:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, sans-serif;
  background: #f6f8f3;
  color: #172e26;
  --green: #175541;
  --line: #d7e2d8;
  --muted: #52655b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main {
  width: min(100%, 42rem);
  margin: auto;
  padding: max(1.1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
header { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.15rem; }
header img { border-radius: .8rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 7vw, 2.45rem); letter-spacing: -.055em; }
h2 { font-size: 1.23rem; letter-spacing: -.025em; }
h3 { font-size: .95rem; }
.header-actions { margin-left: auto; display: flex; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.passkey-button { margin-top: .5rem; padding-inline: 0; }
#passkey-result:empty { display: none; }
.header-actions .link { padding-inline: .45rem; }
button, input, select { font: inherit; }
button { cursor: pointer; min-height: 44px; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #668442; outline-offset: 3px; }
nav { background: #e8eee7; display: flex; padding: 4px; border-radius: .9rem; gap: 4px; margin-bottom: 1rem; }
nav button { flex: 1; border: 0; background: transparent; color: var(--green); font-weight: 650; border-radius: .7rem; padding: .45rem; }
nav button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px #172e2620; }
#shopping-count { background: #e0ecdd; font-size: .86rem; border-radius: 2rem; padding: .12rem .42rem; margin-left: .12rem; }
.add-panel { background: #eaf2dd; border: 1px solid #dae8cf; border-radius: 1rem; padding: 1rem; }
.add-panel h2 { margin-bottom: .65rem; }
.entry-row, .review-actions { display: flex; gap: .45rem; }
.review-actions { justify-content: flex-end; margin-top: .65rem; }
input[type="text"], input[type="email"], input[type="number"], select { min-height: 46px; width: 100%; min-width: 0; border: 1px solid #a6b8aa; border-radius: .6rem; padding: .45rem .55rem; background: white; color: #172e26; font-size: 1rem; }
.sign-in main { width: min(100%, 31rem); padding-top: max(2.5rem, env(safe-area-inset-top)); }
.auth-form { display: grid; gap: .65rem; margin-top: 1rem; }
.auth-form label { font-weight: 650; }
.auth-form .hint { margin: 0; }
.auth-form .link { justify-self: start; padding-inline: 0; }
#auth-modes { margin-top: .75rem; }
#group-name-field { margin-top: 0; }
.primary, .link, .remove { border: 0; border-radius: .6rem; padding: .45rem .75rem; white-space: nowrap; font-weight: 670; }
.primary { background: var(--green); color: #fff; }
.primary:disabled { opacity: .59; }
.link, .remove { background: transparent; color: var(--green); }
.hint { font-size: .9rem; color: var(--muted); line-height: 1.45; margin-top: .55rem; }
.review-row { display: grid; grid-template-columns: 1fr 1fr 44px; align-items: center; gap: .35rem; margin-top: .5rem; }
.review-row { grid-template-columns: minmax(0, 1fr) 4.75rem 44px; padding-block: .35rem; }
.review-row [name="note"] { grid-column: 2 / -1; }
.remember { display: flex; gap: .5rem; align-items: center; min-height: 44px; margin-top: .45rem; }
.remember input { accent-color: var(--green); width: 1.1rem; height: 1.1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1.2rem 0 .55rem; }
#progress { color: var(--muted); font-size: .88rem; }
#progress:empty { display: none; }
.edit-item { padding-inline: .4rem; }
dialog { width: min(28rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; background: #f6f8f3; color: #172e26; }
dialog::backdrop { background: #172e2670; }
dialog .auth-form { margin-top: 0; }
.saved-card { padding: .75rem; margin-bottom: .55rem; border: 1px solid var(--line); border-radius: .8rem; background: white; }
.saved-card summary { cursor: pointer; min-height: 44px; line-height: 44px; overflow-wrap: anywhere; }
.saved-card summary span { margin-left: .55rem; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.saved-card ul { margin-top: .25rem; padding-left: 1.45rem; }
.saved-card li { padding-block: .3rem; overflow-wrap: anywhere; }
.group { margin: .65rem 0 .95rem; }
.group h3 { margin: 0 0 .35rem .15rem; color: var(--green); }
.rows { margin: 0; padding: 0; list-style: none; background: white; border: 1px solid var(--line); border-radius: .8rem; }
.rows li + li { border-top: 1px solid var(--line); }
.shopping-row { display: flex; align-items: center; }
.check-item, .catalogue-item { display: flex; align-items: center; gap: .7rem; border: 0; color: #172e26; background: transparent; text-align: left; min-height: 49px; padding: .52rem .7rem; width: 100%; }
.check-item { flex: 1; min-width: 0; }
.checkmark { flex: 0 0 1.45rem; width: 1.45rem; height: 1.45rem; color: white; border: 2px solid #6c8875; border-radius: .4rem; display: grid; place-content: center; font-weight: 700; }
.item-name { overflow-wrap: anywhere; }
#bought .checkmark { background: var(--green); border-color: var(--green); }
#bought .item-name { text-decoration: line-through; color: var(--muted); }
.remove { min-width: 44px; font-size: 1.26rem; }
.catalogue-item { justify-content: space-between; }
.catalogue-item:disabled { color: var(--muted); }
.add-caption { color: var(--green); font-size: .9rem; white-space: nowrap; font-weight: 650; }
.catalogue-item:disabled .add-caption { color: var(--muted); }
.catalogue-hint { margin: 0 0 .85rem; }
.empty { color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: .8rem; padding: .8rem .9rem; line-height: 1.45; }
.error { color: #852a20; background: #ffebe5; border-radius: .65rem; padding: .65rem; margin-top: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.household { display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem 1rem; margin-bottom: 1rem; color: var(--muted); }
.household details { flex: 1; min-width: min(100%, 12rem); }
.household summary { cursor: pointer; color: var(--green); }
.household form { margin: .5rem 0; }

@media (max-width: 440px) {
  nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#price-estimate { margin-block: .3rem .65rem; }
.item-price { display: block; font-weight: 400; }
#receipts .add-panel > label { display: block; margin-top: .65rem; font-weight: 650; }
#receipt-photo { width: 100%; margin: .3rem 0 .65rem; }
.receipt-paste summary { cursor: pointer; color: var(--green); }
.receipt-paste textarea, #receipt-date {
  width: 100%;
  min-height: 46px;
  min-width: 0;
  border: 1px solid #a6b8aa;
  border-radius: .6rem;
  background: white;
  color: #172e26;
  padding: .45rem .55rem;
  font: inherit;
}
.receipt-paste textarea { margin-top: .5rem; resize: vertical; }
.receipt-meta, .receipt-fields { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.receipt-meta input, .receipt-fields input, .receipt-fields select { display: block; margin-top: .2rem; }
.receipt-line { margin: 0 0 .5rem; padding: .55rem; min-width: 0; border: 1px solid #a6b8aa; border-radius: .6rem; }
.receipt-line .link { display: block; margin-left: auto; padding-inline: .2rem; }
#receipt-lines:empty, #receipt-status:empty, #receipt-history-status:empty { display: none; }
#receipt-status { margin-top: .65rem; }
.receipt-table { width: 100%; border-collapse: collapse; margin: .5rem 0; font-variant-numeric: tabular-nums; }
.receipt-table th, .receipt-table td { padding: .4rem .2rem; border-bottom: 1px solid #e8eee7; text-align: right; }
.receipt-table :is(th, td):first-child { text-align: left; overflow-wrap: anywhere; }
.receipt-table small { display: block; }
