:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --ink: #2b2620;
  --muted: #8b8378;
  --line: #e8e0d3;
  --accent: #f59e0b;
  --dylan: #2563eb;
  --dylan-bg: #dbeafe;
  --lucy: #9333ea;
  --lucy-bg: #f3e8ff;
  --family: #16a34a;
  --family-bg: #dcfce7;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(43, 38, 32, .08);
  --shadow-lg: 0 8px 28px rgba(43, 38, 32, .12);
  /* urgency scale: late -> today -> tomorrow -> soon -> later -> done */
  --u-late: #dc2626;    --u-late-bg: #fee2e2;
  --u-today: #ea580c;   --u-today-bg: #ffedd5;
  --u-soon: #d97706;    --u-soon-bg: #fef3c7;
  --u-later: #64748b;   --u-later-bg: #f1f5f9;
  --u-done: #16a34a;    --u-done-bg: #dcfce7;
  --u-wait: #b45309;    --u-wait-bg: #fef3c7;
  --font-display: 'Fredoka', 'Nunito', sans-serif;
}
h1, h2, h3, .hh-greet, .nc-class, .hc-head, .page-title, .brand h1 {
  font-family: var(--font-display);
  letter-spacing: .1px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Nunito', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 3px solid var(--accent);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-emoji { font-size: 34px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -.3px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.main-tabs { display: flex; gap: 6px; flex: 1 1 auto; justify-content: flex-start;
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0;
  background: var(--bg); border: 2px solid var(--line); border-radius: 999px;
  padding: 5px 6px; }
.main-tabs::-webkit-scrollbar { display: none; }
.main-tab {
  border: 2px solid var(--line); background: var(--card); font: inherit;
  font-weight: 800; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  color: var(--ink); white-space: nowrap; flex: 0 0 auto;
  box-shadow: 0 2px 0 var(--line); transition: transform .08s, box-shadow .08s;
}
.main-tab:hover { border-color: var(--accent); color: var(--accent); }
.main-tab:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.main-tab.active {
  background: var(--ink); border-color: var(--ink); color: #fff;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.add-btn {
  border: none; background: var(--accent); color: #fff; font: inherit;
  font-weight: 900; font-size: 15px; padding: 9px 18px; border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow);
}
.add-btn:hover { filter: brightness(1.05); }
.header-right { display: flex; align-items: center; gap: 8px; }
.me-btn {
  display: flex; align-items: center; gap: 7px; border: 2px solid var(--accent);
  background: var(--card); font: inherit; font-weight: 800; font-size: 13px;
  padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
}
.me-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 18px;
  background: var(--bg); overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 900; vertical-align: 1px;
}

/* ---------- quick links ---------- */
.quick-links {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 20px 4px;
  scrollbar-width: none;
}
.quick-links::-webkit-scrollbar { display: none; }
.quick-links.expanded { flex-wrap: wrap; }
.link-toggle { border: 1.5px dashed var(--accent); background: transparent;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 800;
  color: var(--accent); }
.quick-link {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow); transition: transform .1s;
}
.quick-link:hover { transform: translateY(-1px); border-color: var(--accent); }

/* ---------- home page ---------- */
.home-stack { display: flex; flex-direction: column; gap: 14px; max-width: 760px;
  margin: 14px auto 0; }
.home-hero { padding: 6px 4px 0; }
.hh-greet { font-size: 28px; font-weight: 900; letter-spacing: -.4px; }
.hh-date { font-size: 14px; font-weight: 700; color: var(--muted); }
.home-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-left: 8px solid var(--sc, var(--accent)); border-radius: 20px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.home-card.urgent { background: #fffbeb; border-color: var(--u-soon);
  box-shadow: 0 4px 18px rgba(217, 119, 6, .18); }
.hc-head { margin: 0 0 10px; font-size: 17px; font-weight: 700; }
.hc-sub { margin: 12px 0 8px; font-size: 13px; font-weight: 900; color: var(--muted); }
.now-card {
  position: relative; overflow: hidden;
  display: flex; gap: 16px; align-items: center;
  background: linear-gradient(120deg, var(--hero1, #2563eb), var(--hero2, #1d4ed8));
  color: #fff; border: none;
  border-radius: 22px; padding: 20px 22px 24px; box-shadow: var(--shadow-lg);
}
.now-card.off {
  background: var(--card); color: var(--ink);
  border: 2px dashed var(--line); box-shadow: var(--shadow);
}
.now-card.off .nc-label, .now-card.off .nc-next { color: var(--muted); }
.nc-emoji { font-size: 42px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.nc-label { font-size: 11.5px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1px; opacity: .85; }
.nc-class { font-size: 22px; font-weight: 700; margin-top: 2px; }
.nc-next { font-size: 13.5px; font-weight: 700; margin-top: 4px; opacity: .9; }
.nc-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 7px;
  background: rgba(255,255,255,.25);
}
.nc-progress > span {
  display: block; height: 100%; background: rgba(255,255,255,.95);
  border-radius: 0 99px 99px 0; transition: width .6s ease;
}
.nc-count { font-family: var(--font-display); font-size: 40px; font-weight: 700;
  line-height: 1; }
.mini-event {
  display: flex; align-items: center; gap: 10px; padding: 9px 6px;
  border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer;
  transition: background .12s;
}
.mini-event:hover { background: var(--bg); border-radius: 10px; }
.mini-event:last-child { border-bottom: none; }
.me-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.me-when { font-weight: 900; font-size: 11.5px; color: var(--muted);
  flex: 0 0 auto; min-width: 58px; text-transform: uppercase; }
.me-title { font-weight: 700; flex: 1; min-width: 0; }
.me-loc { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-hw {
  display: flex; align-items: center; gap: 11px; padding: 10px 6px;
  border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 12px;
}
.mini-hw:last-child { border-bottom: none; }
.mini-hw.overdue { background: var(--u-late-bg); border-bottom-color: transparent;
  margin-bottom: 4px; }
.mh-body { flex: 1; min-width: 0; }
.mh-title { font-weight: 800; font-size: 14px; }
.mh-due { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 1px; }

/* ---------- countdown badges & status chips ---------- */
.count-badge {
  flex: 0 0 50px; width: 50px; height: 50px; border-radius: 15px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; line-height: 1; gap: 2px;
  font-family: var(--font-display);
}
.count-badge .cb-num { font-size: 19px; font-weight: 700; }
.count-badge .cb-unit { font-size: 8.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; font-family: 'Nunito', sans-serif; }
.count-badge.u-late { background: var(--u-late); color: #fff; }
.count-badge.u-today { background: var(--u-today); color: #fff; }
.count-badge.u-tomorrow { background: var(--u-soon); color: #fff; }
.count-badge.u-soon { background: var(--u-soon-bg); color: var(--u-soon); }
.count-badge.u-later { background: var(--u-later-bg); color: var(--u-later); }
.count-badge.u-done { background: var(--u-done-bg); color: var(--u-done); }
.count-badge.u-wait { background: var(--u-wait-bg); color: var(--u-wait); }
.status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 900; border-radius: 999px; padding: 2.5px 9px;
  vertical-align: 2px; white-space: nowrap;
}
.status-chip.late { background: var(--u-late); color: #fff; }
.status-chip.today { background: var(--u-today); color: #fff; }
.status-chip.wait { background: var(--u-wait-bg); color: var(--u-wait);
  animation: pulse-soft 2s ease-in-out infinite; }
.status-chip.ok { background: var(--u-done-bg); color: var(--u-done); }
@keyframes pulse-soft {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: .82; }
}
@media (prefers-reduced-motion: reduce) {
  .status-chip.wait { animation: none; }
  .nc-progress > span { transition: none; }
}

/* ---------- compact link chips (kid home) ---------- */
.link-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.link-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 800;
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  white-space: nowrap; cursor: pointer; font-family: 'Nunito', sans-serif;
}
.link-chip:hover { border-color: var(--sc, var(--accent)); }
.link-chip.more { color: var(--muted); border-style: dashed; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 800; }

/* ---------- done drawer ---------- */
.done-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 18px 0 8px; padding: 10px 14px; font: inherit; font-weight: 900;
  font-size: 14px; color: var(--muted); background: var(--card);
  border: 1.5px dashed var(--line); border-radius: 14px; cursor: pointer;
}
.done-toggle:hover { border-color: var(--u-done); color: var(--u-done); }

/* ---------- points ---------- */
.hh-row { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; }
.pts-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fef3c7; color: #92400e; border: 2px solid #fcd34d;
  border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 900;
  white-space: nowrap;
}
.pts-chip.big { font-size: 17px; padding: 8px 18px; border-radius: 999px;
  font-family: var(--font-display); box-shadow: var(--shadow); }
.trade-btn {
  margin-left: auto; font: inherit; font-size: 12px; font-weight: 800;
  cursor: pointer; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.trade-btn:hover { border-color: var(--accent); }
.hc-head-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  flex-wrap: wrap; }
.hc-head-row .hc-head { margin: 0; }
.hint-inline { font-size: 12px; font-weight: 800; color: var(--muted);
  font-family: 'Nunito', sans-serif; }

/* ---------- class schedule on calendar ---------- */
.sched-card { max-width: 760px; }
.sched-row {
  display: flex; gap: 12px; align-items: baseline; padding: 7px 4px;
  border-bottom: 1px dashed var(--line); font-size: 14px;
}
.sched-row:last-child { border-bottom: none; }
.sr-period {
  flex: 0 0 44px; text-align: center; font-family: var(--font-display);
  font-weight: 700; font-size: 12px; color: var(--sc, var(--accent));
  background: color-mix(in srgb, var(--sc, var(--accent)) 12%, transparent);
  border-radius: 8px; padding: 2px 0; align-self: center;
}
.sr-time { flex: 0 0 118px; font-weight: 900; font-size: 12px;
  color: var(--muted); text-transform: uppercase; }
.t-avatar {
  border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.18);
  align-self: center;
}
.t-avatar-pair { display: flex; flex: 0 0 auto; }
.t-avatar-pair .t-avatar:last-child { margin-left: -12px; }
.sched-row.commute { background: color-mix(in srgb, var(--sc, var(--accent)) 7%, transparent);
  border-radius: 10px; border-bottom: none; margin: 2px 0; }
.sched-row.commute .sr-class { font-weight: 900; }

/* ---------- activity picker ---------- */
.act-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px;
  overflow-y: auto; padding-right: 4px; }
.act-row {
  display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas:
  "check name when" "check who who"; align-items: center; gap: 0 8px;
  text-align: left; font: inherit; cursor: pointer;
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
  padding: 8px 12px; transition: border-color .12s, background .12s;
}
.act-row:hover { border-color: #7c3aed; }
.act-row.selected { border-color: #7c3aed; background: #f5f3ff; }
.act-check { grid-area: check; font-size: 16px; }
.act-name { grid-area: name; font-weight: 800; font-size: 14px; }
.act-when { grid-area: when; font-weight: 900; font-size: 11.5px;
  color: #7c3aed; white-space: nowrap; }
.act-who { grid-area: who; font-size: 12px; color: var(--muted); font-weight: 600; }
.act-row { grid-template-areas: "check name when" "check who who" "check desc desc"; }
.act-desc { grid-area: desc; font-size: 12.5px; color: var(--ink);
  font-weight: 500; line-height: 1.45; margin-top: 4px; }
.act-grade { font-size: 10.5px; font-weight: 900; color: #7c3aed;
  background: #ede9fe; border-radius: 999px; padding: 1px 7px;
  vertical-align: 1px; }
.lunch-req-when { font: inherit; font-weight: 700; padding: 7px 10px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.plan-grid { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.plan-row { display: flex; align-items: center; gap: 10px; }
.plan-row .me-when { min-width: 92px; }
.plan-input { flex: 1; font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--card); }
.plan-input:focus { border-color: var(--accent); outline: none; }
.mh-title.pre { white-space: pre-wrap; font-weight: 600; font-size: 13px; }

/* ---------- brain boost ---------- */
.vocab-word { font-size: 14.5px; padding: 5px 2px; font-weight: 600; }
.vocab-word b { color: #0891b2; font-size: 15.5px; }
.vocab-quiz { margin: 8px 0 4px; }
.vocab-opt { display: flex; width: 100%; text-align: left; font: inherit;
  border: 2px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 8px 12px; margin-top: 6px; cursor: pointer; font-weight: 600;
  font-size: 13.5px; }
.vocab-opt:hover { border-color: #0891b2; }
.hint-p.fact { font-size: 14px; color: var(--ink); font-weight: 600;
  background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.drill-q { font-family: var(--font-display); font-size: 34px; font-weight: 700;
  text-align: center; padding: 8px 0; }
.drill-q.eq { color: #0891b2; font-size: 28px; }
.drill-in { width: 110px; font-size: 22px; text-align: center;
  font-family: var(--font-display); }
.drill-live .pb-request { justify-content: center; }
.drill-start { width: 100%; justify-content: center; font-size: 15px;
  padding: 12px; border-color: #0891b2; color: #0891b2; }
.drill-result { text-align: center; }

/* ---------- rules review ---------- */
.rule-block {
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px;
  margin-bottom: 8px; background: var(--bg);
}
.rule-block.read { border-color: var(--u-done); background: #f0fdf4; }
.rule-title {
  display: flex; align-items: center; gap: 10px; font-weight: 900;
  font-size: 14.5px; cursor: pointer;
}
.rule-title input { width: 20px; height: 20px; accent-color: var(--u-done); }
.rule-readtag { margin-left: auto; font-size: 11px; font-weight: 900;
  color: var(--muted); text-transform: uppercase; }
.rule-block.read .rule-readtag { color: var(--u-done); }
.rule-bullets { margin: 8px 0 2px 6px; padding-left: 20px; }
.rule-bullets li { font-size: 13.5px; line-height: 1.5; margin-bottom: 5px;
  font-weight: 600; }
.quiz-box { border-top: 2px dashed var(--line); margin-top: 12px; padding-top: 8px; }
.quiz-q { margin-bottom: 12px; }
.qq-text { font-weight: 800; font-size: 14px; margin-bottom: 5px; }
.qq-opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.qq-opt:hover { background: var(--bg); }
.qq-opt input { accent-color: #dc2626; }
.sr-class { font-weight: 800; flex: 0 0 auto; }
.sr-where { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.sched-block { margin-top: 6px; border-top: 1.5px dashed var(--line);
  padding-top: 4px; }
.sched-tabs { display: flex; gap: 3px; background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 3px;
  margin-left: auto; }
.sched-tab {
  border: none; background: transparent; font: inherit; font-weight: 800;
  font-size: 12.5px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  color: var(--muted);
}
.sched-tab.active { background: var(--sc, var(--accent)); color: #fff; }
.hw-flag {
  display: inline-flex; align-items: center; gap: 4px; font: inherit;
  font-size: 11px; font-weight: 900; cursor: pointer; border: none;
  border-radius: 999px; padding: 3px 10px; margin-left: auto;
  white-space: nowrap;
}
.hw-flag.f-late { background: var(--u-late); color: #fff; }
.hw-flag.f-today { background: var(--u-today); color: #fff; }
.hw-flag.f-tomorrow { background: var(--u-soon); color: #fff; }
.hw-flag.f-soon { background: var(--u-soon-bg); color: var(--u-soon); }
.hw-flag.f-later { background: var(--u-later-bg); color: var(--u-later); }
.hw-flag.f-wait { background: var(--u-wait-bg); color: var(--u-wait); }
.hw-flag:hover { filter: brightness(1.06); }
.sched-row { flex-wrap: wrap; }
.sched-hw-panel {
  background: var(--bg); border-radius: 14px; padding: 6px 10px;
  margin: 2px 0 8px;
}
.sched-hw-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 2px;
  border-bottom: 1px dashed var(--line);
}
.sched-hw-row:last-child { border-bottom: none; }
.sched-hw-row .count-badge { flex: 0 0 42px; width: 42px; height: 42px; }
.shw-worth { display: inline-block; font-size: 11.5px; font-weight: 900;
  color: #b45309; background: #fef3c7; border-radius: 999px; padding: 1.5px 9px;
  margin-left: 6px; }
.shw-worth.due { color: #fff; background: var(--u-today); }
.hd-btn.mini { font-size: 11.5px; padding: 4px 10px; white-space: nowrap; }
.hd-btn.ok { border-color: var(--u-done); color: var(--u-done); }
.sched-date-line { font-size: 12px; font-weight: 900; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin: -4px 0 6px; }
.overdue-alert {
  background: var(--u-late-bg); border: 2px solid var(--u-late);
  border-radius: 14px; padding: 8px 12px; margin-bottom: 10px;
}
.oa-head { font-weight: 900; font-size: 13px; color: var(--u-late);
  margin-bottom: 4px; }
.pb-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px;
  border-bottom: 1px dashed var(--line); }
.pb-row:last-child { border-bottom: none; }
.pb-pts { flex: 0 0 46px; text-align: center; font-family: var(--font-display);
  font-weight: 700; font-size: 16px; border-radius: 10px; padding: 6px 0; }
.pb-pts.earn { background: var(--u-done-bg); color: var(--u-done); }
.pb-pts.spend { background: var(--u-later-bg); color: var(--u-later); }
.pb-worth { font-size: 12.5px; font-weight: 800; color: var(--muted);
  margin-bottom: 10px; }
.pb-request { display: flex; gap: 8px; margin: 6px 0 10px; flex-wrap: wrap; }
.pb-req-pts { width: 70px; font: inherit; font-weight: 800; padding: 7px 10px;
  border: 1.5px solid var(--line); border-radius: 10px; }
.pb-req-reason { flex: 1; min-width: 180px; font: inherit; font-weight: 600;
  padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 10px; }
.pts-chip { cursor: pointer; font-family: 'Nunito', sans-serif; }
.home-alert { max-width: none; }
.hw-subtabs { margin-bottom: 12px; }
.cl-done { text-decoration: line-through; opacity: .55; }
.cl-row .cl-del { opacity: 0; transition: opacity .12s; }
.cl-row:hover .cl-del { opacity: 1; }
#cl-add { margin-top: 10px; }
.month-group { margin-top: 14px; border: 1.5px solid var(--line);
  border-radius: 14px; background: var(--card); padding: 4px 14px 10px; }
.month-group summary { cursor: pointer; font-weight: 900; font-size: 14px;
  padding: 8px 0; color: var(--muted); font-family: var(--font-display); }
.month-group[open] summary { color: var(--ink); }
.hw-section-head.sub { font-size: 12.5px; color: var(--muted); margin: 10px 0 2px; }
.sched-off { padding: 12px 14px 14px; margin-bottom: 6px; }
.sched-off .nc-class { font-size: 17px; }
.status-chip.started { background: #e0f2fe; color: #0369a1; }
.hw-ctl.start { color: #0369a1; }
.hw-ctl.start input { accent-color: #0369a1; width: 17px; height: 17px; }
.view-as {
  font: inherit; font-weight: 800; font-size: 12.5px; padding: 7px 10px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--muted); cursor: pointer; max-width: 120px;
}
.viewas-banner {
  position: sticky; top: 0; z-index: 60; background: #0369a1; color: #fff;
  text-align: center; font-weight: 800; font-size: 13.5px; padding: 8px 12px;
}
.viewas-banner button {
  font: inherit; font-weight: 900; color: #0369a1; background: #fff;
  border: none; border-radius: 999px; padding: 3px 12px; margin-left: 8px;
  cursor: pointer;
}
.sched-mini { font-size: 10.5px; font-weight: 700; color: var(--muted);
  padding: 1.5px 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }

/* ---------- expandable homework details ---------- */
.hw-item { border-bottom: 1px solid var(--line); }
.hw-item:last-child { border-bottom: none; }
.hw-item .mini-hw, .hw-item .hw-card { border-bottom: none; }
.hw-toggle { cursor: pointer; }
.hw-chevron {
  flex: 0 0 auto; font-size: 15px; color: var(--muted); font-weight: 900;
  transition: transform .18s ease; margin-left: 2px; align-self: center;
}
.hw-chevron.open { transform: rotate(180deg); }
.hw-details {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease;
}
.hw-details.open { grid-template-rows: 1fr; }
.hw-details .hd-inner { overflow: hidden; }
.hw-details.open .hd-inner {
  padding: 4px 10px 14px 66px; }
.hd-notes {
  margin: 4px 0 8px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
  background: var(--bg); border-radius: 12px; padding: 10px 12px;
}
.hd-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px;
  font-weight: 700; color: var(--muted); margin-bottom: 10px;
}
.hd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hd-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit;
  font-size: 13px; font-weight: 800; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 6px 14px; transition: border-color .12s;
}
.hd-btn:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .hw-details, .hw-chevron { transition: none; }
}
@media (max-width: 720px) {
  .hw-details.open .hd-inner { padding-left: 14px; }
}

/* ---------- add-to-calendar ---------- */
.cal-btn {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 5px 9px; font-size: 13px; cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.cal-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.cal-export-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; }
.cal-export-label { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.cal-export-btn {
  font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px;
  padding: 5px 13px;
}
.cal-export-btn:hover { border-color: var(--accent); }
.all-clear { padding: 10px 4px; font-weight: 800; color: var(--muted); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; }
.link-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; background: var(--bg); border: 2px solid var(--line);
  border-radius: 14px; text-decoration: none; color: var(--ink);
  text-align: center; transition: transform .1s, border-color .1s;
}
.link-tile:hover { transform: translateY(-2px); border-color: var(--sc, var(--accent)); }
.lt-icon { font-size: 28px; }
.lt-title { font-size: 12.5px; font-weight: 800; line-height: 1.25; }

/* ---------- controls ---------- */
main { padding: 10px 20px 60px; max-width: 1200px; margin: 0 auto; }
.controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 10px 0 16px;
}
.page-title { margin: 0; font-size: 22px; font-weight: 900; }
.view-switch, .person-filter { display: flex; gap: 4px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.view-switch button, .person-filter button {
  border: none; background: transparent; font: inherit; font-weight: 800;
  font-size: 13px; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  color: var(--muted);
}
.view-switch button.active { background: var(--ink); color: #fff; }
.person-filter button.active { background: var(--ink); color: #fff; }
.person-filter button.chip-dylan.active { background: var(--dylan); }
.person-filter button.chip-lucy.active { background: var(--lucy); }
.person-filter button.chip-family.active { background: var(--family); }
.nav-controls { display: flex; align-items: center; gap: 6px; }
.nav-controls button {
  border: 1.5px solid var(--line); background: var(--card); font: inherit;
  font-weight: 800; padding: 6px 12px; border-radius: 10px; cursor: pointer;
}
.nav-controls h2 { margin: 0 0 0 8px; font-size: 18px; font-weight: 900; }

/* ---------- month grid ---------- */
.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.dow-label { text-align: center; font-size: 11px; font-weight: 900;
  color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.day-cell {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 10px; min-height: 92px; padding: 5px; font-size: 12px;
  overflow: hidden;
}
.day-cell.other-month { opacity: .38; }
.day-cell.today { border-color: var(--accent); border-width: 2.5px; }
.day-num { font-weight: 900; font-size: 12px; margin-bottom: 3px; }
.day-cell.today .day-num { color: var(--accent); }

/* ---------- event pills ---------- */
.event-pill {
  display: block; width: 100%; text-align: left; border: none; font: inherit;
  border-radius: 7px; padding: 2px 7px; margin-bottom: 3px; font-size: 11.5px;
  font-weight: 700; cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: #fff; background: var(--muted);
}
.event-pill.p-dylan { background: var(--dylan); }
.event-pill.p-lucy { background: var(--lucy); }
.event-pill.p-family { background: var(--family); }
.event-pill.is-done { opacity: .45; text-decoration: line-through; }

/* ---------- week view ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-col { background: var(--card); border: 1.5px solid var(--line);
  border-radius: 10px; min-height: 220px; padding: 6px; }
.week-col.today { border-color: var(--accent); border-width: 2.5px; }
.week-col .col-head { font-weight: 900; font-size: 12px; margin-bottom: 6px;
  text-align: center; }
.week-col .col-head .dnum { font-size: 18px; display: block; }

/* ---------- day / list view ---------- */
.agenda { display: flex; flex-direction: column; gap: 10px; }
.agenda-day-head { font-weight: 900; font-size: 14px; color: var(--muted);
  margin: 14px 0 2px; text-transform: uppercase; letter-spacing: .4px; }
.agenda-card {
  display: flex; gap: 12px; align-items: flex-start; background: var(--card);
  border: 1.5px solid var(--line); border-left-width: 6px; border-radius: 12px;
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.agenda-card.p-dylan { border-left-color: var(--dylan); }
.agenda-card.p-lucy { border-left-color: var(--lucy); }
.agenda-card.p-family { border-left-color: var(--family); }
.agenda-card.is-done { opacity: .5; }
.agenda-card.is-done .ac-title { text-decoration: line-through; }
.agenda-emoji { font-size: 22px; }
.ac-title { font-weight: 800; font-size: 15px; }
.ac-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.ac-notes { font-size: 12.5px; margin-top: 4px; color: var(--ink); }
.person-tag {
  display: inline-block; font-size: 10.5px; font-weight: 900; color: #fff;
  border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px;
  background: var(--muted);
}
.person-tag.p-dylan { background: var(--dylan); }
.person-tag.p-lucy { background: var(--lucy); }
.person-tag.p-family { background: var(--family); }
.empty-note { color: var(--muted); font-weight: 700; text-align: center;
  padding: 40px 0; }

/* ---------- homework ---------- */
.hw-section-head { font-weight: 900; font-size: 15px; margin: 18px 0 8px; }
.hw-card { display: flex; gap: 10px; align-items: center; }
.hw-controls { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.hw-ctl {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 800; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.hw-ctl input { width: 20px; height: 20px; accent-color: var(--muted); cursor: pointer; }
.hw-ctl.approve { color: var(--family); }
.hw-ctl.approve input { width: 24px; height: 24px; accent-color: var(--family); }
.hw-status {
  display: inline-block; font-size: 11px; font-weight: 900; margin-left: 8px;
  padding: 2px 9px; border-radius: 999px; vertical-align: 1px;
}
.hw-status.ok { background: var(--family-bg); color: var(--family); }
.hw-status.wait { background: #fef3c7; color: #b45309; }
.hw-overdue .ac-meta { color: var(--danger); font-weight: 800; }

/* ---------- info ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px; }
.info-card { background: var(--card); border: 1.5px solid var(--line);
  border-top: 6px solid var(--dylan); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.info-card.p-lucy { border-top-color: var(--lucy); }
.info-card.p-family { border-top-color: var(--family); }
.info-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 900; }
.info-card .who { font-size: 11px; font-weight: 900; text-transform: uppercase;
  color: var(--muted); letter-spacing: .5px; }
.info-card p { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
  margin: 6px 0 0; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 38, 32, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 18px; padding: 22px;
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal h3 { margin: 0 0 14px; font-weight: 900; }
.modal label { display: block; font-size: 12.5px; font-weight: 800;
  margin-bottom: 10px; color: var(--muted); }
.modal .hint { font-weight: 600; }
.modal input, .modal select, .modal textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 600;
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.modal-actions .spacer { flex: 1; }
.modal-actions button {
  font: inherit; font-weight: 800; padding: 9px 18px; border-radius: 999px;
  cursor: pointer; border: 1.5px solid var(--line); background: var(--card);
}
.modal-actions .primary { background: var(--accent); border-color: var(--accent);
  color: #fff; }
.modal-actions .danger { background: transparent; border-color: var(--danger);
  color: var(--danger); }

/* ---------- profile modal ---------- */
.profile-top { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.p-avatar-preview {
  width: 72px; height: 72px; flex: 0 0 72px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); display: flex;
  align-items: center; justify-content: center; font-size: 38px; overflow: hidden;
}
.p-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer;
}
.swatch.selected { border-color: var(--ink); }
.bg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 10px; }
.bg-tile {
  height: 44px; border-radius: 10px; border: 3px solid transparent; cursor: pointer;
}
.bg-tile.selected { border-color: var(--ink); }
.hint-p { font-size: 12px; color: var(--muted); font-weight: 600; margin: 4px 0 8px; }
.logout-link { font-size: 13px; font-weight: 800; color: var(--danger); }
.modal hr { border: none; border-top: 1.5px solid var(--line); margin: 14px 0; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; }
.login-card { background: var(--card); border-radius: 20px; padding: 40px;
  text-align: center; box-shadow: var(--shadow); max-width: 340px; width: 90%; }
.login-emoji { font-size: 54px; }
.login-card h1 { font-size: 22px; font-weight: 900; margin: 10px 0 4px; }
.login-card p { color: var(--muted); font-weight: 700; margin: 0 0 16px; }
.login-error { color: var(--danger) !important; }
.login-card input { width: 100%; font: inherit; font-weight: 600; padding: 10px;
  border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 10px;
  text-align: center; }
.login-card .primary { width: 100%; font: inherit; font-weight: 900;
  background: var(--accent); color: #fff; border: none; padding: 11px;
  border-radius: 999px; cursor: pointer; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px; border: 2px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font-weight: 800; text-decoration: none;
  margin-bottom: 6px;
}
.google-btn:hover { border-color: var(--accent); }
.kid-google-row { display: flex; gap: 8px; margin-top: 8px; }
.kid-google-btn {
  flex: 1; padding: 9px 6px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink); font-weight: 800; font-size: 13px;
  text-decoration: none; text-align: center;
}
.kid-google-btn:hover { border-color: var(--accent); }
.login-divider {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: 12px; font-weight: 700; margin: 12px 0;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; border-top: 1.5px solid var(--line);
}
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.picker-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px; border: 2.5px solid var(--line); border-radius: 14px;
  background: var(--bg); font: inherit; cursor: pointer;
}
.picker-btn.selected, .picker-btn:hover { border-color: var(--pc, var(--accent)); }
.picker-btn img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.picker-emoji { font-size: 40px; }
.picker-name { font-weight: 900; font-size: 15px; }
.picker-role { font-size: 11px; font-weight: 700; color: var(--muted); }
#pin-row { display: grid; gap: 8px; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
  .brand-emoji { font-size: 24px; }
  .main-tab { font-size: 13px; padding: 6px 10px; }
  .main-tabs { order: 3; flex-basis: 100%; padding: 4px 5px; }
  .me-btn #me-name { display: none; }
  .hh-greet { font-size: 22px; }
  main { padding: 8px 10px 60px; }
  .month-grid { gap: 3px; }
  .day-cell { min-height: 64px; padding: 3px; border-radius: 7px; }
  .event-pill { font-size: 9px; padding: 1px 4px; }
  .week-grid { grid-template-columns: 1fr; }
  .week-col { min-height: unset; }
  .form-row { grid-template-columns: 1fr; }
  .controls { gap: 8px; }
}
