/* EonLink design system «Трасса 2.0» — shared by the router UI and the fleet panel.
   The router is an instrument: you see where traffic goes and where it broke.
   Graphite and aluminium; colour only where something needs attention.
   Yellow is the fiber: the route line that packets run along while the tunnel works.
   Numbers are set in a monospace face, like the readout of a device.

   Motion: transform and opacity only; one ease-out curve; exits are faster than entries;
   hover effects only on devices that hover; reduced motion keeps colour and drops movement. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/golos-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/golos-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/jbmono-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/jbmono-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+FEFF, U+FFFD; }

/* ======================================================================================
   tokens
   ====================================================================================== */
:root {
  color-scheme: light;
  --bg: #f2f3f5;
  --side-bg: #eceef1;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #e9ebee;
  --border: #e4e6ea;
  --border-strong: #d3d7dd;
  --text: #111316;          /* 18.9:1 on white */
  --text-2: #474d57;        /* 8.6:1 */
  --text-3: #69707b;        /* 5.1:1 */
  --accent: #111316;        /* graphite: links, switches, focus */
  --accent-hover: #2a2e35;
  --accent-ink: #ffffff;
  --accent-soft: #eceef1;
  --accent-strong: #111316;
  --ink-btn: #111316;
  --ink-btn-hover: #2a2e35;
  --ink-btn-text: #ffffff;
  --fiber: #f2b53a;         /* the route line; never text on white */
  --fiber-line: #e0a21f;    /* chart strokes on white */
  --fiber-soft: #fdf3dc;
  --fiber-ink: #7a5200;     /* text on --fiber-soft, 8.1:1 */
  --packet: #ffffff;
  --ok: #157a44;            /* 5.4:1 */
  --ok-led: #22a25c;
  --ok-soft: #e2f3e9;
  --warn: #8a5600;          /* 6.2:1 */
  --warn-soft: #fdf1dc;
  --bad: #c43030;           /* 5.5:1 */
  --bad-soft: #fbe8e8;
  --idle: #69707b;
  --idle-soft: #eceef1;
  --focus: #111316;
  --halo: rgba(242, 181, 58, 0.38);
  --shadow-1: 0 1px 2px rgba(17, 19, 22, 0.04), 0 4px 16px rgba(17, 19, 22, 0.04);
  --shadow-2: 0 2px 6px rgba(17, 19, 22, 0.06), 0 12px 32px rgba(17, 19, 22, 0.10);
  --shadow-3: 0 30px 80px rgba(17, 19, 22, 0.22);
  --scrim: rgba(11, 13, 16, 0.42);
  --chart-line: #e0a21f;
  --chart-fill: rgba(242, 181, 58, 0.14);
  --grid: #eceef1;
  --glass: rgba(246, 247, 249, 0.78);

  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 18px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --t-press: 140ms;
  --t-fast: 150ms;
  --t-med: 220ms;
  --t-slow: 280ms;
  --t-exit: 150ms;
  --z-sticky: 20;
  --z-nav: 40;
  --z-modal: 100;
  --z-toast: 1000;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d10; --side-bg: #0f1215; --surface: #14171c; --surface-2: #1a1e24; --surface-3: #232830;
    --border: #242931; --border-strong: #323842;
    --text: #eceef1; --text-2: #a6adb7; --text-3: #7f8792;
    --accent: #eceef1; --accent-hover: #ffffff; --accent-ink: #0b0d10; --accent-soft: #20252c; --accent-strong: #eceef1;
    --ink-btn: #eceef1; --ink-btn-hover: #ffffff; --ink-btn-text: #0b0d10;
    --fiber: #f5be4a; --fiber-line: #f5be4a; --fiber-soft: rgba(245, 190, 74, 0.14); --fiber-ink: #f5be4a; --packet: #fff6dc;
    --ok: #3dd68c; --ok-led: #3dd68c; --ok-soft: rgba(61, 214, 140, 0.12);
    --warn: #f0b44c; --warn-soft: rgba(240, 180, 76, 0.13);
    --bad: #ff6b6b; --bad-soft: rgba(255, 107, 107, 0.13);
    --idle: #7f8792; --idle-soft: rgba(127, 135, 146, 0.14);
    --focus: #eceef1; --halo: rgba(245, 190, 74, 0.30);
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.65);
    --scrim: rgba(0, 0, 0, 0.6);
    --chart-line: #f5be4a; --chart-fill: rgba(245, 190, 74, 0.12); --grid: #20252c;
    --glass: rgba(15, 18, 21, 0.72);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d10; --side-bg: #0f1215; --surface: #14171c; --surface-2: #1a1e24; --surface-3: #232830;
  --border: #242931; --border-strong: #323842;
  --text: #eceef1; --text-2: #a6adb7; --text-3: #7f8792;
  --accent: #eceef1; --accent-hover: #ffffff; --accent-ink: #0b0d10; --accent-soft: #20252c; --accent-strong: #eceef1;
  --ink-btn: #eceef1; --ink-btn-hover: #ffffff; --ink-btn-text: #0b0d10;
  --fiber: #f5be4a; --fiber-line: #f5be4a; --fiber-soft: rgba(245, 190, 74, 0.14); --fiber-ink: #f5be4a; --packet: #fff6dc;
  --ok: #3dd68c; --ok-led: #3dd68c; --ok-soft: rgba(61, 214, 140, 0.12);
  --warn: #f0b44c; --warn-soft: rgba(240, 180, 76, 0.13);
  --bad: #ff6b6b; --bad-soft: rgba(255, 107, 107, 0.13);
  --idle: #7f8792; --idle-soft: rgba(127, 135, 146, 0.14);
  --focus: #eceef1; --halo: rgba(245, 190, 74, 0.30);
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.65);
  --scrim: rgba(0, 0, 0, 0.6);
  --chart-line: #f5be4a; --chart-fill: rgba(245, 190, 74, 0.12); --grid: #20252c;
  --glass: rgba(15, 18, 21, 0.72);
}

/* ======================================================================================
   base
   ====================================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font);
  font-optical-sizing: auto; font-kerning: normal;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 620; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: 26px; letter-spacing: -0.022em; font-weight: 650; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--text); text-decoration-color: color-mix(in srgb, var(--text) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: 0.92em; font-variant-numeric: tabular-nums; }
.tnum, .mono-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono-num { font-family: var(--mono); letter-spacing: -0.01em; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 13px; }
.small, .help, .meta, .muted { text-wrap: pretty; }
.wrap-any { overflow-wrap: anywhere; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.t-bad { color: var(--bad); font-weight: 500; }
.t-warn { color: var(--warn); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: var(--z-toast); background: var(--ink-btn); color: var(--ink-btn-text); padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--fiber) 40%, transparent); color: var(--text); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 22px; height: 22px; }

/* status light: a small LED, the way a router shows state on its front panel */
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok-led); box-shadow: 0 0 0 3px var(--ok-soft); transition: background-color var(--t-slow), box-shadow var(--t-slow); }
.led.warn { background: var(--fiber); box-shadow: 0 0 0 3px var(--fiber-soft); }
.led.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.led.off, .led.idle { background: var(--border-strong); box-shadow: none; }

/* ======================================================================================
   layout
   ====================================================================================== */
.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.main { min-width: 0; padding: 20px 16px calc(104px + env(safe-area-inset-bottom)); }
.container { max-width: 1160px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 36px; letter-spacing: -0.024em; }
.page-head p { margin-top: 6px; max-width: 70ch; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stack-sm { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 768px) {
  .main { padding: 28px 28px 48px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stack { gap: 20px; }
}
@media (min-width: 960px) {
  .app.with-side { grid-template-columns: 248px minmax(0, 1fr); }
  .main { padding: 32px 40px 56px; }
  .grid-2.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: 28px; line-height: 34px; }
  /* page actions: an even grid, the main one takes the whole last row */
  .page-head > .row.wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .page-head > .row.wrap > .btn { width: 100%; padding: 0 10px; }
  /* buttons go in pairs; an odd last one, and a select, take the whole line */
  .page-head > .row.wrap > .btn.primary:last-child:nth-child(odd of .btn) { grid-column: 1 / -1; order: 9; }
  .page-head > .row.wrap > .btn:last-child:nth-child(odd of .btn) { grid-column: 1 / -1; }
  .page-head > .row.wrap > .select, .page-head > .row.wrap > label:not(.sr-only) { grid-column: 1 / -1; width: 100% !important; min-width: 0 !important; }
  .page-head .btn.ghost { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
}

/* ======================================================================================
   sidebar (computer) and tab bar (phone)
   ====================================================================================== */
.side {
  display: none; position: sticky; top: 0; height: 100dvh;
  flex-direction: column; gap: 2px; padding: 22px 14px;
  background: var(--side-bg); border-right: 1px solid var(--border);
  overflow-y: auto; scrollbar-width: none;
}
.side::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .app.with-side .side { display: flex; } }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; font-weight: 650; letter-spacing: -0.015em; font-size: 16px; min-width: 0; }
.brand > span:last-child { min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink-btn); color: var(--ink-btn-text); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.brand-mark svg { width: 24px; height: 24px; }
.brand small { display: block; font-weight: 500; font-size: 12.5px; color: var(--text-3); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 12px; width: 100%;
  border: 0; border-radius: var(--r-md); background: transparent;
  color: var(--text-2); font-weight: 540; font-size: 14.5px; text-decoration: none; text-align: left; cursor: pointer;
}
.nav-item svg.i { color: var(--text-3); transition: color var(--t-fast); }
.nav-item[aria-current="page"] { color: var(--text); font-weight: 620; }
.nav-item[aria-current="page"] svg.i { color: var(--text); }
.nav-item .badge { margin-left: auto; }
/* the selected item sits on a surface that slides from item to item (positioned by Eon.ink) */
.side > .ink { position: absolute; z-index: 0; left: 0; top: 0; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 1px 2px rgba(17, 19, 22, 0.06), 0 0 0 1px var(--border); pointer-events: none; }
.side:not(:has(> .ink)) .nav-item[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%);
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
@media (min-width: 960px) { .app.with-side .bottom-nav { display: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .bottom-nav { background: var(--surface); } }
.bottom-nav button, .bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; min-width: 0; border: 0; background: none; border-radius: var(--r-md);
  color: var(--text-3); font-size: 11px; font-weight: 560; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.bottom-nav span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottom-nav svg.i { width: 22px; height: 22px; }
.bottom-nav [aria-current="page"] { color: var(--text); }
.bottom-nav [aria-current="page"] svg.i { stroke-width: 2.2; }

/* ======================================================================================
   tabs: scroll sideways with faded edges; the chosen one has an ink line that slides to it
   ====================================================================================== */
.tabs {
  position: relative; display: flex; gap: 2px 22px; padding: 0 2px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-behavior: smooth;
  scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.tabs.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
.tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.tabs button {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent;
  color: var(--text-3); font-weight: 540; font-size: 14.5px; cursor: pointer; white-space: nowrap; scroll-snap-align: center;
}
.tabs button svg.i { display: none; }
@media (hover: hover) { .tabs button:hover { color: var(--text); } }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tabs > .ink { position: absolute; left: 0; bottom: 0; height: 2px !important; top: auto !important; border-radius: 2px 2px 0 0; background: var(--text); pointer-events: none; }
.tabs:not(:has(> .ink)) button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); border-radius: 2px 2px 0 0; }

/* ======================================================================================
   surfaces
   ====================================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-1); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); min-height: 56px; }
.card-head h2, .card-head h3 { font-size: 16px; display: flex; align-items: baseline; gap: 6px; }
.card-head > svg.i, .card-head h2 > svg.i { display: none; }
.card-head .spacer + * { flex: none; }
.card-body { padding: 16px 20px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card.interactive { cursor: pointer; }
@media (hover: hover) { .card.interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); } }
.card.interactive:active { transform: scale(0.995); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 8px 0 10px; }
@media (min-width: 768px) { .card-pad { padding: 24px; } .card-head { padding: 16px 24px; } .card-body { padding: 18px 24px 24px; } .card-foot { padding: 14px 24px; } }

/* ======================================================================================
   buttons
   ====================================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 560; font-size: 14.5px; line-height: 1; cursor: pointer; white-space: nowrap;
  text-decoration: none; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-press) var(--ease-out), opacity var(--t-fast);
}
.btn:active:not([disabled]) { transform: scale(0.97); }
.btn.primary { background: var(--ink-btn); border-color: transparent; color: var(--ink-btn-text); font-weight: 600; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 1px 2px rgba(17, 19, 22, 0.16); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--border-strong)); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.icon:active:not([disabled]) { transform: scale(0.92); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }
.btn .spin { animation: spin 0.7s linear infinite; }
/* restraint: icons live in navigation and icon-only buttons, not next to every label */
.btn:not(.icon) svg.i:not(.spin) { display: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--text-3); }
  .btn.primary:hover { background: var(--ink-btn-hover); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 4px 12px rgba(17, 19, 22, 0.18); }
  .btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
  .btn.danger:hover { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
  .btn.danger.solid:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }
  .nav-item:hover { color: var(--text); }
  .nav-item:hover svg.i { color: var(--text-2); }
}
@media (max-width: 767px) { .btn { min-height: 44px; } .btn.sm { min-height: 36px; } .btn.icon { width: 44px; } .btn.icon.sm { width: 36px; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* every pressable thing answers the finger at once */
.chip, .nav-item, .bottom-nav button, .bottom-nav a, .seg button, .menu button, .row-btn {
  transition-property: background-color, border-color, color, box-shadow, transform, opacity;
  transition-duration: var(--t-fast); transition-timing-function: var(--ease-out);
}
.chip:active, .seg button:active, .menu button:active { transform: scale(0.97); }
.nav-item:active, .bottom-nav button:active, .bottom-nav a:active { transform: scale(0.95); }

/* ======================================================================================
   status marks
   ====================================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 560; white-space: nowrap; line-height: 1;
  background: var(--idle-soft); color: var(--text-2);
}
.pill svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--fiber-soft); color: var(--fiber-ink); }
.pill.stale { opacity: 0.55; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; border: 2px solid var(--text-3); }
.dot.ok { background: var(--ok-led); border-color: var(--ok-led); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--fiber); border-color: var(--fiber); }
.dot.bad { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font: 500 11.5px/1 var(--mono); letter-spacing: 0; border: 1px solid var(--border); white-space: nowrap; flex: none; font-feature-settings: "tnum" 1; }
.now-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--fiber-soft); color: var(--fiber-ink); font-size: 12px; font-weight: 620; white-space: nowrap; flex: none; }

/* ======================================================================================
   hero: the router's state in one sentence, the route, and a strip of readouts
   ====================================================================================== */
.hero { position: relative; overflow: hidden; padding: 22px 20px 0; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.hero-top { display: flex; gap: 16px 24px; align-items: flex-start; flex-wrap: wrap; }
.hero-icon { display: none; }
.hero h1 { font-size: 28px; line-height: 34px; }
.hero-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.hero-eyebrow > span:nth-child(2) { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-eyebrow .when { margin-left: auto; flex: none; white-space: nowrap; font-weight: 450; color: var(--text-3); font-size: 13px; }
.hero-readout { display: grid; justify-items: end; gap: 2px; margin-left: auto; }
.hero-readout .lbl { font-size: 12.5px; color: var(--text-3); }
.hero-readout .num { font: 500 44px/50px var(--mono); letter-spacing: -0.03em; display: inline-flex; align-items: baseline; gap: 6px; }
.hero-readout .num small { font: 500 15px var(--mono); color: var(--text-3); letter-spacing: 0; }
.hero.bad .hero-readout .num { color: var(--bad); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-trace { margin: 28px 0 26px; }
/* cells take the width of their content and share what is left; each draws its own lines,
   so a wrapped row still lines up */
.hero-meta { display: flex; flex-wrap: wrap; margin: 0 -20px; }
.hero-meta .kv { flex: 1 1 auto; min-width: 140px; padding: 14px 20px; border-left: 1px solid var(--border); border-top: 1px solid var(--border); margin-left: -1px; }
.kv { display: grid; gap: 4px; min-width: 0; align-content: start; }
.kv dt { font-size: 12.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv dd { margin: 0; font-weight: 580; font-size: 15px; line-height: 22px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-feature-settings: "tnum" 1; }
.kv dd .mono, .kv dd.mono { font-size: 13.5px; font-weight: 500; }
.hero .banner { margin-top: 16px; }
/* the big readout already shows the latency on a wide screen */
@media (min-width: 641px) { .hero:has(.hero-readout) .kv-lat { display: none; } }
@media (min-width: 768px) {
  .hero { padding: 28px 32px 0; }
  .hero h1 { font-size: 34px; line-height: 40px; }
  .hero-meta { margin: 0 -32px; }
  .hero-meta .kv { padding: 16px 24px; }
}
@media (max-width: 640px) {
  .hero-readout { display: none; }
  .hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .hero-actions .btn { width: 100%; padding: 0 8px; }
  .hero-actions .btn.primary { grid-column: 1 / -1; }
  .hero-actions .btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
  .hero-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-meta .kv { min-width: 0; padding: 12px 14px 12px 16px; }
  .hero-meta .kv dd { font-size: 14.5px; }
  /* the key name gets a whole row; an odd cell at the end does too */
  .hero-meta .kv:first-child, .hero-meta .kv:last-child:nth-child(even) { grid-column: 1 / -1; }
  .hero-eyebrow .when { display: none; }
}

/* ======================================================================================
   «Трасса»: home → router → provider → tunnel. A stretch takes the state of the step it
   leads into, so a break shows on its own stretch. While everything works the whole line
   is fiber and packets run along it.
   ====================================================================================== */
.trace { --node: 26px; display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); position: relative; margin: 6px 0 2px; }
.tr-step { display: grid; justify-items: center; align-content: start; text-align: center; gap: 12px; position: relative; min-width: 0; padding: 0 6px; }
.tr-step + .tr-step::before { content: ""; position: absolute; top: calc(var(--node) / 2 - 1px); right: 50%; width: 100%; height: 2px; background: var(--text); transition: background-color var(--t-slow); }
.tr-step.warn::before { background: repeating-linear-gradient(90deg, var(--fiber) 0 6px, transparent 6px 11px) !important; }
.tr-step.bad::before { background: repeating-linear-gradient(90deg, var(--bad) 0 7px, transparent 7px 12px) !important; animation: snap 360ms var(--ease-out) both; }
.tr-step.off::before { background: repeating-linear-gradient(90deg, var(--text-3) 0 2px, transparent 2px 6px) !important; opacity: 0.7; }
.tr-step.tunnel.ok::before, .trace.live .tr-step::before { background: var(--fiber); }
.tr-node {
  width: var(--node); height: var(--node); border-radius: 50%; background: var(--text); border: 2px solid var(--text);
  position: relative; z-index: 1; display: grid; place-items: center; font-size: 13px; font-weight: 700; line-height: 1; color: var(--bad);
  transition: background-color var(--t-slow) var(--ease-out), border-color var(--t-slow) var(--ease-out);
}
.tr-step.first .tr-node { background: var(--surface); }
.tr-step.warn .tr-node { background: var(--fiber); border-color: var(--fiber); }
.tr-step.bad .tr-node { background: var(--bad-soft); border-color: var(--bad); animation: pop-in 360ms var(--ease-spring) both; }
.tr-step.off .tr-node { background: var(--surface); border: 2px dotted var(--text-3); }
.tr-step.tunnel.ok .tr-node { background: var(--fiber); border-color: var(--fiber); animation: breathe 2.8s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.tr-label { display: grid; gap: 2px; min-width: 0; }
.tr-label b { font-weight: 620; font-size: 15px; overflow-wrap: anywhere; }
.tr-label small { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; line-height: 1.35; }
.tr-step.bad .tr-label small { color: var(--bad); }
.tr-step.warn .tr-label small { color: var(--warn); }
/* packets: comets that run from the first node to the last */
.tr-flow { position: absolute; z-index: 0; pointer-events: none; overflow: hidden; top: calc(var(--node) / 2 - 4px); height: 8px; left: calc(100% / var(--n, 4) / 2); right: calc(100% / var(--n, 4) / 2); }
.tr-flow i { position: absolute; inset: 0; animation: packet 2.4s linear infinite; }
.tr-flow i::after { content: ""; position: absolute; left: -64px; top: 2px; width: 64px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, var(--packet) 85%); }
.tr-flow i:nth-child(2) { animation-delay: -0.8s; }
.tr-flow i:nth-child(3) { animation-delay: -1.6s; }
@keyframes packet { from { transform: translateX(0); } to { transform: translateX(calc(100% + 64px)); } }
@keyframes breathe { 0% { box-shadow: 0 0 0 0 var(--halo); } 70% { box-shadow: 0 0 0 11px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }
@keyframes snap { from { opacity: 0; transform: scaleX(0.7); transform-origin: left; } }
@media (max-width: 600px) {
  .trace { grid-template-columns: minmax(0, 1fr); }
  .tr-step { grid-template-columns: var(--node) minmax(0, 1fr); justify-items: start; align-items: center; text-align: left; column-gap: 14px; padding: 0 0 18px; }
  .tr-step:last-child { padding-bottom: 0; }
  .tr-step + .tr-step::before { content: none; }
  .tr-step:not(:last-child)::after { content: ""; position: absolute; left: calc(var(--node) / 2 - 1px); top: var(--node); bottom: 0; width: 2px; background: var(--text); }
  .tr-step:has(+ .tr-step.warn)::after { background: repeating-linear-gradient(180deg, var(--fiber) 0 6px, transparent 6px 11px); }
  .tr-step:has(+ .tr-step.bad)::after { background: repeating-linear-gradient(180deg, var(--bad) 0 7px, transparent 7px 12px); }
  .tr-step:has(+ .tr-step.off)::after { background: repeating-linear-gradient(180deg, var(--text-3) 0 2px, transparent 2px 6px); opacity: 0.7; }
  .tr-step:has(+ .tr-step.tunnel.ok)::after, .trace.live .tr-step:not(:last-child)::after { background: var(--fiber); }
  .tr-label { padding-top: 0; }
  .tr-flow { top: calc(var(--node) / 2); bottom: calc(var(--node) / 2 + 2px); left: calc(var(--node) / 2 - 4px); right: auto; width: 8px; height: auto; }
  .tr-flow i { animation-name: packet-v; }
  .tr-flow i::after { left: 2px; top: -52px; width: 4px; height: 52px; background: linear-gradient(180deg, transparent, var(--packet) 85%); }
}
@keyframes packet-v { from { transform: translateY(0); } to { transform: translateY(calc(100% + 52px)); } }

/* compact trace for list rows */
.trace-mini { display: inline-flex; align-items: center; width: 168px; max-width: 100%; flex: none; }
.trace-mini i { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--text); flex: none; }
.trace-mini s { display: block; flex: 1; height: 2px; background: var(--text); text-decoration: none; }
.trace-mini s.warn { background: repeating-linear-gradient(90deg, var(--fiber) 0 5px, transparent 5px 8px); }
.trace-mini i.warn { background: var(--fiber); }
.trace-mini s.bad { background: none; border-top: 2px dashed var(--bad); height: 0; }
.trace-mini b.x { color: var(--bad); font-size: 13px; font-weight: 700; line-height: 1; }
.trace-mini s.tun { height: 2px; background: var(--fiber); }
.trace-mini i.tun { width: 10px; height: 10px; background: var(--fiber); box-shadow: 0 0 0 3px var(--fiber-soft); }
.trace-mini.off { opacity: 0.55; }
.trace-mini.off i { background: transparent; border: 2px solid var(--text-3); }
.trace-mini.off s { background: none; border-top: 2px dotted var(--text-3); height: 0; }

/* status headline: one sentence instead of tiles */
.status-line { display: grid; gap: 6px; }
.status-line h1, .status-line h2 { font-size: 30px; line-height: 36px; letter-spacing: -0.024em; }
.status-line p { color: var(--text-2); max-width: 70ch; }
.status-line .when { font-size: 13px; color: var(--text-3); }
@media (max-width: 640px) { .status-line h1, .status-line h2 { font-size: 28px; line-height: 34px; } }

/* readouts */
.metric { padding: 16px; border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.metric .label { font-size: 12.5px; color: var(--text-3); font-weight: 560; display: flex; gap: 6px; align-items: center; line-height: 1.3; overflow-wrap: anywhere; }
.metric .label svg.i { display: none; }
.metric .value { font: 500 22px/1.2 var(--mono); margin-top: 8px; letter-spacing: -0.02em; font-feature-settings: "tnum" 1; }
.metric .value small { font: 500 13px var(--mono); color: var(--text-3); margin-left: 3px; letter-spacing: 0; }

/* rolling digits: a changed number turns over digit by digit, the row never changes width */
.roll { display: inline-flex; white-space: nowrap; }
.roll .rd { display: inline-block; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom; }
.roll .rd > span { display: flex; flex-direction: column; transition: transform 460ms var(--ease-out); }
.roll .rd > span > span { height: 1.2em; }
.roll .rc { display: inline-block; height: 1.2em; line-height: 1.2em; vertical-align: bottom; white-space: pre; }

/* ======================================================================================
   lists
   ====================================================================================== */
.list { display: grid; }
.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); min-width: 0; transition: background-color var(--t-fast); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1 1 220px; min-width: 0; }
.list-item .title { font-weight: 600; overflow-wrap: anywhere; }
.list-item .meta { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-top: 4px; min-width: 0; }
.list-item .meta .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-item.active { background: none; }
@media (hover: hover) { .list-item:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); } }
@media (min-width: 768px) { .list-item { padding: 14px 24px; } }
.prio { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font: 500 13px var(--mono); color: var(--text-3); flex: none; }
.list-item.active .prio { background: var(--fiber-soft); color: var(--fiber-ink); font-weight: 600; }
.lat { font-family: var(--mono); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.actions { display: flex; gap: 6px; flex: none; }
.subnodes { margin: 0 20px 14px 60px; border-left: 2px solid var(--border); padding-left: 16px; display: grid; gap: 2px; }
@media (max-width: 640px) { .subnodes { margin-left: 18px; margin-right: 16px; } }
.subnode { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px 12px; min-height: 44px; padding: 6px 0; font-size: 14px; min-width: 0; border-top: 1px solid var(--border); }
.subnode:first-child { border-top: 0; }
.subnode .name { min-width: 0; display: grid; gap: 4px; }
.subnode .name > .tag { justify-self: start; }
.subnode .health { justify-content: flex-end; }
@media (max-width: 640px) { .subnode { grid-template-columns: minmax(0, 1fr) auto; } .subnode .health { grid-column: 1; justify-content: flex-start; } }

/* key health: words and numbers */
.health { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
.health .checked { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.h-lat { font: 500 15px var(--mono); letter-spacing: -0.015em; white-space: nowrap; font-feature-settings: "tnum" 1; }
.h-lat.subtle, .h-lat.t-bad { font-family: var(--font); font-size: 14px; letter-spacing: 0; }
.h-lat.stale { opacity: 0.55; }

/* uptime strip: one tick per check, newest on the right */
.tracker { display: flex; gap: 2px; margin-top: 10px; height: 6px; max-width: 220px; }
.tracker .tb { flex: 1; min-width: 2px; border-radius: 2px; background: var(--surface-3); transition: background-color var(--t-med); }
.tracker .tb.ok { background: color-mix(in srgb, var(--text-3) 55%, transparent); }
.tracker .tb.bad { background: var(--bad); }
.subnode .tracker { margin-top: 2px; height: 5px; max-width: 150px; }

/* key rows: number · name · readout and actions on the right */
.list-item.krow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 8px; }
.krow > .prio { align-self: start; margin-top: -2px; }
.krow .k-side { display: grid; justify-items: end; gap: 8px; min-width: 0; }
.krow .k-side .health { text-align: right; }
.krow .k-side .h-lat { font-size: 17px; }
.krow .k-acts { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.krow .k-acts .now-tag { margin-right: 6px; }
.krow.checking .k-side .health { visibility: hidden; }
.krow.checking .k-side { position: relative; }
.krow.checking .k-side::before { content: ""; position: absolute; right: 0; top: 4px; width: 64px; height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%) 0 0 / 200% 100%; animation: shimmer 0.9s linear infinite; }
.krow.checked .h-lat { animation: flash 900ms var(--ease-out); }
@media (max-width: 640px) {
  .list-item.krow { grid-template-columns: 26px minmax(0, 1fr); padding: 14px 16px; }
  .krow .k-side { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-items: stretch; gap: 2px 8px; }
  .krow .k-side .health { display: contents; }
  .krow .k-side .h-lat { grid-column: 1; grid-row: 1; justify-self: start; }
  .krow .k-side .checked { grid-column: 1 / -1; grid-row: 2; text-align: left; white-space: normal; }
  .krow .k-side .k-acts { grid-column: 2; grid-row: 1; justify-self: end; }
  .krow .k-acts .js-up, .krow .k-acts .js-down { display: none; }
  .krow.checking .k-side::before { left: 0; right: auto; top: 6px; }
}

/* device rows: dot level with the name, mode and actions on the right */
.list-item.dev { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 8px; }
.dev > .dot { align-self: start; margin-top: 7px; }
.dev .d-side { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
.dev .d-side .actions { margin-left: auto; width: auto; }
@media (max-width: 640px) { .list-item.dev { grid-template-columns: 10px minmax(0, 1fr); } .dev .d-side { grid-column: 2; justify-content: space-between; } }

/* events */
.events { display: grid; }
.event { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; padding: 12px 20px; border-top: 1px solid var(--border); }
.event:first-child { border-top: 0; }
.event .ev-icon { grid-row: span 2; width: 20px; height: 22px; display: grid; place-items: center; color: var(--text-3); }
.event.warn .ev-icon { color: var(--warn); }
.event.error .ev-icon { color: var(--bad); }
.event .ev-icon svg.i { width: 15px; height: 15px; }
.event .ev-msg { overflow-wrap: anywhere; font-size: 14px; }
.event .ev-time { font: 12px var(--mono); color: var(--text-3); }
@media (min-width: 768px) { .event { padding: 12px 24px; } }
.logbox { font: 12.5px/1.6 var(--mono); background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }

/* ======================================================================================
   forms
   ====================================================================================== */
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-weight: 600; font-size: 13.5px; }
.field .help { font-size: 12.5px; color: var(--text-3); }
.field .error { font-size: 12.5px; color: var(--bad); font-weight: 600; }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: 15px;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out), background-color var(--t-fast);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; font-family: var(--mono); font-size: 13.5px; }
/* words people write to each other (tickets, notes, tasks) are not code */
.textarea.prose { font-family: inherit; font-size: 15px; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 0.85; }
@media (hover: hover) { .input:hover:not(:focus):not(:disabled), .textarea:hover:not(:focus):not(:disabled), .select:hover:not(:focus):not(:disabled) { border-color: var(--text-3); } }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 4px var(--halo); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-2); }
.input.mono { font-family: var(--mono); font-size: 13.5px; }
@media (max-width: 767px) { .input, .select { min-height: 48px; font-size: 16px; } .textarea, .input.mono { font-size: 16px; } }
.input:-webkit-autofill, .input:-webkit-autofill:hover, .input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); caret-color: var(--text); -webkit-box-shadow: 0 0 0 40px var(--surface) inset; transition: background-color 9999s; }
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; font-family: var(--mono); }
.input[type="number"]::-webkit-outer-spin-button, .input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.select {
  -webkit-appearance: none; appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2369707b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 14px center; background-size: 16px; background-repeat: no-repeat;
}
.select option { background: var(--surface); color: var(--text); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
/* password: the eye sits inside the field, so every field on a form has the same width */
.input-group:has(> .js-eye) { position: relative; gap: 0; }
.input-group:has(> .js-eye) > .input { padding-right: 52px; }
.input-group > .js-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; min-height: 36px; height: 36px; color: var(--text-3); }
.input-group > .js-eye:active { transform: translateY(-50%) scale(0.9); }
@media (hover: hover) { .input-group > .js-eye:hover { color: var(--text); background: var(--surface-2); } }
@media (max-width: 767px) { .input-group > .js-eye { width: 44px; height: 40px; } }

/* checkboxes: the tick draws itself */
input[type="checkbox"]:not([role="switch"]) {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 20px !important; height: 20px !important; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer;
  display: inline-grid; place-content: center;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
input[type="checkbox"]:not([role="switch"])::after {
  content: ""; width: 10px; height: 6px; border-left: 2px solid var(--ink-btn-text); border-bottom: 2px solid var(--ink-btn-text);
  transform: translateY(-1px) rotate(-45deg) scale(0.5); opacity: 0;
  transition: transform 220ms var(--ease-spring), opacity var(--t-fast);
}
input[type="checkbox"]:not([role="switch"]):checked { background: var(--ink-btn); border-color: var(--ink-btn); }
input[type="checkbox"]:not([role="switch"]):checked::after { opacity: 1; transform: translateY(-1px) rotate(-45deg) scale(1); }
input[type="checkbox"]:not([role="switch"]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
label.row:has(> input[type="checkbox"]) { gap: 10px; min-height: 32px; }

/* segmented control: the chosen option sits on a surface that slides to it */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 12px; }
.seg button {
  position: relative; z-index: 1; display: grid; gap: 2px; justify-items: start; text-align: left;
  padding: 10px 12px; min-height: 44px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer; font-weight: 600;
}
.seg button small { font-weight: 450; font-size: 12px; color: var(--text-3); line-height: 1.35; }
.seg button[aria-checked="true"] { color: var(--text); }
.seg > .ink { position: absolute; z-index: 0; left: 0; top: 0; border-radius: 9px; background: var(--surface); box-shadow: 0 1px 3px rgba(17, 19, 22, 0.1), 0 0 0 0.5px rgba(17, 19, 22, 0.04); pointer-events: none; }
.seg:not(:has(> .ink)) button[aria-checked="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(17, 19, 22, 0.1); }
@media (max-width: 640px) { .seg { grid-auto-flow: row; } }
.seg.seg-sm { grid-auto-flow: column; flex: none; }
.seg.seg-sm button { min-height: 34px; padding: 6px 12px; justify-items: center; text-align: center; }
.seg.seg-sm .seg-title { font-size: 13px; white-space: nowrap; }
@media (max-width: 640px) { .seg.seg-sm { width: 100%; } .seg.seg-sm button { min-height: 38px; } }

/* switch: iOS-sized, the thumb stretches on press and lands with a slight overshoot */
.switch-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); cursor: pointer; }
.switch-row:first-child { border-top: 0; padding-top: 2px; }
.switch-row .grow { flex: 1; min-width: 0; }
.switch-row .title { font-weight: 580; }
.switch-row .help { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.switch-row:has(input:disabled) { cursor: not-allowed; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); transition: background-color var(--t-med) var(--ease-out), box-shadow var(--t-med); }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 320ms var(--ease-spring), width var(--t-fast) var(--ease-out); }
.switch input:checked + .track { background: var(--accent); box-shadow: none; }
.switch input:checked ~ .thumb { transform: translateX(18px); }
.switch input:active ~ .thumb { width: 28px; }
.switch input:checked:active ~ .thumb { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled ~ .track, .switch input:disabled ~ .thumb { opacity: 0.5; }
:root[data-theme="dark"] .switch input:checked ~ .thumb { background: #0b0d10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .switch input:checked ~ .thumb { background: #0b0d10; } }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 540; font-size: 14px; line-height: 1.25; text-align: left; cursor: pointer; touch-action: manipulation;
}
.chip > span:not(.pill) { padding: 7px 0; }
@media (hover: hover) { .chip:hover { border-color: var(--text-3); } }
.chip[aria-pressed="true"] { background: var(--ink-btn); border-color: var(--ink-btn); color: var(--ink-btn-text); }
.chip .check { width: 16px; height: 16px; display: none; }
.chip[aria-pressed="true"] .check { display: block; }
.chip .pill { height: 20px; font-size: 11px; padding: 0 6px; }
.chip[aria-pressed="true"] .pill.accent { background: var(--fiber); color: #2b1d00; }

.dns-list { display: grid; gap: 8px; }
.dns-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.dns-row .addr { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dns-row.current { border-color: var(--text); }
@media (max-width: 640px) { .dns-row { gap: 4px; padding-left: 10px; } .dns-row .addr { font-size: 12.5px; } .dns-row .pill { padding: 0 6px; } .dns-row .pill .txt { display: none; } .dns-row .addr { white-space: normal; overflow-wrap: anywhere; } }

.copy-field { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--border-strong); min-width: 0; }
.copy-field code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }

.fs { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.fs legend { font-weight: 600; font-size: 14px; padding: 0 6px; }

/* sticky save bar */
.savebar {
  position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; margin-top: 20px;
  background: var(--ink-btn); color: var(--ink-btn-text); border-radius: 14px; box-shadow: var(--shadow-2);
  animation: rise 320ms var(--ease-out) both;
}
.savebar > span { min-width: 0; line-height: 1.3; font-weight: 540; }
.savebar .btn.primary { background: var(--ink-btn-text); color: var(--ink-btn); }
.savebar .btn.ghost { color: color-mix(in srgb, var(--ink-btn-text) 75%, transparent); }
@media (hover: hover) { .savebar .btn.ghost:hover { background: color-mix(in srgb, var(--ink-btn-text) 12%, transparent); color: var(--ink-btn-text); } }
@media (min-width: 960px) { .savebar { bottom: 20px; } }
.app.embedded { display: block; min-height: 0; }
.app.embedded .container { max-width: none; }
.el-embedded:focus { outline: none; }
.app.embedded .savebar { bottom: calc(84px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .app.embedded .savebar { bottom: 16px; } }

/* ======================================================================================
   charts
   ====================================================================================== */
.chart { position: relative; width: 100%; height: 160px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); }
.chart .gap { fill: var(--bad-soft); }
.chart .cursor { stroke: var(--text-3); stroke-dasharray: 3 3; }
.chart .pt { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.chart .line { stroke-dasharray: var(--len, 0); animation: draw 900ms var(--ease-out) both; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; background: var(--ink-btn); color: var(--ink-btn-text); font: 600 12px var(--mono); padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.spark { width: 100%; height: 36px; display: block; }
.spark .line { fill: none; stroke: var(--chart-line); stroke-width: 1.6; }
.spark .area { fill: var(--chart-fill); }
@keyframes draw { from { stroke-dashoffset: var(--len, 0); } to { stroke-dashoffset: 0; } }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-bottom: 20px; }
.bar-col { flex: 1; min-width: 6px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar-stack { width: 100%; max-width: 32px; display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; min-height: 2px; background: var(--surface-3); transform-origin: bottom; animation: grow 520ms var(--ease-out) both; }
.bar-col:nth-child(2n) .bar-stack { animation-delay: 30ms; }
.bar-col:nth-child(3n) .bar-stack { animation-delay: 60ms; }
@keyframes grow { from { transform: scaleY(0); } }
.bar-l { position: absolute; bottom: -20px; font: 11px var(--mono); color: var(--text-3); }
.b-tun { background: var(--fiber); display: block; }
.b-dir { background: color-mix(in srgb, var(--text-3) 45%, transparent); display: block; }
.legend { display: flex; gap: 16px; margin-top: 18px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin: 6px 0 2px; max-width: 320px; }
.hbar span { height: 100%; }

/* meters: label on the left, value on the right, never wrapping into each other */
.meters { display: grid; gap: 20px 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13.5px; margin-bottom: 8px; min-width: 0; }
.meter-top span:first-child { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter-top span:last-child { color: var(--text-3); text-align: right; white-space: nowrap; flex: none; font-family: var(--mono); font-size: 12.5px; }
.meter-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: inherit; background: var(--text); transform-origin: left; animation: fill 700ms var(--ease-out) both; transition: width var(--t-slow) var(--ease-out); }
.meter-bar.warn span { background: var(--fiber); }
.meter-bar.bad span { background: var(--bad); }
@keyframes fill { from { transform: scaleX(0); } }
.quota-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; max-width: 320px; }
.quota-bar span { display: block; height: 100%; background: var(--text); }
.quota-bar.warn span { background: var(--fiber); }
.quota-bar.over span { background: var(--bad); }
.actions-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.actions-grid .btn { justify-content: flex-start; }

/* ======================================================================================
   overlays: dialog (a sheet on a phone), menu, toast
   ====================================================================================== */
.dialog-wrap { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; background: var(--scrim); animation: fade 200ms var(--ease-out) both; }
.dialog {
  width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-3);
  animation: pop 240ms var(--ease-out) both; transform-origin: center;
}
.dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 22px 4px; }
.dialog-head h2 { flex: 1; font-size: 20px; line-height: 26px; letter-spacing: -0.015em; }
.dialog-body { padding: 10px 22px 8px; display: grid; gap: 16px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 22px; flex-wrap: wrap; }
.dialog-wrap.closing { animation: fadeout var(--t-exit) var(--ease-in) forwards; }
.dialog-wrap.closing .dialog { animation: popout var(--t-exit) var(--ease-in) forwards; }
@media (max-width: 560px) {
  .dialog-wrap { place-items: end stretch; padding: 0; }
  .dialog { width: 100%; max-height: calc(100dvh - 24px); border-radius: 24px 24px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet 420ms var(--ease-drawer) both; touch-action: pan-y; }
  .dialog::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto 0; }
  .dialog-head { padding: 12px 20px 4px; touch-action: none; cursor: grab; }
  .dialog-body { padding: 8px 20px 8px; }
  .dialog-foot { padding: 14px 20px 20px; }
  .dialog-foot .btn { flex: 1; }
  .dialog.dragging { animation: none; transition: none; }
  .dialog.settle { transition: transform 380ms var(--ease-drawer); }
  .dialog-wrap.closing .dialog { animation: sheetout 220ms var(--ease-in) forwards; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
@keyframes popout { to { opacity: 0; transform: scale(0.97); } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes sheetout { to { transform: translateY(100%); } }

.menu {
  position: absolute; z-index: var(--z-modal); min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-2); transform-origin: var(--menu-origin, top right);
  animation: menuin 170ms var(--ease-out) both;
}
.menu.closing { animation: menuout 110ms var(--ease-in) forwards; pointer-events: none; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-weight: 540; text-align: left; color: var(--text); }
.menu button svg.i { color: var(--text-3); }
.menu button.danger { color: var(--bad); }
.menu button.danger svg.i { color: currentColor; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
@media (max-width: 767px) { .menu button { min-height: 44px; } }
@keyframes menuin { from { opacity: 0; transform: scale(0.95); } }
@keyframes menuout { to { opacity: 0; transform: scale(0.97); } }

.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { left: auto; right: 24px; bottom: 24px; transform: none; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--ink-btn); color: var(--ink-btn-text); box-shadow: var(--shadow-2); font-weight: 540; font-size: 14px; pointer-events: auto; animation: toastin 320ms var(--ease-out) both; }
.toast.leaving { opacity: 0; transform: translateY(8px) scale(0.98); transition: opacity var(--t-exit) var(--ease-in), transform var(--t-exit) var(--ease-in); }
.toast .t-icon { color: var(--ok-led); display: grid; }
.toast.error .t-icon { color: var(--bad); }
.toast .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@keyframes toastin { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ======================================================================================
   empty, skeleton, banner
   ====================================================================================== */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px; }
.empty .e-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.empty .e-icon svg.i { width: 22px; height: 22px; }
.empty p { max-width: 42ch; color: var(--text-2); }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%; border: 1px solid var(--border); animation: shimmer 1.6s var(--ease-in-out) infinite; border-radius: var(--r-xl); }
@keyframes shimmer { to { background-position: -200% 0; } }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); animation: fadeup var(--t-slow) var(--ease-out) both; }
.banner > div { flex: 1 1 220px !important; min-width: 0; overflow-wrap: anywhere; }
.banner > .btn:first-of-type { margin-left: auto; }
.banner > svg.i { flex: none; color: var(--warn); align-self: flex-start; margin-top: 2px; }
.banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.banner.bad > svg.i { color: var(--bad); }
.banner.info { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-1); }
.banner.info > svg.i { color: var(--text-3); }
.banner .btn { flex: none; }
.stack-sm > .banner { margin: 0; }

/* ======================================================================================
   auth
   ====================================================================================== */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 28px; border-radius: 22px; box-shadow: var(--shadow-2); }
.auth-card .brand { justify-content: center; padding: 0 0 26px; font-size: 20px; }
.auth-card .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
.auth-card .brand-mark svg { width: 32px; height: 32px; }

/* ======================================================================================
   diagnostics, site check, ratings, QR, snapshots, devices
   ====================================================================================== */
.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--idle-soft); }
.verdict p { margin-top: 2px; color: var(--text-2); font-size: 14px; }
.verdict .v-icon { color: var(--idle); display: grid; padding-top: 2px; }
.verdict.ok { background: var(--ok-soft); } .verdict.ok .v-icon { color: var(--ok); }
.verdict.warn { background: var(--warn-soft); } .verdict.warn .v-icon { color: var(--warn); }
.verdict.bad { background: var(--bad-soft); } .verdict.bad .v-icon { color: var(--bad); }
.checks { display: grid; gap: 2px; margin: 12px 0; }
.check-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; font-size: 14px; animation: fadeup var(--t-slow) var(--ease-out) both; }
.check-row:nth-child(2) { animation-delay: 60ms; } .check-row:nth-child(3) { animation-delay: 120ms; } .check-row:nth-child(4) { animation-delay: 180ms; } .check-row:nth-child(n + 5) { animation-delay: 240ms; }
.check-row .pill { min-width: 54px; justify-content: center; }
.score { font: 600 12px var(--mono); padding: 2px 7px; border-radius: 6px; background: var(--surface-2); white-space: nowrap; }
.score.ok { color: var(--ok); } .score.warn { color: var(--warn); } .score.bad { color: var(--bad); background: var(--bad-soft); }
.dead-nodes { margin-top: 4px; color: var(--text-3); font-size: 13px; }
.dead-nodes summary { cursor: pointer; padding: 8px 0; min-height: 36px; list-style-position: inside; }
.dead-nodes .subnode { opacity: 0.7; }
.qr-grid { display: flex; flex-wrap: wrap; gap: 20px; }
.qr-card { margin: 0; display: grid; justify-items: center; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--surface-2); text-align: center; width: min(240px, 100%); }
.qr-card figcaption { display: grid; gap: 2px; }
svg.qr { width: 180px; height: 180px; border-radius: 10px; display: block; background: #fff; padding: 6px; }
.diff { max-height: 55vh; font-size: 12px; }
.diff .d-add { color: var(--ok); } .diff .d-del { color: var(--bad); } .diff .d-hunk { color: var(--text-3); }
.findings { display: grid; gap: 8px; }
.finding { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; line-height: 1.45; border: 1px solid transparent; }
.finding svg.i { flex: none; margin-top: 2px; }
.finding.ok svg.i { color: var(--ok); }
.finding.warn { background: var(--warn-soft); } .finding.warn svg.i { color: var(--warn); }
.finding.bad { background: var(--bad-soft); } .finding.bad svg.i { color: var(--bad); }
.lims { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lim { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 560; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.lim.bad { background: var(--bad-soft); color: var(--bad); }
.lim svg.i { width: 13px; height: 13px; }

/* terminal window */
.term { --t-bg: #0d1016; --t-bar: #151a23; --t-text: #d7dde8; --t-dim: #7d8899; --t-cmd: #f5be4a; --t-err: #ff8a8a; --t-ok: #5fe0a1; background: var(--t-bg); color: var(--t-text); border-radius: var(--r-lg); overflow: hidden; border: 1px solid #1f2633; box-shadow: var(--shadow-2); }
.term-bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--t-bar); border-bottom: 1px solid #1f2633; }
.lights { display: inline-flex; gap: 7px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.term-title { display: grid; line-height: 1.2; min-width: 0; }
.term-title b { font: 600 13px var(--mono); color: var(--t-text); }
.term-title small { font: 12px var(--mono); color: var(--t-dim); overflow-wrap: anywhere; }
.term-btn { border: 1px solid #2a3240; background: transparent; color: var(--t-dim); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.term-btn:hover { color: var(--t-text); border-color: #3a4456; }
.term-out { font: 13px/1.6 var(--mono); padding: 14px 16px; height: min(52vh, 460px); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out:focus-visible { outline: 2px solid var(--t-cmd); outline-offset: -2px; border-radius: 0; }
.tl.cmd { color: var(--t-cmd); margin-top: 8px; } .tl.cmd:first-child { margin-top: 0; }
.tl.err { color: var(--t-err); } .tl.info { color: var(--t-dim); }
.term-in { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-top: 1px solid #1f2633; background: var(--t-bar); }
.term-in .prompt { font: 600 13px var(--mono); color: var(--t-ok); white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.term-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--t-text); font: 14px var(--mono); min-height: 36px; }
.term-in input::placeholder { color: #4f5a6b; }
.term-run { width: 36px; height: 36px; border-radius: 10px; border: 0; background: #2a2414; color: var(--t-cmd); display: grid; place-items: center; cursor: pointer; }
.term.busy .term-run { opacity: 0.5; }
.term.busy .term-out::after { content: "▍"; color: var(--t-ok); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (max-width: 640px) { .term-in .prompt { display: none; } .term-in input { font-size: 16px; } }

/* progressive disclosure: rarely changed settings stay folded */
details.disclose > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; cursor: pointer; list-style: none; min-height: 32px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform var(--t-med) var(--ease-out); margin-right: 4px; align-self: center; }
details.disclose[open] > summary::before { transform: rotate(45deg); }
details.disclose[open] > :not(summary) { animation: unfold 260ms var(--ease-out) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
.ds-title { font-weight: 600; font-size: 16px; }
.ds-sub { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }

/* settings: group name on the left, controls on the right; one column on a phone */
.setgroup { display: grid; gap: 12px 40px; grid-template-columns: minmax(0, 1fr); padding: 24px 0; border-top: 1px solid var(--border); }
.setgroup:first-of-type { border-top: 0; padding-top: 4px; }
.sg-head { display: grid; gap: 4px; align-content: start; }
.sg-head h2 { font-size: 17px; }
.sg-head p { color: var(--text-2); font-size: 14px; }
.sg-head .pill { justify-self: start; margin-top: 6px; }
.sg-body > .card-body { padding: 16px 20px; }
.sg-body > .card-body + .card-body { border-top: 1px solid var(--border); }
.sg-body > .card-body.row.wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.sg-body > .card-body.row.wrap > .spacer { display: none; }
.sg-body > .card-body.row.wrap > .btn { width: 100%; }
@media (min-width: 900px) { .setgroup { grid-template-columns: 240px minmax(0, 1fr); } }
@media (max-width: 640px) { .sg-body > .card-body.row.wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sg-body > .card-body.row.wrap > .btn { padding: 0 8px; white-space: normal; line-height: 1.2; } }

/* ======================================================================================
   motion: entrances and live values
   ====================================================================================== */
.fade-in { animation: fadeup var(--t-slow) var(--ease-out) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.stack.fade-in { animation: none; }
.stack.fade-in > * { animation: fadeup 360ms var(--ease-out) both; }
.stack.fade-in > :nth-child(2) { animation-delay: 40ms; }
.stack.fade-in > :nth-child(3) { animation-delay: 80ms; }
.stack.fade-in > :nth-child(4) { animation-delay: 120ms; }
.stack.fade-in > :nth-child(5) { animation-delay: 160ms; }
.stack.fade-in > :nth-child(n + 6) { animation-delay: 200ms; }
.flash { animation: flash 900ms var(--ease-out); }
@keyframes flash { from { color: var(--fiber-ink); } }

/* ======================================================================================
   reduced motion and transparency: keep meaning, drop movement
   ====================================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .tr-flow { display: none; }
  .tr-step.tunnel.ok .tr-node { animation: none !important; box-shadow: 0 0 0 5px var(--fiber-soft); }
  .skeleton, .krow.checking .k-side::before { animation: none !important; }
}
@media (prefers-reduced-transparency: reduce) { .bottom-nav { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; } }

/* hero readout cells: one row when they fit, else even rows (3 + 2, 2 + 2, 3 + 3), never one cell alone */
.hero { container-type: inline-size; }
@container (min-width: 600px) and (max-width: 860px) {
  .hero-meta { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hero-meta .kv { grid-column: span 2; min-width: 0; }
  .hero-meta.n4 .kv, .hero-meta.n5 .kv:nth-last-child(-n+2) { grid-column: span 3; }
}

/* ======================================================================================
   eonlink brand: the same world as the site. Warm paper, ink, and one signal orange (the dot
   of the logo). The orange replaces the old yellow fiber: the route line, charts, focus halo.
   Headlines are big and tight like the wordmark; buttons are ink pills; surfaces are flat
   with hairlines instead of shadows.
   ====================================================================================== */
:root {
  --bg: #EFEDE8; --side-bg: #E8E5DE; --surface: #F8F7F4; --surface-2: #F1EFEA; --surface-3: #E6E3DC;
  --border: #DFDBD3; --border-strong: #CBC6BC;
  --text: #111111;          /* 17.3:1 on surface */
  --text-2: #3A3936;        /* 10.6:1 */
  --text-3: #66635D;        /* 5.6:1 */
  --accent: #111111; --accent-hover: #2A2A28; --accent-ink: #EFEDE8; --accent-soft: #E6E3DC; --accent-strong: #111111;
  --ink-btn: #111111; --ink-btn-hover: #2A2A28; --ink-btn-text: #F8F7F4;
  --fiber: #FF4F12;         /* the signal orange; never small text on paper */
  --fiber-line: #FF4F12; --fiber-soft: #FDE4DA;
  --fiber-ink: #B83A0B;     /* orange text on paper and on --fiber-soft, 5.1:1 */
  --packet: #FFFFFF;
  --ok: #17703F; --ok-led: #22A25C; --ok-soft: #E1EEE3;
  --warn: #8A5300; --warn-soft: #F6EAD2;
  --bad: #C0261F; --bad-soft: #F8E3DF;
  --idle: #66635D; --idle-soft: #E6E3DC;
  --focus: #111111; --halo: rgba(255, 79, 18, 0.30);
  --shadow-1: 0 1px 0 rgba(17, 17, 17, 0.03);
  --shadow-2: 0 2px 6px rgba(40, 24, 10, 0.06), 0 16px 40px rgba(40, 24, 10, 0.10);
  --shadow-3: 0 30px 80px rgba(40, 24, 10, 0.24);
  --scrim: rgba(17, 17, 17, 0.45);
  --chart-line: #FF4F12; --chart-fill: rgba(255, 79, 18, 0.12); --grid: #E6E3DC;
  --glass: rgba(239, 237, 232, 0.84);
  --r-sm: 10px; --r-md: 12px; --r-lg: 18px; --r-xl: 22px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --side-bg: #151514; --surface: #1A1A18; --surface-2: #21211F; --surface-3: #2A2A27;
    --border: #2C2B28; --border-strong: #3B3A36;
    --text: #EFEDE8; --text-2: #CFCBC3; --text-3: #9C988F;
    --accent: #EFEDE8; --accent-hover: #FFFFFF; --accent-ink: #111111; --accent-soft: #2A2A27; --accent-strong: #EFEDE8;
    --ink-btn: #EFEDE8; --ink-btn-hover: #FFFFFF; --ink-btn-text: #111111;
    --fiber: #FF5A1F; --fiber-line: #FF5A1F; --fiber-soft: rgba(255, 90, 31, 0.15); --fiber-ink: #FF8A5C; --packet: #FFE9DF;
    --ok: #3DD68C; --ok-led: #3DD68C; --ok-soft: rgba(61, 214, 140, 0.12);
    --warn: #F0B44C; --warn-soft: rgba(240, 180, 76, 0.13);
    --bad: #FF6B5E; --bad-soft: rgba(255, 107, 94, 0.13);
    --idle: #9C988F; --idle-soft: rgba(156, 152, 143, 0.14);
    --focus: #EFEDE8; --halo: rgba(255, 90, 31, 0.32);
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.01);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5); --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.65);
    --scrim: rgba(0, 0, 0, 0.6);
    --chart-line: #FF5A1F; --chart-fill: rgba(255, 90, 31, 0.12); --grid: #2A2A27;
    --glass: rgba(17, 17, 17, 0.8);
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --side-bg: #151514; --surface: #1A1A18; --surface-2: #21211F; --surface-3: #2A2A27;
  --border: #2C2B28; --border-strong: #3B3A36;
  --text: #EFEDE8; --text-2: #CFCBC3; --text-3: #9C988F;
  --accent: #EFEDE8; --accent-hover: #FFFFFF; --accent-ink: #111111; --accent-soft: #2A2A27; --accent-strong: #EFEDE8;
  --ink-btn: #EFEDE8; --ink-btn-hover: #FFFFFF; --ink-btn-text: #111111;
  --fiber: #FF5A1F; --fiber-line: #FF5A1F; --fiber-soft: rgba(255, 90, 31, 0.15); --fiber-ink: #FF8A5C; --packet: #FFE9DF;
  --ok: #3DD68C; --ok-led: #3DD68C; --ok-soft: rgba(61, 214, 140, 0.12);
  --warn: #F0B44C; --warn-soft: rgba(240, 180, 76, 0.13);
  --bad: #FF6B5E; --bad-soft: rgba(255, 107, 94, 0.13);
  --idle: #9C988F; --idle-soft: rgba(156, 152, 143, 0.14);
  --focus: #EFEDE8; --halo: rgba(255, 90, 31, 0.32);
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.01);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5); --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.65);
  --scrim: rgba(0, 0, 0, 0.6);
  --chart-line: #FF5A1F; --chart-fill: rgba(255, 90, 31, 0.12); --grid: #2A2A27;
  --glass: rgba(17, 17, 17, 0.8);
}

/* the logo: letters in the text colour, the dot orange */
.brand { display: grid; gap: 6px; padding: 4px 12px 26px; }
.brand .wordmark { width: 112px; height: auto; color: var(--text); display: block; }
.brand small { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.auth-card .brand { justify-items: center; text-align: center; padding: 0 0 26px; }
.auth-card .brand .wordmark { width: 148px; }

/* headlines like the site: big, tight, heavy */
.page-head h1, .status-line h1 { font-size: clamp(30px, 3.2vw, 44px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; text-wrap: balance; }
.status-line h2 { letter-spacing: -0.04em; font-weight: 700; }
.page-head { margin-bottom: 28px; }
.page-head p, .status-line p { font-size: 15.5px; }
.hero h1 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.05; letter-spacing: -0.04em; font-weight: 700; }
.card-head h2, .card-head h3 { font-size: 17px; letter-spacing: -0.02em; font-weight: 650; }
@media (max-width: 640px) { .page-head h1, .status-line h1 { font-size: 30px; line-height: 1.04; } }

/* surfaces: flat paper, hairlines */
.card, .hero { box-shadow: none; }
.card-head { border-bottom-color: var(--border); }
.metric { border-radius: var(--r-md); }

/* the side: the selected section is an ink pill, like the site's buttons */
.side { padding: 26px 14px; border-right-color: var(--border); }
.nav-item { border-radius: 999px; min-height: 42px; padding: 0 14px; }
.side > .ink { border-radius: 999px; background: var(--ink-btn); box-shadow: none; }
.side:not(:has(> .ink)) .nav-item[aria-current="page"] { background: var(--ink-btn); box-shadow: none; }
.side .nav-item[aria-current="page"], .side .nav-item[aria-current="page"] svg.i { color: var(--ink-btn-text); }
.side .nav-item[aria-current="page"] .badge { background: var(--fiber); color: #111111; }
.bottom-nav [aria-current="page"] { color: var(--text); }
.bottom-nav [aria-current="page"]::before { content: ""; position: absolute; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--fiber); }
.bottom-nav a, .bottom-nav button { position: relative; }

/* controls: pills, ink for the main action, the orange halo on focus */
.btn { border-radius: 999px; padding: 0 18px; font-weight: 600; }
.btn.sm { border-radius: 999px; padding: 0 14px; }
.btn.primary { box-shadow: none; }
.btn.primary:hover:not([disabled]) { background: var(--ink-btn-hover); }
.btn:focus-visible, .chip:focus-visible, .nav-item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fiber); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--ink-btn); color: var(--ink-btn-text); border-color: var(--ink-btn); }
.pill { border-radius: 999px; padding: 0 10px; }
.pill.accent { background: var(--fiber-soft); color: var(--fiber-ink); }
.input, .textarea, .select { border-radius: var(--r-md); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--text); box-shadow: 0 0 0 4px var(--halo); }
.seg { border-radius: 999px; }
.seg button { border-radius: 999px; }
.tabs > .ink, .tabs:not(:has(> .ink)) button[aria-selected="true"]::after { background: var(--fiber); height: 3px !important; }
.dialog { border-radius: 26px; }
.badge { background: var(--fiber); color: #111111; }
