:root {
  --bg: #f7f4ee;
  --panel: #ffffff;
  --ink: #1f2a37;
  --muted: #6b7280;
  --line: #e7e1d6;
  --soft: #efe9de;
  --brand: #2f6f5e;
  --brand-ink: #ffffff;
  --accent: #f2a65a;
  --danger: #c2413a;
  --good: #2f8f5b;
  --star: #f5b301;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(31, 42, 55, .06), 0 4px 14px rgba(31, 42, 55, .06);
  --tap: 56px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --now: #e35d6a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; }
body { overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { user-select: text; -webkit-user-select: text; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .5; cursor: default; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 104px 1fr; grid-template-rows: auto 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; padding: 14px 24px 10px; }
.clock { font-size: 56px; font-weight: 800; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; }
.clock small { font-size: 22px; font-weight: 700; margin-left: 4px; color: var(--muted); }
.datebox { display: flex; flex-direction: column; line-height: 1.15; }
.datebox .dow { font-size: 22px; font-weight: 800; }
.datebox .full { font-size: 17px; color: var(--muted); font-weight: 600; }
.weather { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-radius: 999px; box-shadow: var(--shadow); font-weight: 700; }
.weather .w-ico { font-size: 30px; }
.weather .w-temp { font-size: 26px; }
.weather .w-range { color: var(--muted); font-size: 15px; }
.topbar .spacer { flex: 1; }
.family-name { font-size: 20px; font-weight: 800; color: var(--brand); }
.top-actions { display: flex; gap: 10px; }
.pill-btn { height: var(--tap); padding: 0 22px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-weight: 800; display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.pill-btn.primary { background: var(--brand); color: var(--brand-ink); }
.pill-btn.magic { background: linear-gradient(135deg, #7c5cd6, #e35d6a); color: #fff; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); font-size: 24px; display: inline-flex; align-items: center; justify-content: center; }

.rail { display: flex; flex-direction: column; gap: 8px; padding: 6px 12px 16px; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 18px; font-weight: 700; font-size: 14px; color: var(--muted); }
.rail button .ico { font-size: 30px; filter: grayscale(.35); }
.rail button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.rail button.on .ico { filter: none; }
.rail .grow { flex: 1; }

.main { overflow: hidden; padding: 0 24px 20px 4px; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0 8px 0 4px; font-size: 28px; font-weight: 800; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 4px; }
.seg button { height: 46px; padding: 0 18px; border-radius: 999px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.nav-btn { width: 50px; height: 50px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); font-size: 22px; font-weight: 800; }
.today-btn { height: 50px; padding: 0 18px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-weight: 800; }
.toolbar .spacer { flex: 1; }

.people { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px 0 6px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-weight: 800; border: 3px solid transparent; }
.chip .av { width: 36px; height: 36px; }
.chip.off { opacity: .4; }
.chip.sel { border-color: currentColor; }
.av { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; color: #fff; }

/* ---------- calendar: week (stacked columns) ---------- */
.week { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-col { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.day-col.today { outline: 3px solid var(--brand); }
.day-col.past { opacity: .72; }
.day-head { padding: 10px 12px 8px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); }
.day-head .dname { font-weight: 800; color: var(--muted); text-transform: uppercase; font-size: 14px; letter-spacing: .5px; }
.day-head .dnum { font-size: 26px; font-weight: 800; }
.day-col.today .dnum { background: var(--brand); color: #fff; border-radius: 12px; padding: 0 8px; }
.day-head .dweather { margin-left: auto; font-size: 14px; color: var(--muted); font-weight: 700; }
.day-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.day-body .meal-line { font-size: 14px; color: var(--muted); font-weight: 700; padding: 4px 6px; border-top: 1px dashed var(--line); margin-top: auto; }
.add-in-day { margin-top: 4px; min-height: 44px; border-radius: 12px; color: var(--muted); font-weight: 800; font-size: 22px; }
.add-in-day:active { background: var(--soft); }

.ev { border-radius: 12px; padding: 8px 10px; background: var(--c-bg, #eef2f7); border-left: 6px solid var(--c, #64748b); text-align: left; width: 100%; display: block; }
.ev .t { font-weight: 800; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.ev .tm { font-size: 13px; font-weight: 700; color: var(--muted); }
.ev .who { display: flex; gap: 3px; margin-top: 4px; }
.ev .who .dot { width: 18px; height: 18px; border-radius: 50%; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.ev.allday { background: var(--c, #64748b); color: #fff; border-left: 0; }
.ev.allday .tm { color: rgba(255,255,255,.85); }
.ev.done { opacity: .5; }

/* ---------- calendar: month ---------- */
.month { flex: 1; min-height: 0; display: grid; grid-template-rows: auto repeat(var(--rows), minmax(0, 1fr)); gap: 6px; }
.month-head, .month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-head div { text-align: center; font-weight: 800; color: var(--muted); font-size: 14px; text-transform: uppercase; }
.mcell { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; overflow: hidden; display: flex; flex-direction: column; gap: 3px; text-align: left; min-height: 0; }
.mcell.other { opacity: .45; }
.mcell.today { outline: 3px solid var(--brand); }
.mcell .n { font-weight: 800; font-size: 16px; }
.mcell .mev { font-size: 13px; font-weight: 700; border-radius: 6px; padding: 1px 6px; background: var(--c-bg); border-left: 4px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell .mev.allday { background: var(--c); color: #fff; border-left: 0; }
.mcell .more { font-size: 12px; color: var(--muted); font-weight: 800; }

/* ---------- calendar: day (time grid) ---------- */
.dayview { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; gap: 14px; }
.timegrid-wrap { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto; position: relative; }
.allday-strip { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 8px 8px 8px 64px; display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.timegrid { position: relative; height: calc(24 * 64px); margin-left: 64px; margin-right: 8px; }
.hour { position: absolute; left: -64px; right: 0; height: 64px; border-top: 1px solid var(--line); }
.hour span { position: absolute; left: 8px; top: -10px; background: var(--panel); padding: 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.slot-ev { position: absolute; border-radius: 10px; padding: 4px 8px; overflow: hidden; background: var(--c-bg); border-left: 5px solid var(--c); text-align: left; }
.slot-ev .t { font-weight: 800; font-size: 15px; }
.slot-ev .tm { font-size: 12px; font-weight: 700; color: var(--muted); }
.now-line { position: absolute; left: -8px; right: 0; height: 2px; background: var(--now); z-index: 2; }
.now-line::before { content: ''; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--now); }
.side-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; overflow-y: auto; }
.side-card h3 { margin: 0 0 10px; font-size: 18px; }

/* ---------- schedule (agenda) ---------- */
.agenda { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.ag-day { display: grid; grid-template-columns: 96px 1fr; gap: 14px; }
.ag-date { text-align: center; padding-top: 6px; }
.ag-date .dname { font-weight: 800; color: var(--muted); text-transform: uppercase; font-size: 14px; }
.ag-date .dnum { font-size: 34px; font-weight: 800; line-height: 1; }
.ag-date.today .dnum { color: var(--brand); }
.ag-list { display: flex; flex-direction: column; gap: 8px; }
.ag-list .ev { padding: 12px 14px; }
.ag-empty { color: var(--muted); font-weight: 700; padding: 10px 0; }

/* ---------- side widgets (countdowns, forecast) ---------- */
.countdowns { display: flex; flex-direction: column; gap: 8px; }
.cd { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--soft); border-radius: 14px; font-weight: 800; }
.cd .e { font-size: 26px; }
.cd .days { margin-left: auto; text-align: right; line-height: 1; }
.cd .days b { font-size: 26px; display: block; }
.cd .days small { color: var(--muted); font-size: 12px; }
.forecast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-weight: 700; font-size: 13px; }
.forecast .fi { font-size: 22px; }

/* ---------- chores ---------- */
.chore-board { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; }
.chore-col { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chore-head { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.chore-head .av { width: 54px; height: 54px; font-size: 28px; }
.chore-head .nm { font-size: 20px; font-weight: 800; }
.chore-head .stars { color: var(--muted); font-weight: 800; font-size: 15px; }
.ring { margin-left: auto; width: 54px; height: 54px; }
.chore-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.chore { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--soft); text-align: left; width: 100%; min-height: 68px; }
.chore .ce { font-size: 30px; }
.chore .ct { font-weight: 800; font-size: 17px; flex: 1; line-height: 1.2; }
.chore .cs { font-size: 13px; color: var(--muted); font-weight: 800; white-space: nowrap; }
.chore .check { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; background: #fff; }
.chore.done { background: color-mix(in srgb, var(--c) 18%, white); }
.chore.done .check { background: var(--c); border-color: var(--c); }
.chore.done .ct { text-decoration: line-through; opacity: .65; }
.tod { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 6px 4px 0; }

/* ---------- rewards ---------- */
.rewards-wrap { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.balances { display: flex; gap: 12px; flex-wrap: wrap; }
.balance { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 220px; }
.balance .av { width: 52px; height: 52px; font-size: 26px; }
.balance .b { font-size: 30px; font-weight: 800; }
.balance .b span { color: var(--star); }
.balance .adj { margin-left: auto; display: flex; gap: 6px; }
.balance .adj button { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); font-weight: 800; font-size: 20px; }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.reward { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.reward .re { font-size: 44px; }
.reward .rt { font-size: 19px; font-weight: 800; }
.reward .rc { font-weight: 800; color: var(--muted); }
.bar { height: 12px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--star); border-radius: 99px; }

/* ---------- lists ---------- */
.lists { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.list-tabs { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.list-tab { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; font-weight: 800; text-align: left; background: transparent; font-size: 18px; }
.list-tab.on { background: var(--panel); box-shadow: var(--shadow); }
.list-tab .cnt { margin-left: auto; background: var(--soft); border-radius: 99px; padding: 2px 10px; font-size: 14px; }
.list-panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; }
.list-add { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.list-add input { flex: 1; height: var(--tap); border-radius: 14px; border: 2px solid var(--line); padding: 0 16px; font-size: 18px; background: var(--bg); }
.items { flex: 1; overflow-y: auto; padding: 8px 14px 14px; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; font-size: 19px; font-weight: 700; min-height: 60px; }
.item .box { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--line); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.item.done { color: var(--muted); }
.item.done .txt { text-decoration: line-through; }
.item.done .box { background: var(--good); border-color: var(--good); }
.item .del { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 20px; }

/* ---------- meals ---------- */
.meals { flex: 1; min-height: 0; overflow: auto; }
.meal-grid { display: grid; grid-template-columns: 120px repeat(7, minmax(140px, 1fr)); gap: 8px; }
.meal-grid .mh { font-weight: 800; text-align: center; padding: 6px; }
.meal-grid .mh.today { color: var(--brand); }
.meal-grid .ms { font-weight: 800; color: var(--muted); display: flex; align-items: center; font-size: 15px; text-transform: capitalize; }
.mealcell { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); min-height: 92px; padding: 8px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.mealcell .mt { font-weight: 800; font-size: 15px; background: var(--soft); border-radius: 10px; padding: 6px 8px; }
.mealcell .plus { color: var(--muted); font-size: 22px; font-weight: 800; margin: auto; }
.recipes { margin-top: 18px; }
.recipe-row { display: flex; gap: 10px; flex-wrap: wrap; }
.recipe { background: var(--panel); box-shadow: var(--shadow); border-radius: 14px; padding: 12px 16px; font-weight: 800; }

/* ---------- photos ---------- */
.photo-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-content: start; }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--soft); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; }

/* ---------- empty states ---------- */
.empty { margin: auto; text-align: center; max-width: 520px; color: var(--muted); font-weight: 700; padding: 30px; }
.empty .big { font-size: 64px; }
.empty h3 { color: var(--ink); font-size: 24px; margin: 8px 0; }

/* ---------- modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.sheet { background: var(--bg); border-radius: 24px; width: min(720px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet.wide { width: min(980px, 100%); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 10px; }
.sheet-head h3 { margin: 0; font-size: 24px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 6px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.sheet-foot .spacer { flex: 1; }
.btn { height: var(--tap); padding: 0 24px; border-radius: 16px; font-weight: 800; font-size: 18px; background: var(--panel); box-shadow: var(--shadow); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { height: 44px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 800; font-size: 15px; color: var(--muted); }
.field input[type=text], .field input[type=date], .field input[type=time], .field input[type=number], .field input[type=password], .field textarea, .field select {
  height: var(--tap); border-radius: 14px; border: 2px solid var(--line); padding: 0 14px; background: var(--panel); font-size: 18px; width: 100%;
}
.field textarea { height: 110px; padding: 12px 14px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; height: var(--tap); }
.toggle input { width: 28px; height: 28px; accent-color: var(--brand); }
.picks { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { height: 48px; min-width: 48px; padding: 0 14px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-weight: 800; border: 3px solid transparent; display: inline-flex; align-items: center; gap: 8px; }
.pick.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, white); }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow); }
.swatch.on { outline: 3px solid var(--ink); }
.note { font-size: 15px; color: var(--muted); font-weight: 600; line-height: 1.45; }
.note code, .copybox code { background: var(--soft); padding: 2px 6px; border-radius: 6px; font-size: 14px; user-select: all; -webkit-user-select: all; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h4 { margin: 0; font-size: 19px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-row .nm { font-weight: 800; flex: 1; }
.err { color: var(--danger); font-weight: 800; }
.okmsg { color: var(--good); font-weight: 800; }
.proposal { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); }
.proposal input[type=checkbox] { width: 28px; height: 28px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.proposal .pt { font-weight: 800; }
.proposal .pd { font-size: 14px; color: var(--muted); font-weight: 700; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 6px solid var(--soft); border-top-color: var(--brand); animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login { height: 100dvh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px; padding: 20px; }
.login h1 { margin: 0; font-size: 32px; }
.dots { display: flex; gap: 14px; height: 24px; }
.dots i { width: 20px; height: 20px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--brand); }
.keypad { display: grid; grid-template-columns: repeat(3, 88px); gap: 14px; }
.keypad button { height: 88px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); font-size: 32px; font-weight: 800; }
.keypad button.ghost { background: transparent; box-shadow: none; font-size: 22px; }

/* ---------- screensaver / night ---------- */
.saver { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; }
.saver img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1.5s ease; }
.saver img.bgfill { object-fit: cover; filter: blur(40px) brightness(.5); transform: scale(1.1); }
.saver img.show { opacity: 1; }
.saver .s-info { position: absolute; left: 40px; bottom: 34px; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.saver .s-clock { font-size: 110px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.saver .s-date { font-size: 32px; font-weight: 700; }
.saver .s-next { font-size: 24px; font-weight: 700; margin-top: 10px; opacity: .9; }
.saver.noimg { background: radial-gradient(circle at 30% 20%, #2f6f5e, #10231e); display: flex; align-items: center; justify-content: center; }
.saver.noimg .s-info { position: static; text-align: center; }
.night { position: fixed; inset: 0; z-index: 90; background: #000; color: #555; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.night .s-clock { font-size: 120px; font-weight: 800; color: #3a3a3a; }

/* ---------- toast & confetti ---------- */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(140%); background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-weight: 800; z-index: 100; transition: transform .25s ease; max-width: calc(100% - 32px); text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); }
.confetti { position: fixed; top: -20px; width: 12px; height: 18px; z-index: 120; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- phones & narrow screens ---------- */
@media (max-width: 900px) {
  :root { --tap: 52px; }
  body { font-size: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .main, .view, .topbar, .toolbar { min-width: 0; }
  .datebox, .cd-chip { display: none; }
  .top-actions .pill-btn { height: 46px; }
  .people { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chip { height: 42px; flex: none; }
  .chip .av { width: 30px; height: 30px; font-size: 16px; }
  .seg button { height: 40px; padding: 0 12px; }
  .today-btn, .nav-btn { height: 44px; }
  .nav-btn { width: 44px; }
  .toolbar { gap: 8px; }
  .topbar { padding: 10px 16px 6px; gap: 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .clock { font-size: 34px; }
  .clock small { font-size: 15px; }
  .datebox .dow { font-size: 17px; }
  .datebox .full { font-size: 14px; }
  .family-name, .weather .w-range { display: none; }
  .weather { padding: 6px 12px; }
  .weather .w-temp { font-size: 20px; }
  .weather .w-ico { font-size: 22px; }
  .top-actions .pill-btn span.lbl { display: none; }
  .top-actions .pill-btn { padding: 0 16px; }
  .main { padding: 0 12px 10px; }
  .rail { grid-row: 3; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--panel); box-shadow: 0 -2px 10px rgba(0,0,0,.06); overflow-x: auto; gap: 0; }
  .rail button { flex: 1; padding: 6px 2px; font-size: 11px; min-width: 0; }
  .rail button .ico { font-size: 24px; }
  .rail button.on { box-shadow: none; background: var(--soft); }
  .rail .grow { display: none; }
  .toolbar h2 { font-size: 21px; width: 100%; order: -1; }
  .week { grid-template-columns: 1fr; grid-auto-rows: max-content; overflow-y: auto; }
  .day-col { min-height: auto; }
  .day-body { overflow: visible; }
  .dayview { grid-template-columns: 1fr; }
  .dayview .side-card { display: none; }
  .lists { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .list-tabs { flex-direction: row; overflow-x: auto; }
  .list-tab { white-space: nowrap; padding: 10px 14px; }
  .chore-board { grid-auto-flow: row; grid-auto-columns: auto; overflow-y: auto; overflow-x: hidden; }
  .chore-col { min-height: auto; }
  .chore-list { overflow: visible; }
  .sheet { border-radius: 22px 22px 0 0; max-height: 92dvh; align-self: flex-end; }
  .backdrop { padding: 0; align-items: flex-end; }
  .ag-day { grid-template-columns: 64px 1fr; }
  .month .mev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; background: var(--c); }
  .mcell .n { font-size: 14px; }
}
