/* Tunnex web console — the landing's wire-trace identity, tuned for a daily tool.
   Ink on paper, one signal colour, hairline rules, Archivo + IBM Plex Mono.
   Signal orange is a fill; orange text uses --signal-ink. No gradients, glows or blur. */

/* ===== TOKENS ===== */
:root {
  /* palette (same values as landing/styles.css) */
  --paper: #f1eee4;
  --paper-2: #e8e4d8;
  --slip: #fbfaf5;
  --ink: #141414;
  --signal: #ff4d00;          /* fills only; ink text on top (5.5:1) */

  /* semantic, light */
  --bg: var(--paper);
  --bg-2: var(--paper-2);
  --surface: var(--slip);
  --fg: var(--ink);
  --muted: #5c5850;           /* 6.1:1 on paper */
  --hair: #cbc5b5;
  --rule: var(--ink);
  --signal-ink: #b53600;      /* orange text on paper (5.2:1) */
  --on-signal: var(--ink);
  --tint: rgba(20, 20, 20, .045);
  --signal-tint: rgba(255, 77, 0, .09);
  --input-bg: var(--slip);
  --input-border: #8a8478;

  /* inverse slabs: commands, toasts, primary buttons */
  --inv-bg: var(--ink);
  --inv-fg: var(--paper);
  --inv-muted: #9a958a;       /* 6.2:1 on ink */
  --inv-hair: #3a3833;
  --code-bg: var(--ink);
  --code-border: var(--ink);

  --display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --text: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 232px;
  --gutter: clamp(16px, 3.2vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --bg-2: #1c1b19;
    --surface: #1a1917;
    --fg: #f1eee4;            /* 15.6:1 on ink */
    --muted: #a39e92;         /* 7.0:1 on ink */
    --hair: #3a3833;
    --rule: #b9b4a6;
    --signal-ink: #ff6a29;    /* 6.4:1 on ink */
    --on-signal: #141414;
    --tint: rgba(241, 238, 228, .05);
    --signal-tint: rgba(255, 77, 0, .14);
    --input-bg: #0e0e0d;
    --input-border: #6b675e;

    --inv-bg: #f1eee4;
    --inv-fg: #141414;
    --inv-muted: #5c5850;
    --inv-hair: #cbc5b5;
    --code-bg: #0a0a09;
    --code-border: #3a3833;
    color-scheme: dark;
  }
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--signal);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .mono { font-family: var(--mono); font-size: .9em; }
::selection { background: var(--signal); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 1000;
  padding: 10px 14px; background: var(--inv-bg); color: var(--inv-fg);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; color: var(--fg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.noscript { padding: 24px; text-align: center; color: var(--muted); }

/* Inline code in prose */
p code, li code, dd code, .card__note code {
  font-size: .86em;
  padding: 0 .3em;
  background: var(--tint);
  overflow-wrap: anywhere;
}

/* ===== BOOT ===== */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }

/* ===== BRAND ===== */
.logo { display: block; }
.logo__tile { fill: var(--fg); }
.logo__glyph { fill: var(--bg); }
.logo__byte { fill: var(--signal); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; }
.brand__text {
  font-family: var(--display);
  font-stretch: 68%;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: .01em;
  text-transform: uppercase;
  line-height: 1;
}
.brand__tag {
  font-family: var(--mono); font-size: 11px; line-height: 1.4;
  border: 1px solid var(--fg); padding: 1px 6px;
}

/* ===== FRAME LABEL ===== */
.frame-label {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  margin-bottom: 8px;
  font-family: var(--mono); font-size: 12px; line-height: 1.4;
  color: var(--muted); letter-spacing: .03em;
}
.frame-label__hex b { color: var(--signal-ink); font-weight: 600; }
.frame-label__type { color: var(--fg); font-weight: 600; }
.frame-label__name::before { content: "· "; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 16px;
  border: 1px solid var(--fg); border-radius: 0;
  background: transparent; color: var(--fg);
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn:disabled:hover { background: transparent; color: var(--fg); }
.btn--primary { background: var(--fg); color: var(--bg); }
.btn--primary:hover { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn--primary:disabled:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn--danger:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn--danger-ghost { color: var(--signal-ink); border-color: var(--signal-ink); }
.btn--danger-ghost:hover { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn--danger-ghost:disabled:hover { background: transparent; color: var(--signal-ink); border-color: var(--signal-ink); }
.btn--sm { min-height: 30px; padding: 4px 11px; font-size: 13px; }
.btn--block { width: 100%; }
.btn .icon { flex: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid transparent; background: transparent; color: var(--fg);
}
.icon-btn:hover { border-color: var(--fg); }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--fg); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: currentColor; }

/* Copy buttons read like the landing's "copy" tag */
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 2px 7px;
  border: 1px solid var(--fg); background: transparent; color: var(--fg);
  font-family: var(--mono); font-size: 11px; font-weight: 500; line-height: 1.5;
  text-transform: uppercase; letter-spacing: .06em;
}
.copy-btn .icon { display: none; }
.copy-btn:hover, .copy-btn.is-copied { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }

/* ===== FOCUS LAYOUT (login, signup, device) ===== */
.focus { min-height: 100vh; display: flex; flex-direction: column; }
.focus__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.focus__main { flex: 1; display: grid; place-items: start center; padding: clamp(24px, 7vh, 72px) 16px 40px; }
.focus__foot {
  display: flex; gap: 8px 24px; justify-content: center; flex-wrap: wrap;
  padding: 16px; border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.focus__foot a { color: var(--fg); }

.card.auth {
  width: min(440px, 100%);
  padding: clamp(20px, 5vw, 30px);
  border: 1px solid var(--rule);
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--rule);
}
.auth .frame-label { padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--hair); }
.auth__title {
  font-family: var(--display); font-stretch: 72%; font-weight: 800;
  font-size: 36px; line-height: .98; letter-spacing: -.01em;
  margin-bottom: 10px;
}
.auth__lead { margin-bottom: 22px; }
.auth__switch { margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth__switch a { color: var(--fg); font-weight: 600; }
.auth__who { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--hair); color: var(--muted); font-size: 13px; }
.auth__who strong { color: var(--fg); font-weight: 600; word-break: break-all; }
.auth__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.auth__actions .btn { flex: 1 1 140px; }
.auth .cmd { margin-top: 14px; }

.divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  font-family: var(--mono); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hair); }

.result { padding: 4px 0; }
.result__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border: 1px solid var(--fg); }
.result--success .result__icon { background: var(--fg); color: var(--bg); }
.result--error .result__icon { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.result--warn .result__icon { color: var(--signal-ink); border-color: var(--signal-ink); }
.result__title {
  font-family: var(--display); font-stretch: 82%; font-weight: 800;
  font-size: 22px; line-height: 1.1; margin-bottom: 6px;
}

/* ===== APP LAYOUT ===== */
.app { min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 0 16px;
  border-bottom: 1px solid var(--rule);
}
.sidebar__close { display: none; margin-left: auto; }

.nav { display: flex; flex-direction: column; padding: 12px 0; }
.nav__link {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 16px;
  color: var(--fg); font-weight: 500; font-size: 14.5px; text-decoration: none;
  border: 0; background: none; text-align: left;
  transition: background .12s;
}
.nav__link .icon { flex: none; color: var(--muted); }
.nav__label { flex: 1; min-width: 0; }
.nav__code { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.nav__link:hover { background: var(--tint); }
.nav__link:hover .nav__label { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.nav__link:focus-visible { outline-offset: -2px; }
.nav__link.is-active { background: var(--surface); box-shadow: inset 3px 0 0 var(--signal); font-weight: 700; }
.nav__link.is-active .icon { color: var(--fg); }
.nav__link.is-active .nav__code { color: var(--signal-ink); font-weight: 600; }

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 0 10px; border-top: 1px solid var(--rule); }
.sidebar__foot .badge { align-self: flex-start; margin: 0 16px 4px; }
.account { display: flex; align-items: center; gap: 10px; padding: 4px 16px 6px; min-width: 0; }
.account__avatar {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--fg); color: var(--bg);
  font-family: var(--mono); font-size: 13px; font-weight: 600;
}
.account__text { display: flex; flex-direction: column; min-width: 0; }
.account__email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.scrim { display: none; }

.app__body { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; width: 100%; min-width: 0; max-width: 1200px; padding: 28px var(--gutter) 64px; }
.banner-slot:empty { display: none; }
.banner-slot { padding: 20px var(--gutter) 0; max-width: 1200px; }
.banner {
  display: flex; align-items: flex-start; gap: 10px 12px; flex-wrap: wrap;
  padding: 11px 14px 11px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  box-shadow: inset 4px 0 0 var(--signal);
}
.banner > .icon { color: var(--signal-ink); flex: none; margin-top: 1px; }
.banner__text { flex: 1 1 260px; font-size: 13.5px; }
.banner__text strong { font-weight: 700; }
.banner__actions { flex: none; }

/* ===== PAGE ===== */
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page__heading { min-width: 0; }
.page__title {
  font-family: var(--display); font-stretch: 70%; font-weight: 800;
  font-size: 46px; line-height: .92; letter-spacing: -.012em;
}
.page__lead { margin-top: 10px; color: var(--muted); max-width: 64ch; }
.page__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page__body { display: flex; flex-direction: column; gap: 36px; }
.page__body > div:empty { display: none; }
.page--notfound .page__cta { margin-top: 24px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 32px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card--wide { grid-column: 1 / -1; }

/* Cards are ruled panels: a heavy top rule, no box */
.card {
  position: relative; min-width: 0;
  border-top: 2px solid var(--rule);
  padding-top: 12px;
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title {
  font-family: var(--display); font-stretch: 82%; font-weight: 800;
  font-size: 20px; line-height: 1.15; letter-spacing: -.005em;
}
.card__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card__link { font-size: 13px; font-weight: 600; white-space: nowrap; }
.card__note { margin-top: 16px; font-size: 13px; color: var(--muted); }
.card__note a { color: var(--fg); }
.card > .cmd + .cmd { margin-top: 8px; }
.card > p + .cmd { margin-top: 12px; }

/* ===== COMMANDS ===== */
.steps { counter-reset: step; border-bottom: 1px solid var(--hair); }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 34px minmax(0, 1fr); row-gap: 6px;
  padding: 12px 0; border-top: 1px solid var(--hair);
}
.steps li::before {
  content: counter(step, decimal-leading-zero); grid-row: 1 / span 2;
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--signal-ink); line-height: 1.5;
}
.steps__label { font-size: 13.5px; }

.cmd {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 9px 9px 9px 14px;
  background: var(--code-bg); color: #f1eee4;
  border: 1px solid var(--code-border);
}
.cmd .cmd__text { flex: 1; min-width: 0; overflow-x: auto; white-space: pre; font-size: 13px; scrollbar-width: thin; color: #f1eee4; background: none; padding: 0; overflow-wrap: normal; }
.cmd__prompt { color: var(--signal); font-weight: 600; user-select: none; }
.cmd__comment { color: #9a958a; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.cmd .copy-btn { border-color: #5c5850; color: #b9b4a6; }
.cmd .copy-btn:hover, .cmd .copy-btn.is-copied { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.cmd :focus-visible { outline-color: var(--signal); }

/* ===== STATS ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.stats--row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { min-width: 0; padding: 2px 16px 4px; border-left: 1px solid var(--hair); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat__label {
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.stat__value {
  font-family: var(--display); font-stretch: 75%; font-weight: 800;
  font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat__sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.big-number {
  font-family: var(--display); font-stretch: 72%; font-weight: 800;
  font-size: 52px; line-height: 1; margin-bottom: 14px; font-variant-numeric: tabular-nums;
}
.big-number__of { font-size: 26px; color: var(--muted); font-weight: 600; }

.mini-list { border-bottom: 1px solid var(--hair); }
.mini-list li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 0; border-top: 1px solid var(--hair); font-size: 13.5px; }
.mini-list .ext-link { min-width: 0; flex: 1; }
.mini-list .ext-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .status { font-size: 0; gap: 0; }

/* ===== BADGES, STATUS ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; line-height: 1.7; white-space: nowrap;
  border: 1px solid var(--hair); background: transparent; color: var(--fg);
}
.badge--outline { color: var(--muted); border-style: dashed; border-color: var(--muted); }
/* Tunnel modes: plain protocols outlined, AI modes filled */
.badge--cyan, .badge--amber, .badge--green { border-color: var(--fg); font-weight: 600; letter-spacing: .04em; }
.badge--violet, .badge--pink { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; letter-spacing: .04em; }
.badge--warn { background: var(--signal); border-color: var(--signal); color: var(--on-signal); font-weight: 600; }

.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.status__dot { width: 9px; height: 9px; flex: none; border: 1.5px solid var(--muted); }
.status--online { color: var(--fg); }
.status--online .status__dot { background: var(--signal); border-color: var(--signal); }
.dot-live { display: inline-block; width: 7px; height: 7px; margin-left: 8px; background: var(--signal); vertical-align: middle; }

.live-indicator { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.live-indicator__dot { width: 8px; height: 8px; background: var(--signal); animation: blink 2s steps(1) infinite; }
.live-indicator.is-stale .live-indicator__dot { background: transparent; border: 1.5px solid var(--muted); animation: none; }

.pill {
  display: inline-flex; align-items: center; padding: 3px 10px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1px solid var(--fg); color: var(--fg);
}
.pill:empty { display: none; }
.pill--warn { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== KEY / VALUE ===== */
.kv { margin: 4px 0 18px; border-bottom: 1px solid var(--hair); }
.kv > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--hair); }
.kv dt, .kv--grid dt {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv--grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px;
  margin: 14px 0; padding: 12px 0 0; border-top: 1px solid var(--hair); border-bottom: 0;
}
.kv--grid > div { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; }
.kv--grid dd { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.kv--grid .kv__wide { grid-column: 1 / -1; }

.ports { display: flex; flex-direction: column; gap: 6px; }
.port { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.port__proto { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--signal-ink); letter-spacing: .05em; width: 30px; }
.port code { overflow-wrap: anywhere; }

/* ===== TUNNELS ===== */
.tunnel-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.tunnel {
  padding: 14px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.tunnel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tunnel__title { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.tunnel__title .status { font-size: 0; gap: 0; }
.tunnel__url {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--fg);
  text-decoration: none; overflow-wrap: anywhere;
}
.tunnel__url:hover span { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tunnel__url .icon { color: var(--muted); flex: none; }
.ext-link { display: inline-flex; align-items: center; gap: 5px; color: var(--fg); text-decoration: none; }
.ext-link .icon { color: var(--muted); flex: none; }
.ext-link:hover span { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ===== DOMAINS ===== */
.domain-list { display: flex; flex-direction: column; border-bottom: 1px solid var(--hair); }
.domain { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--hair); }
.domain:first-child { border-top: 0; padding-top: 2px; }
.domain__main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.domain__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.domain__title .ext-link { font-family: var(--mono); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.domain__meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--muted); }

/* ===== DATASHEET TABLES ===== */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; border-bottom: 1px solid var(--rule); }
.table th, .table td { padding: 8px 14px; text-align: left; vertical-align: baseline; border-top: 1px solid var(--hair); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.table--wrap tbody th { white-space: normal; }
.table thead th {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  border-top: 0; border-bottom: 1px solid var(--rule);
  padding-top: 4px; padding-bottom: 7px;
}
.table thead th.num { font-size: 11px; }
.table tbody tr:first-child th, .table tbody tr:first-child td { border-top: 0; }
.table tbody th { font-weight: 600; }
.table tbody tr:hover { background: var(--tint); }
.table tfoot th, .table tfoot td { font-weight: 700; border-top: 1px solid var(--rule); }
.table tr.is-zero td { color: var(--muted); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tbody tr:hover th:first-child, .table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--signal); padding-left: 10px; }
.table code { background: none; padding: 0; }

/* ===== FORMS ===== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form--inline { flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.form--inline .field { flex: 1 1 260px; }
.form__submit { padding-top: 23px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
/* A <span> label carries user data (e.g. a token name): keep its case. */
span.field__label { text-transform: none; letter-spacing: .02em; font-size: 12px; }
.field__hint { font-size: 12.5px; color: var(--muted); }
.field__error { font-size: 12.5px; font-weight: 600; color: var(--signal-ink); }
.field__error::before { content: "ERR "; content: "ERR " / ""; font-family: var(--mono); font-size: 11px; }
.field__error:empty { display: none; }
.input {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--input-border); border-radius: 0;
  background: var(--input-bg); color: var(--fg);
  transition: border-color .12s;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--fg); }
.input:focus, .input:focus-visible { border-color: var(--fg); outline: none; box-shadow: inset 0 0 0 1px var(--fg), inset 0 -3px 0 var(--signal); }
.input[aria-invalid="true"] { border-color: var(--signal-ink); box-shadow: inset 3px 0 0 var(--signal); }
.input[aria-invalid="true"]:focus { box-shadow: inset 0 0 0 1px var(--signal-ink), inset 3px 0 0 var(--signal); }
.input:disabled { opacity: .5; cursor: not-allowed; }
.input--code { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: .14em; text-align: center; text-transform: uppercase; }
.input--mono { font-family: var(--mono); font-size: 13px; }
.input-group { display: flex; align-items: stretch; gap: 0; min-width: 0; }
.input-group .input { flex: 1; min-width: 0; }
.input-group > :not(:first-child) { margin-left: -1px; }
.input-group .copy-btn { padding: 0 12px; border-color: var(--fg); }
.input-addon {
  flex: none; padding: 0 12px;
  border: 1px solid var(--fg); background: transparent; color: var(--fg);
  font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}
.input-addon:hover { background: var(--fg); color: var(--bg); }
.input-suffix {
  display: inline-flex; align-items: center; padding: 0 12px;
  border: 1px solid var(--input-border);
  background: var(--bg-2); color: var(--muted); font-family: var(--mono); font-size: 13px; white-space: nowrap;
}
.input-group--suffix .input:focus { position: relative; z-index: 1; }
.form-error { font-size: 13.5px; }
.form-error:not(:empty) { padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--signal-ink); box-shadow: inset 4px 0 0 var(--signal); }

.callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px 10px 14px; margin-bottom: 14px; font-size: 13.5px;
  background: var(--bg-2);
}
.callout .icon { flex: none; margin-top: 1px; }
.callout--warn { box-shadow: inset 4px 0 0 var(--signal); }
.callout--warn .icon { color: var(--signal-ink); }
.callout--info { box-shadow: inset 4px 0 0 var(--fg); }

/* ===== STATES ===== */
.loading { display: flex; align-items: center; gap: 10px; padding: 16px 0; color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
/* A blinking signal cursor stands in for a spinner */
.spinner { width: 9px; height: 16px; flex: none; background: var(--signal); animation: blink 1s steps(1) infinite; }
.boot .spinner { width: 12px; height: 20px; }
.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px 20px; border: 1px dashed var(--muted);
}
.empty__title { font-family: var(--display); font-stretch: 82%; font-weight: 800; font-size: 18px; }
.empty__text { color: var(--muted); font-size: 13.5px; max-width: 60ch; }
.empty .cmd { margin-top: 10px; width: min(380px, 100%); }
.inline-error {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px 10px 14px; font-size: 13.5px;
  background: var(--bg-2); border: 1px solid var(--signal-ink); box-shadow: inset 4px 0 0 var(--signal);
}
.inline-error .icon { color: var(--signal-ink); flex: none; }
.inline-error span { flex: 1 1 200px; }

/* ===== SEGMENTED CONTROL ===== */
.seg { display: inline-flex; border: 1px solid var(--fg); }
.seg__btn {
  padding: 5px 12px; border: 0; background: transparent; color: var(--fg);
  font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.seg__btn + .seg__btn { border-left: 1px solid var(--fg); }
.seg__btn:hover { background: var(--tint); }
.seg__btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.seg__btn:focus-visible { outline-offset: 1px; }

/* ===== CHART ===== */
.chart { position: relative; }
.chart__plot { width: 100%; }
.chart__svg { display: block; overflow: visible; }
.chart__gridline { stroke: var(--hair); stroke-width: 1; stroke-dasharray: 2 3; }
.chart__baseline { stroke: var(--rule); stroke-width: 1; }
.chart__axis { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart__empty { fill: var(--muted); font-size: 12px; font-family: var(--mono); }
.chart__hit { fill: transparent; }
.chart__mark { fill: var(--fg); transition: fill .1s, opacity .1s; }
.chart__zero { fill: var(--muted); }
.chart__svg.is-hovering .chart__bar:not(.is-active) .chart__mark { opacity: .55; }
.chart__bar.is-active .chart__mark { fill: var(--signal); opacity: 1; }
.chart__bar.is-active .chart__hit { fill: var(--signal-tint); }
.chart__bar:focus { outline: none; }
.chart__bar:focus-visible .chart__hit { fill: var(--signal-tint); stroke: var(--fg); stroke-width: 1.5; }
.chart__tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px;
  padding: 7px 10px;
  background: var(--surface); border: 1px solid var(--rule);
  box-shadow: 4px 4px 0 var(--rule);
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
}
.chart__tip-title { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.chart__tip-value { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.chart__tip-detail { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ===== MODAL ===== */
.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 1px solid var(--rule); border-radius: 0;
  background: var(--surface); color: var(--fg);
  box-shadow: 8px 8px 0 var(--rule);
}
.modal--sm { width: min(440px, calc(100vw - 24px)); }
.modal--md { width: min(580px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(20, 20, 20, .5); }
.modal[open] { animation: pop .14s ease-out; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--rule);
}
.modal__title {
  font-family: var(--display); font-stretch: 78%; font-weight: 800;
  font-size: 24px; line-height: 1.05;
}
.modal__body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal__body .callout { margin-bottom: 4px; }
.modal__note { color: var(--muted); font-size: 13.5px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ===== TOASTS ===== */
.toasts {
  position: fixed; z-index: 2000; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 8px 11px 16px;
  background: var(--inv-bg); color: var(--inv-fg);
  font-size: 13.5px; animation: toast-in .16s ease-out;
}
.toast > .icon { flex: none; margin-top: 1px; color: var(--inv-muted); }
.toast--success > .icon { color: var(--inv-fg); }
.toast--error { box-shadow: inset 4px 0 0 var(--signal); }
.toast--error > .icon { color: var(--signal); }
.toast__msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast__close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: -2px 0; padding: 0; border: 1px solid transparent; background: transparent; color: var(--inv-muted); }
.toast__close:hover { color: var(--inv-fg); border-color: var(--inv-hair); }
.toast :focus-visible { outline-color: var(--signal); }
.toast--leaving { opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }

/* ===== KEYFRAMES ===== */
@keyframes blink { 50% { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 8px;
    min-height: 56px; padding: 0 12px 0 6px;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
  }
  .topbar .brand__text { font-size: 24px; }
  .topbar__spacer { flex: 1; }
  .sidebar {
    width: min(280px, 84vw); transform: translateX(-102%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    z-index: 60;
  }
  .sidebar__close { display: inline-grid; }
  .drawer-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 20, 20, .5); }
  .drawer-open { overflow: hidden; }
  .app__body { margin-left: 0; }
  .content { padding-top: 22px; }
  .banner-slot { padding-top: 14px; }
  .page__title { font-size: 40px; }
}

@media (max-width: 720px) {
  .grid, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .stats--row { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .stats--row .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .page__title { font-size: 36px; }
  .page__head { align-items: flex-start; margin-bottom: 22px; }
  .page__body { gap: 30px; }
  .form__submit { padding-top: 0; width: 100%; }
  .form__submit .btn { width: 100%; }
  .domain { flex-direction: column; align-items: stretch; }
  .domain .btn { align-self: flex-start; }
  .cmd__comment { display: none; }
  .big-number { font-size: 44px; }
}

@media (max-width: 420px) {
  body { font-size: 14px; }
  .brand__tag { display: none; }
  .sidebar .brand__tag { display: inline-block; }
  .frame-label { font-size: 11px; gap: 2px 8px; }
  .page__title { font-size: 34px; }
  .auth__title { font-size: 30px; }
  .table th, .table td { padding: 8px 10px; }
  .tunnel { padding: 12px 14px 14px; }
  .stat { padding: 2px 10px 4px; }
  .stat__value { font-size: 26px; }
  .kv--grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
  .kv > div { grid-template-columns: 80px minmax(0, 1fr); }
  .toasts { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .modal__actions .btn { flex: 1 1 auto; }
  .card.auth { box-shadow: 5px 5px 0 var(--rule); }
}
