:root {
  --ink: #1d2530;
  --muted: #64707d;
  --line: #dfe3e8;
  --paper: #f6f7f9;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-soft: #e6f0f7;
  --good: #1e7a46;
  --good-soft: #e5f4ea;
  --warn: #9a6400;
  --warn-soft: #fbf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe9e8;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16.5px; line-height: 1.45; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26.5px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
h3 { font-size: 16.5px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.top { display: flex; align-items: center; gap: 24px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 16px; flex: 1; }
.brand { font-weight: 700; color: var(--ink); }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stat { font-size: 28.5px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
form.stack { display: grid; gap: 10px; max-width: 520px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: grid; gap: 4px; font-size: 14.5px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #c5ccd4; border-radius: 6px; background: #fff; color: var(--ink); min-width: 0; max-width: 100%; }
button, .button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; display: inline-block; }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:disabled, .button.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; background: var(--accent-soft); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 13px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.pass { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.fail { background: var(--bad-soft); color: var(--bad); }
.group { display: grid; gap: 10px; }
.group .badge { white-space: normal; }
.group-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pager { display: flex; gap: 10px; margin: 14px 0; align-items: center; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.lines-sample { table-layout: fixed; }
.lines-sample td { font-size: 14.5px; padding: 4px 6px; overflow-wrap: anywhere; }
.lines-sample td:first-child { width: 92px; }
.lines-sample td.num { width: 90px; }
.card, .group, .group-head, .group-head span { min-width: 0; overflow-wrap: anywhere; }
td select { max-width: 200px; }
td .row { flex-wrap: nowrap; }
details summary { cursor: pointer; color: var(--accent); }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 10px; }
  .top nav { order: 3; width: 100%; }
  h1 { font-size: 22px; }
}

/* Emphasis: statuses and counts people act on */
.stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat-card { border-left: 4px solid var(--line); }
.stat-card.good { border-left-color: var(--good); }
.stat-card.bad { border-left-color: var(--bad); }
.stat-card.good .stat { color: var(--good); }
.stat-card.bad .stat { color: var(--bad); }
.stat-card.wide { grid-column: span 2; }
.stat-label { font-size: 14.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.stat { font-size: 37.5px; line-height: 1.1; }
.stat-unit { font-size: 15.5px; font-weight: 500; color: var(--muted); }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 10px 0 8px; }
.seg { min-width: 0; }
.seg.silent, .dot.silent { background: var(--good); }
.seg.guess, .dot.guess { background: #e0a526; }
.seg.reviewed, .dot.reviewed { background: var(--accent); }
.seg.open, .dot.open { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.summary { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 8px; margin-bottom: 16px; }
.summary.good { background: var(--good-soft); color: var(--good); }
.summary.bad { background: var(--bad-soft); color: var(--bad); }
.summary strong { font-size: 20px; }
.summary-icon { font-size: 31px; font-weight: 700; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #fff; flex: none; }
.status { font-size: 15.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.status.pass { background: var(--good-soft); color: var(--good); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.fail { background: var(--bad); color: #fff; }
.check { border-left: 4px solid var(--good); }
.check.warn { border-left-color: #e0a526; }
.check.fail { border-left-color: var(--bad); }
.check.pass h3 { font-weight: 500; }
.group { border-left: 4px solid #e0a526; }
.group.open { border-left-color: var(--bad); }
.group .badge.warn { font-size: 14.5px; font-weight: 600; padding: 3px 10px; }
.group h3 { font-size: 18.5px; }
button, .button { font-weight: 600; }

/* Motion: a thin bar while a request runs, a spinner on the button pressed, a cross-fade between pages */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 10; opacity: 0; }
.loading .progress { opacity: 1; animation: progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes progress { from { width: 0; } to { width: 90%; } }
.htmx-request button:disabled, button.htmx-request:disabled { opacity: .75; cursor: progress; }
.htmx-request button:disabled::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
.working { display: flex; align-items: center; padding: 8px 12px; margin-bottom: 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.flash { animation: flash-in .35s ease-out; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
@media (max-width: 640px) {
  .stat-card.wide { grid-column: auto; }
}

/* Year page: the next step first, then every step in the team's order with its state */
.next { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 16px 20px; margin: 14px 0 12px; border-radius: 8px; background: var(--accent-soft); border: 1px solid #c9dceb; }
.next.done { background: var(--good-soft); border-color: #bfe0cb; }
.next-label { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.next-title { font-size: 21px; font-weight: 700; }
.button.big { padding: 10px 20px; font-size: 17.5px; }
.next.done .button.big { background: var(--good); border-color: var(--good); }
.steps-list { list-style: none; margin: 0 0 6px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.steps-list li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.steps-list li:last-child { border-bottom: none; }
.step-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14.5px; font-weight: 700; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.steps-list li.done .step-mark { background: var(--good); border-color: var(--good); color: #fff; }
.steps-list li.current .step-mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps-list li.current { background: #fafcfe; }
.step-body { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; flex: 1; min-width: 0; }
.step-title { font-weight: 600; min-width: 190px; }
a.step-title { color: var(--ink); }
.steps-list li.current a.step-title { color: var(--accent); }
.step-status { color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.steps-list li.done .step-status { color: var(--good); }
.more-links { margin: 0 0 18px; }
.ai-details summary { font-weight: 600; }
.ai-details[open] summary { margin-bottom: 8px; }
h2[id] { scroll-margin-top: 16px; }
@media (max-width: 640px) {
  .next-title { font-size: 18.5px; }
  .step-title { min-width: 0; }
}

/* Check list: one main action per group, other accounts below it */
.decide { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ai-reason { margin: 0; }
.group form.other { padding-top: 10px; border-top: 1px dashed var(--line); }
.group form.other select { min-width: 280px; }
@media (max-width: 640px) { .group form.other select { min-width: 0; width: 100%; } }

/* Rename and delete: tucked away, deletion asks for the name typed */
details.change summary { font-size: 14.5px; }
details.change[open] { display: grid; gap: 8px; padding: 6px 0; }
.danger-zone { margin-top: 28px; border-color: #f0c9c6; }
.danger-zone summary { color: var(--bad); font-weight: 600; }
.danger-form label { color: var(--ink); }
