/* Trojan Fork flow UI: warm ivory, burgundy, muted gold. Mobile first, widens to a three-card row on desktop. */
:root {
  color-scheme: light;
  --paper: #f7f4ef; --surface: #fff; --raised: #f1ebe4; --ink: #261f1b; --subtle: #6f655d; --line: #e8dfd6;
  --wine: #872c40; --wine-dark: #4b1d2b; --blush: #f5e7ea; --gold: #c99a3f; --sage: #e6eee4; --sage-ink: #2f5a43;
  --warn: #7a4a00; --warn-bg: #fbf0dc; --danger: #a72f39;
  --radius: 18px; --shadow: 0 1px 2px rgba(60, 30, 20, .05), 0 10px 28px rgba(60, 30, 20, .07);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.03em; line-height: 1.12; }
h1 { font-size: 34px; } h2 { font-size: 25px; } h3 { font-size: 18px; letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--wine); }
:focus-visible { outline: 3px solid var(--wine); outline-offset: 3px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--wine); color: #fff; border-radius: 12px; }
.skip:focus { top: 10px; }

/* shell */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1040px; margin: 0 auto; padding: 14px 20px 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; color: var(--wine); font-weight: 600; font-size: 20px; letter-spacing: -.04em; min-height: 44px; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--subtle); }
.shell { max-width: 480px; margin: 0 auto; padding: 8px 20px 120px; }
.shell.wide { max-width: 1040px; }
.stack { display: grid; gap: 20px; }
.stack.tight { gap: 12px; }
.lede { color: var(--subtle); font-size: 15px; }
.muted { color: var(--subtle); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.split { justify-content: space-between; }
.grow { flex: 1; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px; border-radius: 16px; border: 1px solid transparent; font-weight: 600; font-size: 16px; text-decoration: none; transition: background .15s, transform .12s, border-color .15s; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--wine); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #6f2234; }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover:not(:disabled) { border-color: var(--wine); }
.btn.ghost { background: transparent; color: var(--wine); min-height: 44px; padding: 8px 12px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }

/* form bits */
.field { display: grid; gap: 6px; }
.field > label, .legend { font-weight: 500; font-size: 14px; }
.input { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.input:focus { border-color: var(--wine); outline: 2px solid var(--blush); }
.hint { font-size: 13px; color: var(--subtle); }
.err { color: var(--danger); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 15px; transition: background .15s, color .15s, border-color .15s; }
.chip[aria-pressed="true"], .chip.on { background: var(--wine); border-color: var(--wine); color: #fff; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; background: var(--raised); border-radius: 16px; gap: 4px; }
.seg button { min-height: 46px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 15px; color: var(--subtle); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--wine); box-shadow: 0 1px 4px rgba(60, 30, 20, .12); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.stepper button { width: 46px; height: 46px; border: 0; background: transparent; font-size: 22px; color: var(--wine); }
.stepper output { min-width: 64px; text-align: center; font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 16px; }
.choice { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.choice strong { display: block; font-weight: 600; }
.choice span { color: var(--subtle); font-size: 14px; }
.choice[aria-pressed="true"] { border-color: var(--wine); background: var(--blush); box-shadow: inset 0 0 0 1px var(--wine); }
.choices { display: grid; gap: 10px; }

/* welcome */
.hero { display: grid; gap: 22px; padding-top: 24px; }
.hero h1 { font-size: clamp(38px, 11vw, 52px); letter-spacing: -.045em; line-height: 1.02; color: var(--wine-dark); }
.hero .mark { width: 58px; height: 58px; border-radius: 16px; box-shadow: var(--shadow); }
.path { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.path li { position: relative; padding: 0 0 14px 22px; font-size: 15px; }
.path li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--wine); }
.path li strong { font-weight: 600; }
.path li span { color: var(--subtle); display: block; font-size: 13px; }

/* onboarding */
.progress { display: grid; grid-auto-flow: column; gap: 6px; }
.progress i { height: 5px; border-radius: 3px; background: var(--line); }
.progress i.done { background: var(--wine); }
.stephead { display: flex; align-items: center; gap: 8px; }
.back { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; color: var(--wine); }
.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.paceplans { display: grid; gap: 10px; }
.pace { text-align: left; display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.pace[aria-pressed="true"] { border-color: var(--wine); background: var(--blush); box-shadow: inset 0 0 0 1px var(--wine); }
.pace b { font-size: 26px; letter-spacing: -.03em; color: var(--wine-dark); }
.pace .meta { color: var(--subtle); font-size: 14px; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.macros div { background: var(--raised); border-radius: 14px; padding: 10px 6px; }
.macros b { display: block; font-size: 20px; letter-spacing: -.02em; }
.macros span { font-size: 12px; color: var(--subtle); }

/* day bar */
.daybar { position: sticky; top: 0; z-index: 30; background: rgba(247, 244, 239, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.daybar-in { max-width: 1040px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; gap: 14px; }
.daybar .ring { width: 46px; height: 46px; flex: none; }
.daybar button { all: unset; display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 1; min-height: 46px; }
.daybar strong { font-weight: 600; }
.daybar .sub { font-size: 13px; color: var(--subtle); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--gold); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .5s; }
.ring text { font: 600 11px var(--font); fill: var(--ink); }

/* banners */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14px; background: var(--sage); color: var(--sage-ink); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: #f9e3e5; color: var(--danger); }
.banner.info { background: var(--raised); color: var(--subtle); }
.banner svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.banner a { color: inherit; font-weight: 600; }

/* option cards */
.cards { display: grid; gap: 14px; }
.opt { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow); align-content: start; }
.opt-head { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.opt-head.flat { grid-template-columns: 1fr; }
.opt.has-photo { padding-top: 0; overflow: hidden; }
.dishpic { margin: 0 -16px; height: 168px; background: var(--raised); overflow: hidden; }
.dishpic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chip .count { font-size: 12px; font-weight: 600; opacity: .7; margin-left: 4px; }
.chip[aria-pressed="true"] .count { opacity: .9; }
.bandlist { display: grid; gap: 14px; margin-top: 6px; max-height: 360px; overflow: auto; padding: 12px 14px; background: var(--raised); border-radius: 14px; overscroll-behavior: contain; }
.bandlist .band li { border-bottom-color: #e2d8cd; }
.band { display: grid; gap: 4px; }
.band.off { opacity: .55; }
.band ul { list-style: none; margin: 0; padding: 0; display: grid; }
.band li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.band li:last-child { border-bottom: 0; }
@media (max-width: 560px) { .band li { grid-template-columns: 1fr; } }
.art { width: 64px; height: 64px; border-radius: 18px; background: var(--blush); display: grid; place-items: center; overflow: hidden; }
.art img { width: 42px; height: 42px; object-fit: contain; }
.art img.photo { width: 100%; height: 100%; object-fit: cover; }
.opt h3 { font-size: 18px; line-height: 1.2; }
.opt .with { color: var(--subtle); font-size: 14px; margin-top: 2px; }
.venue { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--subtle); margin-top: 4px; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--blush); color: var(--wine-dark); white-space: nowrap; }
.pill.sage { background: var(--sage); color: var(--sage-ink); }
.pill.gold { background: #f7ecd2; color: #6b4d0f; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--raised); border-radius: 14px; padding: 8px 6px; text-align: center; }
.stats b { display: block; font-size: 19px; letter-spacing: -.02em; line-height: 1.2; }
.stats span { font-size: 12px; color: var(--subtle); }
.why { font-size: 14px; display: grid; gap: 4px; }
.why p::before { content: "✓ "; color: var(--sage-ink); font-weight: 700; }
.ai { font-size: 14px; background: var(--blush); border-radius: 12px; padding: 8px 12px; color: var(--wine-dark); }
.allergen { font-size: 13px; color: var(--subtle); }
.allergen.unknown { color: var(--warn); font-weight: 500; }
.opt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-actions .btn { width: 100%; }
.opt-actions .btn.primary { grid-column: 1 / -1; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.sortseg { display: inline-grid; grid-auto-flow: column; background: var(--raised); border-radius: 12px; padding: 3px; }
.sortseg button { border: 0; background: transparent; padding: 8px 11px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--subtle); min-height: 40px; }
.sortseg button[aria-pressed="true"] { background: var(--surface); color: var(--wine); box-shadow: 0 1px 3px rgba(60, 30, 20, .12); }
.skeleton { height: 220px; border-radius: 22px; background: linear-gradient(90deg, var(--raised) 25%, #f8f3ed 50%, var(--raised) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* full day on one screen, and the all-matches list */
.daysec { display: grid; gap: 12px; padding-top: 6px; scroll-margin-top: 92px; }
.daysec + .daysec { border-top: 1px solid var(--line); padding-top: 22px; }
.sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sec-head h3 { font-size: 24px; }
.locked { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; background: var(--sage); border: 1px solid #cfe0cd; border-radius: 18px; padding: 14px 16px; }
.locked strong { display: block; font-size: 17px; line-height: 1.25; }
.locked .m { display: block; font-size: 13px; color: var(--sage-ink); margin-top: 2px; }
.allm { gap: 10px; }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; }
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow-main strong { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; }
.mrow-main span { display: block; font-size: 13px; color: var(--subtle); margin-top: 2px; }
.mrow-act { display: flex; gap: 8px; }
@media (max-width: 560px) { .mrow { grid-template-columns: 1fr; } .mrow-act .btn { flex: 1; } }

/* summary */
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .m { font-size: 13px; color: var(--subtle); }
.meals { gap: 0; padding: 4px 18px; }
.meal-row { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.meal-row:last-child { border-bottom: 0; }
.meal-row .m { font-size: 13px; color: var(--subtle); }
.meal-row .mr-name { font-size: 16px; font-weight: 500; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; gap: 4px; font-size: 14px; }
.bar .track { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--wine); border-radius: 4px; }
.bar .track i.over { background: var(--danger); }
.help { background: var(--blush); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; }

/* nav + sheet + toast */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 420px; z-index: 40; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; background: rgba(255, 255, 255, .99); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 32px rgba(75, 53, 35, .16); }
.nav button { display: grid; justify-items: center; gap: 2px; min-height: 54px; border: 0; border-radius: 18px; background: transparent; color: var(--subtle); font-size: 12px; font-weight: 500; }
.nav button[aria-current="page"] { background: var(--wine); color: #fff; }
.nav svg { width: 21px; height: 21px; }
dialog.sheet { width: min(520px, calc(100% - 24px)); max-height: 88svh; border: 0; border-radius: 24px; padding: 0; box-shadow: 0 24px 80px rgba(40, 20, 10, .35); background: var(--surface); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(38, 31, 27, .45); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head h3 { flex: 1; }
.sheet-in { padding: 20px; display: grid; gap: 14px; overflow: auto; max-height: 88svh; }
.comp { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.comp small { color: var(--subtle); grid-column: 1 / -1; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 60; max-width: calc(100% - 40px); padding: 0; color: #fff; background: var(--wine-dark); border-radius: 14px; font-size: 14px; }
#toast:not(:empty) { padding: 10px 16px; }
.foot { max-width: 480px; margin: 0 auto; padding: 0 20px 120px; color: var(--subtle); font-size: 12px; }

@media (min-width: 880px) {
  .cards { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
  .opt-head { grid-template-columns: 1fr; }
  .art { width: 72px; height: 72px; }
  .shell.wide .stack.cols { grid-template-columns: 1fr 1fr; align-items: start; }
  h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .shell, .top, .daybar-in { padding-left: 14px; padding-right: 14px; } .dual { grid-template-columns: 1fr; } }
