/* X TRACKER — COMET family, made flat. Void navy ground, tinted navy shell,
   solid panels on hairlines. Ice = interaction, violet = comparison source,
   ember = detections only, mint/rose = health. Numbers in tabular mono.
   Dark by default (used at night next to trading terminals); light on request. */
:root {
  color-scheme: dark;
  --bg: #070a12;
  --bg-2: #0c111e;
  --shell: #0a0f1c;
  --panel: #0e1424;
  --panel-hi: #151c30;
  --line: rgb(255 255 255 / 0.12);
  --line-soft: rgb(255 255 255 / 0.07);
  --ink: #edf1ff;
  --ink-2: #c4cbe6;
  --muted: #8b94b8;
  --faint: #767fa3;
  --accent: #6ee7f0;
  --accent-ink: #04141a;
  --accent-soft: rgb(110 231 240 / 0.12);
  --violet: #a78bfa;
  --ember: #ffc24b;
  --ember-soft: rgb(255 194 75 / 0.14);
  --good: #4ade80;
  --warn: #fb923c;
  --bad: #fb7185;
  --sim: #c4b5fd;
  --solana: #c084fc;
  --evm: #60a5fa;
  --tron: #f87171;
  --move: #2dd4bf;
  --arrive: rgb(255 194 75 / 0.16);
  --shadow: 0 12px 32px rgb(0 0 0 / 0.5);

  --sans: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --display: "Unbounded", var(--sans);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 8px;
  --r-l: 12px;
  --nav-w: 196px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb;
  --bg-2: #e9edf7;
  --shell: #eef1f9;
  --panel: #ffffff;
  --panel-hi: #f1f4fb;
  --line: rgb(13 18 32 / 0.14);
  --line-soft: rgb(13 18 32 / 0.08);
  --ink: #0d1220;
  --ink-2: #2b3350;
  --muted: #565f80;
  --faint: #636c8c;
  --accent: #0e7c86;
  --accent-ink: #ffffff;
  --accent-soft: rgb(14 124 134 / 0.1);
  --violet: #6d4fd8;
  --ember: #a8670a;
  --ember-soft: rgb(196 125 12 / 0.12);
  --good: #15803d;
  --warn: #c2410c;
  --bad: #be123c;
  --sim: #6d4fd8;
  --solana: #8b3fd9;
  --evm: #2563eb;
  --tron: #dc2626;
  --move: #0f766e;
  --arrive: rgb(196 125 12 / 0.14);
  --shadow: 0 12px 32px rgb(13 18 32 / 0.16);
}

/* ---------------------------------------------------------------- fonts (self-hosted: CSP allows 'self' only) */
@font-face { font-family: "Sora"; src: url("fonts/sora-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrainsmono-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-600-latin.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  font-feature-settings: "ss01";
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: 0.94em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.94em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--panel-hi) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--panel-hi); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
input, textarea { caret-color: var(--accent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.strong { font-weight: 600; }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.clipb { display: block; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-box { padding: 20px 14px; text-align: center; color: var(--muted); }
.clip { display: inline-block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.noscript { padding: 20px; }
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- controls */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea {
  height: 34px; padding: 0 10px; min-width: 0; width: 100%;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
textarea { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: none; }
input[type="color"] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input:user-invalid { border-color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-hi); color: var(--ink);
  cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; flex: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--panel-hi) 70%, var(--ink) 8%); border-color: color-mix(in srgb, var(--ink) 20%, transparent); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--accent-ink); }
.btn.danger-ghost { color: var(--bad); }
.btn.danger-ghost:hover { background: color-mix(in oklch, var(--bad) 10%, var(--panel)); }
.btn.small { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn.tiny { width: 22px; height: 22px; color: var(--muted); }

.check { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; cursor: pointer; user-select: none; color: var(--ink-2); }
.checks { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.radios { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 6px; }
.switch { appearance: none; width: 32px !important; height: 18px !important; border-radius: var(--r-l); background: var(--line); position: relative; cursor: pointer; transition: background-color 120ms; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); transition: transform 120ms; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(14px); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.hint { color: var(--muted); font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.narrow { max-width: 720px; }
.span2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.form-actions.sticky { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line-soft); z-index: 2; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form > input:not([type="color"]) { flex: 1 1 220px; width: auto; }
.inline-form > select { flex: 0 1 200px; width: auto; }

/* ---------------------------------------------------------------- badges */
.tag {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px;
  background: var(--bg-2); color: var(--ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: 0.01em;
  border: 1px solid var(--line-soft);
}
.tag.good { color: var(--good); background: color-mix(in oklch, var(--good) 12%, transparent); border-color: color-mix(in oklch, var(--good) 30%, transparent); }
.tag.bad { color: var(--bad); background: color-mix(in oklch, var(--bad) 12%, transparent); border-color: color-mix(in oklch, var(--bad) 30%, transparent); }
.tag.first { color: var(--accent); background: color-mix(in oklch, var(--accent) 12%, transparent); border-color: color-mix(in oklch, var(--accent) 35%, transparent); }
.tag.repeat { color: var(--muted); background: transparent; }
.tag.sim { color: var(--sim); background: color-mix(in oklch, var(--sim) 10%, transparent); border: 1px dashed var(--sim); letter-spacing: 0.04em; }
.tag.field { font-weight: 500; font-family: var(--mono); font-size: 10.5px; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 3px; }

.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.state[data-tone="good"] i { background: var(--good); }
.state[data-tone="warn"] i { background: var(--warn); border-radius: 1px; transform: rotate(45deg) scale(0.85); }
.state[data-tone="bad"] i { background: var(--bad); border-radius: 1px; }
.state[data-tone="bad"] { color: var(--bad); font-weight: 600; }
.state[data-tone="neutral"] i { background: transparent; border: 1.5px solid var(--faint); }

.chain { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 11.5px; font-weight: 600; --cc: var(--muted); color: var(--cc); }
.chain > span:first-child { padding: 1px 6px; border-radius: 4px; background: color-mix(in oklch, var(--cc) 13%, transparent); }
.chain[data-chain="solana"] { --cc: var(--solana); }
.chain[data-chain="evm"] { --cc: var(--evm); }
.chain[data-chain="tron"] { --cc: var(--tron); }
.chain[data-chain="move"] { --cc: var(--move); }
.hint-tag { color: var(--ink-2); font-weight: 500; font-family: var(--mono); font-size: 11px; }
.hint-tag::before { content: "· "; color: var(--faint); }

.gdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--gc, var(--faint)); margin-right: 6px; vertical-align: -1px; border: 1px solid color-mix(in oklch, var(--ink) 15%, transparent); }

.addr { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; }
.addr > .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr.big { font-size: 14px; gap: 6px; margin-bottom: 8px; }
.ext { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.ext .ico { opacity: 0.8; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.login-brand b { letter-spacing: 0.12em; font-size: 15px; }
.login-brand span { color: var(--muted); font-size: 12px; }
.login-error { margin: 0; padding: 8px 10px; border-radius: var(--r); color: var(--bad); background: color-mix(in oklch, var(--bad) 10%, transparent); border: 1px solid color-mix(in oklch, var(--bad) 30%, transparent); }
.login-setup { margin: 0; padding: 8px 10px; border-radius: var(--r); background: var(--bg-2); color: var(--ink-2); font-size: 12px; }
.login-setup code { display: block; margin-top: 4px; color: var(--ink); word-break: break-all; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 18px; height: 56px; background: var(--shell); border-bottom: 1px solid var(--line-soft); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; flex: none; }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.brand-text b { font-family: var(--display); font-weight: 600; letter-spacing: 0.06em; font-size: 14px; }
.brand-text span { color: var(--faint); font-size: 11px; }
.topbar-spacer { flex: 1; }
.top-user { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16ch; }
.conn { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--muted); background: var(--panel); border: 1px solid var(--line-soft); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn[data-state="on"] { color: var(--good); }
.conn[data-state="on"] i { animation: beat 2.4s var(--ease) infinite; }
.conn[data-state="off"] { color: var(--bad); }
.conn[data-state="off"] i { border-radius: 1px; }
.conn[data-state="connecting"] { color: var(--warn); }
@keyframes beat { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 0; }
.side { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; background: var(--shell); border-right: 1px solid var(--line-soft); overflow-y: auto; }
.side a { display: block; padding: 8px 12px; border-radius: var(--r); color: var(--muted); font-weight: 500; white-space: nowrap; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.side a:hover { background: var(--panel); text-decoration: none; color: var(--ink); }
.side a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.view { overflow: auto; min-width: 0; padding: 20px 24px 48px; outline: none; }

/* ---------------------------------------------------------------- page */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; min-height: 34px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.page-actions select { width: auto; }
.crumb { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); padding: 14px 16px; margin-bottom: 14px; min-width: 0; }
.panel-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head .panel-title { margin: 0; }
.scraper-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: -3px 0 16px; }
.scraper-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.3fr); gap: 16px; }
.scraper-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 20px; margin: 0; }
.scraper-summary dt { grid-row: 1; color: var(--muted); font-size: 11.5px; }
.scraper-summary dd { grid-row: 2; margin: 0; font-size: 15px; color: var(--ink); }
.scraper-profile-list { max-height: 248px; overflow-y: auto; margin: 8px 0; border-block: 1px solid var(--line-soft); }
.scraper-profile { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 35px; padding: 3px 2px; border-bottom: 1px solid var(--line-soft); }
.scraper-profile:last-child { border-bottom: 0; }
.scraper-profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scraper-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; padding: 0; margin: 0; border: 0; }
.scraper-sections legend { padding: 0 0 6px; }
.scraper-sessions { margin-top: 20px; }
.scraper-info { margin: 12px 0 18px; color: var(--muted); font-size: 11.5px; max-width: 75ch; }
.scraper-info summary { cursor: pointer; padding: 3px 0; }
.scraper-info p { margin: 8px 0 0; }
.browser-diagnostic { margin-top: 20px; }
.browser-diagnostic-summary { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 8px 16px; margin: 12px 0; }
.browser-diagnostic-summary dt { color: var(--muted); }
.browser-diagnostic-summary dd { margin: 0; overflow-wrap: anywhere; }
.browser-diagnostic-image { display: block; width: 100%; max-height: 720px; object-fit: contain; object-position: top left; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.scraper-notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); max-width: 75ch; }
@media (max-width: 900px) { .scraper-layout { grid-template-columns: 1fr; gap: 0; } }
@media (max-width: 550px) {
  .scraper-summary { grid-template-columns: 1fr auto; gap: 10px 16px; }
  .scraper-summary dt, .scraper-summary dd { grid-row: auto; }
  .scraper-summary dd { text-align: right; }
  .scraper-sections { grid-template-columns: 1fr; }
  .view[data-view="scraper"] .btn { min-height: 44px; height: auto; padding-block: 8px; }
  .view[data-view="scraper"] .check { min-height: 44px; }
  .view[data-view="scraper"] input:not([type="checkbox"]) { min-height: 44px; }
  .view[data-view="scraper"] .form-actions.sticky { position: static; }
}
.note { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line-soft); background: var(--bg-2); color: var(--ink-2); border-radius: var(--r); font-size: 12.5px; max-width: 110ch; }
.note.inline { margin: 0; display: inline-block; }
.note.bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--ink); }
.warn-box { padding: 8px 11px; border-radius: var(--r); background: color-mix(in oklch, var(--warn) 12%, transparent); border: 1px solid color-mix(in oklch, var(--warn) 35%, transparent); color: var(--ink); }
.ok-box { padding: 8px 11px; border-radius: var(--r); background: color-mix(in oklch, var(--good) 10%, transparent); border: 1px solid color-mix(in oklch, var(--good) 30%, transparent); }
.warn-box ul { margin: 6px 0 0; padding-left: 18px; }
h3.sub { font-size: 12.5px; margin: 16px 0 6px; color: var(--ink-2); font-weight: 650; }
h4 { margin: 0 0 6px; font-size: 12px; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }

.tabs { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 7px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.toolbar > input, .toolbar > select { width: auto; flex: 0 1 200px; }
.toolbar > input[type="search"] { flex: 1 1 200px; max-width: 320px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; border-radius: var(--r); background: color-mix(in oklch, var(--accent) 10%, var(--panel)); border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent); }

.filter-box { margin-bottom: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); }
.filter-box > summary { padding: 9px 14px; cursor: pointer; font-weight: 650; }
.filter-box > .filters { padding: 0 14px 12px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; margin-bottom: 12px; }
.filters.compact { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); padding: 10px 14px; }
.checks-inline { flex-direction: row; flex-wrap: wrap; gap: 0 14px; align-self: center; }
.filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.results { min-width: 0; }
.more { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-l); background: var(--panel); max-width: 100%; }
.panel .table-wrap { border-radius: 6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted); background: var(--panel); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.th-num { text-align: right; }
.tbl td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.empty { text-align: center; color: var(--muted); padding: 22px; }
.tbl td.actions, .tbl th.actions { text-align: right; }
.tbl td.sel, .tbl th.sel { width: 28px; padding-right: 0; }
.row-actions { display: inline-flex; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- live */
/* stats: one quiet row of readings, not a card grid */
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border-block: 1px solid var(--line-soft); margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px 10px 0; min-width: 0; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line-soft); }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val { display: flex; align-items: baseline; gap: 4px; }
.stat-val b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.unit { color: var(--muted); font-size: 11px; }
.stat small, .tile small { color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.src-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line-soft); color: var(--ink-2); transition: border-color 160ms var(--ease); }
.src-chip:hover { text-decoration: none; border-color: var(--line); }

/* ---- signature: the latency rail. Last detection on a ms axis against the 500 ms budget. */
.rail-band { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); padding: 16px 18px 14px; margin-bottom: 14px; }
.rail-band.is-empty { color: var(--muted); }
.rail-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; }
.rail-who { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.rail-ca { font-family: var(--mono); font-size: 12.5px; color: var(--ember); background: var(--ember-soft); padding: 2px 8px; border-radius: 6px; }
.rail-src { font-size: 12px; color: var(--muted); }
.rail-src b { color: var(--ink-2); font-weight: 500; }
.rail-age { margin-left: auto; font-size: 12px; color: var(--faint); }
.rail-head { display: flex; align-items: baseline; gap: 10px; }
.rail-total { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.rail-total.over { color: var(--warn); }
.rail-total small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.rail-caption { font-size: 12px; color: var(--muted); }
.rail { position: relative; height: 54px; margin: 14px 0 4px; }
.rail-axis { position: absolute; left: 0; right: 0; top: 22px; height: 2px; background: var(--line); border-radius: 2px; }
.rail-fill { position: absolute; left: 0; top: 22px; height: 2px; background: var(--accent); border-radius: 2px; transform-origin: left; }
.rail-band.grow .rail-fill { animation: rail-grow 520ms var(--ease) both; }
@keyframes rail-grow { from { transform: scaleX(0); } }
.rail-budget { position: absolute; top: 10px; height: 26px; width: 0; border-left: 1px dashed var(--muted); }
.rail-budget span { position: absolute; top: -14px; left: 4px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.rail-tick { position: absolute; top: 18px; width: 2px; height: 10px; margin-left: -1px; background: var(--faint); opacity: 0.55; border-radius: 1px; }
.rail-mark { position: absolute; top: 15px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.rail-mark.pub { border-color: var(--ink-2); }
.rail-mark.recv { border-color: var(--ember); background: var(--ember); }
.rail-mark.ready { border-color: var(--accent); }
.rail-mark-label { position: absolute; top: 36px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rail-mark-label b { color: var(--ink-2); font-weight: 500; font-family: var(--mono); }
.rail-mark-label.ready { top: -6px; }
.rail-mark-label.ready.below { top: 36px; }
.rail-mark-label.from-left { transform: none; margin-left: -8px; }
.rail-mark-label.from-right { transform: translateX(-100%); margin-left: 8px; }
.rail-race.muted-race { color: color-mix(in srgb, var(--violet) 70%, var(--muted)); }
.rail-fill.hop2 { background: var(--ink-2); animation-delay: 380ms; }
.rail-race { font-size: 12px; color: var(--violet); font-variant-numeric: tabular-nums; }
.rail-scale { position: relative; height: 14px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.rail-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.rail-scale span.first { transform: none; }
.rail-scale span.last { transform: translateX(-100%); }
.rail-note { margin-top: 8px; font-size: 11.5px; color: var(--faint); }

.feed-box { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); overflow: hidden; }
.feed { list-style: none; margin: 0; padding: 0; }
.ev {
  display: grid; align-items: center; column-gap: 12px; padding: 5px 12px; min-height: 40px;
  grid-template-columns: 62px minmax(100px, 1fr) minmax(170px, 1.5fr) minmax(96px, 0.7fr) 40px 64px minmax(80px, 0.9fr) 64px 92px 22px;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.feed .ev { cursor: pointer; content-visibility: auto; contain-intrinsic-size: auto 40px; }
.feed .ev:hover { background: var(--bg-2); }
.feed .ev:last-child { border-bottom: 0; }
.feed-head { min-height: 30px; padding-top: 6px; padding-bottom: 6px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
.feed-head .c4, .ev .c4 { text-align: right; }
.ev > span { min-width: 0; }
.ev .c0 { color: var(--ink-2); }
.ev .c1 { display: flex; flex-direction: column; line-height: 1.25; }
.ev .prof { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-line { display: flex; gap: 5px; align-items: center; min-width: 0; }
.task-name { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .c2 { display: flex; align-items: center; gap: 6px; }
.ev .c6 { display: flex; flex-wrap: wrap; gap: 3px; }
.ev .c9 { text-align: right; }
.ev.is-sim .c0 { color: var(--sim); }
.ev.is-follow { background: color-mix(in oklch, var(--bg-2) 60%, transparent); }
.lat { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.lat-acq { color: var(--muted); font-size: 10.5px; }
.icon-link { padding: 3px; border-radius: 5px; }
.icon-link:hover { background: var(--panel-hi); }
.feed-empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }
.feed-empty p { margin: 4px 0; }
/* a row landing: one short tint, never delays the row */
/* ember marks a detection landing; other rows land quietly in ice */
.ev.arrive:not(.is-follow) { animation: arrive 1400ms ease-out; }
.ev.is-follow.arrive, .log.arrive { animation: arrive-quiet 1400ms ease-out; }
@keyframes arrive { from { background-color: var(--arrive); } to { background-color: transparent; } }
@keyframes arrive-quiet { from { background-color: var(--accent-soft); } to { background-color: transparent; } }

/* ---------------------------------------------------------------- dialogs */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: oklch(0.15 0.02 260 / 0.45); }
.modal { width: min(560px, calc(100vw - 24px)); }
.modal.wide { width: min(860px, calc(100vw - 24px)); }
.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(640px, 100vw); border-radius: 0; border-width: 0 0 0 1px; }
.drawer.wide { width: min(980px, 100vw); }
.dlg-inner { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.drawer .dlg-inner { height: 100dvh; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.dlg-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.dlg-body { padding: 14px; overflow: auto; flex: 1; min-height: 0; }
.dlg-body > p:first-child { margin-top: 0; }
.dlg-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.secret-row { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.secret { flex: 1 1 260px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); word-break: break-all; user-select: all; font-size: 12.5px; }
.secret-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.secret-state input { flex: 1 1 220px; width: auto !important; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; min-width: 0; }
.post-text { white-space: pre-wrap; word-break: break-word; padding: 8px 10px; margin: 0; background: var(--bg-2); border-radius: var(--r); }
.locs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.locs > li { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.locs > li > div { flex-basis: 100%; }
.snippet { white-space: pre-wrap; word-break: break-all; font-size: 12px; color: var(--ink-2); }
mark { background: color-mix(in oklch, var(--accent) 22%, transparent); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.json { margin: 8px 0 0; padding: 10px; background: var(--bg-2); border-radius: var(--r); overflow: auto; max-height: 50vh; font-size: 11.5px; white-space: pre; }
details.raw { margin-top: 14px; }
details.raw > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 14px; bottom: 14px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 28px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 8px; align-items: baseline; padding: 9px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer; word-break: break-word; }
.toast b { flex: none; font-size: 12px; }
.toast.ok { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.toast.ok b { color: var(--good); }
.toast.error { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.toast.error b { color: var(--bad); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.toast.warn b { color: var(--warn); }

/* ---------------------------------------------------------------- tasks */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 14px; align-items: start; }
.side-panel { position: sticky; top: 0; max-height: calc(100dvh - 120px); overflow: auto; }
.task-form { min-width: 0; }
.fs { border: 1px solid var(--line-soft); border-radius: var(--r-l); background: var(--panel); padding: 10px 14px 12px; margin: 0 0 10px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fs legend { padding: 0 4px; font-weight: 650; font-size: 12.5px; }
.fs .hint { margin: 0; }
.scope-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pick-list { max-height: 210px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--r); padding: 4px 8px; margin-top: 6px; }
.pick-list .checks { flex-direction: column; gap: 0; }
.range-row { display: flex; align-items: center; gap: 10px; max-width: 420px; }
.conf-out { min-width: 4ch; text-align: right; font-weight: 650; }
.playground { display: flex; flex-direction: column; gap: 10px; }
.pg-out { min-width: 0; }
.dets { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dets > li { padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--r); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dets > li.rejected { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.det-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.why { color: var(--bad); }

/* ---------------------------------------------------------------- api */
.code-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.code-block { border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; min-width: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 4px 3px 10px; background: var(--bg-2); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.code-block pre { margin: 0; padding: 9px 10px; overflow-x: auto; font-size: 12px; white-space: pre; }

/* ---------------------------------------------------------------- metrics */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); min-width: 0; }
.tile.tone-bad { border-color: var(--bad); }
.tile.tone-warn { border-color: var(--warn); }
.spark { display: block; width: 100%; height: 28px; margin-top: 4px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-base { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-dot { fill: var(--accent); }
.bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line-soft); overflow: hidden; vertical-align: middle; flex: none; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.bad { background: var(--bad); }
.meter-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- logs */
.logs { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-l); font-size: 12px; }
.log { display: grid; grid-template-columns: 92px 44px minmax(80px, 160px) minmax(0, 1fr); column-gap: 10px; padding: 4px 10px; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.log:last-child { border-bottom: 0; }
.log-ts { color: var(--muted); }
.log-lv { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.lv-warn .log-lv { color: var(--warn); }
.lv-error .log-lv { color: var(--bad); }
.lv-error { background: color-mix(in oklch, var(--bad) 6%, transparent); }
.log-scope { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-msg { word-break: break-word; }
.log-data { grid-column: 4; min-width: 0; }
.log-data summary { cursor: pointer; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-data pre { margin: 4px 0; padding: 6px 8px; background: var(--bg-2); border-radius: 5px; overflow: auto; max-height: 300px; font-size: 11px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .ev { grid-template-columns: 62px minmax(90px, 1fr) minmax(150px, 1.4fr) minmax(90px, 0.7fr) 38px minmax(70px, 0.8fr) 62px 86px 22px; }
  .ev .c5 { display: none; }
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n + 4) { border-top: 1px solid var(--line-soft); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px 8px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side a { padding: 6px 10px; flex: none; }
  .side { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
  .side a { padding: 7px 12px; border-radius: 99px; }
  .topbar { height: 52px; padding: 0 14px; gap: 10px; }
  .view { padding: 16px 16px 40px; }
  .grid2, .scope-pick { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .feed-head.ev { display: none; }
  .ev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 12px; }
  .ev .c0 { order: 0; }
  .ev .c1 { order: 1; flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
  .ev .c9 { order: 2; margin-left: auto; }
  .ev .c2 { order: 3; flex-basis: 100%; }
  .ev .c3 { order: 4; }
  .ev .c4 { order: 5; }
  .ev .c4::before { content: "conf "; color: var(--muted); font-family: var(--sans); }
  .ev .c5 { order: 6; display: inline; color: var(--muted); }
  .ev .c6 { order: 7; }
  .ev .c7 { order: 8; }
  .ev .c8 { order: 9; margin-left: auto; }
  .ev .c8 .lat { flex-direction: row; gap: 6px; align-items: baseline; }
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding-block: 8px; }
  .strip .stat small { display: none; }
  #conn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .strip .stat-label { white-space: normal; line-height: 1.25; }
  #conn { padding: 4px 8px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand-text b { font-size: 12.5px; letter-spacing: 0.03em; }
  #logout-btn { padding: 0 8px; }
  .ev.is-follow .c2, .ev.is-follow .c3, .ev.is-follow .c4, .ev.is-follow .c6, .ev.is-follow .c7 { display: none; }
  .stat-val b { font-size: 16px; }
  .rail-band { padding: 14px 14px 12px; }
  .src-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .src-chips::-webkit-scrollbar { display: none; }
  .src-chip { flex: none; }
  .rail-total { font-size: 28px; }
  .rail-age { margin-left: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .log { grid-template-columns: 80px 40px minmax(0, 1fr); }
  .log-msg { grid-column: 1 / -1; }
  .log-data { grid-column: 1 / -1; }
  .top-user { display: none; }
  .brand-text span { display: none; }
  .toolbar > input, .toolbar > select { flex: 1 1 140px; max-width: none; }
  .modal, .modal.wide { width: calc(100vw - 16px); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 1px; }
  .kv dd { margin-bottom: 6px; }
  .page-actions { margin-left: 0; }
}
@media (max-width: 420px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 8px 10px; }
  .filters { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
