/* The Thezier Table. Gelasio headings, Lexend labels, Nunito body + figures.
   Charcoal / olive on a warm off-white; protein brick, carb sage, fat amber. */
:root {
  --ground: #FBFAF8; --card: #FFFFFF; --ink: #393939; --muted: #5F6355; --line: #E4E0D7; --line-soft: #EEEBE4;
  --wash: #F6F4EF; --hover: #F1EEE8; --gold-ink: #94661A; --gold-text: #D9C7A8;
  --p: #8E3B2E; --c: #7E9C5C; --f: #C08A2E; --x: #5F6355; --none: #D6D1C6;
  --ok-bg: #E2EAD6; --ok-ink: #3E5228; --warn-bg: #F3E2C2; --warn-ink: #6E4A10;
  --serif: Gelasio, Georgia, serif; --label: Lexend, system-ui, sans-serif; --body: Nunito, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: -0.005em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.eb { font-family: var(--label); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot.p { background: var(--p); } .dot.c { background: var(--c); } .dot.f { background: var(--f); } .dot.x { background: var(--x); } .dot.none { background: var(--none); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- shell ---- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 40px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand b { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { font-family: var(--label); font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 999px; }
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a.on { background: var(--ink); color: var(--ground); }
.weekbar { display: flex; align-items: center; gap: 6px; }
.weekbar .label { font-family: var(--label); font-size: 13px; font-weight: 500; min-width: 170px; text-align: center; }
.saved { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.saved.err { color: #A3341F; font-weight: 700; }
.page { padding: 28px 40px 56px; max-width: 1560px; margin: 0 auto; }
.split { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.split > .main { flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.split > .rail { flex: 1 1 400px; max-width: 500px; min-width: 0; }
.headline { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.headline h1 { font-size: 38px; line-height: 1.1; }
.headline h1 em { color: var(--muted); }
.headline p { font-size: 15px; color: var(--muted); max-width: 64ch; margin-top: 6px; }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 16px; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; align-items: center; }

/* ---- buttons ---- */
.btn { all: unset; box-sizing: border-box; cursor: pointer; font-family: var(--label); font-weight: 500; font-size: 13px; padding: 0 16px; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: 1px solid #D6D1C6; color: var(--ink); background: var(--card); white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn.ghost { border-style: dashed; border-color: #A9A498; }
.btn.ghost:hover { border-style: solid; border-color: var(--ink); }
.btn[disabled], .ib[disabled] { opacity: .35; pointer-events: none; }
.ib { all: unset; box-sizing: border-box; cursor: pointer; width: 32px; height: 32px; border-radius: 9px; border: 1px solid #D6D1C6; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: var(--card); }
.ib:hover { border-color: var(--ink); }
.ib.bare { border-color: transparent; color: var(--muted); }
.ib.bare:hover { color: var(--ink); border-color: var(--line); }
.ib svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

/* ---- week board ---- */
.board { display: flex; flex-direction: column; gap: 10px; }
.brow { display: grid; grid-template-columns: 92px repeat(7, minmax(0, 1fr)); gap: 10px; }
.bhead { display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }
.bhead .d { font-family: var(--serif); font-size: 19px; }
.bhead.today .eb { color: var(--ink); }
.blabel { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.blabel b { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.blabel span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.cell { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 10px 11px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.cell:hover { border-color: #B9B4A8; }
.cell.sel { border: 2px solid var(--ink); padding: 9px 10px; box-shadow: 0 6px 18px -10px rgba(57, 57, 57, .45); }
.cell.off { background: transparent; border: 1.5px dashed #CFCABF; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.cell.off.sel { border: 2px dashed var(--ink); }
.cell .plus { font-family: var(--label); font-size: 12px; font-weight: 500; }
.chip { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.chip .dot { width: 8px; height: 8px; margin-top: 5px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; padding-left: 102px; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- fit cards ---- */
.fitgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.fit { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fit .top2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fit .top2 b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.bar { display: flex; flex-direction: column; gap: 5px; }
.bar .lab { display: flex; justify-content: space-between; font-size: 12px; gap: 6px; }
.bar .lab b { font-weight: 700; }
.track { position: relative; height: 8px; border-radius: 99px; background: var(--line-soft); }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.track .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 2px; }
.off-by { color: var(--gold-ink); font-weight: 700; }

/* ---- rail ---- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.panel h2 { font-size: 26px; }
.group .ghead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 6px; }
.group .ghead > span { display: flex; align-items: center; gap: 8px; }
.group .ghead .eb { color: var(--ink); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.item .nm { display: flex; flex-direction: column; min-width: 0; }
.item .nm b { font-size: 14px; }
.item .nm span { font-size: 11.5px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .v { width: 48px; text-align: center; font-weight: 800; font-size: 14px; }
.empty-group { font-size: 13px; color: var(--muted); padding: 8px 0; border-top: 1px solid var(--line-soft); }
.gtable { display: grid; font-size: 13px; column-gap: 8px; }
.gtable > span { padding: 8px 0; border-top: 1px solid var(--line-soft); text-align: right; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.gtable > span.h { border-top: none; font-weight: 700; font-size: 12px; padding: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtable > span.f { text-align: left; font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }

/* ---- add food ---- */
.adder { margin-top: 8px; background: var(--wash); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 4px; background: #ECE8E0; border-radius: 999px; padding: 3px; align-self: flex-start; }
.tabs button { all: unset; cursor: pointer; font-family: var(--label); font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.tabs button.on { background: var(--ink); color: var(--ground); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-family: var(--label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.in { box-sizing: border-box; width: 100%; height: 42px; border-radius: 11px; border: 1.5px solid #CFCABF; padding: 0 12px; font: inherit; font-size: 15px; color: var(--ink); background: var(--card); }
.in:focus { outline: none; border-color: var(--ink); }
select.in { padding-right: 6px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.results { display: flex; flex-direction: column; }
.results .sec { padding: 8px 2px 4px; }
.res { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 10px; border-radius: 10px; width: 100%; }
.res:hover { background: var(--hover); }
.res b { font-size: 14px; overflow-wrap: anywhere; }
.res .per { font-size: 12px; color: var(--muted); }
.res .act { font-family: var(--label); font-size: 12px; font-weight: 500; justify-self: end; }
.src { font-family: var(--label); font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; justify-self: end; align-self: start; white-space: nowrap; }
.src.plan, .src.manual { background: var(--ink); color: var(--ground); }
.src.usda { background: var(--ok-bg); color: var(--ok-ink); }
.src.off { background: var(--warn-bg); color: var(--warn-ink); }
.check { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.check.ok { background: var(--ok-bg); color: var(--ok-ink); }
.check.bad { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.err { color: #A3341F; font-size: 13px; font-weight: 700; min-height: 1em; }
video.scan { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---- this week ---- */
.daytabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.daytab { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); min-height: 64px; min-width: 0; }
.daytab:hover { border-color: #B9B4A8; }
.daytab b { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.daytab span:last-child { font-size: 12px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daytab.on { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.daytab.on .eb { color: var(--gold-text); }
.daytab.offday { background: transparent; border-style: dashed; }
.hero { background: var(--ink); color: var(--ground); border-radius: 22px; padding: 28px 30px; display: flex; flex-direction: column; gap: 20px; }
.hero .eb { color: var(--gold-text); }
.hero h1 { font-size: 40px; line-height: 1.1; }
.plates { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.plate { background: var(--ground); color: var(--ink); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.plate .who { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.plate .who b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.plate .ln { border-top: 1px solid var(--line-soft); padding-top: 7px; display: flex; flex-direction: column; }
.plate .ln span:first-child { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.plate .ln .g { font-size: 26px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.mealcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mealcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mealcard h3 { font-size: 21px; }
.minis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mini { background: var(--wash); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.mini b { font-size: 12.5px; }
.offcard { background: var(--card); border: 1.5px dashed #CFCABF; border-radius: 20px; padding: 44px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.offcard h1 { font-size: 38px; }

/* ---- shopping ---- */
.shopgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.shopcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px; display: flex; flex-direction: column; }
.shopcard .ghead { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.shopcard .ghead .eb { color: var(--ink); }
.sline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 11px 0; border-top: 1px solid var(--line-soft); align-items: baseline; }
.sline b { font-size: 15px; }
.sline .buy { font-size: 19px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.sline .why, .sline .det { font-size: 12.5px; color: var(--muted); }
.sline .det { text-align: right; }
.darkside { background: var(--ink); color: var(--ground); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.darkside .eb { color: var(--gold-text); }
.darkside .ln { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #55554F; font-size: 14px; }
.darkside .ln b { font-variant-numeric: tabular-nums; }

/* ---- foods ---- */
.ftable { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ftable th { text-align: left; font-family: var(--label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ftable td { padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.ftable td.n { text-align: right; font-variant-numeric: tabular-nums; }
.ftable tr.hid td { opacity: .5; }
.ftable .nm { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ftable .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.filter { display: flex; gap: 4px; background: #ECE8E0; border-radius: 999px; padding: 4px; }
.filter button { all: unset; cursor: pointer; font-family: var(--label); font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 999px; color: var(--muted); }
.filter button.on { background: var(--ink); color: var(--ground); }

/* ---- family ---- */
.famgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr)); gap: 16px; }
.fam { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.fam .who { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fam .who h2 { font-size: 24px; }
.ttable { display: grid; grid-template-columns: 92px repeat(4, minmax(0, 1fr)) 70px; gap: 8px; align-items: center; }
.ttable .h { font-family: var(--label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ttable .slot { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.ttable .in { height: 40px; text-align: right; font-variant-numeric: tabular-nums; padding: 0 10px; }
.ttable .k { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; }
.ttable .tot { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(38, 38, 36, .45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; z-index: 50; overflow-y: auto; }
.modal .box { background: var(--card); border-radius: 20px; padding: 24px; width: min(560px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .4); }

/* ---- login ---- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 36px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 30px; }

@media (max-width: 900px) {
  .top, .page { padding-left: 16px; padding-right: 16px; }
  .fitgrid, .plates, .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { overflow-x: auto; }
  .brow { min-width: 860px; }
  .shopgrid, .mealcards { grid-template-columns: 1fr; }
  .daytabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media print {
  .top, .noprint { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .shopcard, .darkside { break-inside: avoid; }
  .darkside { background: #fff; color: #000; border: 1px solid #999; }
}
