:root {
  --bg: #f6f5f2; --card: #fff; --ink: #1f2328; --muted: #6b6f76; --line: #e3e1dc;
  --accent: #2f6f6a; --accent-ink: #fff; --accent-soft: #e4efed; --danger: #b3261e; --danger-bg: #b3261e; --ok: #2e7d4f;
  --warn: #f0c24b; --warn-ink: #1f2328;
  --full: #2e7d4f; --late: #f0c24b; --partial: #f2a65a; --absent: #b3261e; --none: #d6d3cc; --off: #eeece7;
  --dad: #2f5f9e; --mom: #8a4f9e;
  --tabs-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16181b; --card: #1f2226; --ink: #e8e6e3; --muted: #9a9ea5; --line: #33373c; --none: #3a3e44; --off: #24272b;
          --accent: #5fb0a8; --accent-ink: #06201e; --accent-soft: #24393a; --danger: #f2877f; --ok: #6fc28f; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
main { max-width: 960px; margin: 0 auto; padding: 12px; }
h1 { font-size: 1.4rem; margin: 0 0 6px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header and navigation ---------- */
.top { display: flex; gap: 16px; align-items: center; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap; }
.top .brand img { display: block; border-radius: 7px; }
.top nav.menu { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav.menu a { text-decoration: none; color: var(--muted); padding: 6px 9px; border-radius: 8px; white-space: nowrap; }
.top nav.menu a:hover { color: var(--ink); background: var(--bg); }
.top nav.menu a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.menu-button, .menu-backdrop, .menu-head { display: none; }
.menu-group { display: contents; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 10px 14px; z-index: 20; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.menu-button svg, .tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: none; }

@media (max-width: 760px) {
  main { padding: 8px 10px; }
  body.signed-in main { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); }
  .top { justify-content: space-between; }
  .menu-button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 0; padding: 0; margin-right: -10px; border: 0; background: none; border-radius: 10px; color: var(--ink); cursor: pointer; }
  /* Full menu: a sheet that drops from the header */
  .top nav.menu { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 12; flex-direction: column; flex-wrap: nowrap; gap: 0;
                  background: var(--card); border-bottom: 1px solid var(--line); padding: 4px 10px 12px; box-shadow: 0 10px 24px rgba(0,0,0,.12);
                  max-height: calc(100dvh - 60px - var(--tabs-h) - var(--safe-b)); overflow-y: auto; }
  .menu-group { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
  .menu-group:last-child { border-bottom: 0; }
  .menu-head { display: block; grid-column: 1 / -1; padding: 8px 10px 2px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .top nav.menu a { padding: 11px 10px; font-size: 1.02rem; color: var(--ink); }
  .menu-open .top nav.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; }
  .menu-open .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 11; background: rgba(0,0,0,.25); }
  /* Bottom tab bar */
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; background: var(--card); border-top: 1px solid var(--line);
          padding-bottom: var(--safe-b); height: calc(var(--tabs-h) + var(--safe-b)); }
  .tabs a, .tabs button { flex: 1; border: 0; background: none; padding: 0; min-height: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
                         font-size: .72rem; color: var(--muted); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabs a[aria-current], .menu-open .tabs button { color: var(--accent); font-weight: 600; }
  .tabs a { position: relative; }
  .tabs .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  .tabs .tab-log { color: var(--accent); font-weight: 600; }
  .tabs .tab-log svg { width: 40px; height: 40px; padding: 8px; margin-top: -4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); stroke-width: 2.5; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.card:has(> table) { overflow-x: auto; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.between { justify-content: space-between; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: inline; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select, textarea, button, .button { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { width: 100%; }
input[type=text], input[type=email] { width: 100%; }
.row input[type=text], .row input[type=email], .row input[type=tel] { flex: 1; min-width: 160px; }
button, .button { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; }
button:active, .button:active { transform: translateY(1px); }
input, select { min-height: 44px; }
input[type=radio], input[type=checkbox] { min-height: 0; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.danger { color: var(--danger); border-color: var(--danger); }
.quiet { color: var(--muted); }
button.link { border: 0; background: none; color: var(--muted); padding: 0 4px; min-height: 0; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.flash { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.flash.error { background: none; border: 1px solid var(--danger); }
.flash p { margin: 0; }
.notes { white-space: pre-wrap; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.choices legend { font-size: .9rem; color: var(--muted); margin-bottom: 4px; width: 100%; }
.chip { position: relative; flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 44px; color: var(--ink); cursor: pointer; background: var(--card); -webkit-tap-highlight-color: transparent; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.strip { display: flex; gap: 3px; flex-wrap: wrap; }
.strip .day { width: 38px; text-align: center; border-radius: 6px; padding: 4px 0; text-decoration: none; color: #fff; background: var(--none); display: flex; flex-direction: column; line-height: 1.1; font-size: .8rem; }
.strip .day small { font-size: .7rem; opacity: .85; }
.strip .day.off { background: var(--off); color: var(--muted); }
.att-full, .strip .att-full { background: var(--full); }
.att-late, .strip .day.att-late { background: var(--late); color: var(--warn-ink); }
.att-partial, .strip .day.att-partial { background: var(--partial); color: var(--warn-ink); }
.strip .day.is-today { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.legend i.att-none { background: var(--none); }
.att-absent, .strip .att-absent { background: var(--absent); }
.strip .day.att-none:not(.off) { color: var(--ink); }
.att { color: #fff; padding: 2px 8px; border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.att.att-late, .att.att-partial { color: var(--warn-ink); }
.att.att-none, .att.att-no_school { background: var(--none); color: var(--ink); }
ul.items, ul.events, ul.contacts { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .check { width: 44px; height: 44px; min-height: 0; padding: 0; margin: -6px -8px -6px -8px; border: 0; background: none; flex: none; }
.item .check span { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 8px; color: var(--accent-ink); font-weight: 700; font-size: .9rem; line-height: 1; }
.item.done .check span { background: var(--accent); border-color: var(--accent); }
.item-body { min-width: 0; flex: 1; }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-soon { color: var(--ink); font-weight: 600; }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.item-title { color: var(--ink); text-decoration: none; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.details { font-size: .85rem; color: var(--muted); white-space: pre-wrap; }
.tag { padding: 0 8px; border-radius: 999px; color: #fff; font-size: .78rem; background: var(--muted); }
.owner-dad { background: var(--dad); } .owner-mom { background: var(--mom); } .owner-both { background: var(--accent); }
ul.events li, ul.contacts li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.events .date { display: inline-block; min-width: 86px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-no_school { color: var(--danger); }
.ev-early_release { color: var(--muted); }
.ev-school_milestone, .ev-meeting, .ev-appointment { font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-input { width: 90px; }
tr.fail td:first-child { color: var(--danger); }
table.cal tr.off td { background: var(--off); }
table.cal tr.monday td { border-top: 2px solid var(--line); }
table.cal td.date { white-space: nowrap; width: 90px; color: var(--muted); }
pre.preview { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 8px; font-size: .85rem; }
.filters select { min-width: 120px; }

ul.messages { list-style: none; padding: 0; margin: 0; }
ul.messages li { padding: .5rem 0; border-bottom: 1px solid rgba(127,127,127,.2); }
ul.messages li.msg-outgoing { padding-left: 1.5rem; }
ul.messages .notes { margin: .25rem 0 0; white-space: pre-wrap; }
.tag.prio-high { background: var(--danger-bg); color: #fff; }
.tag.prio-low { opacity: .7; }

/* ---------- login ---------- */
.signin-logo { display: block; width: 64px; height: 64px; margin: 8px auto 12px; border-radius: 15px; }
.signin { text-align: center; }
.signin form { text-align: left; margin-top: 12px; }
.signin form button { width: 100%; margin-top: 10px; }

/* ---------- phone layouts ---------- */
@media (max-width: 760px) {
  h1 { font-size: 1.3rem; }
  .card { padding: 14px; margin: 10px 0; border-radius: 12px; }
  .row > label { flex: 1 1 140px; }
  .row > label input, .row > label select { width: 100%; }
  form.stack > button.primary { width: 100%; }
  .strip .day { width: calc((100% - 6 * 3px) / 7); max-width: 44px; padding: 6px 0; }
  /* The daily log table becomes one card per day */
  table.logs tr:first-child:has(th) { display: none; }
  table.logs tr { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.logs td { display: block; padding: 0; border: 0; }
  table.logs td:empty { display: none; }
  table.logs td:first-child { font-weight: 600; }
  table.logs:not(.activity) td:nth-child(4):not(:empty)::before { content: "School record: "; color: var(--muted); }
  table.logs td:nth-child(4) { flex-basis: 100%; }
  table.logs td:nth-child(5)::before { content: "up "; color: var(--muted); }
  table.logs td:nth-child(6)::before { content: "mood "; color: var(--muted); }
  table.logs td:nth-child(7) { flex-basis: 100%; color: var(--muted); }
  table.cal td.date { width: auto; }
  .grades td.small { font-size: .75rem; }
  /* Keep the save button in reach on the log form */
  .log-form .save { position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
}

.upload-preview { max-width: 100%; height: auto; border-radius: 6px; }
ul.thresholds { list-style: none; padding: 0; margin: 0; }
ul.thresholds li { padding: .6rem 0; border-bottom: 1px solid rgba(127,127,127,.2); }
.bar { position: relative; height: 8px; background: rgba(127,127,127,.2); border-radius: 4px; margin: .35rem 0; overflow: visible; }
.bar span { display: block; height: 100%; border-radius: 4px; background: var(--full, #2e7d32); }
.bar i { position: absolute; top: -3px; width: 2px; height: 14px; background: currentColor; opacity: .5; }
.thr-watch .bar span { background: var(--warn); }
.thr-at_risk .bar span, .thr-over .bar span { background: var(--danger-bg); }
.thr-over .thr-tag { background: var(--danger-bg); color: #fff; }
.thr-at_risk .thr-tag { background: none; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.thr-watch .thr-tag { background: var(--warn); color: var(--warn-ink); }
.thr-ok .thr-tag { background: var(--full); }
.thr details { margin-top: 2px; }
.thr summary, details.more > summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: 6px 0; }
.nowrap { white-space: nowrap; }

/* ---------- shared pieces ---------- */
h3 { font-size: 1rem; margin: 14px 0 6px; }
.lede { color: var(--muted); margin: 0 0 10px; }
.card > :last-child { margin-bottom: 0; }
.card-link { display: inline-block; padding: 8px 0 0; font-weight: 600; text-decoration: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 0; list-style: none; }
.seg a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; background: var(--card); }
.seg a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg a[aria-current] .count { color: inherit; }
.count { color: var(--muted); font-size: .85rem; }
.group-title { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 16px 0 2px; }
.group-title.overdue { color: var(--danger); }
details.add > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; color: var(--accent); }
details.add > summary::-webkit-details-marker { display: none; }
details.add[open] > summary { margin-bottom: 12px; }
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav h1 { margin: 0; text-align: center; flex: 1; }
.daynav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
button.link, a.link { display: inline-flex; align-items: center; min-height: 32px; }
table.cal tr.today td { background: var(--accent-soft); }
table.cal tr.today td.date { color: var(--ink); font-weight: 600; }
.sub { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.plain > li:last-child { border-bottom: 0; }
.pick { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; color: var(--ink); font-size: 1rem; cursor: pointer; }
.pick input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; }
.pick-mark { width: 22px; flex: none; color: var(--ok); font-weight: 700; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- messages: conversation list, chat, announcements ---------- */
ul.convs { list-style: none; margin: 0; padding: 0; }
.conv { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
ul.convs li:last-child .conv { border-bottom: 0; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.conv-body { min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; }
.conv-name { font-weight: 600; overflow-wrap: anywhere; }
.conv-body .meta { margin-top: 2px; }
.conv-time { flex: none; font-size: .8rem; color: var(--muted); }
.conv-preview { color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.conv-chevron { flex: none; align-self: center; color: var(--muted); }
.thread-head { display: flex; gap: 10px; align-items: center; }
.thread-head .back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -10px; border-radius: 10px; text-decoration: none; font-size: 1.4rem; }
.thread-head h1 { margin: 0; font-size: 1.15rem; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.chat-day { align-self: center; font-size: .78rem; color: var(--muted); background: var(--bg); padding: 2px 10px; border-radius: 999px; margin: 6px 0 0; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.msg-who { font-size: .78rem; color: var(--muted); margin: 0 6px 2px; }
.msg-who strong { color: var(--ink); }
.bubble { margin: 0; padding: 9px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.family { align-self: flex-end; align-items: flex-end; }
.msg.family .bubble { border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; background: var(--accent-soft); }
.msg.mine .bubble { background: var(--accent); color: var(--accent-ink); }
.msg details { font-size: .8rem; color: var(--muted); margin: 2px 6px 0; }
.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.composer textarea { flex: 1; min-height: 44px; border-radius: 18px; padding: 10px 14px; resize: vertical; }
.composer button { border-radius: 999px; }
.notice { padding: 14px 0; border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.notice-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.notice-from { font-weight: 600; }
.notice-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice.urgent { border-left: 3px solid var(--danger); padding-left: 12px; }

@media (max-width: 760px) {
  .seg a { padding: 6px 12px; }
  .daynav h1 { font-size: 1.1rem; }
  .composer { flex-wrap: wrap; justify-content: flex-end; }
  .composer textarea { flex-basis: 100%; }
  .composer { position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b)); background: var(--card); padding: 10px 0; margin-bottom: -14px; }
  /* Plan: calendar vs plan rows stack */
  table.stack tr:first-child:has(th) { display: none; }
  table.stack tr { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack td { display: block; padding: 0; border: 0; width: auto; }
  table.stack td:first-child, table.stack td.wide { flex-basis: 100%; }
  table.stack td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .85rem; }
}

/* ---------- "the tracker was updated" banner ---------- */
.update-banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 20;
                 display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; max-width: calc(100% - 32px);
                 background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
                 box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.update-banner[hidden] { display: none; }
.update-banner.done { padding: 10px 16px; }
@media (max-width: 760px) { .update-banner { bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); } }

/* Access page: checkbox and radio rows */
.check-row { display: flex; flex-direction: row; align-items: center; color: var(--ink); gap: .5rem; font-weight: normal; }
.check-row input { width: auto; min-height: 0; margin: 0; }
fieldset.hide-fields { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }

/* ---------- quick update (chat) ---------- */
.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
/* white-space: normal undoes the messages page's pre-wrap .bubble, which turned template whitespace into empty space */
.chat .bubble { white-space: normal; max-width: min(560px, 88%); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; background: var(--card); }
.chat .bubble .meta { margin: 0 0 2px; font-size: .78rem; }
.chat .bubble .text { white-space: pre-wrap; margin: 0; }
.chat .bubble p { margin: 0; }
/* One row per message: avatar circle + bubble. Your own messages on the right, everyone else (the other parent,
   AI suggestions) on the left. */
.crow { display: flex; align-items: flex-end; gap: 8px; }
.crow.me { flex-direction: row-reverse; }
.cav { flex: none; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-size: .78rem;
  font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.crow.me .cav { background: var(--accent); color: var(--accent-ink); }
.cav-ai { background: var(--card); border: 1px solid var(--line); font-size: 1rem; }
.chat .crow .bubble { max-width: min(560px, calc(100% - 48px)); border-radius: 18px; }
.chat .crow.me .bubble { border-bottom-right-radius: 6px; }
.chat .crow.other .bubble, .chat .crow.ai .bubble { border-bottom-left-radius: 6px; }
.chat .bubble.from-parent { background: var(--accent-soft); border-color: transparent; }
.chat .crow.other .bubble.from-parent { background: var(--card); border-color: var(--line); }
.chat .crow.ai .bubble.from-claude { max-width: min(640px, calc(100% - 48px)); }
.chat .bubble form { margin-top: 6px; }
.thinking { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .7; } }
.chat-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.chat-error p { flex: 1 1 14rem; }
.proposals { list-style: none; padding: 0; margin: 6px 0 0; }
.proposals li { padding: 6px 0; border-top: 1px solid var(--line); }
.proposals li.skipped { opacity: .6; }
.proposals .check-row { align-items: flex-start; }
.proposals .check-row input { margin-top: 4px; }
.done-mark { display: inline-block; width: 16px; color: var(--full); font-weight: 700; }
.pdetail { margin-left: 24px; }
.tracked-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.tracked-table th, .tracked-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.quick-update .row textarea { flex: 1; min-width: 200px; }

.ev-exchange { font-weight: 600; color: var(--accent); }
.exchange-next { padding: 8px 0; }
.countdown { font-size: 1.15rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: 4px 12px; align-items: baseline; padding: 6px 0 6px 12px; border-left: 2px solid var(--line); position: relative; }
.tl-item::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.tl-item.is-next::before, .tl-item.is-now::before { background: var(--accent); }
.tl-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .92rem; }
.tl-item.is-next .tl-time, .tl-item.is-now .tl-time { color: inherit; font-weight: 600; }
.tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-body .sub { color: var(--muted); font-size: .9rem; }
.tl-body details summary { cursor: pointer; }
.tl-item .countdown { font-size: 1rem; }
.tl-sep { height: 8px; border-left: 2px dashed var(--line); }
@media (max-width: 480px) { .tl-item { grid-template-columns: 3.8rem 1fr; } .tl-item .countdown { grid-column: 2; } }

/* Work and driving page */
.tag.ok-bg { background: var(--ok); }
.card.inset { box-shadow: none; border: 1px solid var(--line); margin-top: 12px; }
.upload-big input[type=file] { display: block; width: 100%; padding: 18px 12px; margin-top: 4px; border: 2px dashed var(--line); border-radius: 12px; }
table.shifts { width: 100%; border-collapse: collapse; }
table.shifts td, table.shifts th { padding: 4px; text-align: left; vertical-align: middle; }
table.shifts input[type=text] { width: 100%; }
table.cal.driving tr.clash td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.exchange-check { border-top: 1px solid var(--line); padding-top: 8px; }
.exchange-check:first-of-type { border-top: 0; }
@media (max-width: 760px) {
  table.shifts tr { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.shifts tr:first-child { display: none; }
  table.shifts td { padding: 0; }
  table.shifts td:first-child, table.shifts td:last-child { flex-basis: 100%; }
}
table.cal.driving .tag, .exchange-check .tag { white-space: nowrap; }
/* Admin: Analyze now progress */
.spinner { display: inline-block; width: .9em; height: .9em; vertical-align: -.1em; border: 2px solid currentColor;
           border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.review-result:focus { outline: none; }

/* --- Second UX pass: fewer things per screen --- */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.clamp, .clamp2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.clamp { -webkit-line-clamp: 3; } .clamp2 { -webkit-line-clamp: 2; }
/* Tabs for the pages inside one destination */
.subnav { display: flex; gap: 4px; margin: 0 0 12px; padding: 4px; overflow-x: auto; background: var(--off); border-radius: 12px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: 1 0 auto; text-align: center; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 14px; border-radius: 9px;
            text-decoration: none; color: var(--muted); font-size: .92rem; white-space: nowrap; }
.subnav a[aria-current] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
/* Explanations and secondary sections stay one tap away */
details.help { margin: 6px 0 0; }
details.help > summary, details.fold > summary { cursor: pointer; color: var(--muted); font-size: .85rem; min-height: 36px; display: flex; align-items: center; gap: 6px; list-style: none; }
details.help > summary::-webkit-details-marker, details.fold > summary::-webkit-details-marker { display: none; }
details.help > summary::before { content: "i"; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; font-size: .7rem; font-weight: 700; font-style: normal; }
details.help[open] > summary { color: var(--ink); }
details.help > :not(summary) { font-size: .85rem; color: var(--muted); }
details.fold > summary { justify-content: space-between; min-height: 44px; color: var(--ink); font-size: 1.05rem; font-weight: 600; }
details.fold > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > summary .count { font-weight: 400; margin-left: 6px; }
details.fold > summary > span:first-child { flex: 1; }
details.fold[open] > summary { margin-bottom: 8px; }
section.card > details.fold:only-child > summary { margin-top: -6px; margin-bottom: -6px; }
section.card > details.fold[open]:only-child > summary { margin-bottom: 8px; }
/* Today */
.quick-line { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 14px; }
.quick-line input[type=text] { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; font-size: 1rem; }
.quick-line input[type=text]:focus { outline: none; }
.quick-line:focus-within { border-color: var(--accent); }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.attention li:first-child { border-top: 0; padding-top: 0; } .attention li:last-child { padding-bottom: 0; }
.attention li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); transform: translateY(-1px); }
.items.compact .details, .items.compact .meta > :not([class^="due-"]):not(.prio-high) { display: none; }
.items.compact .meta:empty { display: none; }
.limits { list-style: none; margin: 0; padding: 0; }
.limits > li { padding: 10px 0; border-top: 1px solid var(--line); }
.limits > li:first-child { border-top: 0; padding-top: 2px; } .limits > li:last-child { padding-bottom: 0; }
.limits summary { list-style: none; cursor: pointer; }
.limits summary::-webkit-details-marker { display: none; }
.limits .limit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.limits .limit-head span { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.limits .bar { margin: 6px 0 0; }
.next-up { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.next-up a { flex: 1 1 140px; display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.next-up a small { display: block; color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) { .card h1 { font-size: 1.35rem; } }
details.fold > summary h2 { margin: 0; font-size: inherit; flex: 1; }
.items:not(.compact) .details { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.chat-day .day-badge { margin-left: 6px; vertical-align: middle; }
.day-badge.tone-ok { background: var(--ok); }
.day-badge.tone-watch { background: #b7791f; }
.day-badge.tone-risk { background: var(--danger-bg); }
.day-badge.tone-none { background: var(--muted); }
.chat-flag { margin: 4px auto 10px; max-width: 34rem; padding: 6px 10px; border-left: 3px solid var(--danger-bg); background: rgba(179,38,30,.06); font-size: .85rem; border-radius: 4px; }
details.older-days > summary { text-align: center; color: var(--muted); font-size: .85rem; margin: 6px 0 10px; cursor: pointer; }

/* --- Calendar: day, week, month --- */
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-top h1 { margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-arrow, .cal-today { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; }
.cal-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cal-today { padding: 0 14px; font-size: .9rem; font-weight: 600; }
.cal-today.is-now { color: var(--muted); font-weight: 400; }
.cal-arrow:hover, .cal-today:hover { background: var(--bg); }
.cal-views { margin: 14px 0; }
.cal-month { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span { padding: 8px 0; text-align: center; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cal-dow abbr { text-decoration: none; }
.cal-week { border-top: 1px solid var(--line); }
.cal-cell { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 112px; padding: 6px 6px 10px; border-left: 1px solid var(--line); color: var(--ink); text-decoration: none; min-width: 0; }
.cal-cell:first-child { border-left: 0; }
.cal-cell.off { background: var(--off); }
.cal-cell.out .cal-num, .cal-cell.out .cal-chips { opacity: .45; }
.cal-cell:hover { background: var(--accent-soft); }
/* Who she is with that night: a band along the bottom of the day */
.cal-cell::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--none); }
.cal-cell.with-dad::after { background: var(--dad); } .cal-cell.with-mom::after { background: var(--mom); }
/* Exchange day: both parents have time with her, so the band is split (morning parent first). */
.cal-cell.with-split.from-dad::after { background: linear-gradient(90deg, var(--dad) 50%, var(--mom) 50%); }
.cal-cell.with-split.from-mom::after { background: linear-gradient(90deg, var(--mom) 50%, var(--dad) 50%); }
.cal-cell.out::after { opacity: .4; }
.cal-num { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 999px; font-size: .9rem; font-weight: 600; }
.cal-cell.is-today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-cell.is-sel { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: block; padding: 2px 6px; border-radius: 6px; font-size: .74rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            background: var(--accent-soft); color: var(--ink); border-left: 3px solid var(--accent); }
.cal-more { font-size: .72rem; color: var(--muted); padding-left: 6px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal-chip.k-no_school { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.cal-chip.k-early_release, .cal-chip.k-school_milestone, .cal-chip.k-event { border-left-color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.cal-chip.k-exchange { border-left-color: var(--ink); background: none; box-shadow: inset 0 0 0 1px var(--line); }
.cal-dots .k-no_school { background: var(--danger); } .cal-dots .k-early_release, .cal-dots .k-school_milestone, .cal-dots .k-event { background: var(--muted); }
.cal-dots .k-exchange { background: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-legend { margin: 10px 2px 0; }
.cal-legend .cal-off { background: var(--off); box-shadow: inset 0 0 0 1px var(--line); }
.cal-day-panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.cal-day-panel.solo { margin-top: 0; padding: 0 0 0 14px; border-top: 0; border-left: 4px solid var(--none); }
.cal-day-panel.solo.with-dad { border-left-color: var(--dad); } .cal-day-panel.solo.with-mom { border-left-color: var(--mom); }
.cal-day-panel h2 { margin: 0; }
.cal-flag { margin: 0 0 4px; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.cal-with { margin: 6px 0 10px; }
.cal-evs { list-style: none; margin: 0; padding: 0; }
.cal-ev { display: flex; gap: 12px; padding: 10px 12px; margin-top: 6px; border-radius: 10px; background: var(--accent-soft); border-left: 4px solid var(--accent); }
.cal-ev-time { flex: none; width: 74px; font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-ev-time .muted { font-weight: 400; }
.cal-ev-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cal-ev.k-no_school { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.cal-ev.k-early_release, .cal-ev.k-school_milestone, .cal-ev.k-event { border-left-color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); }
.cal-ev.k-exchange { border-left-color: var(--ink); background: none; box-shadow: inset 0 0 0 1px var(--line); }
.cal-agenda { list-style: none; margin: 0; padding: 0; }
.cal-agenda > li { display: flex; gap: 12px; padding: 12px 0 12px 10px; border-top: 1px solid var(--line); border-left: 4px solid var(--none); }
.cal-agenda > li:first-child { border-top: 0; }
.cal-agenda > li.with-dad { border-left-color: var(--dad); } .cal-agenda > li.with-mom { border-left-color: var(--mom); }
.cal-agenda > li.with-split, .cal-day-panel.solo.with-split { border-left-color: transparent; background-origin: border-box; background-repeat: no-repeat; background-size: 4px 50%; background-position: left top, left bottom; }
.cal-agenda > li.with-split.from-dad, .cal-day-panel.solo.with-split.from-dad { background-image: linear-gradient(var(--dad), var(--dad)), linear-gradient(var(--mom), var(--mom)); }
.cal-agenda > li.with-split.from-mom, .cal-day-panel.solo.with-split.from-mom { background-image: linear-gradient(var(--mom), var(--mom)), linear-gradient(var(--dad), var(--dad)); }
.cal-agenda > li.off { background: var(--off); }
.cal-date { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.cal-date strong { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; color: var(--ink); letter-spacing: 0; }
.cal-agenda > li.is-today .cal-date strong { background: var(--accent); color: var(--accent-ink); }
.cal-agenda-body { flex: 1; min-width: 0; }
.cal-agenda-body .cal-with { margin: 6px 0 2px; }
.cal-agenda-body p.muted { display: none; }
main > details.help { margin: 0 6px 12px; }
@media (max-width: 760px) {
  .cal-card { padding-left: 10px; padding-right: 10px; }
  .cal-dow span span, .cal-chips { display: none; }
  .cal-dots { display: flex; }
  .cal-cell { min-height: 56px; align-items: center; padding: 6px 2px 9px; gap: 3px; }
  .cal-num { align-self: center; width: 30px; height: 30px; }
  .cal-cell.is-sel { box-shadow: none; }
  .cal-cell.is-sel:not(.is-today) .cal-num { box-shadow: inset 0 0 0 2px var(--accent); }
  .cal-ev-time { width: 64px; }
}

/* --- Uploads: what each one is and what came of it --- */
.ups { list-style: none; margin: 0; padding: 0; }
.up { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.up:first-child { border-top: 0; padding-top: 2px; } .up:last-child { padding-bottom: 2px; }
.up-main { flex: 1; min-width: 0; display: block; text-decoration: none; color: var(--ink); }
.up-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.up-main:hover .up-title { color: var(--accent); }
.up-meta { display: block; margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.up-summary { margin-top: 4px; font-size: .9rem; color: var(--muted); }
.up-status { flex: none; max-width: 42%; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; text-align: right; color: var(--muted); background: var(--off); }
.up-status .sub { font-size: .75rem; }
.up-attention .up-status { background: var(--warn); color: var(--warn-ink); border-radius: 12px; }
.up-attention .up-status .sub { color: inherit; }
.up-ok .up-status { background: var(--accent-soft); color: var(--ink); }
.up-problem .up-status { background: none; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.up-state { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 14px 0; padding: 12px 14px; border-radius: 12px; background: var(--off); border-left: 4px solid var(--none); }
.up-state.up-attention { background: color-mix(in srgb, var(--warn) 22%, transparent); border-left-color: var(--warn); }
.up-state.up-ok { background: var(--accent-soft); border-left-color: var(--accent); }
.up-state.up-problem { border-left-color: var(--danger); }
.up-actions { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); gap: 18px; }
.danger-link { color: var(--danger); }
@media (max-width: 760px) {
  .up { flex-direction: column; gap: 6px; }
  .up-status { max-width: none; text-align: left; order: -1; }
}
/* First sign-in: activate account (app/activation.py) */
dialog.activate { position: fixed; inset: 0; margin: auto; z-index: 100; max-width: min(420px, calc(100vw - 32px)); padding: 28px 24px; border: 0; border-radius: 16px; background: var(--card, #fff); color: inherit; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
dialog.activate::backdrop { background: rgba(0,0,0,.45); }
dialog.activate h2 { margin-top: 0; }
.activate-btn { display: block; width: 100%; margin: 20px 0 12px; padding: 22px 16px; font-size: 1.4rem; font-weight: 800; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.activate-btn:hover { filter: brightness(1.05); }
/* Who said what: a small circle with initials, one color per person (Ty, Jen, school) */
.msg-line { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msg.family .msg-line { flex-direction: row-reverse; }
.mini-avatar { flex: none; width: 28px; height: 28px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: #fff; background: var(--muted); vertical-align: middle; }
.mini-avatar.av-dad { background: #2b6cb0; }
.mini-avatar.av-mom { background: #8a3fb0; }
.mini-avatar.av-school { background: #4a5568; }
.mini-avatar.av-parent { background: #718096; }
/* School record vs. attendance messages: one row per kind, dates as chips */
.ac-group { border-left: 4px solid var(--line); padding: 6px 10px; margin: 8px 0; border-radius: 6px; background: var(--bg); }
.ac-group.tone-risk { border-left-color: var(--danger-bg); }
.ac-group.tone-watch { border-left-color: #b7791f; }
.ac-group > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.ac-group > summary::-webkit-details-marker { display: none; }
.ac-icon { width: 22px; height: 22px; border-radius: 999px; display: inline-grid; place-items: center; font-weight: 800; color: #fff; background: var(--muted); flex: none; }
.tone-risk .ac-icon { background: var(--danger-bg); }
.tone-watch .ac-icon { background: #b7791f; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; text-decoration: none; color: var(--ink); background: var(--card); }
.ac-quotes { list-style: none; padding: 0; margin: 4px 0 8px; font-size: .85rem; color: var(--muted); }
.ac-quotes li { margin: 3px 0; }
.chip-date { font-weight: 600; color: var(--ink); margin-right: 4px; }

/* --- Third pass: a calmer, more even look --- */
:root { --field: #c9c5bd; --shadow: 0 1px 2px rgba(20,20,20,.04), 0 2px 10px rgba(20,20,20,.04); }
@media (prefers-color-scheme: dark) { :root { --field: #4a4f56; --shadow: none; } }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
h2 { font-size: 1.08rem; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: .95rem; margin: 14px 0 6px; }
.card { border-radius: 18px; padding: 18px; box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--line) 70%, transparent); }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
p { margin: 8px 0; }
.lede { color: var(--muted); }
.eyebrow { margin: 0 0 2px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
/* Fields and buttons share one height, one radius and a border you can see */
input, select, textarea { border-color: var(--field); border-radius: 12px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
button, .button { border-radius: 12px; border-color: var(--field); font-weight: 600; padding: 8px 16px; }
.primary { border-color: var(--accent); }
.button.ghost, button.ghost { background: none; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
button.link { font-weight: 400; }
label { font-size: .88rem; }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
/* Tags: tinted, so the solid colours are left for people and for attendance */
.tag { display: inline-block; padding: 1px 8px; font-weight: 600; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--ink); }
.tag[class*="owner-"], .tag.prio-high, .tag.thr-tag, .tag.ok-bg { color: #fff; }
.tag.owner-dad { background: var(--dad); } .tag.owner-mom { background: var(--mom); } .tag.owner-both { background: var(--accent); }
.tag.owner-lizzy, .tag.owner-child { background: var(--muted); }
.tag.prio-high { background: var(--danger-bg); } .tag.ok-bg { background: var(--ok); }
.today-head .button { white-space: nowrap; flex: none; }
.thr-watch .tag.thr-tag { color: var(--warn-ink); } .thr-at_risk .tag.thr-tag { color: var(--danger); }
.tag.prio-low { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); opacity: 1; font-weight: 400; }
.att { font-weight: 600; padding: 2px 10px; }
/* Lists breathe a little more */
.item { padding: 11px 0; gap: 12px; }
.item-title { font-weight: 500; line-height: 1.35; }
.item .meta { margin-top: 3px; align-items: center; }
.item .check span { border-radius: 50%; border-color: var(--field); }
.item .check:hover span { border-color: var(--accent); }
.group-title { margin: 20px 0 0; }
.card-link { padding-top: 10px; }
.seg.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px 4px; padding: 2px 18px; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll li { flex: none; }
.seg a { min-height: 36px; padding: 4px 14px; font-size: .92rem; border-color: var(--line); }
.seg a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--card); }
details.add > summary { border-radius: 12px; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
/* Today */
.today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-head h1 { margin: 0; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; list-style: none; margin: 8px 0 0; padding: 0; color: var(--muted); }
.facts li:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--field); }
.facts.logged { color: var(--ink); margin-top: 12px; }
.today .notes { margin: 12px 0 0; border-radius: 12px; padding: 10px 12px; font-size: .95rem; }
.exchange-next { margin-top: 14px; padding: 12px 0 0; border-top: 1px solid var(--line); }
.quick-line { padding: 6px 6px 6px 16px; border-radius: 18px; }
.quick-line button { border-radius: 12px; }
.attention li { align-items: flex-start; }
.attention li::before { margin-top: .55em; transform: none; }
.strip { gap: 4px; }
.strip .day { border-radius: 8px; }
.limits .limit-head strong { font-weight: 500; font-size: .95rem; }
.bar { height: 6px; border-radius: 3px; } .bar span { border-radius: 3px; }
.next-up a { border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; }
.next-up a small { font-weight: 400; margin-top: 2px; }
/* Log form: even, thumb-sized choices */
.log-form { gap: 18px; }
fieldset.choices legend { font-size: .88rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
fieldset.choices .hint { font-weight: 400; color: var(--muted); margin-left: 6px; }
fieldset.choices.even, fieldset.choices.grid { display: block; }
fieldset.choices.even .opts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
fieldset.choices.grid .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; }
.chip { justify-content: center; text-align: center; border-color: var(--field); border-radius: 12px; padding: 8px 10px; font-weight: 500; }
.chip:has(input:checked) { box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 600; }
.log-form .row > label { flex: 1; min-width: 130px; color: var(--ink); font-weight: 600; }
.log-form > label { color: var(--ink); font-weight: 600; }
.log-form label input, .log-form label textarea { font-weight: 400; margin-top: 2px; }
.save-bar { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; }
.daynav a { border-radius: 999px; border-color: var(--field); width: 44px; padding: 0; }
@media (max-width: 760px) {
  main { padding: 10px 12px; }
  .card { padding: 16px; margin: 10px 0; }
  .seg.scroll { margin: 0 -16px 4px; padding: 2px 16px; }
  .log-form .save { position: static; box-shadow: none; }
  .save-bar { position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b)); margin: 0 -16px -16px; padding: 10px 16px 12px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; }
  table.logs td:nth-child(7) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  table.logs tr { padding: 12px 0; }
}

/* ---------- what's new ---------- */
.update-banner a { white-space: nowrap; }
.news { list-style: none; margin: 0 0 12px; padding: 0; }
.news li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); }
.news li:first-child { border-top: 0; }
.news-title { font-weight: 600; }
.update-banner { width: max-content; font-size: .9rem; line-height: 1.35; }
.update-banner > span { min-width: 0; }
.update-banner button { flex: none; }
@media (min-width: 761px) { .update-banner { max-width: min(560px, calc(100% - 32px)); } }

/* ---------- contacts ---------- */
.emergency { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px 10px 16px; border-radius: 18px;
             background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--danger); }
.emergency-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.emergency .act { width: auto; padding: 0 14px; gap: 6px; font-weight: 600; font-size: .9rem; }
.act { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px;
       background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.act:hover { filter: brightness(.96); }
.contact-search { width: 100%; margin: 4px 0 4px; }
.contact-group[hidden], .person[hidden] { display: none; }
.contact-group .group-title { margin-top: 18px; }
.people { list-style: none; margin: 0; padding: 0; }
.person { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.person details { flex: 1; min-width: 0; }
.person summary { display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer; min-height: 44px; }
.person summary::-webkit-details-marker { display: none; }
.person-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.person-acts { display: flex; gap: 8px; flex: none; }
.person-more { margin: 8px 0 4px 54px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .92rem; }
.person-more dt { color: var(--muted); }
.person-more dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.person details > p, .person details > form { margin: 4px 0 4px 54px; }
button.link.danger { color: var(--danger); }
/* Messages > School days: one card per day */
.day-cards { list-style: none; padding: 0; margin: 0; }
.day-cards li { margin: 6px 0; }
.day-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  border-left: 4px solid var(--line); text-decoration: none; color: var(--ink); background: var(--card); }
.day-card.tone-risk { border-left-color: var(--danger-bg); }
.day-card.tone-watch { border-left-color: #b7791f; }
.day-card.tone-ok { border-left-color: var(--ok); }
.day-card.quiet { background: rgba(46,125,50,.06); padding: 7px 12px; }
.day-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.day-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-ok { color: var(--ok); font-weight: 600; font-size: .85rem; }
.day-msg { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; overflow-wrap: anywhere; }
.status-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #fff; background: var(--muted); }
/* School page: this month's ParentVUE calendar */
.cal-list { list-style: none; padding: 0; margin: 4px 0 10px; }
.cal-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.status-chip { display: inline-block; min-width: 4.5rem; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; text-align: center; color: #fff; background: var(--muted); margin-right: 6px; }
.status-chip.tone-risk { background: var(--danger-bg); }
.status-chip.tone-watch { background: #b7791f; }
.status-chip.tone-ok { background: var(--ok); }
/* Attachments in TalkingPoints messages */
.msg-media img { display: block; max-width: min(260px, 70vw); max-height: 320px; border-radius: 14px; border: 1px solid var(--line); }
.msg-file { font-size: .85rem; }
.msg-thumb { display: block; margin-top: 4px; max-width: 120px; max-height: 120px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- event form ---------- */
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-head h1 { flex: 1; margin: 0; font-size: 1.15rem; }
.sheet-back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 1.2rem; }
.sheet-back:hover, .menu > summary:hover { background: var(--accent-soft); }
.menu { position: relative; }
.menu > summary { list-style: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; cursor: pointer; font-size: 1.4rem; line-height: 1; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 44px; z-index: 5; min-width: 220px; padding: 6px; background: var(--card); border: 1px solid var(--line);
              border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.menu-items form { margin: 0; }
.menu-items button { display: block; width: 100%; text-align: left; padding: 10px 12px; min-height: 44px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.menu-items button:hover { background: var(--accent-soft); }
.menu-items button.danger { color: var(--danger); }
.ev-form { display: flex; flex-direction: column; gap: 16px; }
.ev-form [hidden] { display: none !important; }
.ev-form .ev-title { font-size: 1.25rem; font-weight: 600; border: 0; border-bottom: 2px solid var(--field, var(--line)); border-radius: 0; padding: 8px 0; background: none; box-shadow: none; }
.ev-form .ev-title:focus { outline: 0; border-bottom-color: var(--accent); box-shadow: none; }
.ev-block { margin: 0; }
div.ev-block { display: flex; flex-direction: column; gap: 10px; }
.ev-line { display: flex; gap: 10px; align-items: flex-end; }
.ev-line > label { flex: 1; min-width: 0; }
.ev-form label, .ev-form legend { font-size: .88rem; font-weight: 600; color: var(--ink); }
.ev-form label .hint, .ev-form legend .hint { font-weight: 400; color: var(--muted); margin-left: 4px; }
.ev-form label.chip { font-weight: 500; font-size: 1rem; }
.switch { flex: none !important; flex-direction: row !important; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 500 !important; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; min-height: 0; padding: 0; margin: 0; border-radius: 999px; border: 0;
                background: var(--field, var(--line)); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
fieldset.choices .opts.wrap { display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.choices .opts.wrap .chip { border-radius: 999px; padding: 6px 14px; min-height: 40px; }
fieldset.choices.ev-block > input[type=text], .ev-until { margin-top: 8px; }
.ev-until { display: flex; }
/* In-place page swaps (Turbo): frames are blocks, and the top progress bar uses the app colour. */
turbo-frame { display: block; }
.turbo-progress-bar { height: 3px; background: var(--accent); }

/* ---------- AI suggestions as a decision card: a question, options (first recommended), "Do nothing" ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.decision { margin-top: 10px; }
.dq { font-weight: 650; margin: 0 0 8px !important; }
.dopts { display: flex; flex-direction: column; gap: 8px; margin: 0 !important; }
.dopt { display: flex; flex-direction: column; }
.dbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; min-height: 48px;
  padding: 10px 14px; border: 1px solid var(--field, var(--line)); border-radius: 14px; background: var(--card); color: var(--ink);
  font-weight: 400; cursor: pointer; transition: border-color .12s, background .12s; }
div.dbtn { cursor: default; }
button.dbtn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.dopt.rec .dbtn { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.dbtn.quiet { border-style: dashed; }
.dlabel { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dcons { font-size: .88rem; color: var(--muted); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .74rem; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--ink); }
.pill-rec { background: var(--accent); color: var(--accent-ink); }
.pill.st-current { background: var(--ok); color: #fff; }
.pill.st-superseded { background: #b7791f; color: #fff; }
.pill.st-historical { background: color-mix(in srgb, var(--muted) 35%, transparent); }
.pill.st-none { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.dchanges { margin: 4px 0 0 4px; font-size: .88rem; }
.dchanges > summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.dchg-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; }
.chg { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--muted) 7%, transparent); border-left: 3px solid var(--line); }
.chg.tone-current { border-left-color: var(--ok); } .chg.tone-superseded { border-left-color: #b7791f; }
.chg.tone-action_item, .chg.tone-update_item, .chg.tone-complete_item { border-left-color: var(--accent); }
.chg.tone-event { border-left-color: var(--mom, var(--accent)); } .chg.tone-log { border-left-color: var(--dad, var(--accent)); }
.chg-st { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: .88rem; }
.chg details.more > summary { cursor: pointer; color: var(--muted); font-size: .82rem; padding: 2px 0; }
.dresult { border-radius: 14px; padding: 10px 14px; }
.dresult.done { background: color-mix(in srgb, var(--ok) 13%, var(--card)); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); }
.dresult.none { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.dresult ul { margin: 4px 0 6px; padding-left: 20px; }
.dres-head { font-weight: 650; display: flex; align-items: center; gap: 8px; margin: 0 !important; }
.dres-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--ok); color: #fff; font-size: .8rem; }
.dresult.none .dres-mark { background: var(--muted); }
.decision.just-done .dresult { animation: justdone 1.6s ease-out; }
@keyframes justdone { from { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 45%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .decision.just-done .dresult { animation: none; } }
/* Archive item: its status, said plainly at the top */
.status-banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 10px 14px; margin: 10px 0 4px;
  background: color-mix(in srgb, var(--muted) 10%, transparent); border-left: 4px solid var(--muted); }
.status-banner.st-current { background: color-mix(in srgb, var(--ok) 12%, var(--card)); border-left-color: var(--ok); }
.status-banner.st-superseded { background: color-mix(in srgb, #b7791f 13%, var(--card)); border-left-color: #b7791f; }
.status-banner p { margin: 0; }
/* Links: back links are pills; ghost buttons get a tint on hover */
a { text-decoration: none; }
.backlink { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 12px 2px 8px; margin: 0 0 8px; border-radius: 999px;
  font-size: .88rem; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); }
.backlink:hover { color: var(--ink); text-decoration: none; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.button.ghost:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.dresult a { font-weight: 600; }

/* ---------- upload page: the parent's note as a bubble, the AI panel, action buttons ---------- */
.up-note { margin: 12px 0 0; }
.up-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.up-head h2 { margin: 0; }
.up-analysis h3 { margin: 16px 0 4px; }
.up-summary { line-height: 1.5; }
.up-reading { position: relative; margin: 12px 0 4px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); min-height: 96px; }
.up-reading p { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 600; }
.up-reading .spinner { color: var(--accent); }
.skel { display: flex; flex-direction: column; gap: 8px; }
.skel i { display: block; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--muted) 18%, transparent); animation: skel 1.4s ease-in-out infinite; }
.skel i.short { width: 55%; }
@keyframes skel { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skel i { animation: none; } }
ul.plain > li.up-sugg { padding: 10px 12px; margin: 6px 0; border-radius: 12px; border: 1px solid var(--line); }
.up-sugg .meta, .up-sugg .small { margin-left: 32px; }
.up-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.up-acts .up-delete { margin-left: auto; background: none; }
.cal-bell { margin: 2px 0 6px; }
.bell-periods .cal-ev-time { min-width: 4.5rem; }

/* ---------- busy overlay (Redo analysis, AI review) ---------- */
.is-busy { position: relative; min-height: 96px; }
.busy-cover { position: absolute; inset: -6px; z-index: 4; display: grid; place-items: center; border-radius: 14px;
              background: color-mix(in srgb, var(--card) 78%, transparent); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); }
.busy-box { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--card);
            border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.14); font-weight: 600; }
.busy-box .spinner { width: 1.1em; height: 1.1em; color: var(--accent); }
.busy-time { font-weight: 400; font-variant-numeric: tabular-nums; min-width: 2.2em; }

/* ---------- AI review card (Admin) ---------- */
.src-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--field, var(--line));
            background: var(--card); color: var(--ink); font: inherit; font-size: .92rem; cursor: pointer; }
.src-chip .count { font-weight: 700; }
.src-chip[aria-expanded=true] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.src-items { margin: 4px 0 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.src-items ul { margin: 0; padding-left: 18px; }
.src-items li { margin: 4px 0; overflow-wrap: anywhere; }
.review-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 4px; }
.review-result { margin: 10px 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--card); }
.review-result.problem { border-left-color: var(--danger); }
.changes { list-style: none; margin: 8px 0 0; padding: 0; }
.changes li { padding: 8px 0; border-top: 1px solid var(--line); }
.review-timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.review-timeline > li { position: relative; padding: 0 0 14px 10px; }
.review-timeline > li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.review-timeline > li.problem::before { background: var(--danger); }
.review-timeline > li.quiet::before { background: var(--muted); }

/* ---- Links: never underlined (Ty's rule). A link is a pill, a button, or accent-coloured text; hover and keyboard
   focus change the colour or the background instead. tools/layout_check.js and tests/test_markup.py guard this. ---- */
a, a:hover, a:focus, button.link, button.link:hover, summary { text-decoration: none; }
a { transition: color .12s, background-color .12s; }
a:not([class]):not([aria-current]):hover, a.card-link:hover { color: color-mix(in srgb, var(--accent) 65%, var(--ink)); }
button.link { color: var(--accent); font-weight: 500; }
button.link:hover { color: color-mix(in srgb, var(--accent) 65%, var(--ink)); }
p a:not(.button):not(.chip), .small a:not(.button):not(.chip), li > a:only-child:not([class]) { font-weight: 500; }
/* Calendar feeds page */
.feed-opts { border: 0; padding: 0; margin: 0; }
.feed-opts legend { font-weight: 600; margin-bottom: 4px; }
.feed-opt { display: flex; flex-direction: row; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: normal; cursor: pointer; }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-list > li { padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.feed-opt input { width: auto; margin-top: 4px; }
.feed-opt > span { display: flex; flex-direction: column; gap: 2px; }

/* ---- To-dos: one list with a quick-add line, Today / Upcoming / Someday, Done folded at the bottom ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.todo-head h1 { margin: 0; }
.todo-head .count { font-weight: 400; margin-left: 4px; }
.toggle-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.toggle-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); }
.toggle-pill[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.toggle-pill[aria-current]::before { background: var(--accent); border-color: var(--accent); }
.quick-add { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 4px 4px 4px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); }
.quick-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick-add .qa-plus { color: var(--accent); font-size: 1.4rem; font-weight: 600; line-height: 1; }
.quick-add input[type=text] { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; min-height: 44px; font-size: 1.05rem; outline: none; box-shadow: none; }
.quick-add button { border-radius: 10px; min-height: 40px; }
.quick-add:has(input:placeholder-shown) button { opacity: .45; }
.qa-hint { margin: 6px 2px 0; min-height: 1.3em; }
.qa-hint.is-read { color: var(--accent); font-weight: 500; }
details.more-add { margin: 2px 0 0; }
details.more-add > summary { display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; color: var(--muted); font-size: .85rem; list-style: none; }
details.more-add > summary::-webkit-details-marker { display: none; }
details.more-add > summary::after { content: "\203A"; margin-left: 6px; transition: transform .15s; }
details.more-add[open] > summary::after { transform: rotate(90deg); }
details.more-add[open] { padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.flash.undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 0; padding: 6px 6px 6px 14px; border-radius: 12px; }
.flash.undo > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash.undo .undo-btn { flex: none; min-height: 36px; border-radius: 999px; font-weight: 600; color: var(--accent); border-color: transparent; background: var(--card); }
.todos .group-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 2px; }
.todo { align-items: flex-start; transition: opacity .25s; }
.todo .todo-toggle { flex: none; }
.todo .check span { width: 24px; height: 24px; border-width: 2px; transition: background-color .15s, border-color .15s, transform .15s; }
.todo .check:active span { transform: scale(.88); }
.todo.is-high .check span { border-color: var(--danger); }
.todo.completing .check span { background: var(--accent); border-color: var(--accent); }
.todo.completing .check span::after { content: "\2713"; }
.todo.completing .item-title { text-decoration: line-through; color: var(--muted); }
.todo.completing, .todo.reopening { opacity: .55; }
.todo-main { flex: 1; min-width: 0; }
.todo-main > summary { display: flex; align-items: flex-start; gap: 10px; list-style: none; cursor: pointer; border-radius: 10px; }
.todo-main > summary::-webkit-details-marker { display: none; }
.todo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.todo-text .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; color: var(--muted); font-size: .85rem; }
.todo-text .meta:empty { display: none; }
.todo-text .details { color: var(--muted); font-size: .9rem; }
.todo-main[open] > summary .details { display: none; }
.pilltag { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: var(--off, var(--accent-soft)); color: var(--ink); font-size: .8rem; font-weight: 500; white-space: nowrap; }
.pilltag.due-overdue { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }
.pilltag.due-soon { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pilltag.prio { box-shadow: inset 0 0 0 1px var(--danger); background: none; color: var(--danger); }
.who { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.who-dad { background: var(--dad); } .who-mom { background: var(--mom); } .who-both { background: var(--accent); color: var(--accent-ink); } .who-lizzy { background: var(--muted); }
.todo-edit { margin: 10px 0 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.todo-edit fieldset.choices, .more-add fieldset.choices { margin: 0; }
.todo.done .who { opacity: .5; }
.done-fold { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 6px; }
.empty-state { text-align: center; padding: 34px 12px 26px; }
.empty-state p { margin: 4px 0; }
.empty-mark { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .todo, .todo .check span { transition: none; } }

/* ---------- daily log follow-ups (_log_thread.html) ---------- */
.log-thread { margin: 10px 0 14px; }
.log-thread .bubble .meta .tag { font-size: .7rem; padding: 0 6px; }
.log-thread .bubble textarea { width: 100%; }
.cedit { margin-top: 4px; }
.cedit > summary { list-style: none; cursor: pointer; font-size: .78rem; color: var(--muted); display: inline-block; }
.cedit > summary::-webkit-details-marker { display: none; }
.cedit > summary:hover { color: var(--accent); }
.cedit[open] > summary { margin-bottom: 4px; }

/* ---- Event form: "Who's going" picker and Place suggestions ---- */
button.chip.chip-add { justify-content: center; min-width: 44px; padding: 6px 0; font-size: 1.3rem; line-height: 1; font-weight: 500; color: var(--accent); border-style: dashed; border-color: var(--accent); background: none; }
fieldset.choices .opts.wrap button.chip.chip-add { padding: 6px 0; }
button.chip.chip-add[aria-expanded=true] { background: var(--accent-soft); border-style: solid; }
.who-menu { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 8px 22px rgba(0,0,0,.10); display: flex; flex-direction: column; gap: 8px; }
.who-menu input[type=search] { width: 100%; }
.who-list { list-style: none; margin: 0; padding: 0; max-height: 264px; overflow-y: auto; overscroll-behavior: contain; }
.who-list li[data-find] { border-bottom: 1px solid var(--line); }
.who-list li[data-find]:last-of-type { border-bottom: 0; }
.who-list .pick { align-items: center; min-height: 44px; padding: 6px 4px; font-weight: 400; }
.who-list .pick input { margin: 0; accent-color: var(--accent); }
.who-list .pick strong { font-weight: 600; }
.who-list .pick .small { display: block; font-weight: 400; }
.who-list [data-who-new] .button { width: 100%; justify-content: flex-start; margin-top: 6px; color: var(--accent); font-weight: 600; }
.ev-place { position: relative; gap: 0 !important; }
.suggest { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 8px 22px rgba(0,0,0,.14); position: absolute; left: 0; right: 0; top: 100%; z-index: 6; max-height: 280px; overflow-y: auto; }
.suggest li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 400; font-size: 1rem; }
.suggest li:hover, .suggest li[aria-selected=true] { background: var(--accent-soft); }
.suggest-ic { flex: none; width: 1.2em; text-align: center; color: var(--muted); }
.suggest-known .suggest-ic { color: var(--accent); }
/* ---------- admin: integrations and API usage ---------- */
.keys { list-style: none; margin: 0; padding: 0; }
.key-row { padding: 12px 0; border-top: 1px solid var(--line); }
.key-row:first-child { border-top: 0; padding-top: 4px; }
.key-row p { margin: 4px 0; }
.key-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-head .status-chip { min-width: 0; margin: 0; }
.key-row .status-chip + .status-chip { margin-left: 4px; }
.key-dots { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.key-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.key-acts form { margin: 0; }
.key-replace { flex-basis: auto; }
.key-replace[open] { flex-basis: 100%; }
.key-replace > summary { list-style: none; cursor: pointer; display: inline-flex; }
.key-replace > summary::-webkit-details-marker { display: none; }
.key-replace[open] > summary { margin-bottom: 8px; }
.key-replace input[type=password] { flex: 1; min-width: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-scroll { overflow-x: auto; }
table.usage td.num { white-space: nowrap; }
.meter { display: inline-block; vertical-align: middle; width: 64px; height: 6px; margin-left: 8px; border-radius: 3px;
         background: color-mix(in srgb, var(--muted) 25%, transparent); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.meter.hot > span { background: var(--danger-bg); }
.api-limits { list-style: none; margin: 0 0 8px; padding: 0; }
.api-limits li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.api-limits li:first-child { border-top: 0; }
.api-limits .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.api-limits .error { flex-basis: 100%; }
.login-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.login-line .status-chip { min-width: 0; margin: 0; }

/* ---------- parents: last signed in / last seen (settings) ---------- */
.presence { list-style: none; margin: 0; padding: 0; }
.presence-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.presence-row:first-child { border-top: 0; }
.presence-av { position: relative; flex: none; }
.presence-av .avatar.av-dad { background: #2b6cb0; color: #fff; }
.presence-av .avatar.av-mom { background: #8a3fb0; color: #fff; }
.presence-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 999px;
  background: #38a169; border: 2px solid var(--card, var(--bg)); }
.presence-who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.presence-on { color: #38a169; font-weight: 600; }
.presence-row > .tag { flex: none; }
/* ---------- skeleton pages (while an in-app page loads; built by app.js) ---------- */
main.page-loading > :not(.sk-page) { display: none !important; }
.sk-page { display: flex; flex-direction: column; gap: 16px; }
.sk-page .card { display: flex; flex-direction: column; gap: 12px; }
.sk { display: block; border-radius: 8px; height: 12px; background: linear-gradient(90deg, var(--off) 0%, var(--line) 40%, var(--off) 80%) 0 0 / 300% 100%;
  animation: sk-shimmer 1.3s linear infinite; }
.sk.h1 { height: 26px; width: 55%; } .sk.h2 { height: 18px; width: 40%; }
.sk.w90 { width: 90%; } .sk.w70 { width: 70%; } .sk.w50 { width: 50%; } .sk.w30 { width: 30%; }
.sk.pill { height: 40px; border-radius: 999px; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.sk-row .sk.dot { flex: none; width: 24px; height: 24px; border-radius: 50%; }
.sk-row .sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sk-grid .sk { height: auto; aspect-ratio: 1 / 1; border-radius: 10px; }
.sk-bubble { height: 46px; width: 72%; border-radius: 16px; }
.sk-bubble.mine { align-self: flex-end; width: 60%; }
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: skel 2.4s ease-in-out infinite; } }
/* The calendar frame while a day, week or month loads: the parts that change shimmer (after a short pause). */
turbo-frame#cal[busy] .cal-day-panel, turbo-frame#cal[busy] .cal-agenda { animation: sk-dim .9s ease-in-out .15s infinite both; }
@keyframes sk-dim { 50% { opacity: .55; } }

/* ---- Today: the quick update box is one frame (the card), and the "Rest of today" line stops at the last item.
   The inner field has no border, ring or fill of its own; focus shows on the card. ---- */
.card.quick-line { padding: 6px 6px 6px 16px; border-radius: 16px; box-shadow: none; }
.card.quick-line input[type=text], .card.quick-line input[type=text]:focus, .card.quick-line input[type=text]:focus-visible,
.quick-add input[type=text], .quick-add input[type=text]:focus, .quick-add input[type=text]:focus-visible { border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent; }
.card.quick-line:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
ol.timeline > .tl-item:last-child { border-left-color: transparent; }

/* ---- Polish pass: shared to-do row on Today, activity by day, Today's coming-up links, heading counts ---- */
h1 .count, h2 .count { display: inline; font-weight: 400; margin-left: 4px; white-space: nowrap; }
.card-head { align-items: center; }
.card-head h2 { margin: 0; }
.button.small-btn { min-height: 34px; padding: 4px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--accent); }
.items.compact .todo .cat, .items.compact .todo .details { display: none; }
.items.compact .todo .meta > .pilltag { display: inline-flex; }
.todo .item-body .item-title { display: block; }
a.coming { display: flex; gap: 12px; align-items: baseline; color: var(--ink); min-height: 32px; }
a.coming .date { flex: none; min-width: 92px; }
a.coming .coming-what { min-width: 0; font-weight: 500; }
a.coming .coming-what .muted { font-weight: 400; margin-left: 4px; white-space: nowrap; }
a.coming:hover .coming-what { color: var(--accent); }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-list li { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: 2px 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.act-list li:last-child { border-bottom: 0; }
.act-time { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.act-what { min-width: 0; overflow-wrap: anywhere; }
.act-what strong { font-weight: 600; }
.act-detail { color: var(--muted); font-size: .92rem; }
.act-who { color: var(--muted); font-size: .88rem; white-space: nowrap; }
@media (max-width: 520px) { .act-list li { grid-template-columns: 4.2rem 1fr; } .act-who { grid-column: 2; } }

/* ---- To-dos: the editor is the row, opened flat (no card inside the card). Due and Priority sit in two equal
   columns that can shrink (iOS date fields have a wide natural size and used to slide under their neighbour). ---- */
.todo-close { display: none; margin-left: auto; color: var(--accent); font-size: .9rem; font-weight: 600; padding: 4px 0; }
.todo-main[open] > summary { justify-content: flex-end; min-height: 32px; }
.todo-main[open] > summary .todo-text, .todo-main[open] > summary .who { display: none; }
.todo-main[open] > summary .todo-close { display: inline; }
.todo-edit { margin: 0 0 4px; padding: 0; border: 0; border-radius: 0; background: none; gap: 12px; }
.todo-edit label, .more-add label { min-width: 0; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.pair > label { min-width: 0; }
.pair input, .pair select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; min-height: 44px; }
.pair input[type=date] { display: block; -webkit-appearance: none; appearance: none; text-align: left; line-height: 1.3; }
.pair input[type=date]::-webkit-date-and-time-value { text-align: left; }
textarea.grow { resize: none; overflow: hidden; min-height: 44px; line-height: 1.35; field-sizing: content; }
.todo-edit textarea[name=title] { font-weight: 600; font-size: 1.02rem; }

/* ---- Phone pass (2026-11-17). Rules that hold on every page at phone width. docs/UI.md has the list. ---- */
/* 1. iOS zooms the page when a focused field's text is under 16px. */
@media (max-width: 760px) {
  main input:not([type=checkbox]):not([type=radio]):not([type=range]), main select, main textarea { font-size: 16px !important; }
}
/* 2. Date and time fields have a wide natural size on iOS and slide under their neighbour in a row: let them shrink. */
input[type=date], input[type=time], input[type=datetime-local] { min-width: 0; max-width: 100%; box-sizing: border-box; }
.row > label:has(> input[type=date], > input[type=time]), .ev-line > label:has(> input[type=date], > input[type=time]) { flex: 1 1 130px; min-width: 0; }
.row > label > input[type=date], .row > label > input[type=time], .ev-line > label > input[type=date], .ev-line > label > input[type=time] { width: 100%; }
@supports (-webkit-touch-callout: none) {
  input[type=date], input[type=time], input[type=datetime-local] { -webkit-appearance: none; appearance: none; display: block; min-height: 44px; text-align: left; }
  input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
}
/* 3. Things to tap are at least 36px tall (44px for the main ones, set where they are defined). */
@media (pointer: coarse), (max-width: 760px) {
  main details:not(.fold):not(.add):not(.todo-main):not(.menu):not(.more-add) > summary { min-height: 36px; padding-block: 7px; box-sizing: border-box; min-width: 36px; }
  button.link, button.link.small { min-height: 36px; padding-block: 6px; }
  .button.small-btn { min-height: 36px; }
  .todo-main[open] > summary { min-height: 40px; }
}
/* 4. While the on-screen keyboard is up, the bottom tab bar steps aside so the keyboard and a save bar are not stacked on
   top of it. app.js sets html.kb-open only when the keyboard has actually shrunk the screen, not on focus alone: a field
   can stay focused after the keyboard is closed, and the page must never be left without the tab bar. */
@media (max-width: 760px) {
  html.kb-open { --tabs-h: 0px; }
  html.kb-open .tabs { display: none; }
}
/* Access: one row per area with a three-way control, instead of a table of bare radio dots. */
.perm-list { list-style: none; margin: 0; padding: 0; }
.perm-list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.perm-list > li:last-child { border-bottom: 0; }
.perm-what { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.segctl { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.segctl label { position: relative; display: flex; margin: 0; cursor: pointer; font-weight: 500; font-size: .92rem; color: var(--ink); }
.segctl label + label { border-left: 1px solid var(--line); }
.segctl input { position: absolute; opacity: 0; pointer-events: none; }
.segctl span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; white-space: nowrap; }
.segctl input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.segctl label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 520px) { .segctl { width: 100%; } .segctl label { flex: 1; } .segctl span { width: 100%; padding: 0 8px; } }
/* Settings on a phone: each section folds to its heading (the script in settings.html adds .folds). */
.card.folds > :not(.fold-head) { display: none; }
.card.folds.is-open > :not(.fold-head) { display: revert; }
.card.folds.is-open > [style*="display:none"], .card.folds.is-open > [hidden] { display: none; }
.fold-head { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; color: var(--ink); }
.fold-head h2 { margin: 0; }
.fold-head::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.card.folds.is-open > .fold-head::after { transform: rotate(-135deg); }
.card.folds.is-open > .fold-head { margin-bottom: 8px; }

/* ---------- iPad and wide windows: sidebar, side-by-side list and detail, keyboard (2026-11-18) ----------
   700px and up (iPad portrait, iPad mini, phones held sideways): the header becomes a rail of icons down the left
   and the bottom tab bar goes. 1100px and up (iPad landscape, desktop): a full sidebar with labels and the current
   section's pages. 1000px and up: list pages in SPLITS (app/web.py) keep the list on the left and open items on the
   right. Phone layouts (under 700px) are unchanged. */
.side-log, .side-keys, .side-sub, .top nav.menu a.dest svg, .top nav.menu a.dest .badge { display: none; }
.split-list, .split-detail { display: contents; }
.split-empty { display: none; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
      background: var(--bg); font: 600 .8rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; color: var(--ink); }
dialog.keys { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100dvh - 32px); overflow: auto; width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: var(--card); color: var(--ink);
              box-shadow: 0 18px 48px rgba(0,0,0,.25); }
dialog.keys::backdrop { background: rgba(0,0,0,.35); }
dialog.keys .kv { gap: 10px 16px; margin: 6px 0 16px; align-items: baseline; }
dialog.keys dt { white-space: nowrap; }
dialog.keys form { display: flex; justify-content: flex-end; }

@media (min-width: 700px) {
  body.signed-in { --side-w: 84px; --tabs-h: 0px; padding-left: calc(var(--side-w) + env(safe-area-inset-left, 0px)); }
  body.signed-in .tabs, body.signed-in .menu-button, body.signed-in .menu-backdrop { display: none; }
  body.signed-in main { padding-bottom: 24px; }
  body.signed-in .top { position: fixed; top: 0; bottom: 0; left: 0; width: calc(var(--side-w) + env(safe-area-inset-left, 0px));
                        flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px;
                        padding: max(12px, env(safe-area-inset-top, 0px)) 8px max(12px, env(safe-area-inset-bottom, 0px)) calc(8px + env(safe-area-inset-left, 0px));
                        border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  body.signed-in .top .brand { justify-content: center; padding: 2px 0 10px; }
  body.signed-in .top .brand img { width: 34px; height: 34px; border-radius: 9px; }
  body.signed-in .top .brand span { display: none; }
  body.signed-in .top nav.menu { display: flex; position: static; flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 0; margin: 0;
                                 border: 0; box-shadow: none; background: none; max-height: none; overflow: visible; }
  body.signed-in .top nav.menu a.dest { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px;
                                        border-radius: 12px; font-size: .7rem; line-height: 1.15; text-align: center; white-space: normal; color: var(--muted); }
  body.signed-in .top nav.menu a.dest[aria-current] { color: var(--accent); background: var(--accent-soft); }
  body.signed-in .top nav.menu a.dest svg, .side-log svg, .side-keys svg { display: block; width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  body.signed-in .top nav.menu a.dest .badge { display: inline-block; position: absolute; top: 3px; left: calc(50% + 6px); }
  body.signed-in .side-log { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 2px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
                             font-size: .7rem; font-weight: 600; color: var(--accent); text-decoration: none; border-radius: 12px; }
  body.signed-in .side-log svg { width: 42px; height: 42px; padding: 9px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); stroke-width: 2.5; }
  body.signed-in .side-keys { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; margin-top: auto; padding: 8px 2px; min-height: 0;
                              border: 0; background: none; border-radius: 12px; font-size: .7rem; color: var(--muted); }
  body.signed-in .side-keys:hover { color: var(--ink); background: var(--bg); }
  body.signed-in .update-banner { left: calc(50% + var(--side-w) / 2); max-width: min(560px, calc(100% - var(--side-w) - 32px)); }
}

@media (min-width: 1100px) {
  body.signed-in { --side-w: 236px; }
  body.signed-in .top { padding-left: calc(12px + env(safe-area-inset-left, 0px)); padding-right: 12px; }
  body.signed-in .top .brand { justify-content: flex-start; padding: 2px 8px 12px; font-size: 1.05rem; }
  body.signed-in .top .brand img { width: 30px; height: 30px; }
  body.signed-in .top .brand span { display: inline; }
  body.signed-in .side-log { flex-direction: row; gap: 10px; padding: 8px 10px; margin-bottom: 10px; border: 0; background: var(--accent-soft); font-size: .98rem; }
  body.signed-in .side-log svg { width: 30px; height: 30px; padding: 6px; }
  body.signed-in .top nav.menu a.dest { flex-direction: row; gap: 12px; padding: 9px 10px; font-size: .98rem; text-align: left; color: var(--ink); }
  body.signed-in .top nav.menu a.dest svg { color: var(--muted); }
  body.signed-in .top nav.menu a.dest[aria-current] svg { color: var(--accent); }
  body.signed-in .top nav.menu a.dest .badge { position: static; margin-left: auto; }
  body.signed-in .side-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; padding-left: 36px; }
  body.signed-in .top nav.menu .side-sub a { padding: 7px 10px; border-radius: 10px; font-size: .92rem; color: var(--muted); white-space: normal; }
  body.signed-in .top nav.menu .side-sub a:hover { color: var(--ink); background: var(--bg); }
  body.signed-in .top nav.menu .side-sub a[aria-current] { color: var(--ink); background: var(--bg); font-weight: 600; }
  body.signed-in .side-keys { flex-direction: row; gap: 12px; padding: 9px 10px; font-size: .92rem; }
  /* The section's pages are in the sidebar, so the tab row at the top of the page goes */
  body.signed-in main > .subnav { display: none; }
}

@media (min-width: 1000px) {
  body.signed-in main.split { max-width: 1440px; display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  body.signed-in main.split.page-loading { display: block; }
  main.split > .subnav, main.split > .flash, main.split > details.help { grid-column: 1 / -1; }
  main.split > .split-list { display: block; grid-column: 1; position: sticky; top: 0; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
                             margin-top: -12px; padding-top: 12px; scrollbar-width: thin; }
  main.split > .split-detail { display: block; grid-column: 2; min-width: 0; }
  main.split > .split-detail[busy] { opacity: .55; transition: opacity .15s .1s; }
  .split-detail > .card.narrow { max-width: 760px; }
  .split-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60vh; margin: 12px 0;
                 border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
  .split-empty img { opacity: .5; }
  /* The list is right there, so a detail page's own back link goes */
  .split-detail .thread-head .back, .split-detail .backlink { display: none; }
  /* The open item is marked in the list */
  .split-list .is-open { background: var(--accent-soft); border-radius: 10px; box-shadow: inset 3px 0 0 var(--accent); }
  .split-list li.is-open:not(:has(> a.conv, > a.day-card)) { margin: 0 -10px; padding-left: 13px; padding-right: 10px; }
  .split-list li:has(> a.day-card).is-open { background: none; box-shadow: none; }
  .split-list li.is-open > a.day-card { box-shadow: 0 0 0 2px var(--accent); }
  .split-list .conv { padding-left: 8px; padding-right: 8px; border-radius: 10px; }
  .split-list .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .split-list .seg a { white-space: nowrap; }
}

/* Pointer (trackpad, mouse): rows answer hover */
@media (hover: hover) and (pointer: fine) {
  .conv:hover, .split-list li:has(> a[href]):hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); border-radius: 10px; }
  body.signed-in .top nav.menu a.dest:hover:not([aria-current]) { color: var(--ink); background: var(--bg); }
}

/* ---------- AI day summary (log day page, Today) ---------- */
.ds-segs { list-style: none; padding: 0; margin: 8px 0 4px; }
.ds-seg { padding: 10px 0; border-top: 1px solid var(--line); }
.ds-seg:first-child { border-top: 0; }
.ds-seg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ds-seg-head h3 { margin: 0; font-size: .95rem; }
.ds-seg-head .status-chip { margin-right: 0; }
.ds-seg p { margin: 4px 0 0; }
.ds-seg.ds-nothing h3 { color: var(--muted); font-weight: 600; }
.ds-seg .ds-when { margin-top: 2px; }
.day-summary form.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- admin: AI models per feature ---------- */
.ai-models { list-style: none; margin: 0 0 8px; padding: 0; }
.ai-models li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ai-models li:first-child { border-top: 0; }
.ai-models label { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; min-width: 0; }
.ai-models select { flex: 0 0 auto; }
