:root {
  --ink: #111;
  --muted: #5a5a5a;
  --line: #e2e2e2;
  --bg: #fff;
  --soft: #f6f6f4;
  --accent: #c8102e;      /* buttons only */
  --accent-ink: #fff;
  --ok: #2e7d32;
  --radius: 8px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 var(--gap); }
.small, .note, .hint, .checked { font-size: 14px; color: var(--muted); }

.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; text-decoration: none; }

.intro h1 { font-size: 28px; line-height: 1.2; margin: 32px 0 12px; }
.intro p { margin: 0 0 10px; max-width: 64ch; }

/* calculator */
.calc { background: var(--soft); border-radius: var(--radius); padding: 20px var(--gap); margin: 24px 0 8px; }
.calc h2 { font-size: 18px; margin: 0 0 12px; }
.counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 24px; }
.counter { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.counter-label { display: flex; flex-direction: column; line-height: 1.25; }
.counter-label span:first-child { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid #bbb; background: var(--bg);
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink);
}
.stepper button:hover { border-color: var(--ink); }
.stepper button:focus-visible, .buy:focus-visible, select:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; font-size: 18px; }
.hours { margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.hours select { font: inherit; padding: 8px; border-radius: var(--radius); border: 1px solid #bbb; }
.summary { margin: 14px 0 0; font-weight: 600; }

.totals { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); }
.totals p { margin: 0; padding: 10px 0; }
.totals:empty { display: none; }

/* list */
.group h3 { font-size: 20px; margin: 32px 0 4px; }
.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 72px 1fr; gap: 6px 14px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.thumb { width: 72px; height: 72px; object-fit: contain; border-radius: var(--radius); background: var(--bg); }
.thumb-empty { background: var(--soft); }
.item.is-reminder .thumb-empty { background: transparent; border: 1px dashed var(--line); }
.body h4 { margin: 0 0 2px; font-size: 16px; line-height: 1.35; }
.body p { margin: 2px 0; }
.tag { font-size: 14px; color: var(--muted); }
.tag-src { font-weight: 600; color: var(--ink); }
.tag.added { font-style: italic; }
.need { font-size: 15px; }
.reviews { font-size: 14px; }
.stars { color: #b8860b; }
.have { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-top: 6px; cursor: pointer; }
.have input { width: 18px; height: 18px; }
.item.is-have .body h4, .item.is-have .need { text-decoration: line-through; color: var(--muted); }
.item.is-have .thumb { opacity: .5; }

.action { grid-column: 2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 18px; margin: 0; }
.each { font-weight: 400; font-size: 14px; color: var(--muted); }
.checked { margin: 0; }
.nolink { font-size: 14px; color: var(--muted); margin: 0; }
.buy {
  display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font-weight: 600; padding: 11px 18px; border-radius: var(--radius); min-height: 44px;
}
.buy:hover { background: #a00d25; }
.item.is-have .buy { background: var(--soft); color: var(--muted); }

@media (min-width: 640px) {
  .item { grid-template-columns: 96px 1fr 190px; }
  .thumb { width: 96px; height: 96px; }
  .action { grid-column: 3; grid-row: 1; flex-direction: column; align-items: flex-end; justify-content: center; text-align: right; gap: 4px; }
}

.sources { margin: 48px 0 24px; font-size: 14px; color: var(--muted); }
.sources h2 { font-size: 16px; color: var(--ink); }
.sources ul { padding-left: 18px; }
.site-footer { border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); padding: 16px 0 32px; }

@media print {
  .calc .stepper button, .buy, .have input, .totals { display: none; }
  .item { break-inside: avoid; }
}
