:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #5d6b7a;
  --line: #dde2e8;
  --soft: #eef1f5;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e2f3f1;
  --good: #15803d;
  --mid: #b45309;
  --low: #b91c1c;
  --good-soft: #e6f4ea;
  --bad-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171e26;
    --text: #e6ebf0;
    --muted: #93a1b0;
    --line: #2a3542;
    --soft: #1f2832;
    --accent: #2dd4bf;
    --accent-text: #062a26;
    --accent-soft: #123a36;
    --good: #4ade80;
    --mid: #fbbf24;
    --low: #f87171;
    --good-soft: #13301f;
    --bad-soft: #3a1717;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }
section { margin: 28px 0; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.mark { width: 22px; height: 22px; border-radius: 50%; border: 5px solid var(--accent); display: inline-block; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.top nav a:hover { background: var(--soft); text-decoration: none; color: var(--text); }
.top nav a[aria-current] { color: var(--text); background: var(--soft); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.head h2 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.lead { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.warn { color: var(--low); font-weight: 600; }

/* Buttons and forms */
button, .button {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block;
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent);
  padding: 8px 14px; border-radius: 8px; line-height: 1.3;
}
.button:hover { text-decoration: none; }
button.secondary, .button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { background: var(--soft); }
button.small { padding: 4px 10px; font-size: .85rem; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
input.short { width: 7.5em; }
label { display: block; font-weight: 600; font-size: .92rem; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }
label.check, label.toggle { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input, label.toggle input { width: auto; margin: 0; }
.form { display: grid; gap: 12px; align-content: start; }
.form h2 { margin-bottom: 0; }
.stack { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }
form.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline input { width: auto; }
.login { max-width: 380px; margin: 48px auto; }

/* Cards, tiles, notices */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.tile-value { font-size: 1.7rem; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile-note { color: var(--muted); font-size: .82rem; }
.notice { border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; border: 1px solid var(--line); }
.notice.good { background: var(--good-soft); border-color: transparent; }
.notice.bad { background: var(--bad-soft); border-color: transparent; }
.notice ul { margin: 4px 0 0; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; }
.empty p:last-child { margin: 0; }
.tag { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--soft); padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-weight: 600; letter-spacing: .04em; }
.code.big { font-size: 1.15rem; padding: 2px 10px; color: var(--text); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; background: var(--accent-soft); border-radius: 99px; padding: 2px 10px; font-size: .85rem; margin: 1px 2px 1px 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
ol.questions { padding-left: 1.2em; margin: 0; }
ol.questions li { margin-bottom: 10px; }
details.quiet { margin: 16px 0; color: var(--muted); }
details.quiet summary { cursor: pointer; }
dl.pair { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0 16px; }
dl.pair dt { font-weight: 600; }
dl.pair dd { margin: 0; overflow-wrap: anywhere; }
[data-copy] { cursor: copy; background: var(--soft); padding: 3px 8px; border-radius: 6px; }
[data-copy].copied { outline: 2px solid var(--good); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--soft); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.compact td { padding: 5px 8px; border: 0; }
td.barcell { width: 40%; vertical-align: middle; }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.good > span { background: var(--good); }
.bar.mid > span { background: var(--mid); }
.bar.low > span { background: var(--low); }
.score { font-weight: 600; font-variant-numeric: tabular-nums; }
.score.good { color: var(--good); }
.score.mid { color: var(--mid); }
.score.low { color: var(--low); }
.pin-col { display: none; }
table.show-pins .pin-col { display: table-cell; }
.reveal { color: transparent; text-shadow: 0 0 8px var(--muted); cursor: pointer; user-select: none; }
.reveal.shown { color: inherit; text-shadow: none; user-select: auto; }

/* PIN slips */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0; margin-top: 16px; }
.slip { border: 1px dashed var(--muted); padding: 14px 16px; background: var(--surface); break-inside: avoid; }
.slip-lab { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.slip-name { font-size: 1.15rem; font-weight: 700; margin: 2px 0 8px; }
.slip dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0 0 8px; }
.slip dt { color: var(--muted); }
.slip dd { margin: 0; font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: 1.1rem; letter-spacing: .12em; }
.slip-how { font-size: .78rem; color: var(--muted); }

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #444; }
  .top, .no-print { display: none; }
  main.wrap { padding: 0; max-width: none; }
  .slips { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .who span { display: none; }
  .tile-value { font-size: 1.4rem; }
  .two { grid-template-columns: 1fr; }
}
