/* Brokk Observe dashboard — no build step, no external assets. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --sidebar: #efefeb;
  --surface: #fcfcfb;
  --surface-2: #f3f3f0;
  --surface-3: #e9e9e4;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.20);
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #6d6c67;
  --axis: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --accent-contrast: #ffffff;
  --series-1: #2a78d6;
  --spark: #b4b2aa;
  --focus: #2a78d6;
  --good: #0ca30c;
  --good-ink: #006300;
  --danger: #d03b3b;
  --danger-ink: #b42323;
  --danger-wash: rgba(208, 59, 59, 0.08);
  --warn-ink: #8a5a00;
  --sev-critical: #d03b3b;
  --sev-high: #ec835a;
  --sev-medium: #fab219;
  --sev-low: #5598e7;
  --sev-info: #a3a29b;
  --quality-wash: rgba(208, 59, 59, 0.045);
  --diff-del: rgba(208, 59, 59, 0.12);
  --diff-del-ink: #a42020;
  --diff-add: rgba(12, 163, 12, 0.12);
  --diff-add-ink: #0b6a0b;
  --code-bg: #f3f3f0;
  --tok-key: #1c5cab;
  --tok-str: #0b6a0b;
  --tok-num: #a3501a;
  --tok-lit: #7a3fb0;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 1px 1px rgba(11, 11, 11, 0.03);
  --shadow-pop: 0 8px 28px rgba(11, 11, 11, 0.16), 0 1px 3px rgba(11, 11, 11, 0.10);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 228px;
  --topbar-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --sidebar: #121211;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.20);
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9a9890;
    --axis: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --accent-contrast: #ffffff;
    --series-1: #3987e5;
    --spark: #5e5d58;
    --focus: #6da7ec;
    --good-ink: #3cc43c;
    --danger-ink: #f08080;
    --danger-wash: rgba(208, 59, 59, 0.14);
    --warn-ink: #f2c25a;
    --quality-wash: rgba(208, 59, 59, 0.07);
    --diff-del: rgba(230, 103, 103, 0.16);
    --diff-del-ink: #f4a3a3;
    --diff-add: rgba(12, 163, 12, 0.18);
    --diff-add-ink: #8fdc8f;
    --code-bg: #141413;
    --tok-key: #86b6ef;
    --tok-str: #8fdc8f;
    --tok-num: #f0a674;
    --tok-lit: #c4a6f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --sidebar: #121211;
  --surface: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #9a9890;
  --axis: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --accent-contrast: #ffffff;
  --series-1: #3987e5;
  --spark: #5e5d58;
  --focus: #6da7ec;
  --good-ink: #3cc43c;
  --danger-ink: #f08080;
  --danger-wash: rgba(208, 59, 59, 0.14);
  --warn-ink: #f2c25a;
  --quality-wash: rgba(208, 59, 59, 0.07);
  --diff-del: rgba(230, 103, 103, 0.16);
  --diff-del-ink: #f4a3a3;
  --diff-add: rgba(12, 163, 12, 0.18);
  --diff-add-ink: #8fdc8f;
  --code-bg: #141413;
  --tok-key: #86b6ef;
  --tok-str: #8fdc8f;
  --tok-num: #f0a674;
  --tok-lit: #c4a6f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0 0 8px; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-wash); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack.tight { gap: 8px; }
.icon { flex: none; display: inline-block; vertical-align: -3px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--sidebar) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--danger-wash); color: var(--danger-ink); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); }
.sidebar-foot .org { color: var(--text); font-weight: 600; font-size: 13px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 8px; }
.topbar-title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-3); min-width: 0; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.org-chip { font-size: 12px; color: var(--text-2); padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.btn.menu-btn { display: none; }
.view { padding: 20px 24px 48px; width: 100%; max-width: 1680px; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(280px, 84vw);
    transform: translateX(-102%); transition: transform 0.18s ease; box-shadow: var(--shadow-pop);
  }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.drawer-open .backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.35); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 8px; }
  .org-chip, .topbar .logout-btn { display: none; }
  .view { padding: 14px 12px 40px; }
}
@media (max-width: 520px) {
  .topbar-title h1 { font-size: 15px; }
  .crumbs .crumb-parent { display: none; }
}

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary:disabled { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-2); opacity: 0.8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-danger { color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-wash); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon { width: 26px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-3); border-top-color: transparent; animation: spin 0.8s linear infinite; }

.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); gap: 2px; }
.seg button {
  border: 0; background: transparent; height: 26px; padding: 0 10px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
@media (max-width: 420px) { .seg button { padding: 0 7px; } }

.input, .select, .textarea {
  height: 32px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); min-width: 0; font-size: 13px;
}
.select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; background-size: 5px 5px; background-repeat: no-repeat; }
.textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.search { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.search .icon { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 30px; width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-error { color: var(--danger-ink); font-size: 13px; }

.switch {
  position: relative; width: 34px; height: 20px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; flex: none;
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); transition: background 0.15s;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); box-shadow: none; }
.switch[aria-checked="true"]::after { transform: translateX(14px); background: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .search { flex: 1 1 220px; max-width: 340px; }
.filters .select { max-width: 200px; }
@media (max-width: 640px) {
  .filters .search { flex-basis: 100%; max-width: none; }
  .filters .select { flex: 1 1 140px; max-width: none; }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .count { font-size: 11px; color: inherit; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; overflow-wrap: break-word; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 46px; }
.card-head h2, .card-head h3 { font-size: 13.5px; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 6px 0 8px; }
.grid { display: grid; gap: 16px; min-width: 0; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main-rail { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-3, .grid-2, .grid-main-rail { grid-template-columns: minmax(0, 1fr); } }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.callout .icon { margin-top: 1px; color: var(--text-3); }
.callout.info { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout.info .icon { color: var(--accent-ink); }
.callout.warn { background: color-mix(in srgb, var(--sev-medium) 12%, transparent); border-color: color-mix(in srgb, var(--sev-medium) 40%, transparent); }
.callout.warn .icon { color: var(--warn-ink); }
.callout.danger { background: var(--danger-wash); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--text); }
.callout.danger .icon { color: var(--danger-ink); }
.callout strong { color: var(--text); }

/* ------------------------------------------------------------------ states */
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); }
.empty .icon { color: var(--text-3); opacity: 0.6; margin-bottom: 6px; }
.empty-title { color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.empty.compact { padding: 18px 12px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--text-3); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.is-refreshing { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
  line-height: 1; vertical-align: middle;
}
.badge { max-width: 100%; overflow: hidden; }
.sd-badges .badge, .finding-meta .badge, .bug .label-chip { display: inline-block; line-height: 20px; text-overflow: ellipsis; }
.sd-badges .badge .icon, .finding-meta .badge .icon { vertical-align: -2px; margin-right: 4px; }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.badge.accent { background: var(--accent-wash); color: var(--accent-ink); }
.badge.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.badge.bad { background: var(--danger-wash); color: var(--danger-ink); }
.badge.warn { background: color-mix(in srgb, var(--sev-medium) 18%, transparent); color: var(--warn-ink); }
.badge.mono { font-family: var(--mono); font-weight: 500; font-size: 11px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.sev { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--text); background: color-mix(in srgb, var(--sev-c) 16%, transparent); vertical-align: middle; }
.sev-glyph { width: 9px; height: 9px; flex: none; background: var(--sev-c); display: inline-block; }
.sev-critical { --sev-c: var(--sev-critical); }
.sev-high { --sev-c: var(--sev-high); }
.sev-medium { --sev-c: var(--sev-medium); }
.sev-low { --sev-c: var(--sev-low); }
.sev-info { --sev-c: var(--sev-info); }
.sev-none { --sev-c: var(--sev-info); }
.sev-critical .sev-glyph, .sev-glyph.sev-critical { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 10px; height: 10px; }
.sev-high .sev-glyph, .sev-glyph.sev-high { clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.sev-medium .sev-glyph, .sev-glyph.sev-medium { border-radius: 50%; }
.sev-low .sev-glyph, .sev-glyph.sev-low { border-radius: 2px; width: 8px; height: 8px; }
.sev-info .sev-glyph, .sev-glyph.sev-info, .sev-none .sev-glyph { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--sev-c); }
.sev.sev-critical { background: color-mix(in srgb, var(--sev-critical) 20%, transparent); }

.risk { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; font-weight: 600; }
.risk-bar { width: 34px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
.risk-bar > span { display: block; height: 100%; background: var(--sev-c, var(--sev-info)); border-radius: 0 3px 3px 0; }
.risk-num { min-width: 22px; text-align: right; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status .icon { width: 13px; height: 13px; }
.status.ok { color: var(--good-ink); }
.status.failed, .status.denied { color: var(--danger-ink); }
.status.ask, .status.warn { color: var(--warn-ink); }
.status.pending, .status.none { color: var(--text-3); }

.avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--av, #6d6c67); letter-spacing: 0.02em; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 56px; height: 56px; font-size: 20px; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-cell .who { min-width: 0; }
.user-cell .name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-cell .email { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.repo { font-family: var(--mono); font-size: 12.5px; color: var(--text); white-space: nowrap; }
.repo .at { color: var(--text-3); }
.repo .branch { color: var(--text-2); }
.repo-cell { display: flex; flex-direction: column; max-width: 240px; min-width: 0; color: var(--text); }
.repo-cell:hover { text-decoration: none; }
.repo-cell:hover .repo { text-decoration: underline; }
.repo-cell .repo { overflow: hidden; text-overflow: ellipsis; }
.branch-line { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 8px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: relative;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th button.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tbl th button.sort-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.tbl th[aria-sort="ascending"], .tbl th[aria-sort="descending"] { color: var(--text); }
.sort-ind { font-size: 10px; opacity: 0.85; }
.tbl .q { background: var(--quality-wash); }
.tbl tbody tr:hover td.q { background: color-mix(in srgb, var(--surface-2) 70%, var(--danger) 4%); }
.tbl th.group { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.tbl th.group.q { color: var(--danger-ink); }
.tbl .mono { font-size: 12px; }
.tbl-compact td { padding: 7px 12px; }
.tbl .cell-bar { position: relative; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.tbl .cell-bar .bar { height: 3px; border-radius: 0 2px 2px 0; background: var(--series-1); opacity: 0.85; align-self: flex-start; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.pager .row { gap: 6px; }

/* ------------------------------------------------------------------ KPI tiles */
.kpi-group { margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.kpi { position: relative; padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 96px; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.kpi-value .unit { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-sub { font-size: 12px; color: var(--text-3); }
.kpi-spark { position: absolute; right: 10px; top: 12px; width: 76px; height: 26px; }
.kpi.quality { background: linear-gradient(0deg, var(--quality-wash), var(--quality-wash)), var(--surface); }
.kpi-flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--danger-ink); margin-top: 4px; }
a.kpi { color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--border-strong); text-decoration: none; }
.kpi .segbar { margin-top: 8px; }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); border-top: 1px solid var(--border); overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.stat-strip > div { padding: 10px 14px; min-width: 0; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.stat-strip .l { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strip .v { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ charts */
.viz { position: relative; }
.viz svg { display: block; overflow: visible; }
.viz text { font-family: var(--font); }
.viz .tick { fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz .baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
.viz .col { fill: var(--series-1); transition: opacity 0.1s; }
.viz.hovering .col { opacity: 0.4; }
.viz.hovering .col.is-hover { opacity: 1; }
.viz .crosshair { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.viz .hit { fill: transparent; cursor: crosshair; }
.viz svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.mchart-panel + .mchart-panel { margin-top: 14px; }
.mchart-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.mchart-head .total { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.mchart-head .key { width: 10px; height: 10px; border-radius: 2px; background: var(--series-1); display: inline-block; align-self: center; }
.spark-line { fill: none; stroke: var(--spark); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--series-1); opacity: 0.08; }
.spark-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }

.viz-tip {
  position: fixed; z-index: 90; pointer-events: none; min-width: 140px; max-width: 280px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop);
  padding: 8px 10px; font-size: 12px; opacity: 0; transition: opacity 0.08s;
}
.viz-tip.show { opacity: 1; }
.viz-tip .tt-title { color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.viz-tip .tt-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.viz-tip .tt-key { width: 12px; height: 2px; border-radius: 1px; background: var(--series-1); flex: none; }
.viz-tip .tt-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.viz-tip .tt-lab { color: var(--text-2); }

.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: var(--lw, minmax(0, 38%)) minmax(0, 1fr); align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; }
.hbar:hover { background: var(--surface-2); }
.hbar-label { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hbar-label.mono { font-size: 12px; }
.hbar-area { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-fill { height: 10px; background: var(--series-1); border-radius: 0 4px 4px 0; flex: none; min-width: 2px; }
.hbar-val { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
a.hbar { color: inherit; text-decoration: none; }

.meter { position: relative; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--meter-c, var(--series-1)) 18%, transparent); overflow: hidden; min-width: 40px; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--meter-c, var(--series-1)); border-radius: 999px; }
.meter.neutral { background: var(--surface-3); }
.meter.sm { height: 4px; }
.meter.lg { height: 10px; }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter-row .meter { flex: 1 1 auto; }

.segbar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.segbar > span { height: 100%; background: var(--sev-c); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: inherit; min-width: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .main-col { min-width: 0; flex: 1 1 auto; }
.list-item .t { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .t.wrap2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.list-item .side { flex: none; white-space: nowrap; text-align: right; font-size: 12px; color: var(--text-3); }
.list-item .s { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ podium */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.podium .card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.podium a.card { color: inherit; text-decoration: none; }
.podium a.card:hover { border-color: var(--border-strong); }
.podium .p1 { order: 0; }
.rank { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-1 { background: #f3d66b; color: #4a3800; }
.rank-2 { background: #d9dbe0; color: #33363d; }
.rank-3 { background: #e7b98f; color: #4d2c0d; }
.podium-metric { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.podium-metric-label { font-size: 12px; color: var(--text-3); }
.podium-sub { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.podium-sub b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .podium { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .podium .card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 10px 12px; }
  .podium .card > :nth-child(2) { text-align: right; }
  .podium .card > :nth-child(3) { grid-column: 1 / -1; }
  .podium-metric { font-size: 22px; }
}

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; padding: 10px 12px; font-weight: 500; color: var(--text-3); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.page-tabs { margin: -4px 0 16px; }

/* ------------------------------------------------------------------ session detail */
.sd-head { padding: 16px; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.sd-who { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.sd-title .repo { white-space: normal; overflow-wrap: anywhere; font-size: 13.5px; font-weight: 500; }
.sd-who .who-main { min-width: 0; }
.sd-title { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; min-width: 0; }
.sd-title a { color: var(--text); }
.sd-line { font-size: 13px; color: var(--text-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.sd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sd-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sd-badges > a { display: inline-flex; max-width: 100%; min-width: 0; }
.outcomes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.outcomes > section { padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
.outcomes > section:last-child { border-right: 0; }
.outcomes h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.outcome-item { font-size: 13px; padding: 4px 0; min-width: 0; }
.outcome-item + .outcome-item { border-top: 1px dashed var(--border); }
.outcome-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outcome-item .s { font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 2px; }
@media (max-width: 1100px) { .outcomes { grid-template-columns: repeat(2, minmax(0, 1fr)); } .outcomes > section:nth-child(2) { border-right: 0; } .outcomes > section:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }
@media (max-width: 600px) { .outcomes { grid-template-columns: minmax(0, 1fr); } .outcomes > section { border-right: 0; border-bottom: 1px solid var(--border); } .outcomes > section:last-child { border-bottom: 0; } }
.sd-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.sd-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 1180px) { .sd-body { grid-template-columns: minmax(0, 1fr); } .sd-rail { position: static; max-height: none; overflow: visible; } }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* findings panel */
.fgroup + .fgroup { border-top: 1px solid var(--border); }
.fgroup-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.finding { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.fgroup-head + .finding { border-top: 0; }
.finding.is-closed { opacity: 0.62; }
.finding-title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.finding-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--text-3); }
.finding-detail { font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.finding-detail.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.evidence { font-family: var(--mono); font-size: 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow-y: auto; color: var(--text); }
.triage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.link-btn { all: unset; cursor: pointer; color: var(--accent-ink); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* timeline */
.tl-toolbar { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tl-toolbar .row { flex-wrap: wrap; }
.tl-toolbar .search { flex: 1 1 280px; max-width: 420px; }
.tl-count { font-size: 12px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.tl { position: relative; }
.tl-row { position: relative; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sev-c, transparent); }
.tl-head {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; align-items: center;
  grid-template-columns: 62px 132px minmax(0, 1fr) auto 16px; gap: 10px; padding: 7px 14px 7px 14px; min-height: 38px;
}
.tl-head:hover { background: var(--surface-2); }
.tl-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tl-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-kind { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; }
.tl-kind .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.tl-kind .icon { color: var(--text-3); }
.tl-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.tl-sum.code { font-family: var(--mono); font-size: 12px; color: var(--text); }
.tl-meta { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tl-dur { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.tl-chev { color: var(--text-3); transition: transform 0.12s; }
.tl-row.open .tl-chev { transform: rotate(90deg); }
.tl-row.open > .tl-head { background: var(--surface-2); }
.tl-row.k-prompt { background: var(--accent-wash); }
.tl-row.k-prompt .tl-head:hover, .tl-row.k-prompt.open > .tl-head { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tl-row.k-prompt .tl-sum { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; color: var(--text); overflow-wrap: anywhere; }
.tl-row.k-prompt .tl-kind .icon { color: var(--accent-ink); }
.tl-row.k-assistant .tl-sum { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tl-row.k-life .tl-head { min-height: 30px; padding-top: 4px; padding-bottom: 4px; }
.tl-row.k-life .tl-kind, .tl-row.k-life .tl-sum { color: var(--text-3); font-weight: 500; font-size: 12px; }
.tl-row.is-failed .tl-kind .icon { color: var(--danger-ink); }
.tl-row.flash { animation: flash 2.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.tl-body { padding: 4px 16px 16px 86px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tl-body .section-title { margin: 4px 0 4px; }
.tl-more { padding: 12px; text-align: center; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .tl-head { grid-template-columns: 50px minmax(0, 1fr) 14px; grid-template-areas: "time kind chev" "sum sum sum" "meta meta meta"; gap: 4px 8px; padding: 8px 12px; }
  .tl-time { grid-area: time; }
  .tl-kind { grid-area: kind; }
  .tl-sum { grid-area: sum; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .tl-meta { grid-area: meta; justify-content: flex-start; flex-wrap: wrap; }
  .tl-meta:empty { display: none; }
  .tl-chev { grid-area: chev; }
  .tl-dur { min-width: 0; text-align: left; }
  .tl-body { padding: 4px 12px 14px; }
}

.code-block { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 7px; overflow: auto; max-height: 380px; }
.code-block pre { padding: 9px 11px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.code-block.nowrap pre { white-space: pre; overflow-wrap: normal; }
.code-block.short { max-height: 240px; }
mark.hit { background: color-mix(in srgb, var(--sev-medium) 42%, transparent); color: inherit; font-weight: 600; border-radius: 3px; padding: 1px 0; box-shadow: 0 0 0 1px color-mix(in srgb, var(--sev-medium) 85%, transparent); }
.match { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.match-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.match-note .icon { flex: none; margin-top: 2px; color: var(--accent-ink); }
.match-note strong { color: var(--text); }
.code-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.code-label .btn { margin-left: auto; }
.tok-key { color: var(--tok-key); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-lit { color: var(--tok-lit); }
.io-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .io-grid { grid-template-columns: minmax(0, 1fr); } }

.diff { font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--code-bg); border: 1px solid var(--border); border-radius: 7px; overflow: auto; max-height: 460px; }
.diff-file { padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); background: var(--surface-2); display: flex; gap: 8px; align-items: center; position: sticky; top: 0; }
.diff-line { display: grid; grid-template-columns: 20px minmax(0, 1fr); white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 10px 0 0; }
.diff-line .sign { text-align: center; color: var(--text-3); user-select: none; }
.diff-line.del { background: var(--diff-del); color: var(--diff-del-ink); }
.diff-line.add { background: var(--diff-add); color: var(--diff-add-ink); }
.diff-line.del .sign, .diff-line.add .sign { color: inherit; }
.diff-line.ctx { color: var(--text-2); }
.diff-sep { height: 1px; background: var(--border); margin: 4px 0; }
.diff-stats { font-size: 11.5px; }
.diff-stats .a { color: var(--diff-add-ink); }
.diff-stats .d { color: var(--diff-del-ink); }

.finding-inline { border: 1px solid color-mix(in srgb, var(--sev-c) 45%, var(--border)); background: color-mix(in srgb, var(--sev-c) 6%, var(--surface)); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }

/* transcript */
.tx { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.tx-msg { border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; max-width: 920px; min-width: 0; }
.tx-msg.user { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 25%, transparent); align-self: flex-end; }
.tx-msg.assistant { background: var(--surface); }
.tx-msg.system, .tx-msg.other { background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.tx-head { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; flex-wrap: wrap; }
.tx-head .role { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.tx-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.tx-block + .tx-block { margin-top: 6px; }
.tx-tool { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
details.disclose > summary { cursor: pointer; font-size: 12px; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "▸"; font-size: 10px; color: var(--text-3); transition: transform 0.1s; display: inline-block; }
details.disclose[open] > summary::before { transform: rotate(90deg); }
details.disclose > summary:hover { color: var(--text); }
details.disclose > :not(summary) { margin-top: 6px; }

/* findings page */
.sevtiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.sevtile { all: unset; box-sizing: border-box; cursor: pointer; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.sevtile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sev-c); }
.sevtile:hover { border-color: var(--border-strong); }
.sevtile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--sev-c), var(--shadow); }
.sevtile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sevtile .n { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.sevtile .l { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .sevtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 420px) { .sevtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.frow { display: grid; grid-template-columns: 96px minmax(0, 1fr) 220px; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: start; }
.frow:last-child { border-bottom: 0; }
.frow.is-closed { opacity: 0.62; }
.frow-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; text-align: right; }
.frow-side .triage { justify-content: flex-end; }
@media (max-width: 900px) { .frow { grid-template-columns: minmax(0, 1fr); gap: 8px; } .frow-side { align-items: flex-start; text-align: left; } .frow-side .triage { justify-content: flex-start; } }

/* bugs */
.bug { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.bug:last-child { border-bottom: 0; }
.bug-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.bug-title .ref { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.bug-title .t { font-weight: 600; color: var(--text); }
.attr-list { display: flex; flex-direction: column; gap: 8px; }
.attr { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 6px 16px; align-items: start; background: var(--surface); }
.attr .ev { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
@media (max-width: 640px) { .attr { grid-template-columns: minmax(0, 1fr); } }
.label-chip { display: inline-flex; align-items: center; height: 19px; max-width: 100%; overflow: hidden; white-space: nowrap; padding: 0 7px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--border-strong); color: var(--text-2); }
.method { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.legend-box { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 12.5px; color: var(--text-2); }
.big-num { font-size: 32px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }

/* policies */
.policy { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.policy:last-child { border-bottom: 0; }
.policy.off { opacity: 0.6; }
.policy .pat { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.policy .pat code { color: var(--text); background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; overflow-wrap: anywhere; }
.action-deny { background: var(--danger-wash); color: var(--danger-ink); }
.action-ask { background: color-mix(in srgb, var(--sev-medium) 18%, transparent); color: var(--warn-ink); }
.action-warn { background: var(--accent-wash); color: var(--accent-ink); }

/* settings */
.cmd { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--code-bg); }
.cmd pre { flex: 1 1 auto; padding: 8px 11px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.cmd .btn { border-radius: 0; border: 0; border-left: 1px solid var(--border); height: auto; }
.secret { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); flex-wrap: wrap; }
.secret code { font-size: 13px; overflow-wrap: anywhere; flex: 1 1 260px; min-width: 0; font-weight: 600; }
.feature { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.feature:last-child { border-bottom: 0; }
.feature .desc { font-size: 12px; color: var(--text-3); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.steps > li { padding-left: 4px; }
.steps > li::marker { color: var(--text-3); font-weight: 600; }

/* ------------------------------------------------------------------ dialogs & toasts */
dialog.modal { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.4); }
.modal-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.modal-head h2 { font-size: 15px; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; z-index: 100; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; animation: toast-in 0.18s ease; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-wash), transparent 60%), var(--bg); }
.login { width: min(440px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login .brand { padding: 0; }
.login h1 { font-size: 20px; }
.login .lead { color: var(--text-2); font-size: 13.5px; margin: 4px 0 0; }
.login .input { height: 38px; font-size: 14px; }
.login .input.mono { font-family: var(--mono); font-size: 13px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-ink, var(--accent)); font: inherit; cursor: pointer; text-decoration: underline; }
.login .btn { height: 38px; }
.login-help { font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.login-help code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; overflow-wrap: anywhere; }
.login-theme { position: fixed; top: 12px; right: 12px; }

/* Connect page */
.connect-cmd pre { font-size: 14px; padding: 14px 16px; }
.connect-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.connect-step { display: flex; gap: 12px; align-items: flex-start; }
.connect-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.connect-step.done .connect-mark { border-color: transparent; background: var(--accent); color: #fff; }
