:root {
  --bg: #fbf6ef;
  --surface: #ffffff;
  --surface-2: #f3ece3;
  --text: #221c29;
  --muted: #6f6779;
  --line: rgba(34, 28, 41, 0.09);
  --primary: #221c29;
  --on-primary: #ffffff;
  --shadow: 0 1px 2px rgba(34, 28, 41, 0.05), 0 10px 30px rgba(34, 28, 41, 0.07);
  --radius: 22px;

  --blue: #3b82f6;
  --amber: #f59e0b;
  --green: #22c55e;
  --orange: #f97316;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --teal: #14b8a6;
  --sky: #0ea5e9;
  --lime: #65a30d;
  --rose: #f43f5e;
  --indigo: #6366f1;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-book: 'Fraunces', Georgia, 'Times New Roman', serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15121b;
    --surface: #201b28;
    --surface-2: #2b2534;
    --text: #f5f1f8;
    --muted: #a99fb4;
    --line: rgba(255, 255, 255, 0.09);
    --primary: #f5f1f8;
    --on-primary: #15121b;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

/* Colour families: set --c, get a soft background and a readable ink. */
.c-orange { --c: var(--orange); }
.c-violet { --c: var(--violet); }
.c-pink { --c: var(--pink); }
.c-teal { --c: var(--teal); }
.c-sky { --c: var(--sky); }
.c-lime { --c: var(--lime); }
.c-rose { --c: var(--rose); }
.c-indigo { --c: var(--indigo); }
.s-sealed { --c: var(--blue); }
.s-opened { --c: var(--amber); }
.s-container { --c: var(--green); }
.c-orange, .c-violet, .c-pink, .c-teal, .c-sky, .c-lime, .c-rose, .c-indigo,
.s-sealed, .s-opened, .s-container {
  --soft: color-mix(in srgb, var(--c) 15%, var(--surface));
  --ink: color-mix(in srgb, var(--c) 72%, var(--text));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(104px + env(safe-area-inset-bottom));
}
body.bare #app { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.view { display: flex; flex-direction: column; gap: 14px; }
.view-enter { animation: view-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }

.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 700; margin: 10px 2px -2px; }
.empty { text-align: center; padding: 16px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn-big { min-height: 56px; width: 100%; font-size: 17px; border-radius: 18px; }
.btn-small { min-height: 38px; padding: 0 13px; font-size: 14px; border-radius: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { color: var(--rose); }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  font-size: 18px;
}
.back {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: none;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 20px;
  cursor: pointer;
}

/* Header */
.top { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; margin-bottom: 4px; }
.top .eyebrow { grid-column: 1; grid-row: 1; }
.top h1 { grid-column: 1 / -1; grid-row: 2; }
.top-stats { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 12px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.pill-coin { background: color-mix(in srgb, var(--amber) 22%, var(--surface)); color: color-mix(in srgb, var(--amber) 60%, var(--text)); }
.pill-level { background: color-mix(in srgb, var(--violet) 18%, var(--surface)); color: color-mix(in srgb, var(--violet) 70%, var(--text)); }

/* Quote screen */
.quote-screen {
  min-height: calc(100dvh - 42px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 6px 0;
}
.blob { position: fixed; border-radius: 50%; filter: blur(50px); opacity: 0.45; z-index: -1; pointer-events: none; }
.blob-1 { width: 240px; height: 240px; background: var(--pink); top: -40px; right: -60px; }
.blob-2 { width: 200px; height: 200px; background: var(--amber); bottom: 120px; left: -70px; }
.blob-3 { width: 160px; height: 160px; background: var(--teal); bottom: -20px; right: -10px; opacity: 0.3; }
.quote-greet { font-weight: 700; color: var(--muted); }
.quote-body { display: flex; flex-direction: column; gap: 18px; animation: view-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.quote-mark { font-family: var(--font-book); font-size: 90px; line-height: 0.6; color: var(--pink); height: 36px; }
.quote-text { margin: 0; font-family: var(--font-book); font-size: clamp(26px, 7.5vw, 34px); line-height: 1.28; letter-spacing: -0.01em; }
.quote-source { color: var(--muted); line-height: 1.5; }
.quote-source strong { color: var(--text); }

/* Quote card on home */
.quote-line {
  display: block;
  margin: -4px 2px 0;
  font-family: var(--font-book);
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.goal-slim { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.goal-slim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bar-slim { height: 6px; }

/* Setup: mapping places */
.setup { display: flex; flex-direction: column; gap: 12px; background: color-mix(in srgb, var(--sky) 10%, var(--surface)); }
.bar-setup { height: 10px; }
.place-card.is-unmapped { background: transparent; border: 2px dashed color-mix(in srgb, var(--c) 45%, transparent); }
.place-card.is-unmapped .place-level { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--ink); }
.eyebrow.on-color { color: rgba(255, 255, 255, 0.85); margin-top: 8px; }
.staples { display: flex; flex-wrap: wrap; gap: 7px; }
.staple {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s;
}
.staple:active { transform: scale(0.95); }
.staple.is-here { background: color-mix(in srgb, var(--green) 18%, var(--surface)); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.map-footer {
  position: sticky;
  bottom: calc(92px + env(safe-area-inset-bottom));
  padding-top: 8px;
  z-index: 5;
}
.map-footer .btn { box-shadow: 0 10px 30px rgba(34, 28, 41, 0.25); }

/* Duplicates */
.did-you-mean { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.did-you-mean .btn { background: var(--surface); }
.duplicate-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  font-size: 22px;
  background: color-mix(in srgb, var(--violet) 12%, var(--surface));
  color: var(--text);
}
.duplicate-alert strong { font-size: 15px; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice-list .choice > span { justify-content: space-between; }

/* Place picker: places, then spots inside */
.place-picker { display: flex; flex-direction: column; gap: 8px; }
.place-btn, .spot-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s;
}
.place-btn { background: var(--soft); }
.place-btn.is-on { border-color: var(--c); background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.spot-list { display: flex; flex-direction: column; gap: 5px; }
.spot-btn { background: var(--surface-2); margin-left: calc(var(--depth, 0) * 18px); min-height: 40px; }
.spot-btn.is-on { border-color: var(--text); background: color-mix(in srgb, var(--text) 10%, var(--surface)); }
.place-btn:active, .spot-btn:active { transform: scale(0.97); }
.breadcrumb { font-size: 13px; opacity: 0.9; }
.breadcrumb a { color: inherit; }
.tree-row { padding-left: calc(16px + var(--depth, 0) * 22px); }

/* Stock details */
.lot-path { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.01em; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-first { background: color-mix(in srgb, var(--amber) 22%, var(--surface)); color: color-mix(in srgb, var(--amber) 60%, var(--text)); }
.level { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 5px; max-width: 160px; }
.level > span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--green)); }
.level-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.level-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.level-card .level { max-width: none; background: var(--surface); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }
details.more { border-radius: 14px; background: var(--surface-2); padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
details.more[open] summary { margin-bottom: 10px; }
.field-row > .field-price { flex: 0 0 110px; }

/* Item overview */
.overview { display: flex; flex-direction: column; gap: 2px; padding: 8px 16px; }
.ov-row { display: grid; grid-template-columns: 26px 92px 1fr; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ov-row:last-child { border-bottom: none; }
.ov-icon { font-size: 18px; }
.ov-label { font-weight: 700; color: var(--muted); font-size: 13px; }
.ov-value { font-weight: 600; min-width: 0; }
.ov-home select { width: 100%; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 8px; }
.journey { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.journey .arrow { color: var(--muted); font-weight: 800; }
.timeline .row { align-items: flex-start; font-size: 14px; }
.tl-icon { font-size: 18px; width: 24px; text-align: center; }

/* Eat me first */
.eat-first { display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--amber) 9%, var(--surface)); }
.soon-list { display: flex; flex-direction: column; gap: 10px; }
.card.soon-list { padding: 14px 16px; }
.soon-row { display: flex; align-items: center; gap: 10px; }
.soon-row a { text-decoration: none; display: flex; flex-direction: column; gap: 3px; }
.soon-top { display: flex; justify-content: space-between; gap: 8px; }
.soon-days { font-size: 12px; font-weight: 800; white-space: nowrap; }
.soon-days.is-hot { color: var(--rose); }
.soon-days.is-warm { color: color-mix(in srgb, var(--amber) 70%, var(--text)); }
.soon-days.is-ok { color: var(--green); }
.countdown { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.countdown > span { display: block; height: 100%; border-radius: inherit; }
.countdown.is-hot > span { background: var(--rose); }
.countdown.is-warm > span { background: var(--amber); }
.countdown.is-ok > span { background: var(--green); }
.month { display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--green) 9%, var(--surface)); }
.month-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.month-grid > div { display: flex; flex-direction: column; }
.month-num { font-size: 22px; font-weight: 800; }
.recipe { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.recipe .btn { align-self: flex-start; }
.recipe-head { display: flex; align-items: center; gap: 12px; }
.recipe-emoji { font-size: 30px; }
.ask-claude { display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--violet) 10%, var(--surface)); }
.claude-question { width: 100%; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 12px; font: inherit; font-size: 14px; resize: vertical; }
.cooked-row { font-weight: 600; }
.ask-option { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--violet) 10%, var(--surface)); }
details.more .btn { margin-top: 8px; width: 100%; }

/* Shopping */
.shop-card { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; background: color-mix(in srgb, var(--orange) 10%, var(--surface)); }
.chevron { font-size: 26px; color: var(--muted); }
.need { display: flex; flex-direction: column; gap: 10px; }
.need .search { box-shadow: none; background: var(--surface-2); }
.verdict { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px; }
.verdict .btn { align-self: flex-start; }
.verdict .button-row .btn { align-self: stretch; }
.v-ok { background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.v-low { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); }
.v-out { background: color-mix(in srgb, var(--rose) 13%, var(--surface)); }
.v-unknown { background: var(--surface-2); }
.list-add { display: flex; gap: 8px; }
.list-add input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  outline: none;
}
.list-add input:focus { border-color: var(--violet); }
.store-section { display: flex; flex-direction: column; gap: 8px; }
.store-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--soft); margin-top: 6px; }
.store-head .small { color: var(--ink); }
.store-icon { font-size: 24px; }
.store-count { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; background: var(--c); color: #fff; font-weight: 800; display: grid; place-items: center; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.shop-row:last-child { border-bottom: none; }
.shop-row.is-checked strong { text-decoration: line-through; color: var(--muted); }
.tick {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.shop-row.is-checked .tick { background: var(--green); border-color: var(--green); }
.mini-btn { flex: none; width: 34px; height: 34px; border-radius: 10px; border: none; background: var(--surface-2); cursor: pointer; font-size: 15px; }
.unpack-card { display: flex; flex-direction: column; gap: 12px; }

/* Big goal */
.goal { display: flex; flex-direction: column; gap: 10px; }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-emoji { font-size: 34px; }
.goal-pct { font-size: 28px; font-weight: 800; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--orange), var(--amber));
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar-big { height: 16px; }
.bar-mini { height: 6px; background: color-mix(in srgb, var(--c, var(--text)) 14%, transparent); }
.bar-mini > span { background: var(--c); }
.bar-on-color { background: rgba(255, 255, 255, 0.35); height: 12px; }
.bar-on-color > span { background: #fff; }

.next-quest, .quest {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  border-radius: 18px;
  padding: 14px;
  transition: transform 0.12s;
}
.next-quest { background: var(--soft); color: var(--text); margin-top: 4px; }
.next-quest .eyebrow { color: var(--ink); }
.next-icon, .quest-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--c);
  font-size: 22px;
}
.quest { background: var(--surface); box-shadow: var(--shadow); }
.quest .eyebrow { color: var(--ink); }
.quest:active, .next-quest:active { transform: scale(0.98); }
.reward {
  flex: none;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--amber) 22%, var(--surface));
  color: color-mix(in srgb, var(--amber) 60%, var(--text));
}
.all-done { font-weight: 700; color: var(--green); }

/* Use soon */
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -16px; padding-left: 16px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.soon-chip {
  flex: none;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--amber) 18%, var(--surface));
  font-size: 14px;
  font-weight: 600;
}
.soon-chip b { color: color-mix(in srgb, var(--amber) 65%, var(--text)); }
.soon-chip.is-hot { background: color-mix(in srgb, var(--rose) 18%, var(--surface)); }
.soon-chip.is-hot b { color: var(--rose); }

/* Places */
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.place-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--soft);
  text-decoration: none;
  transition: transform 0.12s;
}
.place-card:active { transform: scale(0.97); }
.place-top { display: flex; justify-content: space-between; align-items: flex-start; }
.place-icon { font-size: 32px; line-height: 1; }
.place-level { font-size: 12px; font-weight: 800; padding: 4px 9px; border-radius: 99px; background: var(--c); color: #fff; }
.place-name { font-weight: 800; margin-top: 6px; }
.place-meta { font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.place-add {
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px dashed var(--line);
  color: var(--muted);
  font-size: 26px;
  font-weight: 700;
}
.place-add span { font-size: 14px; }

.place-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 18px;
  border-radius: var(--radius);
  background: var(--c);
  color: #fff;
}
.place-hero .back { background: rgba(255, 255, 255, 0.25); box-shadow: none; color: #fff; }
.place-hero-icon { font-size: 46px; margin-top: 4px; }

/* Lists and rows */
.list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-amount { font-weight: 700; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.stage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.stage::before, .dot { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.dots { display: flex; gap: 3px; }
.flag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--violet) 16%, var(--surface));
  color: var(--violet);
  vertical-align: 2px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search input { flex: 1; border: none; background: transparent; height: 50px; outline: none; }

/* Item page */
.item-head { display: flex; flex-direction: column; gap: 8px; }
.item-head h1 { margin-top: 6px; }
.item-total { font-size: 22px; font-weight: 800; }
.item-total .muted { font-size: 15px; font-weight: 600; }
.stage-bar { display: flex; gap: 3px; height: 14px; border-radius: 99px; overflow: hidden; }
.stage-bar span { background: var(--c); }

.lot {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  border-left: 6px solid var(--c);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lot-head { display: flex; align-items: center; gap: 12px; }
.lot-place {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--soft);
  font-size: 22px;
}
.lot-amt { font-weight: 800; white-space: nowrap; }
.lot-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.expiry { font-size: 13px; font-weight: 700; color: var(--muted); }
.expiry.is-warm { color: color-mix(in srgb, var(--amber) 70%, var(--text)); }
.expiry.is-hot { color: var(--rose); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-inline { padding: 14px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span, .field-label { font-size: 14px; font-weight: 700; }
.field input, .field select {
  height: 50px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--violet); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row > .field { flex: 1; }
.field-row > .field-unit { flex: 0 0 90px; }
.field-row > .field-count { flex: 0 0 100px; }
.field-row > .field-emoji { flex: 0 0 76px; }
.field-emoji input { text-align: center; font-size: 22px; }
.date-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.date-pick input { height: 42px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); }
.form-error { color: var(--rose); font-weight: 700; font-size: 14px; }
.smart-hint {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--violet) 12%, var(--surface));
  color: color-mix(in srgb, var(--violet) 70%, var(--text));
}

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice-row { display: flex; flex-wrap: wrap; gap: 7px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  height: 100%;
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--soft, var(--surface-2));
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.12s, border-color 0.15s;
}
.choice-row .choice > span { min-height: 40px; padding: 6px 12px; }
.choice input:checked + span {
  border-color: var(--c, var(--text));
  background: color-mix(in srgb, var(--c, var(--text)) 22%, var(--surface));
}
.choice input:focus-visible + span { outline: 2px solid var(--c, var(--violet)); outline-offset: 2px; }
.choice:active > span { transform: scale(0.96); }
.swatch > span { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; background: var(--c); }
.swatch input:checked + span { border-color: var(--text); background: var(--c); box-shadow: inset 0 0 0 3px var(--surface); }

.hero-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 28px 20px; }
.hero-emoji { font-size: 56px; }

/* Tab bar */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 496px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(34, 28, 41, 0.14), 0 0 0 1px var(--line);
  z-index: 10;
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 0 6px;
  border-radius: 18px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.tab-icon { font-size: 22px; line-height: 1.1; filter: grayscale(0.6); opacity: 0.75; }
.tab.is-active { background: var(--surface-2); color: var(--text); }
.tab.is-active .tab-icon { filter: none; opacity: 1; }
.tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 26px);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--rose);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* Bottom sheet */
.sheet {
  border: none;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--text);
}
.sheet::backdrop { background: rgba(20, 14, 30, 0.45); }
.sheet[open] { animation: sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh;
  overflow-y: auto;
}
.sheet-handle { align-self: center; width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin-bottom: 6px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head .eyebrow { color: var(--ink); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* Rewards */
#toasts {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  width: calc(100% - 32px);
}
.toast {
  padding: 12px 18px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  transition: opacity 0.4s, transform 0.4s;
  text-align: center;
}
.toast b { color: var(--amber); }
.toast.has-action { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; pointer-events: auto; }
.toast-undo {
  border: none;
  border-radius: 99px;
  padding: 7px 14px;
  font-weight: 800;
  background: color-mix(in srgb, var(--on-primary) 18%, transparent);
  color: var(--on-primary);
  cursor: pointer;
}
.toast.big { font-size: 18px; padding: 14px 22px; background: linear-gradient(90deg, var(--pink), var(--orange)); color: #fff; }
.toast.error { background: var(--rose); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(0.9); } }

.burst {
  position: fixed;
  left: 50%;
  top: 55%;
  font-size: 28px;
  pointer-events: none;
  z-index: 99;
  animation: burst 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes burst {
  0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(1.1) rotate(25deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Nutrition: balance check and household goals */
.food-card { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; background: color-mix(in srgb, var(--lime) 12%, var(--surface)); }
.food-summary { display: flex; flex-direction: column; gap: 10px; }
.food-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.food-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: baseline; }
.food-row .bar { grid-column: 1 / -1; }
.food-label { font-weight: 700; font-size: 15px; }
.food-flag { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; margin-left: 4px; vertical-align: 1px; }
.food-flag.is-low { background: color-mix(in srgb, var(--amber) 25%, var(--surface)); }
.food-flag.is-high { background: color-mix(in srgb, var(--rose) 22%, var(--surface)); }
.food-bar > span { background: var(--lime); }
.food-bar.is-low > span { background: var(--amber); }
.food-bar.is-high > span { background: var(--rose); }
.goal-chip { font: inherit; font-size: 14px; font-weight: 700; padding: 9px 12px; border-radius: 14px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); cursor: pointer; }
.goal-chip.is-on { border-color: var(--lime); background: color-mix(in srgb, var(--lime) 22%, var(--surface)); }
.goal-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.tag-goal { background: color-mix(in srgb, var(--lime) 20%, var(--surface)); }