:root {
  --bg: #F7F2EA;
  --text: #3A2519;
  --brand: #B9825A;
  --brand-ink: #825235;
  --soft: #EAD8C8;
  --card: #FFFDF9;
  --sprout: #6B9447;
  --sprout-ink: #4A6E30;
  --muted: #756B65;
  --new: #E8F0DC;
  --radius: 1rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.4 ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: 0 1rem 1.5rem; }

.top {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: 40rem; width: 100%; margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0.5rem;
}
.logo { width: 2.5rem; height: 2.5rem; border-radius: 0.6rem; flex: none; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(58 37 25 / 0.08), 0 0 0 1px rgb(234 216 200 / 0.6);
  margin: 0 0 1rem;
  overflow: hidden;
}

.lede { margin: 0.25rem 0 1rem; color: var(--muted); font-size: 0.9375rem; }

.offline {
  margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-radius: 0.75rem;
  background: var(--soft); color: var(--brand-ink); font-size: 0.875rem;
}

/* Sections and rows */
.section-title {
  margin: 0; padding: 0.75rem 1rem 0.25rem;
  font-size: 0.875rem; font-weight: 600; color: var(--muted);
}
.items { list-style: none; margin: 0; padding: 0; }

/* A finished section folded to one line */
.fold {
  display: block; width: 100%; min-height: 3rem; padding: 0.5rem 1rem; text-align: left;
  background: none; border: 0; cursor: pointer; font: inherit; font-size: 0.9375rem; font-weight: 600; color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}

.row { border-top: 1px solid var(--soft); transition: background-color 0.6s ease, opacity 2s ease; }
.items > .row:first-child { border-top: 0; }

/* The whole row is the button */
.tap {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 3.25rem; padding: 0.375rem 1rem;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tap:active:not(:disabled) { background: rgb(234 216 200 / 0.4); }
.tap:disabled { cursor: default; }
.tap:focus-visible, .fold:focus-visible { outline: 3px solid var(--sprout); outline-offset: -3px; border-radius: 0.75rem; }
.box {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  border: 2px solid var(--brand); background: var(--card);
  display: grid; place-items: center; font-size: 1rem; font-weight: 700; line-height: 1; color: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.tap[aria-pressed="true"] .box { background: var(--sprout); border-color: var(--sprout); }
.tap[aria-pressed="true"] .box::before { content: "✓"; }

.label { flex: 1; min-width: 0; padding: 0.25rem 0; overflow-wrap: anywhere; }
.text { display: block; }
.note { display: block; font-size: 0.875rem; color: var(--muted); }
.badge { flex: none; font-size: 0.75rem; font-weight: 700; color: var(--sprout-ink); }

.row.done .text { text-decoration: line-through; color: var(--muted); }
.row.done .note { opacity: 0.7; }

/* Changes while shopping */
.row.new { background: var(--new); }
.row.highlight { background: var(--soft); }
.row.removed { opacity: 0; pointer-events: none; }
.row.removed .text { text-decoration: line-through; color: var(--muted); }

/* The invite page (/join) uses .finish for a link */
.finish {
  display: block; width: 100%; min-height: 3rem; margin: 0.5rem 0 1rem; padding: 0.75rem 1rem;
  border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--sprout); color: #fff; font: inherit; font-weight: 700;
}
.finish:active { background: var(--sprout-ink); }
.finish:focus-visible, .foot a:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Sprout pill and the quiet button */
.pill, .quiet {
  min-height: 2.75rem; padding: 0.5rem 1.25rem; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 700; -webkit-tap-highlight-color: transparent;
}
.pill { background: var(--sprout); color: #fff; }
.pill:active { background: var(--sprout-ink); }
.quiet { background: var(--soft); color: var(--brand-ink); }
.pill:focus-visible, .quiet:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Basket bar */
.bar {
  position: fixed; inset: auto 0 0; z-index: 1; max-width: 40rem; margin: 0 auto; overflow: hidden;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1rem max(0.875rem, env(safe-area-inset-bottom));
  background: var(--card); border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -2px 12px rgb(58 37 25 / 0.12), 0 0 0 1px rgb(234 216 200 / 0.6);
}
.bar-track { position: absolute; inset: 0 0 auto; height: 0.25rem; background: var(--soft); }
.bar-fill { height: 100%; width: 0; background: var(--sprout); transition: width 0.4s ease; }
.basket { flex: none; color: var(--brand-ink); }
.progress { flex: 1; margin: 0; font-weight: 600; color: var(--brand-ink); }
.has-bar .foot { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }

/* Confirmation bottom sheet */
.sheet {
  width: 100%; max-width: 40rem; margin: auto auto 0; padding: 0; border: 0; color: var(--text);
  background: var(--bg); border-radius: 1.5rem 1.5rem 0 0; animation: sheet-up 0.25s ease-out;
}
.sheet::backdrop { background: rgb(58 37 25 / 0.45); }
.sheet-in { padding: 1.5rem 1.25rem max(1.25rem, env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.sheet p { margin: 0 0 1.25rem; color: var(--muted); }
/* Like the app's sheets: one full-width main action, a quiet way out underneath (easy to hit one-handed). */
.sheet-actions { display: grid; gap: 0.5rem; }
.sheet-actions .pill { width: 100%; min-height: 3.25rem; font-size: 1.05rem; }
.sheet-actions .quiet { justify-self: center; min-height: 2.75rem; padding: 0 1.25rem; background: none; }
@keyframes sheet-up { from { transform: translateY(100%); } }

.status img { display: block; width: 6rem; height: auto; margin: 0 auto 0.5rem; }
.status { padding: 1.5rem 1rem; text-align: center; color: var(--muted); }
.status strong { display: block; margin-bottom: 0.25rem; font-size: 1.25rem; color: var(--text); }
.status.done strong { color: var(--sprout-ink); }

.foot { padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom)); text-align: center; font-size: 0.875rem; color: var(--muted); }
.foot p { margin: 0; }
.foot a { color: var(--brand-ink); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

a.finish { text-align: center; text-decoration: none; }

/* Privacy, terms and support pages */
.prose .card { padding: 0.25rem 1rem 0.5rem; }
.prose h2 { margin: 0.75rem 0 0.25rem; font-size: 1.125rem; }
.prose h3 { margin: 1rem 0 0.25rem; font-size: 1rem; }
.prose p, .prose ul { margin: 0 0 0.75rem; }
.prose ul { padding-left: 1.25rem; }
.prose a { color: var(--brand-ink); font-weight: 600; }
