/* AI QA Agent Agency — dense operational tool UI.
   Dark by default, light via prefers-color-scheme or the toggle. No external resources. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;

  --bg: #0e1217;
  --surface: #141a21;
  --surface-2: #19212a;
  --surface-3: #212b36;
  --hover: #1d2731;
  --border: #27313d;
  --border-strong: #3a4756;

  --text: #e5eaf0;
  --text-muted: #9ba7b4;
  --text-subtle: #808c99;

  --accent: #2dd4bf;
  --accent-text: #5eead4;
  --accent-bg: #14b8a6;
  --accent-on: #04201d;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-border: rgba(45, 212, 191, 0.45);
  --focus: #5eead4;

  --danger: #f87171;
  --danger-solid: #b91c1c;
  --danger-on: #ffffff;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.4);

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --ok-border: rgba(74, 222, 128, 0.35);

  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --warn-border: rgba(251, 191, 36, 0.4);

  --info: #7cb4ff;
  --info-soft: rgba(96, 165, 250, 0.14);
  --info-border: rgba(96, 165, 250, 0.38);

  --sev-critical-bg: #b91c1c;
  --sev-critical-fg: #ffffff;
  --sev-critical-bd: #dc2626;
  --sev-critical-text: #ff9090;
  --sev-critical-solid: #dc2626;

  --sev-high-bg: rgba(234, 88, 12, 0.18);
  --sev-high-fg: #fdba74;
  --sev-high-bd: rgba(249, 115, 22, 0.5);
  --sev-high-text: #fdba74;
  --sev-high-solid: #f97316;

  --sev-medium-bg: rgba(217, 119, 6, 0.18);
  --sev-medium-fg: #fcd34d;
  --sev-medium-bd: rgba(245, 158, 11, 0.5);
  --sev-medium-text: #fcd34d;
  --sev-medium-solid: #f59e0b;

  --sev-low-bg: rgba(59, 130, 246, 0.18);
  --sev-low-fg: #93c5fd;
  --sev-low-bd: rgba(96, 165, 250, 0.5);
  --sev-low-text: #93c5fd;
  --sev-low-solid: #3b82f6;

  --sev-info-bg: rgba(148, 163, 184, 0.16);
  --sev-info-fg: #cbd5e1;
  --sev-info-bd: rgba(148, 163, 184, 0.4);
  --sev-info-text: #cbd5e1;
  --sev-info-solid: #64748b;

  --stripe-a: #f59e0b;
  --stripe-b: #d97706;
  --stripe-fg: #1c1300;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e8ecf1;
  --hover: #eef2f6;
  --border: #dce1e8;
  --border-strong: #b9c2cd;

  --text: #111827;
  --text-muted: #4b5563;
  --text-subtle: #5b6573;

  --accent: #0f766e;
  --accent-text: #0f766e;
  --accent-bg: #0f766e;
  --accent-on: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --accent-border: rgba(15, 118, 110, 0.35);
  --focus: #0d9488;

  --danger: #b91c1c;
  --danger-solid: #b91c1c;
  --danger-on: #ffffff;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --danger-border: rgba(185, 28, 28, 0.3);

  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.09);
  --ok-border: rgba(21, 128, 61, 0.3);

  --warn: #a16207;
  --warn-soft: rgba(202, 138, 4, 0.12);
  --warn-border: rgba(161, 98, 7, 0.35);

  --info: #1d4ed8;
  --info-soft: rgba(29, 78, 216, 0.08);
  --info-border: rgba(29, 78, 216, 0.3);

  --sev-critical-bg: #991b1b;
  --sev-critical-fg: #ffffff;
  --sev-critical-bd: #7f1d1d;
  --sev-critical-text: #991b1b;
  --sev-critical-solid: #991b1b;

  --sev-high-bg: #ffedd5;
  --sev-high-fg: #9a3412;
  --sev-high-bd: #fdba74;
  --sev-high-text: #c2410c;
  --sev-high-solid: #ea580c;

  --sev-medium-bg: #fef3c7;
  --sev-medium-fg: #854d0e;
  --sev-medium-bd: #fcd34d;
  --sev-medium-text: #a16207;
  --sev-medium-solid: #d97706;

  --sev-low-bg: #dbeafe;
  --sev-low-fg: #1e40af;
  --sev-low-bd: #93c5fd;
  --sev-low-text: #1d4ed8;
  --sev-low-solid: #2563eb;

  --sev-info-bg: #eef1f5;
  --sev-info-fg: #374151;
  --sev-info-bd: #cbd2db;
  --sev-info-text: #4b5563;
  --sev-info-solid: #94a3b8;

  --stripe-a: #fbbf24;
  --stripe-b: #f59e0b;
  --stripe-fg: #1c1300;

  --shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --surface-3: #e8ecf1;
    --hover: #eef2f6;
    --border: #dce1e8;
    --border-strong: #b9c2cd;

    --text: #111827;
    --text-muted: #4b5563;
    --text-subtle: #5b6573;

    --accent: #0f766e;
    --accent-text: #0f766e;
    --accent-bg: #0f766e;
    --accent-on: #ffffff;
    --accent-soft: rgba(15, 118, 110, 0.09);
    --accent-border: rgba(15, 118, 110, 0.35);
    --focus: #0d9488;

    --danger: #b91c1c;
    --danger-solid: #b91c1c;
    --danger-on: #ffffff;
    --danger-soft: rgba(185, 28, 28, 0.08);
    --danger-border: rgba(185, 28, 28, 0.3);

    --ok: #15803d;
    --ok-soft: rgba(21, 128, 61, 0.09);
    --ok-border: rgba(21, 128, 61, 0.3);

    --warn: #a16207;
    --warn-soft: rgba(202, 138, 4, 0.12);
    --warn-border: rgba(161, 98, 7, 0.35);

    --info: #1d4ed8;
    --info-soft: rgba(29, 78, 216, 0.08);
    --info-border: rgba(29, 78, 216, 0.3);

    --sev-critical-bg: #991b1b;
    --sev-critical-fg: #ffffff;
    --sev-critical-bd: #7f1d1d;
    --sev-critical-text: #991b1b;
    --sev-critical-solid: #991b1b;

    --sev-high-bg: #ffedd5;
    --sev-high-fg: #9a3412;
    --sev-high-bd: #fdba74;
    --sev-high-text: #c2410c;
    --sev-high-solid: #ea580c;

    --sev-medium-bg: #fef3c7;
    --sev-medium-fg: #854d0e;
    --sev-medium-bd: #fcd34d;
    --sev-medium-text: #a16207;
    --sev-medium-solid: #d97706;

    --sev-low-bg: #dbeafe;
    --sev-low-fg: #1e40af;
    --sev-low-bd: #93c5fd;
    --sev-low-text: #1d4ed8;
    --sev-low-solid: #2563eb;

    --sev-info-bg: #eef1f5;
    --sev-info-fg: #374151;
    --sev-info-bd: #cbd2db;
    --sev-info-text: #4b5563;
    --sev-info-solid: #94a3b8;

    --stripe-a: #fbbf24;
    --stripe-b: #f59e0b;
    --stripe-fg: #1c1300;

    --shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }

/* Component classes set an explicit display, which would otherwise beat the
   UA rule for the hidden attribute. */
[hidden] { display: none !important; }

/* ---------------------------------------------------------- RTL / bidi */
/* LTR content (URLs, paths, codes, English audit prose) wrapped by ltr()
   or a dir="ltr" attribute stays isolated so it reads correctly in RTL. */
.ltr { unicode-bidi: isolate; }
[dir="rtl"] .mono,
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] time,
[dir="rtl"] .num { unicode-bidi: isolate; }

/* Mirror directional glyphs (chevrons, external-link, undo arrow). */
[dir="rtl"] .icon-flip { transform: scaleX(-1); }
[dir="rtl"] .finding-chevron,
[dir="rtl"] .summary-chevron { transform: scaleX(-1); }
[dir="rtl"] .finding.is-open .finding-chevron,
[dir="rtl"] .collapsible[open] > summary .summary-chevron { transform: scaleX(-1) rotate(90deg); }
[dir="rtl"] .switch-input:checked::before { transform: translateX(-13px); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
ul[role="list"], .chips-list, .sev-legend, .cat-list, .dist-list, .related-list, .error-list, .limitations, .project-list { list-style: none; }
code, .mono, pre { font-family: var(--mono); font-size: 0.92em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; inset-inline-start: 8px; top: -60px; z-index: 60;
  background: var(--accent-bg); color: var(--accent-on);
  padding: 8px 12px; border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 8px; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: end; }
.truncate { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.break { word-break: break-all; }
.noscript { padding: 24px; color: var(--text); }

/* --------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--accent-bg);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 650; letter-spacing: -0.1px; }
.brand-lab { font-size: 10.5px; color: var(--text-subtle); letter-spacing: 0.3px; text-transform: uppercase; }

.nav { display: flex; gap: 2px; margin-inline-start: 8px; }
.nav a {
  padding: 6px 10px; border-radius: var(--radius); color: var(--text-muted); font-weight: 500;
}
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }

.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.lang-btn { font-weight: 600; min-width: 62px; }
.health { display: flex; gap: 6px; flex-wrap: wrap; }
.hbadge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.hbadge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-subtle); flex: none; }
.hb-ok { border-color: var(--ok-border); color: var(--text); }
.hb-ok .hbadge-dot { background: var(--ok); }
.hb-bad { border-color: var(--danger-border); color: var(--danger); }
.hb-bad .hbadge-dot { background: var(--danger); }
.hb-neutral .hbadge-dot { background: var(--text-subtle); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn-sm { width: 22px; height: 22px; border: 0; }

.main { flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 18px 16px 48px; }
.main:focus { outline: none; }
.footer {
  border-top: 1px solid var(--border); padding: 14px 16px;
  color: var(--text-subtle); font-size: 11.5px; text-align: center;
}

/* ------------------------------------------------------------ page heads */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.page-head-main { min-width: 0; }
.breadcrumb ol { display: flex; gap: 6px; list-style: none; font-size: 11.5px; color: var(--text-subtle); }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--text-subtle); }
.page-title { font-size: 20px; letter-spacing: -0.2px; }
.page-title:focus { outline: none; }
.page-sub { color: var(--text-muted); margin-top: 3px; max-width: 76ch; }
.page-actions, .page-actions-inner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; min-width: 0; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 12px; }
.meta-target { color: var(--text-muted); max-width: min(520px, 100%); font-size: 12px; }
.queue-badge {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--info-soft); color: var(--info); border: 1px solid var(--info-border);
}
.view-body { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.panel + .panel, .queue-strip + .panel { margin-top: 14px; }
.view-body .panel + .panel { margin-top: 0; }
.panel-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.panel-title { font-size: 13px; letter-spacing: 0.1px; }
.panel-title:focus { outline: none; }
.panel-meta { font-size: 11.5px; color: var(--text-subtle); }
.panel-actions { margin-inline-start: auto; display: flex; gap: 6px; }
.panel-body { padding: 12px; }
.panel-body.flush { padding: 0; }
.panel-pad { padding: 12px; }
.panel-note { color: var(--text-muted); font-size: 12px; margin-bottom: 10px; max-width: 90ch; }
.panel-danger { border-color: var(--danger-border); }
.panel-danger .panel-head { background: var(--danger-soft); }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  font: inherit; font-weight: 500; font-size: 12.5px; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-lg { padding: 8px 16px; font-size: 13.5px; }
.btn-primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-on); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--danger-on); font-weight: 600; }
.btn-danger-ghost { background: transparent; border-color: var(--danger-border); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-group { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.btn-group-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-subtle); padding: 0 4px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; text-align: start; text-decoration: underline; }

/* ------------------------------------------------------- badges and pills */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: var(--radius-sm); font-size: 10.5px;
  font-weight: 700; letter-spacing: 0.4px; border: 1px solid var(--border-strong); color: var(--text-muted);
}
.mode-live { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.mode-demo {
  color: var(--stripe-fg); border-color: var(--stripe-b);
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 6px, var(--stripe-b) 6px 12px);
}
.exec { font-weight: 600; letter-spacing: 0.2px; text-transform: none; }
.exec-browser { color: var(--accent-text); border-color: var(--accent-border); background: var(--accent-soft); }
.exec-http { color: var(--info); border-color: var(--info-border); background: var(--info-soft); }
.exec-deterministic { color: var(--text-muted); background: var(--surface-3); }
.exec-simulated {
  color: var(--stripe-fg); border-color: var(--stripe-b); font-weight: 800;
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 6px, var(--stripe-b) 6px 12px);
}
.exec-not_implemented { color: var(--text-subtle); border-style: dashed; background: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.st-running, .st-cancelling { color: var(--accent-text); border-color: var(--accent-border); background: var(--accent-soft); }
.st-running .pill-dot { animation: pulse 1.6s ease-in-out infinite; }
.st-queued, .st-pending, .st-idle { color: var(--text-muted); }
.st-completed, .st-done { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.st-failed { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.st-cancelled, .st-skipped { color: var(--text-subtle); border-style: dashed; }
.cov-ran { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.cov-partial { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); }
.cov-skipped { color: var(--text-subtle); border-style: dashed; }
.cov-not_implemented { color: var(--text-subtle); border-style: dashed; background: transparent; }
.ls-proposed { color: var(--info); border-color: var(--info-border); background: var(--info-soft); }
.ls-confirmed { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.ls-dismissed { color: var(--text-subtle); border-style: dashed; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.sev {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px; border: 1px solid transparent;
}
.sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical-fg); border-color: var(--sev-critical-bd); }
.sev-high { background: var(--sev-high-bg); color: var(--sev-high-fg); border-color: var(--sev-high-bd); }
.sev-medium { background: var(--sev-medium-bg); color: var(--sev-medium-fg); border-color: var(--sev-medium-bd); }
.sev-low { background: var(--sev-low-bg); color: var(--sev-low-fg); border-color: var(--sev-low-bd); }
.sev-info { background: var(--sev-info-bg); color: var(--sev-info-fg); border-color: var(--sev-info-bd); }

.verif { font-weight: 600; letter-spacing: 0; text-transform: none; }
.verif-verified_automated { color: var(--ok); border-color: var(--ok-border); }
.verif-needs_verification { color: var(--warn); border-color: var(--warn-border); }
.verif-simulated { color: var(--stripe-fg); border-color: var(--stripe-b); background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 6px, var(--stripe-b) 6px 12px); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px;
  border-radius: var(--radius-sm); font-size: 11px;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border);
}
.tag-accent { color: var(--accent-text); border-color: var(--accent-border); background: var(--accent-soft); }
.tag-known { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); font-weight: 600; }
.tag-placeholder { border-style: dashed; }
.tag-on { color: var(--ok); border-color: var(--ok-border); }
.tag-off { color: var(--text-subtle); border-style: dashed; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

.yn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.yn-yes { color: var(--ok); }
.yn-no { color: var(--text-subtle); }
.yn-na { color: var(--text-subtle); }
.yn-alert { color: var(--warn); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* ------------------------------------------------------------- severity bar */
.sevbar-wrap { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.sevbar { display: flex; height: 6px; flex: 1; min-width: 46px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.sevbar-seg { display: block; min-width: 3px; }
.sevbar-empty { flex: 1; background: var(--surface-3); }
.sevbar-counts { display: flex; gap: 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.sevcount { font-weight: 600; }
.sev-bg-critical { background: var(--sev-critical-solid); }
.sev-bg-high { background: var(--sev-high-solid); }
.sev-bg-medium { background: var(--sev-medium-solid); }
.sev-bg-low { background: var(--sev-low-solid); }
.sev-bg-info { background: var(--sev-info-solid); }
.sev-text-critical { color: var(--sev-critical-text); }
.sev-text-high { color: var(--sev-high-text); }
.sev-text-medium { color: var(--sev-medium-text); }
.sev-text-low { color: var(--sev-low-text); }
.sev-text-info { color: var(--sev-info-text); }

/* ---------------------------------------------------------------- states */
.state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; text-align: center; }
.state-title { font-weight: 600; }
.state-text { color: var(--text-muted); max-width: 62ch; }
.state-error { color: var(--danger); }
.state-error .state-text { color: var(--text-muted); }
.state-actions { display: flex; gap: 8px; margin-top: 4px; }
.state-icon { color: var(--danger); }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.skeleton-line { height: 11px; border-radius: 3px; background: var(--surface-3); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.85; } }
.stale-note { font-size: 12px; color: var(--warn); padding: 6px 10px; border: 1px solid var(--warn-border); background: var(--warn-soft); border-radius: var(--radius); }

.callout {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
}
.callout-icon { flex: none; margin-top: 2px; color: var(--text-muted); }
.callout-title { font-weight: 600; }
.callout-text { color: var(--text-muted); max-width: 90ch; }
.callout-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.callout-actions { margin-top: 6px; display: flex; gap: 8px; }
.callout-info { border-color: var(--info-border); background: var(--info-soft); }
.callout-info .callout-icon { color: var(--info); }
.callout-warn { border-color: var(--warn-border); background: var(--warn-soft); }
.callout-warn .callout-icon { color: var(--warn); }
.callout-danger { border-color: var(--danger-border); background: var(--danger-soft); }
.callout-danger .callout-icon { color: var(--danger); }
.callout-ok { border-color: var(--ok-border); background: var(--ok-soft); }
.callout-ok .callout-icon { color: var(--ok); }
.callout-sim { border-color: var(--stripe-b); background: var(--warn-soft); }
.callout-sim .callout-icon { color: var(--stripe-b); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { padding: 7px 10px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.table thead th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--text-subtle);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; z-index: 1;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.row-link { cursor: pointer; }
.row-primary { font-weight: 600; color: var(--text); }
.cell-target { max-width: 280px; }
.cell-path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title { max-width: 260px; }
.cell-reason { color: var(--text-muted); max-width: 320px; }
.cell-strong { display: block; font-weight: 600; }
.cell-sub { display: block; font-size: 11px; color: var(--text-subtle); }
.cell-sub code + code { margin-inline-start: 6px; }
.code { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.code-2xx { color: var(--ok); }
.code-3xx { color: var(--info); }
.code-4xx { color: var(--warn); }
.code-5xx { color: var(--danger); }
.code-err { color: var(--text-subtle); }
.cov-row-skipped td, .cov-row-not_implemented td { color: var(--text-subtle); }

/* ------------------------------------------------------------ home view */
.queue-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 14px;
}
.queue-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-subtle); font-weight: 600; }
.queue-empty { display: inline-flex; align-items: center; gap: 6px; color: var(--text-subtle); font-size: 12.5px; }
.queue-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12.5px;
  max-width: 100%; min-width: 0; flex-wrap: wrap;
}
.queue-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.queue-item:hover { background: var(--hover); text-decoration: none; }
.queue-item.is-active { border-color: var(--accent-border); background: var(--accent-soft); }
.queue-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-subtle); font-weight: 600; }
.queue-name { font-weight: 600; }
.queue-target { color: var(--text-subtle); max-width: min(220px, 100%); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-pos { font-variant-numeric: tabular-nums; color: var(--text-muted); font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; flex: none; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 10px; }
.demo-card { border: 1px solid var(--stripe-b); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.sim-label {
  padding: 3px 10px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px; color: var(--stripe-fg);
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 8px, var(--stripe-b) 8px 16px);
}
.demo-card-body { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.demo-card-title { font-size: 13.5px; }
.demo-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- run view */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; display: flex; flex-direction: column; gap: 2px;
}
.stat-value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.4px; }

.run-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }

.stepper { display: flex; flex-direction: column; list-style: none; }
.step { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.step + .step { border-top: 1px solid var(--border); }
.step-icon {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-subtle); border: 1px solid var(--border);
}
.step-completed .step-icon { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.step-running .step-icon { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.step-failed .step-icon { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.step-skipped .step-icon { border-style: dashed; }
.step-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.step-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent-border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.step-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.step-num { color: var(--text-subtle); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 11.5px; }
.step-status { font-size: 11.5px; color: var(--text-muted); }
.step-spec { font-size: 11.5px; }
.step-detail { font-size: 12px; color: var(--text-muted); }
.step-skip { font-size: 12px; color: var(--warn); }
.step-time { font-size: 11.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.step.is-simulated .step-name::after {
  content: ""; width: 26px; height: 4px; border-radius: 2px;
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 4px, var(--stripe-b) 4px 8px);
}
.progress { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--accent); }
.progress.is-indeterminate .progress-bar { animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: 0; } 50% { margin-left: 65%; } 100% { margin-left: 0; } }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.spec-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 9px;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 6px;
}
.spec-card.is-simulated { border-color: var(--stripe-b); }
.spec-card.is-ni { border-style: dashed; }
.spec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.spec-name { font-size: 12.5px; }
.spec-action { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-foot { display: flex; align-items: baseline; justify-content: space-between; font-size: 11.5px; }
.spec-findings { font-weight: 650; font-variant-numeric: tabular-nums; }

.log {
  list-style: none; max-height: 340px; overflow: auto; font-family: var(--mono); font-size: 11.5px;
  background: var(--surface-2); padding: 6px 0;
}
.log:focus-visible { outline-offset: -2px; }
.log-line { display: grid; grid-template-columns: 62px 52px 110px minmax(0, 1fr); gap: 8px; padding: 2px 10px; }
.log-line:hover { background: var(--hover); }
.log-ts { color: var(--text-subtle); }
.log-level { font-weight: 700; font-size: 10.5px; letter-spacing: 0.3px; }
.log-spec { color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-msg { color: var(--text); word-break: break-word; }
.lvl-info .log-level { color: var(--info); }
.lvl-warn .log-level, .lvl-warning .log-level { color: var(--warn); }
.lvl-error .log-level, .lvl-critical .log-level { color: var(--danger); }
.lvl-debug .log-level { color: var(--text-subtle); }
.lvl-success .log-level { color: var(--ok); }
.log-empty { padding: 10px; color: var(--text-subtle); }

.error-list { list-style: disc; padding-inline-start: 18px; color: var(--danger); display: flex; flex-direction: column; gap: 4px; }
.error-list.compact { font-size: 12px; margin-top: 6px; }

.complete-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid var(--ok-border); background: var(--ok-soft); border-radius: var(--radius);
}
.complete-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.complete-title { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ok); }
.complete-text { color: var(--text-muted); font-size: 12.5px; }

.kv { display: grid; gap: 8px 16px; }
.kv-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kv-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kv-item dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-subtle); }
.kv-item dd { margin: 2px 0 0; color: var(--text); font-size: 12.5px; word-break: break-word; }
.chip-static-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-static { background: var(--surface-3); border-radius: var(--radius-sm); padding: 0 5px; }

/* ---------------------------------------------------------- report view */
.sim-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px;
  color: var(--stripe-fg); border: 2px solid var(--stripe-b);
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 12px, var(--stripe-b) 12px 24px);
}
.sim-banner-title { font-size: 14px; font-weight: 800; letter-spacing: 0.6px; }
.sim-banner-text { font-size: 12.5px; font-weight: 500; }
.sim-banner-compact { padding: 7px 12px; }
.live-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px;
  border: 1px solid var(--ok-border); background: var(--ok-soft); font-size: 12.5px;
}
.live-banner-text { color: var(--text-muted); }

.jump-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.jump-link {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font: inherit; font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.jump-link:hover { background: var(--hover); color: var(--text); }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; }
.sum-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.sum-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-subtle); }
.big-num { font-size: 26px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.sum-note { font-size: 11.5px; color: var(--text-subtle); }
.sev-legend { display: flex; flex-direction: column; gap: 3px; }
.sev-legend li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.cat-list { display: flex; flex-direction: column; gap: 4px; }
.cat-list li { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.cat-list li.is-zero { color: var(--text-subtle); }
.cat-bar { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.cat-bar span { display: block; height: 100%; background: var(--accent); min-width: 0; }
.check-counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-count { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.check-count-num { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.risk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.risk-pill { padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; border: 1px solid var(--border-strong); text-transform: capitalize; }
.risk-low { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.risk-medium { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); }
.risk-high { color: var(--sev-high-text); border-color: var(--sev-high-bd); background: var(--sev-high-bg); }
.risk-critical { color: var(--sev-critical-fg); background: var(--sev-critical-bg); border-color: var(--sev-critical-bd); }
.risk-neutral { color: var(--text-muted); }
.dist-list { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.dist-list li { display: inline-flex; align-items: center; gap: 5px; }
.dist-swatch { width: 8px; height: 8px; border-radius: 2px; }

.filters { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-subtle); width: 62px; flex: none; }
.chip-group { display: flex; gap: 5px; flex-wrap: wrap; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.chip-toggle:hover { background: var(--hover); }
.chip-toggle[aria-pressed="true"] { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.chip-toggle[aria-pressed="true"]::before { content: "✓ "; }
.chip-count { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-subtle); }
.sevchip-critical[aria-pressed="true"] { border-color: var(--sev-critical-bd); background: var(--sev-critical-bg); color: var(--sev-critical-fg); }
.sevchip-high[aria-pressed="true"] { border-color: var(--sev-high-bd); background: var(--sev-high-bg); color: var(--sev-high-fg); }
.sevchip-medium[aria-pressed="true"] { border-color: var(--sev-medium-bd); background: var(--sev-medium-bg); color: var(--sev-medium-fg); }
.sevchip-low[aria-pressed="true"] { border-color: var(--sev-low-bd); background: var(--sev-low-bg); color: var(--sev-low-fg); }
.sevchip-info[aria-pressed="true"] { border-color: var(--sev-info-bd); background: var(--sev-info-bg); color: var(--sev-info-fg); }
.filter-count { font-size: 12px; color: var(--text-muted); margin-inline-start: auto; }
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-icon { position: absolute; inset-inline-start: 7px; color: var(--text-subtle); pointer-events: none; }
.search-wrap .input { padding-inline-start: 25px; }

.finding-list { display: flex; flex-direction: column; list-style: none; }
.finding { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; background: var(--surface); border-inline-start-width: 3px; }
.finding.is-open { background: var(--surface-2); }
.sev-edge-critical { border-inline-start-color: var(--sev-critical-solid); }
.sev-edge-high { border-inline-start-color: var(--sev-high-solid); }
.sev-edge-medium { border-inline-start-color: var(--sev-medium-solid); }
.sev-edge-low { border-inline-start-color: var(--sev-low-solid); }
.sev-edge-info { border-inline-start-color: var(--sev-info-solid); }
.finding-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; width: 100%;
  padding: 8px 10px; background: none; border: 0; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.finding-head:hover { background: var(--hover); }
.finding-chevron { flex: none; color: var(--text-subtle); transition: transform 0.15s ease; }
.finding.is-open .finding-chevron { transform: rotate(90deg); }
.finding-title { font-weight: 600; min-width: 140px; flex: 1; }
.finding-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.finding-path { font-size: 11.5px; color: var(--text-muted); }
.finding-body { padding: 4px 12px 14px; padding-inline-start: 32px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); }
.finding-kv { padding-top: 10px; }
.detail-block { display: flex; flex-direction: column; gap: 5px; }
.detail-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-subtle); }
.steps { padding-inline-start: 20px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.compare-col { padding: 9px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.compare-expected { border-inline-start: 3px solid var(--ok); }
.compare-actual { border-inline-start: 3px solid var(--danger); }
.fix-text { font-size: 12.5px; color: var(--text); max-width: 100ch; }
.confidence { display: inline-flex; align-items: center; gap: 6px; }
.confidence-bar { width: 52px; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.confidence-bar span { display: block; height: 100%; background: var(--accent); }
.related-list { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }

.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.evidence { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.evidence.is-simulated { border-color: var(--stripe-b); border-top: 3px solid var(--stripe-b); }
.ev-caption { padding: 7px 9px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; border-top: 1px solid var(--border); }
.ev-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.ev-label { color: var(--text-muted); }
.ev-thumb { display: block; width: 100%; padding: 0; border: 0; background: var(--surface-3); cursor: zoom-in; }
.ev-thumb img { display: block; width: 100%; height: 132px; object-fit: cover; object-position: top; }
.ev-broken { display: flex; align-items: center; justify-content: center; gap: 6px; height: 132px; color: var(--text-subtle); font-size: 12px; }
.ev-text { margin: 0; padding: 9px; max-height: 180px; overflow: auto; font-size: 11.5px; background: var(--surface-2); white-space: pre-wrap; word-break: break-word; }
.ev-placeholder-box {
  display: flex; align-items: center; justify-content: center; gap: 7px; padding: 22px 10px;
  color: var(--text-subtle); font-size: 12px; border: 1px dashed var(--border-strong); margin: 9px; border-radius: var(--radius-sm);
}
.coverage-note { display: flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--text-muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.limitations { list-style: disc; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- lessons */
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 11px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.lesson-card.is-busy { opacity: 0.65; }
.ls-card-confirmed { border-inline-start: 3px solid var(--ok); }
.ls-card-dismissed { border-inline-start: 3px solid var(--border-strong); }
.ls-card-proposed { border-inline-start: 3px solid var(--info); }
.lesson-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lesson-title { font-size: 13.5px; }
.lesson-title:focus { outline: none; }
.lesson-text { color: var(--text-muted); font-size: 12.5px; white-space: pre-wrap; max-width: 100ch; }
.lesson-fix { border-inline-start: 2px solid var(--accent-border); padding-inline-start: 9px; font-size: 12.5px; }
.lesson-fix-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-subtle); display: block; }
.lesson-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 6px 14px; }
.lesson-meta-item dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-subtle); }
.lesson-meta-item dd { margin: 1px 0 0; font-size: 12px; word-break: break-word; }
.lesson-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lesson-edit { display: flex; flex-direction: column; gap: 8px; }

/* -------------------------------------------------------------- learning */
.learning-grid { display: grid; grid-template-columns: minmax(210px, 270px) minmax(0, 1fr); gap: 14px; align-items: start; }
.learning-side .project-list { padding: 6px; display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow: auto; }
.project-item {
  width: 100%; text-align: start; display: flex; flex-direction: column; gap: 3px;
  padding: 8px 9px; border-radius: var(--radius); border: 1px solid transparent;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.project-item:hover { background: var(--hover); }
.project-item.is-current { background: var(--accent-soft); border-color: var(--accent-border); }
.project-item-top { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.project-name { font-weight: 600; font-size: 12.5px; }
.project-origin { font-size: 11px; color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-counts { font-size: 11px; color: var(--text-subtle); }
.project-header { padding: 11px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project-title { font-size: 15px; }
.cred-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.tabs { display: flex; gap: 3px; padding: 8px 12px 0; border-bottom: 1px solid var(--border); }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; margin-bottom: -1px;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 600; }
.tab-count { font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.tab-panel { padding: 12px; }
.tab-panel:focus { outline: none; }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.form-col { display: flex; flex-direction: column; gap: 14px; }
.form-panel .panel-body { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text); padding: 0; }
.req { color: var(--danger); }
.field-hint { font-size: 11.5px; color: var(--text-subtle); max-width: 80ch; }
.field-error { font-size: 11.5px; color: var(--danger); font-weight: 500; }
.field.has-error .input, .has-error .chips { border-color: var(--danger); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.field-grid .span-2 { grid-column: 1 / -1; }
.subhead { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-subtle); margin-top: 4px; }

.input {
  width: 100%; padding: 6px 9px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 12.5px;
}
.input:focus { border-color: var(--accent); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 58px; }
textarea.mono { font-family: var(--mono); }
.input-sm { padding: 4px 8px; font-size: 12px; width: auto; }
.input-narrow { max-width: 110px; }
select.input { cursor: pointer; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn { align-self: flex-start; cursor: pointer; }

.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-3); border-radius: var(--radius); border: 1px solid var(--border); }
.seg-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label { padding: 5px 13px; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.segmented label:hover { color: var(--text); }
.seg-input:checked + label { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.seg-input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }

.scenario-list { display: flex; flex-direction: column; gap: 8px; }
.scenario-option { position: relative; }
.scenario-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scenario-card {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.scenario-card:hover { background: var(--hover); }
.scenario-input:checked + .scenario-card { border-color: var(--accent); background: var(--accent-soft); }
.scenario-input:focus-visible + .scenario-card { outline: 2px solid var(--focus); outline-offset: 2px; }
.scenario-name { font-weight: 600; font-size: 12.5px; }
.scenario-kind { font-size: 11.5px; color: var(--text-muted); }
.scenario-url { font-family: var(--mono); font-size: 11px; color: var(--text-subtle); word-break: break-all; }
.scenario-desc { font-size: 11.5px; color: var(--text-muted); }

.chips {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 4px 6px; min-height: 32px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: text;
}
.chips.is-disabled { opacity: 0.55; cursor: not-allowed; }
.chips:focus-within { border-color: var(--accent); }
.chips-list { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 7px;
  border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 11.5px;
}
.chip-remove { display: inline-flex; padding: 1px; background: none; border: 0; color: var(--text-subtle); cursor: pointer; border-radius: 3px; }
.chip-remove:hover { color: var(--danger); background: var(--danger-soft); }
.chips-input { flex: 1; min-width: 100px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; padding: 2px; }
.chips-input:focus { outline: none; }

.switch-list { display: flex; flex-direction: column; gap: 9px; }
.switch-row { display: flex; gap: 9px; align-items: flex-start; }
.switch-input {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 2px 0 0;
  width: 30px; height: 17px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border-strong); cursor: pointer; transition: background 0.12s ease;
}
.switch-input::before {
  content: ""; position: absolute; top: 1px; inset-inline-start: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--text-subtle); transition: transform 0.12s ease, background 0.12s ease;
}
.switch-input:checked { background: var(--accent-bg); border-color: var(--accent-bg); }
.switch-input:checked::before { transform: translateX(13px); background: var(--accent-on); }
.switch-input:disabled { opacity: 0.5; cursor: not-allowed; }
.switch-text { min-width: 0; }
.switch-label { font-size: 12.5px; font-weight: 600; cursor: pointer; }
.switch-desc { font-size: 11.5px; color: var(--text-subtle); max-width: 80ch; }

.checkbox {
  appearance: none; -webkit-appearance: none; flex: none; width: 15px; height: 15px; margin: 1px 0 0;
  border: 1px solid var(--border-strong); border-radius: 3px; background: var(--surface-2); cursor: pointer; position: relative;
}
.checkbox:checked { background: var(--accent-bg); border-color: var(--accent-bg); }
.checkbox:checked::before {
  content: ""; position: absolute; inset-inline-start: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--accent-on); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check-row { display: flex; align-items: flex-start; gap: 8px; }
.check-row label { font-size: 12.5px; cursor: pointer; }
.check-field { display: flex; flex-direction: column; gap: 3px; }
.radio-row { display: flex; gap: 8px; align-items: flex-start; }
.radio-row input { margin: 2px 0 0; accent-color: var(--accent-bg); flex: none; }
.radio-row label { font-size: 12.5px; font-weight: 500; cursor: pointer; }

.collapsible { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.collapsible > summary {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer;
  background: var(--surface-2); list-style: none; font-size: 13px;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.summary-chevron { transition: transform 0.15s ease; color: var(--text-subtle); flex: none; }
.collapsible[open] > summary .summary-chevron { transform: rotate(90deg); }
.summary-title { font-weight: 600; }
.summary-meta { font-size: 11px; color: var(--text-subtle); margin-inline-start: auto; text-transform: uppercase; letter-spacing: 0.4px; }
.collapsible-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); }
.panel-collapsible .panel-body { border-top: 1px solid var(--border); }
.saved-creds { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; padding: 9px; border: 1px solid var(--accent-border); background: var(--accent-soft); border-radius: var(--radius); }
.saved-user { color: var(--text-muted); }
.storage-field { padding: 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); gap: 8px; display: flex; flex-direction: column; }
.storage-field.is-disabled { opacity: 0.7; }

.consent { border: 2px solid var(--accent-border); border-radius: var(--radius); background: var(--accent-soft); padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.consent-head { display: flex; align-items: center; gap: 7px; color: var(--accent-text); }
.consent-text { font-size: 12.5px; color: var(--text-muted); }
.consent-extra { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--accent-border); }
.consent-note { font-size: 11.5px; color: var(--text-muted); }

.submit-bar {
  position: sticky; bottom: 0; z-index: 10; margin-top: 14px; padding: 11px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.submit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.submit-note { font-size: 11.5px; color: var(--text-subtle); margin-inline-end: auto; }
.error-summary { border: 1px solid var(--danger-border); background: var(--danger-soft); border-radius: var(--radius); padding: 9px 11px; display: flex; flex-direction: column; gap: 5px; }
.error-summary:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.error-summary-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--danger); }
.error-summary-list { list-style: disc; padding-inline-start: 20px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.error-summary-note { font-size: 11.5px; color: var(--text-muted); }
.is-loading { opacity: 0.8; }

/* ---------------------------------------------------------- dialogs/toasts */
.dialog {
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text); max-width: 440px; width: calc(100% - 32px); box-shadow: var(--shadow);
}
.dialog::backdrop, .lightbox::backdrop { background: rgba(3, 7, 12, 0.72); }
.dialog-form { padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.dialog-title { font-size: 15px; }
.dialog-msg { color: var(--text-muted); font-size: 12.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.lightbox {
  border: 0; padding: 0; background: var(--surface); color: var(--text); border-radius: var(--radius);
  max-width: min(94vw, 1180px); width: auto; max-height: 92vh; box-shadow: var(--shadow);
}
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lightbox-counter { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; }
.lightbox-nav { display: flex; gap: 6px; margin-inline-start: auto; }
.lightbox-figure { margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.lightbox-img { max-width: 100%; max-height: 72vh; object-fit: contain; background: var(--surface-3); border-radius: var(--radius-sm); }
.lightbox-caption { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }
.lightbox-error { color: var(--danger); font-size: 12.5px; }

.toasts { position: fixed; inset-inline-end: 14px; bottom: 14px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 28px)); }
.toast {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 12.5px;
  animation: toast-in 0.16s ease-out;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.16s ease, transform 0.16s ease; }
.toast-msg { flex: 1; min-width: 0; }
.toast-icon { flex: none; margin-top: 2px; }
.toast-success { border-color: var(--ok-border); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error { border-color: var(--danger-border); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .run-grid { grid-template-columns: minmax(0, 1fr); }
  .learning-grid { grid-template-columns: minmax(0, 1fr); }
  .learning-side .project-list { max-height: none; flex-direction: row; overflow-x: auto; }
  .learning-side .project-item { min-width: 200px; }
}

@media (max-width: 760px) {
  .topbar-inner { padding: 8px 12px; gap: 10px; }
  .nav { order: 3; width: 100%; margin-inline-start: 0; overflow-x: auto; }
  .topbar-end { order: 2; }
  .hbadge-text { display: none; }
  .hbadge { padding: 4px; }
  .main { padding: 14px 12px 40px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .check-counts { grid-template-columns: repeat(2, 1fr); }
  .finding-body { padding-inline-start: 12px; }
  .log-line { grid-template-columns: 58px 46px minmax(0, 1fr); }
  .log-spec { display: none; }
  .filter-label { width: auto; }
  .filter-count { margin-inline-start: 0; }

  /* Dense tables collapse into stacked rows */
  .stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack-sm tbody tr { display: block; padding: 8px 10px; border-bottom: 1px solid var(--border); }
  .stack-sm tbody td { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; border: 0; padding: 2px 0; }
  .stack-sm tbody td::before {
    content: attr(data-label); flex: 0 0 80px; color: var(--text-subtle); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  .stack-sm tbody td.num { text-align: start; }
  .cell-target, .cell-path, .cell-title { max-width: 100%; }
}

@media (max-width: 420px) {
  body { font-size: 13px; }
  .page-title { font-size: 18px; }
  .summary-grid, .stats { grid-template-columns: minmax(0, 1fr); }
  .ev-grid, .card-grid { grid-template-columns: minmax(0, 1fr); }
  .submit-actions { flex-direction: column; align-items: stretch; }
  .submit-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar, .footer, .toasts, .page-actions, .filters, .jump-nav, .submit-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { break-inside: avoid; }
}
