/* TechReview — single stylesheet, no build step, no CDN. */

/* Palette taken from the RADAR mark: navy for structure, the mark's orange for
   highlights. Odoo Enterprise density is kept — flat white sheets on a light
   grey desk, 1px greys, 4px corners, compact rows. Light only, by request. */
:root {
  --primary: #2c3e50;
  --primary-dark: #1e2b38;
  --primary-soft: #ecf0f4;
  /* Link/action colour: the mark's orange darkened to ~4.6:1 on white.
     #FF6A00 itself is ~3:1 and unreadable as body text. */
  --accent: #c2530b;
  --accent-soft: #fff1e6;
  --sage: #d3e0dc;

  --bg: #f9f9f9;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f4f4f4;
  --border: #dee2e6;
  --border-strong: #ced4da;

  --text: #212529;
  --text-muted: #6c757d;
  --text-faint: #8f959b;

  --critical: #b02a37;
  --critical-soft: #fbeaec;
  --high: #b5541b;
  --high-soft: #fdf0e6;
  --medium: #8a6d0b;
  --medium-soft: #fbf5e0;
  --low: #2f6d8a;
  --low-soft: #e9f2f6;
  --info: #6c757d;
  --info-soft: #f1f3f5;
  --ok: #1c7c4a;
  --ok-soft: #e6f4ec;

  /* Accent hues used to colour-code the four stat tiles and section heads.
     The orange is the app icon's, so the palette ties back to the mark. */
  --brand-orange: #ff6a00;
  --brand-amber: #ffa02b;
  --hue-1: #2c3e50;
  --hue-2: #c2530b;
  --hue-3: #b5541b;
  --hue-4: #2f6d8a;
  --hue-1-soft: #ecf0f4;
  --hue-2-soft: #fff1e6;
  --hue-3-soft: #fdf0e6;
  --hue-4-soft: #e9f2f6;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -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; letter-spacing: -0.01em; }
h1 { font-size: 19px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius);
  background: var(--primary);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
/* The mark is now artwork, so it carries its own colour and shape. */
img.brand-mark { background: none; border-radius: 0; object-fit: contain; }
.brand-name { font-weight: 650; font-size: 15px; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); padding: 14px 8px 5px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border-radius: var(--radius); color: var(--text-muted);
  font-weight: 500; font-size: 13.5px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-count {
  font-size: 11px; background: var(--border); color: var(--text-muted);
  border-radius: 20px; padding: 1px 7px; font-weight: 600;
}
.nav-item.active .nav-count { background: var(--primary); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.who { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 700;
  flex: 0 0 28px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who-name { font-size: 13px; font-weight: 600; }
.who-role { font-size: 11px; color: var(--text-faint); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.content { padding: 18px 22px 60px; max-width: 1440px; }

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

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Stacked cards need spacing between them… */
.card + .card { margin-top: 14px; }
/* …but a grid already spaces its children with `gap`. Without this reset the
   adjacent-sibling rule above lands on every tile except the first, pushing
   five tiles of six down by 14px and misaligning the whole row. */
.grid > .card + .card { margin-top: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.card-body { padding: 14px; }
.card-body.tight { padding: 0; overflow-x: auto; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1240px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  /* Narrow screens: the sidebar becomes a scrollable strip above the content
     rather than disappearing, so navigation stays reachable on a phone. */
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 6px;
    overflow-x: auto; padding: 8px 12px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 10px 0 0; }
  .brand-sub, .nav-label, .who-role { display: none; }
  .sidebar-foot {
    margin-top: 0; margin-left: auto; padding-top: 0; border-top: none;
    display: flex; align-items: center; gap: 6px;
  }
  .sidebar-foot form { margin: 0; }
  .sidebar-foot .btn { width: auto !important; margin-top: 0 !important; }
  .nav-item { white-space: nowrap; }
  .topbar { position: static; flex-wrap: wrap; }
  .grid.cols-2, .grid.cols-4, .grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; }
}

/* Tiles are a three-row stack — label, value, foot — so the numbers line up
   across a row whatever each tile happens to contain. The foot is pushed to
   the bottom, which keeps a tile with a one-word note level with one carrying
   a row of chips. */
.stat {
  padding: 12px 14px;
  display: flex; flex-direction: column; min-height: 104px; height: 100%;
}
.stat-top { display: flex; align-items: center; gap: 9px; min-height: 34px; }
.stat-icon {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 600; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis;
}
.stat-value {
  font-size: 24px; font-weight: 680; letter-spacing: -0.02em;
  margin-top: 10px; line-height: 1.15;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 30px;
}
/* Tiles whose "value" is a chip or badge rather than a number. */
.stat-value.compact { font-size: 15px; font-weight: 600; }
/* The mark tile: the grade badge reads first, the score sits beside it with a
   bar so a 69 and an 89 are told apart without doing the arithmetic. */
.stat-value.mark { gap: 12px; flex-wrap: nowrap; margin-top: 8px; }
.mark-score { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mark-num { font-size: 20px; font-weight: 680; letter-spacing: -0.02em; }
.mark-out { font-size: 12px; font-weight: 600; color: var(--text-faint); }
.stat-value.mark .meter { width: 96px; }
.stat-foot {
  font-size: 12px; color: var(--text-muted);
  margin-top: auto; padding-top: 6px; min-height: 18px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

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

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 600; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-3);
  white-space: nowrap; padding: 8px 14px;
}
.table td { padding: 8px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .shrink { width: 1%; white-space: nowrap; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-muted); }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ---------- chips & badges ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--info-soft); color: var(--info); border: 1px solid transparent;
  white-space: nowrap;
}
.chip.plain { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); font-weight: 500; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.sev-critical { background: var(--critical-soft); color: var(--critical); }
.sev-high { background: var(--high-soft); color: var(--high); }
.sev-medium { background: var(--medium-soft); color: var(--medium); }
.sev-low { background: var(--low-soft); color: var(--low); }
.sev-info { background: var(--info-soft); color: var(--info); }
.sev-clean { background: var(--ok-soft); color: var(--ok); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.sha {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; color: var(--text-muted);
}

.path { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: flex; flex-wrap: wrap; gap: 5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.col { display: flex; flex-direction: column; gap: 3px; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ---------- risk meter ---------- */

.meter { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; min-width: 64px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.meter.risk-critical > span { background: var(--critical); }
.meter.risk-high > span { background: var(--high); }
.meter.risk-medium > span { background: var(--medium); }
.meter.risk-low > span { background: var(--low); }
.meter.risk-info > span, .meter.risk-clean > span { background: var(--ok); }

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

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--critical); border-color: var(--border-strong); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-faint); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: auto; }

.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }

/* ---------- flashes ---------- */

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--critical-soft); color: var(--critical); }
.flash.warning { background: var(--medium-soft); color: var(--medium); }

/* ---------- activity bars ---------- */

.bars { display: flex; align-items: flex-end; gap: 5px; height: 92px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 5px; }
.bars .bar i {
  display: block; background: var(--primary); border-radius: 4px 4px 2px 2px; min-height: 3px; opacity: 0.85;
}
.bars .bar:hover i { opacity: 1; }
.bars .bar b { font-size: 9.5px; color: var(--text-faint); text-align: center; font-weight: 500; }

/* ---------- finding cards ---------- */

.finding { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.finding + .finding { margin-top: 10px; }
.finding-head { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--surface-2); }
.finding-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.finding-body .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
.finding.resolved { opacity: 0.62; }
.evidence {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  color: var(--text-muted); word-break: break-all;
}

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

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); }
.pager .links { display: flex; gap: 6px; }

.kv { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-word; }

.commit { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.commit:last-child { border-bottom: none; }
.commit-msg { font-weight: 550; }
.commit-body { white-space: pre-wrap; font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }

.filelist { max-height: 620px; overflow-y: auto; }
.filerow { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--border); }
.filerow:last-child { border-bottom: none; }
.ftag { font-size: 10.5px; font-weight: 700; width: 18px; text-align: center; flex: 0 0 18px; }
.ftag.added { color: var(--ok); }
.ftag.modified { color: var(--medium); }
.ftag.removed { color: var(--critical); }

pre.payload {
  margin: 0; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius);
  border: 1px solid var(--border); overflow-x: auto; font-family: var(--mono);
  font-size: 12px; line-height: 1.55; max-height: 640px;
}

.comment { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: none; }
.comment-body { white-space: pre-wrap; margin-top: 5px; }

.secret-box { display: flex; gap: 8px; align-items: center; }
.secret-box input { font-family: var(--mono); font-size: 12.5px; }

/* ---------- production branch ---------- */

/* An indication, not an alarm: the branch chip keeps its normal styling and
   gains a small marker plus a "prod" suffix. */
.chip.branch-production {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 500;
}
.chip.branch-production .dot { width: 6px; height: 6px; color: var(--primary); }
.chip.branch-production .prod-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--primary); text-transform: uppercase;
  border-left: 1px solid var(--border-strong); padding-left: 5px; margin-left: 1px;
}

/* ---------- AI rank badge ---------- */

.rank {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: var(--radius); font-weight: 700; font-size: 12px;
  border: 1px solid transparent;
}
.rank-A { background: var(--ok-soft); color: var(--ok); }
.rank-B { background: var(--low-soft); color: var(--low); }
.rank-C { background: var(--medium-soft); color: var(--medium); }
.rank-D { background: var(--high-soft); color: var(--high); }
.rank-E { background: var(--critical-soft); color: var(--critical); }
.rank-none { background: var(--surface-3); color: var(--text-faint); border-color: var(--border); }
.rank-lg { width: 44px; height: 44px; font-size: 22px; }
a.rank:hover { text-decoration: none; filter: brightness(0.95); }

.ai-summary {
  background: var(--primary-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--radius);
  padding: 12px 14px;
}

/* ---------- code flow timeline ---------- */

.flow-entry { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.flow-entry:last-child { border-bottom: none; }
.flow-entry:hover { background: var(--surface-2); }
.flow-when {
  flex: 0 0 62px; display: flex; flex-direction: column; align-items: flex-end;
  text-align: right; padding-top: 1px; border-right: 1px solid var(--border); padding-right: 10px;
}
.flow-body { flex: 1; min-width: 0; }
.flow-body .mono { color: var(--text); }

/* ---------- token usage ---------- */

.usage {
  display: inline-flex; align-items: center; gap: 9px; flex-wrap: wrap;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.usage-cost {
  font-weight: 700; color: var(--text);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1px 6px;
}

/* ---------- master / detail split on the commits page ---------- */

.commits-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.commits-layout.with-panel { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
/* Below this the two columns cannot both be readable, so the panel stacks. */
@media (max-width: 1240px) { .commits-layout.with-panel { grid-template-columns: minmax(0, 1fr); } }

.panel { position: sticky; top: 74px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.panel .filelist { max-height: 460px; }
.panel .diffwrap { max-height: 380px; overflow: auto; }
tr.row-selected { background: var(--primary-soft) !important; }
tr.row-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

.filelist.bordered { border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- connection indicator ---------- */

.conn { display: inline-flex; flex-direction: column; line-height: 1.25; margin-right: 4px; }
.conn-name { font-size: 12.5px; font-weight: 650; }
.conn-state { font-size: 11.5px; display: inline-flex; align-items: center; gap: 5px; }
.conn-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn-state.on { color: var(--ok); }
.conn-state.off { color: var(--high); }

/* ---------- sidebar repository shortcuts ---------- */

.repolist { display: flex; flex-direction: column; gap: 1px; }
.repo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 9px; border-radius: var(--radius); font-size: 12.5px; color: var(--text-muted);
}
.repo-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.repo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: 0 0 6px; }

/* ---------- settings panes ---------- */

/* Each tab is one column: a pane whose cards all lived in the old right-hand
   column would otherwise render against an empty half-page. */
.settings-pane { max-width: 820px; }
.settings-pane .card + .card { margin-top: 14px; }

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

/* Tabs are links so each one is a real, shareable URL and needs no script. */
.tabs {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.tab {
  padding: 8px 14px; font-size: 13.5px; font-weight: 550;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }
.tab-count {
  font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-muted);
  border-radius: 20px; padding: 0 6px; min-width: 18px; text-align: center;
}
.tab.on .tab-count { background: var(--primary); color: #fff; }
.tabs form { margin-left: auto; }

/* ---------- review state pill ---------- */

.state {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-reviewed { background: var(--ok-soft); color: var(--ok); }
.state-issues { background: var(--high-soft); color: var(--high); }
.state-pending { background: var(--low-soft); color: var(--low); }

/* ---------- AI scoreboard ---------- */

.scoreboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.score {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; background: var(--surface-2);
}
.score b { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.score span { font-size: 11.5px; color: var(--text-muted); }
.score-critical { background: var(--critical-soft); border-color: transparent; }
.score-critical b { color: var(--critical); }
.score-warning { background: var(--high-soft); border-color: transparent; }
.score-warning b { color: var(--high); }
.score-suggest { background: var(--low-soft); border-color: transparent; }
.score-suggest b { color: var(--low); }
.score-rank { background: var(--primary-soft); border-color: transparent; }
.score-rank b { color: var(--primary); }
@media (max-width: 640px) { .scoreboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* A stat card that is also a filter link should not look like body text. */
a.stat:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- provider picker ---------- */

.providers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.provider {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 9px 11px; background: var(--surface);
}
.provider:hover { background: var(--surface-2); }
.provider.on { border-color: var(--primary); background: var(--primary-soft); }
.provider input { width: auto; margin: 0; }
.provider > span { display: flex; flex-direction: column; line-height: 1.35; flex: 1; min-width: 0; }

.providerbox {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px 2px; margin: 0 0 14px;
}
.providerbox legend {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 700; padding: 0 6px;
}
@media (max-width: 640px) { .providers { grid-template-columns: minmax(0, 1fr); } }

/* ---------- per-repository AI scope ---------- */

.scopelist {
  max-height: 300px; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.scoperow {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 52px;
  gap: 8px; align-items: center;
  padding: 6px 10px; border-bottom: 1px solid var(--border);
}
.scoperow:last-child { border-bottom: none; }
.scoperow:hover { background: var(--surface-2); }
.scoperow input[type="text"] { padding: 4px 7px; font-size: 12.5px; }
.scope-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.scope-hint { text-align: right; }
@media (max-width: 640px) {
  .scoperow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .scope-hint { text-align: left; }
}

/* ---------- scrollable checkbox list ---------- */

.checklist {
  max-height: 230px; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface);
}
.checklist .check {
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  gap: 9px; cursor: pointer;
}
.checklist .check:last-child { border-bottom: none; }
.checklist .check:hover { background: var(--surface-2); }
.checklist .check span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- date range filter ---------- */

.periods { display: flex; flex-wrap: wrap; gap: 5px; }
.periods a {
  font-size: 12px; padding: 3px 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text-muted); background: var(--surface);
}
.periods a:hover { background: var(--surface-2); text-decoration: none; }
.periods a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
input[type="date"] { min-width: 140px; }

/* ---------- numbered setup steps ---------- */

ol.steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-muted); }
ol.steps li { margin-bottom: 7px; line-height: 1.55; }
ol.steps li::marker { color: var(--primary); font-weight: 700; }
ol.steps strong { color: var(--text); }

/* ---------- notices ---------- */

.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.notice-warn { border-left-color: var(--high); }
.mt-xs { margin-top: 3px; }

/* ---------- side-by-side diff ---------- */

.difffile { border-bottom: 1px solid var(--border); }
.difffile:last-child { border-bottom: none; }
.difffile > summary {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px;
  cursor: pointer; list-style: none; user-select: none;
}
.difffile > summary::-webkit-details-marker { display: none; }
.difffile > summary::before {
  content: "▸"; color: var(--text-faint); font-size: 11px; flex: 0 0 9px;
}
.difffile[open] > summary::before { content: "▾"; }
.difffile > summary:hover { background: var(--surface-2); }
.difffile > summary .path { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.diffwrap { overflow-x: auto; border-top: 1px solid var(--border); background: var(--surface-2); }

table.diff {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
}
table.diff th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left;
  padding: 5px 10px; font-family: inherit; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint); border-bottom: 1px solid var(--border);
}
table.diff td { padding: 0 8px; vertical-align: top; border: none; }
table.diff .d-no {
  width: 48px; min-width: 48px; text-align: right; color: var(--text-faint);
  user-select: none; font-size: 11px; padding-right: 8px;
  border-right: 1px solid var(--border);
}
table.diff .d-code {
  width: 50%; white-space: pre-wrap; word-break: break-word; color: var(--text);
}
/* Left column is the old file, right column the new one. */
tr.d-change .d-old, tr.d-del .d-old { background: var(--critical-soft); }
tr.d-change .d-new, tr.d-add .d-new { background: var(--ok-soft); }
tr.d-del .d-new, tr.d-add .d-old { background: repeating-linear-gradient(
  45deg, transparent, transparent 6px, var(--border) 6px, var(--border) 7px); opacity: 0.35; }
tr.d-hunk td {
  background: var(--accent-soft); color: var(--accent); padding: 3px 10px;
  font-size: 11px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
tr.d-flagged .d-new { box-shadow: inset 3px 0 0 var(--high); }
tr.d-flagged .d-no { color: var(--high); font-weight: 700; }

@media (max-width: 900px) {
  table.diff .d-code { width: auto; }
  table.diff .d-no { width: 34px; min-width: 34px; }
}

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

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  /* The sign-in page is the one place the brand colour gets to fill the frame. */
  background: linear-gradient(160deg, var(--sage) 0%, var(--bg) 55%);
}
.login-card { width: 100%; max-width: 390px; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-head .brand-mark { width: 46px; height: 46px; font-size: 18px; margin: 0 auto 12px; display: block; }
.login-head h1 { font-size: 20px; }
.login-head p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-foot { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 18px; }


/* ---------- back link ---------- */

/* The way back has to be as easy to find as the way in: a real bordered
   button above the title, not a faint 12px line people scan past. */
.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--primary); background: var(--primary-soft);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 7px 12px; margin-bottom: 8px;
}
.backlink:hover {
  color: #fff; background: var(--primary); border-color: var(--primary);
  text-decoration: none;
}

/* ---------- at-a-glance issue indicator ---------- */

/* A thin severity band on the row: the point of the list is that a reviewer
   spots the commits that need attention without reading a single word. */
tr.sev-row-critical td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
tr.sev-row-high td:first-child { box-shadow: inset 3px 0 0 var(--high); }
tr.sev-row-medium td:first-child { box-shadow: inset 3px 0 0 var(--medium); }
tr.sev-row-low td:first-child { box-shadow: inset 3px 0 0 var(--low); }
tr.sev-row-info td:first-child, tr.sev-row-clean td:first-child { box-shadow: inset 3px 0 0 transparent; }

.issues {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 3px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted); white-space: nowrap;
}
.issues:hover { text-decoration: none; filter: brightness(0.97); }
.issues-count {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px;
  border-radius: 50%; background: var(--surface); font-weight: 700; font-size: 11px;
  border: 1px solid currentColor;
}
.issues-critical { background: var(--critical-soft); color: var(--critical); }
.issues-high { background: var(--high-soft); color: var(--high); }
.issues-medium { background: var(--medium-soft); color: var(--medium); }
.issues-low { background: var(--low-soft); color: var(--low); }
.issues-info { background: var(--info-soft); color: var(--info); }
.issues-clean { background: var(--ok-soft); color: var(--ok); padding: 2px 9px; }

.commit-table td { vertical-align: middle; }

/* ---------- quick-look dialog ---------- */

.quicklook {
  border: none; padding: 0; background: transparent;
  width: min(1040px, 94vw); max-width: 94vw; max-height: 90vh;
}
.quicklook::backdrop { background: rgba(20, 24, 28, 0.45); }
.modal-card {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-content { display: flex; flex-direction: column; min-height: 0; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.modal-body { padding: 14px 16px 18px; overflow-y: auto; min-height: 0; }
.modal-body .diffwrap { max-height: 46vh; overflow: auto; }
.modal-body .filelist { max-height: none; }
.quicklook.is-loading .modal-card::after {
  content: "Loading…"; display: block; padding: 10px 16px;
  font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--border);
}
@media (max-width: 700px) { .quicklook { width: 96vw; max-height: 94vh; } }

/* ---------- code snippet inside a finding ---------- */

/* The offending code, so a reviewer does not have to go and find it. */
.snippet {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto; padding: 4px 0;
}
.snip-line { display: flex; gap: 10px; padding: 0 10px; white-space: pre; }
.snip-no {
  color: var(--text-faint); user-select: none; text-align: right;
  min-width: 40px; flex: 0 0 40px; font-size: 11px;
}
.snip-code { flex: 1; min-width: 0; }
.snip-line.added .snip-code { color: var(--text); }
.snip-line.added { background: rgba(28, 124, 74, 0.06); }
/* The flagged line itself. */
.snip-line.target {
  background: var(--high-soft);
  box-shadow: inset 3px 0 0 var(--high);
  font-weight: 600;
}
.snip-line.target .snip-no { color: var(--high); font-weight: 700; }


/* ---------- colour ---------- */

/* Stat tiles are colour-coded left to right so a row of numbers reads as four
   distinct things rather than one grey block. */
.grid.cols-5 > .stat { border-top: 3px solid var(--border-strong); }
.grid.cols-4 > .stat:nth-child(1) { border-top: 3px solid var(--hue-1); }
.grid.cols-4 > .stat:nth-child(2) { border-top: 3px solid var(--ok); }
.grid.cols-4 > .stat:nth-child(3) { border-top: 3px solid var(--hue-3); }
.grid.cols-4 > .stat:nth-child(4) { border-top: 3px solid var(--hue-4); }
.grid.cols-4 > .stat:nth-child(1) .stat-label { color: var(--hue-1); }
.grid.cols-4 > .stat:nth-child(2) .stat-label { color: var(--ok); }
.grid.cols-4 > .stat:nth-child(3) .stat-label { color: var(--hue-3); }
.grid.cols-4 > .stat:nth-child(4) .stat-label { color: var(--hue-4); }

/* The topbar carries the brand gradient as a hairline. */
.topbar { border-bottom: 1px solid var(--border); box-shadow: inset 0 3px 0 -1px transparent; }
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--brand-orange), var(--brand-amber) 35%, var(--primary) 100%);
  opacity: 0.85;
}
.topbar { position: sticky; }

/* Card headings get a coloured rule, so sections separate at a glance. */
.card-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.card-head h2 { position: relative; padding-left: 10px; }
.card-head h2::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px;
  border-radius: 2px; background: var(--hue-1);
}

/* Sidebar: active item keeps the plum, the brand rule uses the icon colours. */
.sidebar { border-right: 1px solid var(--border); }
.nav-item.active { box-shadow: inset 2px 0 0 var(--primary); }
.repo-item:hover { box-shadow: inset 2px 0 0 var(--hue-2); }

/* Primary button gets a little depth rather than a flat fill. */
.btn.primary {
  background: linear-gradient(180deg, #3a4f66, var(--primary));
  border-color: var(--primary-dark);
}
.btn.primary:hover { background: var(--primary-dark); }

/* Chips and states become a touch more saturated so they carry meaning. */
.chip { border-width: 1px; }
.chip.accent { border-color: rgba(194, 83, 11, 0.25); }
.chip.ok { border-color: rgba(28, 124, 74, 0.25); }
.sev-critical { border-color: rgba(176, 42, 55, 0.28); }
.sev-high { border-color: rgba(181, 84, 27, 0.28); }
.sev-medium { border-color: rgba(138, 109, 11, 0.28); }
.sev-low { border-color: rgba(47, 109, 138, 0.28); }
.state { border-color: currentColor; }

/* The login page uses the icon gradient. */
.login-wrap { background: linear-gradient(155deg, #fff1e3 0%, var(--bg) 48%, #e9eef3 100%); }
.login-head h1 { color: var(--primary); }

/* Tabs: active tab underlined in the brand orange for contrast with the plum. */
.tab.on { border-bottom-color: var(--brand-orange); color: var(--primary); }


/* ---------- bulk action bar ---------- */

.bulkbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.bulkbar input[type="text"] { padding: 4px 8px; font-size: 12.5px; }
.bulk-sep { width: 1px; height: 20px; background: var(--border-strong); }
.check.pick { flex: 0 0 auto; margin-right: 2px; }
.check.pick input { width: auto; margin: 0; }


/* ---------- icons ---------- */

.icon { display: block; flex: 0 0 auto; }
.nav-face { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.nav-face .icon { opacity: 0.75; }
.nav-item.active .nav-face .icon { opacity: 1; }
.nav-item:hover .nav-face .icon { opacity: 1; }

/* ---------- tile tones ---------- */

/* The icon carries the colour, so the number stays black and readable —
   colour is a label here, not decoration. */
.stat.tone-plum  .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat.tone-teal  .stat-icon { background: var(--accent-soft);  color: var(--accent); }
.stat.tone-green .stat-icon { background: var(--ok-soft);      color: var(--ok); }
.stat.tone-amber .stat-icon { background: var(--high-soft);    color: var(--high); }
.stat.tone-red   .stat-icon { background: var(--critical-soft);color: var(--critical); }
.stat.tone-blue  .stat-icon { background: var(--low-soft);     color: var(--low); }
.stat.tone-grey  .stat-icon { background: var(--surface-3);    color: var(--text-muted); }

.stat.tone-plum  { border-top: 3px solid var(--primary); }
.stat.tone-teal  { border-top: 3px solid var(--accent); }
.stat.tone-green { border-top: 3px solid var(--ok); }
.stat.tone-amber { border-top: 3px solid var(--high); }
.stat.tone-red   { border-top: 3px solid var(--critical); }
.stat.tone-blue  { border-top: 3px solid var(--low); }
.stat.tone-grey  { border-top: 3px solid var(--border-strong); }

/* The tone classes replace the old position-based colouring, which painted
   the wrong tile whenever a row had other than four items. */
.grid.cols-4 > .stat:nth-child(1),
.grid.cols-4 > .stat:nth-child(2),
.grid.cols-4 > .stat:nth-child(3),
.grid.cols-4 > .stat:nth-child(4),
.grid.cols-5 > .stat { border-top-color: inherit; }
.grid.cols-4 > .stat:nth-child(1) .stat-label,
.grid.cols-4 > .stat:nth-child(2) .stat-label,
.grid.cols-4 > .stat:nth-child(3) .stat-label,
.grid.cols-4 > .stat:nth-child(4) .stat-label { color: var(--text-faint); }

/* ---------- six across ---------- */

.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1400px) { .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px)  { .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .grid.cols-6 { grid-template-columns: minmax(0, 1fr); } }


/* ---------- dashboard ---------- */

/* Long lists scroll inside their card. Without this a card with twelve rows
   stretches its whole row, and the page grows instead of the list. */
.card-body.scroll { max-height: 340px; overflow-y: auto; }
.card-body.tight.scroll { padding: 0; }

/* Icons in card headings, matching the tiles above them. */
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--primary); opacity: 0.7; flex: 0 0 auto; }

/* A filerow that is a link should not look like body text. */
a.filerow { color: inherit; }
a.filerow:hover { background: var(--surface-2); text-decoration: none; }


/* ---------- filter bar ---------- */

/* Filters read left to right: a wide search, then the narrowing controls,
   then the date range. The applied values are echoed underneath so it is
   always clear why a list is short. */
.filters { align-items: flex-end; gap: 10px; }
.filters .field { min-width: 132px; }
.filters .field.grow { flex: 1 1 260px; min-width: 200px; }
.filters .field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.filters input, .filters select { height: 34px; }

.filter-dates { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field span {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}
.filter-field input { width: 128px; height: 34px; }

.applied {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.applied-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid transparent; border-radius: 20px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600;
}
.applied-chip:hover { text-decoration: none; border-color: var(--primary); }
.applied-key { opacity: 0.65; font-weight: 500; }
.applied-val { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.applied-x { opacity: 0.55; font-size: 10px; }
.applied-chip:hover .applied-x { opacity: 1; }

/* ---------- charts ---------- */

/* One palette, used by every chart element. Severities keep the alarm colours
   they have everywhere else; the neutral tones are for *kinds* of problem, so
   a category is never mistaken for a severity. */
.seg-critical { background: var(--critical); stroke: var(--critical); }
.seg-high     { background: var(--high);     stroke: var(--high); }
.seg-medium   { background: var(--medium);   stroke: var(--medium); }
.seg-low      { background: var(--low);      stroke: var(--low); }
.seg-info     { background: var(--info);     stroke: var(--info); }
.seg-ok       { background: var(--ok);       stroke: var(--ok); }
.seg-plum     { background: var(--primary);  stroke: var(--primary); }
.seg-teal     { background: var(--accent);   stroke: var(--accent); }
.seg-blue     { background: var(--low);      stroke: var(--low); }
.seg-green    { background: var(--ok);       stroke: var(--ok); }
.seg-amber    { background: var(--brand-amber); stroke: var(--brand-amber); }
.seg-red      { background: var(--critical); stroke: var(--critical); }
.seg-grey     { background: var(--border-strong); stroke: var(--border-strong); }

.chart { width: 100%; }
.chart-plot { position: relative; padding-left: 26px; }
.chart-line {
  position: absolute; left: 26px; right: 0; height: 0;
  border-top: 1px dashed var(--border);
}
.chart-line.base { border-top-style: solid; }
.chart-line i {
  position: absolute; right: 100%; margin-right: 6px; transform: translateY(-50%);
  font-size: 10px; font-style: normal; color: var(--text-faint);
}
.chart-cols { position: absolute; inset: 0 0 0 26px; display: flex; align-items: flex-end; gap: 2px; }
.chart-col {
  flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0;
  border-radius: 2px;
}
.chart-col:hover { background: var(--surface-3); text-decoration: none; }
.chart-stack {
  width: 100%; display: flex; flex-direction: column; border-radius: 2px 2px 0 0;
  overflow: hidden; min-height: 0;
}
/* A day with nothing found still gets a mark, so a gap reads as "quiet",
   not as "the chart stops here". */
.chart-col.void .chart-stack { height: 2px !important; background: var(--border); }
.chart-axis { display: flex; gap: 2px; padding-left: 26px; margin-top: 5px; }
.chart-axis span {
  flex: 1; min-width: 0; font-size: 10px; color: var(--text-faint);
  text-align: center; white-space: nowrap; overflow: visible;
}

.donut { display: block; flex: none; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.donut-seg { fill: none; stroke-width: 5; }
.donut-seg:hover { stroke-width: 6.5; }
.donut-value {
  fill: var(--text); font-size: 7px; font-weight: 700; text-anchor: middle;
  letter-spacing: -0.03em;
}
.donut-caption {
  fill: var(--text-faint); font-size: 3.1px; text-anchor: middle;
  text-transform: uppercase; letter-spacing: 0.08em;
}

.chart-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chart-row .legend { flex: 1; min-width: 150px; }

.legend { display: flex; flex-direction: column; gap: 1px; }
.legend-row {
  display: flex; align-items: center; gap: 8px; padding: 3px 6px;
  border-radius: var(--radius); font-size: 12.5px; color: var(--text);
}
a.legend-row:hover { background: var(--surface-3); text-decoration: none; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { font-weight: 700; }
.legend-share { width: 34px; text-align: right; color: var(--text-faint); font-size: 11.5px; }
.dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.hbars { display: flex; flex-direction: column; }
.hbar {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px;
  border-radius: var(--radius); color: var(--text); font-size: 12.5px;
}
.hbar + .hbar { border-top: 1px solid var(--border); }
a.hbar:hover { background: var(--surface-3); text-decoration: none; }
.hbar-label {
  width: 34%; min-width: 0; display: flex; flex-direction: column;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hbar-label .mono { font-size: 10.5px; }
.hbar-track { flex: 1; min-width: 40px; height: 8px; background: var(--surface-3); border-radius: 4px; }
.hbar-track i { display: block; height: 100%; border-radius: 4px; min-width: 3px; }
.hbar-count { width: 34px; text-align: right; font-weight: 700; }
.hbar.tall { padding: 7px 6px; }

/* A one-line key under a stacked chart: enough to read the colours without
   spending a whole column on a legend. */
.legend-inline {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.legend-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-muted); white-space: nowrap;
}


/* A one-button form sitting in a row of buttons must not add its own box. */
.inline-form { display: inline-flex; margin: 0; }
