/* WatchTower console — "The Calm Watch".
 *
 * A security console that feels like a quiet observation deck at night.
 * Committed dark: one deliberate deep-navy nocturnal world. The identity is
 * ported faithfully from the approved mockup (/tmp/wt_calmwatch_mockup.html)
 * onto the console's existing `.c-*` classes — token NAMES the templates and JS
 * reference are unchanged, only VALUES moved, and new additive tokens/classes
 * were added.
 *
 * Signature hue = azure blue (--c-accent): brand mark, active nav, focus rings,
 * links, primary button, beacon. Blue is now the single brand hue — the former
 * iris secondary is folded into the accent (--c-iris repoints to --c-accent),
 * and the former teal is retained ONLY as the semantic "good / protected" green
 * (--c-good #35d3a6), used sparingly for success states — never as brand.
 * Type is self-hosted (no external calls — CSP `font-src
 * 'self'`): Instrument Serif (editorial display), Hanken Grotesk (body/UI),
 * IBM Plex Mono (numbers/mono). Every existing `.c-*` class, focus ring,
 * reduced-motion guard, mobile rail toggle, the end-of-file cascade fix, the
 * `--wt-rook` mask and tenant `--c-accent` branding are preserved.
 */

/* ---------- self-hosted fonts (woff2, latin) ----------
   Served from /static/fonts/ (same-origin — CSP `font-src 'self'` allows it).
   font-display:swap so text paints immediately in the fallback and swaps when
   the webfont arrives. IBM Plex Mono was already self-hosted — kept. */

/* Instrument Serif — editorial display (large headings + hero headline). */
@font-face {
  font-family: "Instrument Serif"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}

/* Hanken Grotesk — body and UI. */
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2");
}

/* IBM Plex Mono — numbers / mono (already self-hosted; kept). */
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
}

:root {
  /* ---- Ground / surfaces: deep navy night, as an elevation ladder ---- */
  --c-bg:        #0a0e1a;
  --c-surface:   #111726;
  --c-surface-2: #172033;
  --c-raised:    #1e2942;
  --c-line:      #263149;
  --c-line-soft: #1a2336;
  --c-glass:     rgba(23,32,51,.55);

  /* ---- Text: muted body, bright titles — never pure white on body ----
     --c-text-3 nudged up from the marketing-matched #6b7699 so it clears the
     ~4.5:1 AA minimum on --c-surface (measured ~4.6:1), since it carries real
     text (table headers, field hints, metric labels, nav group labels, empty
     states). --c-text / --c-text-2 match the shared blue palette exactly. */
  --c-text:    #eaeefb;
  --c-text-2:  #98a4c2;
  --c-text-3:  #7681a8;
  /* Form-control boundaries need 3:1 (WCAG 1.4.11). Held well brighter than the
     decorative --c-line so field borders stay legible (~3.1:1 on --c-surface-2). */
  --c-line-control: #5a679c;

  /* ---- Signature hue: azure blue (brand / links / focus / primary / beacon) ---- */
  --c-accent:     #4d9cff;
  --c-accent-2:   #82bbff;
  --c-accent-dim: rgba(77,156,255,.13);

  /* ---- Semantic good: a restrained green-teal for success / protected ONLY
     (used sparingly — NOT a second brand hue). ---- */
  --c-good:     #35d3a6;
  --c-good-dim: rgba(53,211,166,.13);
  /* --c-ok is the affirmative alias of good; kept so the hero/severity
     components can read either name. */
  --c-ok:       #35d3a6;
  --c-ok-dim:   rgba(53,211,166,.13);

  /* ---- --c-iris folded into the accent: blue is the one brand hue. The token
     NAME is kept so templates/JS referencing it keep working. ---- */
  --c-iris:     var(--c-accent);
  --c-iris-dim: var(--c-accent-dim);

  /* ---- Severity ramp: calm-low -> hot-high ---- */
  --c-warn:     #f5b95a;
  --c-warn-dim: rgba(245,185,90,.14);
  --c-bad:      #ff7a8a;
  --c-bad-dim:  rgba(255,122,138,.12);
  --c-crit:     #ff4d6a;

  /* ---- Elevation: lean on layered surfaces + these shadows, not borders ---- */
  --c-shadow:    0 24px 60px -24px rgba(0,0,0,.75);
  --c-shadow-sm: 0 4px 16px -6px rgba(0,0,0,.5);
  --c-hi:        inset 0 1px 0 rgba(255,255,255,.05);

  --c-rail:      252px;
  --c-topbar:    60px;
  --c-radius:    14px;
  --c-radius-sm: 10px;

  /* --c-serif repointed to the grotesque: display headings now read in Hanken
     Grotesk (operator register), not Instrument Serif. The token NAME is kept so
     any template/JS referencing it keeps resolving — it simply resolves to sans
     now. The Instrument Serif @font-face files are left in place, unreferenced. */
  --c-serif: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --c-sans:  "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --c-mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;

  /* The Ward mark (monochrome) as a mask source. Mirrors templates/_logo.html. */
  --wt-rook: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='M24 5 L39.5 9.8 V24 C39.5 33.4 32.6 40 24 43 C15.4 40 8.5 33.4 8.5 24 V9.8 Z'/%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' d='M15 24 a9 9 0 0 1 18 0'/%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' d='M18.5 28.5 a5.5 5.5 0 0 1 11 0'/%3E%3Ccircle cx='24' cy='33' r='2.6' fill='%23000'/%3E%3C/svg%3E");
}

/* ---------- reset-ish ---------- */
.c-shell *, .c-shell *::before, .c-shell *::after { box-sizing: border-box; }

body.c-body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 14.5px/1.55 var(--c-sans);
  -webkit-font-smoothing: antialiased;
  /* Nocturnal wash: an azure glow top-right and a faint blue wash up from the
     bottom-left, fixed so it does not scroll with dense tables. */
  background-image:
    radial-gradient(1100px 620px at 84% -12%, rgba(77,156,255,.10), transparent 60%),
    radial-gradient(760px 460px at -6% 108%, rgba(130,187,255,.05), transparent 55%);
  background-attachment: fixed;
}

/* Wiz-style grain: de-sterilise the dark ground so it reads organic, not
   plastic. Fixed, non-interactive, faint, blended over the surfaces. */
body.c-body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: .03; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.c-shell { display: grid; grid-template-columns: var(--c-rail) 1fr; min-height: 100vh; }
@media (max-width: 1000px) {
  .c-shell { grid-template-columns: 1fr; }
  .c-rail { display: none; }
  .c-rail.open { display: flex; position: fixed; inset: 0 auto 0 0; width: var(--c-rail); z-index: 60; }
}

/* ---------- navigation rail ---------- */
.c-rail {
  background: linear-gradient(180deg, #0c1120, #0a0e1a);
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.c-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--c-line-soft);
}
/* The WatchTower rook, drawn as a mask so the element stays a plain <span> —
   tenant_branding.html toggles this node's `hidden` attribute, so replacing it
   with inline SVG would break that preview. Geometry is identical to
   templates/_logo.html; keep the two in step. Painted with background-color, so
   it follows --c-accent and a tenant's own colour reaches the mark exactly as
   before. Framed in the rounded gradient tile with an azure glow. */
.c-brand .mark {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 50% 25%, #1c2748, #10182b);
  border: 1px solid #2b3a5e; box-shadow: var(--c-hi);
}
.c-brand .mark::after {
  content: ""; width: 19px; height: 19px;
  background-color: var(--c-accent);
  -webkit-mask: var(--wt-rook) center / contain no-repeat;
          mask: var(--wt-rook) center / contain no-repeat;
}
.c-brand .mark::before {
  content: ""; position: absolute; inset: -1px; border-radius: 9px;
  box-shadow: 0 0 16px -2px var(--c-accent); opacity: .55;
}
/* A tenant logo replaces the mark entirely; capped so a wide logo cannot
   push the rail out of shape. */
.c-brand .logo { height: 32px; max-width: 122px; object-fit: contain; flex: none; border-radius: 8px; }
.c-brand .name { font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.c-brand .tenant { font-size: 11.5px; color: var(--c-text-3); margin-top: 1px; letter-spacing: .01em; }

.c-nav { padding: 12px 12px 20px; flex: 1; }
.c-nav-group { margin-top: 18px; }
.c-nav-group:first-child { margin-top: 6px; }
.c-nav-label {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--c-text-3); padding: 6px 10px; font-weight: 600;
}
.c-nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 8.5px 11px; border-radius: 10px; margin-bottom: 1px;
  color: var(--c-text-2); text-decoration: none; font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .14s, color .14s;
}
.c-nav a:hover { background: var(--c-surface-2); color: var(--c-text); }
.c-nav a.active {
  background: linear-gradient(90deg, var(--c-accent-dim), transparent);
  color: #fff; font-weight: 600;
}
/* Left azure bar + glow on the active item — reaches to the rail edge past the
   nav's 12px inset. */
.c-nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--c-accent); box-shadow: 0 0 14px var(--c-accent);
}
.c-nav a .ico { width: 17px; height: 17px; flex: none; opacity: .85; }
.c-nav a.active .ico { opacity: 1; color: var(--c-accent); }
.c-nav .count {
  margin-left: auto; font-family: var(--c-mono); font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--c-raised); color: var(--c-text-2);
  border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.c-nav .count.bad { background: rgba(255,77,106,.16); color: var(--c-crit); }
.c-rail-foot {
  border-top: 1px solid var(--c-line-soft); padding: 13px 16px;
  font-size: 12px; color: var(--c-text-3);
}

/* ---------- top bar ---------- */
.c-main { min-width: 0; display: flex; flex-direction: column; }
.c-topbar {
  height: var(--c-topbar); display: flex; align-items: center; gap: 16px;
  padding: 0 26px; border-bottom: 1px solid var(--c-line);
  background: rgba(10,12,22,.72); backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 40;
}
.c-crumb { font-size: 13px; color: var(--c-text-2); }
.c-crumb strong { color: var(--c-text); font-weight: 600; }
.c-topbar .spacer { flex: 1; }
.c-search {
  background: var(--c-surface-2); border: 1px solid var(--c-line-control);
  border-radius: 10px; padding: 8px 12px; color: var(--c-text);
  font: inherit; font-size: 13.5px; width: 300px;
}
.c-search::placeholder { color: var(--c-text-3); }
.c-search:focus { outline: none; border-color: var(--c-accent);
                  box-shadow: 0 0 0 3px var(--c-accent-dim); }
.c-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--c-text-2); }
.c-avatar {
  width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center;
  color: #071426; font-size: 12px; font-weight: 700;
  background: linear-gradient(150deg, var(--c-accent-2), #2f74e0);
  box-shadow: var(--c-shadow-sm);
}

/* ---------- page ---------- */
.c-page { padding: 22px 22px 56px; max-width: 1580px; width: 100%; margin: 0 auto; }
.c-page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
/* Operator-grade display heading — Hanken Grotesk, heavy, tight tracking.
   The editorial serif is retired from headings; the mono eyebrow carries the
   technical signal above it. */
.c-page-head h1 {
  margin: 0; font-family: var(--c-sans); font-weight: 700;
  font-size: 31px; line-height: 1.05; letter-spacing: -.02em;
}
.c-page-head p { margin: 6px 0 0; color: var(--c-text-2); font-size: 14px; max-width: 78ch; }
.c-page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* Mono eyebrow — a small uppercase azure kicker above a display heading. */
.c-eyebrow {
  font-family: var(--c-mono); font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--c-accent); margin-bottom: 8px;
}

/* ---------- cards and grids ---------- */
.c-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--c-radius); padding: 14px;
  box-shadow: var(--c-shadow-sm), var(--c-hi);
}
.c-card.pad0 { padding: 0; overflow: hidden; }
.c-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--c-line-soft);
}
/* Card titles stay in the sans (grotesk) — the serif is reserved for display. */
.c-card-head h2, .c-card-head h3 { margin: 0; font-family: var(--c-sans); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.c-card-head .actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }
.c-grid { display: grid; gap: 16px; }
/* Kept as responsive auto-fit tracks (the mockup's fixed 1.55fr/1fr assumes
   exactly N children; console pages populate these generically). */
.c-grid.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.c-grid.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.c-grid.g4 { grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }

/* ---------- metrics ---------- */
.c-metric {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--c-radius); padding: 17px 18px;
  box-shadow: var(--c-shadow-sm), var(--c-hi); position: relative;
}
.c-metric .label {
  font-family: var(--c-mono);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--c-text-3); font-weight: 500;
}
/* Metric values stay in the mono. */
.c-metric .value {
  font-family: var(--c-mono); font-size: 30px; font-weight: 500;
  letter-spacing: -.02em; line-height: 1; margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.c-metric .value small { font-size: 15px; color: var(--c-text-3); }
.c-metric .sub {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--c-text-2); margin-top: 11px;
}
.c-metric.good .value { color: var(--c-good); }
.c-metric.warn .value { color: var(--c-warn); }
.c-metric.bad .value  { color: var(--c-bad); }

/* ---------- tables ---------- */
.c-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.c-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--c-surface-2); color: var(--c-text-3);
  text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 600; padding: 9px 16px; border-bottom: 1px solid var(--c-line);
  white-space: nowrap; font-family: var(--c-mono);
}
.c-table tbody td { padding: 10px 16px; border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.c-table tbody tr:hover td { background: rgba(77,156,255,.05); }
.c-table tbody tr:last-child td { border-bottom: none; }
.c-table tbody tr.clickable { cursor: pointer; }
.c-table .num { text-align: right; font-family: var(--c-mono); font-variant-numeric: tabular-nums; }
.c-table .mono { font-family: var(--c-mono); font-size: 12px; }
.c-table .muted { color: var(--c-text-3); }
.c-table-wrap { overflow: auto; max-height: 68vh; border-radius: var(--c-radius); border: 1px solid var(--c-line); }
.c-empty { padding: 34px; text-align: center; color: var(--c-text-3); font-size: 13.5px; }

/* ---------- controls ---------- */
.c-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  background: var(--c-surface-2); color: var(--c-text);
  border: 1px solid var(--c-line); cursor: pointer; text-decoration: none;
  white-space: nowrap; box-shadow: var(--c-hi);
}
.c-btn:hover { border-color: #33436b; background: var(--c-raised); }
.c-btn .ico { width: 16px; height: 16px; flex: none; }
/* Primary = azure — the single brand hue drives the "click me" button. */
.c-btn.primary {
  background: linear-gradient(180deg, var(--c-accent-2), var(--c-accent));
  border-color: transparent; color: #071426; font-weight: 650;
  box-shadow: 0 8px 22px -8px rgba(77,156,255,.6), var(--c-hi);
}
.c-btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--c-accent-2), var(--c-accent)); }
.c-btn.danger { color: var(--c-bad); border-color: rgba(255,122,138,.35); }
.c-btn.danger:hover { background: rgba(255,122,138,.1); }
.c-btn.sm { padding: 5px 10px; font-size: 12px; }
.c-btn[disabled] { opacity: .5; cursor: not-allowed; }

.c-input, .c-select, .c-textarea {
  background: var(--c-surface-2); border: 1px solid var(--c-line-control); color: var(--c-text);
  border-radius: 10px; padding: 8px 11px; font: inherit; font-size: 13px; width: 100%;
}
/* One ring so focus is visible without a colour-vision or contrast dependency
   (WCAG 2.4.7). Azure is the signature focus colour. */
.c-input:focus, .c-select:focus, .c-textarea:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-dim);
}
.c-textarea { font-family: var(--c-mono); font-size: 12.5px; line-height: 1.55; }
.c-field { display: grid; gap: 5px; margin-bottom: 12px; }
.c-field label { font-size: 12.5px; font-weight: 600; color: var(--c-text-2); }
.c-field .hint { font-size: 11.5px; color: var(--c-text-3); }
.c-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Links — azure, the brand hue. */
.c-link, .link { color: var(--c-accent); font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.c-link:hover, .link:hover { color: var(--c-accent-2); }

/* ---------- status ---------- */
.c-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--c-line); color: var(--c-text-2); background: var(--c-surface-2);
  white-space: nowrap;
}
.c-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.c-pill.plain::before { display: none; }
.c-pill.good { color: var(--c-good); border-color: rgba(53,211,166,.3); background: var(--c-good-dim); }
.c-pill.warn { color: var(--c-warn); border-color: rgba(245,185,90,.3); background: rgba(245,185,90,.1); }
.c-pill.bad  { color: var(--c-bad);  border-color: rgba(255,122,138,.3); background: rgba(255,122,138,.1); }
.c-pill.crit { color: #fff; border-color: var(--c-crit); background: var(--c-crit); }
.c-pill.info { color: var(--c-accent); border-color: rgba(77,156,255,.3); background: var(--c-accent-dim); }

.c-bar { height: 6px; border-radius: 999px; background: var(--c-raised); overflow: hidden; min-width: 60px; }
.c-bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c-good), #6ee7c6); }
.c-bar > i.good { background: linear-gradient(90deg, var(--c-good), #6ee7c6); }
.c-bar > i.warn { background: linear-gradient(90deg, var(--c-warn), #ffd27a); }
.c-bar > i.bad  { background: var(--c-bad); }

.c-score { font-family: var(--c-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.c-score.good { color: var(--c-good); }
.c-score.warn { color: var(--c-warn); }
.c-score.bad  { color: var(--c-bad); }

/* ---------- tabs ---------- */
.c-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-line); margin-bottom: 16px; }
.c-tab {
  padding: 8px 14px; font-size: 13px; font-weight: 570; cursor: pointer;
  color: var(--c-text-3); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.c-tab:hover { color: var(--c-text-2); }
.c-tab.active { color: var(--c-text); border-bottom-color: var(--c-accent); }

/* ---------- drawer ---------- */
.c-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(5,7,14,.62); z-index: 70;
  display: none;
}
.c-drawer-backdrop.open { display: block; }
.c-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 96vw);
  background: var(--c-surface); border-left: 1px solid var(--c-line);
  z-index: 71; transform: translateX(100%); transition: transform .18s ease;
  display: flex; flex-direction: column; box-shadow: var(--c-shadow);
}
.c-drawer.open { transform: none; }
.c-drawer header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--c-line);
}
.c-drawer header h2 { margin: 0; font-size: 15px; font-weight: 650; }
.c-drawer .body { padding: 18px; overflow-y: auto; flex: 1; }
.c-drawer .foot { padding: 12px 18px; border-top: 1px solid var(--c-line); display: flex; gap: 8px; }
.c-close { background: none; border: none; color: var(--c-text-3); font-size: 20px; cursor: pointer; line-height: 1; }
.c-close:hover { color: var(--c-text); }

/* ---------- misc ---------- */
.c-kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 13px; }
.c-kv dt { color: var(--c-text-3); }
.c-kv dd { margin: 0; }
.c-note { font-size: 12.5px; color: var(--c-text-3); }
.c-code {
  background: var(--c-bg); border: 1px solid var(--c-line); border-radius: 10px;
  padding: 11px 13px; font-family: var(--c-mono); font-size: 12.5px;
  white-space: pre-wrap; overflow-x: auto; color: var(--c-text-2);
}
.c-sep { height: 1px; background: var(--c-line-soft); margin: 16px 0; border: 0; }
.c-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  background: var(--c-raised); border: 1px solid var(--c-line);
  border-radius: var(--c-radius); padding: 11px 15px; font-size: 13px;
  box-shadow: var(--c-shadow); opacity: 0; transform: translateY(8px);
  transition: .18s; pointer-events: none;
}
.c-toast.show { opacity: 1; transform: none; }
.c-toast.bad { border-color: rgba(255,122,138,.4); }

/* ---------- LIVING HERO (Overview signature) ----------
   The affirmative "you're protected" banner, now a quiet observation deck: a
   left beacon column (animated canvas + a glowing azure core over the rook /
   shield) and a body with a status chip, a serif headline and the live
   `.facts`. The `.attention` variant (set by index.html's updateHero) swaps the
   signature azure for a calm amber, so "you're protected" is never shown over
   a week that was not — the default azure state is untouched. */
.c-hero {
  position: relative;
  display: grid; grid-template-columns: 300px 1fr; gap: 8px; align-items: center;
  background: linear-gradient(120deg, rgba(77,156,255,.08), rgba(17,23,38,.2) 46%), var(--c-surface);
  border: 1px solid var(--c-line); border-radius: 20px; padding: 10px;
  box-shadow: var(--c-shadow), var(--c-hi); overflow: hidden;
}

/* Beacon column — the living signal. Canvas fills it; the core sits centred. */
.c-beacon-wrap { position: relative; height: 250px; display: grid; place-items: center; }
.c-beacon-wrap > canvas, #wt-beacon { position: absolute; inset: 0; width: 100%; height: 100%; }

/* The beacon core — the glowing azure tile holding the shield / rook. Replaces
   the old flat `.shield` tile; the element carries `shield c-shield` so the
   attention tone below (and any JS that referenced the shield) still applies. */
.c-shield, .c-hero .shield {
  position: relative; z-index: 2;
  width: 92px; height: 92px; border-radius: 24px; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 50% 30%, rgba(77,156,255,.30), rgba(77,156,255,.05));
  border: 1px solid rgba(77,156,255,.42);
  box-shadow: 0 0 44px -6px rgba(77,156,255,.55), var(--c-hi);
}
.c-shield svg, .c-hero .shield svg { width: 46px; height: 46px; color: var(--c-accent); }

/* Hero body. */
.c-hero-body { padding: 20px 30px 20px 8px; position: relative; z-index: 2; }
.c-hero-body .status {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--c-mono);
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--c-accent);
  background: var(--c-accent-dim); border: 1px solid rgba(77,156,255,.3);
  border-radius: 999px; padding: 4px 12px;
}
/* Hero headline — operator register: Hanken Grotesk, heavy, tight tracking. */
.c-hero-body h2 { margin: 14px 0 0; font-family: var(--c-sans); font-weight: 700; font-size: 30px; line-height: 1.06; letter-spacing: -.02em; }
.c-hero-body h2 em { font-style: normal; color: var(--c-accent); }

/* Status badges the hero script swaps between (kept from before). */
.c-hero .badge-ok {
  font-size: 11.5px; font-weight: 600; color: var(--c-ok); background: var(--c-ok-dim);
  border: 1px solid rgba(53,211,166,.32); border-radius: 999px; padding: 3px 10px;
}
.c-hero .badge-warn {
  font-size: 11.5px; font-weight: 600; color: var(--c-warn); background: var(--c-warn-dim);
  border: 1px solid rgba(245,185,90,.32); border-radius: 999px; padding: 3px 10px;
}
.c-hero .facts { display: flex; gap: 34px; margin-top: 22px; flex-wrap: wrap; }
.c-hero .facts .k { font-family: var(--c-mono); font-size: 23px; font-weight: 500; letter-spacing: -.01em; }
.c-hero .facts .k.ok { color: var(--c-ok); }
.c-hero .facts .v { font-size: 11px; color: var(--c-text-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }

/* Attention tone — calm amber instead of the affirmative azure. */
.c-hero.attention {
  background: linear-gradient(120deg, rgba(245,185,90,.10), rgba(17,23,38,.2) 46%), var(--c-surface);
}
.c-hero.attention .c-shield, .c-hero.attention .shield {
  background: radial-gradient(circle at 50% 30%, rgba(245,185,90,.26), rgba(245,185,90,.06));
  border-color: rgba(245,185,90,.4);
  box-shadow: 0 0 44px -6px rgba(245,185,90,.5), var(--c-hi);
}
.c-hero.attention .c-shield svg, .c-hero.attention .shield svg { color: var(--c-warn); }

/* Severity stripe — a coloured tick to lead a table row. */
.c-sev { display: inline-block; width: 3px; height: 32px; border-radius: 3px; vertical-align: middle; margin-right: 2px; }
.c-sev.crit { background: var(--c-crit); box-shadow: 0 0 12px var(--c-crit); }
.c-sev.bad  { background: var(--c-bad); }
.c-sev.warn { background: var(--c-warn); }
.c-sev.ok   { background: var(--c-ok); }
/* Low / informational severity — a dim azure tick (brand hue, held back so it
   never competes with the warm hot-end of the ramp). */
.c-sev.info { background: var(--c-accent); opacity: .6; }
/* Unrated / unknown — a quiet neutral tick so the row still leads with a mark. */
.c-sev.none { background: var(--c-line-control); }

/* Sparkline — absolutely positioned in the corner of a metric card. */
.c-spark { position: absolute; right: 15px; bottom: 15px; width: 82px; height: 30px; opacity: .9; }

/* Delta chip — a small mono up/down indicator. */
.c-delta { font-family: var(--c-mono); font-weight: 600; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; }
.c-delta.up { color: var(--c-ok); background: var(--c-ok-dim); }
.c-delta.dn { color: var(--c-bad); background: rgba(255,122,138,.12); }

/* Metric card header — a small tinted glyph next to the label. Azure by default
   (brand hue), green/amber/red for state. The `.value`/`.sub` a page's
   script writes to are unchanged. */
.c-metric .top { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; }
.c-metric .top .label { margin: 0; }
.c-metric .mi {
  width: 31px; height: 31px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--c-iris-dim); color: var(--c-iris);
}
.c-metric .mi svg { width: 16px; height: 16px; }
.c-metric .mi.ok   { background: var(--c-ok-dim);   color: var(--c-ok); }
.c-metric .mi.warn { background: var(--c-warn-dim); color: var(--c-warn); }
.c-metric .mi.bad  { background: var(--c-bad-dim);  color: var(--c-bad); }

/* ---------- refined elevation on hover ----------
   A small, tasteful lift so cards and metric tiles feel responsive to the
   pointer without moving layout. Disabled under prefers-reduced-motion below. */
.c-card, .c-metric {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.c-card:hover, .c-metric:hover {
  transform: translateY(-2px);
  border-color: #33436b;
  box-shadow: var(--c-shadow), var(--c-hi);
}
/* Cards that only hold a header and a table (`.pad0`) should not lift — the
   hover belongs to the rows inside them, not the whole panel. */
.c-card.pad0:hover { transform: none; box-shadow: var(--c-shadow-sm), var(--c-hi); border-color: var(--c-line); }
.c-table tbody tr { transition: background .12s ease; }

/* ---------- keyboard focus ----------
   One ring, applied with :focus-visible so it appears for keyboard users
   without adding a halo to every mouse click. */
.c-btn:focus-visible,
.c-tab:focus-visible,
.c-nav a:focus-visible,
.c-close:focus-visible,
.c-pill:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- empty states ---------- */
.c-blank {
  display: grid; place-items: center; gap: 6px; text-align: center;
  min-height: 150px; padding: 24px; color: var(--c-text-3); font-size: 13px;
}
.c-blank strong { color: var(--c-text-2); font-weight: 600; font-size: 13.5px; }

@media (prefers-reduced-motion: reduce) {
  .c-drawer, .c-toast { transition: none; }
  .c-nav a { transition: none; }
  .c-btn.primary:hover { filter: none; }
  /* The hover lift and the beacon core breathing are niceties, not
     information — hold them still for anyone who asked to reduce motion. The
     beacon script also draws a single static frame under this preference. */
  .c-card, .c-metric, .c-table tbody tr { transition: none; }
  .c-card:hover, .c-metric:hover { transform: none; }
}

/* ---------- mobile navigation ----------
   The rail is display:none below 1000px. The toggle lives in the top bar and
   only exists at those widths. */
.c-rail-toggle {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; margin-right: 2px;
  background: var(--c-surface-2); border: 1px solid var(--c-line);
  border-radius: 10px; color: var(--c-text-2); cursor: pointer;
}
.c-rail-toggle:hover { color: var(--c-text); border-color: #33436b; }
.c-rail-toggle:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

.c-rail-backdrop {
  position: fixed; inset: 0; background: rgba(5,7,14,.6);
  z-index: 55; display: none;
}

@media (max-width: 1000px) {
  .c-rail-toggle { display: inline-flex; }
  .c-rail.open { box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .c-rail-backdrop.open { display: block; }
  /* Hero collapses to a single column, beacon shortens. */
  .c-hero { grid-template-columns: 1fr; }
  .c-beacon-wrap { height: 200px; }
}

/* ---------- mobile rail cascade fix ----------
   The @media block near the top sets `.c-rail { display: none }` below 1000px,
   but the base `.c-rail { display: flex }` rule is declared AFTER it. A media
   query adds no specificity, so on equal specificity the later declaration won
   and the rail was never actually hidden. Re-declared here, at the end of the
   file, so source order settles it. The `.open` variant is higher specificity
   and wins over both. */
@media (max-width: 1000px) {
  .c-rail { display: none; }
  .c-rail.open {
    display: flex; position: fixed; inset: 0 auto 0 0;
    width: var(--c-rail); z-index: 60;
  }
}
