/* Family Hub — a calm paper planner: warm cream, soft raised cards, thin uppercase headings, one coffee-brown accent.
   Bottom icon bar for sections; each view opens with a big uppercase title and a dateline. */
:root {
  --bg: #efe8de;
  --bg-deep: #e7ded2;
  --surface: #f7f2eb;
  --raised: #ebe2d6;
  --ink: #3a2e26;
  --muted: #8e7f72;
  --line: #ddd2c4;
  --accent: #9b7351;        /* coffee brown */
  --accent-ink: #fbf7f1;
  --accent-soft: #eadccb;
  --late: #a5483a;
  --late-soft: #f1dcd6;
  --fam: #6f8a5e;           /* sage, for family activities */
  --fam-soft: #e3e7d6;
  --sch: #c08a3e;           /* honey, for school events */
  --off: #e8e0d5; --off-stripe: #dfd5c8;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 6px 18px -10px rgba(92,64,40,.35), 0 1px 2px rgba(92,64,40,.08);
  --shadow-press: 0 2px 6px -2px rgba(92,64,40,.25) inset;
  --display: "Jost", "Futura", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --script: "Caveat", "Bradley Hand", cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1814; --bg-deep: #191410; --surface: #26201b; --raised: #2e2721; --ink: #efe6db; --muted: #a69684;
    --line: #3a322b; --accent: #c9a07a; --accent-ink: #1d1814; --accent-soft: #3b2f24; --late: #e39484; --late-soft: #3d2420;
    --fam: #a9c294; --fam-soft: #29301f; --sch: #e0b46f; --off: #221c17; --off-stripe: #2a231d;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 20px -12px rgba(0,0,0,.7);
    --shadow-press: 0 2px 6px -2px rgba(0,0,0,.6) inset;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-block: max(22px, env(safe-area-inset-top, 0px)) calc(110px + env(safe-area-inset-bottom, 0px));
}
.wrap { max-width: 640px; margin: 0 auto; }
.stack { display: grid; gap: 18px; }
.card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.eyebrow, .label { font-family: var(--display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); } .small { font-size: 14px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary {
  font-family: var(--display); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; font-size: 14px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 14px; padding: 13px 20px; cursor: pointer; box-shadow: var(--shadow);
}
.primary:active { box-shadow: var(--shadow-press); }
.primary:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 6px 0; }

/* ---------- Header ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
h1, .page-title { font-family: var(--display); font-weight: 400; font-size: clamp(38px, 11vw, 54px); line-height: 1; margin: 0; letter-spacing: .02em; text-transform: uppercase; }
.dateline { color: var(--muted); font-size: 17px; margin-top: 8px; }
.badge { width: 58px; height: 58px; border-radius: 18px; background: var(--raised); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); flex: none; }
.badge svg { width: 30px; height: 30px; }

/* ---------- Bottom bar ---------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  width: min(560px, calc(100% - 28px)); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-radius: 24px; box-shadow: 0 10px 30px -12px rgba(60,40,25,.45), var(--shadow); padding: 8px;
}
.bottom-nav a, .bottom-nav button {
  display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 16px; text-decoration: none; color: var(--muted);
  background: none; border: 0; cursor: pointer; font-size: 12.5px;
}
.bottom-nav svg { width: 24px; height: 24px; }
.bottom-nav a[aria-current="page"] { color: var(--ink); background: var(--raised); box-shadow: var(--shadow-press); }

/* ---------- Auth ---------- */
.auth { display: grid; gap: 22px; max-width: 420px; margin: 7vh auto 0; }
.auth .script { font-family: var(--script); font-size: 26px; color: var(--accent); line-height: 1.1; }
.form { display: grid; gap: 14px; padding: 20px; }
.form label { display: grid; gap: 6px; font-family: var(--display); font-weight: 500; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.form input, .form select, .form textarea {
  font: inherit; font-family: var(--body); letter-spacing: 0; text-transform: none; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 0; border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow-press); width: 100%; min-width: 0;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.opt { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 400; color: var(--muted); font-size: 12px; }
.error { margin: 0; color: var(--late); font-size: 14px; }
.auth .link { justify-self: start; }

/* ---------- Week strip (To-Do) ---------- */
.strip { display: grid; gap: 10px; }
.strip-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.strip-day { display: grid; justify-items: center; gap: 2px; padding: 7px 0; border-radius: 12px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.strip-day .sd-dow { font-family: var(--display); font-size: 13px; letter-spacing: .1em; }
.strip-day .sd-num { font-size: 13px; font-variant-numeric: tabular-nums; }
.strip-day.is-today { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.strip-day[aria-pressed="true"]:not(.is-today) { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-press); }
.strip-day .sd-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0; }
.strip-day.has .sd-dot { opacity: .8; }
.progress { display: grid; gap: 4px; }
.progress-track { height: 8px; border-radius: 99px; background: var(--raised); box-shadow: var(--shadow-press); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.progress-label { font-size: 12px; color: var(--muted); }

/* ---------- Glance cards (today at school / family) ---------- */
.glance { padding: 14px 16px; display: grid; gap: 4px; background: var(--raised); }
.glance .lunch-line { font-weight: 700; }
.glance ul { margin: 0; padding-left: 18px; }
.glance.fam { background: var(--fam-soft); }

/* ---------- To-dos ---------- */
form.add { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.add input {
  font: inherit; color: var(--ink); background: var(--raised); border: 0; border-radius: 16px; padding: 15px 16px; min-width: 0; box-shadow: var(--shadow);
}
.add input[type="text"] { font-family: var(--display); letter-spacing: .12em; text-transform: uppercase; font-size: 15px; text-align: center; }
.add input[type="text"]:focus, .add input[type="text"]:not(:placeholder-shown) { text-transform: none; letter-spacing: 0; text-align: left; font-family: var(--body); font-size: 16px; }
.add input[type="text"]::placeholder { color: var(--ink); opacity: .8; }
.add input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.add input[type="date"] { color: var(--muted); padding: 14px 10px; font-size: 14px; }
.add .primary { padding: 15px 18px; border-radius: 16px; }
@media (max-width: 480px) { form.add { grid-template-columns: minmax(0, 1fr) auto; } .add input[type="text"] { grid-column: 1 / -1; } }
.status { font-size: 14px; color: var(--late); }

.group { display: grid; gap: 8px; }
.group h2 { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .14em; text-transform: uppercase; margin: 0 4px; display: flex; gap: 10px; align-items: baseline; color: var(--muted); }
.group.late h2 { color: var(--late); }
.group.today h2 { color: var(--ink); }
.count { font-family: var(--body); letter-spacing: 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
ul.items { list-style: none; margin: 0; padding: 4px 0; overflow: hidden; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 13px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.check {
  appearance: none; -webkit-appearance: none; width: 26px; height: 26px; border-radius: 8px; margin: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--raised); box-shadow: var(--shadow-press); border: 1.5px solid var(--line);
}
.check:checked { background: var(--accent); border-color: var(--accent); box-shadow: none; }
.check:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.text { min-width: 0; overflow-wrap: anywhere; display: grid; gap: 1px; font-size: 17px; }
.meta { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta .late { color: var(--late); font-weight: 700; } .meta .today { color: var(--accent); font-weight: 700; }
.item.done .text > span:first-child { text-decoration: line-through; color: var(--muted); }
.who { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.del { font-size: 20px; line-height: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.del:hover { color: var(--late); background: var(--late-soft); }
.pill { justify-self: start; font-family: var(--display); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: var(--raised); border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer; box-shadow: var(--shadow); }
.empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.empty b { color: var(--ink); display: block; font-family: var(--script); font-weight: 600; font-size: 28px; margin-bottom: 2px; }

/* ---------- School ---------- */
.controls { display: grid; gap: 10px; padding: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 14px; border: 0; background: var(--raised); color: var(--ink); padding: 7px 13px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.month-head { display: grid; gap: 2px; }
.month-head h2 { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.week { display: grid; gap: 10px; }
.week-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.week-head h3 { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .12em; text-transform: uppercase; margin: 0; color: var(--muted); }
.tag { font-family: var(--display); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.week-notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.week-notes li::before { content: "✦ "; color: var(--accent); }
.week-notes li.other { opacity: .45; }
.days { display: grid; gap: 10px; background: none; box-shadow: none; }
.day { display: grid; gap: 8px; padding: 12px 16px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); border: 1.5px solid transparent; }
.date { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.dow { font-family: var(--display); font-size: 17px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.num { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.content { display: grid; gap: 8px; min-width: 0; }
.lunch { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.lunch .main { font-weight: 700; } .lunch .sides { color: var(--muted); font-size: 14px; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.events li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 15px; }
.events time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.flag { font-weight: 700; }
.gr { font-size: 12px; color: var(--muted); background: var(--raised); border-radius: 6px; padding: 0 6px; }
.events li.mine .gr { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.events li.other { opacity: .42; }
.to-todo { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--raised); border: 0; border-radius: 999px; padding: 2px 10px; cursor: pointer; box-shadow: var(--shadow); }
.to-todo:disabled { color: var(--muted); cursor: default; box-shadow: none; }
.day.today { border-color: var(--accent); }
.day.today .num { color: var(--accent); font-weight: 700; }
.day.off { background: repeating-linear-gradient(135deg, var(--off) 0 10px, var(--off-stripe) 10px 20px); box-shadow: none; }
.day.past { opacity: .55; }
.nolabel { font-family: var(--display); font-size: 16px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.foot { color: var(--muted); font-size: 13px; display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Family calendar ---------- */
.cal { padding: 16px; display: grid; gap: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h2 { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: .1em; text-transform: uppercase; margin: 0; }
.nav-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--raised); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.nav-btn:active { box-shadow: var(--shadow-press); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1 / 1; max-width: 100%; border: 0; border-radius: 12px; background: var(--raised); color: var(--ink); cursor: pointer;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 4px 2px 6px;
  font-variant-numeric: tabular-nums; font-size: 15px; box-shadow: var(--shadow-press);
}
.cal-day.blank { visibility: hidden; }
.cal-day.off { background: repeating-linear-gradient(135deg, var(--off) 0 6px, var(--off-stripe) 6px 12px); color: var(--muted); }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 800; color: var(--accent); }
.cal-day[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.dots { display: flex; gap: 3px; min-height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.fam { background: var(--fam); } .dot.sch { background: var(--sch); }
.cal-day[aria-selected="true"] .dot { background: var(--accent-ink); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.cal-legend .dot, .sw { margin-right: -8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.off { background: repeating-linear-gradient(135deg, var(--off) 0 3px, var(--off-stripe) 3px 6px); border: 1px solid var(--line); }

.act-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.act-form .row > * { min-width: 0; }
.form-head { display: flex; justify-content: space-between; align-items: center; }
.act-form.editing { outline: 2px solid var(--accent); }

.agenda-day { display: grid; gap: 8px; }
.agenda-day h3 { font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: .12em; text-transform: uppercase; margin: 0 4px; display: flex; gap: 10px; align-items: baseline; color: var(--muted); }
.agenda-day h3 .muted { font-family: var(--body); letter-spacing: 0; text-transform: none; font-size: 13px; font-weight: 700; color: var(--accent); }
.agenda-day.today h3 { color: var(--ink); }
.acts { list-style: none; margin: 0; padding: 4px 0; overflow: hidden; }
.act { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 14px; padding: 12px 14px 12px 0; align-items: start; }
.act + .act { border-top: 1px solid var(--line); }
.act .bar { background: var(--fam); border-radius: 0 3px 3px 0; align-self: stretch; }
.act.school .bar { background: var(--sch); }
.act .body { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.act .title { font-weight: 700; font-size: 17px; }
.act .sub { font-size: 14px; color: var(--muted); }
.act .actions { display: flex; gap: 2px; }
.act .actions button { font-size: 13px; font-weight: 700; background: transparent; border: 0; color: var(--accent); cursor: pointer; padding: 4px 7px; border-radius: 8px; }
.act .actions button.danger { color: var(--muted); }
.act .actions button:hover { background: var(--raised); }
.act .actions button.danger:hover { color: var(--late); background: var(--late-soft); }
.act .actions button.confirm { color: var(--accent-ink); background: var(--late); }
@media (max-width: 420px) { .cal-day { font-size: 13px; border-radius: 10px; } .act-form .row { grid-template-columns: 1fr; } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; z-index: 20; max-width: calc(100% - 32px);
}
@media (prefers-reduced-motion: no-preference) {
  .card, .day, .item { transition: box-shadow .2s ease; }
}
