/* ══════════════════════════════════════════════════════════════════════
   Keep — Design System v1 (light-mode default, editorial)
   Implements tokens.docx. Sourced from /tmp/Keep dashboard mockups.
   Loaded BEFORE blackhole.css so legacy --ss-* aliases below win where
   the old stylesheet doesn't override.
   ══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Open+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap');

:root {
  /* ── Brand: sky blue (identity only, never interactive) ── */
  --brand-sky-50:  #EAF2F8;
  --brand-sky-100: #C9DDED;
  --brand-sky-300: #6FA3C9;
  --brand-sky-500: #2E72A6;
  --brand-sky-700: #1F5079;
  --brand-sky-900: #0E2A47;

  /* ── Signal: orange (the single interactive accent) ── */
  --signal-default: #E66B2C;
  --signal-hover:   #CC5A1F;
  --signal-pressed: #B34D17;
  --signal-subtle:  #FCE9DC;
  --signal-focus:   rgba(230, 107, 44, 0.4);

  /* ── Foreground (off-black, never #000) ── */
  --fg-primary:   #0A0A0F;
  --fg-secondary: #4A4A52;
  --fg-tertiary:  #8A8A92;
  --fg-disabled:  #C0C0C5;
  --fg-inverse:   #FFFFFF;

  /* ── Background (warm off-white) ── */
  --bg-canvas:  #FAFAF8;
  --bg-surface: #FFFFFF;
  --bg-sunken:  #F4F4F0;
  --bg-overlay: #FFFFFF;

  /* ── Border ── */
  --border-subtle:  rgba(10, 10, 15, 0.08);
  --border-default: rgba(10, 10, 15, 0.12);
  --border-strong:  rgba(10, 10, 15, 0.24);
  --border-focus:   var(--signal-focus);

  /* ── Semantic (use sparingly — typography first) ── */
  --status-success-fg: #1F7A4D;  --status-success-bg: #E8F5EC;
  --status-warning-fg: #A36608;  --status-warning-bg: #FCF1DC;
  --status-danger-fg:  #B33B2E;  --status-danger-bg:  #FCEBE9;

  /* ── Typography ── */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:      "Open Sans", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* ── Spacing (4px scale) ── */
  --space-0:    0;
  --space-px:   1px;
  --space-0_5:  2px;
  --space-1:    4px;
  --space-2:    8px;
  --space-3:    12px;
  --space-4:    16px;
  --space-5:    20px;
  --space-6:    24px;
  --space-8:    32px;
  --space-10:   40px;
  --space-12:   48px;
  --space-16:   64px;
  --space-20:   80px;
  --space-24:   96px;

  /* ── Radius ── */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* ── Motion ── */
  --duration-instant:    0ms;
  --duration-fast:     120ms;
  --duration-base:     200ms;
  --duration-slow:     320ms;
  --duration-deliberate: 480ms;
  --ease-linear:      cubic-bezier(0, 0, 1, 1);
  --ease-standard:    cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized:  cubic-bezier(0.3, 0, 0, 1);
  --ease-exit:        cubic-bezier(0.4, 0, 1, 1);

  /* ── Shadows (restrained) ── */
  --shadow-sm: 0 1px 2px rgba(10, 10, 15, 0.04);
  --shadow:    0 2px 8px rgba(10, 10, 15, 0.06);
  --shadow-lg: 0 8px 24px rgba(10, 10, 15, 0.08);

  /* ══════════════════════════════════════════════════════════════════
     Legacy --ss-* aliases — keeps existing markup rendering on the new
     palette without sweeping every file. Each old token maps to its
     closest v1 equivalent so the redesign cascades automatically.
     ══════════════════════════════════════════════════════════════════ */
  --ss-bg:          var(--bg-canvas);
  --ss-bg-deep:     var(--bg-sunken);
  --ss-card:        var(--bg-surface);
  --ss-card-hover:  var(--bg-sunken);
  --ss-border:      var(--border-subtle);
  --ss-border-dim:  var(--border-subtle);

  --ss-accent:      var(--signal-default);
  --ss-accent-dim:  var(--signal-hover);
  --ss-accent-glow: var(--signal-subtle);
  --ss-accent-line: var(--border-default);
  --ss-navy:        var(--brand-sky-900);

  --ss-text:        var(--fg-primary);
  --ss-text-muted:  var(--fg-secondary);
  --ss-text-dim:    var(--fg-tertiary);
  --ss-text-inv:    var(--fg-inverse);

  --ss-success:     var(--status-success-fg);
  --ss-warning:     var(--status-warning-fg);
  --ss-danger:      var(--status-danger-fg);
  --ss-info:        var(--brand-sky-500);

  --ss-radius:      var(--radius);
  --ss-radius-sm:   var(--radius-sm);
  --ss-radius-xs:   var(--radius-sm);
  --ss-shadow:      var(--shadow);
  --ss-transition:  var(--duration-fast) var(--ease-standard);
  --ss-topnav-h:    60px;
  --ss-subnav-h:    44px;
  --ss-font:        var(--font-ui);

  --ss-glass-bg:      var(--bg-surface);
  --ss-glass-border:  var(--border-subtle);
  --ss-glass-shine:   transparent;
  --ss-glass-shadow:  var(--shadow-sm);
  --ss-glass-glow:    0 0 0 transparent;
}

/* Dark-mode variant — DEFERRED to v2 per tokens.docx. The existing
   html.ss-light class is inverted: we now treat light as default and
   provide a thoughtful (not just inverted) dark mode under .keep-dark.
   The legacy .ss-light class is kept as a no-op for backwards compat. */
html.ss-light { color-scheme: light; }

html.keep-dark {
  color-scheme: dark;

  /* Canvas + surfaces. Off-black with a slight blue cast — restful, not
     pure black. Cards are lifted ~6% toward white so they read as
     distinct surfaces without needing a shadow. */
  --bg-canvas:  #0F1013;
  --bg-surface: #16181D;
  --bg-sunken:  #0A0B0E;
  --bg-overlay: #1A1C22;

  /* Foreground — softened white, never #FFF. Same ladder of contrast
     as the light palette, mirrored. */
  --fg-primary:   #F2F2F0;
  --fg-secondary: #B0B0B5;
  --fg-tertiary:  #7A7A82;
  --fg-disabled:  #4A4A52;
  --fg-inverse:   #0A0A0F;

  /* Borders — lifted off black with translucent white so they integrate
     with whatever sits behind them. */
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.20);

  /* Brand — promote sky to a lighter tint so the wordmark reads. */
  --brand-sky-500: #6FA3C9;
  --brand-sky-700: #C9DDED;
  --brand-sky-900: #EAF2F8;

  /* Signal — orange pops naturally against dark; keep the same hue,
     warm the subtle fill so selected rows read. */
  --signal-subtle: rgba(230, 107, 44, 0.16);

  /* Semantic — re-anchor to dark-friendly tints. Foreground tones
     stay accessible on the dark canvas without flashbang backgrounds. */
  --status-success-fg: #4ADE80;  --status-success-bg: rgba(74, 222, 128, 0.10);
  --status-warning-fg: #FBBF24;  --status-warning-bg: rgba(251, 191, 36, 0.10);
  --status-danger-fg:  #F87171;  --status-danger-bg:  rgba(248, 113, 113, 0.10);

  /* Shadows — deeper, but mostly the surface lift carries hierarchy. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Anti-FOUC: apply the canvas immediately so the dark mode doesn't
   flash light during initial page load. */
html.keep-dark,
html.keep-dark body { background: var(--bg-canvas); }
html.keep-dark .keep-overview .card,
html.keep-dark .card { background: var(--bg-surface); }

/* ══════════════════════════════════════════════════════════════════════
   Base — page chrome, html/body. Loaded before legacy CSS but kept tight
   so the rest of the redesign happens in component classes.
   ══════════════════════════════════════════════════════════════════════ */
html {
  font-size: 14px;
  color-scheme: light;
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  color: var(--fg-primary);
  background: var(--bg-canvas);
  margin: 0;
  min-height: 100vh;
}

/* Higher-specificity body override — wins against the legacy ambient
   radial gradients in blackhole.css. Editorial pages read clean. */
html body,
html.ss-light body {
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: var(--font-ui);
}

/* Editorial sections opt out of the legacy .card glow + hover halo
   inherited from blackhole.css. */
.keep-overview .card,
.keep-overview .card:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  box-shadow: none;
  border-radius: var(--radius);
}
.keep-overview .card-hd { border-bottom: 1px solid var(--border-subtle); padding: var(--space-4) var(--space-5); }
.keep-overview .card-title { font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--fg-primary); }
.keep-overview .card-title i { color: var(--fg-tertiary); }

/* ══════════════════════════════════════════════════════════════════════
   Typographic primitives (typed once, reused on every page)
   ══════════════════════════════════════════════════════════════════════ */
.display { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 600; }
.mono    { font-family: var(--font-mono); }

.display-lg { font-family: var(--font-display); font-size: 48px; line-height: 56px; letter-spacing: -0.02em; font-weight: 600; }
.display-md { font-family: var(--font-display); font-size: 36px; line-height: 44px; letter-spacing: -0.02em; font-weight: 600; }
.display-sm { font-family: var(--font-display); font-size: 28px; line-height: 36px; letter-spacing: -0.01em; font-weight: 600; }

.heading-lg { font-size: 22px; line-height: 30px; letter-spacing: -0.01em; font-weight: 600; }
.heading-md { font-size: 18px; line-height: 26px; font-weight: 600; }
.heading-sm { font-size: 15px; line-height: 22px; font-weight: 600; }

.body-lg { font-size: 16px; line-height: 24px; }
.body-md { font-size: 14px; line-height: 20px; }
.body-sm { font-size: 13px; line-height: 18px; }
.body-xs { font-size: 12px; line-height: 16px; font-weight: 500; }

.mono-md { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
.mono-sm { font-family: var(--font-mono); font-size: 12px; line-height: 18px; }

.label-md, .kicker {
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.label-sm {
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}

/* Numbers that read as "data" — tabular, tightened display face */
.bignum {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
}
.bignum-lg {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* Editorial lede sentence (one per page max) */
.lede-sentence {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--fg-primary);
  text-wrap: pretty;
  margin: 0;
  max-width: 720px;
}
.lede-sentence .num    { font-weight: 600; }
.lede-sentence .domain { font-family: var(--font-mono); font-size: 0.85em; letter-spacing: 0; color: var(--fg-secondary); }

/* ══════════════════════════════════════════════════════════════════════
   Layout primitives
   ══════════════════════════════════════════════════════════════════════ */
.keep-shell {
  min-height: 100vh;
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: var(--font-ui);
}
.keep-page {
  padding: var(--space-8) var(--space-12);
}
.keep-section {
  border-bottom: 1px solid var(--border-subtle);
}
.keep-section:last-child { border-bottom: 0; }

.keep-row-rule { border-top: 1px solid var(--border-subtle); }
.keep-col-rule { border-right: 1px solid var(--border-subtle); }

/* ══════════════════════════════════════════════════════════════════════
   Nav
   ══════════════════════════════════════════════════════════════════════ */
.keep-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-5) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}
.keep-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--brand-sky-900);
  text-decoration: none;
}
.keep-nav-items {
  display: flex;
  gap: var(--space-6);
  font-size: 13px;
  color: var(--fg-secondary);
  font-weight: 500;
}
.keep-nav-items a,
.keep-nav-items span {
  color: var(--fg-secondary);
  text-decoration: none;
  cursor: pointer;
  padding-bottom: var(--space-5);
  position: relative;
  transition: color var(--duration-fast) var(--ease-standard);
}
.keep-nav-items a:hover,
.keep-nav-items .active { color: var(--fg-primary); }
.keep-nav-items .active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--space-5) * -1 + 1px);
  height: 2px;
  background: var(--fg-primary);
}
.keep-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 12px;
  color: var(--fg-tertiary);
}

.keep-status-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}

.keep-user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--fg-primary);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.keep-user-chip:hover { border-color: var(--border-strong); }
.keep-user-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-sky-900);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal-default);
  margin-right: 6px;
  animation: keep-pulse 1.6s ease-in-out infinite;
}
.live-dot--ok { background: #3FA66B; }
/* Dim + freeze the dot when JS confirms the live pipeline is offline.
   Toggled by realtime.js → updateConnectionStatus. */
.live-dot--off {
  background: var(--fg-tertiary);
  animation: none;
  opacity: 0.55;
}
@keyframes keep-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}

/* ══════════════════════════════════════════════════════════════════════
   Cards / surfaces
   ══════════════════════════════════════════════════════════════════════ */
.keep-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}
.keep-card--sunken { background: var(--bg-sunken); }
.keep-card-pad   { padding: var(--space-6); }
.keep-card-pad-lg { padding: var(--space-8) var(--space-12); }

.keep-divider { height: 1px; background: var(--border-subtle); width: 100%; }

/* Pill / tag */
.keep-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-default);
  color: var(--fg-secondary);
  background: transparent;
}
.keep-pill--signal { border-color: var(--signal-default); color: var(--signal-default); }
.keep-pill--success { border-color: var(--status-success-fg); color: var(--status-success-fg); }
.keep-pill--danger  { border-color: var(--status-danger-fg);  color: var(--status-danger-fg); }
/* Muted pill — used when an "X Active" pill flips to "0 Active" so it
   doesn't keep shouting in alarm-red when there's nothing to alert on. */
.keep-pill--muted   { border-color: var(--border-default);    color: var(--fg-tertiary); }

/* ══════════════════════════════════════════════════════════════════════
   Buttons (one accent color, multiple weights)
   ══════════════════════════════════════════════════════════════════════ */
.keep-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: background-color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
  text-decoration: none;
  white-space: nowrap;
}
.keep-btn:focus-visible { outline: 2px solid var(--signal-focus); outline-offset: 2px; }

.keep-btn--primary {
  background: var(--signal-default);
  color: #fff;
  border-color: var(--signal-default);
}
.keep-btn--primary:hover   { background: var(--signal-hover); border-color: var(--signal-hover); }
.keep-btn--primary:active  { background: var(--signal-pressed); border-color: var(--signal-pressed); }
.keep-btn--primary:disabled { background: var(--fg-disabled); border-color: var(--fg-disabled); cursor: not-allowed; }

.keep-btn--secondary {
  background: var(--bg-surface);
  color: var(--fg-primary);
  border-color: var(--border-default);
}
.keep-btn--secondary:hover { border-color: var(--border-strong); background: var(--bg-canvas); }

.keep-btn--ghost {
  background: transparent;
  color: var(--fg-primary);
  border-color: transparent;
}
.keep-btn--ghost:hover { background: var(--bg-sunken); }

.keep-btn--danger {
  background: var(--status-danger-fg);
  color: #fff;
  border-color: var(--status-danger-fg);
}
.keep-btn--danger:hover { background: #9B2F25; border-color: #9B2F25; }

.keep-btn--sm { padding: 6px 12px; font-size: 12px; }
.keep-btn--lg { padding: 12px 20px; font-size: 14px; }

/* Inline text link (sky-blue per mockup — navigation/learn-more) */
.keep-link {
  color: var(--brand-sky-500);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  font-weight: 500;
}
.keep-link:hover { color: var(--brand-sky-700); }

/* Action link (signal-orange — primary attention) */
.keep-action {
  color: var(--signal-default);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.keep-action:hover { color: var(--signal-hover); }

/* ══════════════════════════════════════════════════════════════════════
   Form controls
   ══════════════════════════════════════════════════════════════════════ */
.keep-input,
.keep-select,
.keep-textarea {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  color: var(--fg-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}
.keep-input::placeholder,
.keep-textarea::placeholder { color: var(--fg-tertiary); }
.keep-input:focus,
.keep-select:focus,
.keep-textarea:focus {
  outline: none;
  border-color: var(--signal-default);
  box-shadow: 0 0 0 3px var(--signal-focus);
}

.keep-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 6px;
}
.keep-helper {
  font-size: 12px;
  color: var(--fg-tertiary);
  margin-top: 4px;
}

/* Toggle switch */
.keep-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.keep-switch input { opacity: 0; width: 0; height: 0; }
.keep-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--fg-disabled);
  border-radius: var(--radius-pill);
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.keep-switch-slider::before {
  content: "";
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.keep-switch input:checked + .keep-switch-slider { background: var(--signal-default); }
.keep-switch input:checked + .keep-switch-slider::before { transform: translateX(16px); }
.keep-switch input:focus-visible + .keep-switch-slider { box-shadow: 0 0 0 3px var(--signal-focus); }

/* ══════════════════════════════════════════════════════════════════════
   Tables (reference density)
   ══════════════════════════════════════════════════════════════════════ */
.keep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.keep-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background: transparent;
}
.keep-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-primary);
  vertical-align: middle;
}
.keep-table tr:last-child td { border-bottom: 0; }
.keep-table tbody tr:hover td { background: var(--bg-sunken); }

/* ══════════════════════════════════════════════════════════════════════
   Live feed rows
   ══════════════════════════════════════════════════════════════════════ */
.keep-feed-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.keep-feed-row:last-child { border-bottom: 0; }
.keep-feed-time { font-family: var(--font-mono); font-size: 11px; color: var(--fg-tertiary); }
.keep-feed-domain { font-family: var(--font-mono); font-size: 12px; color: var(--fg-primary); word-break: break-all; }
.keep-feed-meta { font-size: 12px; color: var(--fg-secondary); margin-top: 2px; }
.keep-feed-explainer { font-size: 11px; font-style: italic; color: var(--fg-tertiary); margin-top: 3px; line-height: 1.35; max-width: 460px; }

/* ══════════════════════════════════════════════════════════════════════
   Device rows
   ══════════════════════════════════════════════════════════════════════ */
.keep-device-row {
  display: grid;
  grid-template-columns: 1fr 110px 90px 60px;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.keep-device-row:last-child { border-bottom: 0; }
.keep-device-name { font-size: 13px; font-weight: 500; color: var(--fg-primary); }
.keep-device-type { font-size: 12px; color: var(--fg-secondary); margin-top: 2px; }
.keep-device-count {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--fg-primary);
}
.keep-device-seen {
  font-size: 11px;
  color: var(--fg-secondary);
  text-align: right;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.keep-device-loud-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--signal-default);
}

/* ══════════════════════════════════════════════════════════════════════
   Stat tabs (activity section)
   ══════════════════════════════════════════════════════════════════════ */
.keep-stat-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border-subtle);
}
.keep-stat-tab {
  padding: var(--space-5) var(--space-12);
  border-right: 1px solid var(--border-subtle);
  /* These read as headline stats, not interactive controls. Removing
     cursor:pointer (and not wiring click handlers) was the call rather than
     shipping a half-built series-swap interaction. */
  position: relative;
  background: transparent;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.keep-stat-tab:last-child { border-right: 0; }
.keep-stat-tab.active { background: var(--bg-canvas); }
.keep-stat-tab.active .kicker { color: var(--signal-default); }
.keep-stat-tab.active::after {
  content: "";
  position: absolute;
  left: var(--space-12);
  right: var(--space-12);
  bottom: -1px;
  height: 2px;
  background: var(--signal-default);
}
.keep-stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-secondary);
  margin-top: var(--space-2);
}
.keep-stat-tab.active .keep-stat-value { color: var(--fg-primary); }

/* Range toggle (Today / 7d / 30d) */
.keep-range-toggle {
  display: inline-flex;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--fg-tertiary);
}
.keep-range-toggle .keep-range {
  cursor: pointer;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  color: var(--fg-tertiary);
  background: transparent;
  border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
  font-size: inherit;
}
.keep-range-toggle .keep-range.active {
  color: var(--fg-primary);
  border-bottom-color: var(--fg-primary);
}

/* ══════════════════════════════════════════════════════════════════════
   Notice band / banner
   ══════════════════════════════════════════════════════════════════════ */
.keep-notice {
  padding: var(--space-5) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}
.keep-notice-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
}
.keep-notice-actions {
  display: inline-flex;
  gap: var(--space-5);
  font-size: 13px;
  flex-shrink: 0;
}

/* Trust strip (compact "we see / we don't see" header band) */
.keep-trust-strip {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-2) var(--space-12);
  font-size: 11px;
  color: var(--fg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}
.keep-trust-strip .dot { color: var(--fg-disabled); }
.keep-trust-strip strong { color: var(--fg-secondary); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════
   Toast notification
   ══════════════════════════════════════════════════════════════════════ */
.keep-toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-5);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--fg-primary);
  z-index: 9999;
  animation: keep-arrive var(--duration-base) var(--ease-emphasized);
}
@keyframes keep-arrive {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════════
   Empty + loading
   ══════════════════════════════════════════════════════════════════════ */
.keep-empty {
  padding: var(--space-12);
  text-align: center;
  color: var(--fg-tertiary);
  font-size: 13px;
}
.keep-skeleton {
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  animation: keep-skel 1.6s ease-in-out infinite;
}
/* Inline-text skeleton — used in the editorial lede while stats load.
   Replaces the bare em-dash placeholder that looked like a failed render. */
.skeleton-num {
  display: inline-block;
  min-width: 2.6em;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  color: transparent;
  animation: keep-skel 1.4s ease-in-out infinite;
}
@keyframes keep-skel {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════
   Dashboard overview composition (Step 3)
   Lays out the v6-unified rhythm on top of the existing #sec-overview
   markup. Operates only within .keep-overview so other sections are
   untouched while the redesign rolls out page by page.
   ══════════════════════════════════════════════════════════════════════ */

/* Ambient page chrome that the legacy stylesheet would otherwise paint
   with radial gradients + dark glass. While the redesign is in flight,
   force the new canvas + nuke the legacy ambient so the overview reads
   editorial even though other pages still load blackhole.css below. */
.keep-overview {
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  margin: 0 calc(var(--space-12) * -1);
}
.keep-overview .keep-section {
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}
.keep-overview .keep-section:last-child { border-bottom: 0; }

.keep-overview-lede-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  padding: 0 !important;
}
.keep-overview-lede {
  padding: var(--space-8) var(--space-12);
}
.keep-overview-lede .lede-sentence { font-size: 22px; line-height: 1.4; }
.keep-overview-lede .kicker { margin-bottom: var(--space-3); }

.keep-next-action {
  padding: var(--space-8) var(--space-8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-3);
}
.keep-next-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-primary);
  margin: 0;
}

/* Stat tabs reuse the .keep-stat-tabs primitive — tighten the gutter
   inside the overview so the strip aligns with the lede grid. */
.keep-overview .keep-stat-tabs { border-top: 0; border-bottom: 1px solid var(--border-subtle); }
.keep-overview .keep-section:has(.keep-stat-tabs) { padding: 0 !important; }

/* Chart block — strip the legacy .card chrome, keep the new layout. */
.keep-chart-block {
  padding: var(--space-5) var(--space-12) var(--space-6);
  background: var(--bg-canvas);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}
.keep-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.keep-chart-caption {
  font-size: 12px;
  color: var(--fg-tertiary);
  max-width: 720px;
}
.keep-chart-canvas-wrap canvas {
  background: transparent !important;
}

/* Restyle the legacy .chart-range-btn to look like a mockup range tab. */
.keep-overview .chart-range-btn {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1.5px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 0 2px !important;
  color: var(--fg-tertiary) !important;
  font-family: var(--font-ui) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}
.keep-overview .chart-range-btn:hover { color: var(--fg-primary) !important; }
.keep-overview .chart-range-btn.active {
  color: var(--fg-primary) !important;
  border-bottom-color: var(--fg-primary) !important;
}

/* Twin columns (devices + feed) */
.keep-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0 !important;
}
.keep-twin-col {
  padding: var(--space-6) var(--space-8);
  min-width: 0;
}
.keep-block-head {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.keep-overview #top-devices-list,
.keep-overview #live-query-feed { background: transparent; }
.keep-overview #live-query-feed { max-height: 420px; overflow-y: auto; }

/* Block suggestions container: when JS populates it, render as a notice */
.keep-overview #block-suggestions-container:not(:empty) {
  padding: var(--space-5) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}

@media (max-width: 1024px) {
  .keep-overview { margin: 0 calc(var(--space-8) * -1); }
  .keep-overview .keep-section { padding: var(--space-6) var(--space-8); }
  .keep-overview-lede { padding: var(--space-6) var(--space-8); }
  .keep-next-action { padding: var(--space-6) var(--space-8); }
  .keep-twin-col { padding: var(--space-5) var(--space-6); }
  .keep-chart-block { padding: var(--space-4) var(--space-8) var(--space-5); }
}
@media (max-width: 768px) {
  .keep-overview { margin: 0; }
  .keep-overview-lede-row,
  .keep-twin { grid-template-columns: 1fr; }
  .keep-overview .keep-col-rule { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .keep-overview-lede .lede-sentence { font-size: 19px; line-height: 1.32; }
  .keep-overview .keep-section { padding: var(--space-5); }
  .keep-overview-lede { padding: var(--space-5); }
  .keep-next-action { padding: var(--space-5); }
  .keep-twin-col { padding: var(--space-5); }
  .keep-chart-block { padding: var(--space-4) var(--space-5); }
}

/* Reduced-motion honors */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .live-dot { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .keep-page          { padding: var(--space-6) var(--space-8); }
  .keep-nav           { padding: var(--space-4) var(--space-8); }
  .keep-card-pad-lg   { padding: var(--space-6) var(--space-8); }
  .keep-stat-tab      { padding: var(--space-5) var(--space-6); }
  .keep-stat-tab.active::after { left: var(--space-6); right: var(--space-6); }
}
@media (max-width: 768px) {
  .keep-page          { padding: var(--space-5); }
  .keep-nav           { padding: var(--space-4) var(--space-5); gap: var(--space-4); }
  .keep-nav-items     { display: none; }
  .keep-trust-strip   { padding: var(--space-2) var(--space-5); flex-wrap: wrap; gap: var(--space-3); }
  .keep-notice        { padding: var(--space-4) var(--space-5); }
  .keep-stat-tab      { padding: var(--space-4); }
  .keep-stat-tab.active::after { left: var(--space-4); right: var(--space-4); }
  .keep-stat-value    { font-size: 20px; }
  .lede-sentence      { font-size: 19px; line-height: 1.32; }
  .keep-device-row    { grid-template-columns: 1fr 64px auto auto; gap: var(--space-2); }
  .keep-device-count  { font-size: 16px; }
}
@media (max-width: 480px) {
  .keep-page          { padding: var(--space-4); }
  .keep-card-pad      { padding: var(--space-4); }
}
