/* Rooftop On Fields — staff & parent portals.
   No inline styles anywhere (strict CSP); group colours come from /groups.css as --g. */

:root {
  --ink: #1d2a2a;
  --ink-2: #4a5a58;
  --muted: #6f7d7a;
  --line: #e2e6e1;
  --line-2: #eef1ec;
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --brand: #1f6f5c;
  --brand-2: #175546;
  --brand-soft: #e3f1ec;
  --sun: #f6c453;
  --sun-soft: #fdf3d8;
  --roof: #e8604c;
  --sick: #c2412d;
  --sick-soft: #fbe5e0;
  --away: #5a6b80;
  --away-soft: #e8edf3;
  --late: #b7791f;
  --late-soft: #fdf0d5;
  --ok: #2f7d3b;
  --ok-soft: #e2f3e3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29, 42, 42, .06), 0 4px 14px rgba(29, 42, 42, .06);
  --shadow-lg: 0 10px 40px rgba(29, 42, 42, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --g: #9aa5a2;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg);
  min-height: 100vh;
}
img { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.selectable { user-select: all; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 20px 20px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 9px; }
.mainnav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  padding: 8px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; white-space: nowrap; font-weight: 550;
}
.mainnav a:hover { background: var(--line-2); color: var(--ink); }
.mainnav a.active { background: var(--brand-soft); color: var(--brand-2); }
.usermenu { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.usermenu .account-link { color: var(--ink-2); text-decoration: none; font-weight: 550; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.usermenu .account-link.active { color: var(--brand); }
.usermenu .switch { font-size: .85rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.inline { display: inline; margin: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spacer { flex: 1; }

/* ---------- Auth pages ---------- */
.portal-auth { background: linear-gradient(180deg, #e8f3ee 0, var(--bg) 340px); }
.auth-shell { max-width: 440px; margin: 0 auto; padding: 40px 18px 60px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.2rem; }
.auth-brand img { border-radius: 16px; box-shadow: var(--shadow); }
.auth-shell .card { padding: 28px; }
.auth-shell h1 { font-size: 1.45rem; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--line); margin: 0; }
.qr { display: flex; justify-content: center; margin: 8px 0 14px; }
.qr img { border: 10px solid #fff; border-radius: 12px; box-shadow: var(--shadow); image-rendering: pixelated; }
.recovery-codes { columns: 2; padding: 14px 18px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); list-style: none; font-size: 1.05rem; }
.recovery-codes li { padding: 3px 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { font-family: var(--mono); font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; }

/* ---------- Cards, panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Alerts / notices / toasts ---------- */
.notice, .alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.notice { background: var(--ok-soft); border-color: #bfe3c3; color: #1e5a27; }
.alert.error { background: var(--sick-soft); border-color: #f2c4ba; color: #8a2a1a; }
.alert.warn { background: var(--late-soft); border-color: #f1d79c; color: #7a4f0e; }
.alert.info { background: var(--away-soft); border-color: #cfd8e3; color: #33465c; }
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 550; animation: toast-in .2s ease-out; }
.toast.error { background: var(--sick); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=color], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd6d1; border-radius: var(--radius-sm);
  padding: 9px 11px; min-height: 42px; width: 100%;
}
input[type=color] { padding: 4px; width: 64px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(31, 111, 92, .28); outline-offset: 1px; border-color: var(--brand);
}
input:disabled { background: var(--line-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
legend { font-weight: 650; padding: 0 6px; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }

/* ---------- Buttons ---------- */
button, .button {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid #cfd6d1; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
button:hover, .button:hover { background: var(--line-2); color: var(--ink); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--brand-2); }
button.danger, .button.danger { color: var(--sick); border-color: #efc2b8; }
button.danger:hover, .button.danger:hover { background: var(--sick-soft); }
button.small, .button.small { min-height: 32px; padding: 4px 11px; font-size: .86rem; }
button.link { background: none; border: 0; min-height: 0; padding: 0; color: var(--brand); font-weight: 550; }
button.link:hover { text-decoration: underline; background: none; }
button.ghost, .button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover, .button.ghost:hover { background: var(--line-2); }
button[disabled] { opacity: .5; cursor: not-allowed; }
.wide { width: 100%; }
.sso { background: #fff; }
.sso::before { content: ""; width: 18px; height: 18px; border-radius: 4px; }
.sso-google::before { background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); border-radius: 50%; }
.sso-microsoft::before { background: linear-gradient(90deg, #f25022 50%, #7fba00 50%) top/100% 50% no-repeat, linear-gradient(90deg, #00a4ef 50%, #ffb900 50%) bottom/100% 50% no-repeat; border-radius: 1px; }
.htmx-request button[type=submit], button.htmx-request { opacity: .6; pointer-events: none; }

/* Segmented control (status pickers, filters) */
.segmented { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { flex-direction: row; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.segmented input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented input:focus-visible + label { outline: 3px solid rgba(31,111,92,.3); }
.segmented .seg-sick input:checked + label { background: var(--sick); color: #fff; }
.segmented .seg-away input:checked + label { background: var(--away); color: #fff; }
.segmented .seg-present input:checked + label { background: var(--brand); color: #fff; }

/* Chips (group filters) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 600; font-size: .86rem; text-decoration: none; cursor: pointer; }
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--g); }
.chip.plain::before { display: none; }
.chip.on { border-color: var(--g); background: color-mix(in srgb, var(--g) 16%, white); color: var(--ink); }
.chip.plain.on { border-color: var(--brand); background: var(--brand-soft); }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips input:checked + .chip { border-color: var(--g); background: color-mix(in srgb, var(--g) 16%, white); color: var(--ink); }

/* ---------- Badges & status ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.sick { background: var(--sick-soft); color: var(--sick); }
.badge.away, .badge.off { background: var(--away-soft); color: var(--away); }
.badge.leave { background: #ece6f7; color: #5b3f94; }
.badge.pending { background: var(--late-soft); color: var(--late); }
.badge.late { background: var(--late-soft); color: var(--late); }
.badge.in, .badge.ok, .badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.out { background: var(--line-2); color: var(--ink-2); }
.badge.nap { background: #e6e9fb; color: #3d4aa3; }
.badge.group { background: color-mix(in srgb, var(--g) 18%, white); color: var(--ink); }
.badge.group::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.badge.admin { background: var(--sun-soft); color: #8a6312; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; }
.comm { cursor: help; }

/* ---------- Avatars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #e6ebe8; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--g); }
.avatar.lg { width: 88px; height: 88px; }
.avatar.sm { width: 30px; height: 30px; border-width: 1px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .sub { font-size: .82rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
tbody tr:hover { background: #fafbf8; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
tr.inactive td { color: var(--muted); }

/* ---------- Week calendar (children & staff) ---------- */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav .label { font-weight: 700; min-width: 190px; text-align: center; }
.cal { border-collapse: separate; border-spacing: 0; min-width: 860px; }
.cal th { text-align: center; }
.cal th.today-col { background: var(--brand-soft); color: var(--brand-2); }
.cal td { padding: 6px; border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line-2); }
.cal td:first-child { border-left: 0; min-width: 210px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cal tr.group-row td { background: color-mix(in srgb, var(--g) 12%, white); font-weight: 700; padding: 8px 12px; position: static; }
.cal tr.group-row td:first-child { box-shadow: inset 4px 0 0 var(--g); }
.cal-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 9px; border-radius: 8px; min-height: 36px; background: var(--ok-soft); color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; text-decoration: none; border: 1px solid transparent; }
a.cal-cell:hover { border-color: var(--brand); color: var(--ink); }
.cal-cell.sick { background: var(--sick-soft); color: var(--sick); }
.cal-cell.away { background: var(--away-soft); color: var(--away); }
.cal-cell.none { background: transparent; color: var(--muted); border: 1px dashed var(--line); font-weight: 500; }
.cal-cell.closed { background: repeating-linear-gradient(-45deg, #f1f1ee, #f1f1ee 6px, #e8e8e3 6px, #e8e8e3 12px); color: var(--muted); }
.cal-cell.leave { background: #ece6f7; color: #5b3f94; }
.cal-cell.off { background: var(--line-2); color: var(--muted); }
.cal-cell.carried { opacity: .82; }
.cal-cell .flags { display: inline-flex; gap: 3px; font-size: .95rem; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .84rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend .l-present { background: var(--ok-soft); border: 1px solid #bfe3c3; }
.legend .l-sick { background: var(--sick-soft); border: 1px solid #f2c4ba; }
.legend .l-away { background: var(--away-soft); border: 1px solid #cfd8e3; }
.legend .l-none { border: 1px dashed var(--line); }

/* ---------- Current day ---------- */
.day-list { display: flex; flex-direction: column; gap: 10px; }
.group-block { border-left: 5px solid var(--g); }
.group-block > .card-head .count { color: var(--muted); font-weight: 600; font-size: .9rem; }
.ev { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; background: var(--line-2); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev.nap-active { background: #e6e9fb; color: #3d4aa3; font-weight: 700; }
.bulkbar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-top: 14px; background: var(--ink); color: #fff; border-radius: 999px; box-shadow: var(--shadow-lg); }
.bulkbar button { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.bulkbar button:hover { background: rgba(255,255,255,.22); color: #fff; }
.bulkbar .count { font-weight: 700; }

/* Log event picker */
/* "Add to the daily log": one text box, a large toggle for who can read it. */
.audience { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--line-2); }
.audience input { position: absolute; opacity: 0; pointer-events: none; }
.audience label { flex-direction: row; justify-content: center; align-items: center; gap: 6px; min-height: 48px; padding: 8px 12px;
  border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--ink-2); text-align: center; }
.audience label small { font-weight: 400; color: var(--muted); }
.audience input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.audience #aud-private:checked + label { background: #fff4dc; color: #6f4f12; }
.audience input:focus-visible + label { outline: 3px solid rgba(31,111,92,.3); }
.note-box:has(#aud-private:checked) textarea { border-color: #e3c27e; background: #fffbf2; }
.note-box:has(#aud-private:checked) .for-parents, .note-box:not(:has(#aud-private:checked)) .for-private { display: none; }
.audience-hint { margin: -4px 0 0; }
/* Diary form: names separated by commas, only between the visible ones. */
.no-photo:not([hidden]) ~ .no-photo:not([hidden])::before { content: ", "; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.event-grid button { flex-direction: column; min-height: 76px; border-radius: var(--radius-sm); font-size: .9rem; gap: 2px; }
.event-grid button .ico { font-size: 1.5rem; line-height: 1; }

/* Timeline (daily log) */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 62px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 52px 22px 1fr auto; gap: 8px; align-items: start; padding: 7px 0; }
.timeline .t { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); text-align: right; padding-top: 1px; }
.timeline .ico { position: relative; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; background: var(--surface); border-radius: 50%; font-size: .95rem; }
.timeline .what { font-weight: 600; }
.timeline .what .note { display: block; font-weight: 400; color: var(--ink-2); white-space: pre-wrap; }
.timeline .by { font-size: .8rem; color: var(--muted); }

/* ---------- Parent week planner ---------- */
.child-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.child-switch a { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 650; }
.child-switch a.active { border-color: var(--brand); background: var(--brand-soft); }
.days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.day-card.sick { border-color: #f2c4ba; background: linear-gradient(180deg, var(--sick-soft), #fff 70px); }
.day-card.away { border-color: #cfd8e3; background: linear-gradient(180deg, var(--away-soft), #fff 70px); }
.day-card.closed { background: var(--line-2); box-shadow: none; }
.day-card.past { opacity: .72; }
.day-card .day-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.day-card .day-title strong { font-size: 1.05rem; }
.day-card .times-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.day-card .saved { font-size: .78rem; color: var(--ok); min-height: 1.2em; }
.day-card .segmented { display: flex; }
.day-card .segmented > span { flex: 1; display: flex; }
.day-card .segmented label { flex: 1; justify-content: center; padding: 6px 4px; font-size: .84rem; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.photo-grid a, .photo-grid figure { display: block; position: relative; margin: 0; border-radius: var(--radius-sm); overflow: hidden; background: #e9ece8; aspect-ratio: 4 / 3; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo-grid a:hover img { transform: scale(1.03); }
.photo-grid .tag { position: absolute; left: 6px; bottom: 6px; }
.photo-day { margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.photo-day h2 { margin: 0; font-size: 1.05rem; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(15, 20, 20, .92); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 8px; }

/* ---------- Planning ---------- */
.heat { border-collapse: separate; border-spacing: 2px; font-variant-numeric: tabular-nums; min-width: 900px; }
.heat th { position: static; font-size: .7rem; padding: 4px 2px; background: none; text-align: center; writing-mode: vertical-rl; transform: rotate(180deg); height: 48px; }
.heat th.rowh { writing-mode: horizontal-tb; transform: none; text-align: left; height: auto; font-size: .82rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.heat td { padding: 0; border: 0; text-align: center; font-size: .78rem; font-weight: 700; height: 30px; min-width: 26px; border-radius: 4px; }
.heat td.rowh { text-align: left; padding: 0 10px 0 0; font-size: .86rem; white-space: nowrap; font-weight: 650; }
.heat tr.sep td { height: 8px; }
.lv0 { background: #f3f4f1; color: #b5bbb7; }
.lv1 { background: #e3f1ec; color: #2c6e5a; }
.lv2 { background: #c6e4d8; color: #1f5f4c; }
.lv3 { background: #9fd0bb; color: #174c3d; }
.lv4 { background: #6fb79a; color: #fff; }
.lv5 { background: #3f9a7a; color: #fff; }
.lv6 { background: #1f6f5c; color: #fff; }
.short { background: var(--sick-soft) !important; color: var(--sick) !important; box-shadow: inset 0 0 0 2px var(--sick); }
.enough { background: var(--ok-soft); color: var(--ok); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h1 { margin: 0 0 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--brand-2); border-bottom-color: var(--brand); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-weight: 600; }
dl.kv dd { margin: 0; }

/* ---------- Admin ---------- */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.admin-tiles a { display: block; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.admin-tiles a:hover { border-color: var(--brand); }
.admin-tiles .ico { font-size: 1.6rem; }
.admin-tiles strong { display: block; margin: 6px 0 2px; }
.admin-tiles span { color: var(--muted); font-size: .88rem; }
/* Group icons: a badge in the group colour; the picker shows the choices in that colour. */
.group-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--g); color: #fff; vertical-align: middle; }
.group-badge svg { width: 16px; height: 16px; }
.icon-picker { border: 0; padding: 0; min-width: 0; --g: #8c867b; }
.form-grid .icon-picker { grid-column: 1 / -1; }
.icon-picker legend { padding: 0; margin-bottom: 8px; font-size: .92rem; font-weight: 600; }
.icon-options { display: flex; flex-wrap: wrap; gap: 8px; }
label.icon-option { position: relative; display: inline-flex; flex-direction: row; cursor: pointer; }
.icon-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--g) 14%, white); color: color-mix(in srgb, var(--g) 80%, black); }
.icon-badge svg { width: 20px; height: 20px; }
.icon-option input:checked + .icon-badge { background: var(--g); color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--g); }
.icon-option input:focus-visible + .icon-badge { outline: 2px solid var(--ink); outline-offset: 5px; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; background: var(--g); vertical-align: middle; border: 1px solid rgba(0,0,0,.08); }
.code-box { font-family: var(--mono); font-size: 1.8rem; letter-spacing: .12em; padding: 14px 20px; background: var(--sun-soft); border: 2px dashed var(--sun); border-radius: var(--radius-sm); display: inline-block; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: .85rem; }

/* ---------- Modal ---------- */
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(20, 30, 30, .45); }
.modal-inner { padding: 22px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; flex: 1; }

/* ---------- Parent tab bar (mobile) ---------- */
.tabbar { display: none; }
.navmenu { display: none; }

/* ---------- Dev ribbon ---------- */
.dev-ribbon { position: fixed; z-index: 200; top: 0; left: 0; right: 0; height: 3px; background: repeating-linear-gradient(90deg, var(--roof) 0 18px, var(--sun) 18px 36px); font-size: 0; pointer-events: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .days { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .container { padding: 14px 12px 90px; }
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .brand span { display: none; }
  /* Staff on a phone: logo + "Menu" (tabs, account, log out). */
  .portal-staff .mainnav, .portal-staff .usermenu { display: none; }
  .portal-staff .navmenu { display: block; margin-left: auto; }
  .navmenu > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; font-weight: 600; }
  .navmenu > summary svg { width: 22px; height: 22px; }
  .navmenu .menu-pop { position: fixed; top: 58px; left: 8px; right: 8px; max-height: calc(100vh - 74px); overflow-y: auto; }
  .navmenu .menu-pop > a, .navmenu .menu-pop form > button { min-height: 46px; font-size: 1.02rem; }
  .navmenu .menu-pop a.active { background: var(--brand-soft); color: var(--brand-2); }
  .navmenu .menu-pop hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
  /* Today on a phone: group chips in one scrollable line; nap buttons show their icon only. */
  .compact-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .compact-chips::-webkit-scrollbar { display: none; }
  .compact-chips .chip { flex: none; }

  .portal-parent .parent-topnav { display: none; }
  .portal-parent .usermenu .account-link { display: none; }
  .usermenu { margin-left: auto; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    backdrop-filter: blur(6px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0; font-size: .72rem; font-weight: 650; color: var(--muted); text-decoration: none; border-radius: 10px; }
  .tabbar a .ico { font-size: 1.25rem; filter: grayscale(.5); }
  .tabbar a.active { color: var(--brand-2); background: var(--brand-soft); }
  .tabbar a.active .ico { filter: none; }
  .days { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .bulkbar { border-radius: var(--radius); }
  .auth-shell { padding-top: 24px; }
}
.top-gap { margin-top: 1.4em; }
.nomargin { margin: 0; }
.error-text { color: var(--sick); font-weight: 600; }
.phone { font-size: 1.1rem; }

.filter-bar { margin-bottom: 16px; }
.comm-cell { min-width: 0; }
.comm-cell .comm { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--ink-2); font-weight: 500; }
.events .ev { border: 0; cursor: pointer; font: inherit; font-size: .8rem; min-height: 0; }
.events .ev:hover { background: var(--brand-soft); }
.photo-grid figure .photo-del { position: absolute; top: 6px; right: 6px; min-height: 28px; padding: 2px 9px; background: rgba(255,255,255,.9); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.card-head input[type=checkbox] { flex: none; }

/* Planning */
.segmented .seg-link { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 600; color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.segmented .seg-link.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.heat td.need { color: var(--ink-2); font-weight: 600; background: transparent; }
.heat tr.need-row td { height: 22px; font-size: .74rem; }
.heat tr.total-row td { height: 32px; }
.heat tr.total-row td.rowh { padding-top: 4px; }
.heat td.enough { background: var(--ok-soft); color: var(--ok); }
.stat.stat-alert { border-color: #f2c4ba; background: var(--sick-soft); }
.legend .legend-short { width: 14px; height: 14px; border-radius: 4px; display: inline-block; background: var(--sick-soft); box-shadow: inset 0 0 0 2px var(--sick); }

/* Lists */
.search { max-width: 340px; }
.inline-cell { display: inline-flex; min-height: 28px; padding: 3px 9px; }
tr.me-row td { background: #fbfdf9; }
tr.me-row td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
.cal tfoot td { background: var(--surface-2); border-top: 1px solid var(--line); }

/* Chips are labels: keep them in a row (the generic label style stacks). */
label.chip { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: .86rem; color: var(--ink-2); }
.filter-bar .row > select, .filter-bar .row > input[type=search] { width: auto; }

/* Admin */
input.narrow { width: 84px; min-width: 0; }
.type-row { flex-wrap: wrap; }
.type-row > input[type=text] { width: 220px; }
.flat-table { box-shadow: none; }
.narrow-card { max-width: 640px; }
.danger-zone { border-color: #f2c4ba; }
.audit-details { max-width: 520px; word-break: break-word; }
.field-hint { margin: -8px 0 0; }

/* ---------- Today: compact list ---------- */
.compact-head { margin-bottom: 10px; gap: 8px 14px; }
.compact-head h1 { font-size: 1.4rem; }
.compact-chips { margin-bottom: 10px; }
.compact-chips .chip { padding: 3px 10px; font-size: .8rem; }
.today-stats { margin: 0 0 10px; color: var(--ink-2); }
.compact-group { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--g); border-radius: var(--radius-sm); padding: 4px 10px 6px; margin-bottom: 10px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--line-2); }
.group-head h2 { font-size: 1rem; margin: 0; }
.group-head .count { color: var(--muted); font-size: .85rem; font-weight: 600; }
/* One line per child: name (opens today's log), times, the parents' message, actions. */
.kid-row {
  display: grid; align-items: center; gap: 4px 10px; padding: 4px 2px; border-top: 1px solid var(--line-2); font-size: .9rem;
  /* Content never sizes the columns, so every row lines up with the others. */
  grid-template-columns: 20px minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, 2.5fr) auto;
}
.kid-row:first-of-type { border-top: 0; }
.kid-row .person { gap: 7px; flex-wrap: nowrap; min-width: 0; }
.kid-row .person .name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; color: var(--ink); text-align: left; }
.kid-row .person > :not(.name) { flex: none; }
/* Start nap / Woke up share one slot of a fixed width (empty when neither applies). */
.kid-row .nap-btn { width: 108px; justify-content: center; flex: none; }
.kid-row span.nap-btn { display: inline-block; }
.kid-row .person .name:hover { color: var(--brand); text-decoration: underline; }
/* Today's log dialog */
.kid-log-comm { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--line-2); }
.kid-log { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.kid-log-line {
  width: 100%; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "ico what when" "ico who who";
  align-items: center; gap: 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-height: 0;
}
.kid-log-line:hover { background: var(--brand-soft); }
.kid-log-line.sleeping { background: #eef0fb; border-color: #d5d9f3; }
.kid-log-line .ico { grid-area: ico; font-size: 1.2rem; text-align: center; }
.kid-log-line .what { grid-area: what; font-weight: 600; min-width: 0; }
.kid-log-line .what .text { display: block; font-weight: 400; color: var(--ink-2); white-space: pre-line; }
.kid-log-line .when { grid-area: when; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.kid-log-line .who { grid-area: who; font-size: .8rem; color: var(--muted); }
.kid-row .person .badge { font-size: .7rem; padding: 1px 6px; }
.kid-row.is-sick .person .name { color: var(--sick); }
.kid-row.is-away .person .name { color: var(--away); }
.kid-row .times { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kid-row .times .actual { font-weight: 650; }
.kid-row .times .planned { color: var(--muted); font-size: .82rem; }
.kid-row .row-actions { grid-column: -2; grid-row: 1; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.kid-row .row-actions .small { min-height: 28px; padding: 2px 9px; }
.avatar.xs { width: 28px; height: 28px; border-width: 1px; box-shadow: 0 0 0 2px var(--g); }

/* "…" menus */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 220px; padding: 6px;
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu-pop > button, .menu-pop > a {
  justify-content: flex-start; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font-weight: 550; text-decoration: none; text-align: left;
}
.menu-pop > button:hover, .menu-pop > a:hover { background: var(--line-2); }
.menu-pop > form { margin: 0; }
.menu-pop > form > button {
  justify-content: flex-start; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font-weight: 550; text-align: left;
}
.menu-pop > form > button:hover { background: var(--line-2); }

@media (max-width: 1100px) {
  .kid-row { grid-template-columns: 20px minmax(0, 1fr) minmax(0, .8fr) auto; }
  .kid-row .comm-cell { grid-column: 2 / -1; }
}
@media (max-width: 760px) {
  .kid-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .kid-row .times, .kid-row .comm-cell { grid-column: 2 / -1; }
  /* Phones: the nap slot shows its icon only, so names keep their room. */
  .kid-row .nap-btn { width: 40px; padding-inline: 0; }
  .kid-row .nap-btn .lbl { display: none; }
  .group-head h2 { white-space: nowrap; }
  .group-head .count { white-space: nowrap; }
}

/* ---------- Parent week plan: compact day cards ---------- */
.days { gap: 10px; }
.day-card { padding: 10px 12px; gap: 6px; }
.day-form { display: flex; flex-direction: column; gap: 6px; }
.day-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-label { font-size: .98rem; white-space: nowrap; }
.late-dot { font-size: .85rem; cursor: help; }
.segmented.tiny { margin-left: auto; padding: 2px; }
.segmented.tiny label { padding: 3px 9px; font-size: .78rem; }
.time-line { display: flex; align-items: center; gap: 6px; margin: 0; }
.time-line select { min-height: 34px; padding: 4px 8px; font-variant-numeric: tabular-nums; flex: 1; min-width: 0; }
.time-line .arrow { color: var(--muted); }
.day-msg > summary { cursor: pointer; font-size: .84rem; color: var(--brand); font-weight: 600; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-msg > summary::-webkit-details-marker { display: none; }
.day-msg[data-has-message] > summary { color: var(--ink-2); font-weight: 500; }
.day-msg[open] > summary { margin-bottom: 4px; }
.day-msg textarea { min-height: 56px; font-size: .9rem; }
.day-note { margin: 0; font-size: .8rem; }
.day-note.saved { color: var(--ok); }
.day-card.sick, .day-card.away { background: none; }
.day-card.sick { border-color: #f2c4ba; box-shadow: inset 4px 0 0 var(--sick); }
.day-card.away { border-color: #cfd8e3; box-shadow: inset 4px 0 0 var(--away); }
.day-card .segmented.tiny .seg-sick input:checked + label { background: var(--sick); color: #fff; }
.day-card .segmented { display: inline-flex; }
.day-card .segmented > span { flex: none; display: inline-flex; }

/* ---------- Diary ---------- */
.diary-list { display: flex; flex-direction: column; gap: 12px; }
.diary-entry { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--g); border-radius: var(--radius-sm); padding: 12px 14px; }
.card .diary-entry { border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; padding: 4px 0 4px 12px; margin-bottom: 10px; }
.diary-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.diary-text { white-space: pre-wrap; margin: 0 0 8px; }
.diary-entry .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }

/* ---------- Private notes ---------- */
.note .note-text { margin: 4px 0 0; white-space: pre-wrap; }
@media (max-width: 760px) {
  .portal-parent .tabbar:has(> a:nth-child(4):last-child) { grid-template-columns: repeat(4, 1fr); }
}
.day-label { display: flex; flex-direction: column; line-height: 1.1; }
.day-label span { font-size: .72rem; font-weight: 500; color: var(--muted); }
.day-line { flex-wrap: nowrap; }
.segmented.tiny label { padding: 3px 7px; }
