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

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

  /* Nexus dark — page #030303 with layered near-black panels */
  --bg: #030303;
  --surface: #050505;
  --surface-2: #0b0b0b;
  --surface-3: #151515;
  --hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  --panel-bg: rgba(10, 9, 7, 0.24);
  --glass-blur: 26px;
  --glass-sat: 165%;
  --glass-edge: rgba(255, 255, 255, 0.14);
  --glass-top: rgba(255, 255, 255, 0.11);
  --glass-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.9), 0 2px 10px -4px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(7, 7, 7, 0.80);
  --card-bg: rgba(26, 23, 18, 0.28);
  --card-bg-2: #090909;
  --bracket: rgba(212, 160, 23, 0.45);
  --row-hover: rgba(212, 160, 23, 0.09);

  --text: #e4e4e7;
  --text-strong: #ffffff;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  /* gold accent system (dark) */
  --accent: #d4a017;
  --accent-2: #f7e07a;
  --orange-100: #f6e7b4;
  --accent-text: #e8c25c;
  --accent-bg: #d4a017;
  --accent-on: #2a1d02;
  --accent-soft: rgba(212, 160, 23, 0.12);
  --accent-border: rgba(212, 160, 23, 0.34);
  --focus: rgba(247, 224, 122, 0.60);
  --focus-neutral: rgba(255, 255, 255, 0.30);

  /* gold — primary call-to-action buttons */
  --gold-light: #f7e07a;
  --gold: #d4a017;
  --gold-deep: #a9790a;
  --gold-on: #2a1d02;
  --gold-border: rgba(212, 160, 23, 0.55);
  --gold-glow: rgba(212, 160, 23, 0.35);

  --danger: #f0424f;
  --danger-solid: #c02535;
  --danger-on: #ffffff;
  --danger-soft: rgba(240, 66, 79, 0.12);
  --danger-border: rgba(240, 66, 79, 0.40);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --ok-border: rgba(52, 211, 153, 0.35);

  --warn: #ffa500;
  --warn-soft: rgba(247, 224, 122, 0.13);
  --warn-border: rgba(247, 224, 122, 0.40);

  --info: #5aa2ff;
  --info-soft: rgba(90, 162, 255, 0.14);
  --info-border: rgba(90, 162, 255, 0.38);

  --sev-critical-bg: rgba(240, 66, 79, 0.16);
  --sev-critical-fg: #ff8790;
  --sev-critical-bd: rgba(240, 66, 79, 0.50);
  --sev-critical-text: #ff8790;
  --sev-critical-solid: #f0424f;

  --sev-high-bg: rgba(212, 160, 23, 0.16);
  --sev-high-fg: #ff9a4d;
  --sev-high-bd: rgba(212, 160, 23, 0.50);
  --sev-high-text: #ff9a4d;
  --sev-high-solid: #ff6400;

  --sev-medium-bg: rgba(247, 224, 122, 0.16);
  --sev-medium-fg: #ffc04d;
  --sev-medium-bd: rgba(247, 224, 122, 0.50);
  --sev-medium-text: #ffc04d;
  --sev-medium-solid: #ffa500;

  --sev-low-bg: rgba(90, 162, 255, 0.16);
  --sev-low-fg: #93c0ff;
  --sev-low-bd: rgba(90, 162, 255, 0.50);
  --sev-low-text: #93c0ff;
  --sev-low-solid: #5aa2ff;

  --sev-info-bg: rgba(161, 161, 170, 0.14);
  --sev-info-fg: #c4c4cc;
  --sev-info-bd: rgba(161, 161, 170, 0.40);
  --sev-info-text: #c4c4cc;
  --sev-info-solid: #a1a1aa;

  --stripe-a: #f7e07a;
  --stripe-b: #d4a017;
  --stripe-fg: #2a1d02;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-2xl: 16px;
  --shadow: 0 1px 1px -0.5px rgba(0, 0, 0, 0.4), 0 3px 3px -1.5px rgba(0, 0, 0, 0.4),
            0 12px 20px -8px rgba(0, 0, 0, 0.55), 0 40px 60px -24px rgba(0, 0, 0, 0.7);
  --font: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --grid-color: rgba(255, 255, 255, 0.08);
  --grid-opacity: 0.16;
  /* Ambient colour blobs spread across the viewport: the glass frames blur over
     these, which is what makes them read as glass rather than flat translucency. */
  --glow: radial-gradient(circle at 50% -4%, rgba(212, 160, 23, 0.30), transparent 38rem),
          radial-gradient(circle at 88% 18%, rgba(247, 224, 122, 0.15), transparent 30rem),
          radial-gradient(circle at 10% 44%, rgba(212, 160, 23, 0.13), transparent 28rem),
          radial-gradient(circle at 76% 72%, rgba(255, 190, 80, 0.11), transparent 32rem),
          radial-gradient(circle at 32% 96%, rgba(247, 224, 122, 0.09), transparent 30rem),
          linear-gradient(180deg, rgba(3, 3, 3, 0.1), #030303 92%);
}

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

  /* Warm-light adaptation: same structure, orange accent, softened glow */
  --bg: #f6f2ee;
  --surface: #ffffff;
  --surface-2: #faf6f2;
  --surface-3: #f0eae3;
  --hover: rgba(120, 60, 0, 0.05);
  --border: rgba(30, 18, 6, 0.12);
  --border-strong: rgba(30, 18, 6, 0.22);

  --panel-bg: rgba(255, 255, 255, 0.34);
  --glass-blur: 24px;
  --glass-sat: 150%;
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-top: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 16px 40px -20px rgba(30, 18, 6, 0.28), 0 2px 8px -4px rgba(30, 18, 6, 0.14);
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --card-bg: rgba(255, 255, 255, 0.39);
  --card-bg-2: #faf6f2;
  --bracket: rgba(234, 88, 0, 0.55);
  --row-hover: rgba(212, 160, 23, 0.07);

  --text: #1c1917;
  --text-strong: #0c0a09;
  --text-muted: #57534e;
  --text-subtle: #78716c;

  /* gold accent system (light) — deepened for AA contrast on white */
  --accent: #9a7209;
  --accent-2: #b8860b;
  --orange-100: #6b4e05;
  --accent-text: #856108;
  --accent-bg: #b8860b;
  --accent-on: #ffffff;
  --accent-soft: rgba(184, 134, 11, 0.12);
  --accent-border: rgba(154, 114, 9, 0.38);
  --focus: rgba(154, 114, 9, 0.55);
  --focus-neutral: rgba(30, 18, 6, 0.35);

  --danger: #c02535;
  --danger-solid: #c02535;
  --danger-on: #ffffff;
  --danger-soft: rgba(192, 37, 53, 0.08);
  --danger-border: rgba(192, 37, 53, 0.30);

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

  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --warn-border: rgba(180, 83, 9, 0.35);

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

  --sev-critical-bg: #fee2e2;
  --sev-critical-fg: #991b1b;
  --sev-critical-bd: #fca5a5;
  --sev-critical-text: #991b1b;
  --sev-critical-solid: #dc2626;

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

  --sev-medium-bg: #fef3c7;
  --sev-medium-fg: #92400e;
  --sev-medium-bd: #fcd34d;
  --sev-medium-text: #92400e;
  --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: #f0eae3;
  --sev-info-fg: #57534e;
  --sev-info-bd: #d6c7ba;
  --sev-info-text: #57534e;
  --sev-info-solid: #78716c;

  --stripe-a: #f3d98a;
  --stripe-b: #b8860b;
  --stripe-fg: #24190a;

  --shadow: 0 10px 28px rgba(60, 30, 0, 0.12);
  --grid-color: rgba(120, 60, 0, 0.10);
  --grid-opacity: 0.10;
  --glow: radial-gradient(circle at 50% 0%, rgba(212, 160, 23, 0.10), transparent 34rem),
          radial-gradient(circle at 85% 22%, rgba(247, 224, 122, 0.05), transparent 28rem),
          linear-gradient(180deg, rgba(246, 242, 238, 0.2), var(--bg) 82%);
}

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

    --bg: #f6f2ee;
    --surface: #ffffff;
    --surface-2: #faf6f2;
    --surface-3: #f0eae3;
    --hover: rgba(120, 60, 0, 0.05);
    --border: rgba(30, 18, 6, 0.12);
    --border-strong: rgba(30, 18, 6, 0.22);

    --panel-bg: rgba(255, 255, 255, 0.34);
  --glass-blur: 24px;
  --glass-sat: 150%;
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-top: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 16px 40px -20px rgba(30, 18, 6, 0.28), 0 2px 8px -4px rgba(30, 18, 6, 0.14);
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --card-bg: rgba(255, 255, 255, 0.39);
    --card-bg-2: #faf6f2;
    --bracket: rgba(234, 88, 0, 0.55);
    --row-hover: rgba(212, 160, 23, 0.07);

    --text: #1c1917;
    --text-strong: #0c0a09;
    --text-muted: #57534e;
    --text-subtle: #78716c;

    /* gold accent system (light, system-preference) */
    --accent: #9a7209;
    --accent-2: #b8860b;
    --orange-100: #6b4e05;
    --accent-text: #856108;
    --accent-bg: #b8860b;
    --accent-on: #ffffff;
    --accent-soft: rgba(184, 134, 11, 0.12);
    --accent-border: rgba(154, 114, 9, 0.38);
    --focus: rgba(154, 114, 9, 0.55);
    --focus-neutral: rgba(30, 18, 6, 0.35);

    --danger: #c02535;
    --danger-solid: #c02535;
    --danger-on: #ffffff;
    --danger-soft: rgba(192, 37, 53, 0.08);
    --danger-border: rgba(192, 37, 53, 0.30);

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

    --warn: #b45309;
    --warn-soft: rgba(180, 83, 9, 0.12);
    --warn-border: rgba(180, 83, 9, 0.35);

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

    --sev-critical-bg: #fee2e2;
    --sev-critical-fg: #991b1b;
    --sev-critical-bd: #fca5a5;
    --sev-critical-text: #991b1b;
    --sev-critical-solid: #dc2626;

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

    --sev-medium-bg: #fef3c7;
    --sev-medium-fg: #92400e;
    --sev-medium-bd: #fcd34d;
    --sev-medium-text: #92400e;
    --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: #f0eae3;
    --sev-info-fg: #57534e;
    --sev-info-bd: #d6c7ba;
    --sev-info-text: #57534e;
    --sev-info-solid: #78716c;

    --stripe-a: #f3d98a;
    --stripe-b: #b8860b;
    --stripe-fg: #24190a;

    --shadow: 0 10px 28px rgba(60, 30, 0, 0.12);
    --grid-color: rgba(120, 60, 0, 0.10);
    --grid-opacity: 0.10;
    --glow: radial-gradient(circle at 50% 0%, rgba(212, 160, 23, 0.10), transparent 34rem),
            radial-gradient(circle at 85% 22%, rgba(247, 224, 122, 0.05), transparent 28rem),
            linear-gradient(180deg, rgba(246, 242, 238, 0.2), var(--bg) 82%);
  }
}

/* Shared translucent elevation for buttons / inputs / chips (theme-aware). */
:root { --elev: rgba(255, 255, 255, 0.04); --elev-hover: rgba(255, 255, 255, 0.08); }
:root[data-theme="light"] { --elev: rgba(30, 18, 6, 0.035); --elev-hover: rgba(30, 18, 6, 0.07); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --elev: rgba(30, 18, 6, 0.035); --elev-hover: rgba(30, 18, 6, 0.07); }
}

/* ------------------------------------------------------------------ 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: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Static Nexus background: faint grid + warm radial glow, fixed behind content. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(135deg, var(--grid-color) 1px, transparent 1px);
  background-size: 1.25rem 1.25rem; opacity: var(--grid-opacity);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--glow);
}

::selection { background: rgba(212, 160, 23, 0.30); color: #fff; }

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; color: var(--text-strong); }
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: transparent; padding: 10px 16px 0;
}
.topbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 7px 10px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); background: var(--topbar-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: center; gap: 10px; color: var(--text-strong);
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius); padding: 4px 10px; transition: border-color 0.25s ease, background 0.25s ease;
}
.brand:hover { text-decoration: none; border-color: var(--accent-border); background: var(--accent-soft); }
.brand-mark {
  display: block; width: 54px; height: 54px; flex: none;
  object-fit: contain; border-radius: 6px; background: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  transition: transform 0.3s ease, filter 0.3s ease;
}
.brand:hover .brand-mark {
  transform: scale(1.06);
  filter: drop-shadow(0 2px 8px var(--gold-glow));
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .brand:hover .brand-mark { transition: none; transform: none; }
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 500; letter-spacing: -0.02em; font-size: 14px; }
.brand-lab { font-family: var(--mono); font-size: 9.5px; color: var(--text-subtle); letter-spacing: 0.12rem; text-transform: uppercase; }

.nav { display: flex; gap: 2px; margin-inline-start: 8px; }
.nav a {
  padding: 6px 11px; border-radius: var(--radius); color: var(--text-muted);
  font-family: var(--mono); font-size: 12px; font-weight: 500; border: 1px solid transparent;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.nav a:hover { background: var(--hover); color: var(--text-strong); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--orange-100); }

.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 9px; border-radius: 999px; font-size: 11px; font-family: var(--mono);
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); 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 { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 18px 16px 48px; }
.main:focus { outline: none; }
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border); padding: 16px; margin-top: 8px;
  color: var(--text-strong); font-size: 11px; text-align: center; font-family: var(--mono);
  display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap;
}
.footer-logo {
  width: 36px; height: 36px; flex: none; object-fit: contain;
  opacity: 0.75; transition: opacity 0.3s ease;
}
.footer:hover .footer-logo { opacity: 1; }

/* ------------------------------------------------------------ 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: 11px; color: var(--text-subtle); font-family: var(--mono); }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--text-subtle); }
.page-title { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; color: var(--text-strong); }
.page-title:focus { outline: none; }
.page-sub { color: var(--text-muted); margin-top: 5px; max-width: 76ch; font-size: 14.5px; }
.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 {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--glass-edge); border-radius: var(--radius-2xl);
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: inset 0 1px 0 var(--glass-top), var(--glass-shadow);
}
/* Signature Nexus corner brackets (top-start + bottom-end); mirror under RTL. */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 1.05rem; height: 1.05rem; pointer-events: none; z-index: 3;
}
.panel::before { top: 0.55rem; inset-inline-start: 0.55rem; border-top: 1px solid var(--bracket); border-inline-start: 1px solid var(--bracket); }
.panel::after { bottom: 0.55rem; inset-inline-end: 0.55rem; border-bottom: 1px solid var(--bracket); border-inline-end: 1px solid var(--bracket); }
.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: 11px 14px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.015);
}
.panel-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--text-strong); }
.panel-title:focus { outline: none; }
.panel-meta { font-size: 11px; color: var(--text-subtle); font-family: var(--mono); }
.panel-actions { margin-inline-start: auto; display: flex; gap: 6px; }
.panel-body { padding: 14px; }
.panel-body.flush { padding: 0; }
.panel-pad { padding: 14px; }
.panel-note { color: var(--text-muted); font-size: 12.5px; margin-bottom: 10px; max-width: 90ch; }
.panel-danger { border-color: var(--danger-border); }
.panel-danger::before, .panel-danger::after { --bracket: 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: 7px 13px; border-radius: var(--radius); cursor: pointer;
  background: var(--elev); border: 1px solid var(--border); color: var(--text-strong);
  font: inherit; font-weight: 500; font-size: 13px; white-space: nowrap;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease, color 0.2s ease;
}
.btn:hover { background: var(--elev-hover); border-color: var(--border-strong); color: var(--text-strong); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-lg { padding: 9px 18px; font-size: 14px; }
/* Golden primary CTA: metallic gradient, ambient shimmer, hover sheen sweep + glow */
.btn-primary {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  background-size: 200% 200%;
  border-color: var(--gold-border);
  color: var(--gold-on); font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 0 0 rgba(212, 160, 23, 0);
  animation: gold-shimmer 6s ease-in-out infinite;
}
/* sheen that sweeps across on hover */
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.39) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 0.65s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #fff0a8 0%, var(--gold-light) 45%, var(--gold) 100%);
  border-color: var(--gold-light);
  color: var(--gold-on);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 4px 18px var(--gold-glow);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:active { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 6px var(--gold-glow); }
.btn-primary:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.btn-primary:disabled { animation: none; box-shadow: none; }
@keyframes gold-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
/* RTL: sweep travels the other way */
[dir="rtl"] .btn-primary::after { transform: translateX(120%); }
[dir="rtl"] .btn-primary:hover::after { transform: translateX(-120%); }
@media (prefers-reduced-motion: reduce) {
  .btn-primary { animation: none; background-position: 0% 50%; }
  .btn-primary::after { display: none; }
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text-strong); }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--danger-on); font-weight: 600; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-group { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--elev); }
.btn-group-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-subtle); padding: 0 4px; font-family: var(--mono); }
.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: 2px 8px; border-radius: 999px; font-size: 10px; font-family: var(--mono);
  font-weight: 600; letter-spacing: 0.03em; 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 9px; border-radius: 999px; font-size: 11px; font-weight: 500; font-family: var(--mono);
  border: 1px solid var(--border); background: var(--elev); 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: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; font-family: var(--mono); 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 8px;
  border-radius: 999px; font-size: 10.5px; font-family: var(--mono);
  background: var(--elev); 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; }

/* Nexus typography: mono for labels/eyebrows/metrics; amber kickers on card headers. */
.table thead th, .field-label, .filter-label, .detail-title, .kv-item dt,
.lesson-meta-item dt, .lesson-fix-label, .subhead, .stat-label, .sum-label,
.queue-label, .queue-kind, .log-level, .log-ts, .chip-static, .scenario-kind, .scenario-url,
.step-num, .hbadge, .num, .chip-count, .tab-count, .spec-findings { font-family: var(--mono); }
/* Card-header eyebrows read as amber section kickers. */
.sum-label { color: var(--accent-2); font-weight: 600; letter-spacing: 0.16rem; }
.stat-label, .detail-title, .field-label, .kv-item dt, .lesson-meta-item dt,
.lesson-fix-label, .subhead { letter-spacing: 0.13rem; }

.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: 11px 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--card-bg);
}
.callout-icon { flex: none; margin-top: 2px; color: var(--text-muted); }
.callout-title { font-weight: 500; color: var(--text-strong); }
.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: 10.5px; text-transform: uppercase; letter-spacing: 0.11rem; font-weight: 600; z-index: 1;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--row-hover); }
.row-link { cursor: pointer; }
.row-primary { font-weight: 500; color: var(--text-strong); }
.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); }
/* Coverage table: bento-style hairline dividers between columns. */
.table-coverage th, .table-coverage td { border-inline-end: 1px solid var(--border); }
.table-coverage th:last-child, .table-coverage td:last-child { border-inline-end: 0; }

/* ------------------------------------------------------------ home view */
.queue-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel-bg); margin-bottom: 14px;
}
.queue-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.16rem; color: var(--accent-2); 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 11px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--elev); 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(--elev-hover); border-color: var(--accent-border); text-decoration: none; }
.queue-item.is-active { border-color: var(--accent-border); background: var(--accent-soft); }
.queue-kind { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14rem; color: var(--text-subtle); font-weight: 600; font-family: var(--mono); }
.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-lg); overflow: hidden; background: var(--card-bg); transition: transform 0.2s ease; }
.demo-card:hover { transform: translateY(-1px); }
.sim-label {
  padding: 4px 11px; font-size: 10px; font-weight: 700; letter-spacing: 0.14rem; color: var(--stripe-fg); font-family: var(--mono);
  background: repeating-linear-gradient(-45deg, var(--stripe-a) 0 8px, var(--stripe-b) 8px 16px);
}
.demo-card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.demo-card-title { font-size: 15px; font-weight: 500; color: var(--text-strong); }
.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(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 11px 13px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.25s ease, transform 0.2s ease;
}
.stat:hover { border-color: var(--accent-border); transform: translateY(-1px); }
.stat-value { font-size: 23px; font-weight: 500; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-label { font-size: 10px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.13rem; }

.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: 500; color: var(--text-strong); display: inline-flex; align-items: center; gap: 6px; }
.step-num { color: var(--accent-2); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 11px; }
.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-lg); padding: 11px;
  background: var(--card-bg); display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.25s ease, transform 0.2s ease;
}
.spec-card:hover { border-color: var(--accent-border); transform: translateY(-1px); }
.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: 13.5px; font-weight: 500; color: var(--text-strong); }
.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: 14px 16px; border: 1px solid var(--ok-border); background: var(--ok-soft); border-radius: var(--radius-lg);
}
.complete-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.complete-title { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 16px; 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: 10px; text-transform: uppercase; letter-spacing: 0.13rem; color: var(--text-subtle); }
.kv-item dd { margin: 3px 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(--elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 6px; }

/* ---------------------------------------------------------- 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: 13px; font-weight: 700; letter-spacing: 0.12rem; font-family: var(--mono); }
.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(--elev); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); cursor: pointer;
  transition: background 0.25s ease, color 0.2s ease, border-color 0.25s ease;
}
.jump-link:hover { background: var(--elev-hover); color: var(--text-strong); border-color: var(--accent-border); }

.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-lg); padding: 13px; background: var(--card-bg); display: flex; flex-direction: column; gap: 9px; }
.sum-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16rem; color: var(--accent-2); }
.big-num { font-size: 30px; font-weight: 500; line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.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: 19px; font-weight: 500; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.risk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.risk-pill { padding: 3px 11px; border-radius: 999px; font-weight: 600; font-size: 11.5px; font-family: var(--mono); 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 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--elev); color: var(--text-muted);
  font-family: var(--mono); font-size: 11.5px; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.chip-toggle:hover { background: var(--elev-hover); }
.chip-toggle[aria-pressed="true"] { border-color: var(--accent-border); background: var(--accent-soft); color: var(--orange-100); font-weight: 500; }
.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-lg); margin-bottom: 7px; background: var(--card-bg); border-inline-start-width: 3px; overflow: hidden; }
.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(--row-hover); }
.finding-chevron { flex: none; color: var(--accent-2); transition: transform 0.15s ease; }
.finding.is-open .finding-chevron { transform: rotate(90deg); }
.finding-title { font-weight: 500; color: var(--text-strong); 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: 11px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card-bg); 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-lg); overflow: hidden; background: var(--card-bg); }
.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-lg); padding: 13px; background: var(--card-bg); 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: 15px; font-weight: 500; color: var(--text-strong); }
.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); border-color: var(--border); }
.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: 500; font-size: 13px; color: var(--text-strong); }
.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-strong); }
.tab[aria-selected="true"] { background: var(--card-bg); border-color: var(--border); color: var(--text-strong); font-weight: 500; }
.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: 10.5px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.13rem; padding: 0; }
.req { color: var(--accent); }
.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: 10.5px; text-transform: uppercase; letter-spacing: 0.14rem; color: var(--accent-2); margin-top: 4px; }

.input {
  width: 100%; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--elev); color: var(--text-strong);
  font: inherit; font-size: 13px; transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { border-color: var(--accent-border); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.20); outline: none; }
.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(--elev); 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-strong); }
.seg-input:checked + label { background: var(--card-bg); color: var(--text-strong); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.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: 10px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card-bg);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.scenario-card:hover { background: var(--elev-hover); border-color: var(--accent-border); }
.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: 500; font-size: 13px; color: var(--text-strong); }
.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: 5px 7px; min-height: 34px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--elev); cursor: text;
}
.chips.is-disabled { opacity: 0.55; cursor: not-allowed; }
.chips:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.20); }
.chips-list { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px;
  border-radius: 999px; background: var(--elev-hover); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px;
}
.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: 13px; font-weight: 500; color: var(--text-strong); cursor: pointer; letter-spacing: 0; }
.switch-desc { font-size: 11.5px; color: var(--text-subtle); max-width: 80ch; }

.checkbox {
  appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 1px 0 0;
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--elev); 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-lg); background: var(--card-bg); overflow: hidden; }
.collapsible > summary {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer;
  background: rgba(255, 255, 255, 0.015); list-style: none; font-size: 14px; color: var(--text-strong);
}
.collapsible > summary::-webkit-details-marker { display: none; }
.summary-chevron { transition: transform 0.15s ease; color: var(--accent-2); flex: none; }
.collapsible[open] > summary .summary-chevron { transform: rotate(90deg); }
.summary-title { font-weight: 500; }
.summary-meta { font-size: 10px; color: var(--text-subtle); margin-inline-start: auto; text-transform: uppercase; letter-spacing: 0.14rem; font-family: var(--mono); }
.collapsible-body { padding: 14px; 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: 10px; border: 1px solid var(--accent-border); background: var(--accent-soft); border-radius: var(--radius-lg); }
.saved-user { color: var(--text-muted); }
.storage-field { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card-bg); gap: 8px; display: flex; flex-direction: column; }
.storage-field.is-disabled { opacity: 0.7; }

.consent { border: 1.5px solid var(--accent-border); border-radius: var(--radius-lg); background: var(--accent-soft); padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.consent-head { display: flex; align-items: center; gap: 7px; color: var(--orange-100); }
.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: 12px 14px;
  background: var(--topbar-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  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-lg); 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, 2, 0, 0.74); backdrop-filter: blur(2px); }
.dialog-form { padding: 18px; display: flex; flex-direction: column; gap: 9px; }
.dialog-title { font-size: 17px; font-weight: 500; color: var(--text-strong); }
.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: 1px solid var(--border-strong); padding: 0; background: var(--surface); color: var(--text); border-radius: var(--radius-lg);
  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: 10px 12px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 12.5px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  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: 10px;
    text-transform: uppercase; letter-spacing: 0.1rem; font-family: var(--mono);
  }
  .stack-sm tbody td.num { text-align: start; }
  .cell-target, .cell-path, .cell-title { max-width: 100%; }
}

@media (max-width: 420px) {
  body { font-size: 13.5px; }
  .page-title { font-size: 22px; }
  .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%; }
  .panel::before, .panel::after { display: none; }
}

@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; }
  body::before, body::after { display: none !important; }
  .panel { break-inside: avoid; background: #fff; border-color: #ccc; }
  .panel::before, .panel::after { display: none; }
}

/* --------------------------------------------------- glass surface layers */
/* Nested cards sit on an already-blurred panel: a light blur keeps the layered
   glass read without stacking expensive (and muddy) heavy filters. */
.sum-card, .finding, .lesson-card, .compare-col, .evidence, .collapsible,
.storage-field, .demo-card, .spec-card, .stat, .phase {
  backdrop-filter: blur(8px) saturate(130%);
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  box-shadow: inset 0 1px 0 var(--glass-top);
  border-color: var(--glass-edge);
}
/* Top-level chrome gets the full frosted treatment. */
.topbar-inner, .dialog, .lightbox-inner, .toast {
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) !important;
  box-shadow: inset 0 1px 0 var(--glass-top), var(--glass-shadow);
  border-color: var(--glass-edge);
}
/* Inputs read as recessed glass rather than solid wells. */
.input, .chips, select, textarea {
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
/* Browsers without backdrop-filter fall back to opaque surfaces so text stays legible. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --panel-bg: #0b0a08; --card-bg: #141210; }
  :root[data-theme="light"] { --panel-bg: #ffffff; --card-bg: #ffffff; }
}

/* ===========================================================================
   MAIN PAGE — Aii.INFO workspace stage
   Ported from the Aii-Main-Page design. Scoped to the home view only, so the
   audit / report / learning views keep their existing layout untouched.

   Three things the source design did not have to handle, and this does:
     - RTL: direction-dependent values are logical, and the network diagram
       mirrors as a whole rather than letting its labels fall out of place.
     - Light theme: the stage stays dark on purpose (it is a photographic hero);
       everything around it follows the app's own theme tokens.
     - Real data: nothing here is sized for the sample numbers in the mock.
   =========================================================================== */

.workspace-stage,
.home-metrics {
  --stage-gold: #e3bf75;
  --stage-gold-light: #f7e0a4;
  --stage-gold-deep: #c99b4c;
}

/* ---- the stage ---------------------------------------------------------- */
.workspace-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1.05fr);
  min-height: 326px;
  margin: 0 0 26px;
  border: 1px solid #9e804b66;
  border-radius: var(--radius-2xl, 16px);
  overflow: hidden;
  color: #f5eddb;
  background-color: #111311;
  background-image:
    linear-gradient(to right, rgba(4, 5, 5, .86) 0%, rgba(4, 5, 5, .68) 40%, rgba(4, 5, 5, .26) 100%),
    url("assets/stage-city.webp");
  background-size: cover;
  background-position: center 62%;
  background-repeat: no-repeat;
  box-shadow: 0 16px 48px #0004, inset 0 1px 0 #f3d99d16;
}
/* The scrim has to come from the text side, whichever side that is. */
[dir="rtl"] .workspace-stage {
  background-image:
    linear-gradient(to left, rgba(4, 5, 5, .86) 0%, rgba(4, 5, 5, .68) 40%, rgba(4, 5, 5, .26) 100%),
    url("assets/stage-city.webp");
}

.stage-grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .25;
  background-image:
    linear-gradient(#ddc8910a 1px, transparent 1px),
    linear-gradient(90deg, #ddc8910a 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(90deg, transparent, #000);
  transform: perspective(900px) rotateY(-10deg) scale(1.15);
}
[dir="rtl"] .stage-grid {
  mask-image: linear-gradient(270deg, transparent, #000);
  transform: perspective(900px) rotateY(10deg) scale(1.15);
}
.stage-grid::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, #edcf8a0a 48%, transparent 62%);
  transform: translateX(-100%);
  animation: stage-scan 8s ease-in-out infinite;
}

.stage-halo {
  position: absolute; pointer-events: none; z-index: -1;
  border-radius: 50%; filter: blur(38px); opacity: .3;
}
.halo-warm {
  width: 370px; height: 280px; inset-inline-end: 18%; top: -155px;
  background: radial-gradient(ellipse, #e7bc6248, transparent 72%);
  animation: stage-drift 10s ease-in-out infinite alternate;
}
.halo-deep {
  width: 390px; height: 390px; inset-inline-end: -95px; bottom: -210px;
  background: radial-gradient(ellipse, #b6813945, transparent 72%);
  animation: stage-drift 10s ease-in-out -7s infinite alternate-reverse;
}

.stage-particles {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1;
  mask-image: linear-gradient(90deg, transparent, #000 55%);
}
[dir="rtl"] .stage-particles { mask-image: linear-gradient(270deg, transparent, #000 55%); }
.stage-particles i {
  position: absolute; inset-inline-start: var(--x); top: var(--y);
  width: var(--size); height: var(--size); border-radius: 50%;
  background: #ffe6a5; box-shadow: 0 0 9px #f8d88690;
  animation: stage-dust var(--duration) linear var(--delay) infinite;
}

/* ---- stage copy --------------------------------------------------------- */
.stage-copy {
  padding: 36px 0 37px; padding-inline-start: 34px;
  align-self: center; position: relative; z-index: 2;
}
.stage-eyebrow {
  color: #c4ac7a; font-size: .6875rem; letter-spacing: 1.6px; font-weight: 650;
  display: flex; align-items: center; gap: 9px; margin-bottom: 18px; text-transform: uppercase;
}
[dir="rtl"] .stage-eyebrow { letter-spacing: 0; }
.brand-tick {
  width: 13px; height: 13px; border: 1px solid #e3bf7580;
  display: inline-block; position: relative; flex-shrink: 0;
}
.brand-tick::after { content: ""; position: absolute; inset: 3px; background: var(--stage-gold); }

.stage-copy h1 {
  font-size: clamp(2rem, 2.9vw, 2.85rem); font-weight: 550; letter-spacing: -1.65px;
  color: #f5eddb; line-height: 1.15; margin: 0;
}
[dir="rtl"] .stage-copy h1 { letter-spacing: 0; }
.title-period { color: var(--stage-gold); }
.stage-copy > p {
  font-size: 1rem; line-height: 1.75; color: #d3cbb8; margin-top: 17px; max-width: 385px;
}

.stage-actions { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 24px; }
.stage-actions .btn { min-height: 43px; }
.stage-actions .btn-primary { box-shadow: 0 0 25px #e3bf7515; }
.stage-actions .btn-primary:hover { box-shadow: 0 0 30px #e3bf7538; }
.stage-secondary { border: 1px solid #b49b6255; background: #e6ce9407; color: #e1d4b2; }
.stage-secondary:hover { background: #e6ce9412; border-color: #b49b62a0; color: #f7e0a4; }

.stage-context {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: .75rem; color: #c8b890; margin-top: 22px;
}
.stage-context > span { display: inline-flex; align-items: center; gap: 5px; }
.stage-context .icon { color: #d6b66d; }
.context-divider { width: 3px; height: 3px; background: #8b764b; border-radius: 50%; }

/* ---- the specialist network -------------------------------------------- */
.agent-network {
  position: relative; width: 100%; max-width: 560px; aspect-ratio: 560 / 340;
  align-self: center; justify-self: center; margin: 0 0 19px;
  container-type: inline-size;
}
/* One mirror for the whole diagram, then un-mirror the text so it stays readable. */
/* The diagram mirrors as a whole, then the text-bearing parts flip back.
   Order matters: `scaleX(-1) translate(...)` mirrors about the element's
   UNTRANSFORMED origin, which negates the translate and displaces the element
   by its own width. Flipping first, then translating, keeps the geometry. */
[dir="rtl"] .agent-network { transform: scaleX(-1); }
[dir="rtl"] .agent-network .network-node { transform: translate(-50%, -50%) scaleX(-1); }
[dir="rtl"] .agent-network .network-hub { transform: translate(-50%, -50%) scaleX(-1); }
[dir="rtl"] .agent-network figcaption { transform: translateX(-50%) scaleX(-1); }

.network-wires {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.network-orbit { stroke: #cbaa612b; stroke-width: .8; stroke-dasharray: 2 6; fill: none; }
.network-orbit.outer { stroke: #cbaa6118; stroke-dasharray: none; }
.network-ring {
  stroke: #e3bf7566; stroke-width: 1; stroke-dasharray: 39 13 3 14; fill: none;
  transform-box: fill-box; transform-origin: center;
  animation: stage-orbit 24s linear infinite;
}
.network-connections { stroke: #d0ae6c44; stroke-width: 1; fill: none; }
.network-signals {
  stroke: #f3d99f; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 14 100;
  fill: none; filter: drop-shadow(0 0 3px #e3bf7599);
}
.network-signals path { animation: stage-flow 3.8s linear infinite; }
.network-signals path:nth-child(2n) { animation-delay: -3s; stroke: #bf8d3d; }
.network-signals path:nth-child(3n) { animation-delay: -5s; animation-direction: reverse; }

.network-aura {
  position: absolute; left: 50%; top: 50.59%; width: 68%; aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, #e5b95605 80deg, #e5b95628 120deg,
              transparent 160deg, transparent 220deg, #e5b95618 280deg, transparent 340deg);
  mask-image: radial-gradient(circle, transparent 20%, #000 40%, transparent 71%);
  animation: stage-orbit 16s linear infinite;
}
.network-echoes circle {
  stroke: #e8c377; stroke-width: .7; fill: none;
  transform-origin: 280px 172px; animation: stage-echo 6s ease-out infinite;
}
.network-echoes circle:nth-child(2) { animation-delay: -2s; }
.network-echoes circle:nth-child(3) { animation-delay: -4s; }
.network-satellites {
  transform-origin: 280px 172px; animation: stage-orbit 12s linear infinite;
  stroke: #e3bf7525; stroke-width: .6; fill: none;
}
.network-satellites path {
  stroke: #f5d998; stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 45 100;
}
.network-satellites .satellite-light {
  fill: #ffeaba; stroke: none; filter: drop-shadow(0 0 4px #f7c96a);
}
.network-satellites.satellite-outer { animation-duration: 19s; animation-direction: reverse; opacity: .65; }
.network-star { fill: #e3bf75; opacity: .5; animation: stage-star 7s ease-in-out infinite; }
.star-two { animation-delay: -2s; fill: #fff0bf; }
.star-three { animation-delay: -4s; }

.network-hub {
  position: absolute; left: 50%; top: 50.59%; transform: translate(-50%, -50%);
  width: clamp(66px, 20cqw, 110px); height: clamp(66px, 20cqw, 110px);
  border: 1px solid #e3bf7577; border-radius: 50%; background: #080909; overflow: hidden;
  box-shadow: 0 0 0 8px #e3bf7506, 0 0 48px #e3bf751d, inset 0 1px 1px #f7e0a438;
  display: flex; align-items: center; justify-content: center;
}
.network-hub img {
  display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 50%;
  animation: stage-logo-glow 5s ease-in-out infinite;
}

.network-node {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 12px; border: 1px solid #9a804f80; border-radius: 7px;
  background: linear-gradient(125deg, #29251bf5, #111411f5);
  box-shadow: 0 5px 20px #0005, inset 0 1px 0 #f1ddae10;
  color: #e0cfaa; font-size: .75rem; user-select: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
  animation: stage-node-float 5.5s ease-in-out var(--node-delay) infinite;
}
.network-node .icon { width: 16px; height: 16px; color: var(--stage-gold); }
.node-auth .icon, .node-accessibility .icon { color: #f7e4b1; }
.node-responsive .icon, .node-report .icon { color: var(--stage-gold-deep); }
.node-explorer      { left: 21.43%; top: 17.65%; }
.node-auth          { left: 51.79%; top: 11.18%; }
.node-forms         { left: 80.36%; top: 23.53%; }
.node-responsive    { left: 83.04%; top: 67.65%; }
.node-security      { left: 58.93%; top: 88.82%; }
.node-accessibility { left: 25.89%; top: 82.35%; }
.node-report        { left: 12.5%;  top: 50%; }
.node-beacon {
  position: absolute; right: -2px; top: -2px; width: 5px; height: 5px;
  border-radius: 50%; background: #ffe5a5; box-shadow: 0 0 9px #f6cc74;
  animation: stage-beacon 4.2s ease-in-out var(--node-delay) infinite;
}

.agent-network figcaption {
  position: absolute; bottom: -23px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-family: var(--font-mono, monospace); font-size: .625rem;
  letter-spacing: 1.7px; color: #dfc891; text-shadow: 0 1px 5px #000;
}
[dir="rtl"] .agent-network figcaption { letter-spacing: 0; }
.agent-network figcaption > span { padding: 0 7px; color: #a98a52; }

.motion-toggle {
  position: absolute; inset-inline-end: 14px; top: 12px; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  color: #bba77c; font-size: .6875rem; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 4px; background: #11110d70; cursor: pointer;
}
.motion-toggle:hover { color: #f0dca8; border-color: #b18b4666; background: #2a2418; }
.motion-toggle:disabled { cursor: default; opacity: .8; }
.motion-symbol {
  width: 8px; height: 9px;
  border-inline-start: 2px solid currentColor; border-inline-end: 2px solid currentColor;
}
.motion-toggle[aria-pressed="true"] .motion-symbol {
  border: 0; border-inline-start: 7px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  width: 0; height: 0;
}
[dir="rtl"] .motion-toggle[aria-pressed="true"] .motion-symbol { rotate: 180deg; }

/* ---- metrics ------------------------------------------------------------ */
.home-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--glass-edge); border-radius: var(--radius-lg, 12px);
  background: var(--card-bg); margin-bottom: 26px; overflow: hidden;
  backdrop-filter: blur(8px) saturate(130%); -webkit-backdrop-filter: blur(8px) saturate(130%);
  box-shadow: inset 0 1px 0 var(--glass-top);
}
.home-metric {
  padding: 19px 22px; border-inline-end: 1px solid var(--glass-edge); transition: background .25s;
}
.home-metric:last-child { border-inline-end: 0; }
.home-metric:hover { background: #e3bf7507; }
.home-metric > span {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: .75rem; color: var(--text-muted);
}
.home-metric > span .icon { color: var(--text-muted); opacity: .8; }
.home-metric strong {
  display: flex; align-items: baseline; gap: 12px; font-size: 2rem; font-weight: 500;
  letter-spacing: -1px; margin: 9px 0 3px;
  font-variant-numeric: tabular-nums; color: var(--accent-text);
}
.home-metric em {
  font-style: normal; letter-spacing: 0; color: var(--text-muted);
  font-size: .75rem; font-weight: 400; max-width: 90px; line-height: 1.5;
}
.home-metric small { font-size: .75rem; color: var(--text-muted); }
.home-metric strong.is-risk { color: var(--sev-high-solid); }

/* ---- two-column body ---------------------------------------------------- */
.workspace-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start;
}
.primary-column, .secondary-column {
  min-width: 0; display: flex; flex-direction: column; gap: 24px;
}

.agent-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.agent-row + .agent-row { border-top: 1px solid var(--glass-edge); }
.agent-icon {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--glass-edge); border-radius: 9px;
  background: var(--card-bg); color: var(--accent-text);
  transition: transform .25s, box-shadow .25s;
}
.agent-row:hover .agent-icon { transform: translateY(-2px); box-shadow: 0 3px 13px #0003; }
.agent-row strong { display: block; font-size: .8125rem; font-weight: 600; }
.agent-row small { display: block; color: var(--text-muted); font-size: .75rem; margin-top: 2px; }

.safety-callout {
  display: flex; gap: 14px; padding: 18px 20px;
  border: 1px solid var(--glass-edge); border-radius: var(--radius-lg, 12px);
  background: var(--card-bg);
  backdrop-filter: blur(8px) saturate(130%); -webkit-backdrop-filter: blur(8px) saturate(130%);
  box-shadow: inset 0 1px 0 var(--glass-top);
}
.safety-callout > .icon { flex-shrink: 0; color: var(--accent-text); margin-top: 2px; }
.safety-callout h3 { margin: 0 0 6px; font-size: .9375rem; }
.safety-callout p { margin: 0 0 10px; color: var(--text-muted); font-size: .8125rem; line-height: 1.6; }

/* ---- motion ------------------------------------------------------------- */
@keyframes stage-flow { to { stroke-dashoffset: -166; } }
@keyframes stage-orbit { to { transform: rotate(360deg); } }
@keyframes stage-drift { to { transform: translate(-55px, 35px) scale(1.22); } }
@keyframes stage-scan { 0%, 20% { transform: translateX(-100%); } 80%, 100% { transform: translateX(100%); } }
@keyframes stage-star { 0%, 100% { opacity: .2; } 50% { opacity: .75; } }
@keyframes stage-dust {
  0% { translate: 0 35px; opacity: 0; }
  20% { opacity: .6; }
  80% { opacity: .4; }
  100% { translate: -28px -80px; opacity: 0; }
}
@keyframes stage-echo {
  0% { transform: scale(1); opacity: 0; }
  15% { opacity: .45; }
  100% { transform: scale(2.65); opacity: 0; }
}
@keyframes stage-node-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes stage-beacon { 0%, 100% { opacity: .25; scale: .8; } 50% { opacity: 1; scale: 1.3; } }
@keyframes stage-logo-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
@keyframes stage-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

.home-view .workspace-stage,
.home-view .primary-column,
.home-view .secondary-column { animation: stage-enter .6s ease-out both; }
.home-view .primary-column { animation-delay: .08s; }
.home-view .secondary-column { animation-delay: .16s; }

/* The pause control stops decorative motion without unmounting anything. */
html[data-stage-motion="paused"] .workspace-stage *,
html[data-stage-motion="paused"] .workspace-stage *::before,
html[data-stage-motion="paused"] .workspace-stage *::after { animation-play-state: paused !important; }
html[data-stage-motion="paused"] .workspace-stage,
html[data-stage-motion="paused"] .primary-column,
html[data-stage-motion="paused"] .secondary-column { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .workspace-stage, .workspace-stage *, .workspace-stage *::before, .workspace-stage *::after,
  .home-view .primary-column, .home-view .secondary-column {
    animation: none !important; transition: none !important;
  }
  .network-echoes { display: none; }
  .stage-particles { opacity: .3; }
  .agent-row:hover .agent-icon { transform: none; }
}

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 1250px) {
  .workspace-stage { grid-template-columns: minmax(0, 1fr) minmax(310px, .95fr); }
  .stage-copy { padding: 33px 0 32px; padding-inline-start: 25px; }
  .stage-copy h1 { font-size: 2.2rem; }
  .stage-copy > p { font-size: .94rem; }
  .stage-context { gap: 8px; font-size: .6875rem; }
  .network-node { padding: 7px 9px; gap: 5px; font-size: .6875rem; }
  .network-node .icon { width: 14px; height: 14px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 1050px) {
  .workspace-stage {
    grid-template-columns: 1fr; min-height: 0; background-position: 65% center;
    background-image:
      linear-gradient(180deg, rgba(4, 5, 5, .88) 0%, rgba(4, 5, 5, .72) 42%, rgba(4, 5, 5, .3) 100%),
      url("assets/stage-city.webp");
  }
  [dir="rtl"] .workspace-stage {
    background-image:
      linear-gradient(180deg, rgba(4, 5, 5, .88) 0%, rgba(4, 5, 5, .72) 42%, rgba(4, 5, 5, .3) 100%),
      url("assets/stage-city.webp");
  }
  .stage-copy { padding: 34px 30px 0; }
  .stage-copy > p { max-width: 100%; }
  .stage-copy > p br { display: none; }
  .agent-network { width: 85%; max-width: 400px; margin: 8px auto 37px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-metric:nth-child(2) { border-inline-end: 0; }
  .home-metric:nth-child(-n+2) { border-bottom: 1px solid var(--glass-edge); }
}
@media (max-width: 720px) {
  .workspace-stage { border-radius: 12px; margin-bottom: 20px; }
  .stage-copy { padding: 46px 20px 0; }
  .stage-copy h1 { font-size: 2.1rem; letter-spacing: -1.3px; }
  .stage-copy > p { font-size: .94rem; margin-top: 13px; }
  .stage-actions { margin-top: 21px; }
  .stage-actions .btn { min-height: 44px; }
  .stage-context { line-height: 1.5; gap: 8px; margin-top: 18px; }
  .context-divider { display: none; }
  .agent-network { width: calc(100% - 20px); margin: 8px auto 36px; }
  .network-node { font-size: .625rem; padding: 6px 8px; gap: 4px; }
  .network-node .icon { width: 12px; height: 12px; }
  .agent-network figcaption { bottom: -18px; font-size: .5625rem; letter-spacing: 1.2px; }
  .stage-particles i:nth-child(even) { display: none; }
  .node-beacon { width: 4px; height: 4px; }
  .network-aura { width: 75%; }
  .stage-grid { background-size: 24px 24px; }
  .home-metrics { grid-template-columns: 1fr; }
  .home-metric { border-inline-end: 0; border-bottom: 1px solid var(--glass-edge); }
  .home-metric:last-child { border-bottom: 0; }
  .home-metric strong { font-size: 1.75rem; }
}
@media (max-width: 370px) {
  .stage-copy { padding-inline: 16px; }
  .stage-copy h1 { font-size: 1.85rem; }
  .network-node { padding: 5px 6px; font-size: .5625rem; gap: 3px; }
  .network-node .icon { width: 11px; height: 11px; }
}

/* The city artwork has bright gold sparks scattered through it — about 3% of
   the pixels behind the copy are far brighter than the surrounding dark. The
   scrim alone leaves text crossing a spark below AA locally, so the copy gets
   the same shadow treatment the diagram caption already uses. Cheaper than
   darkening the scrim, and it keeps the artwork visible. */
.stage-copy h1,
.stage-copy > p,
.stage-eyebrow,
.stage-context {
  text-shadow: 0 1px 6px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .7);
}

/* The topbar is sticky and wraps to ~133px at narrow widths, so an in-page jump
   to one of these targets would land its heading underneath it. */
.home-view #runs,
.home-view #demo-reports,
.home-view #team,
.home-view #scope { scroll-margin-top: 150px; }

/* ===========================================================================
   SHELL — fixed sidebar + app body
   Ported from the Aii-Main-Page design. The sidebar carries the brand, the
   primary nav and the live engine status; the topbar is reduced to "where you
   are" plus the language and theme controls.

   Laid out with grid rather than the design's `position: fixed` + margin-left,
   so RTL mirrors with no second set of rules and the main column can never be
   overlapped. Collapses to a full-width strip with a scrolling nav at 720px.
   =========================================================================== */

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w, 236px) minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ---- the sidebar -------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px 16px;
  border-inline-end: 1px solid var(--glass-edge);
  background: var(--panel-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: inset 0 1px 0 var(--glass-top);
  scrollbar-width: thin;
}

/* Brand stacks here: the product name is long, and a 236px column has no room
   to put it beside a logo without shrinking one of them past legibility. */
.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px 0;
  border: 0;
  background: none;
}
.sidebar .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(227, 191, 117, .12);
}
.sidebar .brand-name { font-size: 14px; line-height: 1.25; }
.sidebar .brand-lab { margin-top: 3px; }
.sidebar .brand:hover .brand-name { color: var(--accent-text); }

.sidebar-section { display: flex; flex-direction: column; gap: 8px; }

.nav-label {
  margin: 0;
  padding-inline: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14rem;
  text-transform: uppercase;
  color: var(--text-subtle);
}
[dir="rtl"] .nav-label { letter-spacing: 0; }

.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-inline-start: 0;
}
.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  font-family: var(--font);
  font-size: 13px;
  border-radius: var(--radius);
  color: var(--text-muted);
  border: 1px solid transparent;
}
.sidebar .nav a .icon { width: 17px; height: 17px; flex: none; }
.sidebar .nav a:hover { background: rgba(227, 191, 117, .07); color: var(--text-strong); }
/* aria-current is set by the router, so the active state can never drift from
   the route the way a hand-maintained class would. */
.sidebar .nav a[aria-current="page"] {
  color: var(--accent-text);
  background: linear-gradient(to right, rgba(227, 191, 117, .14), rgba(227, 191, 117, .04));
  box-shadow: inset 2px 0 0 var(--accent);
}
[dir="rtl"] .sidebar .nav a[aria-current="page"] {
  background: linear-gradient(to left, rgba(227, 191, 117, .14), rgba(227, 191, 117, .04));
  box-shadow: inset -2px 0 0 var(--accent);
}

.sidebar .health { flex-direction: column; align-items: stretch; gap: 5px; }
.sidebar .hbadge { justify-content: flex-start; }
.sidebar .hbadge-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-bottom { margin-top: auto; padding-top: 16px; }
.sidebar-note {
  display: flex;
  gap: 9px;
  padding: 11px 10px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-muted);
}
.sidebar-note > .icon { width: 16px; height: 16px; flex: none; color: var(--accent-text); margin-top: 1px; }
.sidebar-note strong { display: block; font-size: 11.5px; color: var(--text-strong); font-weight: 600; }
.sidebar-note small { display: block; font-size: 10.5px; line-height: 1.5; margin-top: 3px; }

/* ---- topbar, now that the brand and nav have moved out ------------------ */
.topbar-context {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  min-width: 0;
}
.topbar-org { color: var(--text-subtle); }
.topbar-slash { padding-inline: 8px; color: var(--text-subtle); opacity: .6; }
.topbar-section { color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 1250px) { .shell { --sidebar-w: 212px; } }
@media (max-width: 1000px) { .shell { --sidebar-w: 196px; } }

/* Below this the sidebar stops being a column and becomes a header strip: the
   nav turns horizontal and scrolls, and the two text blocks step aside. */
@media (max-width: 720px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    flex-direction: column;
    gap: 12px;
    padding: 14px 14px 0;
    border-inline-end: 0;
    border-bottom: 1px solid var(--glass-edge);
  }
  .app-body { min-height: 0; }
  .sidebar .brand { flex-direction: row; align-items: center; gap: 10px; padding: 0 2px; }
  .sidebar .brand-mark { width: 40px; height: 40px; }
  .sidebar .brand-name { font-size: 13px; }
  .sidebar .nav-label, .sidebar-bottom { display: none; }
  .sidebar .nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
  }
  .sidebar .nav::-webkit-scrollbar { display: none; }
  .sidebar .nav a { flex: none; padding: 8px 11px; }
  .sidebar .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  [dir="rtl"] .sidebar .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar .health { flex-direction: row; flex-wrap: wrap; padding-bottom: 12px; }
}

@media print {
  .sidebar { display: none !important; }
  .shell { display: block; }
}

/* --text-subtle (#71717a) lands at 4.23:1 on the sidebar surface in dark and
   4.47:1 in light — both under the 4.5 floor for text this size. These eyebrows
   take the muted tone instead; the hierarchy still reads, because it is carried
   by the 9.5px uppercase mono scale rather than by colour alone. */
.sidebar .brand-lab,
.nav-label,
.topbar-org { color: var(--text-muted); }

/* Held for one frame while the theme swaps — see applyTheme() in app.js. */
:root[data-theme-switching] *,
:root[data-theme-switching] *::before,
:root[data-theme-switching] *::after {
  transition: none !important;
}
