:root {
  --paper: #FBF8F3;
  --card: #FFFFFF;
  --ink: #1F1B16;
  --muted: #6B6259;
  --rule: #E6DFD4;
  --accent: #2E5E4E;
  --accent-soft: #E3EDE8;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 20px;
  --measure: 760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--sans); }
a { color: inherit; }
button { font: inherit; color: inherit; }
.print-only, .print-only-rows { display: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header, main, .site-footer, .ad-slot { max-width: var(--measure); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.site-header { display: flex; justify-content: space-between; align-items: baseline; padding-top: 18px; padding-bottom: 18px; }
.wordmark { font: 600 19px/1 var(--serif); text-decoration: none; letter-spacing: -.01em; }
.site-header nav a { font-size: 14px; color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); text-decoration: underline; }

h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 32px; line-height: 1.12; margin: 12px 0 0; }
h2 { font-size: 20px; line-height: 1.25; margin: 0; }
.muted { color: var(--muted); }

/* ---------- list page ---------- */
.intro { margin-top: 36px; color: #3B342D; }
.intro h2 { margin-bottom: 10px; }
.intro p { margin: 0 0 12px; max-width: 38em; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); z-index: 2; }
.btn { appearance: none; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn + .btn { background: transparent; color: var(--ink); }
.btn-quiet { appearance: none; border: 0; background: none; padding: 8px 6px; font-size: 14px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-quiet.is-armed { color: #A13A24; }
.progress { margin: 0 0 0 auto; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.flash { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 14px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.flash button { appearance: none; border: 0; background: none; padding: 0; font-weight: 600; text-decoration: underline; cursor: pointer; color: inherit; }

.options { display: flex; flex-wrap: wrap; gap: 14px 24px; margin: 20px 0 0; }
.options fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.options legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 6px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); padding: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 13px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); padding: 3px; }
.stepper button { appearance: none; border: 0; background: none; width: 34px; height: 32px; border-radius: 999px; font-size: 20px; line-height: 1; cursor: pointer; }
.stepper button:hover { background: var(--paper); }
.stepper input { width: 46px; border: 0; background: none; text-align: center; font: 600 16px/1 var(--sans); color: var(--ink); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.subtitle { margin: 8px 0 0; font-size: 17px; color: var(--muted); max-width: 34em; }

.groups { margin-top: 8px; }
.group { margin-top: 26px; break-inside: avoid; }
.group h2 { padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.group ul, .misses ul, .sources ul { list-style: none; margin: 0; padding: 0; }
.group li label { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--rule); cursor: pointer; }
.group li input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box { width: 20px; height: 20px; margin-top: 2px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--card); display: grid; place-items: center; }
.box::after { content: ""; width: 10px; height: 5px; border-left: 2px solid var(--paper); border-bottom: 2px solid var(--paper); transform: translateY(-1px) rotate(-45deg); opacity: 0; }
.group li input:checked + .box { background: var(--accent); border-color: var(--accent); }
.group li input:checked + .box::after { opacity: 1; }
.group li input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.group li input:checked ~ .text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(107, 98, 89, .6); }
.note { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.group li input:checked ~ .text .note { text-decoration: none; }

/* people table: a table on wide screens, one card per person on phones */
.people { margin-top: 26px; }
.people h2 { padding-bottom: 6px; margin-bottom: 4px; }
.has-table { --measure: 980px; }
main.has-table { max-width: 980px; }
.table-wrap { overflow-x: auto; }
.table-help { margin-top: 16px; display: grid; gap: 14px; font-size: 14px; color: #3B342D; }
.col-notes { margin: 0; display: grid; gap: 6px; }
.col-notes div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.col-notes dt { font-weight: 600; }
.col-notes dd { margin: 0; color: var(--muted); }
.table-rules { margin: 0; padding-left: 18px; }
.table-rules li { padding: 3px 0; }
.totals dd.is-negative { color: #A13A24; }
.people table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.people th { white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 8px 6px 0; border-bottom: 1px solid var(--ink); }
.people td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.people input[type="text"] { width: 100%; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); padding: 7px 8px; font: inherit; font-size: 16px; color: var(--ink); }
.people input[type="text"]:hover { border-color: #CFC5B6; }
.people input[type="text"]:focus { border-color: var(--accent); background: var(--card); outline: none; }
.col-money { white-space: nowrap; width: 100px; }
.col-money .cur { color: var(--muted); }
.col-money input[type="text"] { width: calc(100% - 12px); text-align: right; font-variant-numeric: tabular-nums; }
.col-check { width: 76px; text-align: center; }
.people th.col-check { text-align: center; padding-right: 8px; }
.people input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.people-actions { margin-top: 4px; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 0; }
.totals div { display: flex; gap: 8px; align-items: baseline; }
.totals dt { font-size: 14px; color: var(--muted); }
.totals dd { margin: 0; font: 600 20px/1 var(--serif); font-variant-numeric: tabular-nums; }
.totals-note { margin: 8px 0 0; font-size: 14px; color: var(--muted); max-width: 38em; }

@media (max-width: 640px) {
  .people thead { display: none; }
  .people table, .people tbody, .people tr, .people td { display: block; width: auto; }
  .people tr.person { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; }
  .people td { border: 0; padding: 2px 0; text-align: left; }
  .people td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  .people td.col-text { grid-column: 1 / -1; }
  .people td.col-check { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
  .people td.col-check::before { display: inline; font-size: 14px; color: var(--ink); }
  .col-money, .col-check { width: auto; }
  .people input[type="text"] { border-color: var(--rule); background: var(--paper); }
}

.misses { margin-top: 36px; padding: 18px 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; }
.misses h2 { font-size: 17px; }
.misses li { padding: 6px 0 6px 18px; position: relative; }
.misses li::before { content: "!"; position: absolute; left: 2px; font-weight: 700; color: #A13A24; }

.sources { margin-top: 28px; font-size: 13px; color: var(--muted); }
.sources h2 { font-size: 15px; margin-bottom: 6px; }
.sources li { padding: 3px 0; }
.src-url { word-break: break-all; user-select: all; }
.noscript { font-size: 14px; color: var(--muted); }

/* ---------- home ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 38px; max-width: 14em; }
.lede { font-size: 18px; color: #3B342D; max-width: 32em; margin: 14px 0 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 28px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; text-decoration: none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--ink); transform: translateY(-1px); }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .meta { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent); }
.how { margin-top: 40px; }
.how ol { padding-left: 20px; margin: 12px 0 0; }
.how li { margin-bottom: 8px; max-width: 40em; }

/* ---------- prose ---------- */
.prose h1 { margin-bottom: 16px; }
.prose h2 { margin-top: 28px; font-size: 19px; }
.prose p { max-width: 40em; }

/* The ad slot sits between the end of the content and the footer, so it is never on a phone's first screen.
   It takes no space until an ad is placed in it. */
.ad-slot { margin-top: 40px; }
.ad-slot:empty { margin-top: 0; }

.site-footer { margin-top: 56px; padding-bottom: 40px; font-size: 13px; color: var(--muted); }
.site-footer::before { content: ""; display: block; border-top: 1px solid var(--rule); margin-bottom: 20px; }
.site-footer nav { display: flex; gap: 18px; margin-bottom: 8px; }

@media (min-width: 720px) {
  :root { --gutter: 32px; }
  h1 { font-size: 40px; }
  .hero h1 { font-size: 48px; }
}

/* ---------- print: the list body only, on one sheet ---------- */
@page { size: auto; margin: 9mm 11mm; }

@media print {
  .site-header, .site-footer, .toolbar, .intro, .flash, .misses, .sources, .ad-slot, .people-actions, .noscript, .options { display: none !important; }
  .print-only { display: block; }
  html, body { background: #fff; }
  body { font-size: 8.8pt; line-height: 1.2; }
  main { max-width: none; padding: 0; }
  .list-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5pt solid #000; padding-bottom: 3pt; }
  h1 { font-size: 15pt; margin: 0; }
  .print-url { margin: 0; font-size: 8pt; color: #555; }
  .groups { columns: 2; column-gap: 8mm; margin-top: 6pt; }
  .group { margin-top: 5pt; break-inside: auto; }
  .group:first-child { margin-top: 0; }
  .group h2 { font-size: 10pt; padding-bottom: 1.5pt; border-bottom-width: .75pt; break-after: avoid; }
  .group li { break-inside: avoid; }
  .group li label { grid-template-columns: 9pt 1fr; gap: 5pt; padding: 1.5pt 0; border-bottom: .5pt solid #ddd; }
  .box { width: 8.5pt; height: 8.5pt; margin-top: 1pt; border-width: .9pt; border-radius: 1.5pt; }
  .box::after { width: 4.5pt; height: 2.3pt; border-width: 0 0 1.2pt 1.2pt; border-color: #000; }
  .group li input:checked + .box { background: #fff; border-color: #000; }
  .group li input:checked ~ .text { color: #000; }
  .note { font-size: 7pt; line-height: 1.2; margin-top: 0; color: #555; }
  .people { margin-top: 8pt; }
  .people th { font-size: 8pt; color: #000; border-bottom-width: .75pt; padding-bottom: 2pt; }
  .people td { padding: 0 6pt 0 0; height: 24pt; border-bottom: .5pt solid #999; }
  .col-money { width: 58pt; }
  .col-check { width: 44pt; }
  .print-only-rows { display: table-row-group; }
  .print-box { display: inline-block; width: 9pt; height: 9pt; border: .9pt solid #000; border-radius: 1.5pt; }
  .totals dd.is-empty { color: transparent; border-bottom: .75pt solid #000; min-width: 48pt; }
  .people input[type="text"] { border: 0; padding: 0; font-size: 9pt; background: none; }
  .people input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 9pt; height: 9pt; margin: 0; border: .9pt solid #000; border-radius: 1.5pt; vertical-align: middle; display: inline-grid; place-items: center; }
  .people input[type="checkbox"]:checked::after { content: ""; width: 4.5pt; height: 2.3pt; border: solid #000; border-width: 0 0 1.2pt 1.2pt; transform: translateY(-.6pt) rotate(-45deg); }
  .print-box { vertical-align: middle; }
  .totals { margin-top: 5pt; gap: 4pt 18pt; }
  .totals dt { font-size: 8.5pt; color: #000; }
  .totals dd { font-size: 10pt; }
  .totals-note, .table-help, .people h2, .subtitle { display: none !important; }
  .print-options { margin: 0; font-size: 8pt; color: #555; order: 3; width: 100%; }
  .list-head { flex-wrap: wrap; }
  .qty { font-weight: 700; }
  main.has-table { max-width: none; }
  .table-wrap { overflow: visible; }
  .people th { white-space: normal; }
  .group li[hidden] { display: none !important; }
}
