:root {
  --navy: #12304a;
  --navy-2: #1a4668;
  --yellow: #ffcc4d;
  --ink: #17212b;
  --muted: #637180;
  --paper: #ffffff;
  --canvas: #f3f5f7;
  --line: #d8dee4;
  --danger: #a52828;
  --success: #176b45;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(24, 42, 58, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--canvas); line-height: 1.55; }
a { color: var(--navy-2); text-decoration-thickness: .08em; text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
button, .button { min-height: 44px; }
input, select, textarea { width: 100%; border: 1px solid #aeb9c3; border-radius: 10px; padding: .72rem .8rem; background: white; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(255, 204, 77, .7); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--yellow); color: var(--ink); padding: .7rem 1rem; border-radius: 8px; font-weight: 800; }
.skip-link:focus { top: 1rem; }
.topbar { position: sticky; top: 0; z-index: 20; height: 70px; display: flex; align-items: center; gap: 2rem; padding: 0 clamp(1rem, 4vw, 3rem); color: white; background: var(--navy); box-shadow: 0 2px 14px rgba(0,0,0,.18); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; font-weight: 850; letter-spacing: -.02em; text-decoration: none; white-space: nowrap; }
.brand-large { color: var(--navy); font-size: 1.15rem; margin-bottom: 2.5rem; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--yellow); color: var(--navy); font-weight: 950; }
.desktop-nav { display: flex; align-items: stretch; height: 100%; gap: .25rem; flex: 1; }
.desktop-nav a { display: grid; place-items: center; padding: 0 1rem; color: #eaf0f5; text-decoration: none; font-weight: 700; border-bottom: 3px solid transparent; }
.desktop-nav a:hover { color: white; border-color: var(--yellow); }
.page-shell { max-width: 1240px; min-height: calc(100vh - 70px); margin: 0 auto; padding: 2.3rem clamp(1rem, 4vw, 3rem) 6rem; }
.page-shell-auth { display: grid; place-items: center; }
.page-heading { margin-bottom: 2rem; }
.page-heading h1 { margin-bottom: .4rem; }
.split-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.eyebrow { margin-bottom: .35rem; color: var(--navy-2); font-size: .8rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.lede { color: var(--muted); font-size: 1.1rem; }
.muted { color: var(--muted); }
.surface { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: .65rem 1rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.button-primary { color: var(--navy); background: var(--yellow); }
.button-primary:hover { background: #ffd86f; }
.button-secondary { color: white; background: var(--navy-2); }
.button-quiet { color: inherit; background: transparent; border: 1px solid currentColor; }
.button-wide { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; }
.people-badge, .category-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: .35rem .7rem; font-size: .82rem; font-weight: 850; }
.people-badge { background: var(--yellow); color: var(--navy); }
.category-pill { background: #e4edf4; color: var(--navy-2); }
.messages { margin-bottom: 1rem; }
.message { padding: .8rem 1rem; border-radius: 10px; background: #e4edf4; }
.message-success { background: #dbf2e6; color: var(--success); }
.message-error { background: #f9dfdf; color: var(--danger); }
.auth-card { width: min(430px, 100%); padding: 2.2rem; background: white; border-radius: 18px; box-shadow: var(--shadow); border-top: 7px solid var(--yellow); }
.stack-form { display: grid; gap: .8rem; }
.stack-form > div { display: grid; gap: .35rem; }
.stack-form label { font-weight: 800; }
.form-errors, .errorlist { color: var(--danger); }
.errorlist { margin: 0; padding-left: 1.2rem; }
.camp-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.4rem; margin-bottom: 2.3rem; border-left: 7px solid var(--yellow); }
.camp-summary h2 { margin: .2rem 0; }
.camp-summary p { margin: 0; color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-grid, .recipe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 1rem; }
.meal-card, .recipe-card { display: flex; flex-direction: column; align-items: flex-start; padding: 1.2rem; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.recipe-card { min-height: 200px; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 11px 28px rgba(24,42,58,.13); }
.recipe-card h2 { margin: 1rem 0 .45rem; font-size: 1.35rem; }
.recipe-card p { color: var(--muted); }
.recipe-meta { margin-top: auto; color: var(--muted); font-size: .88rem; }
.meal-card h3 { margin: .25rem 0 .7rem; }
.meal-card-head, .planned-row { display: flex; justify-content: space-between; gap: .6rem; }
.planned-row > a { display: flex; justify-content: space-between; gap: .75rem; flex: 1; padding: .5rem 0; font-weight: 750; }
.planned-row > a span { color: var(--muted); font-size: .86rem; }
.mini-actions { display: flex; align-items: center; gap: .3rem; }
.mini-actions a, .mini-actions button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: #eef1f3; color: var(--navy); text-decoration: none; cursor: pointer; }
.plan-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 2rem; }
.meal-type { color: var(--navy-2); font-size: .78rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.empty-state { grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--muted); border: 2px dashed #bdc7cf; border-radius: var(--radius); }
.empty-state-large { margin-top: 10vh; }
.filter-bar { display: grid; grid-template-columns: 1fr 220px auto; gap: .7rem; margin-bottom: 1.25rem; }
.recipe-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.5rem; }
.recipe-header .category-pill { margin: 1.4rem 0 .6rem; }
.recipe-header h1 { max-width: 850px; margin-bottom: .45rem; }
.back-link { display: block; width: fit-content; font-weight: 800; }
.people-control { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.people-control > div { display: flex; align-items: center; gap: .65rem; }
.people-control input { width: 90px; }
.recipe-sheet { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); overflow: hidden; background: white; border: 1px solid #9eaab4; border-radius: var(--radius); box-shadow: var(--shadow); }
.recipe-column h2 { margin: 0; padding: .9rem 1.1rem; color: white; background: var(--navy); font-size: 1.15rem; }
.ingredients-column { border-right: 1px solid #9eaab4; }
.ingredient-row { display: grid; gap: .15rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.ingredient-row:last-child { border-bottom: 0; }
.ingredient-row > span { color: var(--muted); font-size: .88rem; }
.instruction-list { margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.instruction-list li { position: relative; min-height: 72px; padding: .9rem 1rem .9rem 3.5rem; border-bottom: 1px solid var(--line); counter-increment: steps; }
.instruction-list li::before { content: counter(steps); position: absolute; left: 1rem; top: .85rem; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); color: var(--navy); font-weight: 900; }
.instruction-list p { margin: .1rem 0 0; }
.kitchen-note { margin-top: 1rem; padding: 1rem 1.2rem; border-left: 7px solid var(--yellow); border-radius: 0 10px 10px 0; background: #fff8dd; }
.kitchen-note p { margin: .35rem 0 0; }
.notes-section { margin-top: 2.5rem; max-width: 800px; }
.note-form { display: grid; gap: .6rem; padding: 1rem; margin-bottom: 1rem; background: white; border-radius: var(--radius); border: 1px solid var(--line); }
.note-form label { font-weight: 800; }
.note { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.note > div { display: flex; justify-content: space-between; gap: 1rem; }
.note span { color: var(--muted); font-size: .84rem; }
.note form { text-align: right; }
.note-actions { display: flex; justify-content: flex-end; gap: .8rem; font-size: .85rem; }
.text-danger { border: 0; background: transparent; color: var(--danger); text-decoration: underline; cursor: pointer; }
.review-flag { display: inline-flex; width: fit-content; padding: .17rem .45rem; border-radius: 5px; background: #fff0c5; color: #795300 !important; font-style: normal; font-size: .78rem !important; font-weight: 850; }
.list-stack { display: grid; gap: .8rem; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem; color: inherit; text-decoration: none; }
.list-row:hover { border-color: var(--navy-2); }
.list-row h2 { margin: 0 0 .2rem; font-size: 1.1rem; }
.list-row p { margin: 0; color: var(--muted); }
.list-row > div:last-child { display: flex; align-items: center; gap: .5rem; }
.schedule { display: grid; gap: 1rem; }
.schedule-day { display: grid; grid-template-columns: 100px 1fr; gap: 1rem; }
.schedule-day > header { padding: .8rem; text-align: center; color: white; background: var(--navy); border-radius: var(--radius); }
.schedule-day > header span { font-size: .78rem; font-weight: 850; text-transform: uppercase; }
.schedule-day > header h2 { margin: .15rem 0 0; }
.day-meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.add-link { margin-top: auto; color: var(--navy-2); }
.shopping-groups { display: grid; gap: 1.5rem; }
.shopping-group h2 { margin-bottom: .6rem; color: var(--navy); }
.shopping-item { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: .7rem; min-height: 66px; padding: .45rem .7rem; background: white; border-bottom: 1px solid var(--line); }
.shopping-line { background: white; border-bottom: 1px solid var(--line); }
.shopping-line .shopping-item { border-bottom: 0; }
.shopping-line:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.shopping-line:last-of-type { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.shopping-item:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.shopping-item:last-of-type { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.shopping-item > div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; }
.shopping-item > div span { color: var(--muted); }
.check-button { display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid #93a2af; border-radius: 10px; background: white; color: transparent; cursor: pointer; }
.is-checked { opacity: .58; }
.is-checked strong { text-decoration: line-through; }
.is-checked .check-button { color: white; background: var(--success); border-color: var(--success); }
.stock-details { padding: 0 .7rem .65rem 4.65rem; color: var(--muted); }
.stock-details summary { width: fit-content; cursor: pointer; font-size: .82rem; font-weight: 750; }
.stock-form { display: flex; flex-wrap: wrap; gap: .55rem; align-items: end; padding-top: .6rem; }
.stock-form label { display: grid; gap: .2rem; font-size: .78rem; font-weight: 800; }
.stock-form input { width: 120px; }
.manual-item { margin-top: 2rem; padding: 1.2rem; }
.inline-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr auto; gap: .6rem; align-items: end; }
.inline-form > div { display: grid; gap: .25rem; }
.inline-form label { font-size: .8rem; font-weight: 800; }
.form-page { max-width: 720px; margin: 0 auto; }
.form-page form.surface { padding: 1.4rem; }
.editor-page { max-width: 1180px; margin: 0 auto; }
.recipe-editor { display: grid; gap: 1.4rem; padding: 1.4rem; }
.recipe-editor fieldset { display: grid; gap: .8rem; min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.recipe-editor legend { padding: 0 .4rem; color: var(--navy); font-size: 1.1rem; font-weight: 900; }
.formset-row { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: .7rem; padding: 1rem; background: #f4f6f7; border-radius: 9px; }
.formset-row > div { display: grid; align-content: start; gap: .25rem; }
.formset-row label { font-size: .78rem; font-weight: 850; }
.formset-row .errorlist, .form-errors { color: var(--danger); }
.instruction-form { grid-template-columns: 1fr 3fr 110px 100px; }
.danger-zone { margin-top: 1rem; text-align: right; }
.photo-section { margin-top: 2rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.photo-grid figure { margin: 0; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid figcaption { padding: .6rem .8rem; color: var(--muted); }
.mobile-nav { display: none; }
.offline-status { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: 360px; padding: .65rem .9rem; border-radius: 9px; background: var(--navy); color: white; box-shadow: var(--shadow); font-weight: 750; }
.offline-status.is-warning { background: #795300; }
.offline-status.is-success { background: var(--success); }

@media (max-width: 900px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar { height: 60px; padding: 0 1rem; justify-content: space-between; }
  .desktop-nav { display: none; }
  .logout-form .button { min-height: 38px; padding: .4rem .65rem; font-size: .82rem; }
  .page-shell { padding: 1.4rem 1rem 2rem; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); background: var(--navy); box-shadow: 0 -3px 16px rgba(0,0,0,.2); }
  .mobile-nav.has-admin { grid-template-columns: repeat(5, 1fr); }
  .offline-status { left: 1rem; right: 1rem; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .mobile-nav a { display: grid; place-items: center; gap: .05rem; min-height: 66px; color: white; font-size: .73rem; font-weight: 750; text-decoration: none; }
  .mobile-nav a span { color: var(--yellow); font-size: 1.3rem; line-height: 1; }
  .split-heading, .recipe-header, .camp-summary { align-items: stretch; flex-direction: column; }
  .split-heading { display: flex; }
  .filter-bar { grid-template-columns: 1fr; }
  .recipe-sheet { grid-template-columns: 1fr; }
  .ingredients-column { border-right: 0; border-bottom: 5px solid var(--yellow); }
  .people-control { align-items: stretch; flex-direction: column; }
  .people-control > div { display: grid; grid-template-columns: 90px 1fr; }
  .people-control .button { grid-column: 1 / -1; }
  .schedule-day { grid-template-columns: 1fr; }
  .schedule-day > header { display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .schedule-day > header h2 { margin: 0; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .inline-form > div:first-of-type { grid-column: 1 / -1; }
  .inline-form .button { grid-column: 1 / -1; }
  .formset-row, .instruction-form { grid-template-columns: 1fr 1fr; }
  .formset-row > div:nth-child(-n+2), .instruction-form > div:nth-child(-n+2) { grid-column: 1 / -1; }
  .auth-card { padding: 1.5rem; }
}

@media print {
  .topbar, .mobile-nav, .button, .manual-item, .back-link { display: none !important; }
  body, .page-shell { background: white; padding: 0; }
  .shopping-item { break-inside: avoid; }
}
