/* Velocity Key Manager - web UI stylesheet.
 * Colours are tokens on :root. The default theme is dark (theme-init.js stamps
 * <html data-theme="dark"> unless the user chose light or "follow system");
 * "follow system" leaves the attribute off and the media query decides. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-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+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --surface-inset: #f2f4f8;
  --border: #e6e9f0;
  --border-strong: #d3d8e2;
  --text: #101626;
  --text-2: #4a5366;
  --text-3: #636b7d;
  --brand: #3d6af2;
  --brand-hover: #2f5ae0;
  --brand-soft: #ebf0ff;
  --brand-text: #2f5ae0;
  --on-brand: #ffffff;
  /* starts at --brand: white text needs >= 4.5:1 across the whole gradient */
  --brand-grad: linear-gradient(135deg, #3d6af2 0%, #6a4cf5 100%);
  --focus: rgba(61, 106, 242, 0.32);
  --success: #15803d; --success-bg: #ebfaf1; --success-border: #b6e8c9;
  --warning: #a35a04; --warning-bg: #fff7e5; --warning-border: #f6d68a;
  --danger: #c22a2a;  --danger-bg: #fdf0f0; --danger-border: #f6c2c2;
  --info: #0b6aa2;    --info-bg: #edf7fe;   --info-border: #bde0f8;
  --neutral: #4a5366; --neutral-bg: #f0f2f6; --neutral-border: #dce0e8;
  --violet: #5b45cf;  --violet-bg: #f1eeff;
  /* icon-tile tones (identity accents for KPI and list icons, never data marks) */
  --tone-blue: #3d6af2;   --tone-blue-bg: #ebf0ff;
  --tone-green: #16a34a;  --tone-green-bg: #e8f8ee;
  --tone-amber: #c27803;  --tone-amber-bg: #fff4dc;
  --tone-red: #dc2645;    --tone-red-bg: #fdecef;
  --tone-violet: #6d4fe0; --tone-violet-bg: #f1ecff;
  --tone-cyan: #0891b2;   --tone-cyan-bg: #e5f7fb;
  --tone-slate: #4a5366;  --tone-slate-bg: #eef1f6;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e6e9f0;
  --sidebar-text: #4a5366;
  --sidebar-strong: #101626;
  --sidebar-muted: #636b7d;
  --sidebar-hover: #f2f4f8;
  --sidebar-active: #ebf0ff;
  --sidebar-active-text: #2449c8;
  --sidebar-active-icon: #3d6af2;
  --topbar-bg: rgba(244, 246, 250, 0.82);
  --input-bg: #ffffff;
  /* field and checkbox outlines: >= 3:1 against the surface (WCAG 1.4.11) */
  --input-border: #848b9e;
  --btn-border: #d6dbe5;
  --btn-bg: #ffffff;
  --overlay: rgba(16, 22, 38, 0.45);
  --shadow-sm: 0 1px 2px rgba(16, 22, 38, 0.05);
  --shadow: 0 4px 14px rgba(16, 22, 38, 0.07), 0 1px 3px rgba(16, 22, 38, 0.05);
  --shadow-lg: 0 24px 60px rgba(16, 22, 38, 0.18), 0 6px 16px rgba(16, 22, 38, 0.08);
  --card-shadow: 0 1px 2px rgba(16, 22, 38, 0.04), 0 2px 10px rgba(16, 22, 38, 0.035);
  --edge-shadow: rgba(16, 22, 38, 0.16);
  --code-bg: #0f1424;
  --code-text: #dbe4f3;
  /* chart tokens (validated categorical order + status steps) */
  --chart-surface: #ffffff;
  --grid: #eceef3;
  --axis: #cfd4dd;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --seq-250: #86b6ef; --seq-400: #3987e5; --seq-550: #1c5cab;
  --status-good: #0ca30c; --status-warning: #fab219; --status-serious: #ec835a; --status-critical: #d03b3b;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar-w: 252px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1118;
    --surface: #171a23;
    --surface-2: #1c202b;
    --surface-3: #242938;
    --surface-inset: #12141c;
    --border: #252a37;
    --border-strong: #343a4c;
    --text: #eceef4;
    --text-2: #a5abbd;
    --text-3: #8b92a6;
    --brand: #3d6af2;
    --brand-hover: #2f5ae0;
    --brand-soft: rgba(79, 124, 255, 0.15);
    --brand-text: #8fb0ff;
    --focus: rgba(110, 148, 255, 0.45);
    --success: #4ade80; --success-bg: rgba(34, 197, 94, 0.12); --success-border: rgba(74, 222, 128, 0.28);
    --warning: #fbbf24; --warning-bg: rgba(251, 191, 36, 0.11); --warning-border: rgba(251, 191, 36, 0.28);
    --danger: #fb7185;  --danger-bg: rgba(244, 63, 94, 0.13); --danger-border: rgba(251, 113, 133, 0.3);
    --info: #5cc0f7;    --info-bg: rgba(56, 189, 248, 0.11);  --info-border: rgba(56, 189, 248, 0.28);
    --neutral: #a5abbd; --neutral-bg: rgba(148, 158, 184, 0.12); --neutral-border: rgba(148, 158, 184, 0.22);
    --violet: #b3a6ff;  --violet-bg: rgba(139, 120, 255, 0.16);
    --tone-blue: #7da0ff;   --tone-blue-bg: rgba(79, 124, 255, 0.16);
    --tone-green: #4ade80;  --tone-green-bg: rgba(34, 197, 94, 0.14);
    --tone-amber: #fbbf24;  --tone-amber-bg: rgba(245, 158, 11, 0.15);
    --tone-red: #fb7185;    --tone-red-bg: rgba(244, 63, 94, 0.15);
    --tone-violet: #a78bfa; --tone-violet-bg: rgba(139, 92, 246, 0.17);
    --tone-cyan: #22d3ee;   --tone-cyan-bg: rgba(6, 182, 212, 0.14);
    --tone-slate: #a5abbd;  --tone-slate-bg: rgba(148, 158, 184, 0.13);
    --sidebar-bg: #13151d;
    --sidebar-border: #1f2330;
    --sidebar-text: #a5abbd;
    --sidebar-strong: #eceef4;
    --sidebar-muted: #8b92a6;
    --sidebar-hover: rgba(255, 255, 255, 0.045);
    --sidebar-active: rgba(79, 124, 255, 0.16);
    --sidebar-active-text: #ffffff;
    --sidebar-active-icon: #8fb0ff;
    --topbar-bg: rgba(15, 17, 24, 0.8);
    --input-bg: #1c202b;
    --input-border: #666d82;
    --btn-border: #2e3446;
    --btn-bg: #1f2330;
    --overlay: rgba(4, 6, 12, 0.66);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    --card-shadow: none;
    --edge-shadow: rgba(0, 0, 0, 0.5);
    --code-bg: #0b0d13;
    --chart-surface: #171a23;
    --grid: #232837;
    --axis: #363c4f;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --seq-250: #6da7ec; --seq-400: #2a78d6; --seq-550: #184f95;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1118;
  --surface: #171a23;
  --surface-2: #1c202b;
  --surface-3: #242938;
  --surface-inset: #12141c;
  --border: #252a37;
  --border-strong: #343a4c;
  --text: #eceef4;
  --text-2: #a5abbd;
  --text-3: #8b92a6;
  --brand: #3d6af2;
  --brand-hover: #2f5ae0;
  --brand-soft: rgba(79, 124, 255, 0.15);
  --brand-text: #8fb0ff;
  --focus: rgba(110, 148, 255, 0.45);
  --success: #4ade80; --success-bg: rgba(34, 197, 94, 0.12); --success-border: rgba(74, 222, 128, 0.28);
  --warning: #fbbf24; --warning-bg: rgba(251, 191, 36, 0.11); --warning-border: rgba(251, 191, 36, 0.28);
  --danger: #fb7185;  --danger-bg: rgba(244, 63, 94, 0.13); --danger-border: rgba(251, 113, 133, 0.3);
  --info: #5cc0f7;    --info-bg: rgba(56, 189, 248, 0.11);  --info-border: rgba(56, 189, 248, 0.28);
  --neutral: #a5abbd; --neutral-bg: rgba(148, 158, 184, 0.12); --neutral-border: rgba(148, 158, 184, 0.22);
  --violet: #b3a6ff;  --violet-bg: rgba(139, 120, 255, 0.16);
  --tone-blue: #7da0ff;   --tone-blue-bg: rgba(79, 124, 255, 0.16);
  --tone-green: #4ade80;  --tone-green-bg: rgba(34, 197, 94, 0.14);
  --tone-amber: #fbbf24;  --tone-amber-bg: rgba(245, 158, 11, 0.15);
  --tone-red: #fb7185;    --tone-red-bg: rgba(244, 63, 94, 0.15);
  --tone-violet: #a78bfa; --tone-violet-bg: rgba(139, 92, 246, 0.17);
  --tone-cyan: #22d3ee;   --tone-cyan-bg: rgba(6, 182, 212, 0.14);
  --tone-slate: #a5abbd;  --tone-slate-bg: rgba(148, 158, 184, 0.13);
  --sidebar-bg: #13151d;
  --sidebar-border: #1f2330;
  --sidebar-text: #a5abbd;
  --sidebar-strong: #eceef4;
  --sidebar-muted: #8b92a6;
  --sidebar-hover: rgba(255, 255, 255, 0.045);
  --sidebar-active: rgba(79, 124, 255, 0.16);
  --sidebar-active-text: #ffffff;
  --sidebar-active-icon: #8fb0ff;
  --topbar-bg: rgba(15, 17, 24, 0.8);
  --input-bg: #1c202b;
  --input-border: #666d82;
  --btn-border: #2e3446;
  --btn-bg: #1f2330;
  --overlay: rgba(4, 6, 12, 0.66);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --card-shadow: none;
  --edge-shadow: rgba(0, 0, 0, 0.5);
  --code-bg: #0b0d13;
  --chart-surface: #171a23;
  --grid: #232837;
  --axis: #363c4f;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --seq-250: #6da7ec; --seq-400: #2a78d6; --seq-550: #184f95;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p { margin: 0 0 8px; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; color: var(--text-2); background: var(--surface-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); }
[hidden] { display: none !important; }
.noscript { padding: 40px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { word-break: break-all; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.gap-lg { gap: 16px; }
.ok-text { color: var(--success); }
.warn-text { color: var(--warning); }
.danger-text { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- boot / spinner */
.boot-screen { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  animation: spin 0.7s linear infinite; vertical-align: -3px;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 16px; color: var(--text-3); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--sidebar-bg) calc(var(--sidebar-w) - 1px), var(--sidebar-border) calc(var(--sidebar-w) - 1px), var(--sidebar-border) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-text); display: flex; flex-direction: column; z-index: 40;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 20px 16px; color: var(--sidebar-strong); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 16px rgba(61, 106, 242, 0.32); }
.brand-name { font-weight: 750; font-size: 17px; letter-spacing: -0.02em; line-height: 1.1; }
.brand > div { min-width: 0; }
.brand-sub { font-size: 10.5px; color: var(--sidebar-muted); font-weight: 600; letter-spacing: 0.1em; margin-top: 2px; }
.nav { padding: 2px 12px 18px; flex: 1; }
.nav-section { margin-top: 16px; }
.nav-section:first-child { margin-top: 6px; }
.nav-section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sidebar-muted); font-weight: 650; padding: 0 12px 7px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 9px; margin-bottom: 1px;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 550; text-decoration: none; position: relative;
  transition: background 0.12s, color 0.12s;
}
.nav-link svg { opacity: 0.85; transition: color 0.12s; }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 600; }
.nav-link.active svg { opacity: 1; color: var(--sidebar-active-icon); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--brand-grad); color: #fff; border-radius: 10px; padding: 0 7px; line-height: 19px; min-width: 20px; text-align: center; }
/* not ".alert": that is the alert-box component and would restyle the pill */
.nav-count.nav-count-alert { background: #e11d48; }
.sidebar-foot { margin: 0 12px 14px; padding: 12px 14px; font-size: 11.5px; color: var(--sidebar-muted); border-radius: 12px; background: var(--sidebar-hover); display: flex; align-items: center; gap: 8px; }
.sidebar-foot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--status-good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-good) 22%, transparent); flex-shrink: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-toggle { display: none; }
.search-box { position: relative; flex: 0 1 440px; }
.search-box input { padding-left: 38px; padding-right: 36px; background: var(--surface); height: 40px; border-radius: 10px; text-overflow: ellipsis; }
.search-box .search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box > kbd { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-box input:focus ~ kbd, .search-box input:not(:placeholder-shown) ~ kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow-y: auto; z-index: 50;
}
.search-group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 650; padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); cursor: pointer; text-decoration: none; }
.search-item:hover, .search-item.active { background: var(--surface-3); text-decoration: none; }
.search-item .meta { margin-left: auto; font-size: 12px; color: var(--text-3); }
.search-item.muted { color: var(--text-3); cursor: default; }
.search-item.muted:hover { background: none; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions > .btn-icon { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.topbar-actions > .btn-icon:hover { color: var(--text); background: var(--surface-3); }
.topbar-divider { width: 1px; height: 28px; background: var(--border); margin: 0 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; font: inherit; }
.user-chip:hover { background: var(--surface-3); }
.user-chip > svg { color: var(--text-3); }
.avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--brand-grad); flex-shrink: 0; letter-spacing: 0.02em; }
.avatar-lg { width: 60px; height: 60px; font-size: 21px; border-radius: 16px; }
.user-chip .who { text-align: left; line-height: 1.25; }
.user-chip .who b { display: block; font-size: 13.5px; font-weight: 650; }
.user-chip .who span { font-size: 11.5px; color: var(--text-3); text-transform: capitalize; }
.jobs-pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--brand-text); background: var(--brand-soft); border-radius: 16px; padding: 0 12px; }
.jobs-pill:hover { text-decoration: none; filter: brightness(1.08); }
.content { padding: 28px 32px 56px; width: 100%; max-width: 1560px; margin: 0 auto; }
.sidebar-backdrop { display: none; }
.sidebar-head { display: flex; align-items: center; padding-right: 12px; position: sticky; top: 0; z-index: 2; background: var(--sidebar-bg); }
.sidebar-head .brand { flex: 1 1 auto; min-width: 0; }
.sidebar .nav-close { display: none; color: var(--sidebar-text); flex-shrink: 0; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  /* closed: no shadow bleeding into the page and out of the tab order */
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s; }
  .shell.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform 0.2s ease; }
  .sidebar .nav-close { display: inline-flex; }
  .shell.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 8px; }
  .content { padding: 20px 16px 40px; }
  .user-chip .who, .user-chip > svg, .topbar-divider { display: none; }
  .user-chip { padding: 2px; }
  .search-box > kbd { display: none; }
  .search-box { flex: 1 1 auto; min-width: 0; }
  /* results use the full phone width instead of the shrunken search box */
  .search-results { position: fixed; top: calc(var(--topbar-h) - 6px); left: 12px; right: 12px; max-height: calc(100vh - var(--topbar-h) - 12px); max-height: calc(100dvh - var(--topbar-h) - 12px); }
  .topbar-actions { gap: 6px; }
  .topbar-actions > .btn-icon { width: 36px; height: 36px; }
  .jobs-pill { padding: 0 10px; }
  .jobs-pill .jp-label { display: none; }
}

/* ---------------------------------------------------------------- page header */
.page-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header .titles { flex: 1 1 320px; min-width: 0; }
.page-header h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header .subtitle { color: var(--text-3); margin-top: 6px; font-size: 14px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--brand-text); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; min-height: 30px; }
.section-title h2 { font-size: 16px; }
.section-title .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--text); font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s, filter 0.12s;
  text-decoration: none; user-select: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: transparent; color: var(--on-brand); box-shadow: 0 6px 16px -6px rgba(61, 106, 242, 0.7); }
.btn-primary:hover { background: var(--brand-hover); border-color: transparent; color: var(--on-brand); }
.btn-danger { background: var(--btn-bg); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid { background: #d1253f; border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(209, 37, 63, 0.7); }
.btn-danger-solid:hover { background: #b51d35; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; gap: 4px; border-radius: 7px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }
.btn .spinner { width: 13px; height: 13px; border-width: 2px; border-color: currentColor; border-top-color: transparent; opacity: 0.8; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-text); font: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------------------------------------------------------------- forms */
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 10px;
  background: var(--input-bg); color: var(--text); font: 13.5px/1.4 var(--font);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
textarea.input { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; }
textarea.input.mono, .input.mono { font-family: var(--mono); font-size: 12.5px; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select.input[multiple] { height: auto; padding: 4px; background-image: none; }
select.input option { background: var(--surface); color: var(--text); }
.input::placeholder, textarea.input::placeholder { color: var(--text-3); opacity: 0.85; }
.input:hover { border-color: color-mix(in srgb, var(--input-border) 65%, var(--text)); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--text-3); }
.input-sm, select.input.input-sm { height: 32px; font-size: 13px; border-radius: 8px; }
select.input.input-sm { padding-right: 28px; background-position: right 9px center; }
/* native spinners and the search clear glyph ignore the theme */
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input[type="number"]::-webkit-inner-spin-button, .input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-left: 6px; cursor: pointer; background-color: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="search"]::-webkit-search-cancel-button:hover { background-color: var(--text); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; margin-left: -1px; height: auto; box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2, .form-grid .field-wide { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 12.5px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.field .req { color: var(--danger); font-weight: 700; }
.field .help { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.field .error-msg { font-size: 12px; color: var(--danger); font-weight: 500; }
.field.has-error .input { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px var(--danger-bg); }
.field .secret-note { font-size: 11.5px; color: var(--success); display: flex; gap: 4px; align-items: center; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 38px; }
.pw-wrap .pw-toggle { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); height: 28px; width: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 5px; }
.pw-wrap .pw-toggle:hover { color: var(--text); background: var(--surface-3); }
fieldset.field-group { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; margin: 0; min-width: 0; }
fieldset.field-group > legend, details.field-group > summary { font-weight: 650; font-size: 12.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
fieldset.field-group > legend { padding: 0 6px; margin-left: 10px; }
fieldset.field-group > .form-grid { padding: 6px 14px 14px; }
details.field-group { border: 1px solid var(--border); border-radius: var(--radius-lg); }
details.field-group > summary { cursor: pointer; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
details.field-group > summary::-webkit-details-marker { display: none; }
details.field-group > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform 0.15s; margin-right: 4px; }
details.field-group[open] > summary::before { transform: rotate(45deg); }
details.field-group > .form-grid { padding: 4px 14px 14px; }
details:not(.field-group) > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
details:not(.field-group) > summary::-webkit-details-marker { display: none; }
details:not(.field-group) > summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin: 0 1px; }
details:not(.field-group)[open] > summary::before { transform: rotate(45deg); }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13.5px; line-height: 1.4; }
.check input { margin: 2px 0 0; width: 15px; height: 15px; accent-color: var(--brand); flex-shrink: 0; }
/* themed checkbox (the native one is a flat grey OS square in dark mode) */
.check input[type="checkbox"], .table .col-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 1px 0 0; flex-shrink: 0;
  border: 1.5px solid var(--input-border); border-radius: 5px; background: var(--input-bg);
  display: inline-grid; place-content: center; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.check input[type="checkbox"]:hover, .table .col-check input[type="checkbox"]:hover { border-color: color-mix(in srgb, var(--input-border) 65%, var(--text)); }
.check input[type="checkbox"]:checked, .table .col-check input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
.check input[type="checkbox"]:checked::after, .table .col-check input[type="checkbox"]:checked::after {
  content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg);
}
.check input[type="checkbox"]:indeterminate, .table .col-check input[type="checkbox"]:indeterminate { background: var(--brand); border-color: var(--brand); }
.check input[type="checkbox"]:indeterminate::after, .table .col-check input[type="checkbox"]:indeterminate::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: #fff; }
.check input[type="checkbox"]:focus-visible, .table .col-check input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); border-color: var(--brand); }
.check input[type="checkbox"]:disabled, .table .col-check input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: 10px; background: var(--input-bg); max-height: 236px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.check-list .check small { display: block; color: var(--text-3); font-size: 11.5px; }
.switch { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; user-select: none; }
/* `.field > label` centres its children; a switch with help text keeps its track on the title line */
.field > label.switch { align-items: flex-start; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 34px; height: 20px; border-radius: 12px; background: var(--input-border); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus); }
.switch .switch-label { line-height: 1.35; padding-top: 1px; }
.switch .switch-label small { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; margin-top: 2px; }
@media (min-width: 761px) {
  /* a bare switch beside a labelled input lines up with the input, not its label */
  .form-grid > .field.beside-input:not(.span-2) { padding-top: 23px; }
  .form-grid > .field.beside-input:not(.span-2) > .switch:not(:has(small)) { min-height: 38px; align-items: center; }
  .form-grid > .field.beside-input:not(.span-2) > .switch:not(:has(small)) .switch-label { padding-top: 0; }
}
.kv-editor { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 6px; }
.form-alert { margin-bottom: 14px; }
.form-alert:empty { display: none; }
[data-alert]:not(:empty) { margin-bottom: 16px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--card-shadow); min-width: 0; }
.card-header { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 4px; min-height: 0; }
.card-header h2, .card-header h3 { font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-header .sub { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-top: 3px; }
.card-header > div:first-child { min-width: 0; }
.card-header .actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
/* a ghost link button's padding would stop its chevron short of the content edge */
.card-header .actions > .btn-ghost:not(.btn-icon):last-child { margin-right: -11px; }
.card-body { padding: 14px 20px 20px; }
.card-body.flush { padding: 0; }
.card-header + .card-body.flush, .card-header + .dt { margin-top: 12px; }
.card-footer { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* tables are clipped to the card's rounded corners (header band, hovered or selected last row) */
.card:has(.table-wrap) { overflow: clip; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-2 > .card, .grid > .card { height: 100%; }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
@media (max-width: 640px) {
  /* card titles keep a readable width; actions move under them */
  .card-header { flex-wrap: wrap; }
  .card-header > div:first-child { flex: 1 1 200px; }
}

/* ---------------------------------------------------------------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px 15px;
  box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--text); position: relative; overflow: hidden;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
a.kpi:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 6px; padding-right: 40px; min-height: 32px; line-height: 1.3; }
.kpi .kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-3); }
.kpi .kpi-icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-slate-bg); color: var(--tone-slate); }
.kpi.tone-danger .kpi-icon { background: var(--tone-red-bg); color: var(--tone-red); }
.kpi.tone-warning .kpi-icon { background: var(--tone-amber-bg); color: var(--tone-amber); }
.kpi.tone-success .kpi-icon { background: var(--tone-green-bg); color: var(--tone-green); }
.kpi.tone-brand .kpi-icon { background: var(--tone-blue-bg); color: var(--tone-blue); }
.kpi.tone-danger.has-value .kpi-value { color: var(--danger); }
.kpi.tone-warning.has-value .kpi-value { color: var(--warning); }
a.kpi .kpi-sub { color: var(--brand-text); display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px 14px 13px; }
  .kpi .kpi-icon { right: 10px; top: 10px; width: 30px; height: 30px; }
  .kpi .kpi-label { padding-right: 34px; font-size: 12px; }
  .kpi .kpi-value { font-size: 20px; }
}
.meter { height: 6px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--brand); }

/* stat cards: icon tile + label, hero value, delta chip, captioned meter (dashboard) */
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.stat-card {
  --tone: var(--tone-blue); --tone-bg: var(--tone-blue-bg);
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--card-shadow);
  color: var(--text); text-decoration: none; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
a.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.stat-card.tone-green { --tone: var(--tone-green); --tone-bg: var(--tone-green-bg); }
.stat-card.tone-amber { --tone: var(--tone-amber); --tone-bg: var(--tone-amber-bg); }
.stat-card.tone-red { --tone: var(--tone-red); --tone-bg: var(--tone-red-bg); }
.stat-card.tone-violet { --tone: var(--tone-violet); --tone-bg: var(--tone-violet-bg); }
.stat-card.tone-cyan { --tone: var(--tone-cyan); --tone-bg: var(--tone-cyan-bg); }
.stat-head { display: flex; align-items: center; gap: 11px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.icon-tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-bg, var(--tone-blue-bg)); color: var(--tone, var(--tone-blue)); flex-shrink: 0; }
.stat-value { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stat-value b { font-size: 32px; font-weight: 720; letter-spacing: -0.03em; line-height: 1.05; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-top: auto; }
.stat-foot .pct { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-meter { height: 7px; border-radius: 6px; background: color-mix(in srgb, var(--tone) 16%, transparent); overflow: hidden; margin-top: -4px; }
.stat-meter > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 55%, transparent), var(--tone)); min-width: 3px; }
.stat-meter.tone-green, .stat-meter.tone-amber, .stat-meter.tone-red, .stat-meter.tone-blue, .stat-meter.tone-violet { background: color-mix(in srgb, var(--tone) 16%, transparent); }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); }
.delta svg { width: 12px; height: 12px; }
.delta.good { background: var(--success-bg); color: var(--success); }
.delta.bad { background: var(--danger-bg); color: var(--danger); }
.delta.warn { background: var(--warning-bg); color: var(--warning); }
.delta.info { background: var(--brand-soft); color: var(--brand-text); }
@media (max-width: 1280px) { .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stat-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; } }

/* ranked lists with icon tiles (dashboard list cards) */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.rank-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.rank-list > li:first-child { padding-top: 4px; }
.rank-list .icon-tile { width: 38px; height: 38px; border-radius: 11px; font-size: 12px; font-weight: 750; letter-spacing: 0.02em; color: color-mix(in srgb, var(--tone, var(--tone-blue)) 70%, var(--text)); }
.rank-list .ri-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rank-list .ri-main b, .rank-list .ri-main a.ri-title { font-weight: 600; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .ri-main span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .ri-val { font-weight: 650; font-size: 13.5px; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.rank-list .ri-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rank-list .delta { min-width: 46px; justify-content: center; }
.tone-blue { --tone: var(--tone-blue); --tone-bg: var(--tone-blue-bg); }
.tone-green { --tone: var(--tone-green); --tone-bg: var(--tone-green-bg); }
.tone-amber { --tone: var(--tone-amber); --tone-bg: var(--tone-amber-bg); }
.tone-red { --tone: var(--tone-red); --tone-bg: var(--tone-red-bg); }
.tone-violet { --tone: var(--tone-violet); --tone-bg: var(--tone-violet-bg); }
.tone-cyan { --tone: var(--tone-cyan); --tone-bg: var(--tone-cyan-bg); }
.tone-slate { --tone: var(--tone-slate); --tone-bg: var(--tone-slate-bg); }

/* welcome header + range control */
.welcome h1 { font-size: 28px; }
.welcome .wave { display: inline-block; }
.range-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.range-seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 8px; font: 600 12.5px/1 var(--font); color: var(--text-3); cursor: pointer; transition: background 0.12s, color 0.12s; }
.range-seg button:hover { color: var(--text); }
.range-seg button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.range-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dash-body { transition: opacity 0.15s; }
.dash-body.loading { opacity: 0.55; pointer-events: none; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.table-wrap:focus-visible { outline-offset: -2px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3);
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: relative;
}
.table th:first-child { padding-left: 20px; }
.table th:last-child { padding-right: 20px; }
.table td:first-child { padding-left: 20px; }
.table td:last-child { padding-right: 20px; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ind { display: inline-block; width: 10px; margin-left: 4px; color: var(--brand-text); }
.table th .th-lc { text-transform: none; }
.table th.sortable:focus-visible { outline-offset: -2px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-3) 55%, transparent); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.table tbody tr.selected td { background: var(--brand-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
/* row actions stay in view when a wide table scrolls sideways (not on phones, where a pinned
   column would leave the data a few words wide) */
@media (min-width: 761px) {
  .table-wrap.overflowing td.actions-cell, .table-wrap.overflowing th.actions-cell { position: sticky; right: 0; z-index: 1; background-color: var(--surface); box-shadow: -12px 0 10px -10px var(--edge-shadow); }
  .table-wrap.overflowing th.actions-cell { background-color: var(--surface-2); }
  .table-wrap.overflowing tbody tr:hover td.actions-cell { background: color-mix(in srgb, var(--surface-3) 55%, var(--surface)); }
  .table-wrap.overflowing tbody tr.selected td.actions-cell { background: linear-gradient(var(--brand-soft), var(--brand-soft)), var(--surface); }
  /* no pinned column to cast the edge shadow: fade the right edge until the table is scrolled to its end */
  .table-wrap.overflowing:not(.at-end):not(:has(td.actions-cell)) { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
}
@media (max-width: 760px) {
  .table-wrap.overflowing:not(.at-end) { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
}
.table .col-check { width: 36px; padding-right: 0; }
.table .col-check input { width: 15px; height: 15px; accent-color: var(--brand); vertical-align: middle; }
.table .cell-title { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); }
.table-compact td, .table-compact th { padding: 8px 12px; }
.table-footer { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.table-footer .pager { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.table-footer select.input { height: 30px; width: auto; font-size: 12.5px; padding-right: 26px; }
.table-loading { position: relative; }
.table-loading::after { content: ""; position: absolute; inset: 0; z-index: 2; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; background: var(--brand-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; }
.bulk-bar b { color: var(--brand-text); }
@media (max-width: 760px) {
  /* scroll sideways instead of squeezing text columns to a word per line */
  .table th:not(.col-check):not(:empty) { min-width: 110px; }
  .table .sev-list { min-width: 260px; }
}

/* ---------------------------------------------------------------- filters */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input { width: auto; }
.toolbar select.input { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 380px; }
.toolbar .search .input { width: 100%; padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.toolbar .check { font-size: 13px; white-space: nowrap; }
.toolbar .spacer { flex: 1; }

/* ---------------------------------------------------------------- badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 650; line-height: 1; white-space: nowrap; border: 1px solid transparent;
  background: var(--neutral-bg); color: var(--neutral);
}
.badge svg { width: 12px; height: 12px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-outline { background: transparent; border-color: var(--border-strong); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-lg { height: 27px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.grade { display: inline-grid; place-items: center; min-width: 36px; height: 27px; padding: 0 8px; border-radius: 8px; font-weight: 750; font-size: 13px; color: #fff; letter-spacing: -0.01em; }
.grade-lg { min-width: 56px; height: 46px; font-size: 22px; border-radius: 12px; }
.grade-A { background: #15803d; }
.grade-B { background: #4d7c0f; }
.grade-C { background: #b45309; }
.grade-D { background: #c2410c; }
.grade-E, .grade-F, .grade-T { background: #b91c1c; }
.grade-none { background: var(--neutral-bg); color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); max-width: 100%; white-space: nowrap; }
/* names (SANs, domains) can outgrow a phone-width column: let those break rather than overflow */
.chip.mono { font-family: var(--mono); font-size: 11.5px; white-space: normal; overflow-wrap: break-word; }
.chip.chip-clip { display: inline-block; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chip-tag { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status-dot.ok { background: var(--status-good); }
.status-dot.warn { background: var(--status-warning); }
.status-dot.bad { background: var(--status-critical); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 760px) {
  /* the scrollbar is hidden, so fade the right edge to show that more tabs follow */
  .tabs { padding-right: 28px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  /* once scrolled, the left edge fades as well (ui.js syncScrollFade sets .scrolled) */
  .tabs.scrolled { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 32px), transparent); }
}
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 14px; border: 0; background: none; cursor: pointer;
  font: 600 13.5px/1 var(--font); color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab:focus-visible { outline-offset: -2px; border-radius: 8px 8px 0 0; }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab.active svg { color: var(--brand-text); }
.tab .count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 2px 7px; border-radius: 8px; }
.tab.active .count { background: var(--brand-soft); color: var(--brand-text); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: 600 12.5px/1.2 var(--font); color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- alerts / empty */
.alert { display: flex; gap: 11px; padding: 12px 15px; border-radius: 12px; border: 1px solid var(--info-border); background: var(--info-bg); color: var(--text); font-size: 13px; line-height: 1.5; }
.alert > svg { color: var(--info); margin-top: 1px; }
.alert-success { border-color: var(--success-border); background: var(--success-bg); }
.alert-success > svg { color: var(--success); }
.alert-warning { border-color: var(--warning-border); background: var(--warning-bg); }
.alert-warning > svg { color: var(--warning); }
.alert-danger { border-color: var(--danger-border); background: var(--danger-bg); }
.alert-danger > svg { color: var(--danger); }
.alert b { font-weight: 650; }
.alert .alert-body { min-width: 0; flex: 1; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .empty-icon { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.empty h2, .empty h3 { font-size: 15px; margin-bottom: 4px; color: var(--text); letter-spacing: -0.01em; }
.empty p { color: var(--text-3); max-width: 440px; margin: 0 auto 14px; font-size: 13px; }
.error-state { padding: 40px 20px; text-align: center; }
.card .empty { padding: 30px 16px; }
.card .empty .empty-icon { width: 44px; height: 44px; margin-bottom: 10px; }
.error-state .empty-icon { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------- key/value lists */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt { color: var(--text-3); font-size: 12.5px; padding: 9px 0; border-bottom: 1px solid var(--border); font-weight: 500; }
.kv dd { margin: 0; padding: 9px 0 9px 12px; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.kv-wide { grid-template-columns: minmax(150px, 28%) minmax(0, 1fr); }
@media (max-width: 640px) {
  /* labels above values on phones; a 120-150px label column leaves values a few characters wide */
  .kv, .kv-wide { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding: 10px 0 1px; }
  .kv dd { padding: 0 0 10px; }
}
.fp { display: flex; align-items: flex-start; gap: 6px; }
.fp > .btn { margin-top: -4px; }
.fp code { word-break: break-all; font-size: 11.5px; color: var(--text-2); line-height: 1.5; }

/* ---------------------------------------------------------------- code / logs */
pre.code-block, .code-block {
  margin: 0; background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 13px 15px; border: 1px solid var(--border);
  font: 12px/1.55 var(--mono); overflow: auto; max-height: 360px; white-space: pre; position: relative;
  color-scheme: dark; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.code-wrap { position: relative; }
/* the Copy button sits in a band of its own above the first line, so long lines never run under it */
.code-wrap.has-copy > .code-block { padding-top: 42px; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 16px; z-index: 1; }
/* opaque (tint over the code surface): text scrolled beneath it must not show through */
.code-wrap .copy-btn.btn { background: linear-gradient(rgba(255,255,255,0.08), rgba(255,255,255,0.08)), var(--code-bg); color: #dbe4f3; border-color: rgba(255,255,255,0.12); box-shadow: none; }
.code-wrap .copy-btn.btn:hover { background: linear-gradient(rgba(255,255,255,0.16), rgba(255,255,255,0.16)), var(--code-bg); }
.log-viewer {
  background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); padding: 10px 12px; font: 12px/1.6 var(--mono);
  height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid rgba(255,255,255,0.05);
  color-scheme: dark; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.log-viewer .ln-err { color: #fca5a5; }
.log-viewer .ln-warn { color: #fcd34d; }
.log-viewer .ln-ok { color: #86efac; }
.log-viewer .ln-ts { color: #8394ae; }
.log-viewer .empty-log { color: #8394ae; font-style: italic; }
.progress { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width 0.3s ease; }
.progress.indeterminate > span { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
.progress.ok > span { background: var(--status-good); }
.progress.bad > span { background: var(--status-critical); }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.mini-progress { display: inline-block; width: 64px; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.mini-progress > span { display: block; height: 100%; background: var(--brand); }
.mini-progress.indeterminate > span { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- overlays: modal, drawer, menu, toast */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; animation: fade 0.12s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; display: flex; flex-direction: column; animation: pop 0.16s ease-out; border: 1px solid var(--border); max-height: calc(100vh - 8vh - 24px); }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 18px; }
.modal-header .modal-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.modal-header .close-btn { margin-left: auto; margin-top: -4px; margin-right: -8px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.modal-footer .left { margin-right: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .modal-footer .left { flex-basis: 100%; } }
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 90; animation: fade 0.12s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide 0.18s ease-out; border-left: 1px solid var(--border); }
.drawer-lg { width: min(860px, 100vw); }
.drawer .modal-body { padding: 20px 24px 30px; }
.menu { position: fixed; z-index: 120; min-width: 210px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; animation: pop 0.1s ease-out; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--text); font: 500 13px/1.2 var(--font); border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); text-decoration: none; outline: none; }
.menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.menu-item svg { color: var(--text-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: 12px; color: var(--text-3); }
.menu-head b { display: block; color: var(--text); font-size: 13px; }
.toasts { position: fixed; right: 16px; top: calc(var(--topbar-h) + 10px); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toasts .toast { pointer-events: auto; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 13px; animation: pop 0.16s ease-out; }
.toast > svg { color: var(--info); margin-top: 1px; }
.toast.success { border-left-color: var(--status-good); }
.toast.success > svg { color: var(--success); }
.toast.error { border-left-color: var(--status-critical); }
.toast.error > svg { color: var(--danger); }
.toast.warning { border-left-color: var(--status-warning); }
.toast.warning > svg { color: var(--warning); }
.toast .toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-title { font-weight: 650; }
.toast .toast-close { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0; margin: -2px -2px 0 0; }
.toast.leaving { opacity: 0; transform: translateX(20px); transition: all 0.2s; }

/* ---------------------------------------------------------------- login */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-hero {
  position: relative; overflow: hidden; color: #e6ebf7; padding: 56px 64px; display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(79, 124, 255, 0.45) 0%, transparent 62%),
    radial-gradient(760px 560px at 105% 110%, rgba(124, 77, 255, 0.42) 0%, transparent 58%),
    linear-gradient(160deg, #0d1222 0%, #0a0d17 100%);
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 75%);
}
.auth-hero > * { position: relative; }
.auth-hero .brand { padding: 0; color: #fff; }
.auth-hero .brand img { width: 42px; height: 42px; border-radius: 12px; }
.auth-hero .brand-name { font-size: 18px; }
.auth-hero .brand-sub { color: #8f9bb8; letter-spacing: 0.02em; font-weight: 500; font-size: 12px; }
.auth-hero h1 { font-size: 38px; line-height: 1.15; margin-top: auto; max-width: 520px; color: #fff; letter-spacing: -0.035em; font-weight: 750; }
.auth-hero p { color: #aab5cf; max-width: 470px; margin-top: 16px; font-size: 15.5px; line-height: 1.6; }
.auth-hero ul { list-style: none; padding: 0; margin: 30px 0 auto; display: grid; gap: 12px; max-width: 470px; }
.auth-hero li { display: flex; gap: 12px; align-items: center; color: #d3dbee; font-size: 14px; }
.auth-hero li svg { color: #9db7ff; background: rgba(79, 124, 255, 0.18); border-radius: 8px; padding: 5px; width: 26px; height: 26px; box-sizing: border-box; }
.auth-hero .hero-foot { font-size: 12px; color: #7d89a8; margin-top: 32px; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px 32px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 24px; letter-spacing: -0.025em; font-weight: 720; }
.auth-card .lead { color: var(--text-3); margin: 6px 0 26px; }
.auth-card .btn-primary { width: 100%; height: 44px; font-size: 14px; border-radius: 11px; }
.auth-card .input { height: 44px; border-radius: 11px; }
.auth-card .form-stack { gap: 16px; }
.auth-mobile-brand { display: none; margin-bottom: 28px; padding: 0; }
.otp-input { letter-spacing: 0.5em; text-align: center; font: 600 22px var(--mono) !important; height: 54px !important; }
.pw-rules { font-size: 12px; color: var(--text-3); display: grid; gap: 3px; }
.pw-rules span { display: flex; gap: 6px; align-items: center; }
.pw-rules span.ok { color: var(--success); }
@media (max-width: 900px) { .auth-screen { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-mobile-brand { display: flex; } .auth-mobile-brand .brand-name { color: var(--text); } .auth-card { padding: 28px 22px; } }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .bar { transition: opacity 0.12s; }
.chart .hit:hover + .bar, .chart .bar:hover { opacity: 0.8; }
.chart .value-label { fill: var(--text-2); font-weight: 600; }
.chart:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 10; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 11px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.chart-tooltip b { font-weight: 700; }
.chart-tooltip .tt-head { color: var(--text-3); font-size: 11.5px; margin-bottom: 5px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.chart-tooltip .tt-row b { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-key { width: 12px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.chart-tooltip .tt-row span:last-child { color: var(--text-2); }
/* the crosshair tooltip sits beside the line inside the plot (charts.js places it) */
.line-chart .chart-tooltip { transform: none; }
.line-chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.line-chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .dot { stroke: var(--chart-surface); stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 4px 0 14px; }
.chart-legend .cl-item { display: flex; align-items: center; gap: 12px; }
.chart-legend .cl-swatch { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.chart-legend .cl-swatch i { display: block; width: 14px; height: 3px; border-radius: 2px; }
.chart-legend .cl-label { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.chart-legend .cl-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; display: flex; align-items: baseline; gap: 8px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.donut-wrap .donut { width: 196px; flex-shrink: 0; position: relative; }
.donut .donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut .donut-center b { font-size: 30px; font-weight: 750; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.donut .donut-center span { font-size: 12px; color: var(--text-3); }
.donut circle[data-tip] { transition: opacity 0.12s; }
.donut circle[data-tip]:hover { opacity: 0.8; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; width: 100%; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); min-width: 0; text-decoration: none; }
a.legend-item:hover { color: var(--text); text-decoration: none; }
.legend-item .sw { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-item > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item .val { margin-left: auto; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.legend-item .pct { display: none; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 12.5px; }
.hbar .lbl { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; position: relative; border-radius: 6px; background: var(--surface-3); }
.hbar .fill { display: block; height: 10px; border-radius: 6px; background: var(--series-1); min-width: 4px; }
.hbar .num { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.hbars.stacked .hbar { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 4px; }
.hbars.stacked .hbar .lbl { grid-column: 1 / -1; white-space: normal; }
.gauge { position: relative; width: 200px; }
.gauge .gauge-val { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; }
.gauge .gauge-val b { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; display: block; line-height: 1; }
.gauge .gauge-val span { font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed .feed-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--tone-blue-bg); color: var(--tone-blue); flex-shrink: 0; }
.feed .feed-icon.fail { background: var(--tone-red-bg); color: var(--tone-red); }
.feed .feed-text { font-size: 13px; line-height: 1.4; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.feed .feed-text .action { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.feed .feed-time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* ---------------------------------------------------------------- wizard */
.wizard { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.step { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px; color: var(--text-3); font-weight: 550; font-size: 13.5px; border: 0; background: none; width: 100%; text-align: left; font-family: inherit; cursor: default; }
.step .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 1.5px solid var(--border-strong); color: var(--text-3); background: var(--surface); flex-shrink: 0; }
.step.done { color: var(--text-2); cursor: pointer; }
.step.done:hover { background: var(--surface-3); }
.step.done .num { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.step.current { color: var(--text); background: var(--brand-soft); }
.step.current .num { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px rgba(61, 106, 242, 0.8); }
.wizard-panel .card-body { padding: 22px 24px; }
.wizard-panel h2 { margin-bottom: 4px; }
.wizard-panel .step-desc { color: var(--text-2); margin-bottom: 20px; }
.wizard-nav { display: flex; justify-content: space-between; gap: 8px; }
/* when "Issue certificate" wraps to its own row on a phone it stays on the right, not under Back */
.wizard-nav [data-nav="next"] { margin-left: auto; }
/* phones: a row of numbered dots; the panel heading already names the current step */
@media (max-width: 900px) { .wizard { grid-template-columns: minmax(0, 1fr); } .steps { position: static; flex-direction: row; justify-content: space-between; overflow-x: auto; } .step { width: auto; } .step .lbl { display: none; } }

/* ---------------------------------------------------------------- catalog / option cards */
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.option-card {
  position: relative; display: flex; flex-direction: column; gap: 5px; padding: 14px 15px; border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.option-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.option-card.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--focus); }
.option-card.selected .badge-brand { background: var(--surface); }
.option-card .oc-title { font-weight: 650; font-size: 13.5px; line-height: 1.4; display: flex; align-items: flex-start; gap: 8px; padding-right: 16px; }
/* the icon tile centres on the first title line, so long titles don't leave it floating mid-text */
.option-card .oc-title .oc-icon { margin-top: calc((1.4em - 32px) / 2); }
.option-card .oc-desc { font-size: 12px; color: var(--text-3); line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.option-card .oc-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.option-card .oc-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--tone-blue-bg); color: var(--tone-blue); flex-shrink: 0; }
.option-card.featured { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.option-card .ribbon { position: absolute; top: -9px; right: 12px; background: var(--brand-grad); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; letter-spacing: 0.03em; }
.option-card input[type="radio"], .option-card input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.option-card .oc-check { position: absolute; top: 12px; right: 12px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.option-card.selected .oc-check { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); }
.catalog-section { margin-bottom: 18px; }
.catalog-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- CA tree */
.ca-tree { list-style: none; margin: 0; padding: 0; }
.ca-tree ul { list-style: none; margin: 0; padding-left: 34px; position: relative; }
.ca-tree ul::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 26px; border-left: 2px solid var(--border-strong); }
.ca-tree li { position: relative; margin-top: 10px; }
.ca-tree ul > li::before { content: ""; position: absolute; left: -18px; top: 28px; width: 16px; border-top: 2px solid var(--border-strong); }
.ca-node { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--card-shadow); text-decoration: none; color: var(--text); }
.ca-node:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.ca-node .ca-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--violet-bg); color: var(--violet); flex-shrink: 0; }
.ca-node.root .ca-icon { background: var(--brand-soft); color: var(--brand-text); }
.ca-node .ca-main { flex: 1; min-width: 0; }
.ca-node .ca-name { font-weight: 650; display: flex; min-width: 0; gap: 8px; align-items: center; flex-wrap: wrap; }
.ca-node .ca-dn { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-node .ca-stats { display: flex; gap: 18px; font-size: 12px; color: var(--text-3); }
.ca-node .ca-stats b { display: block; font-size: 15px; color: var(--text); font-weight: 650; }
@media (max-width: 760px) { .ca-node .ca-stats { display: none; } }

/* ---------------------------------------------------------------- chain diagram */
.chain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.chain li { display: flex; gap: 14px; }
.chain .rail { display: flex; flex-direction: column; align-items: center; width: 28px; flex-shrink: 0; }
.chain .rail .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0; }
.chain .rail .line { width: 2px; flex: 1; background: var(--border-strong); min-height: 14px; }
.chain li:last-child .rail .line { display: none; }
.chain .box { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 13px; margin-bottom: 12px; min-width: 0; background: var(--surface); }
.chain .box .t { font-weight: 600; overflow-wrap: anywhere; }
.chain .box .s { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- misc */
.protocol-matrix { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.proto { border: 1px solid var(--border); border-radius: 10px; padding: 9px; text-align: center; font-size: 12px; }
.proto b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.proto.on.bad { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.proto.on.good { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.proto.off { color: var(--text-3); background: var(--surface-2); }
@media (max-width: 640px) { .protocol-matrix { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sev-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.sev-list li .d { font-size: 12px; color: var(--text-3); }
.sev-list li > .badge { min-width: 76px; justify-content: center; }
.token-reveal { display: flex; gap: 8px; align-items: stretch; }
.token-reveal code { flex: 1; padding: 10px 12px; background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--radius); word-break: break-all; font-size: 12.5px; }
/* grouped manual-entry keys wrap between groups only, never inside one */
.token-reveal code.secret-key { letter-spacing: 0.08em; word-break: normal; overflow-wrap: normal; }
/* "Copy" turns into "Copied": a fixed width stops the key from re-wrapping on click */
.token-reveal > .btn:not(.btn-icon) { min-width: 86px; }
.qr-box { background: #fff; padding: 12px; border-radius: 10px; border: 1px solid var(--border); display: inline-block; line-height: 0; }
.qr-box svg { width: 196px; height: 196px; }
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.subnav button { display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px 12px; border-radius: 9px; border: 0; background: none; color: var(--text-2); font: 550 13.5px/1.2 var(--font); cursor: pointer; }
.subnav button:hover { background: var(--surface-3); color: var(--text); }
.subnav button.active { background: var(--brand-soft); color: var(--text); }
.subnav button.active svg { color: var(--brand-text); }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding-right: 28px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .subnav.scrolled { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 32px), transparent); }
  .subnav::-webkit-scrollbar { display: none; }
  .subnav button { white-space: nowrap; flex-shrink: 0; }
}
.days { font-variant-numeric: tabular-nums; }
.lifetime { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.lifetime > span { display: block; height: 100%; border-radius: 4px; }
.hero-cert { display: flex; gap: 16px; align-items: center; }
.hero-cert .cert-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 24px; text-align: center; color: var(--text-2); background: var(--surface-2); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .file-name { font-weight: 600; color: var(--text); margin-top: 6px; }
.dropzone input { display: none; }
.result-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.result-summary .rs { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); min-width: 0; }
.result-summary .rs span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.result-summary .rs b { font-size: 14px; overflow-wrap: anywhere; }
.drawer .result-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .drawer .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.job-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.job-head .job-meta { font-size: 12px; color: var(--text-3); }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.inline-list b { color: var(--text); font-weight: 600; }
.report-cat { margin-bottom: 22px; }
.report-cat h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 10px; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-decoration: none; color: var(--text); }
.report-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.report-card b { font-weight: 650; }
.report-card span { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.rule-row { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.rule-row:last-child { border-bottom: 0; }
.rule-row .rule-label { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) { .rule-row { grid-template-columns: 1fr; } }
.help-callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.help-callout > svg { color: var(--brand-text); margin-top: 1px; }
.help-callout b { color: var(--text); }
/* links inside running text need a non-colour cue (WCAG 1.4.1) */
:is(p, .help, .help-callout, .alert-body, .muted, .subtitle, .sub, .step-desc, .modal-sub, .empty p, .cell-sub, .kv dd, .feed-text) a:not(.btn),
.table td a.small:not(.btn) { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
/* a cell's link above its sub-line is a line of its own, not a link inside running text */
.table td > a:not(.btn):not(.cell-title):has(+ div) { display: inline-block; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-nav button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 9px; padding: 6px 13px; font: 600 12.5px var(--font); cursor: pointer; }
.pill-nav button.active { background: var(--brand); border-color: transparent; color: #fff; }
/* spacing comes from the mt-/mb- utilities on each use */
.divider-label { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
@media print { .sidebar, .topbar, .page-header .actions { display: none !important; } .shell { display: block; } }

/* manual (reseller) order instructions */
.order-steps { margin: 0; padding-left: 20px; }
.order-steps > li { padding-left: 4px; line-height: 1.55; }
.order-steps > li::marker { font-weight: 650; color: var(--brand, #4f46e5); }
