/* BlueHook Defense - design system
   Tokens on :root, dark theme under prefers-color-scheme (unless the user
   picked light) and under [data-theme="dark"]. Everything else is written
   against roles, never raw hex. */

:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --page: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8f0;
  --border-strong: #cfd7e3;
  --text: #0e1a2b;
  --text-2: #475569;
  --muted: #7b879b;
  --brand: #0a5cf5;
  --brand-ink: #0047c6;
  --brand-soft: #e7efff;
  --brand-btn: #0057e8;
  --focus: #93b4ff;

  --nav-bg: #001028;
  --nav-bg-2: #031c40;
  --nav-text: #a9b8d0;
  --nav-text-strong: #ffffff;
  --nav-active: rgba(96, 148, 255, .16);

  /* status (always paired with an icon or label) */
  --ok: #0f8a3c;      --ok-soft: #e6f6ec;
  --warn: #b45309;    --warn-soft: #fff4e0;
  --serious: #c2410c; --serious-soft: #ffede3;
  --danger: #c62828;  --danger-soft: #fdecec;
  --info: #2563eb;    --info-soft: #e8efff;
  --neutral-soft: #eef2f7;

  /* chart series (validated: tools/dataviz validator, light on #ffffff) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e8ecf2;
  --axis: #c9d1dd;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 6px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 18px 60px rgba(15, 23, 42, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0a101b; --surface: #111a29; --surface-2: #142035; --surface-3: #1a2740;
    --border: #22304a; --border-strong: #2f3f5e; --text: #e7edf7; --text-2: #a7b3c7; --muted: #73819b;
    --brand: #4f8bff; --brand-ink: #7aa6ff; --brand-soft: #172846; --brand-btn: #1d64f2; --focus: #3d6fe0;
    --nav-bg: #000a1c; --nav-bg-2: #021633;
    --ok: #34c06a; --ok-soft: #0f2a1c; --warn: #f0a92c; --warn-soft: #2e2410;
    --serious: #f0874f; --serious-soft: #321c12; --danger: #f06262; --danger-soft: #331517;
    --info: #6b9cff; --info-soft: #172846; --neutral-soft: #1a2740;
    --series-1: #3987e5; --series-2: #d95926; --grid: #1d2a40; --axis: #2f3f5e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a101b; --surface: #111a29; --surface-2: #142035; --surface-3: #1a2740;
  --border: #22304a; --border-strong: #2f3f5e; --text: #e7edf7; --text-2: #a7b3c7; --muted: #73819b;
  --brand: #4f8bff; --brand-ink: #7aa6ff; --brand-soft: #172846; --brand-btn: #1d64f2; --focus: #3d6fe0;
  --nav-bg: #000a1c; --nav-bg-2: #021633;
  --ok: #34c06a; --ok-soft: #0f2a1c; --warn: #f0a92c; --warn-soft: #2e2410;
  --serious: #f0874f; --serious-soft: #321c12; --danger: #f06262; --danger-soft: #331517;
  --info: #6b9cff; --info-soft: #172846; --neutral-soft: #1a2740;
  --series-1: #3987e5; --series-2: #d95926; --grid: #1d2a40; --axis: #2f3f5e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.lg { width: 20px; height: 20px; }
svg.i.xl { width: 28px; height: 28px; }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--nav-bg), var(--nav-bg-2)); color: var(--nav-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand .word { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.brand .word img { height: 22px; width: auto; display: block; }
.brand .word small { font-family: "Michroma", var(--font); font-size: 7.5px; letter-spacing: .32em; text-transform: uppercase; color: #9fb6df; white-space: nowrap; }
.nav { padding: 6px 12px 16px; flex: 1; }
.nav-sec { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #6f82a3;
  padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--nav-text);
  font-weight: 500; text-decoration: none; margin: 1px 0; position: relative;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: var(--nav-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: #6b9cff; }
.nav .count { margin-left: auto; background: #d23b3b; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 0 7px; line-height: 18px; }
.nav .count.soft { background: rgba(255, 255, 255, .12); color: #dbe5f5; }
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 12px; }
.side-foot .who { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }

.ws-switch { position: relative; }
.ws-btn {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-width: 240px; max-width: 360px;
  box-shadow: var(--shadow-sm);
}
.ws-btn:hover { border-color: var(--border-strong); }
.ws-btn .ws-ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 11px; flex: none; }
.ws-btn .ws-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.ws-btn .ws-sub { font-size: 11px; color: var(--muted); }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 300px; max-height: 420px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 50;
}
.menu.right { left: auto; right: 0; }
.menu input.menu-search { width: 100%; margin: 2px 0 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--text);
}
.menu-item:hover, .menu-item.focus { background: var(--surface-3); text-decoration: none; }
.menu-item .check { margin-left: auto; color: var(--brand); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

.icon-btn {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .dot { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; border-radius: 999px;
  background: #d23b3b; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px;
  border: 2px solid var(--surface); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  font-size: 12px; background: linear-gradient(135deg, #2f6cf0, #6a4ff0); color: #fff; flex: none; }

/* ------------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------------ cards + grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h2, .card-h h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px 18px 18px; }
.card-b.flush { padding: 8px 0 0; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }

/* stat tiles */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat .label { color: var(--text-2); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .label .i { color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat .foot { font-size: 12px; color: var(--muted); }
.stat .spark { position: absolute; right: 14px; bottom: 14px; opacity: .9; }
.stat.accent { background: linear-gradient(135deg, #0f2a55, #1a46a8); color: #fff; border-color: transparent; }
.stat.accent .label, .stat.accent .foot, .stat.accent .label .i { color: rgba(255, 255, 255, .78); }

/* hero / protection band */
.hero {
  border-radius: 16px; padding: 22px 24px; color: #fff; display: flex; gap: 20px; align-items: center;
  background: radial-gradient(1200px 300px at 0% 0%, #0a4fd6 0%, transparent 60%), linear-gradient(120deg, #001028, #062f72);
  box-shadow: var(--shadow); flex-wrap: wrap;
}
.hero .shield { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); flex: none; }
.hero h2 { margin: 0; font-size: 20px; }
.hero p { margin: 4px 0 0; color: rgba(255, 255, 255, .8); }
.hero .hero-stats { margin-left: auto; display: flex; gap: 28px; flex-wrap: wrap; }
.hero .hero-stats div b { display: block; font-size: 26px; letter-spacing: -.02em; }
.hero .hero-stats div span { font-size: 12px; color: rgba(255, 255, 255, .75); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand-btn); border-color: var(--brand-btn); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3); }
.btn.primary:hover { background: #0047c6; border-color: #0047c6; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label-sm { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=month], select, textarea, .input {
  height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none; width: 100%; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 10px 12px; min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input.sm, select.sm { height: 32px; font-size: 13px; border-radius: 8px; }
.search-input { position: relative; }
.search-input input { padding-left: 34px; }
.search-input .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-row .t { font-weight: 600; }
.check-row .d { color: var(--text-2); font-size: 13px; }
.check-row .ctl { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* toggle */
.toggle { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: .15s; }
.toggle span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff;
  border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.toggle input:checked + span { background: var(--brand); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* segmented tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .n { font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 0 7px; }
.tab.active .n { background: var(--brand-soft); color: var(--brand); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-weight: 600;
  font-size: 12.5px; color: var(--text-2); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ badges / pills */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2);
}
.badge .i { width: 12px; height: 12px; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.serious { background: var(--serious-soft); color: var(--serious); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.risk { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 12.5px; }
.risk .bar { width: 34px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.risk .bar i { display: block; height: 100%; border-radius: 3px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; white-space: nowrap; padding: 0 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--text); }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
table.t tbody tr.sel td { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
table.t td.r, table.t th.r { text-align: right; }
table.t .title { font-weight: 600; color: var(--text); max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
table.t .sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 460px; display: block; }
table.t input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.pager .sp { flex: 1; }

.bulkbar { position: sticky; bottom: 18px; z-index: 15; margin: 14px auto 0; max-width: 820px; display: flex;
  align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 14px; background: #0f1d33; color: #fff;
  box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.bulkbar .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.bulkbar .btn:hover { background: rgba(255, 255, 255, .16); }
.bulkbar .btn.danger { background: #c62828; border-color: #c62828; }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--border); }
.li:first-child { border-top: 0; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--surface-2); }
.li .ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.li .ico.danger { background: var(--danger-soft); color: var(--danger); }
.li .ico.warn { background: var(--warn-soft); color: var(--warn); }
.li .ico.ok { background: var(--ok-soft); color: var(--ok); }
.li .ico.info { background: var(--info-soft); color: var(--info); }
.li .body { min-width: 0; flex: 1; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .d { color: var(--muted); font-size: 12.5px; }
.li .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 30px; height: 30px; color: var(--border-strong); margin-bottom: 8px; }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }

/* key-value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* timeline */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl .ev { position: relative; padding: 0 0 16px; }
.tl .ev::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); }
.tl .ev.rem::before { border-color: var(--ok); background: var(--ok); }
.tl .ev.auto::before { border-color: var(--brand); background: var(--brand); }
.tl .ev.warn::before { border-color: var(--danger); background: var(--danger); }
.tl .ev .when { font-size: 12px; color: var(--muted); }
.tl .ev .what { font-size: 13.5px; }
.tl .ev .who { font-weight: 600; }

/* ------------------------------------------------------------------ drawer + modal */
.scrim { position: fixed; inset: 0; background: rgba(6, 12, 24, .45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 96vw); background: var(--page); z-index: 61;
  transform: translateX(102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .22s ease; }
.drawer-h { padding: 18px 22px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-h .top { display: flex; gap: 12px; align-items: flex-start; }
.drawer-h h2 { margin: 0; font-size: 18px; line-height: 1.3; word-break: break-word; }
.drawer-h .tabs { margin: 14px 0 0; border-bottom: 0; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px 22px 30px; }
.drawer-f { padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal.wide { width: min(820px, 100%); }
.modal-h { padding: 20px 22px 0; display: flex; gap: 12px; align-items: flex-start; }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-h .sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.modal-b { padding: 18px 22px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: 11px; background: #0f1d33; color: #fff;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease; font-size: 13.5px; }
.toast.ok .i { color: #4ade80; } .toast.err .i { color: #f87171; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text); font-size: 13.5px; }
.callout .i { color: var(--info); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); } .callout.warn .i { color: var(--warn); }
.callout.danger { background: var(--danger-soft); } .callout.danger .i { color: var(--danger); }
.callout.ok { background: var(--ok-soft); } .callout.ok .i { color: var(--ok); }
.code-box { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); border-radius: 8px; padding: 10px 12px;
  word-break: break-all; display: flex; gap: 10px; align-items: center; }
.code-box span { flex: 1; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 36px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12px; display: grid; place-items: center; }

/* email preview */
.email-frame { width: 100%; min-height: 420px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.reason { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; }
.reason .sev { width: 4px; border-radius: 4px; flex: none; }
.reason .t { font-weight: 600; }
.reason .d { color: var(--text-2); font-size: 13px; }
.ai-card { border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.col:hover rect { filter: brightness(1.08); }
.chart .xhair { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 140px; transform: translate(-50%, -100%); }
.tip .h { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r b { font-variant-numeric: tabular-nums; min-width: 22px; }
.tip .r i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.hbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); }
.hbar i { display: block; height: 100%; }
.hbar-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.hbar-legend span { display: inline-flex; gap: 6px; align-items: center; }
.hbar-legend i { width: 9px; height: 9px; border-radius: 2px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }

/* health dot */
.health { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; }
.health::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--neutral-soft); }
.health.protected { color: var(--ok); } .health.protected::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.health.connected { color: var(--info); } .health.connected::before { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.health.warning, .health.unverified { color: var(--warn); } .health.warning::before, .health.unverified::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.health.error { color: var(--danger); } .health.error::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.health.setup { color: var(--muted); }

.cust-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.cust-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.cust-card .nm { font-weight: 650; font-size: 15px; }
.cust-card .dm { color: var(--muted); font-size: 12.5px; }
.cust-card .nums { display: flex; gap: 18px; }
.cust-card .nums div b { display: block; font-size: 18px; }
.cust-card .nums div span { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------------ auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(760px 520px at 100% 52%, rgba(10, 79, 214, .55) 0%, transparent 62%),
  radial-gradient(700px 480px at 0% 100%, rgba(11, 58, 158, .55) 0%, transparent 60%), linear-gradient(160deg, #001028 0%, #001028 30%, #04204a 100%);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art .auth-lockup { width: min(340px, 80%); height: auto; display: block; margin-left: -6px; }
.auth-mobile-logo { display: none; width: 220px; height: auto; margin: 0 0 26px -4px; }
.auth-art h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.02em; margin: auto 0 14px; max-width: 520px; }
.auth-art p { color: #c3d1ee; font-size: 16px; max-width: 470px; margin: 0 0 30px; }
.auth-art ul { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 12px; max-width: 460px; }
.auth-art li { display: flex; gap: 12px; align-items: center; color: #dbe5fb; }
.auth-art li .i { color: #8fb3ff; }
.auth-art .foot { margin-top: 40px; color: #8ea3cc; font-size: 12px; display: flex; flex-direction: column; gap: 8px; }
.auth-art .foot img { width: 170px; height: auto; display: block; }
.auth-art .foot .fine { color: #6f84ad; font-size: 11.5px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: min(400px, 100%); }
.auth-box h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-box .lead { color: var(--text-2); margin: 0 0 26px; }
.auth-box .btn.primary { height: 42px; font-size: 14.5px; }
.otp { letter-spacing: .5em; font-size: 22px !important; text-align: center; height: 52px !important; font-family: var(--mono); }
.qr { background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--border); display: inline-block; }
.qr img, .qr canvas { display: block; width: 184px; height: 184px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: var(--mono); font-size: 14px; }
.codes span { background: var(--surface-3); border-radius: 8px; padding: 8px 10px; text-align: center; }
.err-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%;
  animation: sk 1.2s ease infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.loading-fade { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-102%); transition: transform .2s; visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .icon-btn.menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 60px; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-mobile-logo { display: block; }
  .ws-btn { min-width: 0; max-width: 56vw; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .hero .hero-stats { margin-left: 0; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .ws-btn { max-width: 48vw; min-width: 0; padding: 0 8px; }
  .ws-btn .ws-sub { display: none; }
  #me > svg { display: none; }
  .g-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .page-head .actions { margin-left: 0; }
  .topbar .hide-sm { display: none; }
}
@media print {
  .sidebar, .topbar, .drawer-f, .page-head .actions { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
