/* AtomQuark Orbit console. Tokens and components follow the AtomQuark theme (amber accent on ink + slate).
   Dark mode is its own set of steps, not an inverted light theme. */

:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --field: #f6f7f9;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;

  --ink: #16181d;
  --text: #384152;
  --muted: #6b7280;
  --faint: #9aa1ae;

  --accent: #f59e0b;
  --accent-strong: #d97706;
  --accent-soft: #fff6ea;
  --accent-ring: rgba(245, 158, 11, 0.28);
  --brand-gradient: linear-gradient(135deg, #f7941e 0%, #f5a623 100%);

  --rail: #16181d;
  --rail-2: #1f2229;
  --rail-text: #b8bfcc;
  --rail-muted: #6f7685;

  --good: #0f8a3c;   --good-soft: #e7f6ec;
  --warn: #b45309;   --warn-soft: #fff4e0;
  --bad: #c2363a;    --bad-soft: #fdecec;
  --info: #2563eb;   --info-soft: #e8efff;

  --chart-series: #d97706;
  --chart-series-2: #2a78d6;
  --chart-grid: #eceef2;

  /* signal bands (status colours, always shipped with icon + label) */
  --band-excellent: #0f8a3c;
  --band-good: #2a78d6;
  --band-average: #b45309;
  --band-poor: #c2363a;
  --band-unknown: #9aa1ae;
  /* categorical order for version shares (validated light + dark; labels and a table carry identity) */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f12; --surface: #16181d; --surface-2: #1b1e24; --field: #1f2229;
    --line: #262a32; --line-strong: #323743;
    --ink: #f2f3f5; --text: #d4d8e0; --muted: #9aa1ae; --faint: #6f7685;
    --accent-strong: #f5a623; --accent-soft: #2a1f0e; --accent-ring: rgba(245, 158, 11, 0.35);
    --rail: #0b0c0f; --rail-2: #15171c;
    --good: #3fbf6b; --good-soft: #10261a; --warn: #f0a640; --warn-soft: #2b2010;
    --bad: #ef6b6e; --bad-soft: #2d1415; --info: #6b9bff; --info-soft: #121d36;
    --chart-grid: #262a32; --chart-series-2: #3987e5;
    --band-excellent: #3fbf6b; --band-good: #3987e5; --band-average: #f0a640; --band-poor: #ef6b6e; --band-unknown: #6f7685;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f12; --surface: #16181d; --surface-2: #1b1e24; --field: #1f2229;
  --line: #262a32; --line-strong: #323743;
  --ink: #f2f3f5; --text: #d4d8e0; --muted: #9aa1ae; --faint: #6f7685;
  --accent-strong: #f5a623; --accent-soft: #2a1f0e; --accent-ring: rgba(245, 158, 11, 0.35);
  --rail: #0b0c0f; --rail-2: #15171c;
  --good: #3fbf6b; --good-soft: #10261a; --warn: #f0a640; --warn-soft: #2b2010;
  --bad: #ef6b6e; --bad-soft: #2d1415; --info: #6b9bff; --info-soft: #121d36;
  --chart-grid: #262a32; --chart-series-2: #3987e5;
  --band-excellent: #3fbf6b; --band-good: #3987e5; --band-average: #f0a640; --band-poor: #ef6b6e; --band-unknown: #6f7685;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0; letter-spacing: -0.01em; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell: top navigation bar with grouped dropdowns ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.nav-bar { position: sticky; top: 0; z-index: 30; background: var(--rail); color: var(--rail-text); }
.nav-bar::after { content: ""; display: block; height: 3px; background: var(--brand-gradient); }
.nav-inner { max-width: 1560px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 8px; }
.nav-bar > .nav-inner { height: 60px; }
.nav-brand { display: flex; align-items: center; gap: 12px; margin-right: 18px; color: #fff; }
.nav-brand:hover { text-decoration: none; }
.nav-brand img { height: 22px; display: block; }
.nav-product { font-weight: 800; font-size: 15px; padding-left: 12px; border-left: 1px solid #343944; letter-spacing: .02em; color: #fff; }
.nav-groups { display: flex; align-items: stretch; height: 100%; gap: 2px; }
.nav-group { position: relative; display: flex; }
.nav-group-btn {
  display: flex; align-items: center; gap: 7px; background: transparent; border: 0; color: var(--rail-text);
  font-weight: 600; padding: 0 14px; cursor: pointer; position: relative;
}
.nav-group-btn:hover, .nav-group.open .nav-group-btn, .nav-group.current .nav-group-btn { color: #fff; }
.nav-group.current .nav-group-btn::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 10px; height: 2px; border-radius: 2px; background: var(--accent);
}
.nav-menu {
  display: none; position: absolute; top: calc(100% + 3px); left: 0; min-width: 300px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lg);
}
.nav-group.open .nav-menu { display: block; }
@media (hover: hover) and (min-width: 901px) { .nav-group:hover .nav-menu { display: block; } }
.nav-menu-right { left: auto; right: 0; min-width: 240px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: var(--radius-sm);
  color: var(--text); background: transparent; border: 0; text-align: left; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: var(--field); text-decoration: none; }
.nav-item b { display: block; color: var(--ink); font-weight: 600; }
.nav-item small { display: block; color: var(--muted); font-size: 12px; }
.nav-item-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--field); color: var(--muted); flex: none; }
.nav-item-icon svg { width: 17px; height: 17px; }
.nav-item.active .nav-item-icon { background: var(--accent-soft); color: var(--accent-strong); }
.nav-item.active b { color: var(--accent-strong); }
.nav-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-icon { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--rail-text); display: grid; place-items: center; cursor: pointer; }
.nav-icon:hover { background: var(--rail-2); color: #fff; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-user { position: relative; }
.nav-user .nav-menu { top: calc(100% + 14px); }
.nav-user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: #fff; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.nav-user-btn:hover { background: var(--rail-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-gradient); color: #1b1203; display: grid; place-items: center; font-weight: 800; }
.who { text-align: left; line-height: 1.2; }
.who b { display: block; font-size: 13px; }
.who small { color: var(--rail-muted); font-size: 11.5px; text-transform: capitalize; }
.nav-menu .who-card { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-menu .who-card b { color: var(--ink); display: block; }
.nav-menu .who-card small { color: var(--muted); }
.nav-burger { display: none; margin-left: auto; width: 38px; height: 38px; border: 0; border-radius: 8px; background: var(--rail-2); color: #fff; place-items: center; cursor: pointer; }
.nav-trail { background: var(--surface); border-bottom: 1px solid var(--line); }
.nav-trail .nav-inner { height: 38px; font-size: 13px; gap: 8px; overflow: hidden; white-space: nowrap; }
.nav-trail b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.nav-trail a { color: var(--muted); }
.nav-trail .sep { color: var(--faint); }
.content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 22px 24px 48px; }
@media (max-width: 900px) {
  .nav-burger { display: grid; }
  .nav-tools .who { display: none; }
  .nav-groups {
    display: none; position: absolute; top: 63px; left: 0; right: 0; height: auto; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 8px 16px 16px;
    max-height: calc(100vh - 63px); overflow-y: auto;
  }
  .nav-groups.open { display: flex; }
  .nav-group { flex-direction: column; }
  .nav-group-btn { color: var(--muted); padding: 12px 4px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; cursor: default; }
  .nav-group-btn svg, .nav-group.current .nav-group-btn::after { display: none; }
  .nav-group-btn:hover, .nav-group.open .nav-group-btn, .nav-group.current .nav-group-btn { color: var(--muted); }
  .nav-menu { display: block; position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; }
  .nav-user .nav-menu { position: absolute; display: none; }
  .nav-user.open .nav-menu { display: block; }
  .nav-inner { padding: 0 16px; }
  .nav-product { display: none; }
  .content { padding: 16px; }
  .nav-tools { margin-left: 8px; }
}

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-head .sub { margin-left: 0; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card h3 { font-size: 15px; }
.card .sub { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1200px) { .cols-5, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cols-5, .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-gradient); border-color: transparent; color: #1b1203; }
.btn-primary:hover { filter: brightness(1.03); border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--field); }
.btn-danger { color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 5px; }
.btn-xs svg { width: 13px; height: 13px; }
.icon-btn { width: 38px; padding: 0; justify-content: center; }
.btn-sm.icon-btn { width: 32px; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--field); color: var(--ink); width: 100%; min-width: 0;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
.input-sm { height: 30px; padding: 0 8px; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent-strong); }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 34px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px; }
.filters .field { width: 180px; }
.filters .field.wide { width: 240px; }
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.seg button svg { width: 13px; height: 13px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- chips / status (icon + label, never colour alone) ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; background: var(--field); color: var(--text); }
.chip svg { width: 12px; height: 12px; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent-strong); }
.chip.muted { background: var(--field); color: var(--muted); }
.band { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.band svg { width: 14px; height: 14px; }
.band.excellent { color: var(--band-excellent); }
.band.good { color: var(--band-good); }
.band.average { color: var(--band-average); }
.band.poor { color: var(--band-poor); }
.band.unknown { color: var(--band-unknown); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- stat tiles ---------- */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; color: inherit; }
.stat:hover { text-decoration: none; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; color: var(--muted); }
.stat.accent { background: var(--rail); border-color: var(--rail); }
.stat.accent .k, .stat.accent .d { color: var(--rail-text); }
.stat.accent .v { color: #fff; }
.stat.accent .v em { font-style: normal; background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-link { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat-link:hover, .stat-link:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); transform: translateY(-1px); }
.stat-link .go { position: absolute; right: 14px; top: 14px; opacity: 0; transition: opacity .15s; color: var(--accent-strong); }
.stat-link:hover .go, .stat-link:focus-visible .go { opacity: 1; }
.stat.accent .go { color: var(--accent); }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 16, 0.5); z-index: 50; display: flex; padding: 16px; }
.modal { margin: auto; width: min(640px, 100%); max-height: calc(100vh - 32px); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--accent); }
.modal-head h2 { font-size: 17px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal.danger .modal-head { border-top-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.form-error:empty { display: none; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .18s ease-out; }
.toast svg { width: 18px; height: 18px; margin-top: 1px; }
.toast.good svg { color: #3fbf6b; }
.toast.bad svg { color: #ef6b6e; }
.toast.warn svg { color: #f0a640; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.facts > div { padding: 9px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts > div:nth-child(odd) { border-right: 1px solid var(--line); }
.facts > div > span:first-child { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.facts b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } .facts > div:nth-child(odd) { border-right: 0; } }

.empty { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 16px; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); font-size: 13px; display: flex; gap: 10px; }
.callout svg { color: var(--info); width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); } .callout.warn svg { color: var(--warn); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button, .tabs a { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs .count { font-size: 11px; background: var(--field); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.tabs button.on, .tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- data grid ---------- */
.dg { display: flex; flex-direction: column; min-width: 0; }
.dg-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dg-bar .search-box { flex: 1 1 260px; max-width: 420px; }
.dg-bar .tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dg-sel { display: none; align-items: center; gap: 8px; padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.dg-sel.on { display: flex; }
.dg-sel b { color: var(--ink); }
.dg-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 220px; position: relative; }
.dg table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.dg th, .dg td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.dg thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 12px; z-index: 2; user-select: none; }
.dg thead tr.f th { top: 36px; padding: 4px 6px; background: var(--surface); font-weight: 500; }
.dg thead tr.h th { height: 36px; }
.dg thead th.sortable { cursor: pointer; }
.dg thead th.sortable:hover { color: var(--ink); }
.dg thead th .si { display: inline-flex; margin-left: 4px; color: var(--accent-strong); }
.dg thead th .si svg { width: 12px; height: 12px; }
.dg td.n, .dg th.n { text-align: right; font-variant-numeric: tabular-nums; }
.dg tbody tr:hover td { background: var(--surface-2); }
.dg tbody tr.selected td { background: var(--accent-soft); }
.dg td.cb, .dg th.cb { width: 36px; padding-left: 14px; padding-right: 4px; }
.dg td.cb input, .dg th.cb input { width: 15px; height: 15px; accent-color: var(--accent-strong); }
.dg .filter-in { height: 28px; font-size: 12px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--field); width: 100%; min-width: 70px; color: var(--ink); }
.dg .filter-in:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.dg .filter-in.active { border-color: var(--accent); background: var(--accent-soft); }
.dg-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dg-foot .pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.dg-foot select { height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--field); padding: 0 6px; }
.dg-loading { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 55%, transparent); display: none; place-items: center; z-index: 3; }
.dg.loading .dg-loading { display: grid; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.dg td a.id { font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.popover { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 10px; min-width: 240px; max-height: 420px; overflow: auto; }
.popover .check { display: flex; padding: 4px 4px; font-size: 13px; }
.popover .row { margin-bottom: 6px; }
.table-plain { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-plain th, .table-plain td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-plain th { background: var(--surface-2); font-size: 12px; color: var(--text); position: sticky; top: 0; }
.table-plain td.n, .table-plain th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 560px; }
.wrap-any { overflow-wrap: anywhere; white-space: normal; }

/* ---------- charts ---------- */
.chart-card .card-body { padding: 14px 18px 18px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .bar { fill: var(--chart-series); }
.chart .bar:hover, .chart .bar.hot { filter: brightness(1.1); }
.chart .line { fill: none; stroke: var(--chart-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-series); opacity: .12; }
.chart .dot { fill: var(--chart-series); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .value { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.chart .center-v { fill: var(--ink); font-size: 22px; font-weight: 800; }
.chart .center-k { fill: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.chart .seg-arc { stroke: var(--surface); stroke-width: 2; cursor: default; }
.chart .seg-arc:hover { filter: brightness(1.08); }
.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 5; display: none;
}
.tip b { display: block; }
.hbars { display: flex; flex-direction: column; }
.hbar { display: grid; grid-template-columns: minmax(110px, 36%) 1fr 64px; align-items: center; gap: 10px; padding: 4px 0; border-radius: 6px; color: inherit; }
.hbar:hover { background: var(--surface-2); text-decoration: none; }
.hbar .name { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.hbar .track { height: 12px; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-series); min-width: 2px; }
.hbar .num { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; padding-right: 4px; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text); }
.legend-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-list .li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.legend-list .li > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.legend-list .li > span:nth-child(2) svg { flex: none; }
.legend-list .li i, .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-list .li .n { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.legend-list .li .p { color: var(--muted); font-variant-numeric: tabular-nums; width: 48px; text-align: right; }
.donut-wrap { display: grid; grid-template-columns: minmax(130px, 200px) minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; } .donut-wrap .chart { max-width: 220px; margin: 0 auto; } }
.table-view { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-view th, .table-view td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table-view td.n, .table-view th.n { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; display: flex; gap: 2px; }
.meter span { display: block; height: 100%; }

/* ---------- device detail ---------- */
.device-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.device-head .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--rail); color: var(--accent); display: grid; place-items: center; flex: none; }
.device-head .ic svg { width: 26px; height: 26px; }
.device-head h1 { font-size: 22px; font-family: var(--mono); letter-spacing: 0; overflow-wrap: anywhere; }
.device-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.device-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.signal-big { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.signal-big .v { font-size: 34px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.signal-big .u { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.signal-big .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 4px; }
.scale { position: relative; height: 10px; border-radius: 999px; overflow: hidden; display: flex; margin: 16px 0 6px; }
.scale span { flex: 1; }
.scale-marker { position: relative; height: 0; }
.scale-marker i { position: absolute; top: -22px; width: 3px; height: 16px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.scale-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.channels { display: flex; flex-direction: column; gap: 10px; }
.channel { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.channel .ci { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--field); color: var(--muted); }
.channel.ok .ci { background: var(--good-soft); color: var(--good); }
.channel b { color: var(--ink); display: block; font-size: 13px; }
.channel small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.wake-result { margin-top: 12px; }

.ptree { font-size: 13px; }
.ptree details { margin-left: 14px; }
.ptree > details { margin-left: 0; }
.ptree summary { cursor: pointer; padding: 4px 6px; border-radius: 6px; display: flex; align-items: center; gap: 8px; list-style: none; }
.ptree summary::-webkit-details-marker { display: none; }
.ptree summary::before { content: ""; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .1s; flex: none; }
.ptree details[open] > summary::before { transform: rotate(90deg); }
.ptree summary:hover { background: var(--surface-2); }
.ptree summary .seg-name { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.ptree summary .cnt { color: var(--faint); font-size: 11.5px; }
.ptree summary .btn { margin-left: auto; visibility: hidden; }
.ptree summary:hover .btn, .ptree summary:focus-within .btn { visibility: visible; }
.ptree .leaf { display: grid; grid-template-columns: minmax(180px, 38%) 1fr auto; gap: 12px; padding: 4px 6px 4px 20px; border-bottom: 1px dashed var(--line); align-items: baseline; }
.ptree .leaf .pn { font-family: var(--mono); font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.ptree .leaf .pv { font-family: var(--mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.ptree .leaf .pt { font-size: 11px; color: var(--faint); white-space: nowrap; }
.ptree mark { background: var(--accent-soft); color: var(--accent-strong); border-radius: 3px; padding: 0 1px; }
@media (max-width: 640px) { .ptree .leaf { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- checks / readiness ---------- */
.checks { display: flex; flex-direction: column; }
.check-row { display: grid; grid-template-columns: 110px 180px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: baseline; }
.check-row:last-child { border-bottom: 0; }
.check-row b { color: var(--ink); }
@media (max-width: 640px) { .check-row { grid-template-columns: 1fr; gap: 4px; } }
.verdict { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.verdict .big { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; }
.verdict .big svg { width: 26px; height: 26px; }
.verdict.pass .big { background: var(--good-soft); color: var(--good); }
.verdict.warn .big { background: var(--warn-soft); color: var(--warn); }
.verdict.fail .big { background: var(--bad-soft); color: var(--bad); }

/* ---------- uploads / progress ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--accent-strong); }
.dropzone b { display: block; color: var(--ink); margin-top: 6px; }
.dropzone input { display: none; }
.progress { height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; display: flex; }
.progress span { display: block; height: 100%; }
.progress .p-done { background: var(--good); }
.progress .p-failed { background: var(--bad); }
.progress .p-sent { background: var(--info); }
.progress .p-cancelled { background: var(--faint); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-gradient); color: #1b1203; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { display: flex; gap: 14px; padding: 18px; color: inherit; }
.tile:hover { text-decoration: none; }
.tile .ti { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.tile .ti svg { width: 20px; height: 20px; }
.tile b { color: var(--ink); display: block; font-size: 15px; }
.tile small { color: var(--muted); font-size: 13px; }
.list-pick { display: flex; flex-direction: column; }
.list-pick button { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; text-align: left; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; }
.list-pick button:hover { background: var(--surface-2); }
.list-pick button.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list-pick b { color: var(--ink); }
.list-pick small { color: var(--muted); grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* ---------- sign-in ---------- */
.signin { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.signin-art {
  background: var(--rail); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background-image: radial-gradient(circle at 80% 20%, rgba(245,158,11,.25), transparent 45%), radial-gradient(circle at 10% 90%, rgba(43,108,240,.18), transparent 40%);
  position: relative; overflow: hidden;
}
.signin-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--brand-gradient); }
.signin-art img { height: 26px; }
.signin-art h1 { color: #fff; font-size: 40px; line-height: 1.1; max-width: 460px; }
.signin-art h1 em { font-style: normal; background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.signin-art p { color: var(--rail-text); max-width: 440px; }
.signin-art ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 10px; color: var(--rail-text); }
.signin-art li { display: flex; gap: 10px; align-items: center; }
.signin-art li svg { color: var(--accent); width: 18px; height: 18px; }
.signin-form { display: grid; place-items: center; padding: 32px 16px; background: var(--surface); }
.signin-form .box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.signin-form form { display: flex; flex-direction: column; gap: 14px; }
.signin-form h2 { font-size: 24px; }
.signin-form .mark { width: 44px; height: 44px; }
.btn-block { width: 100%; justify-content: center; height: 44px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert.ok { background: var(--good-soft); color: var(--good); }
@media (max-width: 860px) { .signin { grid-template-columns: 1fr; } .signin-art { display: none; } }
.status-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.status-page h1 { font-size: 26px; }

@media print { .nav-bar, .nav-trail, .dg-bar, .dg-foot, .toasts { display: none !important; } .dg-scroll { max-height: none; overflow: visible; } }
@media (forced-colors: active) { .chip, .band, .btn { border: 1px solid CanvasText; } }

/* ---------- tools, timelines, gauges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tone-good { color: var(--good) !important; } .tone-warn { color: var(--warn) !important; } .tone-bad { color: var(--bad) !important; }
.bar-inline { height: 8px; border-radius: 0 4px 4px 0; background: var(--chart-series); display: inline-block; vertical-align: middle; }
.tl { list-style: none; display: flex; gap: 0; padding: 0; margin: 6px 0 0; font-size: 12px; color: var(--faint); }
.tl li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; text-transform: capitalize; }
.tl li span { width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); position: relative; z-index: 1; }
.tl li::before { content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: var(--line-strong); }
.tl li:first-child::before { display: none; }
.tl li.past { color: var(--text); } .tl li.past span, .tl li.past::before { background: var(--good); }
.tl li.now { color: var(--ink); font-weight: 700; } .tl li.now span { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.tl li.now::before { background: var(--good); }
.tl li.now.done span { background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.tl li.now.failed span, .tl li.now.cancelled span { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.factors { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.factors li b { color: var(--ink); font-size: 13px; }
.factors small { display: block; font-size: 12px; line-height: 1.35; margin-top: 2px; }
.factors .meter { margin-top: 3px; height: 6px; }
.nav-menu.cols { min-width: 620px; }
.nav-group.open .nav-menu.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
@media (hover: hover) and (min-width: 901px) { .nav-group:hover .nav-menu.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; } }
@media (max-width: 900px) { .nav-menu.cols, .nav-group.open .nav-menu.cols { display: block; min-width: 0; } }
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; list-style: none; padding: 0; }
.wizard-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--field); color: var(--muted); font-weight: 600; font-size: 13px; }
.wizard-steps li b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--muted); font-size: 12px; }
.wizard-steps li.on { background: var(--accent-soft); color: var(--accent-strong); } .wizard-steps li.on b { background: var(--brand-gradient); color: #1b1203; }
.wizard-steps li.done { color: var(--text); } .wizard-steps li.done b { background: var(--good); color: #fff; }
.stage-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.stage-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.stage-box.now { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.stage-box.past { background: var(--good-soft); border-color: transparent; }
.stage-box b { color: var(--ink); }
.log { font-family: var(--mono); font-size: 12.5px; background: var(--rail); color: #d4d8e0; border-radius: var(--radius-sm); padding: 10px 12px; max-height: 480px; overflow: auto; }
.log div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
.log .sev { display: inline-block; min-width: 56px; font-weight: 700; }
.log .s0, .log .s1, .log .s2, .log .s3 { color: #ef6b6e; } .log .s4 { color: #f0a640; } .log .s5, .log .s6 { color: #6b9bff; } .log .s7 { color: #9aa1ae; }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--rail); color: #e6e8ec; border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; white-space: pre; }
.docs h2 { font-size: 18px; margin: 24px 0 8px; } .docs h3 { font-size: 15px; margin: 18px 0 6px; } .docs p { margin: 6px 0; }
.docs .ep { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.docs .verb { font-family: var(--mono); font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--info-soft); color: var(--info); }
.docs .verb.post { background: var(--accent-soft); color: var(--accent-strong); }
@media print { .wizard-steps, .page-head .actions, .btn { display: none !important; } .card { box-shadow: none; break-inside: avoid; } body { background: #fff; } }
