/* AI SAST Assist dashboard: design tokens, light/dark themes, components. No inline styles (strict CSP). */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --surface-3: #e6e9ef;
  --fg: #1b2230;
  --fg-muted: #5b6577;
  --fg-faint: #8b94a6;
  --line: #dde2ea;
  --line-strong: #c5ccd8;
  --accent: #1f5fbf;
  --accent-fg: #ffffff;
  --accent-soft: #e3ecfa;
  --focus: #2b7de9;

  --critical: #a61b1b;
  --high: #c2410c;
  --medium: #b7791f;
  --low: #2563eb;
  --info: #6b7280;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;

  --critical-soft: #fbe4e4;
  --high-soft: #fde8dc;
  --medium-soft: #fbefd6;
  --low-soft: #e0eaff;
  --info-soft: #eceef2;
  --ok-soft: #dcf5e4;
  --warn-soft: #fcefd9;
  --danger-soft: #fde2e2;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --sidenav-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1217;
    --surface: #171b22;
    --surface-2: #1d222b;
    --surface-3: #262c37;
    --fg: #e6e9ef;
    --fg-muted: #a0a9ba;
    --fg-faint: #6f788a;
    --line: #2a303c;
    --line-strong: #3a4250;
    --accent: #5b96f0;
    --accent-fg: #0b1220;
    --accent-soft: #1b2b45;
    --focus: #7fb2ff;
    --critical: #f08383;
    --high: #f6a06c;
    --medium: #e9bd5f;
    --low: #8db4ff;
    --info: #aab2c2;
    --ok: #6fd39a;
    --warn: #e8b35a;
    --danger: #f08383;
    --critical-soft: #3a1c1c;
    --high-soft: #3a2518;
    --medium-soft: #3a2f14;
    --low-soft: #1b2a45;
    --info-soft: #262c37;
    --ok-soft: #163322;
    --warn-soft: #3a2a12;
    --danger-soft: #3a1c1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1217;
  --surface: #171b22;
  --surface-2: #1d222b;
  --surface-3: #262c37;
  --fg: #e6e9ef;
  --fg-muted: #a0a9ba;
  --fg-faint: #6f788a;
  --line: #2a303c;
  --line-strong: #3a4250;
  --accent: #5b96f0;
  --accent-fg: #0b1220;
  --accent-soft: #1b2b45;
  --focus: #7fb2ff;
  --critical: #f08383;
  --high: #f6a06c;
  --medium: #e9bd5f;
  --low: #8db4ff;
  --info: #aab2c2;
  --ok: #6fd39a;
  --warn: #e8b35a;
  --danger: #f08383;
  --critical-soft: #3a1c1c;
  --high-soft: #3a2518;
  --medium-soft: #3a2f14;
  --low-soft: #1b2a45;
  --info-soft: #262c37;
  --ok-soft: #163322;
  --warn-soft: #3a2a12;
  --danger-soft: #3a1c1c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; font: 14px/1.5 var(--font); color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; } h4 { font-size: 13px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-sm { margin-top: 8px; } .mb-sm { margin-bottom: 8px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 12px; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.plain-list { list-style: none; padding: 0; margin: 0; }

/* ---------- layout ---------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; color: var(--accent); }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-name { color: var(--fg); font-weight: 500; }
.icon-btn { position: relative; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--fg); cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.badge-dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700; }
.nav-toggle { display: none; }
.layout { display: flex; flex: 1; min-height: 0; }
.sidenav { width: var(--sidenav-w); flex: 0 0 auto; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface); }
.sidenav h4 { padding: 12px 10px 4px; font-size: 11px; }
.sidenav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--fg); }
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidenav .nav-icon { width: 18px; text-align: center; color: var(--fg-muted); }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header .subtitle { color: var(--fg-muted); margin-top: 3px; }
.breadcrumbs { font-size: 12.5px; color: var(--fg-muted); margin-bottom: 6px; }
.breadcrumbs a { color: var(--fg-muted); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidenav { position: fixed; top: 54px; bottom: 0; left: 0; z-index: 25; transform: translateX(-100%); transition: transform .15s; box-shadow: var(--shadow-lg); }
  .sidenav.open { transform: none; }
  .main { padding: 16px 14px 60px; }
  .search { display: none; }
  .user-name { display: none; }
}

/* ---------- cards & grids ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 14px; }
.grid > *, .stack > * { min-width: 0; }
.grid > .stack { align-content: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .grid-main, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4, .grid-main { grid-template-columns: minmax(0, 1fr); } }

.stat { padding: 14px 16px; }
.stat .stat-label { font-size: 12px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-value { font-size: 26px; font-weight: 650; margin-top: 2px; line-height: 1.1; }
.stat .stat-sub { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.stat.critical .stat-value { color: var(--critical); }
.stat.high .stat-value { color: var(--high); }
.stat.medium .stat-value { color: var(--medium); }
.stat.low .stat-value { color: var(--low); }
.stat.ok .stat-value { color: var(--ok); }

/* ---------- badges ---------- */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; border: 1px solid transparent; }
.badge-sev-CRITICAL { background: var(--critical-soft); color: var(--critical); }
.badge-sev-HIGH { background: var(--high-soft); color: var(--high); }
.badge-sev-MEDIUM { background: var(--medium-soft); color: var(--medium); }
.badge-sev-LOW { background: var(--low-soft); color: var(--low); }
.badge-sev-INFO, .badge-sev-UNSPECIFIED, .badge-neutral { background: var(--info-soft); color: var(--info); }
.badge-status-NEW { background: var(--low-soft); color: var(--low); }
.badge-status-OPEN, .badge-status-REOPENED { background: var(--high-soft); color: var(--high); }
.badge-status-IN_REVIEW { background: var(--medium-soft); color: var(--medium); }
.badge-status-CONFIRMED { background: var(--critical-soft); color: var(--critical); }
.badge-status-FIXED, .badge-status-RESOLVED { background: var(--ok-soft); color: var(--ok); }
.badge-status-FALSE_POSITIVE, .badge-status-SUPPRESSED, .badge-status-ACCEPTED_RISK { background: var(--info-soft); color: var(--info); }
.badge-status-READY_FOR_REVIEW { background: var(--accent-soft); color: var(--accent); }
.badge-status-FALSE_POSITIVE_REVIEW_REQUIRED { background: var(--warn-soft); color: var(--warn); }
.badge-status-PENDING_VERIFICATION { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.badge-status-DUPLICATE { background: var(--surface-3); color: var(--fg-muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--surface-3); font-size: 11.5px; margin: 0 4px 4px 0; }

/* ---------- buttons & forms ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
.field .hint { font-size: 12px; color: var(--fg-faint); }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--fg);
}
textarea { min-height: 88px; resize: vertical; }
select { appearance: auto; }
.input-sm { padding: 4px 8px; font-size: 12.5px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.form-error { color: var(--danger); font-size: 12.5px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; }
.filters .field { min-width: 140px; }
.filters .field.wide { min-width: 220px; flex: 1; }
.filters-more { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 0 14px 12px; border-bottom: 1px solid var(--border); }
.filters-more .field { min-width: 140px; }
.input-xs { max-width: 80px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.row-link { cursor: pointer; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty td { text-align: center; padding: 28px; color: var(--fg-muted); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--fg-muted); flex-wrap: wrap; }
.pagination { display: flex; gap: 4px; align-items: center; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--fg-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- finding detail ---------- */

.finding-head { display: flex; flex-direction: column; gap: 8px; }
.finding-title { font-size: 20px; }
.finding-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--fg-muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.code-block { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.code-block .code-head { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--fg-muted); background: var(--surface-3); }
.code-block pre { padding: 8px 0; overflow-x: auto; }
/* The model test's prompt and the model's answer, exactly as the server recorded them. */
.test-exchange .test-text { margin: 0; padding: 8px 10px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.code-line { display: grid; grid-template-columns: 52px 1fr; }
.code-line .ln { color: var(--fg-faint); text-align: right; padding-right: 12px; user-select: none; }
.code-line .lc { padding-right: 12px; white-space: pre; }
.code-line.hl { background: var(--high-soft); }
.code-line.hl .ln { color: var(--high); font-weight: 700; }
.role-chip { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 16px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline .when { font-size: 12px; color: var(--fg-faint); }
.comment { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.comment .who { font-weight: 600; font-size: 12.5px; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.section { margin-bottom: 18px; }
.section h3 { margin-bottom: 8px; }
.callout { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.callout-warn { border-color: var(--warn); background: var(--warn-soft); }
.callout-danger { border-color: var(--danger); background: var(--danger-soft); }
.callout-ok { border-color: var(--ok); background: var(--ok-soft); }
/* A group of fields inside a form (the connection part of the one-step model registration). */
.card-inset { padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }

/* ---------- charts ----------
   Severity uses an ordinal one-hue ramp (critical darkest), validated for both surfaces
   (light: #7a1515 #b42318 #e35d4f #f3a397 · dark: #9c2a25 #d4483c #ee7f71 #f7b8b0).
   Trend lines use validated categorical slots (blue / orange / aqua). Every chart is also
   labeled or legended, so identity never depends on color alone. */

:root {
  --viz-sev-1: #7a1515; --viz-sev-2: #b42318; --viz-sev-3: #e35d4f; --viz-sev-4: #f3a397; --viz-sev-5: #9aa3b5;
  --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-sev-1: #9c2a25; --viz-sev-2: #d4483c; --viz-sev-3: #ee7f71; --viz-sev-4: #f7b8b0; --viz-sev-5: #7f8899;
    --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70;
  }
}
:root[data-theme="dark"] {
  --viz-sev-1: #9c2a25; --viz-sev-2: #d4483c; --viz-sev-3: #ee7f71; --viz-sev-4: #f7b8b0; --viz-sev-5: #7f8899;
  --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70;
}

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--fg-muted); }
.chart text.bar-label { fill: #fff; font-weight: 600; font-size: 10.5px; }
.chart text.series-label { font-weight: 600; fill: var(--fg); }
.chart .axis { stroke: var(--line-strong); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .line { fill: none; stroke-width: 2; }
.chart .area { opacity: .12; }
.chart .crosshair { stroke: var(--fg-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .bar:hover, .chart .bar:focus { filter: brightness(1.12); outline: none; }
.chart rect[tabindex]:focus-visible { stroke: var(--focus); stroke-width: 2; }
.c-track { fill: none; stroke: var(--surface-3); }
.c-accent { fill: var(--viz-s1); stroke: var(--viz-s1); }
.c-ok { fill: var(--ok); stroke: var(--ok); }
.sev-1 { fill: var(--viz-sev-1); stroke: var(--viz-sev-1); background: var(--viz-sev-1); }
.sev-2 { fill: var(--viz-sev-2); stroke: var(--viz-sev-2); background: var(--viz-sev-2); }
.sev-3 { fill: var(--viz-sev-3); stroke: var(--viz-sev-3); background: var(--viz-sev-3); }
.sev-4 { fill: var(--viz-sev-4); stroke: var(--viz-sev-4); background: var(--viz-sev-4); }
.sev-5 { fill: var(--viz-sev-5); stroke: var(--viz-sev-5); background: var(--viz-sev-5); }
.s-1 { fill: var(--viz-s1); stroke: var(--viz-s1); background: var(--viz-s1); }
.s-2 { fill: var(--viz-s2); stroke: var(--viz-s2); background: var(--viz-s2); }
.s-3 { fill: var(--viz-s3); stroke: var(--viz-s3); background: var(--viz-s3); }
.chart .sev-3 + text.bar-label, .chart .sev-4 + text.bar-label { fill: #1b2230; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--fg-muted); margin-top: 6px; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.legend .line-swatch { height: 3px; width: 14px; border-radius: 2px; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow-lg); min-width: 90px; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.bars { display: grid; gap: 6px; }
.bars .bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 44px; gap: 8px; align-items: center; font-size: 12.5px; }
.bars .bar-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bars .bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--viz-s1); }
.score-ring { display: flex; align-items: center; gap: 14px; }
.score-ring svg { width: 84px; height: 84px; flex: 0 0 auto; }
.score-ring circle { fill: none; }
.score-ring .ring { transition: stroke-dasharray .4s; }
.score-ring .score-num { font-size: 30px; font-weight: 700; line-height: 1; }

/* ---------- dialogs & toasts ---------- */

.dialog-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5, 10, 20, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.dialog-lg { max-width: 860px; }
.dialog header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog .dialog-body { padding: 16px 18px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: 360px; }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--fg); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13px; }
.toast-error { background: var(--danger); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.login-card .brand { justify-content: center; font-size: 18px; margin-bottom: 18px; }

/* ---------- misc ---------- */

.loading { padding: 40px; text-align: center; color: var(--fg-muted); }
.empty-state { padding: 36px; text-align: center; color: var(--fg-muted); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.notif.unread { background: var(--accent-soft); }
.notif { padding: 10px 8px; border-radius: var(--radius-sm); }
.notif-wrap { position: relative; }
.notif-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 380px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); display: flex; flex-direction: column; max-height: min(70vh, 560px); }
.notif-menu[hidden] { display: none; }
.notif-menu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-menu-list { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.notif-menu-state { padding: 22px 14px; text-align: center; }
.notif-menu-foot { padding: 10px 14px; border-top: 1px solid var(--line); text-align: center; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg); cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover, .notif-item:focus-visible { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item-head { display: flex; align-items: baseline; gap: 6px; }
.notif-title { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.notif-item.unread .notif-title { font-weight: 650; }
.notif-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: transparent; transform: translateY(-1px); }
.notif-item.unread .notif-dot { background: var(--accent); }
.notif-body { margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .notif-menu { position: fixed; top: 58px; left: 8px; right: 8px; width: auto; max-width: none; max-height: calc(100vh - 70px); }
}
.json-view { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; max-height: 420px; overflow: auto; }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.sla-breach { color: var(--danger); font-weight: 600; }
.row-actions { display: flex; gap: 6px; }
/* Many actions per row (AI models): wrap within the cell instead of running past the card. */
.row-actions-wrap { flex-wrap: wrap; justify-content: flex-end; min-width: 180px; max-width: 300px; }
.secret { font-family: var(--mono); word-break: break-all; padding: 8px 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.gate-PASS { color: var(--ok); font-weight: 700; } .gate-WARN { color: var(--warn); font-weight: 700; } .gate-FAIL, .gate-ERROR { color: var(--danger); font-weight: 700; }
.trend-better { color: var(--ok); } .trend-worse { color: var(--danger); } .trend-flat { color: var(--fg-faint); }
.w-100 { width: 100%; }
.checkbox-cell { width: 28px; }
.selected-bar { display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); }

.segmented { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.segmented .seg { flex: 1; padding: 8px 10px; background: transparent; border: 0; color: var(--fg-muted); font: inherit; font-weight: 600; cursor: pointer; }
.segmented .seg[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.mapping-row > input { flex: 2; min-width: 200px; }
.mapping-row > select { flex: 1; }
.perm-list { max-height: 50vh; overflow: auto; }

/* Emphasis for failure rates and counts (models, skills, dependencies). */
.text-danger { color: var(--critical); }
.stack-sm > * + * { margin-top: 4px; }

/* Multi-select lists (project restriction) and busy buttons. */
select.multi { min-height: 120px; }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* Administration > Settings ------------------------------------------------ */
.settings-group { gap: 0.9rem; }
.setting-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) auto; gap: 0.75rem 1rem; align-items: start; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-key { display: flex; flex-direction: column; gap: 0.3rem; word-break: break-all; }
.setting-control { display: flex; flex-direction: column; gap: 0.3rem; }
.setting-control input[type="text"], .setting-control input[type="password"], .setting-control select { max-width: 100%; }
.setting-actions { padding-top: 0.15rem; }
@media (max-width: 760px) { .setting-row { grid-template-columns: 1fr; } }

/* Scan stages: one chip per stage with its duration, the open one highlighted. */
.stage-timeline { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; }
.stage-timeline li { display: inline-flex; align-items: center; gap: 4px; }
.stage-timeline li.done .badge { opacity: 0.85; }

/* Skill choice of a new scan (Start scan dialog) */
.skill-picker { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0; min-width: 0; }
.skill-picker legend { font-weight: 600; padding: 0 4px; }
.skill-picker .filters { padding: 0; }
.skill-picker-list { max-height: 40vh; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.skill-option { align-items: flex-start; padding: 4px 0; border-bottom: 1px solid var(--border); }
.skill-option:last-child { border-bottom: 0; }
.skill-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.diff-view { max-height: 40vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* The organization's identity in the top bar and on its settings page. */
.org-brand { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: 12px; }
.org-brand .org-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: var(--surface, #fff); }
.org-brand .org-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.org-logo-preview { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--border, #ddd); border-radius: 12px; padding: 6px; background: var(--surface, #fff); }
.org-logo-empty { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border, #ccc); border-radius: 12px; color: var(--muted, #777); font-size: 0.85em; }
@media (max-width: 720px) { .org-brand .org-name { display: none; } }
