/* Family dashboard. Light and dark follow the system setting. */
:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #f8f6f2;
  --text: #1f2326;
  --muted: #6a6f75;
  --line: #e5e0d7;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --danger: #b4321f;
  --warn-bg: #fdf0d8;
  --warn-ink: #7a4b00;
  --today: #fff7e0;
  --shadow: 0 1px 2px rgb(30 25 15 / 6%), 0 6px 20px rgb(30 25 15 / 5%);
  --radius: 16px;
  --radius-s: 10px;
  --note-yellow: #fff1a8; --note-green: #d6f0cf; --note-blue: #d5e7fb; --note-pink: #fbd8e3; --note-purple: #e5dcfa;
  --note-ink: #2b2a25;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131517;
    --surface: #1c1f22;
    --surface-2: #23272b;
    --text: #e9e7e3;
    --muted: #9ba1a7;
    --line: #2f3439;
    --accent: #62b59c;
    --accent-ink: #0c1713;
    --accent-soft: #1d3029;
    --danger: #ff8a75;
    --warn-bg: #3a2e14;
    --warn-ink: #f4cf86;
    --today: #2a2717;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    --note-yellow: #4a4220; --note-green: #23402b; --note-blue: #1f3450; --note-pink: #4a2333; --note-purple: #352a52;
    --note-ink: #f0ece2;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 0.4rem 0; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-s); padding: 0.55rem 0.8rem; margin: 0.3rem 0; }
.hint { color: var(--muted); padding: 0.5rem 0; }
.more { display: inline-block; margin-top: 0.4rem; color: var(--muted); font-size: 0.9rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.78rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }

/* ---------- header and navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1.25rem;
  padding-top: max(0.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); font-weight: 650; font-size: 1.1rem; white-space: nowrap; }
.nav { display: flex; gap: 0.2rem; flex: 1; justify-content: center; }
.nav-link {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.8rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 550; white-space: nowrap;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--accent); color: var(--accent-ink); }
.clock { text-align: right; white-space: nowrap; }
.clock-time { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.clock-date { color: var(--muted); font-size: 0.85rem; }

main { padding: 1.25rem; max-width: 1800px; margin: 0 auto; }
main:focus { outline: none; }
.view-title { font-size: 1.5rem; font-weight: 650; }
.narrow { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }

/* ---------- buttons and form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.6rem; padding: 0.45rem 1rem;
  border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary-ghost { color: var(--accent); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 2.1rem; padding: 0.25rem 0.7rem; font-size: 0.88rem; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: var(--accent); }

input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; min-height: 2.6rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
}
textarea { resize: vertical; min-height: 4.5rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type=checkbox] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); margin: 0; flex: none; }
input[type=color] { width: 2.6rem; height: 2.6rem; padding: 0.15rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); flex: none; }

.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; flex: 1; }
.field.grow { flex: 3; }
.field-label { font-size: 0.82rem; color: var(--muted); font-weight: 550; }
.stack { display: flex; flex-direction: column; gap: 0.8rem; }
.row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 9rem; }
.row.end { align-items: flex-end; }
.check-line { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }

/* ---------- toasts and modals ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 0.5rem; width: min(30rem, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: center; gap: 0.8rem; justify-content: space-between;
  padding: 0.75rem 1rem; border-radius: var(--radius-s);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

.modal {
  border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(32rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 20px 60px rgb(0 0 0 / 25%);
}
.modal.wide { width: min(46rem, calc(100vw - 1.5rem)); }
.modal::backdrop { background: rgb(15 18 20 / 45%); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1rem 0.5rem 1.25rem; }
.modal-head h2 { font-size: 1.2rem; }
.modal-body { padding: 0.5rem 1.25rem 1rem; overflow-y: auto; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.8rem 1.25rem 1.1rem; border-top: 1px solid var(--line); }

/* ---------- cards on the overview ---------- */
.home { display: flex; flex-direction: column; gap: 1rem; }
.home-cols { display: grid; gap: 1rem; align-items: start; }
.home-cols.n3 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
.home-cols.n2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.home-cols.n1 { grid-template-columns: minmax(0, 1fr); }
.home-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem 1.1rem; min-width: 0; }
.card-head { margin-bottom: 0.6rem; }
.card-head a { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--text); text-decoration: none; }
.card-head h2 { font-size: 1.05rem; font-weight: 650; }
.card-head a svg { color: var(--muted); }
.card-body { display: flex; flex-direction: column; gap: 0.35rem; }

.agenda-day { padding: 0.35rem 0 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.agenda-day + .agenda-day { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.agenda-day h3 { font-size: 0.95rem; font-weight: 650; }
.agenda-day.is-today h3 { color: var(--accent); }

/* ---------- events ---------- */
.ev {
  display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem; align-items: baseline;
  width: 100%; text-align: left; cursor: pointer;
  padding: 0.4rem 0.6rem; border: 0; border-left: 4px solid var(--c);
  border-radius: 6px var(--radius-s) var(--radius-s) 6px;
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
}
.ev:hover { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.ev-time { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-title { font-weight: 550; overflow-wrap: anywhere; }
.ev-loc { grid-column: 2; font-size: 0.82rem; color: var(--muted); }
.ev.allday { background: color-mix(in srgb, var(--c) 26%, var(--surface)); }
.ev.compact { display: block; padding: 0.1rem 0.35rem; border-left-width: 3px; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.compact .ev-time { font-size: inherit; margin-right: 0.3rem; }
.ev.compact.allday .ev-time { display: none; }
.ev-detail { display: flex; flex-direction: column; gap: 0.6rem; }
.ev-when { font-weight: 600; }
.ev-cal { display: flex; align-items: center; gap: 0.45rem; }
.ev-desc { white-space: pre-wrap; background: var(--surface-2); padding: 0.6rem 0.8rem; border-radius: var(--radius-s); }

/* ---------- calendar view ---------- */
.toolbar { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.toolbar .view-title { flex: 1; min-width: 12rem; font-size: 1.35rem; }
.toolbar-group { display: flex; align-items: center; gap: 0.35rem; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg { border: 0; background: var(--surface); padding: 0.5rem 0.85rem; cursor: pointer; min-height: 2.5rem; }
.seg.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.legend-item {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.88rem;
}
.legend-item.off { opacity: 0.45; text-decoration: line-through; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.6rem; }
.week-day {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.6rem; min-height: 14rem; display: flex; flex-direction: column; gap: 0.35rem;
}
.week-day.is-today { background: var(--today); outline: 2px solid var(--accent); }
.week-day.past { opacity: 0.72; }
.week-head { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.week-head .wd { text-transform: uppercase; font-size: 0.78rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.week-head .dn { font-weight: 650; }
.week-head .add-day { margin-left: auto; width: 2rem; height: 2rem; }
.week .ev { grid-template-columns: 1fr; }
.week .ev-loc { grid-column: 1; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.month-wd { background: var(--surface-2); text-align: center; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 0.35rem 0; }
.month-cell { background: var(--surface); min-height: 7rem; padding: 0.3rem; display: flex; flex-direction: column; gap: 0.2rem; cursor: pointer; min-width: 0; }
.month-cell:hover { background: var(--surface-2); }
.month-cell.other { background: var(--surface-2); color: var(--muted); }
.month-cell.is-today { background: var(--today); }
.month-cell .mn { font-weight: 650; font-size: 0.88rem; }
.month-cell.is-today .mn { color: var(--accent); }
.month-cell .more { margin: 0; font-size: 0.75rem; }
.month-cell .dots { display: none; gap: 2px; flex-wrap: wrap; }
.month-cell .dots .dot { width: 0.45rem; height: 0.45rem; }

/* ---------- shopping ---------- */
.add-form { display: flex; gap: 0.5rem; }
.add-form input[name=name] { flex: 1; }
.add-form .qty { width: 7rem !important; flex: none; }
.add-form.compact { margin-bottom: 0.6rem; }
.add-form.compact .qty { width: 5rem !important; }
.add-form.compact .btn { padding: 0.45rem 0.7rem; }
.shop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.shop-item { display: flex; align-items: center; gap: 0.2rem; background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); padding-right: 0.3rem; }
.shop-list.compact .shop-item { box-shadow: none; background: var(--surface-2); }
.shop-toggle {
  flex: 1; display: flex; align-items: center; gap: 0.7rem; min-height: 3rem;
  padding: 0.5rem 0.8rem; border: 0; background: none; text-align: left; cursor: pointer; min-width: 0;
}
.shop-list.compact .shop-toggle { min-height: 2.5rem; padding: 0.35rem 0.6rem; }
.box { width: 1.35rem; height: 1.35rem; border: 2px solid var(--muted); border-radius: 6px; flex: none; display: grid; place-items: center; }
.shop-name { font-weight: 550; overflow-wrap: anywhere; }
.shop-qty { color: var(--muted); font-size: 0.9rem; margin-left: auto; white-space: nowrap; }
.shop-item.done .shop-name { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.shop-item.done .box { background: var(--accent); border-color: var(--accent); }
.shop-item.done .box::after { content: ""; width: 0.35rem; height: 0.65rem; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; }
.section-head h2 { font-size: 1.05rem; }

/* ---------- to-dos ---------- */
.todo-form { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.todo-form .row { align-items: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0.35rem 0.85rem; cursor: pointer; min-height: 2.3rem; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.todo-group { display: flex; flex-direction: column; gap: 0.45rem; }
.todo-group h2 { font-size: 0.95rem; color: var(--muted); font-weight: 650; margin-top: 0.4rem; }
.todo-group.late h2 { color: var(--danger); }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.todo { display: flex; align-items: center; gap: 0.7rem; background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 0.35rem 0.7rem; }
.card .todo { box-shadow: none; background: var(--surface-2); }
.todo .check { width: 1.4rem; height: 1.4rem; }
.todo-main { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; border: 0; background: none; text-align: left; padding: 0.35rem 0; cursor: pointer; min-width: 0; }
.todo-title { font-weight: 550; overflow-wrap: anywhere; }
.todo.done .todo-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; font-size: 0.82rem; color: var(--muted); }
.todo-meta:empty { display: none; }
.due.late { color: var(--danger); font-weight: 650; }
.rep { display: inline-flex; align-items: center; gap: 0.2rem; }
.done-list summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 0.4rem 0; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em;
}
.avatar.small { width: 1.6rem; height: 1.6rem; font-size: 0.7rem; }

/* ---------- meals ---------- */
.meal-day { display: flex; flex-direction: column; gap: 0.2rem; }
.meal-day + .meal-day { margin-top: 0.4rem; }
.meal-day h3 { font-size: 0.9rem; color: var(--muted); }
.meal-line { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.5rem; align-items: baseline; text-align: left; border: 0; background: none; padding: 0.25rem 0; cursor: pointer; }
.meals { display: flex; flex-direction: column; gap: 0.5rem; }
.meals-head, .meals-row { display: grid; grid-template-columns: 9rem 1fr 1fr; gap: 0.5rem; }
.meals-head span { font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.8rem; }
.meals-row.past { opacity: 0.7; }
.meals-day { display: flex; flex-direction: column; justify-content: center; padding: 0.4rem 0.2rem; }
.meals-row.is-today .meals-day strong { color: var(--accent); }
.meal-cell {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; text-align: left;
  min-height: 4.2rem; padding: 0.6rem 0.8rem; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-s); background: var(--surface); box-shadow: var(--shadow);
}
.meals-row.is-today .meal-cell { background: var(--today); }
.meal-cell.blank { box-shadow: none; border: 1px dashed var(--line); background: transparent; color: var(--muted); }
.meal-cell .slot-label { display: none; font-size: 0.75rem; color: var(--muted); }
.meal-text { font-weight: 550; overflow-wrap: anywhere; }

/* ---------- notes ---------- */
.note-form { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); margin: 1rem 0; }
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.8rem; }
.notes.compact { grid-template-columns: 1fr; gap: 0.5rem; }
.note {
  background: var(--note-yellow); color: var(--note-ink);
  border-radius: var(--radius-s); padding: 0.85rem 0.9rem 0.5rem; display: flex; flex-direction: column; gap: 0.5rem;
  box-shadow: var(--shadow);
}
.note[data-color=green] { background: var(--note-green); }
.note[data-color=blue] { background: var(--note-blue); }
.note[data-color=pink] { background: var(--note-pink); }
.note[data-color=purple] { background: var(--note-purple); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.02rem; }
.note footer { display: flex; align-items: center; gap: 0.3rem; min-height: 1.6rem; }
.note footer .muted { color: inherit; opacity: 0.65; flex: 1; }
.note .icon-btn { color: inherit; opacity: 0.6; width: 2.2rem; height: 2.2rem; }
.note .icon-btn:hover, .note .icon-btn.on { opacity: 1; background: rgb(0 0 0 / 7%); }
.notes.compact .note { padding: 0.6rem 0.75rem 0.4rem; }
.swatches { display: flex; gap: 0.35rem; }
.swatch { width: 2rem; height: 2rem; border-radius: 50%; background: var(--note-yellow); border: 2px solid var(--line); cursor: pointer; display: grid; place-items: center; }
.swatch[data-color=green] { background: var(--note-green); }
.swatch[data-color=blue] { background: var(--note-blue); }
.swatch[data-color=pink] { background: var(--note-pink); }
.swatch[data-color=purple] { background: var(--note-purple); }
.swatch input { appearance: none; margin: 0; width: 100%; height: 100%; border-radius: 50%; cursor: pointer; }
.swatch:has(input:checked) { border-color: var(--text); }
.swatch input:focus-visible { outline: 2px solid var(--accent); }

/* ---------- settings ---------- */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.panel h2 { font-size: 1.1rem; }
.cal-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.cal-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.cal-row .cal-name { flex: 1 1 10rem; }
.members { display: flex; flex-direction: column; gap: 0.5rem; }
.member { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.3rem 0; }
.member-text { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; gap: 0.1rem; }
.member-text .small { display: flex; gap: 0.3rem; }
.member-actions { display: flex; align-items: center; gap: 0.3rem; }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-box {
  width: min(26rem, 100%); background: var(--surface); border-radius: 22px; box-shadow: var(--shadow);
  padding: 2rem 1.75rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center;
}
.login-box h1 { font-size: 1.6rem; }
.btn.google { min-height: 3rem; padding: 0.6rem 1.4rem; gap: 0.7rem; font-size: 1.02rem; }
.dev-login { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; border-top: 1px dashed var(--line); padding-top: 1rem; }
.login-foot { margin-top: 1rem; text-align: center; }
.login-foot a { color: var(--muted); }

/* ---------- privacy page ---------- */
.doc-page { padding: 1rem; }
.doc-box {
  width: min(42rem, 100%); margin: 1rem auto 3rem; background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow); padding: 1.75rem; line-height: 1.55;
}
.doc-box h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
.doc-box h2 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
.doc-box p, .doc-box li { margin: 0 0 0.6rem; }
.doc-box ul { padding-left: 1.2rem; margin: 0; }

/* ---------- weather ---------- */
.wx-now { display: flex; align-items: center; gap: 0.9rem; }
.wx-big { font-size: 3rem; line-height: 1; }
.wx-temp { font-size: 2rem; font-weight: 650; line-height: 1.05; }
.wx-today { margin-left: auto; text-align: right; white-space: nowrap; }
.wx-hours, .wx-days { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.2rem; text-align: center; margin-top: 0.75rem; }
.wx-days { grid-template-columns: repeat(5, 1fr); padding-top: 0.6rem; border-top: 1px solid var(--line); }
.wx-hour, .wx-day { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; }
.wx-icon { font-size: 1.4rem; line-height: 1.3; }
.rain { color: #2f7fc1; }

/* ---------- layouts ---------- */
@media (min-width: 1500px) {
  body { font-size: 17px; }
}

@media (max-width: 1199px) {
  .nav-link span { display: none; }
  .nav-link { padding: 0.55rem; }
  .nav-link.active span { display: inline; }
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(4.2rem + env(safe-area-inset-bottom)); }
  .top { padding: 0.5rem 1rem; backdrop-filter: none; background: var(--bg); }
  .brand span { font-size: 1rem; }
  .clock-time { font-size: 1.25rem; }
  .clock-date { font-size: 0.75rem; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    justify-content: space-around; gap: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
  }
  .nav-link { flex-direction: column; gap: 0.1rem; padding: 0.35rem 0.2rem; border-radius: var(--radius-s); font-size: 0.68rem; flex: 1; min-width: 0; }
  .nav-link span, .nav-link.active span { display: block; }
  .nav-link.active { background: var(--accent-soft); color: var(--accent); }
  .nav-settings span { display: none !important; }
  .nav-link.nav-settings { flex: 0.6; }
  .toasts { bottom: calc(5rem + env(safe-area-inset-bottom)); }
  main { padding: 1rem; }
  .wx-now { flex-wrap: wrap; }
  .wx-today { margin-left: 0; text-align: left; flex-basis: 100%; display: flex; gap: 0.9rem; }
  .wx-hours .wx-hour:nth-child(n+6) { display: none; }
  .wx-hours { grid-template-columns: repeat(5, 1fr); }
  .week { grid-template-columns: minmax(0, 1fr); }
  .week-day { min-height: 0; }
  .week-day.past { display: none; }
  .month-cell { min-height: 3.4rem; align-items: center; }
  .month-cell .ev, .month-cell .more { display: none; }
  .month-cell .dots { display: flex; justify-content: center; }
  .toolbar .view-title { order: -1; flex-basis: 100%; }
  .meals-head { display: none; }
  .meals-row { grid-template-columns: 1fr 1fr; }
  .meals-day { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 0.5rem; align-items: baseline; padding-bottom: 0; }
  .meal-cell .slot-label { display: block; }
  .add-form .qty { width: 5rem !important; }
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
}

@media (max-width: 380px) {
  .brand span { display: none; }
}

/* ---------- the shop ---------- */
.shop-toolbar { max-width: 1500px; margin-left: auto; margin-right: auto; }
.store { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; max-width: 1500px; margin: 0 auto; }
.store-main { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.store-tools { display: flex; gap: 0.5rem; }
.store-search { flex: 1; min-width: 0; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-btn {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  border-radius: 999px; padding: 0.45rem 0.9rem; min-height: 2.5rem; font: inherit; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.chip-btn:hover { border-color: var(--muted); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.shelves { display: flex; flex-direction: column; gap: 1.4rem; }
.shelf h2 { font-size: 1.1rem; margin-bottom: 0.6rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.2rem, 1fr)); gap: 0.6rem; }
.tile {
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 2px solid transparent; overflow: hidden; min-width: 0;
}
.tile.in { border-color: var(--accent); }
.tile-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.9rem 0.5rem 0.5rem;
  border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: center; min-width: 0;
}
.tile-emoji { font-size: 2.4rem; line-height: 1.15; }
.tile-name { font-weight: 550; font-size: 0.95rem; line-height: 1.25; overflow-wrap: anywhere; }
.tile-foot {
  display: flex; align-items: center; justify-content: center; gap: 0.3rem; min-height: 2.5rem;
  border: 0; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--accent); font: inherit; font-weight: 650;
}
.tile-add { cursor: pointer; }
.tile:hover .tile-add { background: var(--accent-soft); }
.stepper { background: var(--accent); color: var(--accent-ink); justify-content: space-between; padding: 0; border-top-color: var(--accent); }
.stepper button {
  border: 0; background: transparent; color: inherit; font: inherit; font-size: 1.35rem; font-weight: 650;
  width: 2.75rem; min-height: 2.5rem; cursor: pointer;
}
.stepper-gap { width: 0.6rem; }
.stepper button:hover { background: rgb(0 0 0 / 12%); }
.tile-count { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-new {
  align-items: center; justify-content: center; gap: 0.3rem; padding: 0.9rem 0.5rem; min-height: 8rem; cursor: pointer;
  background: transparent; box-shadow: none; border: 2px dashed var(--line); color: var(--muted); font: inherit;
}
.tile-new:hover { border-color: var(--accent); color: var(--accent); }
.store-miss { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.emoji-input { width: 4.5rem !important; text-align: center; font-size: 1.3rem; }

.cart { position: sticky; top: 5rem; display: flex; flex-direction: column; gap: 0.7rem; max-height: calc(100dvh - 6.5rem); }
.cart h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; }
.cart-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; }
.cart-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.1rem 0; border-bottom: 1px solid var(--line); }
.cart-list li:last-child { border-bottom: 0; }
.cart-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cart-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cart-bar { display: none; }

.baskets { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; max-width: 1500px; margin: 0 auto; }
.basket { display: flex; flex-direction: column; gap: 0.5rem; }
.basket h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
.basket-items { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.basket-actions { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.4rem; }
.basket-new {
  align-items: center; justify-content: center; min-height: 9rem; cursor: pointer; font: inherit; font-weight: 550;
  background: transparent; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.basket-new:hover { border-color: var(--accent); color: var(--accent); }
.basket-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.basket-edit li { display: flex; align-items: center; gap: 0.5rem; }
.be-emoji { width: 1.6rem; text-align: center; flex: none; }
.be-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.be-qty { width: 6rem !important; flex: none; }

@media (max-width: 1199px) {
  .store { grid-template-columns: minmax(0, 1fr); }
  .cart { display: none; }
  .cart-bar {
    position: sticky; bottom: 0.75rem; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 0.5rem 0.6rem 0.5rem 1rem; box-shadow: var(--shadow);
  }
  .cart-bar span { display: flex; align-items: center; gap: 0.5rem; font-weight: 550; }
}
@media (max-width: 760px) {
  .cart-bar { bottom: calc(4.8rem + env(safe-area-inset-bottom)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: 0.45rem; }
  .tile-emoji { font-size: 2rem; }
  .stepper button { width: 2.2rem; }
  /* departments as a grid: everything visible, nothing to scroll sideways */
  .cat-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
  .chip-btn {
    flex-direction: column; justify-content: flex-start; gap: 0.1rem; border-radius: var(--radius-s); padding: 0.4rem 0.15rem;
    white-space: normal; text-align: center; font-size: 0.72rem; line-height: 1.15; min-height: 3.6rem;
  }
  .chip-emoji { font-size: 1.35rem; line-height: 1.2; }
  .tile-name { font-size: 0.88rem; }
  .shop-toolbar .segmented { width: 100%; }
  .shop-toolbar .seg { flex: 1; }
}
