/* Organization dashboard: four numbers, repositories at or above the risk score (rows open to their problems), trend, risk levels, top five, types, teams,
   saved fixes and the ranked repository table. Plus the repository drawer and the fix review dialog.
   Blues only, like the navigation: darker blue means more serious. No warning reds. */

.page-dashboard {
  --blue-900: #2f3a9e;
  --blue-700: #4f5ac4;
  --blue-500: #5e6ad2;
  --blue-300: #9aa3e6;
  --blue-200: #c3c8f0;
  --blue-100: #e3e6f8;
  --blue-50: #f1f2fc;
  --band-critical: var(--blue-900);
  --band-high: var(--blue-500);
  --band-medium: var(--blue-300);
  --band-low: var(--blue-200);
  --band-clean: var(--blue-50);
  --band-unscanned: #eceef2;
  --sev-hi: var(--blue-500);
  --sev-lo: var(--blue-200);
  --soft-gradient: linear-gradient(135deg, rgba(94, 106, 210, 0.10) 0%, rgba(94, 106, 210, 0.03) 55%, var(--surface) 100%);
}

.dash { width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--s-6) var(--s-5) 120px; }
.dash > #board { display: flex; flex-direction: column; gap: var(--s-4); }

/* ---------- Header ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.dash-eyebrow { font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.dash-title { font-size: var(--fs-28); margin-top: 2px; }
.dash-sub { color: var(--ink-soft); margin-top: 2px; }
.dash-head-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

.sync-bar {
  display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--accent-tint); color: var(--accent-ink);
  font-size: var(--fs-13); font-weight: 600;
}
.sync-bar .spinner { width: 14px; height: 14px; }
.sync-bar.is-done .spinner { display: none; }
.sync-track { flex: 1; max-width: 240px; height: 6px; margin-left: auto; border-radius: 99px; background: var(--surface); overflow: hidden; }
.sync-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease); }
.dash-empty { margin-bottom: var(--s-4); }

/* ---------- Cards and panels ---------- */
.panel { padding: var(--s-4) var(--s-5); }
.panel-head { margin-bottom: var(--s-4); }
.panel-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.panel-title { font-size: var(--fs-17); }
.panel-sub { font-size: var(--fs-13); color: var(--ink-soft); margin-top: 2px; }
.dash-section { margin-top: var(--s-3); }
.dash-grid { display: grid; gap: var(--s-4); }
.dash-grid-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.dash-grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
#board.is-loading { opacity: .55; transition: opacity .2s; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.tile { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 0; }
.tile-label { font-size: var(--fs-12); font-weight: 700; color: var(--ink-soft); }
.tile-value { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: var(--s-1); }
.tile-value small { font-size: var(--fs-17); font-weight: 600; color: var(--ink-soft); letter-spacing: 0; margin-left: 2px; }
.tile { background: var(--soft-gradient); }

/* ---------- Major vulnerabilities ---------- */
.major { background: linear-gradient(180deg, rgba(94, 106, 210, 0.09) 0%, rgba(94, 106, 210, 0.02) 140px, var(--surface) 260px); }
.major-controls { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.threshold {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-3);
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--blue-100);
  font-size: var(--fs-13); font-weight: 600; color: var(--ink-soft);
}
.threshold input[type="range"] { width: 140px; accent-color: var(--blue-500); }
.threshold output { min-width: 30px; text-align: center; padding: 2px 8px; border-radius: var(--r-pill); background: var(--blue-500); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.auto-switch { font-size: var(--fs-13); font-weight: 600; }
.watch-note { margin: calc(-1 * var(--s-2)) 0 var(--s-3); font-size: var(--fs-12); color: var(--blue-700); }
.major-vulns { display: flex; flex-direction: column; }
.major-vuln { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-4); border-top: 1px solid var(--hairline); }
.major-vuln:first-child { border-top: 0; }
.major-vuln .sev { flex: none; min-width: 64px; justify-content: center; }
.major-vuln-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.major-vuln-title { font-weight: 600; font-size: var(--fs-13); display: flex; align-items: center; gap: var(--s-2); }
.major-vuln-where { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Trend ---------- */
.trend { position: relative; }
.trend svg { width: 100%; height: 220px; overflow: visible; }
.trend .grid-line { stroke: var(--hairline); stroke-width: 1; }
.trend .axis-text { fill: var(--ink-soft); font-size: 11px; font-family: var(--font); }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .area { fill: url(#trend-fill); }
.trend .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.trend .end-label { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); }
.trend .cross { stroke: var(--ink-faint); stroke-width: 1; }
.trend .hit { fill: transparent; cursor: crosshair; }
.trend:focus-visible { outline-offset: 4px; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%);
  padding: 6px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: var(--fs-12); white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.tip strong { display: block; font-size: var(--fs-15); }
.tip-key { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--accent-tint-2); }

/* ---------- Bands ---------- */
.bands { display: flex; gap: 2px; height: 36px; border-radius: 10px; overflow: hidden; background: var(--surface); }
.band-seg { position: relative; border: 0; padding: 0; min-width: 6px; transition: filter .15s, transform .15s; }
.band-seg:hover, .band-seg:focus-visible { filter: brightness(1.06) saturate(1.1); }
.band-seg.is-active { box-shadow: inset 0 0 0 2px var(--ink); }
.band-seg span { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-12); font-weight: 700; color: var(--ink); }
.band-seg[data-band="critical"] span, .band-seg[data-band="high"] span { color: #fff; }
[data-band="clean"] { box-shadow: inset 0 0 0 1px var(--blue-100); }
.bands-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-3); }
.bands-legend li { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--fs-13); }
.bands-legend button { border: 0; background: none; padding: 0; display: flex; align-items: baseline; gap: var(--s-2); color: var(--ink); text-align: left; }
.bands-legend button:hover .band-name { text-decoration: underline; text-underline-offset: 3px; }
.band-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; transform: translateY(1px); }
.band-name { font-weight: 700; }
.band-count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
[data-band="critical"] { background: var(--band-critical); }
[data-band="high"] { background: var(--band-high); }
[data-band="medium"] { background: var(--band-medium); }
[data-band="low"] { background: var(--band-low); }
[data-band="clean"] { background: var(--band-clean); }
[data-band="unscanned"] { background: var(--band-unscanned); }

/* ---------- Top five ---------- */
.top { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); }
.top-card {
  display: flex; flex-direction: column; gap: var(--s-2); text-align: left; width: 100%;
  padding: var(--s-3); border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--surface);
  box-shadow: var(--shadow-1); transition: box-shadow .15s, transform .15s, border-color .15s; color: var(--ink);
}
.top-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); border-color: #dcdfe6; }
.top-rank { font-size: var(--fs-12); font-weight: 700; color: var(--ink-soft); }
.top-name { font-weight: 700; overflow-wrap: anywhere; line-height: 1.3; }
.top-team { font-size: var(--fs-12); color: var(--ink-soft); }
.top-score { display: flex; align-items: baseline; gap: var(--s-2); margin-top: auto; }
.top-score strong { font-size: var(--fs-22); line-height: 1; font-variant-numeric: tabular-nums; }
.top-counts { font-size: var(--fs-12); color: var(--ink-soft); }
.top-cta { font-size: var(--fs-13); font-weight: 700; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Severity, band pills ---------- */
.pill-band, .sev {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 700; white-space: nowrap;
}
.pill-band.b-critical, .sev-critical { background: var(--blue-900); color: #fff; }
.pill-band.b-high, .sev-high { background: var(--blue-100); color: var(--blue-900); }
.pill-band.b-medium, .sev-medium { background: var(--surface-soft); color: var(--ink); border: 1px solid var(--hairline); }
.pill-band.b-low, .sev-low { background: var(--surface-soft); color: var(--ink-soft); border: 1px solid var(--hairline); }
.pill-band.b-clean { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }
.pill-band.b-unscanned { background: var(--surface-soft); color: var(--ink-soft); border: 1px dashed var(--hairline); }
.sev-critical::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Types ---------- */
.key { display: flex; gap: var(--s-4); font-size: var(--fs-12); color: var(--ink-soft); }
.key li { display: flex; align-items: center; gap: 6px; }
.key-swatch { width: 10px; height: 10px; border-radius: 3px; }
.sev-hi { background: var(--sev-hi); }
.sev-lo { background: var(--sev-lo); }
.types { display: flex; flex-direction: column; gap: var(--s-2); }
.type-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 48px; gap: var(--s-3); align-items: center; font-size: var(--fs-13); }
.type-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-track { display: flex; gap: 2px; height: 14px; }
.type-seg { height: 100%; border-radius: 0; min-width: 2px; }
.type-seg:first-child { border-radius: 4px 0 0 4px; }
.type-seg:last-child { border-radius: 0 4px 4px 0; }
.type-seg:only-child { border-radius: 4px; }
.type-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.teams, .repos { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.teams th, .repos th { text-align: left; font-size: var(--fs-12); font-weight: 700; color: var(--ink-soft); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.teams td, .repos td { padding: 10px var(--s-3); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.teams tr:last-child td, .repos tr:last-child td { border-bottom: 0; }
.teams th:first-child, .teams td:first-child { padding-left: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.teams .t-name { font-weight: 600; }
.table-wrap { overflow-x: auto; position: relative; }
.repos tbody tr.repo-row { cursor: pointer; transition: background-color .12s; }
.repos tbody tr.repo-row.is-open { background: var(--blue-50); }
.repos td.caret { width: 36px; padding-right: 0; color: var(--ink-faint); }
.repos td.caret .icon { transition: transform .2s var(--ease); }
.repos tr.repo-row:hover td.caret, .repos tr.repo-row.is-open td.caret { color: var(--accent-ink); }
.repos tr.repo-row.is-open td.caret .icon { transform: rotate(90deg); }
.repos tr.repo-row.is-open td { border-bottom-color: transparent; }
.repos tr.detail-row td.detail-cell { padding: 0 var(--s-3) var(--s-3) 48px; background: var(--blue-50); cursor: default; }
.detail { border: 1px solid var(--blue-100); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.detail-actions { display: flex; gap: var(--s-2); justify-content: flex-end; padding: var(--s-2) var(--s-3); border-top: 1px solid var(--hairline); background: var(--blue-50); }
.detail-empty { padding: var(--s-4); color: var(--ink-soft); }
.detail-loading { display: grid; place-items: center; padding: var(--s-4); }
.repos tbody tr.repo-row:hover { background: var(--surface-soft); }
.repos tbody tr.repo-row.is-open:hover { background: var(--blue-50); }
.repos tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.repos .rank { color: var(--ink-soft); width: 48px; }
.repo-name { font-weight: 700; color: var(--ink); }
.repo-meta { font-size: var(--fs-12); color: var(--ink-soft); display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: 1px; }
.repo-meta span + span:not(.repo-src)::before { content: "·"; margin-right: var(--s-2); color: var(--ink-faint); }
.repo-src { padding: 0 6px; border-radius: 6px; background: var(--accent-tint); color: var(--accent-ink); font-weight: 700; }
.risk-cell { display: flex; align-items: center; gap: var(--s-2); min-width: 180px; }
.risk-num { width: 26px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.risk-track { width: 72px; height: 6px; border-radius: 99px; background: var(--surface-soft); border: 1px solid var(--hairline); overflow: hidden; flex: none; }
.risk-fill { display: block; height: 100%; border-radius: 99px; }
.zero { color: var(--ink-faint); }
.c-strong { color: var(--blue-900); font-weight: 700; }
.report-cell { width: 40px; padding-left: 0 !important; padding-right: 0 !important; }
.report-link { color: var(--ink-soft); }
.report-link:hover { color: var(--accent-ink); }
.empty-row td { text-align: center; color: var(--ink-soft); padding: var(--s-6); cursor: default; }

/* ---------- Filters and pager ---------- */
.filters .spacer { flex: 1; }
.filters { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s-3); }
.filters .input, .filters .select { min-height: 40px; }
.filter-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.filter-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.filter-search .input { width: 100%; padding-left: 36px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-3); font-size: var(--fs-13); color: var(--ink-soft); flex-wrap: wrap; }
.pager-btns { display: flex; gap: var(--s-1); align-items: center; }
.pager-btns .is-current { background: var(--accent-tint); color: var(--accent-ink); }

/* ---------- Saved fixes ---------- */
.saved { display: flex; flex-direction: column; }
.saved-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--hairline); }
.saved-row:first-child { border-top: 0; padding-top: 0; }
.saved-main { flex: 1; min-width: 0; }
.saved-title { font-weight: 700; }
.saved-meta { font-size: var(--fs-12); color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---------- Drawer ---------- */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(43, 48, 59, 0.38); }
.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(620px, 100vw); max-width: 100vw;
  padding: 0; border: 0; border-left: 1px solid var(--hairline); background: var(--canvas);
  box-shadow: -24px 0 60px -30px rgba(43, 48, 59, 0.4);
}
.drawer[open] { animation: drawer-in .25s var(--ease) both; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-5); background: var(--surface); border-bottom: 1px solid var(--hairline); }
.drawer-head-text { flex: 1; min-width: 0; }
.drawer-title { font-size: var(--fs-22); overflow-wrap: anywhere; }
.drawer-sub { color: var(--ink-soft); font-size: var(--fs-13); margin-top: var(--s-1); display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-4) var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); }
.drawer-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.drawer-stat { padding: var(--s-3); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--hairline); }
.drawer-stat strong { display: block; font-size: var(--fs-22); line-height: 1.1; font-variant-numeric: tabular-nums; }
.drawer-stat span { font-size: var(--fs-12); color: var(--ink-soft); font-weight: 600; }
.drawer-group { font-size: var(--fs-12); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); margin-top: var(--s-2); }
.vuln { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--hairline); }
.vuln.is-fixed { opacity: .7; }
.vuln-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vuln-top { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.vuln-title { font-weight: 700; }
.vuln-plain { font-size: var(--fs-13); color: var(--ink-soft); }
.vuln-where { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.vuln-state { font-size: var(--fs-12); font-weight: 700; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 4px; }
.vuln .btn { flex: none; }

/* ---------- Fix review ---------- */
.fix {
  width: min(1180px, calc(100vw - 32px)); max-width: none; height: min(860px, calc(100dvh - 32px)); max-height: none;
  padding: 0; border: 0; border-radius: var(--r-md); background: var(--canvas); box-shadow: 0 30px 80px -30px rgba(43, 48, 59, 0.5);
}
.fix[open] { animation: panel-in .22s var(--ease) both; }
.fix-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.fix-head { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5); background: var(--surface); border-bottom: 1px solid var(--hairline); }
.fix-head-text { flex: 1; min-width: 0; }
.fix-where { font-size: var(--fs-13); color: var(--ink-soft); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.fix-where code { font-size: 12px; }
.fix-title { font-size: var(--fs-22); margin-top: 2px; }
.fix-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.fix-explain { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.explain { padding: var(--s-4); border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--surface); }
.explain h3 { font-size: var(--fs-13); text-transform: uppercase; letter-spacing: .05em; margin-bottom: var(--s-1); display: flex; align-items: center; gap: 6px; }
.explain.is-bad h3 { color: var(--ink); }
.explain.is-good h3 { color: var(--accent-ink); }
.explain p { font-size: var(--fs-15); }
.explain .muted { font-size: var(--fs-13); margin-top: var(--s-2); }
.diff2 { border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.diff2-head { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--hairline); background: var(--surface-soft); }
.diff2-head div { padding: var(--s-2) var(--s-4); font-size: var(--fs-12); font-weight: 700; display: flex; align-items: center; gap: var(--s-2); }
.diff2-head div + div { border-left: 1px solid var(--hairline); }
.diff2-head .del-count { color: var(--ink-soft); }
.diff2-head .add-count { color: var(--accent-ink); }
.diff2-body { overflow-x: auto; }
.diff2-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }
.diff2-table td { padding: 0 var(--s-3); vertical-align: top; white-space: pre-wrap; word-break: break-word; }
.diff2-table td.ln { width: 46px; padding: 0 8px; text-align: right; color: var(--ink-faint); user-select: none; white-space: nowrap; }
.diff2-table td.code-new { border-left: 1px solid var(--hairline); }
.diff2-table td.ln-new { border-left: 1px solid var(--hairline); }
.diff2-table .is-old { background: #eef0f4; }
.diff2-table .is-new { background: var(--accent-tint-2); }
.diff2-table .is-blank { background: repeating-linear-gradient(135deg, var(--surface-soft) 0 6px, var(--surface) 6px 12px); }
.diff2-table .mark { display: inline-block; width: 12px; font-weight: 700; }
.diff2-table .is-old .mark { color: var(--ink-soft); }
.diff2-table .is-new .mark { color: var(--accent-ink); }
.fix-foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-5); background: var(--surface); border-top: 1px solid var(--hairline); flex-wrap: wrap; }
.fix-foot-note { flex: 1 1 280px; font-size: var(--fs-13); color: var(--ink-soft); }
.fix-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-3); min-height: 320px; color: var(--ink-soft); text-align: center; }
.fix-loading .spinner { width: 28px; height: 28px; border-width: 2.5px; }
.fix-done { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s-3); min-height: 360px; }
.fix-done .icon-tile { width: 56px; height: 56px; }
.fix-done .icon-tile .icon { width: 26px; height: 26px; }
.fix-done h3 { font-size: var(--fs-22); }
.fix-done p { color: var(--ink-soft); max-width: 520px; }
.score-move { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-28); font-weight: 700; font-variant-numeric: tabular-nums; }
.score-move .from { color: var(--ink-faint); text-decoration: line-through; }
.fix-error { padding: var(--s-4); border-radius: var(--r-md); background: var(--blue-50); border: 1px solid var(--blue-100); color: var(--ink); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top-card:nth-child(n+4) { display: none; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid-5-7, .dash-grid-7-5 { grid-template-columns: minmax(0, 1fr); }
  .fix-explain { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash { padding: var(--s-5) var(--s-4) 120px; }
  .top { grid-template-columns: minmax(0, 1fr); }
  .top-card:nth-child(n+4) { display: flex; }
  .hide-sm { display: none; }
  .tile-value { font-size: 26px; }
  .type-row { grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) 40px; }
  .drawer-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-head-actions { width: 100%; }
}

/* ---------- Owner picker ---------- */
.owner-pick { position: relative; }
.owner-btn { max-width: 340px; }
.owner-btn #owner-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-btn.is-set { background: var(--blue-50); border-color: var(--blue-100); color: var(--accent-ink); }
.owner-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: 0 1px 2px rgba(43, 48, 59, .04), 0 16px 40px -18px rgba(43, 48, 59, .25); overflow: hidden;
}
.owner-menu-head { padding: var(--s-2); border-bottom: 1px solid var(--hairline); }
.owner-menu-head .input { width: 100%; min-height: 36px; }
.owner-all, .owner-row { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); cursor: pointer; font-size: var(--fs-13); }
.owner-all { border-bottom: 1px solid var(--hairline); font-weight: 700; color: var(--ink-soft); }
.owner-all input, .owner-row input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); flex: none; }
.owner-row:hover { background: var(--blue-50); }
.owner-list { max-height: 260px; overflow-y: auto; padding: var(--s-1) 0; }
.owner-name { flex: 1; min-width: 0; font-weight: 600; display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; }
.owner-sub { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.owner-you { padding: 0 6px; border-radius: 6px; background: var(--blue-100); color: var(--blue-900); font-size: 10px; font-weight: 700; }
.owner-count { margin-left: auto; font-size: var(--fs-12); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.owner-empty { padding: var(--s-3); color: var(--ink-soft); font-size: var(--fs-13); }
.owner-menu-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-top: 1px solid var(--hairline); background: var(--blue-50); }
.owner-picked { font-size: var(--fs-12); font-weight: 600; color: var(--accent-ink); }
@media (max-width: 640px) { .owner-menu { left: 0; right: auto; } }

/* ---------- Proof the fix is safe ---------- */
.proof { border: 1px solid var(--blue-100); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.proof-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: linear-gradient(90deg, var(--blue-50), var(--surface)); border-bottom: 1px solid var(--blue-100); }
.proof-head h3 { font-size: var(--fs-15); }
.proof-verdict { padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 700; }
.proof-verdict.is-good { background: var(--blue-500); color: #fff; }
.proof-verdict.is-partial, .proof-verdict.is-running { background: var(--blue-100); color: var(--blue-900); }
.proof-verdict.is-bad { background: var(--ink); color: #fff; }
.proof-list { display: flex; flex-direction: column; }
.proof-check { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--hairline); }
.proof-check:first-child { border-top: 0; }
.proof-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-soft); color: var(--ink-soft); }
.proof-icon .spinner { width: 12px; height: 12px; border-width: 1.5px; }
.proof-check.is-pass .proof-icon { background: var(--blue-500); color: #fff; }
.proof-check.is-fail .proof-icon { background: var(--ink); color: #fff; }
.proof-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.proof-label { font-weight: 700; font-size: var(--fs-13); }
.proof-check.is-fail .proof-label { text-decoration: underline; text-decoration-color: var(--ink-faint); }
.proof-detail { font-size: var(--fs-13); color: var(--ink-soft); }
.proof-runs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-1); }
.proof-run { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--blue-50); font-size: var(--fs-12); min-width: 0; }
.proof-run-title { font-weight: 700; }
.proof-tests li { color: var(--ink-soft); }
.proof-tests li.is-fail { color: var(--ink); font-weight: 700; }
.proof-output summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; margin-top: 4px; }
.proof-output pre { max-height: 180px; overflow: auto; white-space: pre-wrap; font-size: 11px; margin: 4px 0 0; padding: var(--s-2); background: var(--surface); border-radius: 6px; }
.proof-note { padding: 0 var(--s-4) var(--s-2); font-size: var(--fs-12); color: var(--ink-faint); }
.proof-note:empty { display: none; }
@media (max-width: 640px) { .proof-runs { grid-template-columns: 1fr; } }

/* Fix screen: sections keep their full height and the body scrolls. */
.fix-body > * { flex-shrink: 0; }
.diff2-file { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--hairline); font-size: var(--fs-12); color: var(--ink-soft); }
.diff2-file code { font-size: 12px; color: var(--ink); }
.diff2-head div { flex-wrap: wrap; }
.diff2-range { font-weight: 500; color: var(--ink-soft); font-family: var(--mono); }
.diff2-table mark.word { padding: 0 1px; border-radius: 3px; color: inherit; }
.diff2-table .is-old mark.word { background: rgba(43, 48, 59, 0.16); text-decoration: line-through; text-decoration-color: rgba(43, 48, 59, 0.45); }
.diff2-table .is-new mark.word { background: rgba(94, 106, 210, 0.32); }
.diff2-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--hairline); font-size: var(--fs-12); color: var(--ink-soft); }
.diff2-legend .lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.diff2-legend .lg-old::before { background: #eef0f4; border: 1px solid var(--hairline); }
.diff2-legend .lg-new::before { background: var(--accent-tint-2); }
.diff2-legend .lg-word::before { background: rgba(94, 106, 210, 0.32); }
.proof-status { margin-left: var(--s-2); font-size: var(--fs-12); font-weight: 600; color: var(--ink-soft); }
.proof-check.is-pass .proof-status { color: var(--accent-ink); }
.proof-method { margin-top: 4px; font-size: var(--fs-12); color: var(--ink-soft); }
.proof-method strong { color: var(--ink); }
.proof-evidence { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.proof-evidence li { font-family: var(--mono); font-size: 11.5px; color: var(--ink); padding: 3px 8px; background: var(--blue-50); border-radius: 6px; overflow-wrap: anywhere; }
.proof-table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: var(--fs-12); }
.proof-table th, .proof-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--hairline); }
.proof-table th { color: var(--ink-soft); }
.proof-table td.is-pass { color: var(--accent-ink); font-weight: 700; }
.proof-table td.is-fail { color: var(--ink); font-weight: 700; }

/* ---------- Fix all (one per repository row) and project brief ---------- */
.fix-all-cell { width: 1%; white-space: nowrap; text-align: right; }
.fix-all { gap: 6px; }
.brief { display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-3) 0; padding: var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--blue-100); background: var(--soft-gradient); }
.brief-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.brief-head strong { font-size: var(--fs-13); }
.brief-hint { font-size: var(--fs-12); color: var(--ink-soft); }
.brief textarea { width: 100%; min-height: 84px; resize: vertical; font: inherit; font-size: var(--fs-13); }
.brief-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.brief-saved { font-size: var(--fs-12); color: var(--ink-soft); }

/* ---------- Learn from this fix (fix review dialog) ---------- */
.learn-box { margin-top: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--surface-soft); }
.learn-box h3 { display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); margin-bottom: var(--s-2); }
.learn-remember { padding-left: 18px; list-style: disc; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); margin-bottom: var(--s-3); }
.learn-links { display: flex; flex-direction: column; gap: 6px; }
.learn-res { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13); text-decoration: none; }
.learn-res-kind { flex: none; font-size: var(--fs-12); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--blue-100); color: var(--ink); }
.learn-res-title { font-weight: 600; }
.learn-res-src { color: var(--ink-soft); }
.learn-res:hover .learn-res-title { text-decoration: underline; }

/* Project brief: summary, form and attached files */
.brief-head { align-items: center; }
.brief-head > div { min-width: 0; }
.brief-text { font-size: var(--fs-13); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.brief-files { display: flex; flex-wrap: wrap; gap: 6px; }
.brief-file { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--surface); font-size: var(--fs-12); max-width: 100%; }
.brief-file .faint { margin-left: 2px; }
.brief-file-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-soft); cursor: pointer; }
.brief-file-x:hover { background: var(--accent-tint); color: var(--ink); }
.brief-actions .spacer { flex: 1; }
.brief textarea { min-height: 110px; }
.detail > .brief:first-child, .drawer-body > .brief:first-child { margin-top: 0; }
.brief-md { min-height: 260px; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, monospace); font-size: var(--fs-12); line-height: 1.5; }
/* A brief that exists folds into one line, so the problems stay in view */
.brief.is-compact { padding: var(--s-2) var(--s-3); gap: 0; }
.brief-line { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.brief-line > .icon { flex: none; color: var(--accent-ink); }
.brief-line strong { flex: none; font-size: var(--fs-13); }
.brief-peek { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-12); color: var(--ink-soft);
  margin-left: 4px; }
.brief-tools { display: flex; align-items: center; gap: 2px; flex: none; }
@media (max-width: 640px) { .brief-peek { display: none; } .brief-head { flex-wrap: wrap; } }
.detail-cell .brief { position: sticky; left: 0; max-width: min(100%, calc(100vw - 140px)); box-sizing: border-box; }
/* A repository whose problems already have a pull request */
.pr-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap;
  font-size: var(--fs-12); font-weight: 600; color: var(--accent-ink); background: var(--accent-tint); }
.fix-all-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pr-note { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
/* Problems a push just flagged */
.flagged { margin: 0 0 var(--s-5); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--alert-tint-2); box-shadow: inset 4px 0 0 var(--alert); }
.flagged-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.flagged-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--alert); box-shadow: 0 0 0 4px var(--alert-tint); }
.flagged-head .spacer { flex: 1; }
.flagged-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.flagged-row { display: flex; align-items: center; gap: var(--s-3); }
.flagged-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flagged-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-badge { padding: 1px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; color: #fff; background: var(--alert); }
@media (max-width: 560px) { .flagged-row { flex-wrap: wrap; } .flagged-text .small { white-space: normal; } }

/* The agent's "may not be exploitable" note: a person decides */
.vuln-review { display: flex; align-items: flex-start; gap: var(--s-2); margin-top: 6px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--blue-50); border: 1px solid var(--blue-100); font-size: var(--fs-12); color: var(--ink-soft); }
.vuln-review span { flex: 1; }
.vuln-review strong { color: var(--ink); }
.vuln-note { font-size: var(--fs-12); color: var(--ink-soft); }
