:root {
  color-scheme: light;
  --paper: #faf6ee;
  --surface: #fffdf8;
  --ink: #202e25;
  --muted: #555e52;
  --line: #e5ddce;
  --green: #254a39;
  --mint: #e7efe4;
  --rose: #f7d4c5;
  --danger: #963b2b;
  font: 100%/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100%, 42rem); margin: auto; padding: 2rem 1.125rem; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, .section-heading h2, h3, dialog h2 {
  font-family: Georgia, serif;
  font-weight: 700;
  line-height: 1.12;
}

.masthead, .section-heading, .person-heading, .gift-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.masthead { margin-bottom: 1.5rem; }
.masthead img { flex: 0 0 auto; }
.eyebrow { font-size: .69rem; font-weight: 800; letter-spacing: .17em; }
.masthead .eyebrow { color: var(--green); }
h1 { font-size: clamp(3rem, 10vw, 4.5rem); letter-spacing: -.065em; margin: .2rem 0; }
h1 span { color: #ab4f3c; }
.intro, .empty-note { color: var(--muted); font-size: .92rem; }

.overview { background: var(--green); color: var(--surface); border-radius: 1.25rem; padding: 1.15rem; }
.overview .eyebrow { color: #e0ebd8; }
.overview dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: .85rem 0; gap: .6rem; }
.overview dl > div + div { border-left: 1px solid #658170; padding-left: .6rem; }
.overview dt { font-size: .78rem; color: #e0ebd8; }
.overview dd { font-size: clamp(1.07rem, 4.5vw, 1.6rem); font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.overview-status { color: #e0ebd8; border-top: 1px solid #658170; padding-top: .65rem; font-size: .8rem; }
.overview-status.over { color: #ffdac8; }

.people { margin-top: 1.6rem; }
.section-heading { margin-bottom: .75rem; }
.section-heading h2 { font-size: 1.95rem; }
#people-list { display: grid; gap: .85rem; }
.person, .empty { background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; padding: .9rem; }
.empty { padding: 1.5rem 1rem; text-align: center; border-style: dashed; }
.empty strong { display: block; margin-bottom: .25rem; }
.person-heading h3 { font-size: 1.6rem; overflow-wrap: anywhere; }
.person-heading > div, .gift-heading > div { min-width: 0; }
.person-heading button, .gift-heading button { flex: 0 0 auto; }
.budget-line { color: var(--muted); font-size: .86rem; margin-top: .45rem; overflow-wrap: anywhere; }
.budget-line.over { color: var(--danger); font-weight: 700; }
progress { display: block; width: 100%; height: .48rem; border: 0; border-radius: 1rem; overflow: hidden; background: var(--mint); color: var(--green); margin-top: .45rem; }
progress::-webkit-progress-bar { background: var(--mint); }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
progress.over::-webkit-progress-value { background: var(--danger); }
progress.over::-moz-progress-bar { background: var(--danger); }
.gifts { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .5rem; }
.gift { background: var(--paper); border-radius: .8rem; padding: .6rem .65rem .45rem; }
.gift-name { display: block; overflow-wrap: anywhere; }
.gift-price { color: var(--muted); font-size: .87rem; }
.gift-controls { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.gift-controls label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: 0 .55rem;
  font-size: .86rem;
  cursor: pointer;
}
.gift-controls label:has(input:checked) { background: var(--mint); border-color: var(--green); color: var(--green); }
.gift-controls input { width: 1.1rem; height: 1.1rem; accent-color: var(--green); margin: 0; }
.person > .empty-note { margin: .75rem 0; }

button, input { font: inherit; }
button { min-height: 44px; border: 1px solid transparent; border-radius: .65rem; padding: .45rem .75rem; font-size: .86rem; font-weight: 750; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid #983a29; outline-offset: 2px; }
.primary { background: var(--green); color: white; }
.secondary { background: var(--mint); color: var(--green); }
.danger { background: transparent; color: var(--danger); margin-right: auto; }
.solid-danger { background: var(--danger); color: white; }
footer { margin-top: 1.5rem; text-align: center; color: var(--muted); font-size: .78rem; }
footer span { color: var(--danger); }

dialog { width: min(calc(100% - 2rem), 25rem); max-height: calc(100% - 2rem); border: 0; border-radius: 1.15rem; padding: 1.15rem; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(27 38 30 / .55); }
dialog h2 { font-size: 1.6rem; margin-bottom: .75rem; }
dialog label { display: block; font-size: .86rem; font-weight: 750; margin-top: .65rem; }
dialog input { display: block; min-height: 44px; width: 100%; padding: .4rem .65rem; margin-top: .2rem; color: var(--ink); background: white; border: 1px solid #88897d; border-radius: .55rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; margin-top: .9rem; }

@media (min-width: 40rem) {
  main { padding: 3rem 2rem; }
  .overview, .person { padding: 1.25rem; }
}
