:root {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f1f3f6; --text: #0f172a; --muted: #5b6475;
  --line: #e3e6ec; --accent: #16a34a; --accent-ink: #ffffff; --accent-soft: #dcfce7; --link: #0f6b3a;
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --info-soft: #e0f2fe; --info: #075985;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #111a2e; --surface-2: #17223a; --text: #e5e9f0; --muted: #94a0b8;
    --line: #23304a; --accent: #22c55e; --accent-ink: #052e16; --accent-soft: #123524; --link: #4ade80;
    --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3b1414; --info-soft: #0c2a3d; --info: #7dd3fc;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #17223a; --text: #e5e9f0; --muted: #94a0b8;
  --line: #23304a; --accent: #22c55e; --accent-ink: #052e16; --accent-soft: #123524; --link: #4ade80;
  --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3b1414; --info-soft: #0c2a3d; --info: #7dd3fc;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}
a { color: var(--link); text-underline-offset: 2px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.15; margin: .4em 0 .3em; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 1.8em 0 .5em; letter-spacing: -.01em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small, small { font-size: .875rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }
.sr, .hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo b { color: var(--accent); }
.logo-mark { color: var(--accent); }
.top nav { display: flex; gap: 4px 18px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.top nav a { color: var(--text); text-decoration: none; font-size: .95rem; }
.top nav a[aria-current] { color: var(--accent); font-weight: 600; }
.theme { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; }
.pill { background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: .75rem; padding: 0 7px; font-weight: 700; }

/* buttons */
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 18px; font-weight: 600; text-decoration: none; cursor: pointer; font-size: .95rem; font-family: inherit; }
.top nav a.btn { color: var(--accent-ink); }
.btn:hover { filter: brightness(1.05); }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }

/* hero */
.hero { background: linear-gradient(180deg, var(--surface), var(--bg)); border-bottom: 1px solid var(--line); padding: 28px 0 32px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; max-width: 720px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stats b { display: block; font-size: 1.5rem; }
.stats span { color: var(--muted); font-size: .85rem; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.card-title { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.card-title:hover { color: var(--link); }
/* Whole card opens the project: the title link is stretched over the card. */
.card-link { position: relative; cursor: pointer; transition: border-color .15s; }
.card-link:hover { border-color: var(--accent); }
.card-link .card-title::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link button, .card-link .tags a { position: relative; z-index: 1; }
.card-sum { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.mini dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mini dd { margin: 0; font-weight: 600; font-size: .9rem; }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag, .status, .risk { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag-ok { background: var(--accent-soft); color: var(--link); }
.s-active { background: var(--info-soft); color: var(--info); }
.s-snapshot { background: var(--warn-soft); color: var(--warn); }
.s-claim { background: var(--accent-soft); color: var(--link); }
.s-retired { background: var(--surface-2); color: var(--muted); }
.r1, .r2 { background: var(--accent-soft); color: var(--link); }
.r3 { background: var(--warn-soft); color: var(--warn); }
.r4, .r5 { background: var(--bad-soft); color: var(--bad); }
.score { display: inline-grid; place-items: center; min-width: 40px; height: 40px; border-radius: 10px; font-weight: 800; font-size: 1rem; }
.sc-hi { background: var(--accent); color: var(--accent-ink); }
.sc-mid { background: var(--warn-soft); color: var(--warn); }
.sc-lo { background: var(--surface-2); color: var(--muted); }

/* table */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filters input[type=search], .filters select, .cmp-add input, .sub input {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.filters input[type=search] { flex: 1 1 240px; }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: .92rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
.db th, .db td, .cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .93rem; }
.db thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.db th button { all: unset; cursor: pointer; }
.db th button.sorted-asc::after { content: " ▲"; }
.db th button.sorted-desc::after { content: " ▼"; }
.db tbody tr:hover { background: var(--surface-2); }
.db a { text-decoration: none; color: var(--text); }
.db a:hover { color: var(--link); }
.sub { color: var(--muted); font-size: .8rem; }
.cmp-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; min-width: 32px; height: 32px; cursor: pointer; font-weight: 700; }
.cmp-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* project page */
.crumbs { font-size: .875rem; color: var(--muted); margin-top: 16px; }
.notice { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.p-head { display: flex; gap: 20px; justify-content: space-between; align-items: start; }
.p-score { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .8rem; min-width: 110px; padding-top: 18px; }
.p-score .score { min-width: 64px; height: 64px; font-size: 1.6rem; border-radius: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.facts dt { color: var(--muted); font-size: .78rem; }
.facts dd { margin: 2px 0 0; font-weight: 650; }
.p-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 32px; }
.tasks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: t; }
.tasks li { counter-increment: t; }
.task { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.task input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.task-body { display: grid; gap: 4px; }
.task-body b::before { content: counter(t) ". "; color: var(--muted); }
.task-det { color: var(--muted); font-size: .92rem; }
.task-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.freq { text-transform: capitalize; }
.task:has(input:checked) { background: var(--accent-soft); }
.task:has(input:checked) b { text-decoration: line-through; }
.prog { font-weight: 700; color: var(--link); }
.ref { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; }
.bul { padding-left: 20px; }
.links { list-style: none; padding: 0; display: grid; gap: 4px; }
.warn { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }

/* compare */
.cmp-add { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.cmp-add input { flex: 1 1 260px; }
.cmp th { width: 170px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.cmp td { min-width: 200px; }
.cmp .best { background: var(--accent-soft); }
.rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .85rem; }

/* misc */
.callout { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 24px 20px; }
.callout-sec { margin-top: 40px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 20px; }
.sub { display: grid; gap: 8px; }
.prose { max-width: 780px; }
.prose li { margin: 4px 0; }
.toc { font-size: .92rem; }
.row-actions { display: flex; gap: 8px; margin-top: 16px; }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 24px 0; background: var(--surface); }
.foot-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-in p { max-width: 46ch; font-size: .9rem; }
.foot-links { display: grid; grid-template-columns: repeat(2, auto); gap: 6px 28px; align-content: start; font-size: .92rem; }
.fine { font-size: .8rem; color: var(--muted); }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--accent); }

@media (max-width: 760px) {
  .p-cols, .two { grid-template-columns: 1fr; }
  .p-head { flex-direction: column; }
  .p-score { flex-direction: row; padding-top: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .top nav { margin-left: 0; gap: 4px 14px; }
  .top-in { padding: 8px 16px; }
  .theme { position: absolute; right: 16px; top: 12px; }
}
