:root {
  --bg: #122018;
  --bg-2: #1a2e24;
  --card: #24382e;
  --ink: #eef6f0;
  --muted: #9bb5a6;
  --accent: #9fd4b3;
  --gold: #e8c56b;
  --danger: #e08b7a;
  --bar: #3d8f6a;
  --bar-bg: #1a2820;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { padding-bottom: calc(96px + var(--safe-b)); }
button, input, select, textarea {
  font: inherit; color: inherit; font-size: 16px;
}
button { cursor: pointer; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: var(--bg-2);
}
.top h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.day-nav { display: flex; align-items: center; gap: 4px; }
.day-nav input[type="date"] {
  background: var(--card); border: 1px solid #3a5648; border-radius: 10px;
  padding: 6px 8px; min-height: 40px; max-width: 11.5rem;
}
.combo-dd {
  background: var(--card); border: 1px solid #3a5648; border-radius: 12px;
  max-height: 260px; overflow: auto; margin: 0 0 8px;
}
.combo-dd .food-hit { margin: 0; border-radius: 0; border-bottom: 1px solid #2f463a; }
.login-card a { color: var(--accent); }
.ghost {
  background: transparent; border: 0; color: var(--accent);
  padding: 8px 10px; min-height: 44px;
}
.view { padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.countdown { font-size: 1.4rem; font-weight: 650; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-lab { display: flex; justify-content: space-between; font-size: 0.85rem; }
.bar {
  height: 10px; background: var(--bar-bg); border-radius: 99px; overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar > span.over { background: var(--gold); }
.spark { width: 100%; height: 56px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 64px 1fr; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #2f463a;
  font-size: 0.95rem;
}
.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; padding: 8px 8px calc(8px + var(--safe-b));
  background: var(--bg-2); border-top: 1px solid #2f463a;
}
.dock button {
  background: transparent; color: var(--ink); border: 0;
  border-radius: 12px; min-height: 52px; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 0.75rem;
}
.dock svg { width: 22px; height: 22px; color: var(--accent); }
.sheet .primary, .login-card button, .sheet .danger {
  background: var(--accent); color: #122018; border: 0;
  border-radius: 12px; min-height: 44px; font-weight: 650;
}
.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.hidden { display: none !important; }
.sheet-card {
  background: var(--bg-2); width: 100%; max-width: 560px;
  max-height: min(88vh, 720px); overflow: auto;
  border-radius: 20px;
  padding: 16px 16px 0;
  display: flex; flex-direction: column;
}
.sheet-body { overflow: auto; padding-bottom: 8px; flex: 1; }
.sheet-actions {
  position: sticky; bottom: 0;
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  padding: 10px 0 calc(16px + var(--safe-b));
  background: var(--bg-2);
  border-top: 1px solid #2f463a;
}
.sheet h2 { margin: 0 0 12px; font-size: 1.15rem; }
.sheet label, .login-card label {
  display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: 0.9rem;
}
.sheet input, .sheet select, .sheet textarea, .login-card input {
  background: var(--card); border: 1px solid #3a5648; border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  background: var(--card); border: 1px solid #3a5648; border-radius: 999px;
  padding: 8px 12px; min-height: 44px;
}
.chip.on { background: var(--accent); color: #122018; border-color: var(--accent); }
.food-hit {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 0; border-radius: 12px;
  padding: 12px; margin: 6px 0;
}
.preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; }
.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-wrap { width: min(100%, 360px); }
.login-card {
  background: var(--card); padding: 24px; border-radius: 20px; width: 100%;
}
#pwa-help { text-align: center; margin: 12px 0 0; }
#pwa-install {
  display: block; width: 100%; margin-top: 16px;
  background: var(--accent); color: #122018; border: 0;
  border-radius: 12px; min-height: 48px; font-weight: 650;
}
#pwa-install[hidden], #pwa-help[hidden], .pwa-banner[hidden] { display: none; }
.pwa-banner { margin: 10px 14px 0; }
.pwa-banner #pwa-install { margin-top: 0; }
.pwa-steps {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.pwa-steps[hidden] { display: none; }
.pwa-steps-card {
  background: var(--bg-2); border-radius: 20px; padding: 20px;
  width: min(100%, 360px);
}
.pwa-steps-card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.pwa-steps-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.pwa-steps-card ol { margin: 0 0 16px; padding-left: 1.2em; line-height: 1.55; }
.pwa-steps-card button {
  display: block; width: 100%;
  background: var(--accent); color: #122018; border: 0;
  border-radius: 12px; min-height: 44px; font-weight: 650;
}
.login-card h1 { margin: 0 0 8px; }
.login-card button { width: 100%; margin-top: 12px; }
.sites { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { font-size: 0.8rem; color: var(--muted); }
.unmatched { outline: 1px dashed var(--gold); }
.sheet .danger { background: var(--danger); color: #1a100e; }
.sheet .ghost { width: auto; }
.list-btn { display: block; width: 100%; text-align: left; background: var(--card); border: 0; border-radius: 12px; padding: 12px; margin: 6px 0; }
video.scan { width: 100%; border-radius: 12px; background: #000; max-height: 240px; }
.week-badge {
  font-size: 0.8rem; color: var(--gold); white-space: nowrap; padding: 0 6px;
}
.home-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  background: var(--bg-2); border-bottom: 1px solid #2f463a;
  position: sticky; top: calc(52px + var(--safe-t)); z-index: 4;
}
.home-tabs button {
  background: transparent; border: 0; color: var(--muted);
  min-height: 44px; font-weight: 650;
  border-bottom: 2px solid transparent;
}
.home-tabs button[aria-selected="true"] {
  color: var(--ink); border-bottom-color: var(--accent);
}
.past-strip, .offline {
  background: var(--gold); color: #122018; text-align: center;
  padding: 8px 12px; font-size: 0.9rem; font-weight: 650;
}
.offline { background: var(--danger); color: #1a100e; }
.tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.tile {
  background: var(--card); border-radius: var(--radius); padding: 12px;
  text-align: left; border: 0; min-height: 76px; color: inherit;
  display: flex; flex-direction: column; gap: 4px;
}
.tile .v { font-size: 1.25rem; font-weight: 650; }
.tile .stale { color: var(--gold); font-size: 0.75rem; }
.banner {
  background: #3a2420; border-left: 4px solid var(--danger);
  border-radius: 12px; padding: 12px;
}
.banner.urgent { border-left-color: var(--gold); }
.prompt-card { border-left: 4px solid var(--accent); }
.q { margin: 14px 0; }
.q .q-lab { font-weight: 650; margin-bottom: 4px; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(88px + var(--safe-b));
  z-index: 40; background: var(--ink); color: #122018;
  border-radius: 12px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-weight: 650;
}
.toast button { background: transparent; border: 0; color: #1a2e24; font-weight: 750; min-height: 44px; }
.recovery-key {
  font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: 0.04em;
  background: var(--bg); padding: 12px; border-radius: 12px; word-break: break-all;
}
.settings-group { margin: 12px 0; }
.settings-group > summary {
  min-height: 44px; cursor: pointer; font-weight: 650; list-style: none;
}
.ex-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-row { display: flex; gap: 8px; }
.icon-row .chip { flex: 1; }
.ai-draft { align-items: flex-start; }
input.low-conf { outline: 2px solid var(--gold); }
.mic-launch {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--card); border: 0; border-radius: var(--radius);
  padding: 12px 14px; min-height: 64px; color: inherit;
}
.mic-launch-icon {
  flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: #1a2e24; color: var(--accent);
  border: 2px solid var(--accent);
}
.mic-launch-icon svg { width: 22px; height: 22px; }
.mic-launch-copy { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.mic-launch-copy strong { font-size: 1rem; }
.mic-launch-copy span { font-size: 0.8rem; color: var(--muted); }
.talk-hero {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 8px 0 12px;
}
.mic-round {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--card); color: var(--accent);
  border: 2px solid var(--accent);
  display: grid; place-items: center; padding: 0;
}
.mic-round svg { width: 36px; height: 36px; }
.mic-round.on {
  background: var(--accent); color: #122018;
  animation: micpulse 1.4s ease-in-out infinite;
}
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(159, 212, 179, 0.45); }
  50% { box-shadow: 0 0 0 16px rgba(159, 212, 179, 0); }
}
.sheet #ai-log { min-height: 88px; width: 100%; resize: vertical; }
@media (max-height: 560px) {
  .mic-round { width: 64px; height: 64px; }
  .mic-round svg { width: 28px; height: 28px; }
  .talk-hero { margin: 4px 0 8px; }
  .sheet #ai-log { min-height: 64px; }
}
.sheet-actions .primary { flex: 1; max-width: 220px; }
@media (min-width: 640px) {
  .sheet { padding: 32px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

