:root {
  color-scheme: light;
  font-family: "Aptos", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #222c22;
  background: #f7f8f3;
  font-synthesis: none;
  --paper: #fff;
  --ink: #222c22;
  --muted: #526050;
  --forest: #263f30;
  --moss: #395143;
  --lime: #d8ed9a;
  --soft: #eef3e5;
  --border: #dfe5d9;
  --warm: #fff1e6;
  --danger: #8f3029;
  --radius: 23px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #699357; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.35rem, 7vw, 4rem); line-height: .98; letter-spacing: -.065em; }
h2 { font-size: 1.23rem; letter-spacing: -.035em; }
h3 { font-size: 1rem; letter-spacing: -.02em; }
a { color: inherit; }
svg { width: 21px; height: 21px; flex: 0 0 auto; vertical-align: middle; }
.app { max-width: 1040px; min-height: 100vh; margin: 0 auto; }
.loading { padding: 30px; color: var(--muted); }
.header { display: flex; justify-content: space-between; align-items: center; padding: 20px 25px 14px; gap: 12px; }
.brand, .identity { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 1.18rem; letter-spacing: -.06em; }
.brand-mark { background: var(--forest); color: var(--lime); border-radius: 13px; display: grid; place-items: center; width: 40px; height: 40px; }
.identity { font-size: .9rem; color: var(--muted); font-weight: 650; }
.avatar { display: grid; place-items: center; background: var(--soft); color: var(--forest); width: 32px; height: 32px; border-radius: 50%; }
main { padding: 16px 25px 105px; }
.hero { padding: clamp(24px, 5vw, 47px); display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; background: var(--forest); color: #fff; border-radius: 31px; }
.hero p { margin-top: 12px; color: #e4ecdd; line-height: 1.45; }
.eyebrow { display: block; color: var(--lime); letter-spacing: .13em; font-weight: 750; font-size: .69rem; text-transform: uppercase; margin-bottom: 11px; }
.hero .button { flex-shrink: 0; }
.section { margin-top: 25px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.section-title p { margin-top: 4px; }
.muted { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.panel { padding: 17px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 13px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; border: 1px solid transparent; text-decoration: none; font-weight: 700; }
.button { padding: 9px 14px; background: var(--forest); color: #fff; text-align: center; }
.button.lime { background: var(--lime); color: var(--ink); }
.button.secondary, .icon-button { background: var(--soft); color: var(--forest); }
.button.ghost { background: transparent; border-color: var(--border); color: var(--forest); }
.button.danger { background: #f9e8e3; color: var(--danger); }
.icon-button { padding: 0; width: 44px; flex: 0 0 44px; }
.icon-button:hover, .button.secondary:hover { background: #e1ead7; }
.button.lime:hover { background: #e3f1b4; }
.button:not(.lime):not(.secondary):not(.ghost):not(.danger):hover { background: var(--moss); }
.nav-shell { position: fixed; z-index: 2; left: 0; right: 0; bottom: 0; padding: 8px 14px max(8px, env(safe-area-inset-bottom)); pointer-events: none; background: linear-gradient(transparent, #f7f8f3 28%); }
.nav { pointer-events: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 466px; margin: 0 auto; padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 4px 23px #263f301a; }
.nav button { padding: 5px 2px; min-height: 52px; border: 0; background: transparent; color: var(--muted); display: grid; justify-items: center; align-content: center; gap: 4px; border-radius: 16px; font-size: .77rem; font-weight: 750; }
.nav button[aria-current="page"] { background: var(--lime); color: var(--ink); }
.week-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.week-controls .week-label { text-align: center; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.day { display: grid; align-content: start; gap: 6px; padding: 9px; min-width: 0; background: #f7f8f4; border: 1px solid var(--border); border-radius: 14px; }
.day.today { border-color: #8ba37f; background: var(--soft); }
.day time { font-size: .78rem; color: var(--muted); font-weight: 750; }
.slot { width: 100%; text-align: left; color: var(--forest); background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 7px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.slot.filled { background: #e2edda; border-color: #cfddc7; }
.slot small { color: var(--muted); font-size: .68rem; }
.slot strong { font-size: .78rem; line-height: 1.2; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 8px; }
.recipe { min-height: 72px; display: flex; justify-content: space-between; align-items: center; text-align: left; gap: 10px; background: #fff; border: 1px solid var(--border); color: var(--ink); border-radius: 15px; padding: 10px 13px; }
.recipe:hover { background: var(--soft); }
.recipe .muted { display: block; margin-top: 3px; }
.add-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .45fr) auto; gap: 7px; }
input:not([type="checkbox"]), textarea, select { width: 100%; border: 1px solid #cad6c7; background: #fff; color: var(--ink); border-radius: 11px; padding: 9px 11px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { accent-color: var(--forest); width: 20px; min-height: auto; height: 20px; margin: 0; flex: 0 0 20px; }
.shopping-list, .activity, .budget-list { padding: 0; margin: 0; list-style: none; }
.aisle-heading { margin: 15px 0 2px; color: var(--muted); font-size: .77rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.shopping-row, .activity-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--border); min-height: 50px; overflow-wrap: anywhere; }
.shopping-row:last-child, .activity-row:last-child { border-bottom: 0; }
.shopping-row label, .check-row { display: flex; align-items: center; gap: 11px; min-height: 44px; cursor: pointer; }
.shopping-row label { flex: 1 1 auto; }
.shopping-row.done label span { color: var(--muted); text-decoration: line-through; }
.shopping-row .icon-button { background: transparent; }
.shopping-row .icon-button:hover { background: var(--soft); }
.summary { display: grid; gap: 8px; align-content: start; }
.summary .metric { font-size: clamp(1.55rem, 6vw, 2.55rem); font-weight: 790; letter-spacing: -.06em; line-height: 1.04; }
.summary .metric-label { color: var(--muted); font-weight: 700; font-size: .79rem; }
.summary.balance { background: #e8efdd; }
.period { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.period strong { text-transform: capitalize; text-align: center; }
.budget-list li { display: grid; gap: 5px; padding: 7px 0; }
.budget-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: .9rem; }
.budget-line strong { text-align: right; }
progress { appearance: none; width: 100%; height: 7px; border: 0; border-radius: 10px; background: var(--soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--soft); }
progress::-webkit-progress-value { background: #5e8252; border-radius: 10px; }
progress::-moz-progress-bar { background: #5e8252; border-radius: 10px; }
.over { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.activity-row { width: 100%; min-height: 58px; background: transparent; padding: 7px 0; color: var(--ink); border: 0; text-align: left; }
.activity li:not(:last-child) { border-bottom: 1px solid var(--border); }
.activity-row:hover { color: #41603c; }
.activity-row span { display: block; }
.activity-row > strong { flex-shrink: 0; }
.activity-row .muted { font-size: .78rem; margin-top: 4px; }
.empty { padding: 6px 0; }
dialog { width: min(calc(100% - 24px), 480px); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--border); border-radius: 23px; padding: 20px; background: #fff; color: var(--ink); }
dialog::backdrop { background: #18251ab3; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-grid { display: grid; gap: 11px; }
.form-grid label:not(.check-row) { display: grid; gap: 5px; font-size: .88rem; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 4px; }
.form-error { color: var(--danger); line-height: 1.4; font-size: .88rem; }
.login { max-width: 440px; margin: 6vh auto 0; padding: 20px; }
.login .hero { align-items: flex-start; flex-direction: column; }
.login .panel { margin-top: 13px; }
.toast { position: fixed; bottom: max(84px, calc(env(safe-area-inset-bottom) + 77px)); left: 50%; transform: translateX(-50%); z-index: 3; width: max-content; max-width: calc(100% - 30px); padding: 10px 15px; border-radius: 13px; background: #172b1f; color: #fff; font-size: .88rem; }
@media (max-width: 740px) {
  .week-grid { grid-template-columns: 1fr; }
  .day { grid-template-columns: minmax(66px, .6fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}
@media (max-width: 560px) {
  .header { padding: 13px 14px 7px; }
  .identity > span:not(.avatar) { display: none; }
  main { padding: 10px 13px 100px; }
  .hero { border-radius: 24px; align-items: flex-start; flex-direction: column; gap: 13px; }
  .panel { padding: 13px; border-radius: 17px; }
  .two { grid-template-columns: 1fr; gap: 8px; }
  .add-form { grid-template-columns: minmax(0, 1fr) auto; }
  .add-form select { grid-row: 2; grid-column: 1 / -1; }
  .section { margin-top: 19px; }
}

/* Keep the primary actions close to the list on a phone. */
#main { display: block; }
#main .hero { padding: 18px 20px; border-radius: 20px; gap: 12px; }
#main h1 { font-size: 2rem; letter-spacing: -.045em; }
#main .hero p { margin-top: 6px; font-size: .9rem; }
#main .eyebrow { margin-bottom: 6px; }
#main > .button { margin-top: 10px; }
.section { margin-top: 16px; }
.add-form { grid-template-columns: minmax(0, 1fr) 90px; }
.add-form input[name="item"] { grid-column: 1; grid-row: 1; }
.add-form .quantity-input { grid-column: 2; grid-row: 1; }
.add-form select { grid-column: 1; grid-row: 2; }
.add-form > button { grid-column: 2; grid-row: 2; padding: 8px; }
.add-form datalist { display: none; }
.item-quantity { display: block; text-decoration: none; }
.shopping-row label { min-width: 0; }
.shopping-row .button { font-size: .77rem; padding: 5px 8px; }
.sync-status { display: block; margin: 0 auto; border: 1px solid var(--border); border-radius: 12px; background: var(--warm); color: var(--ink); padding: 9px 16px; }
.toast .button { margin-left: 8px; }
@media (max-width: 560px) {
  .hero .button { width: 100%; }
  .section-title { flex-wrap: wrap; }
}