:root {
  --bg: #FBF7F0;
  --card: #FFFFFF;
  --card-2: #F5F0E6;
  --line: #ECE5D8;
  --text: #2B2A28;
  --muted: #8A857C;
  --accent: #F28C5B;
  --accent-text: #FFFFFF;
  --warn: #F5A524;
  --now: #F25C54;
  --tint: 0.16;
  --shadow: 0 1px 2px rgba(60, 45, 20, .06), 0 4px 14px rgba(60, 45, 20, .06);
  --radius: 16px;
  --hour: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1C1D21;
  --card-2: #26272C;
  --line: #303237;
  --text: #F2F2F4;
  --muted: #9A9CA3;
  --accent: #F49A6E;
  --tint: 0.30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 600 16px/1.35 Nunito, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px 8px; flex-wrap: wrap; }
.today { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.today-date { font-size: clamp(22px, 3vw, 38px); font-weight: 800; letter-spacing: -.01em; }
.today-clock { font-size: clamp(18px, 2.2vw, 28px); color: var(--muted); font-weight: 700; }
.top-actions { display: flex; gap: 10px; align-items: center; }

.icon-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 22px; display: grid; place-items: center; }
.pill-btn { height: 48px; padding: 0 18px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; }
.pill-btn.warn { background: var(--warn); color: #2B2A28; }
.add-btn { height: 52px; padding: 0 24px; border-radius: 26px; background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 18px; box-shadow: var(--shadow); }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 24px 12px; flex-wrap: wrap; }
.nav-group { display: flex; align-items: center; gap: 8px; }
.range-label { font-size: 20px; font-weight: 800; margin-left: 8px; }
.seg { display: flex; background: var(--card-2); border-radius: 24px; padding: 4px; }
.seg button { height: 40px; padding: 0 16px; border-radius: 20px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.member-filter { display: flex; gap: 8px; flex-wrap: wrap; }

.avatar { --c: #888; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: 17px; flex: none; transition: opacity .15s, transform .15s; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.off { opacity: .3; }
.avatar.sel { outline: 3px solid var(--text); outline-offset: 2px; }

.banner { margin: 0 24px 8px; padding: 10px 16px; border-radius: 12px; background: var(--card-2); color: var(--muted); }

main { flex: 1; min-height: 0; padding: 0 24px 20px; display: flex; flex-direction: column; }

/* Events */
.ev { --c: #888; --c-rgb: 136,136,136; background: rgba(var(--c-rgb), var(--tint)); border-left: 5px solid var(--c); border-radius: 10px; padding: 6px 10px; text-align: left; overflow: hidden; width: 100%; display: block; }
.ev .t { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.ev .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--d); }
.ev.pending { opacity: .55; border-left-style: dashed; background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(var(--c-rgb), .12) 8px 16px); }

/* Time grid (day + week) */
.grid-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.grid-head, .grid-allday { display: grid; grid-template-columns: 64px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.grid-head > div { padding: 10px 8px; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; min-width: 0; }
.grid-head .dnum { font-size: 22px; }
.grid-head .is-today { color: var(--accent); }
.grid-allday > div { padding: 4px; display: flex; flex-direction: column; gap: 4px; min-height: 8px; }
.grid-allday > div:first-child { font-size: 12px; color: var(--muted); align-items: flex-end; justify-content: center; padding-right: 8px; }
.grid-scroll { flex: 1; overflow-y: auto; position: relative; }
.grid-body { padding-top: 10px; display: grid; grid-template-columns: 64px repeat(var(--cols), minmax(0, 1fr)); position: relative; }
.hours > div { height: var(--hour); font-size: 12px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-8px); }
.col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); }
.col .ev { position: absolute; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

/* Month */
.month { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(0, 1fr)); gap: 6px; }
.month .dow { text-align: center; color: var(--muted); font-weight: 800; padding: 4px; }
.mcell { background: var(--card); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; text-align: left; box-shadow: var(--shadow); min-height: 0; }
.mcell.other { opacity: .45; }
.mcell .n { font-weight: 800; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.mcell.today .n { background: var(--accent); color: var(--accent-text); }
.mcell .ev { padding: 2px 6px; font-size: 13px; border-left-width: 4px; }
.mcell .more { font-size: 12px; color: var(--muted); font-weight: 800; padding-left: 4px; }

/* Agenda */
.agenda { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.aday { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.aday h3 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.aday.today h3 { color: var(--accent); }
.aday .ev { margin-bottom: 8px; padding: 10px 14px; }
.aday .empty { color: var(--muted); }

/* Dialog */
dialog { border: 0; padding: 0; border-radius: 22px; background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(20, 15, 10, .45); }
.dlg-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-body h2 { margin: 0; font-size: 24px; font-weight: 800; }
.dlg-body h3 { margin: 8px 0 0; font-size: 16px; font-weight: 800; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-size: 14px; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); padding: 0 14px; }
.field textarea { height: 80px; padding: 10px 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { --c: #888; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 26px; background: var(--card-2); font-weight: 700; }
.chip.on { background: var(--c); color: #fff; }
.chip .avatar { width: 32px; height: 32px; font-size: 13px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.btn { height: 50px; padding: 0 22px; border-radius: 25px; font-weight: 800; background: var(--card-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { background: #F25C54; color: #fff; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.toggle input { width: 24px; height: 24px; accent-color: var(--accent); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card-2); border-radius: 12px; }
.list-item .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.f { background: var(--text); border-color: var(--text); }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.pad button { height: 76px; border-radius: 50%; background: var(--card-2); font-size: 28px; font-weight: 800; }
.pin-err { text-align: center; color: #F25C54; min-height: 22px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 14px 22px; border-radius: 26px; font-weight: 800; box-shadow: var(--shadow); z-index: 10; }

/* Chores */
.nudge { margin: 0 24px 8px; padding: 12px 18px; border-radius: 14px; background: rgba(242, 140, 91, var(--tint)); color: var(--text); font-weight: 800; text-align: left; }
.chores { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.chore-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 18px; }
.chore-bar .pill-btn { margin-left: auto; }
.free-tag { padding: 8px 14px; border-radius: 20px; background: var(--card-2); }
.check-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.check-panel h3 { margin: 0; font-size: 18px; font-weight: 800; }
.check-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-row .grow { flex: 1; min-width: 160px; font-weight: 700; }
.kid-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kid-col { --c: #888; --c-rgb: 136,136,136; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.kid-col header { display: flex; align-items: center; gap: 12px; font-size: 20px; }
.kid-col header .grow { flex: 1; min-width: 0; }
.kid-col header .muted { font-size: 15px; }
.closer-badge { font-size: 24px; }
.chore, .step, .choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 68px; padding: 10px 14px; border-radius: 14px; background: rgba(var(--c-rgb), var(--tint)); }
.ci { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--card); }
.chore .grow, .step .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ct { font-size: 18px; font-weight: 800; }
.cs { font-size: 14px; color: var(--muted); }
.chore.check, .chore.pass { opacity: .7; }
.chore.done, .chore.passed { opacity: .5; }
.chore.done .ct, .chore.passed .ct { text-decoration: line-through; }
.tick { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; }
.chore.glow { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(var(--c-rgb), .45); } }
@media (prefers-reduced-motion: reduce) { .chore.glow { animation: none; box-shadow: 0 0 0 3px rgba(var(--c-rgb), .45); } }
.all-done { text-align: center; font-weight: 800; padding: 6px; }
.chore-head { --c: #888; --c-rgb: 136,136,136; display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: rgba(var(--c-rgb), var(--tint)); }
.chore-head .ci { width: 60px; height: 60px; font-size: 34px; }
.steps, .choices { display: flex; flex-direction: column; gap: 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { flex-direction: column; text-align: center; justify-content: center; font-weight: 800; min-height: 120px; --c-rgb: 242,140,91; }
.step { --c-rgb: 242,140,91; }
.step .muted { font-size: 14px; }
.step .box { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 3px solid var(--muted); display: grid; place-items: center; font-weight: 800; }
.step.on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.big-done { height: 64px; font-size: 20px; }
.btn:disabled { opacity: .5; cursor: default; }
.cheer { text-align: center; display: flex; flex-direction: column; gap: 8px; padding: 20px 0; }
.cheer .big { font-size: 96px; line-height: 1; animation: pop .5s cubic-bezier(.16, 1, .3, 1); }
.cheer h2 { font-size: 34px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cheer .big { animation: none; } }

/* Weather and countdowns */
.weather { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px 0 10px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); font-size: clamp(18px, 2vw, 24px); }
.weather .wi { font-size: 1.3em; }
.weather .hl { font-size: .7em; color: var(--muted); font-weight: 700; }
.countdowns { display: flex; gap: 10px; padding: 0 24px 10px; overflow-x: auto; scrollbar-width: none; }
.cd { flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 16px 6px 6px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); text-align: left; max-width: 300px; }
.cd .ci { width: 44px; height: 44px; font-size: 24px; background: var(--card-2); }
.cd .grow { display: flex; flex-direction: column; min-width: 0; }
.cd-t { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-n { font-size: 14px; color: var(--muted); font-weight: 700; }
.cd.party { background: var(--accent); color: var(--accent-text); }
.cd.party .cd-n { color: inherit; }
.cd.party .ci { background: rgba(255, 255, 255, .25); }
.forecast { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; }
.fday { display: flex; flex-direction: column; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--card-2); }
.fday .wi { font-size: 32px; }

/* Meals */
.meals { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.meal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.meal { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-align: left; min-height: 220px; }
.meal.today { outline: 3px solid var(--accent); }
.meal-day { font-weight: 800; font-size: 17px; }
.meal img, .meal-ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--card-2); }
.meal-ph { display: grid; place-items: center; font-size: 36px; color: var(--muted); }
.meal-t { font-weight: 800; font-size: 17px; line-height: 1.25; }
.meal.empty .meal-t { color: var(--muted); font-weight: 700; }
.recipe-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; }
.ingredients { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding: 4px 0; }

/* Lists */
.lists { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 16px; align-items: start; }
.list-tabs { display: flex; flex-direction: column; gap: 8px; }
.list-tab { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px 8px 8px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); text-align: left; font-size: 18px; font-weight: 800; }
.list-tab .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-tab .ci { background: var(--card-2); }
.list-tab.on { background: var(--accent); color: var(--accent-text); }
.list-tab.on .ci { background: rgba(255, 255, 255, .25); }
.list-tab .count { font-size: 15px; opacity: .8; }
.list-tab.add { justify-content: center; color: var(--muted); background: var(--card-2); box-shadow: none; }
.list-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; max-height: 100%; overflow-y: auto; }
.list-card header { display: flex; align-items: center; gap: 12px; }
.list-card header h2 { flex: 1; margin: 0; font-size: 26px; }
.list-card h3 { margin: 12px 0 2px; font-size: 15px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.add-item { display: flex; gap: 10px; margin-bottom: 4px; }
.add-item input { flex: 1; min-width: 0; height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); padding: 0 16px; font-size: 18px; }
.add-item .btn { height: 56px; }
.item { display: flex; align-items: center; gap: 8px; }
.item-check { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 10px; border-radius: 12px; text-align: left; font-size: 19px; font-weight: 700; }
.item-check:active { background: var(--card-2); }
.item-check .box { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 3px solid var(--line); display: grid; place-items: center; font-weight: 800; }
.item.done .box { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.item.done .grow { text-decoration: line-through; color: var(--muted); }
.item-del { box-shadow: none; background: transparent; color: var(--muted); flex: none; }
.done-head { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.done-head .pill-btn { height: 40px; box-shadow: none; background: var(--card-2); }
.list-card .empty { padding: 18px 4px; }

.pill-btn.instacart { background: #0AAD0A; color: #fff; }
.qr { width: min(320px, 70vw); margin: 8px auto; padding: 10px; background: #fff; border-radius: 16px; }
.qr svg { display: block; width: 100%; height: auto; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-text); }

/* Small screens: Echo Show 5 and phones */
@media (max-width: 720px) {
  .top, .toolbar { padding-left: 14px; padding-right: 14px; }
  main { padding: 0 14px 14px; }
  .banner, .nudge { margin: 0 14px 8px; }
  .kid-cols { grid-template-columns: 1fr; }
  .lists { grid-template-columns: 1fr; }
  .meal-grid { grid-template-columns: 1fr; }
  .meal { flex-direction: row; align-items: center; min-height: 0; }
  .meal img, .meal-ph { width: 96px; flex: none; }
  .meal-day { width: 64px; flex: none; }
  .countdowns { padding: 0 14px 8px; }
  .weather .hl { display: none; }
  .list-tabs { flex-direction: row; overflow-x: auto; }
  .list-tab { flex: none; min-height: 52px; }
  .add-btn { height: 48px; padding: 0 16px; }
  .icon-btn { width: 42px; height: 42px; font-size: 19px; }
  .range-label { font-size: 17px; }
  .member-filter .avatar { width: 36px; height: 36px; font-size: 14px; }
  .grid-head, .grid-allday, .grid-body { grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .grid-head > div { font-size: 14px; gap: 4px; padding: 8px 4px; }
  .grid-head .avatar { display: none; }
  .mcell .ev { display: none; }
  .mcell .dotrow { display: flex; }
}
.mcell .dotrow { display: none; gap: 3px; flex-wrap: wrap; }
.mcell .dotrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--d); }
#tabSeg button { height: 48px; padding: 0 22px; font-size: 18px; font-weight: 800; }
@media (max-width: 720px) { #tabSeg { width: 100%; } #tabSeg button { flex: 1; padding: 0 6px; font-size: 16px; } }

/* Photo frame */
.frame { position: fixed; inset: 0; z-index: 50; background: #000; overflow: hidden; cursor: pointer; }
.frame-bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(40px) brightness(.55); }
.frame-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1.5s ease; }
.frame-img.on { opacity: 1; animation: drift 20s linear both; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .frame-img.on { animation: none; } .frame-img { transition: none; } }
.frame-info { position: absolute; left: 40px; bottom: 36px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 6px; }
.frame-clock { font-size: 88px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.frame-date { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.frame-ev { font-size: 24px; font-weight: 600; display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.35); padding: 6px 14px; border-radius: 999px; width: fit-content; }
.frame-ev .dots { display: flex; gap: 4px; }
.frame-ev .dots i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; }

/* Assistant */
.ask-btn { background: var(--card-2); }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.bubble { padding: 10px 14px; border-radius: 16px; max-width: 85%; line-height: 1.35; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 4px; }
.bubble.thinking { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .bubble.thinking { animation: none; } }
.ask-row { display: flex; gap: 8px; align-items: center; }
.ask-row input { flex: 1; min-width: 0; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 0 12px; font: inherit; font-size: 17px; }
#askMic.on { background: #EF4444; color: #fff; }

/* Magic import */
.magic-btn { display: flex; justify-content: center; background: var(--card-2); }
.import-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; }
.import-card textarea { height: auto; min-height: 64px; width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 8px; font: inherit; }
.done-line { font-weight: 700; }
.cd.done .cd-n { color: var(--accent); }
a.list-item { color: inherit; text-decoration: none; }
/* Schoology page */
.school { padding: 0 24px 24px; }
.school-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.school-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.school-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; }
.school-card h3 { margin: 0 0 10px; }
.school-card.alert { box-shadow: inset 0 0 0 2px #E5484D, var(--shadow); }
.school .day-label { font-weight: 800; color: var(--muted); margin: 10px 0 6px; }
.school .tag.bad { flex: none; font-size: 13px; font-weight: 800; color: #fff; background: #E5484D; border-radius: 10px; padding: 3px 8px; }
.school .score { flex: none; font-size: 18px; margin-left: 8px; }
.bad-text { color: #E5484D; }
@media (max-width: 600px) { .school { padding: 0 16px 16px; } .school-grid { grid-template-columns: 1fr; } }

/* Header fits every screen: labels drop on narrow or short screens, buttons keep their icons. */
#tabSeg [data-tab="chores"].due::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.top-actions { flex-wrap: nowrap; }
@media (max-width: 720px), (max-height: 600px) {
  .top-actions .btn-lbl { display: none; }
  .ask-btn, #pendingBtn { padding: 0 14px; }
  .add-btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 24px; }
  #themeBtn { display: none; }
}
@media (max-width: 720px) {
  .top { gap: 10px; padding-top: 12px; }
  .top-actions { width: 100%; justify-content: space-between; }
}
/* Echo Show 5 and other short landscape screens: one header row, calendar gets the rest. */
@media (max-height: 600px) and (min-width: 721px) {
  .top { flex-wrap: nowrap; gap: 10px; padding: 8px 16px 4px; }
  .today { gap: 8px; }
  .today-date { font-size: 20px; white-space: nowrap; }
  .today-clock, .weather .hl { display: none; }
  #tabSeg button { height: 40px; padding: 0 12px; font-size: 15px; }
  .icon-btn, .pill-btn, .add-btn { height: 40px; }
  .icon-btn, .add-btn { width: 40px; font-size: 18px; }
  .countdowns { display: none !important; }
  .toolbar { padding: 4px 16px 6px; }
  .member-filter { display: none; }
  .seg button { height: 34px; }
}

/* Wall screen pairing code */
.pair-code { font-size: 64px; font-weight: 800; letter-spacing: 0.15em; text-align: center; margin: 16px 0; font-variant-numeric: tabular-nums; }
