:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: #090b10;
  color: #f4f6fb;
  --surface: #11141c;
  --surface-2: #171b25;
  --line: #252b39;
  --muted: #8f98aa;
  --accent: #7657ff;
  --accent-2: #9b87ff;
  --danger: #ff637d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, #191535 0, transparent 35%),
    #090b10;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 13px;
  background: var(--surface-2);
  color: #f4f6fb;
  cursor: pointer;
}

button:hover {
  border-color: #484f64;
  background: #202534;
}

button.primary {
  border-color: transparent;
  background: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-2);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  background: #0b0e14;
  color: #f4f6fb;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(118 87 255 / 18%);
}

label {
  display: grid;
  gap: 7px;
  color: #c7cdda;
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.eyebrow {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(17 20 28 / 92%);
  box-shadow: 0 30px 80px rgb(0 0 0 / 40%);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), #bd62ff);
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(9 11 16 / 88%);
  backdrop-filter: blur(14px);
}

.topbar > div:first-child {
  display: flex;
  gap: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  display: grid;
  min-height: calc(100vh - 64px);
  grid-template-columns: 350px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgb(13 16 23 / 82%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 15px;
}

.sidebar-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.icon-button {
  min-width: 36px;
  padding: 7px 10px;
  font-size: 18px;
}

.tree {
  padding: 0 10px 24px;
}

.tree-item {
  margin: 2px 0;
}

.tree-row {
  display: flex;
  min-height: 45px;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
}

.tree-row:hover {
  background: var(--surface-2);
}

.tree-icon {
  width: 20px;
  color: var(--accent-2);
  text-align: center;
}

.tree-label {
  display: grid;
  min-width: 0;
  flex: 1;
}

.tree-label strong,
.tree-label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-label strong {
  font-size: 14px;
}

.tree-label small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.tree-actions {
  display: none;
  gap: 4px;
}

.tree-row:hover .tree-actions {
  display: flex;
}

.tree-action {
  padding: 4px 7px;
  font-size: 11px;
}

.tree-children {
  margin-left: 17px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.tree-empty {
  padding: 15px;
  color: var(--muted);
  font-size: 13px;
}

.content {
  padding: 42px;
}

.empty-state {
  display: grid;
  max-width: 560px;
  min-height: 65vh;
  align-content: center;
}

.empty-state h1 {
  margin: 10px 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

.empty-icon {
  color: var(--accent-2);
  font-size: 42px;
}

#details-panel h1 {
  margin: 8px 0;
  font-size: 36px;
}

.action-row {
  display: flex;
  gap: 10px;
  margin: 24px 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  display: grid;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

dialog {
  width: min(520px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: #f4f6fb;
  box-shadow: 0 30px 100px #000;
}

dialog::backdrop {
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(4px);
}

dialog form,
#secret-dialog {
  padding: 24px;
}

dialog form {
  display: grid;
  gap: 18px;
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-header h2 {
  margin: 5px 0 0;
}

.dialog-actions {
  justify-content: flex-end;
}

#webhook-url {
  margin-top: 7px;
  resize: none;
}

@media (max-width: 800px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 26px 20px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  #current-user {
    display: none;
  }
}

[hidden] {
  display: none !important;
}

.dashboard {
  width: min(1050px, 100%);
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  margin: 7px 0;
  font-size: 36px;
}

.live-status {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.live-status.connected {
  border-color: rgb(61 211 153 / 35%);
  background: rgb(61 211 153 / 8%);
  color: #57dda9;
}

.log-list {
  display: grid;
  gap: 12px;
}

.log-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(17 20 28 / 88%);
}

.log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.log-source {
  display: grid;
  gap: 3px;
}

.log-source span,
.log-header time {
  color: var(--muted);
  font-size: 12px;
}

.log-content {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.embed-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 13px 15px;
  border-left: 4px solid var(--accent);
  border-radius: 4px 10px 10px 4px;
  background: #0c0f16;
}

.embed-box p {
  margin: 0;
  color: #cbd1de;
  white-space: pre-wrap;
}

.embed-fields {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(180px, 1fr)
  );
  gap: 10px;
  margin-top: 5px;
}

.embed-fields > div {
  display: grid;
  gap: 4px;
  padding: 9px;
  border-radius: 8px;
  background: #131722;
}

.embed-fields span {
  color: var(--muted);
  white-space: pre-wrap;
}

.log-empty {
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  text-align: center;
}

.dashboard-button {
  border-color: rgb(118 87 255 / 45%);
  background: rgb(118 87 255 / 12%);
  color: #c7bcff;
}

.dashboard-button:hover {
  border-color: var(--accent);
  background: rgb(118 87 255 / 22%);
}

.danger-button {
  border-color: rgb(255 99 125 / 35%);
  background: rgb(255 99 125 / 8%);
  color: #ff8da0;
}

.danger-button:hover {
  border-color: var(--danger);
  background: rgb(255 99 125 / 18%);
}
