:root {
  color-scheme: light;
  --paper: #fdf7f3;
  --white: #fffefd;
  --sand: #f8efe9;
  --stone: #f2e9e3;
  --ink: #2c2623;
  --muted: #75635e;
  --brand: #894838;
  --coral: #da8d7e;
  --blush: #ffd8d0;
  --mint: #cce8dc;
  --pine: #476257;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #efe6e0;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
input, textarea, select { min-width: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.035em; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { line-height: 1.55; }
small { color: var(--muted); }
[hidden] { display: none !important; }
.app { width: min(100%, 460px); margin: auto; min-height: 100dvh; background: var(--paper); }
.auth-page { min-height: 100dvh; display: grid; align-content: center; padding: 24px 20px; background: var(--paper); }
.auth-panel { width: min(100%, 360px); margin: auto; }
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 42px; }
.auth-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--blush); color: var(--brand); font-size: 21px; }
.auth-panel h1 { max-width: 320px; margin: 10px 0; }
.auth-panel > .subtext { max-width: 300px; margin-bottom: 28px; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; }
.auth-form input { width: 100%; border: 1px solid #eadbd3; border-radius: 13px; padding: 13px; background: var(--white); color: var(--ink); }
.auth-form .primary { width: 100%; margin-top: 5px; }
.auth-panel > small { display: block; margin-top: 18px; text-align: center; line-height: 1.6; }
.auth-switch { display: block; margin: 14px auto 0; padding: 8px 10px; color: var(--brand); font-size: 13px; font-weight: 650; }
.topbar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center;
  gap: 10px; justify-content: space-between; height: 55px; padding: 0 16px;
  background: var(--paper); box-shadow: 0 4px 16px #92594406;
}
.topbar-title { flex: 1; font-weight: 650; line-height: 1.15; }
.topbar-title small { display: block; margin-top: 4px; font-size: 10px; letter-spacing: .07em; }
.topbar-title.center { text-align: center; }
.topbar-title.serif { font-size: 19px; }
.serif, .wordmark, .editorial { font-family: Georgia, "Songti SC", SimSun, serif; }
.wordmark { font-weight: 700; color: var(--brand); letter-spacing: -.055em; font-size: 20px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-button {
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; font-size: 23px; line-height: 1;
}
.icon-button:hover, .icon-button.filled { background: var(--stone); }
.glyph { width: 25px; height: 25px; display: inline-block; flex: none; object-fit: contain; vertical-align: middle; }
.glyph.round { border-radius: 50%; }
.icon-button .glyph { width: 24px; height: 24px; }
.page { padding: 10px 15px 28px; }
.page.with-nav { padding-bottom: 82px; }
.stack { display: grid; gap: 15px; }
.row { display: flex; align-items: center; gap: 9px; }
.split { justify-content: space-between; }
.muted { color: var(--muted); }
.brand { color: var(--brand); }
.positive { color: var(--pine); }
.danger { color: #b12b2b; }
.subtext { color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--pine); font-size: 11px; font-weight: 700; letter-spacing: .085em; }
.pill {
  display: inline-flex; align-items: center; white-space: nowrap; justify-content: center;
  border-radius: 24px; background: var(--stone); padding: 3px 8px; color: var(--muted);
  font-size: 11px; font-weight: 650; line-height: 1.2;
}
.pill.mint { background: var(--mint); color: #34594a; }
.pill.rose { background: var(--blush); color: #a83932; }
.pill.coral { background: #fbb9ab; color: #762f26; }
.card { background: var(--white); border-radius: 17px; padding: 15px; box-shadow: 0 2px 3px #5b382208; }
.soft { background: var(--sand); border-radius: 17px; padding: 15px; }
.primary, .secondary {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: white; border-radius: 80px; padding: 8px 16px; font-weight: 700;
  text-align: center;
}
.primary:hover { background: #763e31; }
.primary .glyph { width: 22px; height: 22px; border-radius: 4px; }
.secondary { background: var(--stone); color: var(--brand); }
.main-action { display: flex; width: 80%; margin: 20px auto 5px; box-shadow: 0 8px 15px #75443521; }
.greeting { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: center; margin-bottom: 14px; }
.greeting h1 { font-size: 24px; }
.greeting h1::before, .section-title.dot::before { content: ""; width: 6px; height: 6px; background: var(--brand); display: inline-block; border-radius: 50%; margin: 0 5px 4px 0; }
.greeting small { display: block; font-size: 12px; margin-top: 2px; }
.alert {
  display: grid; width: 100%; grid-template-columns: 32px minmax(0,1fr) 10px; align-items: start;
  gap: 10px; text-align: left; padding: 12px; margin-bottom: 7px;
  border-radius: 14px; background: var(--stone); box-shadow: 0 1px 2px #5b382207;
}
.alert.urgent { background: var(--blush); }
.alert-icon { display: grid; place-items: center; border-radius: 50%; width: 31px; height: 31px; background: #8a48391b; }
.alert strong { font-size: 14px; }
.alert p { font-size: 12px; color: #6e534b; margin-top: 3px; }
.alert .pill { font-size: 10px; }
.alert.urgent .pill { background: var(--brand); color: white; }
.arrow { color: #9c8680; font-size: 18px; line-height: 1; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 19px 0 12px; }
.section-title small { font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.tile {
  text-align: left; display: flex; flex-direction: column; min-height: 139px; gap: 5px;
  background: var(--white); border-radius: 15px; padding: 11px 12px 12px;
  box-shadow: 0 2px 3px #5b38220a;
}
.tile:hover { background: #fffaf6; }
.tile .glyph { width: 33px; height: 33px; }
.tile h3 { margin-top: 3px; }
.tile .row:first-child { gap: 3px; }
.tile .row:last-child { margin-top: auto; padding-top: 10px; }
.tile .row:last-child small { font-weight: 700; font-size: 10px; }
.tile .subtext { overflow-wrap: anywhere; font-size: 12px; }
.quote { margin-top: 25px; background: var(--sand); border-radius: 15px; padding: 17px; }
.quote small { font-size: 11px; color: var(--brand); font-weight: 700; }
.quote blockquote { margin: 5px 0 0; font-size: 18px; font-weight: 700; font-style: italic; line-height: 1.45; }
.empty-start {
  display: grid; justify-items: start; gap: 10px; background: var(--sand);
  border-radius: 18px; padding: 20px; margin-bottom: 20px;
}
.empty-start h2 { font-size: 20px; }
.empty-start p, .empty-state p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-start-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--mint); color: var(--pine); font-size: 22px; }
.empty-state { display: grid; justify-items: center; gap: 8px; background: var(--white); border-radius: 16px; padding: 24px 17px; text-align: center; }
.empty-state .primary { margin-top: 4px; }
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 4;
  width: min(100%, 460px); padding-bottom: env(safe-area-inset-bottom); display: grid;
  grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid #eee5de;
}
.bottom-nav a { padding: 6px 0 5px; display: grid; justify-items: center; color: #5d4a42; font-size: 11px; font-weight: 600; gap: 1px; }
.bottom-nav a[aria-current] { color: var(--brand); font-weight: 800; }
.bottom-nav .glyph { width: 24px; height: 24px; }
.section-intro { margin: 4px 0 15px; }
.section-intro h1 { margin: 4px 0; }
.tabs { display: flex; gap: 6px; overflow: auto; scrollbar-width: none; padding: 2px 0 4px; }
.tabs button { background: var(--sand); border-radius: 40px; padding: 6px 11px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--brand); color: white; font-weight: 700; }
.task-hero { padding: 20px; }
.task-hero h1 { margin: 11px 0 3px; }
.progress-box { margin-top: 16px; padding: 9px 11px; border-radius: 20px; background: var(--sand); font-size: 12px; }
.progress-track { margin-top: 6px; background: #eee3de; border-radius: 9px; height: 6px; overflow: hidden; }
.progress-track > span { display: block; background: var(--coral); height: 100%; border-radius: inherit; }
.task {
  width: 100%; display: grid; grid-template-columns: 25px 1fr auto; gap: 12px; align-items: center;
  text-align: left; padding: 15px 12px; margin-bottom: 8px;
}
.task.is-next { border-left: 5px solid var(--coral); padding-left: 7px; }
.task .check { display: grid; place-items: center; width: 21px; height: 21px; background: var(--stone); border-radius: 50%; }
.task[aria-pressed="true"] .check { background: var(--pine); color: white; }
.task[aria-pressed="true"] .task-name { text-decoration: line-through; color: var(--muted); }
.task .task-name { display: block; margin-bottom: 3px; overflow-wrap: anywhere; }
.inline-form { display: flex; align-items: center; gap: 7px; background: white; border-radius: 45px; padding: 5px 6px 5px 15px; box-shadow: 0 10px 25px #3923220b; }
.inline-form input { flex: 1; border: 0; background: transparent; padding: 8px 0; }
.inline-form .primary { min-height: 36px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; text-align: center; }
.stats > div { display: grid; gap: 5px; background: var(--white); border-radius: 44px; padding: 10px 4px; font-size: 12px; }
.stats strong { color: var(--pine); font-family: Georgia, SimSun, serif; font-size: 21px; }
.inventory-lines { display: grid; gap: 4px; margin-top: 9px; }
.inventory-lines a { background: var(--sand); border-radius: 25px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 5px; font-size: 13px; }
.search-field { background: var(--sand); border-radius: 25px; display: flex; align-items: center; padding: 4px 12px; gap: 7px; margin-bottom: 12px; }
.search-field input { border: 0; width: 100%; flex: 1; padding: 8px 2px; background: none; }
.list-photo { width: 100%; aspect-ratio: 1.45; object-fit: cover; border-radius: 15px; margin-bottom: 8px; }
.caption-wrap { position: relative; }
.caption-wrap .pill { position: absolute; top: 9px; left: 9px; background: var(--paper); }
.product { display: grid; grid-template-columns: 29% 1fr; gap: 12px; align-items: start; }
.product img.photo { width: 100%; aspect-ratio: .9; object-fit: cover; border-radius: 16px; }
.product > .glyph { width: 100%; height: auto; aspect-ratio: .9; border-radius: 16px; background: var(--sand); }
.pantry-cover { width: 84px; height: 84px; flex: none; object-fit: cover; border-radius: 50%; }
.product h3 { margin: 5px 0; }
.quantity { display: inline-flex; gap: 7px; align-items: center; margin-top: 8px; padding: 3px; border-radius: 25px; background: var(--stone); white-space: nowrap; }
.quantity button { width: 26px; height: 26px; background: white; border-radius: 50%; }
.quantity button:disabled { opacity: .4; cursor: default; }
.meal-card { border-radius: 26px; }
.meal-card img { width: 75px; height: 75px; object-fit: cover; border-radius: 8px; }
.meal-photo {
  width: 75px; height: 94px; flex: none; position: relative; overflow: hidden; display: grid;
  place-content: center; justify-items: center; gap: 3px; border-radius: 12px;
  background: #eeeae7; color: #77655d; font-size: 21px;
}
.meal-photo img.meal-image { width: 75px; height: 75px; object-fit: cover; border-radius: 8px; }
.meal-photo small { font-size: 10px; }
.meal-info { flex: 1; min-width: 0; }
.meal-info .row:first-child { flex-wrap: wrap; }
.meal-amount { font-size: 29px; color: var(--brand); font-weight: 800; }
.meal-amount small { font-size: 13px; color: inherit; font-style: italic; }
.meal-items { border-top: 1px solid #edded8; padding-top: 5px; margin-top: 4px; }
.mood-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 10px 0; }
.mood-grid button { background: #ffffff90; padding: 7px 2px; border: 1px solid transparent; border-radius: 11px; display: grid; justify-items: center; gap: 4px; font-size: 10px; white-space: nowrap; }
.mood-grid button[aria-pressed="true"] { border-color: #d9a599; background: var(--white); color: var(--brand); font-weight: 700; }
.mood-grid .weather { font-size: 21px; color: var(--brand); }
.mood-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.mood-tags .pill[aria-pressed] { padding: 7px 9px; background: var(--white); }
.mood-tags .pill[aria-pressed="true"] { background: var(--mint); color: var(--pine); }
.journal-lines { display: grid; gap: 8px; margin-top: 9px; }
.journal-lines label { display: grid; grid-template-columns: auto 1fr; gap: 8px; background: var(--sand); border-radius: 14px; padding: 9px; }
.journal-lines textarea { border: 0; background: transparent; color: var(--ink); resize: vertical; min-height: 43px; font-size: 13px; }
.photo-pick { cursor: pointer; min-height: 125px; border: 1px dashed #dbac9f; background: #fbf4ef; border-radius: 25px; display: grid; gap: 5px; align-content: center; justify-items: center; padding: 14px; text-align: center; }
.photo-pick .glyph { width: 29px; height: 29px; }
.photo-pick img.preview { max-height: 150px; width: 100%; object-fit: contain; }
.note-composer { display: grid; gap: 10px; }
.note-composer textarea, .sheet textarea, .sheet input:not([type="checkbox"]), .sheet select { padding: 12px; border: 1px solid #eadbd3; background: #fbf5f1; color: var(--ink); border-radius: 13px; width: 100%; }
.note-composer textarea { min-height: 80px; resize: vertical; border: 0; }
.note-entry .list-photo { aspect-ratio: 2; }
.note-entry .like { font-size: 24px; line-height: 1; color: var(--brand); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); justify-items: center; text-align: center; gap: 6px 2px; margin-top: 13px; }
.calendar-grid button { width: min(100%, 34px); aspect-ratio: 1; border-radius: 50%; font-size: 12px; }
.calendar-grid button.prediction { background: #fce5df; }
.calendar-grid button.logged { background: #ecd9d2; color: var(--brand); }
.calendar-grid button[aria-pressed="true"] { background: var(--brand); color: white; }
.legend { display: flex; justify-content: space-around; gap: 6px; font-size: 10px; color: var(--muted); margin-top: 12px; }
.mini-chart { display: flex; height: 70px; align-items: end; gap: 7px; margin-top: 9px; }
.mini-chart span { width: 25%; background: var(--mint); border-radius: 10px 10px 0 0; }
.mini-chart span:last-child { background: #bd9389; }
.sheet { margin: auto auto 0; width: min(100%, 460px); border: 0; border-radius: 24px 24px 0 0; padding: 18px 16px max(20px, env(safe-area-inset-bottom)); background: var(--paper); color: var(--ink); box-shadow: 0 -10px 35px #5b382235; }
.sheet::backdrop { background: #33262255; }
.sheet form { display: grid; gap: 12px; }
.sheet label:not(.photo-pick) { display: grid; gap: 5px; font-size: 13px; }
.sheet .primary { justify-self: stretch; }
.toast { position: fixed; z-index: 8; left: 50%; bottom: 72px; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 24px; padding: 10px 17px; text-align: center; font-size: 13px; max-width: 88vw; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.search-results { display: grid; gap: 5px; max-height: 50dvh; overflow: auto; }
.search-results a { padding: 10px; background: white; border-radius: 12px; }

@media (min-width: 560px) {
  .app { box-shadow: 0 0 50px #4d352317; }
}
@media (max-width: 350px) {
  .page { padding-inline: 11px; }
  .topbar { padding-inline: 10px; gap: 5px; }
  .tile { padding-inline: 8px; }
  .tile .pill { padding-inline: 5px; font-size: 10px; }
}
