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

/* Palette is built around the sage #d3e0dc: it is the border and tint colour,
   the page sits on a paler wash of it, and the accent is the same hue taken
   dark enough to stay readable on white. Severity colours are shifted toward
   the same muted register so nothing shouts louder than its severity. */
:root {
  --sage: #d3e0dc;
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --border: #d9e5e1;
  --border-strong: #b7cbc5;
  --text: #14201d;
  --text-muted: #566661;
  --text-faint: #7d908a;
  --accent: #2c7663;
  --accent-soft: #dfece8;
  --critical: #a81f31;
  --critical-soft: #f9e8ea;
  --high: #b55f18;
  --high-soft: #faefe4;
  --medium: #8f7409;
  --medium-soft: #f7f3df;
  --low: #37718d;
  --low-soft: #e8f0f4;
  --info: #5b6b67;
  --info-soft: #eef2f0;
  --ok: #1f7a58;
  --ok-soft: #e2f0ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 35, 0.05), 0 1px 3px rgba(20, 40, 35, 0.04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sage: #8fb3a9;
    --bg: #0d1413;
    --surface: #151d1b;
    --surface-2: #1b2523;
    --border: #263330;
    --border-strong: #35443f;
    --text: #e2ebe8;
    --text-muted: #9ab0a9;
    --text-faint: #738883;
    --accent: #7fc9b0;
    --accent-soft: #163029;
    --critical: #f58b96;
    --critical-soft: #2b1417;
    --high: #f0a86f;
    --high-soft: #2a1c11;
    --medium: #e2c86a;
    --medium-soft: #262211;
    --low: #85bcd6;
    --low-soft: #122029;
    --info: #a1b2ad;
    --info-soft: #1d2825;
    --ok: #62d3a2;
    --ok-soft: #10241c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  }
}

* { 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: 22px; }
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: 8px;
  background: linear-gradient(135deg, var(--accent), var(--sage));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.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: 7px; 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(--accent-soft); color: var(--accent); 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(--accent); 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(--accent-soft);
  color: var(--accent); 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: 16px 26px; 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: 22px 26px 60px; max-width: 1360px; }

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

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.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.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@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: 720px) {
  .sidebar { display: none; }
  .grid.cols-2, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
}

.stat { padding: 15px 16px; }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; }
.stat-value { font-size: 27px; font-weight: 680; letter-spacing: -0.02em; margin-top: 6px; }
.stat-foot { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

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

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; 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-2);
  white-space: nowrap;
}
.table td { padding: 11px 16px; 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(--accent); }
.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: 7px; 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(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.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: 7px; 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: 8px; 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(--accent); 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: 9px; 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: 8px 16px; 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: 8px;
  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 ---------- */

.chip.branch-production {
  background: var(--critical-soft);
  color: var(--critical);
  border-color: currentColor;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* A left edge on the row, so a production push is findable while scanning. */
tr.row-production td:first-child { box-shadow: inset 3px 0 0 var(--critical); }

/* ---------- 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(--accent); 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: 8px;
  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: 42px; height: 42px; font-size: 18px; margin: 0 auto 12px; }
.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; }
