:root {
  --bg: #0e0f11;
  --surface: #16181b;
  --raised: #1d2024;
  --line: rgba(255, 255, 255, 0.08);
  --text: #ececee;
  --text-2: #a3a7ad;
  --muted: #6d7279;
  --accent: #5cc8d7;
  --accent-ink: #0b1a1d;
  --good: #4cc38a;
  --bad: #ef6b6f;
  --warn: #e2b34c;
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
.boot { padding: 48px; color: var(--muted); }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 20px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 4px 10px 20px; }
.logo i { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--accent); }
.nav { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--text-2); }
.nav:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; flex: none; }
.side .grow { flex: 1; }
.queue { font-size: 12px; color: var(--muted); padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.queue .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
main { padding: 28px 32px 64px; max-width: 1280px; width: 100%; }
h1 { font-size: 22px; font-weight: 500; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; }
.sub { color: var(--text-2); margin: 0 0 24px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* blocks */
.grid { display: grid; gap: 16px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.label { color: var(--text-2); font-size: 13px; }
.big { font-size: 32px; font-weight: 500; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.empty { color: var(--text-2); padding: 8px 0; }

/* buttons, inputs */
.btn { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 255, 255, 0.18); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 500; }
.btn.ghost { background: transparent; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, .nav:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; height: 34px; min-width: 0; }
textarea { padding: 10px 12px; height: 120px; width: 100%; resize: vertical; font-family: var(--mono); font-size: 12px; }
input.grow { flex: 1; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { color: var(--text-2); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 0 12px 8px 0; }
td { padding: 9px 12px 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }
.url { font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* AI matrix */
.cell { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 12px; font-family: var(--mono); }
.cell.yes { color: var(--good); border-color: rgba(76, 195, 138, 0.35); }
.cell.no { color: var(--muted); }
.cell.err { color: var(--bad); }
.answer { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; max-height: 420px; overflow: auto; font-size: 13px; }
.answer mark { background: rgba(92, 200, 215, 0.25); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* bars */
.bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text-2); }
.bar.accent i { background: var(--accent); }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 64px; }
.trend span { flex: 1; background: var(--raised); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.trend span.last { background: var(--accent); }

/* words */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); max-width: 100%; }
.chip span { overflow-wrap: anywhere; }
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: 6px; }
.chip button:hover { color: var(--bad); background: var(--bg); }
.list .chip { display: flex; justify-content: space-between; width: 100%; }

/* key status */
.status { font-size: 12px; font-family: var(--mono); }
.status.set { color: var(--good); }
.status.unset { color: var(--muted); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth form { width: 100%; max-width: 360px; }
.auth .logo { padding: 0 0 24px; font-size: 18px; }
.err-text { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 8px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--raised); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .logo { padding: 0 12px 0 0; }
  .side .grow, .queue { display: none; }
  .nav { flex: none; }
  main { padding: 20px 16px 48px; }
  .g3, .g2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
