:root {
  --bg: #121410;
  --surface: #1b1e19;
  --surface-2: #242822;
  --line: #2f342d;
  --fg: #ece7dc;
  --muted: #9a9b90;
  --brass: #c9973c;
  --brass-ink: #1a1408;
  --sage: #8fb27a;
  --warn: #d9a441;
  --danger: #c75a4a;
  --info: #7aa7c7;
  --edge: #9a9b90;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --nav-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f4f1ea;
    --surface: #ffffff;
    --surface-2: #ebe6da;
    --line: #d9d3c4;
    --fg: #1b1b17;
    --muted: #6a6a60;
    --brass: #7d5814;
    --brass-ink: #fff8e8;
    --edge: #5f5f56;
    color-scheme: light;
  }
}
:root[data-large-text="true"] { --text-scale: 1.15; }
:root[data-high-contrast="true"] {
  --muted: var(--fg);
  --edge: var(--fg);
  --line: color-mix(in srgb, var(--fg) 55%, var(--surface));
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"][data-high-contrast="true"] {
    --muted: var(--fg);
    --edge: var(--fg);
    --line: color-mix(in srgb, var(--fg) 55%, var(--surface));
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: calc(var(--text-scale, 1) * 16px);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.1; }
h1.display, h2.display, .display { font-family: var(--display); font-weight: 520; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--brass); text-decoration: none; }
a:not(.btn) { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--fg); }
ul { list-style: none; margin: 0; padding: 0; }
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.app.no-nav { padding-bottom: 32px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--display); font-size: calc(var(--text-scale, 1) * 26px); line-height: 1; color: var(--brass); }
.topbar .sub { font-size: calc(var(--text-scale, 1) * 13px); color: var(--muted); margin-top: 4px; }
.topbar::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: min(62%, 300px); z-index: -1; pointer-events: none;
  background: url("../brand/logo-dark.jpg") center 42% / cover no-repeat; opacity: .42;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 65%); mask-image: linear-gradient(to right, transparent, #000 65%);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] .topbar::before { background-image: url("../brand/logo-parchment.jpg"); }
}
main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 10px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flat { background: var(--surface-2); border-color: transparent; }
.card.accent { border-color: var(--brass); }
.card h2 { font-family: var(--display); font-size: calc(var(--text-scale, 1) * 24px); font-weight: 520; }
.card h3 { font-size: calc(var(--text-scale, 1) * 16px); }
.eyebrow { font-size: calc(var(--text-scale, 1) * 11px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow.brass { color: var(--brass); }
.muted { color: var(--muted); }
.small { font-size: calc(var(--text-scale, 1) * 13px); }
.tiny { font-size: calc(var(--text-scale, 1) * 12px); }
.brass { color: var(--brass); }
.sage { color: var(--sage); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.bold { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; width: 100%;
  border-radius: 12px; border: 1px solid var(--edge); background: var(--surface-2); color: var(--fg);
  font-weight: 600; font-size: calc(var(--text-scale, 1) * 15px); -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn { min-width: 48px; }
.btn.sm { min-height: 48px; font-size: calc(var(--text-scale, 1) * 14px); padding: 0 12px; width: auto; }
.btn.xs { min-height: 48px; font-size: calc(var(--text-scale, 1) * 13px); padding: 0 12px; width: auto; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:active { transform: translateY(1px); }
details.fold > summary, .opener {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; max-width: 100%; padding: 6px 14px;
  border: 1px solid var(--brass); border-radius: 12px; background: transparent; color: var(--brass);
  font-family: inherit; font-size: calc(var(--text-scale, 1) * 14px); font-weight: 600; line-height: 1.3; text-align: left;
  cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; user-select: none;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .fold-label { display: block; min-width: 0; }
details.fold > summary .fold-sub { font-size: 0.85em; font-weight: 400; color: var(--muted); margin-top: 2px; }
details.card.fold > .fold-body { margin-top: 8px; }
details.fold > summary::before { content: ""; flex: 0 0 auto; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; transition: transform 0.15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold.play > summary::before { border-width: 7px 0 7px 12px; }
details.fold.play[open] > summary::before { transform: none; width: 10px; height: 12px; border-width: 0 3px; border-color: currentColor; }
.opener::before { content: "?"; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: var(--brass); color: var(--brass-ink); font-size: calc(var(--text-scale, 1) * 12px); line-height: 18px; text-align: center; }
.opener.sm { min-height: 48px; padding: 2px 12px; font-size: calc(var(--text-scale, 1) * 13px); }
.fold-tag { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; min-height: 32px; padding: 2px 10px; border: 1px solid var(--brass); border-radius: 12px;
  background: transparent; color: var(--brass); font-size: calc(var(--text-scale, 1) * 13px); font-weight: 600; cursor: pointer; }
.fold-tag::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; transition: transform 0.15s; }
.fold-tag.open::before { transform: rotate(90deg); }
details.fold > summary:active, .opener:active { transform: translateY(1px); }
.icon-btn { background: none; border: 0; padding: 8px; color: var(--muted); min-width: 48px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 48px; min-width: 48px; padding: 0 14px; border-radius: 12px; justify-content: center;
  border: 1px solid var(--edge); background: var(--surface-2); color: var(--fg); font-size: calc(var(--text-scale, 1) * 14px); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.chip.sm { min-height: 48px; font-size: calc(var(--text-scale, 1) * 13px); padding: 0 12px; }
label.field { display: block; font-size: calc(var(--text-scale, 1) * 12px); color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
.input, textarea.input, select.input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-size: calc(var(--text-scale, 1) * 16px);
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }
.input:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.input::placeholder { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: calc(var(--text-scale, 1) * 14px); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: 0 0 auto; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brass); }
.switch { display: inline-flex; align-items: center; gap: 10px; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list.tight > li { padding: 6px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brass); border-radius: 999px; transition: width 0.25s; }
.bar.sage > span { background: var(--sage); }
.bar.info > span { background: var(--info); }
.bar.danger > span { background: var(--danger); }
.bar.tall { height: 12px; }
.badge { display: inline-block; font-size: calc(var(--text-scale, 1) * 11px); font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.badge.brass { background: var(--brass); color: var(--brass-ink); }
.badge.sage { background: color-mix(in srgb, var(--sage) 25%, transparent); color: var(--sage); }
.badge.warn { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.badge.danger { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.badge.info { background: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat .v { font-size: calc(var(--text-scale, 1) * 20px); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .l { font-size: calc(var(--text-scale, 1) * 11px); color: var(--muted); }
.banner { border-radius: var(--radius); padding: 12px 16px; font-size: calc(var(--text-scale, 1) * 14px); border: 1px solid var(--line); background: var(--surface); }
.banner.supp-interaction {
  border: 2px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--fg);
}
.banner.warn { background: var(--warn); color: var(--brass-ink); border-color: var(--warn); }
.banner.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.banner.sage { background: color-mix(in srgb, var(--sage) 22%, var(--surface)); border-color: var(--sage); }
.banner.info { background: color-mix(in srgb, var(--info) 18%, var(--surface)); border-color: var(--info); }
.btn, .chip { color: var(--fg); }
.btn.primary, .chip.on { color: var(--brass-ink); }
.banner.warn { color: #1a1408; }
.banner.sage, .banner.info { color: var(--fg); }
.banner.danger { background: #b84f40; border-color: #b84f40; }
.banner .btn:not(.primary), .banner .chip:not(.on) { background: var(--surface); color: var(--fg); border-color: var(--fg); }
.banner .btn, .banner .chip, .banner .icon-btn { flex: 0 0 auto; max-width: 100%; }
.banner .row { flex-wrap: wrap; }
.banner .icon-btn { color: inherit; }
.banner a { color: inherit; text-decoration: underline; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .tabs:not(.nowrap) { flex-wrap: wrap; overflow-x: visible; } }
.tab { flex: 0 0 auto; min-height: 48px; min-width: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface-2); color: var(--fg); font-size: calc(var(--text-scale, 1) * 14px); font-weight: 500; white-space: nowrap; }
.tab.on { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.tabs.fill .tab { flex: 1 1 0; text-align: center; }
.food-tabs .tab { min-width: 0; padding: 4px; white-space: normal; overflow-wrap: anywhere; }
.tabs.more-tab-grid { display: grid; grid-template-columns: 1fr .85fr 1fr 1.35fr; overflow: visible; }
.more-tab-grid .tab { min-width: 0; padding: 4px; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 365px) {
  .tabs.more-tab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.bottom-nav .inner { max-width: 520px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--nav-h); border: 0; background: none; color: var(--muted); font-size: calc(var(--text-scale, 1) * 11px); font-weight: 500;
}
.bottom-nav button.on { color: var(--brass); }
.bottom-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav button.on svg { stroke-width: 2.4; }
.cal-cell { border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 6px 2px; text-align: center; font-size: calc(var(--text-scale, 1) * 11px); line-height: 1.2; min-height: 64px; }
.cal-cell.today { border-color: var(--brass); background: var(--surface); box-shadow: inset 0 0 0 1px var(--brass); }
.cal-cell.bike { border-color: var(--sage); }
.cal-cell.past { opacity: 0.55; }
.cal-cell .d { font-weight: 600; font-size: calc(var(--text-scale, 1) * 12px); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid figure { margin: 0; position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photo-grid figcaption { font-size: calc(var(--text-scale, 1) * 11px); color: var(--muted); margin-top: 4px; }
.photo-grid .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: 0; border-radius: 8px; min-width: 48px; min-height: 48px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: calc(var(--text-scale, 1) * 14px); font-weight: 600; z-index: 50; opacity: 0; transition: opacity 0.2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }
.timer { font-variant-numeric: tabular-nums; font-size: calc(var(--text-scale, 1) * 15px); display: inline-flex; align-items: center; gap: 6px; }
.timer.active { color: var(--brass); font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 6px 0; }
.swipe-hint { display: flex; justify-content: space-between; align-items: center; }
.pill-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.strike { text-decoration: line-through; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: calc(var(--text-scale, 1) * 13px); }
table.t th, table.t td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; font-size: calc(var(--text-scale, 1) * 11px); text-transform: uppercase; letter-spacing: 0.06em; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
.sub-link { font-size: calc(var(--text-scale, 1) * 13px); color: var(--brass); }
.notice { font-size: calc(var(--text-scale, 1) * 12px); color: var(--muted); }
dialog { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; max-width: 480px; width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(0,0,0,0.6); }
.mic-btn.listening { color: var(--accent, #e5484d); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .mic-btn.listening { animation: none; } }
.intro { position: fixed; inset: 0; z-index: 1000; background: #161410; pointer-events: none; display: flex; align-items: center; justify-content: center; transition: opacity 0.35s ease; }
.intro video, .intro img { width: 100%; height: 100%; object-fit: contain; display: block; }
.intro img { display: none; }
.intro[data-intro="still"] img { display: block; }
.intro[data-intro="still"] video { display: none; }
.intro[data-intro="out"] { opacity: 0; }
.intro[hidden] { display: none; }
html.away #app, html.away #navwrap { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .intro { transition: none; } }
.saved-food-capture { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.saved-food-capture > [data-photo-choice] { display: contents; }
.saved-food-capture > .btn { white-space: normal; }
.saved-food-capture [data-photo-choice] > label:last-child { grid-column: 1 / -1; justify-self: center; min-height: 44px; background: transparent; }
.saved-food-capture-note { align-self: center; }
.welcome-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 126px; display: grid; align-items: center; }
.welcome-hero .full-logo { position: absolute; inset: 0 0 0 auto; width: min(66%, 270px); z-index: -1; pointer-events: none; opacity: .42; mask-image: linear-gradient(to right, transparent, #000 65%); }
.welcome-hero .full-logo img { width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; object-position: center 42%; }
.welcome-hero-copy { max-width: 72%; }
.full-logo img { display: block; width: min(100%, 300px); height: auto; margin: 0 auto 12px; border-radius: 12px; }
#feedback-btn { min-height: 48px; padding: 0 12px; font-size: calc(var(--text-scale, 1) * 13px); position: relative; white-space: nowrap; }
#feedback-btn::after { content: ""; position: absolute; inset: -8px -4px; }
