/* ========================================================
   wpx-sys.css — System & Security health surfaces

   Loaded by all dashboard pages: it carries the topbar indicator styles
   (.sys-hi*, rendered by nav.js into the shared topbar) and the WakaPanel
   detail styles (#wpx-panel.sys-panel and friends).

   The bottom split-pane band styles (.sys-band / .sys-split / .sys-half /
   .sys-headline / .sys-rows / .sys-row / .sys-quiet) were removed
   2026-05-29 along with the band itself — see panel-system.js header for
   the rationale.

   Tokens: no new ones. The source CSS references `--ok` / `--ok-bg`;
   production tokens are `--good` / `--good-bg`. We alias them below so
   the rest of the file stays unchanged from the design source.
   Source: SPEC docs/design-pass-2026-05-21-system-security-health/SPEC.md §3
   ======================================================== */

:root {
  /* Token aliases — design source → production token names. */
  --ok: var(--good);
  --ok-bg: var(--good-bg);
  /* --info-br doesn't exist in prod tokens; pick a sensible tinted border. */
  --info-br: #bfd7f5;
}

/* ───────── Health indicator ─────────
   Lives in .top-actions slot, replacing the unwired bell SVG. */

.sys-hi {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 4px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1;
  transition: background .15s, border-color .15s, padding .15s;
}
.sys-hi:hover { background: var(--paper-2); border-color: var(--rule); }
.sys-hi .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.sys-hi .lbl {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
}
.sys-hi .ct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* OK · bare dot, no label, no padding */
.sys-hi[data-state="ok"] {
  padding: 6px;
}
.sys-hi[data-state="ok"] .dot {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-bg);
}

/* Watch · dot + count + label */
.sys-hi[data-state="watch"] {
  padding: 4px 10px 4px 8px;
  background: var(--watch-bg);
  border-color: #ecdfa6;
}
.sys-hi[data-state="watch"] .dot { background: var(--watch); }
.sys-hi[data-state="watch"] .lbl { color: var(--watch); font-weight: 600; }
.sys-hi[data-state="watch"] .ct { background: var(--watch); color: var(--paper); }

/* Alert · same shape, red palette + soft pulse on dot */
.sys-hi[data-state="alert"] {
  padding: 4px 10px 4px 8px;
  background: var(--alert-bg);
  border-color: #f4d4d0;
}
.sys-hi[data-state="alert"] .dot {
  background: var(--alert);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.18);
  animation: sys-pulse 2.2s ease-in-out infinite;
}
.sys-hi[data-state="alert"] .lbl { color: var(--alert); font-weight: 600; }
.sys-hi[data-state="alert"] .ct { background: var(--alert); color: var(--paper); }

@keyframes sys-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(192,57,43,0.08); }
}

@media (prefers-reduced-motion: reduce) {
  .sys-hi[data-state="alert"] .dot { animation: none; }
}

/* Tooltip popover hanging beneath the indicator */
.sys-hi-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ink-2);
  z-index: 20;
}
.sys-hi-tip::before {
  content: '';
  position: absolute;
  top: -6px; right: 14px;
  width: 10px; height: 10px;
  background: var(--paper);
  border-top: 1px solid var(--rule-2);
  border-left: 1px solid var(--rule-2);
  transform: rotate(45deg);
}
.sys-hi-tip .hd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.sys-hi-tip .hd .dot { width: 6px; height: 6px; border-radius: 50%; }
.sys-hi-tip .hd .dot.ok    { background: var(--good); }
.sys-hi-tip .hd .dot.watch { background: var(--watch); }
.sys-hi-tip .hd .dot.alert { background: var(--alert); }
.sys-hi-tip .ti { font-weight: 600; color: var(--ink); margin-bottom: 4px; font-size: 13px; }
.sys-hi-tip .ln {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0;
}
.sys-hi-tip .ln .sw { width: 4px; height: 4px; border-radius: 50%; flex: 0 0 auto; }
.sys-hi-tip .ln .sw.alert { background: var(--alert); }
.sys-hi-tip .ln .sw.watch { background: var(--watch); }
.sys-hi-tip .ln .sw.ok    { background: var(--good); }
.sys-hi-tip .cta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
}
.sys-hi-tip .cta strong { color: var(--ink-2); font-weight: 600; }

/* ───────── Bottom split-pane band ─────────
   Removed 2026-05-29. The band's CSS classes (.sys-band, .sys-band-head,
   .sys-split, .sys-half, .sys-headline, .sys-rows, .sys-row, .sys-quiet)
   are deleted along with the JS that rendered them. See panel-system.js
   header for the rationale. */

/* ───────── WakaPanel (system health kind, wide 640) ───────── */

#wpx-panel.sys-panel { width: 640px; }
.sys-panel-id {
  display: flex; align-items: center; gap: 10px;
}
.sys-panel-id .pdot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.sys-panel-id .pdot.ok    { background: var(--good);  box-shadow: 0 0 0 3px var(--good-bg); }
.sys-panel-id .pdot.watch { background: var(--watch); box-shadow: 0 0 0 3px var(--watch-bg); }
.sys-panel-id .pdot.alert { background: var(--alert); box-shadow: 0 0 0 3px var(--alert-bg); }
.sys-panel-id h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.sys-panel-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* Panel tab strip */
.sys-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0 22px;
  margin-bottom: 14px;
}
.sys-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.sys-tab:hover { color: var(--ink-2); }
.sys-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.sys-tab .ct {
  font-size: 9.5px;
  color: var(--ink-3);
  margin-left: 5px;
  font-weight: 500;
}
.sys-tab[aria-selected="true"] .ct { color: var(--ink-2); }

/* Panel body sections */
.sys-section {
  padding: 0 22px 18px;
}
.sys-section + .sys-section { padding-top: 4px; }
.sys-section-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.sys-section-empty {
  font-size: 12px;
  color: var(--ink-4);
  padding: 8px 0;
  font-style: italic;
}

/* Source chip — expanded taxonomy for this kind (4 sources) */
.sys-srcchip {
  display: inline-flex; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
}
.sys-srcchip.firebase  { background: #fff4e6; color: #b75c00; border-color: #f1d8b4; }
.sys-srcchip.connector { background: var(--info-bg); color: var(--info); border-color: var(--info-br); }
.sys-srcchip.secrets   { background: #ece4f5; color: #5e3e8a; border-color: #d6c5ec; }
.sys-srcchip.agent     { background: var(--good-bg); color: var(--good); border-color: #c6dec9; }

/* Connector row inside the panel */
.sys-conn {
  display: grid;
  grid-template-columns: 10px 1fr 90px 80px 14px;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 12.5px;
  cursor: pointer;
}
.sys-conn:last-child { border-bottom: none; }
.sys-conn:hover .nm { color: var(--orange); }
.sys-conn .swatch { width: 6px; height: 26px; border-radius: 3px; }
.sys-conn .swatch.ok    { background: var(--good); }
.sys-conn .swatch.watch { background: var(--watch); }
.sys-conn .swatch.alert { background: var(--alert); }
.sys-conn .lhs { min-width: 0; }
.sys-conn .nm { font-size: 12.5px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.sys-conn .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.sys-conn .sparkline {
  width: 90px; height: 22px;
  background: var(--paper-2);
  border: 1px dashed var(--rule);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.sys-conn .sparkline::after {
  content: 'sparkline · future';
  position: absolute;
  inset: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}
.sys-conn .age {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: right;
}
.sys-conn .age.ok    { color: var(--good); }
.sys-conn .age.watch { color: var(--watch); }
.sys-conn .age.alert { color: var(--alert); font-weight: 600; }
.sys-conn .chev { color: var(--ink-4); font-size: 12px; text-align: center; }

/* HIGH-severity inline excerpt (SPEC §8.3) — shown above the finding list
   whenever the latest scan contains ≥1 HIGH finding. Empty otherwise. */
.sys-high-excerpt {
  background: var(--alert-bg);
  border: 1px solid #f4d4d0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.sys-high-excerpt .hd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--alert);
  margin-bottom: 6px;
}
.sys-high-excerpt .ln {
  font-size: 12px;
  color: var(--ink);
  margin: 4px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
}
.sys-high-excerpt .ln .ti { font-weight: 500; }
.sys-high-excerpt .ln .ck {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* Finding row inside Security tab */
.sys-find {
  display: grid;
  grid-template-columns: 64px 1fr auto 14px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  cursor: pointer;
}
.sys-find:last-child { border-bottom: none; }
.sys-find:hover .ti { color: var(--orange); }
.sys-find .sev {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
  text-align: center;
}
.sys-find .sev.high   { background: var(--alert-bg); color: var(--alert); border-color: #f4d4d0; }
.sys-find .sev.medium { background: var(--watch-bg); color: var(--watch); border-color: #ecdfa6; }
.sys-find .sev.low    { background: var(--paper-2); color: var(--ink-3); border-color: var(--rule); }
.sys-find .lhs { min-width: 0; }
.sys-find .ti { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.sys-find .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 1px;
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sys-find .meta .new {
  background: var(--orange);
  color: var(--paper);
  font-weight: 600;
  padding: 0 5px;
  border-radius: 3px;
  letter-spacing: 0.06em;
}
.sys-find .meta .carried {
  color: var(--ink-4);
  letter-spacing: 0.06em;
}
.sys-find .rhs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: right;
}
.sys-find .chev { color: var(--ink-4); font-size: 12px; text-align: center; }

/* Drift check row */
.sys-drift {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 12px;
}
.sys-drift:last-child { border-bottom: none; }
.sys-drift .lhs { display: flex; align-items: center; gap: 8px; }
.sys-drift .nm { color: var(--ink); font-weight: 500; font-size: 12px; }
.sys-drift .path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
}
.sys-drift .v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.sys-drift .v.ok    { background: var(--good-bg); color: var(--good); border-color: #c6dec9; }
.sys-drift .v.watch { background: var(--watch-bg); color: var(--watch); border-color: #ecdfa6; }
.sys-drift .v.fail  { background: var(--alert-bg); color: var(--alert); border-color: #f4d4d0; }
.sys-drift .v.review { background: var(--watch-bg); color: var(--watch); border-color: #ecdfa6; }

/* Activity timeline */
.sys-timeline {
  position: relative;
  padding-left: 22px;
}
.sys-timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--rule);
}
.sys-event {
  position: relative;
  padding: 6px 0 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
}
.sys-event::before {
  content: '';
  position: absolute;
  left: -20px; top: 12px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink-4);
}
.sys-event[data-tone="ok"]::before    { border-color: var(--good); }
.sys-event[data-tone="watch"]::before { border-color: var(--watch); }
.sys-event[data-tone="alert"]::before { border-color: var(--alert); background: var(--alert); }
.sys-event .ti { font-size: 12.5px; color: var(--ink); }
.sys-event .ti .src {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-right: 6px;
}
.sys-event .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 1px;
  letter-spacing: 0.02em;
}
.sys-event .when {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
