:root {
  --bg: #eef1ea;
  --paper: #fbfcf8;
  --ink: #17201a;
  --muted: #46514a;
  --line: #c3ccbe;
  --soft: #e2e8dd;
  --accent: #a8401a;
  --accent-ink: #ffffff;
  --forest: #2b5535;
  --warn: #7a4300;
  --warn-bg: #fbecd2;
  --ok: #2b5535;
  --ok-bg: #dfeedd;
  --info-bg: #e6eaf0;
  --focus: #1a5fb4;
  --r: 6px;
  --head: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a17;
    --paper: #1c231f;
    --ink: #e5ebe3;
    --muted: #b2bdb1;
    --line: #3b473f;
    --soft: #252e28;
    --accent: #f0895a;
    --accent-ink: #1a0f08;
    --forest: #9fcaa7;
    --warn: #ffcf8a;
    --warn-bg: #3a2a12;
    --ok: #a9d6b0;
    --ok-bg: #1f3424;
    --info-bg: #262c35;
    --focus: #8ab4ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
main { max-width: 1160px; margin: 0 auto; padding: 0 16px 40px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { overflow-wrap: anywhere; font-family: var(--head); font-stretch: condensed; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; font-weight: 800; margin: 32px 0 12px; color: var(--forest); }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }

.intro { padding: 28px 0 8px; max-width: 46rem; }
.lede { font-size: 1.08rem; margin: 10px 0 0; }

.tool { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-top: 16px; }
@media (min-width: 720px) { .tool { padding: 24px 28px; } }
.tool > h2:first-of-type, .edit > h2:first-of-type { margin-top: 4px; }
.edit { border: 0; margin: 0; padding: 0; min-width: 0; }
.edit[disabled] { opacity: 1; }
.readonly .edit input, .readonly .edit select { background: var(--soft); }

label, .lab { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="text"], textarea, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--muted); border-radius: var(--r); min-height: 44px; padding: 8px 10px; width: 100%; max-width: 100%; }
select { padding-right: 28px; text-overflow: ellipsis; }
input[aria-invalid="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
input.short { width: 7.5em; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--forest); margin: 0; flex: none; }
.f { margin: 0 0 14px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; }
.row > .f.grow { flex: 1 1 16rem; }
.hint, .cap { color: var(--muted); margin: 6px 0 0; }
.err { color: var(--accent); font-weight: 600; margin: 0 0 8px; }
.err:empty { display: none; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--muted); border-radius: var(--r); font-weight: 600; margin: 0; cursor: pointer; background: var(--paper); }
.seg label:has(input:checked) { background: var(--forest); color: var(--paper); border-color: var(--forest); }
.seg label:has(input:checked) input { accent-color: var(--paper); }
.seg small { font-weight: 400; font-size: 1rem; }

.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--forest); background: var(--paper); color: var(--forest); cursor: pointer; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.quiet { border-color: var(--line); color: var(--ink); }
.btn.small { min-height: 44px; padding: 6px 12px; }
.btn.danger { border-color: var(--accent); color: var(--accent); }
.btn[disabled], .edit[disabled] .btn { opacity: .55; cursor: default; }

.store-note { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: var(--r); margin: 0 0 12px; }
.viewbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: var(--info-bg); padding: 10px 12px; border-radius: var(--r); margin: 0 0 14px; }
.viewbar p { margin: 0; flex: 1 1 18rem; }
.plans { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 8px; }
.plan-pick { flex: 1 1 14rem; min-width: 0; }
.confirm { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--warn-bg); padding: 10px 12px; border-radius: var(--r); }
.confirm p { margin: 0; flex: 1 1 16rem; }

.sub { margin: 18px 0 8px; }
.members { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.member { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) auto; grid-template-areas: "n d x"; gap: 4px 16px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.member > .f { grid-area: n; }
.member > .needs { grid-area: d; min-width: 0; }
.member > .m-x { grid-area: x; }
.needs summary { font-weight: 400; color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; }
.needs[open] summary { color: var(--forest); }
.member .f { margin: 0; }
.diet { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.diet legend { font-weight: 600; padding: 0; margin-bottom: 4px; float: left; width: 100%; }
.diet label, .tags label, .who-list label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; min-height: 36px; margin: 0; }
@media (max-width: 720px) {
  .member { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n x" "d d"; }
}

.cook { margin: 16px 0; }
summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; color: var(--forest); }
.cook-t { border-collapse: collapse; margin-top: 6px; width: 100%; max-width: 34rem; }
.cook-t th, .cook-t td { text-align: left; padding: 6px 10px 6px 0; vertical-align: middle; overflow-wrap: normal; word-break: normal; }
.cook-t tbody th, .cook-t thead th:not(:last-child) { white-space: nowrap; }
.cook-t td:last-child { white-space: nowrap; }
.cook-t select { width: 100%; min-width: 0; max-width: 13rem; }
@media (max-width: 380px) {
  .cook-t thead tr, .cook-t tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem; align-items: center; }
  .cook-t thead th:first-child { display: none; }
  .cook-t tbody th { grid-column: 1 / -1; padding-bottom: 0; border-bottom: 0; }
  .cook-t select { max-width: none; }
}
.cook-t label { display: inline-flex; gap: 6px; align-items: center; margin: 0; min-height: 44px; font-weight: 400; }
.target { margin-top: 12px; }

/* menu */
.days { display: grid; gap: 18px; }
.day { border-top: 3px solid var(--forest); padding-top: 10px; }
.day-h { font-size: 1.35rem; color: var(--forest); margin-bottom: 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px 22px; align-items: start; }
.slot { min-width: 0; }
.slot h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.slot .mode { font-family: var(--body); font-weight: 400; font-size: 1rem; color: var(--muted); }
.slot.em { margin-top: 22px; border-top: 3px solid var(--forest); padding-top: 10px; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 5.5em; grid-template-areas: "f n" "m x"; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item .it-f { grid-area: f; }
.item .it-n { grid-area: n; }
.item .meta { grid-area: m; display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; min-width: 0; }
.item .it-x { grid-area: x; justify-self: end; align-self: start; width: 44px; height: 44px; padding: 0; font-size: 1.4rem; line-height: 1; }
.calc { color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.who { min-width: 0; }
.who summary { font-weight: 400; color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; overflow-wrap: anywhere; }
.who[open] { flex-basis: 100%; }
.who-list { display: flex; flex-wrap: wrap; gap: 0 14px; padding: 4px 0; }
.nw { white-space: nowrap; }
.add { margin-top: 8px; color: var(--muted); }

/* foods */
.foods { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 6px; }
.food-edit { background: var(--soft); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.food-edit h3 { margin-bottom: 10px; }
.fe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 0 14px; }
.tags { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 16px; }
.tags legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.fe-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }

/* tables */
.tablewrap { container-type: inline-size; width: 100%; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
thead th { border-bottom: 2px solid var(--muted); font-weight: 700; }
td.n, th.n { text-align: right; }
th small { display: block; font-weight: 400; color: var(--muted); font-size: 1rem; }
.diff { display: block; color: var(--muted); }
.none { color: var(--muted); }
.off { color: var(--muted); background: var(--soft); }
.food-t th[scope="row"] { font-weight: 600; }
.food-t td:last-child { text-align: right; }
.empty { color: var(--muted); }
@container (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack th, table.stack td, table.stack tfoot { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { border-bottom: 2px solid var(--muted); padding: 6px 0; }
  table.stack th[scope="row"] { border: 0; padding: 4px 0; font-size: 1.05rem; }
  table.stack td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(6.5em, 34%) minmax(0, 1fr); gap: 8px; text-align: left; }
  table.stack td.n { text-align: left; }
  table.stack td::before { content: attr(data-l); color: var(--muted); }
  table.stack td:empty { display: none; }
  table.stack .diff { display: inline; margin-left: 6px; }
  table.shop.stack tr { border-bottom-width: 1px; }
  table.shop.stack td { display: inline; padding: 0; }
  table.shop.stack td::before { content: none; }
  table.shop.stack td + td::before { content: " · "; color: var(--muted); }
  table.shop.stack tfoot td:empty { display: none; }
  table.shop.stack tfoot td::before { content: none; }
  table.shop.stack tfoot th { display: inline; padding-right: 8px; }
}
@container (max-width: 560px) {
  .food-t th:nth-child(2), .food-t td:nth-child(2), .food-t th:nth-child(5), .food-t td:nth-child(5) { display: none; }
}

.planner-for { margin-top: 18px; max-width: 22rem; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.checks li { overflow-wrap: anywhere; min-width: 0; }
.checks > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 10px; padding: 10px 12px; border-radius: var(--r); }
.checks > li > ul { grid-column: 2; margin: 6px 0 0; padding-left: 18px; }
.checks .ok { background: var(--ok-bg); }
.checks .warn { background: var(--warn-bg); }
.checks .info { background: var(--info-bg); }
.checks .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.checks .ok .mark { background: var(--ok); }
.checks .ok .mark::after { content: ""; width: 10px; height: 6px; border: solid var(--ok-bg); border-width: 0 0 3px 3px; transform: translateY(-2px) rotate(-45deg); }
.checks .warn .mark { background: var(--warn); color: var(--warn-bg); }
.checks .warn .mark::after { content: "!"; }
.checks .info .mark { border: 2px solid var(--muted); color: var(--muted); }
.checks .info .mark::after { content: "i"; }

.fuel { margin-bottom: 10px; }
.fuel .row .f { flex: 0 1 11rem; }
.fuel .row input.short { width: 100%; }
.fuel-line { margin: 4px 0 10px; }
.carriers { margin-top: 14px; }
.carriers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px 24px; }
.carrier h3 { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--muted); padding-bottom: 4px; }
.carrier .w { font-family: var(--body); font-variant-numeric: tabular-nums; }
.carrier ul { list-style: none; padding: 0; margin: 6px 0 0; }
.carrier li { padding: 3px 0; overflow-wrap: anywhere; }
.sub { color: var(--muted); }
h3.sub { color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.share { margin-top: 12px; }
.share-row { display: flex; gap: 8px; }
.share-row textarea { flex: 1; min-width: 0; }
.share-row { align-items: flex-start; }
.kept { margin-top: 24px; }
.kept ul { list-style: none; padding: 0; margin: 0; }
.kept li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kept li span { flex: 1 1 16rem; overflow-wrap: anywhere; }

.explain { max-width: 46rem; margin-top: 12px; }
.explain h3 { margin: 20px 0 4px; font-size: 1.15rem; }
.explain p { margin: 0 0 10px; }
.sources { color: var(--muted); margin-top: 24px !important; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: var(--ink); color: var(--bg); padding: 10px 12px; border-radius: var(--r); display: flex; align-items: center; gap: 8px; z-index: 20; pointer-events: none; }
.toast > * { pointer-events: auto; }
.toast-text { flex: 1; }
.toast button { font: inherit; font-weight: 700; background: transparent; color: var(--bg); border: 1px solid var(--bg); border-radius: var(--r); min-height: 44px; min-width: 44px; padding: 4px 12px; cursor: pointer; }

.site-footer { max-width: 1160px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); }
.sb-footer p { margin: 0 0 10px; }
.sb-more a { color: var(--ink); }
.sb-credit a { color: var(--ink); }

.print-root { display: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ------------------------------------------------------------ print */
@page { margin: 12mm; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #888; }
  body { background: #fff; color: #000; font: 10.5pt/1.35 var(--body); }
  main { max-width: none; padding: 0; }
  body > *:not(main), main > *:not(.print-root), .toast, .site-footer, .skip { display: none !important; }
  .print-root { display: block !important; }
  .sheet { break-after: page; }
  .sheet:last-child { break-after: auto; }
  .p-head { border-bottom: 2pt solid #000; padding-bottom: 4pt; margin-bottom: 6pt; }
  .p-head h2 { font-size: 17pt; color: #000; margin: 0; }
  .p-head p { margin: 2pt 0 0; font-size: 10pt; }
  .sheet h3 { font-size: 12pt; margin: 8pt 0 3pt; break-after: avoid; }
  .p-sec { break-inside: auto; }
  .p-team { margin: 4pt 0; }
  table { width: calc(100% - 1pt); margin-left: 0.5pt; border-collapse: collapse; table-layout: fixed; }
  th, td { border: 0.75pt solid #555; padding: 3pt 4pt; font-size: 10pt; vertical-align: top; overflow-wrap: anywhere; }
  thead th { background: #eee; print-color-adjust: exact; -webkit-print-color-adjust: exact; border-bottom: 1pt solid #000; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .p-grid th[scope="row"], .grid th[scope="row"] { width: 13%; }
  .p-grid ul { list-style: none; margin: 0; padding: 0; }
  .p-grid ul.inline li { display: inline; }
  .p-grid ul.inline li + li::before { content: "; "; }
  .p-grid li { margin: 0 0 1pt; }
  .who-p, .sub { color: #333; }
  .tag { display: block; font-size: 10pt; color: #333; font-style: italic; }
  .off { background: #f2f2f2; color: #555; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .none { color: #555; }
  .diff { display: block; font-size: 10pt; color: #333; }
  .p-note { font-size: 10pt; color: #333; margin: 3pt 0 0; }
  .p-check { margin: 3pt 0; font-weight: 600; }
  .p-checks { margin: 0; padding-left: 14pt; }
  .p-checks li { margin: 0 0 2pt; }
  .p-tot thead th:first-child { width: 30%; }
  .p-shop th[scope="row"] { font-weight: 600; }
  .p-shop th, .p-shop td, .p-carry th, .p-carry td, .p-tot th, .p-tot td { padding: 1.5pt 4pt; line-height: 1.25; }
  .keep { break-inside: avoid; }
  table.cont { margin-top: 0; }
  table.cont tr:first-child > * { border-top: 0; }
  .sign { margin: 8pt 0 2pt; break-inside: avoid; }
  .line { display: inline-block; width: 55mm; border-bottom: 0.75pt solid #000; height: 1em; vertical-align: bottom; }
  .line.short { width: 30mm; }
  .p-list { margin: 0; padding-left: 14pt; }
  .tablewrap { container-type: normal; }
  /* the on-screen stacked tables stay tables on paper */
  .grid { margin-top: 6pt; }
  .grid thead tr:last-child th:first-child { width: 15%; }
  .grid th[scope="row"] { overflow-wrap: normal; }
  .grid th[scope="row"] small, .p-grid th small { display: block; font-size: 10pt; font-weight: 400; white-space: nowrap; }
  .grid thead tr:last-child th:last-child { width: 11%; }
  .grid td::before { content: none; }
  .grid .diff { display: block; }
  .blank .fill { margin: 10pt 0; }
  .blank .line { width: 60mm; }
  .blank-grid tbody td { height: var(--rowh, 40mm); }
  .blank-grid tr:last-child td { height: 24mm; }
  .blank-grid th[scope="row"] { width: 11%; }
}

.jump { margin: -4px 0 12px; }
#out-h:focus { outline: none; }
#out-h:focus-visible { outline: 3px solid var(--focus); }

textarea.grow1 { resize: none; overflow: hidden; field-sizing: content; min-height: 44px; line-height: 1.5; overflow-wrap: anywhere; display: block; }
textarea.url { font-size: 16px; color: var(--muted); }
.who-list label, .diet label, .tags label { max-width: 100%; }
.who-list label span { min-width: 0; overflow-wrap: anywhere; }
.carrier h3 .nm { min-width: 0; }
.carrier h3 .w { flex: none; }
.linkish { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.day-tabs { display: none; }
@media (max-width: 719px) {
  .day-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
  .day-tabs .btn[aria-pressed="true"] { background: var(--forest); color: var(--paper); border-color: var(--forest); }
  .days .day:not(.on) { display: none; }
}
