/* Let's Imagine Preschool — colours from the school logo. Fonts are bundled (SIL OFL): Fredoka (display), Atkinson Hyperlegible (text). */
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url(/static/fonts/fredoka-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url(/static/fonts/fredoka-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); }

:root {
  --ink: #202655;
  --ink-2: #51607E;
  --sky: #F3F3FA;
  --sky-2: #E4E6F6;
  --line: #DCDEF0;
  --card: #FFFFFF;
  --cobalt: #384898;
  --cobalt-dk: #26327A;
  --cobalt-soft: #E6E8F6;
  --sun: #F8C800;
  --sun-dk: #B08C00;
  --sun-soft: #FFF5CC;
  --grass: #009858;
  --grass-soft: #DDF3E8;
  --berry: #C01888;
  --berry-dk: #8E1064;
  --berry-soft: #FBE3F1;
  --plum: #8008A8;
  --orange: #F06018;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --text: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.55 var(--text); background: var(--sky); color: var(--ink); }
a { color: var(--cobalt); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; letter-spacing: -.005em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem); margin: 0 0 .5em; }
h2 { font-size: 1.25rem; margin: 0 0 .6em; }
h3 { font-size: 1.05rem; margin: 1.3em 0 .4em; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }
.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }

/* ---------- Top bar & navigation ---------- */
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px clamp(14px, 3vw, 28px); background: var(--card); border-bottom: 2px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand img { height: 56px; width: auto; display: block; }
.nav { display: flex; gap: 2px; flex: 1; align-items: center; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .95rem; position: relative; }
.nav a:hover { color: var(--ink); background: var(--sky); }
.nav a.active { color: var(--cobalt); background: var(--cobalt-soft); }
.nav .badge { position: absolute; top: 2px; left: 26px; }
.me { display: flex; gap: 14px; align-items: center; font-size: .92rem; }
.me > a { display: flex; gap: 8px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; }
.adminmenu { position: relative; }
.adminmenu summary { list-style: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border-radius: 12px; font-weight: 700; color: var(--ink-2); font-size: .95rem; }
.adminmenu summary::-webkit-details-marker { display: none; }
.adminmenu[open] summary, .adminmenu summary:hover { background: var(--sky); color: var(--ink); }
.adminmenu .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: 6px; min-width: 190px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(30,43,74,.12); }
.adminmenu .menu a { padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.adminmenu .menu a:hover, .adminmenu .menu a.active { background: var(--cobalt-soft); color: var(--cobalt); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--berry); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 20px; }

/* ---------- Layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px clamp(14px, 3vw, 28px) 80px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 20px; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.mt { margin-top: 16px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.scroll-x { overflow-x: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.wrap > input { flex: 1 1 180px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; align-items: end; }
.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 880px) { .cols { grid-template-columns: 1fr; } }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.subtitle { margin: 2px 0 0; color: var(--ink-2); }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 18px; font-weight: 700; word-break: break-word; border: 2px solid; }
.flash.ok { background: var(--grass-soft); color: #1C6B49; border-color: #B5E3CB; }
.flash.err { background: var(--berry-soft); color: var(--berry-dk); border-color: #F5BFD0; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
label.inline { display: inline-flex; }
input, select, textarea { font: inherit; font-size: 1rem; padding: 10px 13px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
input:hover, select:hover, textarea:hover { border-color: #C3C7E6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 4px var(--cobalt-soft); }
input:disabled { background: var(--sky); color: var(--ink-2); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--cobalt); flex: none; box-shadow: none; }
fieldset { border: 2px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-family: var(--display); font-weight: 600; padding: 0 6px; }
form.inline { display: inline; }
.row input, .row select { width: auto; }

/* Buttons: chunky and pressable, like toy blocks. */
.btn { --b: var(--cobalt); --bd: var(--cobalt-dk); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 14px; border: 0;
  background: var(--b); color: var(--fg); font: 700 1rem var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 0 var(--bd); transform: translateY(0); transition: transform .08s, box-shadow .08s; margin-bottom: 4px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bd); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { --b: #fff; --bd: var(--line); --fg: var(--cobalt); box-shadow: 0 3px 0 var(--bd), inset 0 0 0 2px var(--line); }
.btn.ghost:active { box-shadow: 0 0 0 var(--bd), inset 0 0 0 2px var(--line); }
.btn.sun { --b: var(--sun); --bd: var(--sun-dk); --fg: var(--ink); }
.btn.grass { --b: var(--grass); --bd: #1F7550; }
.btn.berry { --b: var(--berry); --bd: var(--berry-dk); }
.btn.sm { padding: 6px 13px; font-size: .9rem; border-radius: 11px; }
.btn.wide { width: 100%; padding: 13px; font-size: 1.05rem; }
button.link { background: none; border: 0; padding: 0; color: var(--cobalt); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
button.link.danger, .danger { color: var(--berry-dk); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------- People ---------- */
.av { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; font-family: var(--display); font-weight: 600; font-size: .95rem; flex: none; }
.av.sm { width: 28px; height: 28px; font-size: .72rem; }
.av.lg { width: 72px; height: 72px; font-size: 1.5rem; }
.av.c0 { background: #FFE08A; color: #6B4A00; } .av.c1 { background: #BFD3FF; color: #26327A; } .av.c2 { background: #FFC2D4; color: #8E1F45; }
.av.c3 { background: #B8EBCF; color: #18603F; } .av.c4 { background: #FFD2B8; color: #8A3A10; } .av.c5 { background: #DCCBFF; color: #4B2C9C; }
.av.s0 { border-radius: 50%; } .av.s1 { border-radius: 42% 58% 55% 45% / 50% 44% 56% 50%; }
.av.s2 { border-radius: 30%; } .av.s3 { border-radius: 58% 42% 46% 54% / 42% 56% 44% 58%; }
.who { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-width: 0; }
.who b { display: block; }
.who small { display: block; }
.who.big h1 { margin: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .84rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.in { background: var(--grass-soft); color: #1C6B49; }
.pill.out { background: var(--cobalt-soft); color: var(--cobalt-dk); }
.pill.absent { background: #EEF1F6; color: var(--ink-2); }
.allergy { display: inline-flex; align-items: center; gap: 4px; color: var(--berry-dk); font-weight: 700; }

/* ---------- Dashboard ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: var(--cobalt); color: #fff; border-radius: var(--r-lg); padding: 22px 26px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hello h1 { margin: 0; color: #fff; }
.hello p { margin: 4px 0 0; color: #D6E1FF; }
.hello::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--sun); opacity: .95; }
.hello .stats { position: relative; z-index: 1; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: #fff; color: var(--ink); border-radius: var(--r-md); padding: 8px 16px; min-width: 92px; }
.stat b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--ink-2); }
.stat.in b { color: var(--grass); } .stat.out b { color: var(--cobalt); } .stat.absent b { color: var(--ink-2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip { padding: 7px 16px; border-radius: 999px; background: #fff; border: 2px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; }
.chip:hover { border-color: #C3C7E6; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips select { width: auto; }

.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--sun-soft); border: 2px solid #F5DD95; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
.bulkbar .muted { color: #6B4A00; font-weight: 700; margin-left: 6px; }
.roster { list-style: none; margin: 0 0 22px; padding: 0; background: var(--card); border: 2px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.roster-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 2px solid var(--sky); }
.roster-row:first-child { border-top: 0; }
.roster-row:hover { background: #FAFCFF; }
.roster-row .who { flex: 1; }
.roster-row.status-absent .av { filter: saturate(.25); opacity: .8; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-top: 2px solid var(--sky); }
.list li:first-child { border-top: 0; }
.feed li { display: grid; grid-template-columns: 70px 30px 1fr; gap: 8px; align-items: start; }
.feed time { color: var(--ink-2); font-size: .88rem; padding-top: 3px; }

/* ---------- Activity type colors ---------- */
.t-meal { --tc: #C2410C; --tb: #FFE4D2; } .t-nap { --tc: #4B2C9C; --tb: #EAE0FF; } .t-diaper { --tc: #0E7490; --tb: #D5F2F8; }
.t-mood { --tc: #8A6100; --tb: var(--sun-soft); } .t-learning { --tc: var(--cobalt-dk); --tb: var(--cobalt-soft); } .t-medication { --tc: #6D28D9; --tb: #EFE7FF; }
.t-incident { --tc: var(--berry-dk); --tb: var(--berry-soft); } .t-note { --tc: var(--ink-2); --tb: #EEF1F6; } .t-photo { --tc: #18603F; --tb: var(--grass-soft); }
.t-checkin { --tc: #fff; --tb: var(--grass); } .t-checkout { --tc: #fff; --tb: var(--cobalt); }
.ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; background: var(--tb, var(--sky)); color: var(--tc, var(--ink)); }
.ico .i { width: 18px; height: 18px; }

/* ---------- Day timeline ---------- */
.daynav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.daynav input { width: auto; padding: 6px 10px; }
.daynav .btn { margin-bottom: 3px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 89px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--sky-2); }
.tl-item { display: grid; grid-template-columns: 66px 46px 1fr; gap: 0 8px; padding: 7px 0; align-items: start; }
.tl-item time { color: var(--ink-2); font-size: .88rem; text-align: right; padding-top: 10px; font-variant-numeric: tabular-nums; }
.tl-item > .ico { width: 40px; height: 40px; border-radius: 14px; position: relative; z-index: 1; margin-top: 2px; border: 3px solid var(--card); box-sizing: content-box; }
.tl-item > .ico .i { width: 20px; height: 20px; }
.tl-body { background: #F8FAFE; border-radius: var(--r-md); padding: 10px 15px; }
.tl-incident .tl-body { background: var(--berry-soft); }
.tl-title { font-family: var(--display); font-weight: 600; font-size: 1.02rem; }
.tl-text { margin-top: 2px; }
.tl-meta { color: var(--ink-2); font-size: .82rem; margin-top: 4px; }
.tl-photo { display: block; margin-top: 10px; border-radius: 14px; max-height: 380px; width: 100%; object-fit: cover; }

/* ---------- Empty states ---------- */
.empty { color: var(--ink-2); text-align: center; padding: 8px 0; margin: 0; }
.empty-state { text-align: center; padding: 18px 10px 8px; color: var(--ink-2); }
.empty-state img { width: 200px; height: auto; display: block; margin: 0 auto 10px; }
.empty-state b { display: block; font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); margin-bottom: 2px; }
.empty-state .btn { margin-top: 14px; }

/* ---------- Log activity ---------- */
.typepick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.typebtn { position: relative; }
.typebtn input { position: absolute; opacity: 0; }
.typebtn span { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 6px 10px; border: 2px solid var(--line); border-radius: var(--r-md); background: #fff; cursor: pointer; font-weight: 700; font-size: .88rem; }
.typebtn .ico { width: 40px; height: 40px; border-radius: 14px; }
.typebtn .ico .i { width: 22px; height: 22px; }
.typebtn:hover span { border-color: #C3C7E6; }
.typebtn input:checked + span { border-color: var(--cobalt); background: var(--cobalt-soft); box-shadow: 0 3px 0 var(--cobalt); }
.typebtn input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.kidpick { display: flex; flex-wrap: wrap; gap: 8px; }
.kid { flex-direction: row; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border: 2px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; cursor: pointer; }
.kid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kid:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-soft); color: var(--cobalt-dk); }
.kid:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.kid:has(input:checked) .av::after { content: "✓"; }
.kid:has(input:checked) .av { font-size: 0; background: var(--cobalt); }
.kid:has(input:checked) .av::after { font-size: .85rem; color: #fff; }
.kid.absent { opacity: .7; }
.kid.noconsent { opacity: .45; cursor: not-allowed; }

/* ---------- Family ---------- */
.child-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 18px 22px; margin-bottom: 22px; }
.child-hero h1 { margin: 0; }
.kidcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.kidcard { display: flex; gap: 16px; align-items: center; text-decoration: none; color: inherit; transition: border-color .12s; }
.kidcard:hover { border-color: var(--cobalt); }
.kidcard h2 { margin: 0 0 2px; }
.info dt { font-weight: 700; margin-top: 10px; }
.info dt:first-child { margin-top: 0; }
.info dd { margin: 2px 0 0; }

/* ---------- Photos ---------- */
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; color: var(--cobalt); }
details[open].card > summary::after { content: "–"; }
details[open].card > summary { margin-bottom: 16px; }
.dropzone { border: 2px dashed #A9BFE3; border-radius: var(--r-md); background: var(--sky); padding: 18px; text-align: center; cursor: pointer; }
.dropzone:hover { border-color: var(--cobalt); }
.dropzone input { margin-top: 8px; background: transparent; border: 0; padding: 0; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; }
.previews img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.photo { margin: 0; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); overflow: hidden; padding: 8px; }
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-md); }
.photo figcaption { padding: 10px 6px 4px; font-size: .94rem; }
.photo .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.photo .tags span { background: var(--sun-soft); color: #6B4A00; border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 700; }
.photo-actions { display: flex; gap: 14px; margin-top: 8px; font-size: .86rem; }

/* ---------- Messages ---------- */
.threads { list-style: none; padding: 6px; }
.threads li + li { border-top: 2px solid var(--sky); }
.threads a { display: flex; gap: 14px; align-items: center; padding: 12px 10px; border-radius: var(--r-md); text-decoration: none; color: inherit; }
.threads a:hover { background: #F8FAFE; }
.threads a.unread .t-main b { color: var(--cobalt); }
.t-main { flex: 1; min-width: 0; }
.t-main small { display: block; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { max-width: 780px; margin: 0 auto; padding: 0; overflow: hidden; }
.chat-head { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 2px solid var(--sky); }
.chat-head h1 { font-size: 1.3rem; margin: 0; }
.chat-head p { margin: 0; }
.bubbles { display: flex; flex-direction: column; gap: 12px; padding: 20px; max-height: 60vh; overflow-y: auto; background: #FAFCFF; }
.bubble { max-width: 78%; padding: 10px 15px; border-radius: 18px 18px 18px 6px; background: #fff; border: 2px solid var(--line); align-self: flex-start; }
.bubble.staff { background: var(--sun-soft); border-color: #F5DD95; }
.bubble.mine { align-self: flex-end; background: var(--cobalt); border-color: var(--cobalt); color: #fff; border-radius: 18px 18px 6px 18px; }
.bubble.mine .b-meta { color: #D6E1FF; }
.b-meta { font-size: .78rem; color: var(--ink-2); margin-bottom: 3px; }
.b-body { white-space: pre-wrap; word-break: break-word; }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 14px 16px; border-top: 2px solid var(--sky); }
.composer textarea { flex: 1; resize: vertical; }

/* ---------- Announcements ---------- */
.ann h2 { margin-bottom: 4px; }
.ann p { margin: .3em 0 .8em; }
.ann-mini { padding: 12px 14px; background: var(--sun-soft); border-radius: var(--r-md); margin-bottom: 10px; }
.ann-mini p { margin: 4px 0 0; white-space: pre-wrap; }
.megaphone { display: inline-flex; width: 42px; height: 42px; border-radius: 14px; align-items: center; justify-content: center; background: var(--sun); color: var(--ink); flex: none; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-weight: 700; color: var(--ink-2); font-size: .85rem; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 2px solid var(--sky); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive { opacity: .5; }
.table input, .table select { width: auto; padding: 6px 9px; }

/* ---------- Sign-in ---------- */
.auth-page .wrap { max-width: none; padding: 0; }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: calc(100vh - 60px); }
.auth-art { background: #E4E6F6; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.auth-art img { width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 6vw, 80px); background: var(--card); }
.auth-form > div { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.5rem); margin-bottom: .2em; }
.auth-form .lead { color: var(--ink-2); margin: 0 0 24px; font-size: 1.05rem; }
.auth-form .flash { margin-bottom: 16px; }
@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-art { height: 230px; }
  .auth-form { padding: 28px 20px 40px; }
}

/* ---------- Phone: bottom tab bar ---------- */
@media (max-width: 700px) {
  body { font-size: 16px; }
  .topbar { gap: 10px; }
  .brand span { display: none; }
  .me .name { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 2px solid var(--line); }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .72rem; border-radius: 10px; flex: 1; text-align: center; }
  .nav a .i { width: 24px; height: 24px; }
  .nav a.active { background: transparent; }
  .nav a.active .i { background: var(--cobalt-soft); border-radius: 10px; box-sizing: content-box; padding: 2px 12px; }
  .nav .badge { left: calc(50% + 4px); top: 0; }
  .me { margin-left: auto; }
  .wrap { padding: 16px 12px 100px; }
  .hello { padding: 18px; }
  .hello::after { width: 130px; height: 130px; right: -40px; top: -50px; }
  .roster-row { flex-wrap: wrap; gap: 10px; }
  .roster-row .who { flex-basis: calc(100% - 40px); }
  .roster-row .pill { margin-left: 34px; }
  .timeline::before { left: 73px; }
  .tl-item { grid-template-columns: 52px 46px 1fr; }
  .bubble { max-width: 90%; }
  .card { padding: 16px; border-radius: var(--r-md); }
}

/* utilities */
.ico.xs { width: 22px; height: 22px; border-radius: 7px; } .ico.xs .i { width: 14px; height: 14px; }
.ico.s26 { width: 26px; height: 26px; border-radius: 8px; } .ico.s26 .i { width: 16px; height: 16px; }
.mb { margin-bottom: 14px; } .m0 { margin: 0; } .who.top { align-items: flex-start; } .grow { flex: 1; min-width: 0; }

/* ---- Absences, contacts, incident signatures ---- */
.pill.away { background: var(--berry-soft); color: var(--berry-dk); }
.pill.late { background: var(--sun-soft); color: #7A5500; }
.stat.away b { color: var(--berry); }
.family-note { display: block; color: #7A5500; font-weight: 700; font-size: .88rem; }
.family-note::before { content: "\201C"; } .family-note::after { content: "\201D"; }
.t-absence { --tc: var(--berry-dk); --tb: var(--berry-soft); }
.opt { font-weight: 400; color: var(--ink-2); }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pair > label[hidden] { display: none; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 10px 8px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 700; }
.seg label:hover span { border-color: #C3C7E6; }
.seg input:checked + span { border-color: var(--cobalt); background: var(--cobalt-soft); box-shadow: 0 3px 0 var(--cobalt); }
.seg input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.list.reported li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.list.reported { margin-bottom: 14px; padding: 4px 14px; background: var(--sky); border-radius: var(--r-md); }
.list.reported li { border-top-color: #fff; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; vertical-align: 1px; }
.tag.ok { background: var(--grass-soft); color: #1C6B49; }
.contacts li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.contacts li > div { flex: 1 1 160px; }
details.edit > summary { cursor: pointer; color: var(--cobalt); font-weight: 700; list-style: none; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] { flex-basis: 100%; }
details.edit[open] > summary { margin-bottom: 10px; }
details.edit form + form { margin-top: 10px; }
details.edit.add { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--sky); }
details.edit.add > summary::before { content: "+ "; }

.ack { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.ack-done { display: inline-flex; align-items: center; gap: 6px; color: #1C6B49; font-weight: 700; font-size: .9rem; }
.ack-done .i { width: 16px; height: 16px; }
.ack-wait { color: var(--berry-dk); font-weight: 700; font-size: .9rem; }

/* ---- School logo ---- */
.brand { padding: 2px 0; flex: none; }
.brand img { max-width: none; }
.me { white-space: nowrap; }
@media (max-width: 1100px) { .brand img { height: 48px; } .topbar { gap: 12px; } .nav a { padding: 8px 10px; } }
.auth-logo { display: block; width: min(100%, 340px); height: auto; margin: 0 0 22px -6px; }
@media (max-width: 720px) { .brand img { height: 44px; } }

/* ---- News: crayon banners, templates, email ---- */
.news-art { display: block; width: 100%; height: auto; aspect-ratio: 4 / 1; border-radius: var(--r-md); margin-bottom: 14px; }
.ann .news-art { margin: -6px 0 14px; }
.ann h2 { font-size: 1.4rem; }
.ann-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 12px; margin-top: 6px; border-top: 2px solid var(--sky); font-size: .92rem; }
.ann-foot .push { margin-left: auto; }
.ann-foot .sent { display: inline-flex; align-items: center; gap: 6px; color: #1C6B49; font-weight: 700; }
.ann-foot .sent .i { width: 16px; height: 16px; }

.news-composer > form { margin-top: 16px; }
.tpl-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.tpl-picker legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpl { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-weight: 700; font-size: .9rem; text-align: center; }
.tpl:hover { border-color: #C3C7E6; }
.tpl input { position: absolute; opacity: 0; }
.tpl img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 1; border-radius: 9px; }
.tpl:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-soft); box-shadow: 0 3px 0 var(--cobalt); }
.tpl:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.news-art.preview { margin: 4px 0 0; }
.news-composer .hint { margin: -6px 0 0; }
.email-opt { align-items: flex-start; padding: 12px 14px; background: var(--sky); border-radius: var(--r-md); }
.email-opt input { margin-top: 4px; }
.email-opt span { display: flex; flex-direction: column; font-weight: 700; }
.email-opt small { font-weight: 400; }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.list-head p { margin: 0; }
.table-wrap { overflow-x: auto; }
