:root {
  --bg: #f2f4f1; --surface: #fff; --fill: #e8ebe7; --ink: #111a15; --muted: #5f6b64;
  --line: rgba(17,26,21,.10); --accent: #1f6b45; --accent-soft: rgba(31,107,69,.10); --on-accent: #fff;
  --warn: #9a5200; --warn-bg: #fff2df; --danger: #c0352b; --check: #1f6b45;
  --bar: rgba(248,250,247,.74); --bar-edge: rgba(255,255,255,.7); --scrim: rgba(10,16,13,.32);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(17,26,21,.05), 0 6px 20px rgba(17,26,21,.06);
  --tabbar-h: 56px; --scale: 1;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0c120f; --surface: #161e19; --fill: #212b25; --ink: #e9efeb; --muted: #97a59d;
  --line: rgba(233,239,235,.10); --accent: #5cc08b; --accent-soft: rgba(92,192,139,.15); --on-accent: #08110c;
  --warn: #f0a53a; --warn-bg: #2a2010; --danger: #ff7b70; --check: #5cc08b;
  --bar: rgba(22,30,25,.74); --bar-edge: rgba(255,255,255,.06); --scrim: rgba(0,0,0,.5); --shadow: none; } }
:root[data-theme="dark"] {
  --bg: #0c120f; --surface: #161e19; --fill: #212b25; --ink: #e9efeb; --muted: #97a59d;
  --line: rgba(233,239,235,.10); --accent: #5cc08b; --accent-soft: rgba(92,192,139,.15); --on-accent: #08110c;
  --warn: #f0a53a; --warn-bg: #2a2010; --danger: #ff7b70; --check: #5cc08b;
  --bar: rgba(22,30,25,.74); --bar-edge: rgba(255,255,255,.06); --scrim: rgba(0,0,0,.5); --shadow: none; }
:root[data-mode="display"] { --scale: 1.3; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(16px * var(--scale)); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.45;
  -webkit-font-smoothing: antialiased; min-height: 100dvh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.hidden { display: none !important; }
.press { transition: transform 100ms ease-out, background-color 150ms ease-out, opacity 150ms; }
.press:active { transform: scale(.97); }

/* Sign-in */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--r-lg); padding: 32px 24px; box-shadow: var(--shadow); }
.mark { font-weight: 700; font-size: 1.75rem; letter-spacing: -0.025em; margin: 0 0 4px; }
.mark span, .side-brand span { color: var(--accent); }
.sub { color: var(--muted); margin: 0 0 24px; }
.err { color: var(--danger); font-size: .875rem; min-height: 1.25rem; margin: 0 0 12px; }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; font-size: 1.0625rem; }

/* Shell: bottom tab bar on phones, sidebar on desktop */
.main { padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); max-width: 680px; margin: 0 auto; }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 4px calc(env(safe-area-inset-bottom) + 2px); background: var(--bar);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--bar-edge); box-shadow: 0 -0.5px 0 var(--line); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 50px; color: var(--muted); font-size: .625rem; font-weight: 600; letter-spacing: .01em; border-radius: var(--r-sm); }
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: .6875rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.side-brand, .side-foot { display: none; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 232px 1fr; }
  .tabbar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: 28px 14px;
    border-top: 0; box-shadow: 0.5px 0 0 var(--line); background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .side-brand { display: block; font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; margin: 0 10px 22px; }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; min-height: 42px; font-size: .9375rem; font-weight: 500; color: var(--ink); }
  .tab svg { width: 21px; height: 21px; color: var(--muted); }
  .tab:hover { background: var(--fill); }
  .tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .tab[aria-current="page"] svg { color: var(--accent); }
  .tab-badge { position: static; margin-left: auto; }
  .side-foot { display: block; margin-top: auto; color: var(--muted); font-size: .8125rem; padding: 0 12px; }
  .main { padding: 36px 40px 48px; max-width: 1180px; margin: 0; }
}

/* Large-title header */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 16px; min-height: 64px; }
.eyebrow { color: var(--muted); font-size: .8125rem; font-weight: 600; margin: 0 0 2px; }
.title { font-size: 2.125rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--accent); flex: none; }
.iconbtn svg { width: 20px; height: 20px; stroke-width: 2.2; }
.pill { height: 38px; padding: 0 14px; border-radius: 999px; background: var(--fill); color: var(--accent); font-weight: 600; font-size: .9375rem; }
.link { color: var(--accent); font-size: .9375rem; font-weight: 500; min-height: 44px; padding: 0 2px; }
.link.strong { font-weight: 700; }

.banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px; font-weight: 500; font-size: .9375rem; }
.section-h { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; margin: 24px 0 8px; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.section-h.first { margin-top: 0; }
.section-h .count { font-size: .875rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.card.gap { margin-top: 24px; }
.today-grid { display: grid; gap: 0 28px; }
@media (min-width: 1100px) { .today-grid { grid-template-columns: 1.35fr 1fr; align-items: start; } }

/* Event rows */
.rows, .items, .list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 4px 60px 1fr; gap: 12px; padding: 12px 16px 12px 12px; position: relative; }
.row + .row::before, .it + .it::before, .list li + li::before { content: ""; position: absolute; top: 0; right: 0; height: .5px; background: var(--line); }
.row + .row::before { left: 88px; }
.bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c, var(--muted)); }
.time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9375rem; }
.time small { display: block; color: var(--muted); font-weight: 400; font-size: .8125rem; }
.ev-title { font-weight: 600; font-size: 1.0625rem; line-height: 1.3; overflow-wrap: anywhere; padding-right: 44px; }
.ev-meta { color: var(--muted); font-size: .8125rem; margin-top: 2px; }
.row.now .time { color: var(--accent); }
.row.now::after { content: "Now"; position: absolute; right: 14px; top: 13px; font-size: .6875rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.row.past { opacity: .5; }
.row.cancelled .ev-title { text-decoration: line-through; }
.empty { color: var(--muted); padding: 16px; margin: 0; font-size: .9375rem; }
.days { display: flex; flex-direction: column; gap: 10px; }
.dayhead { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px 0; font-weight: 700; font-size: .9375rem; }
.dayhead small { color: var(--muted); font-weight: 500; }

/* Checklist items */
.it { position: relative; display: flex; align-items: center; gap: 4px; padding-left: 4px; min-height: 52px; }
.it + .it::before { left: 52px; }
.check { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.check i { width: 24px; height: 24px; border-radius: 50%; border: 1.75px solid color-mix(in srgb, var(--muted) 70%, transparent); display: grid; place-items: center;
  transition: background-color 180ms ease-out, border-color 180ms ease-out, transform 180ms cubic-bezier(.22,1,.36,1); }
.check i svg { width: 14px; height: 14px; stroke-width: 3; color: var(--on-accent); opacity: 0; transform: scale(.5); transition: opacity 150ms, transform 220ms cubic-bezier(.22,1,.36,1); }
.check:active i { transform: scale(.85); }
.it.done .check i { background: var(--check); border-color: var(--check); }
.it.done .check i svg { opacity: 1; transform: none; }
.it-body { flex: 1; min-width: 0; padding: 10px 16px 10px 4px; min-height: 52px; display: flex; flex-direction: column; justify-content: center; }
.it-name { font-size: 1.0625rem; line-height: 1.3; overflow-wrap: anywhere; }
.it.done .it-name { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.it-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8125rem; color: var(--muted); margin-top: 1px; }
.it-meta .due.late { color: var(--danger); font-weight: 600; }
.it-meta .due.today { color: var(--accent); font-weight: 600; }
.who { display: inline-flex; align-items: center; gap: 4px; }
.who b { width: 16px; height: 16px; border-radius: 50%; background: var(--c, var(--muted)); color: #fff; font-size: .5625rem; font-weight: 700; display: grid; place-items: center; text-transform: uppercase; }
.it.leaving { animation: leave 260ms ease-in forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(12px); } }
.it.arriving { animation: arrive 220ms ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } }

/* Shopping shortcut */
.shop { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; }
.shop-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.shop-ic svg { width: 22px; height: 22px; }
.shop-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-txt strong { font-size: 1.0625rem; }
.shop-txt small { color: var(--muted); font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; color: var(--muted); flex: none; }

/* Lists */
.list li { position: relative; }
.list li + li::before { left: 16px; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; font-size: 1.0625rem; }
.item-row .val { color: var(--muted); font-size: .9375rem; }
.item-row.danger { color: var(--danger); justify-content: center; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; }
.lrow .ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.lrow .ic svg { width: 18px; height: 18px; stroke-width: 2; }
.lrow .nm { flex: 1; min-width: 0; font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.lrow[aria-current="true"] { background: var(--accent-soft); }
.adder { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: var(--r-md); padding: 0 14px; margin-bottom: 12px; box-shadow: var(--shadow); min-height: 50px; position: sticky; top: calc(env(safe-area-inset-top) + 6px); z-index: 5; }
.adder { padding-left: 4px; }
.add-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent); flex: none; border-radius: 50%; }
.add-btn svg { width: 22px; height: 22px; stroke-width: 2.4; }
.add-go { min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: .9375rem; flex: none; }
.adder input { flex: 1; border: 0; background: none; outline: none; min-height: 50px; font-size: 1.0625rem; }
.adder:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.done-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 4px 4px; }
.back { display: none; align-items: center; gap: 2px; color: var(--accent); font-size: 1.0625rem; min-height: 44px; margin-left: -6px; }
.back svg { width: 24px; height: 24px; stroke-width: 2.2; }
.detail-head { flex-wrap: wrap; }
.detail-title { flex: 1; min-width: 0; }
.lists-layout { display: grid; }
.lists-index, .list-detail { min-width: 0; }
@media (max-width: 899px) {
  .lists-layout[data-pane="index"] .list-detail, .lists-layout[data-pane="detail"] .lists-index { display: none; }
  .lists-layout[data-pane="detail"] .back { display: inline-flex; flex-basis: 100%; }
  .lists-layout[data-pane="detail"] .list-detail { animation: push 260ms cubic-bezier(.2,.8,.2,1); }
}
@keyframes push { from { opacity: .4; transform: translateX(24px); } }
@media (min-width: 900px) { .lists-layout { grid-template-columns: 300px 1fr; gap: 32px; align-items: start; } .lists-index { position: sticky; top: 36px; } }

/* Month */
.monthbar { display: flex; align-items: center; gap: 6px; }
.cal { padding: 8px 6px 10px; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dow span { text-align: center; font-size: .6875rem; font-weight: 600; color: var(--muted); padding: 4px 0 6px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 50px; padding: 3px 0; border-radius: var(--r-sm); min-width: 0; }
.cell .n { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; font-size: .9375rem; font-weight: 500; }
.cell.out .n { color: var(--muted); opacity: .45; }
.cell.today .n { color: var(--accent); font-weight: 700; }
.cell[aria-selected="true"] .n { background: var(--ink); color: var(--surface); font-weight: 700; }
.cell.today[aria-selected="true"] .n { background: var(--accent); color: var(--on-accent); }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.chips { display: none; }
.cal-layout { display: grid; gap: 20px; }
@media (min-width: 900px) {
  .cal-layout { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
  .cell { min-height: 92px; align-items: stretch; padding: 4px; border-top: .5px solid var(--line); border-radius: 0; }
  .cell .n { width: 28px; height: 28px; font-size: .875rem; align-self: flex-start; }
  .cell:hover { background: var(--fill); }
  .dots { display: none; }
  .chips { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
  .chips span { font-size: .6875rem; line-height: 1.4; padding: 0 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: color-mix(in srgb, var(--c) 18%, transparent); text-align: left; }
  .chips em { font-size: .6875rem; color: var(--muted); font-style: normal; padding-left: 5px; text-align: left; }
  .daypanel { position: sticky; top: 36px; }
}

/* Meals placeholder */
.soon { padding: 22px 20px; }
.soon-h { font-weight: 700; font-size: 1.125rem; margin: 0 0 6px; }
.soon p { margin: 0 0 18px; color: var(--muted); max-width: 52ch; }

/* You */
.switch { width: 51px; height: 31px; border-radius: 999px; background: var(--fill); position: relative; transition: background-color 200ms; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform 300ms cubic-bezier(.22,1,.36,1); }
[aria-checked="true"] .switch { background: var(--accent); }
[aria-checked="true"] .switch::after { transform: translateX(20px); }
.note { color: var(--muted); font-size: .8125rem; margin: 8px 16px 0; }
.n-intro { padding: 16px; border-bottom: .5px solid var(--line); }
.n-h { font-weight: 700; margin: 0 0 4px; }
.n-intro p { margin: 0 0 12px; color: var(--muted); font-size: .9375rem; }
.n-btns { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.n-btns .pill { display: inline-grid; place-items: center; text-decoration: none; }
.n-sub { width: auto; flex: 1; min-height: 44px; }
.n-manual { font-size: .8125rem !important; margin: 0 !important; overflow-wrap: anywhere; }
.n-manual code { font-size: .75rem; background: var(--fill); padding: 1px 5px; border-radius: 4px; }
.pref { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 16px; }
.pref span:first-child { flex: 1; display: flex; flex-direction: column; }
.pref small { color: var(--muted); font-size: .8125rem; }
.it.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } }
.skel { height: 14px; border-radius: 4px; background: var(--fill); margin: 16px; }

/* Sheets: bottom sheet on phones, centred card on desktop */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; background: var(--surface); color: var(--ink);
  border-radius: 14px 14px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.18); }
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { animation: sheet-in 340ms cubic-bezier(.2,.9,.25,1); }
.sheet[open]::backdrop { animation: fade 240ms ease-out; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet-body { padding: 6px 16px calc(env(safe-area-inset-bottom) + 18px); display: flex; flex-direction: column; gap: 14px; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: 2px auto 0; }
.sheet-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.sheet-top h2 { font-size: 1.0625rem; font-weight: 700; margin: 0; }
.sheet-top .link:last-child { justify-self: end; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.fld input { min-height: 48px; padding: 0 12px; border: 0; border-radius: var(--r-md); background: var(--fill); font-size: 1.0625rem; outline: none; width: 100%; }
.fld input:focus { box-shadow: 0 0 0 2px var(--accent); }
.remind-row { display: flex; gap: 10px; align-items: center; }
.remind-row input { flex: 1; }
.rem { display: inline-flex; align-items: center; gap: 3px; }
.rem svg { width: 12px; height: 12px; stroke-width: 2.2; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--fill); font-size: .9375rem; font-weight: 500; }
.chip[aria-checked="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.sheet .item-row.danger { background: var(--fill); border-radius: var(--r-md); }
@media (min-width: 900px) { .sheet { margin: auto; border-radius: 16px; max-width: 460px; } .sheet[open] { animation: pop 220ms cubic-bezier(.2,.9,.25,1); } .grabber { display: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-size: .9375rem; font-weight: 500; z-index: 30;
  display: flex; gap: 14px; align-items: center; transition: opacity 200ms, transform 260ms cubic-bezier(.2,.9,.25,1); pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent-soft); font-weight: 700; color: #8fe0b4; }
@media (min-width: 900px) { .toast { bottom: 24px; left: calc(50% + 116px); } }

.view { animation: view-in 200ms ease-out; }
@keyframes view-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media (prefers-reduced-transparency: reduce) { .tabbar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
