/*
 * The kindergarten wall: a pale sage wall, white paper, slate ink, pine green
 * for anything you can press, and sun yellow only for "new" and "needs you".
 * The loud thing is each child's znak (js/znak.js); everything else stays quiet.
 * Type: Bricolage Grotesque for names and titles, Figtree for everything else.
 */
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; src: url('fonts/figtree-latin-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Figtree'; src: url('fonts/figtree-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --wall: #EEF2EC;
  --wall-deep: #E2E8E0;
  --bg: var(--wall);
  --surface: #FFFFFF;
  --sunk: #F2F5F1;
  --ink: #1D2A30;
  --muted: #56645F;
  --faint: #6B7873;
  --line: #DCE3DB;
  --primary: #235A49;
  --primary-ink: #FFFFFF;
  --primary-soft: #DCEBE3;
  --accent: #9C5C00;      /* sun, dark enough for small text on white (5:1) */
  --accent-fill: #F2A900; /* sun, for dots and fills */
  --accent-soft: #FFF1CC;
  --sleep: #3D63A8; --sleep-soft: #E3EAF6;
  --meal: #A85A16; --meal-soft: #FBEADB;
  --play: #6E46AE; --play-soft: #EEE7F8;
  --care: #22708C; --care-soft: #DDEEF4;
  --danger: #B93A26; --danger-soft: #FBE3DD;
  --ok: #24764A; --ok-soft: #DCF0E3;
  --r-sm: 12px; --r-md: 16px; --r-lg: 22px;
  --font-display: 'Bricolage', 'Figtree', system-ui, sans-serif;
  --font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-family: var(--font-ui);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.45; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font: inherit; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- type ---------- */
.display { font-family: var(--font-display); font-size: 30px; line-height: 34px; font-weight: 750; letter-spacing: -0.6px; margin: 0; }
.title { font-family: var(--font-display); font-size: 21px; line-height: 26px; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.head { font-size: 16px; line-height: 22px; font-weight: 650; }
.body { font-size: 16px; line-height: 23px; }
.small { font-size: 14px; line-height: 19px; }
.label { font-size: 13px; line-height: 18px; font-weight: 650; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- znak (child symbol) ---------- */
.znak { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-display); font-weight: 700; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, currentColor 18%, transparent); }
.strike { text-decoration: line-through; color: var(--faint); }

/* ---------- layout ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-title { font-family: var(--font-display); font-size: 19px; line-height: 24px; font-weight: 700; letter-spacing: -0.2px; margin: 0; }

/* ---------- phone shell ---------- */
.phone { position: relative; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; height: 100%; }
.phone-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; overflow-y: auto; padding: 8px 18px 44px; scrollbar-width: none; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { display: none; }
.header { display: flex; align-items: center; gap: 14px; padding: 20px 18px 12px; }
.header .sub { font-size: 14px; line-height: 19px; color: var(--muted); margin-top: 2px; }
.subhead { display: flex; align-items: center; gap: 6px; padding: 14px 10px 6px; }
.back { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; }
.back:active { background: var(--wall-deep); }

.tabbar { display: flex; border-top: 1px solid var(--line); background: var(--surface); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; color: var(--faint); font-size: 12px; font-weight: 600; gap: 3px; }
.tab .ico { position: relative; display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: 999px; transition: background-color 0.2s ease; }
.tab.on { color: var(--primary); font-weight: 750; }
.tab.on .ico { background: var(--primary-soft); }
.dot { position: absolute; top: 2px; right: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-fill); border: 2px solid var(--surface); }

/* ---------- desktop: two phones ---------- */
.desk { min-height: 100vh; background: var(--wall-deep); display: flex; flex-direction: column; }
.desk-top { display: flex; align-items: center; gap: 14px; padding: 18px 32px; }
.desk-phones { flex: 1; display: flex; justify-content: center; align-items: flex-start; gap: 64px; padding-bottom: 28px; }
.desk-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.desk-col .who { font-size: 14px; color: var(--muted); }
.desk-col .who b { color: var(--ink); font-weight: 700; }
.frame { width: 390px; height: min(800px, calc(100vh - 130px)); min-height: 560px; border-radius: 46px; border: 10px solid var(--ink); overflow: hidden; box-shadow: 0 24px 48px rgba(29, 42, 48, 0.16); background: var(--bg); }
.single { height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); }
.single .tabbar { padding-bottom: calc(6px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.card.flat { border-color: transparent; }
.card.list { padding: 0; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 60px; width: 100%; text-align: left; }
.list-row + .list-row { border-top: 1px solid var(--line); }
button.list-row:hover { background: var(--sunk); }
button.list-row:active { background: var(--wall); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 16px; font-size: 16px; font-weight: 700; background: var(--primary); color: var(--primary-ink); width: 100%; transition: filter 0.15s ease, transform 0.15s ease; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; transform: none; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); padding: 0 6px; width: auto; min-height: 44px; }
.btn.small { min-height: 44px; padding: 0 16px; border-radius: 13px; font-size: 15px; width: auto; }
.btn.light { background: #fff; color: var(--primary); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 0 16px; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 600; transition: background-color 0.15s ease; }
.chip:active { background: var(--wall); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; line-height: 18px; font-weight: 700; white-space: nowrap; }
.avatar { display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; font-family: var(--font-display); }
.tile-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.status::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; font-size: 14px; line-height: 19px; }
.banner.ok { background: var(--ok-soft); } .banner.ok svg { color: var(--ok); }
.banner.accent { background: var(--accent-soft); } .banner.accent svg { color: var(--accent); }
.banner.danger { background: var(--danger-soft); } .banner.danger svg { color: var(--danger); }

/* A notice from the kindergarten: a pinned note, not another card. */
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--accent-soft); font-size: 15px; line-height: 21px; }
.note svg { color: var(--accent); margin-top: 2px; }
.note b { display: block; font-weight: 700; }

.field { width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 48px; font-size: 16px; color: var(--ink); outline: none; transition: border-color 0.15s ease; }
.field:focus { border-color: var(--primary); }
textarea.field { min-height: 88px; resize: vertical; }

.link { font-size: 14px; color: var(--faint); padding: 10px; margin: 6px auto 0; display: block; min-height: 44px; }
.link:hover { color: var(--muted); }

/* ---------- parent home ---------- */
.child-head { display: flex; align-items: center; gap: 16px; padding: 20px 18px 8px; }
.child-head .display { font-size: 34px; line-height: 38px; }

/* The one strong card: telling the teacher you are on your way. */
.pickup { margin-top: 16px; background: var(--primary); color: #fff; border-radius: 22px; padding: 18px; }
.pickup .title { color: #fff; }
.pickup p { color: rgba(255, 255, 255, 0.85); margin: 6px 0 14px; font-size: 15px; line-height: 21px; }
.pickup .link { color: rgba(255, 255, 255, 0.78); }
.pickup.done { background: var(--ok-soft); color: var(--ink); }
.pickup.sent { background: var(--primary-soft); color: var(--ink); }
.pickup.done .title, .pickup.sent .title { color: var(--ink); }
.pickup.done p, .pickup.sent p { color: var(--muted); margin-bottom: 0; }

/* ---------- timeline ---------- */
.day-sheet { background: var(--surface); border-radius: 22px; border: 1px solid var(--line); padding: 2px 16px; }
.tl { display: flex; gap: 12px; padding: 14px 0; }
.tl + .tl { border-top: 1px solid var(--sunk); }
.tl-time { width: 44px; flex-shrink: 0; font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 7px; }
.tl-ico { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tl-photo { margin-top: 10px; height: 132px; border-radius: 16px; overflow: hidden; width: 100%; display: block; }
.new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-fill); margin-left: 6px; vertical-align: middle; }

/* ---------- teacher: the cubby wall ---------- */
.tally { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 4px 2px 0; }
.tally span { display: flex; flex-direction: column; }
.tally b { font-family: var(--font-display); font-size: 26px; line-height: 30px; color: var(--ink); }
.section-hint { font-size: 14px; color: var(--muted); margin: -4px 2px 12px; }
.chip .znak { margin-left: -8px; }
.cubbies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cubby { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 10px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); text-align: center; min-height: 128px; transition: transform 0.15s ease, opacity 0.2s ease; }
.cubby:active { transform: scale(0.97); }
.cubby .nm { font-weight: 700; font-size: 15px; line-height: 18px; }
.cubby .st { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cubby.present .st { color: var(--ok); }
.cubby.expected { background: transparent; border-style: dashed; border-color: #AFBBAE; }
.cubby.expected .znak { filter: saturate(0.2); opacity: 0.65; }
.cubby.expected .st { color: var(--accent); }
.cubby.gone { opacity: 0.5; }
.cubby.gone .st { color: var(--muted); }
.cubby.absent { background: transparent; border-color: transparent; opacity: 0.5; }
.cubby.absent .st { color: var(--danger); }
.cubby .flag { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-fill); border: 2px solid var(--surface); }
/* The cubby toggles attendance; the small round button in its corner opens the child's card. */
.cubby-wrap { position: relative; display: flex; }
.cubby-wrap .cubby { width: 100%; }
.cubby-info { position: absolute; top: 2px; left: 2px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 50%; }
.cubby-info::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); z-index: -1; }
.cubby-info { z-index: 1; isolation: isolate; }
.cubby-info.warn { color: var(--danger); }
.cubby-info.warn::before { background: var(--danger-soft); border-color: transparent; }
.note.danger { background: var(--danger-soft); }
.note.danger > svg { color: var(--danger); }
.daynav { display: flex; gap: 6px; }
.daynav .nav-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.daynav .nav-btn:disabled { opacity: 0.35; }

/* ---------- album ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { text-align: left; }
.photo .img { position: relative; aspect-ratio: 1.15; border-radius: 16px; overflow: hidden; background: var(--sunk); }
.photo .img .pill { position: absolute; top: 8px; left: 8px; background: var(--accent-fill); color: var(--ink); }
.photo img, .tl-photo img, .viewer .img img, .pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art { width: 100%; height: 100%; }
.pick { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; border: 3px solid transparent; }
.pick.on { border-color: var(--primary); }
.pick .check { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.viewer { position: absolute; inset: 0; background: rgba(18, 26, 30, 0.94); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
.viewer-in { width: 100%; }
.viewer .img { aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; }

/* ---------- chat ---------- */
.chat-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.chat-list::-webkit-scrollbar { display: none; }
.msg { display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine { align-items: flex-end; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 20px 20px 20px 6px; background: var(--surface); border: 1px solid var(--line); font-size: 16px; line-height: 22px; }
.mine .bubble { background: var(--primary); color: #fff; border: 0; border-radius: 20px 20px 6px 20px; }
.msg time { font-size: 12px; color: var(--faint); margin-top: 3px; padding: 0 4px; }
.composer { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.send:disabled { background: var(--wall-deep); color: var(--faint); cursor: default; }

/* ---------- push ---------- */
.push { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 10; display: flex; gap: 12px; align-items: center; background: var(--ink); color: #fff; border-radius: 20px; padding: 12px 14px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); text-align: left; animation: drop 0.25s ease-out; }
.push .bell { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-fill); color: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.push .small { color: #C9D3D0; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }

/* ---------- role select ---------- */
.roles { padding: 28px 22px; display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.logo { display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--accent-fill); }
.role-card { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 80px; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 16px; transition: border-color 0.15s ease; }
.role-card:hover { border-color: var(--primary); }
.role-card .tile-ico { width: 48px; height: 48px; border-radius: 14px; }

.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- v2: summary, photo posts, viewer, calendar, bills ---------- */
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sum-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 92px; }
.sum-ico { color: var(--primary); }
.sum-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.sum-tile b { font-family: var(--font-display); font-size: 22px; line-height: 26px; }
.sum-sub { font-size: 12.5px; color: var(--muted); line-height: 16px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tl-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.tl-thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sunk); }
.tl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-thumb .more { position: absolute; inset: 0; background: rgba(18, 26, 30, 0.55); color: #fff; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.photo .img .count { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; background: rgba(18, 26, 30, 0.7); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.viewer { flex-direction: column; justify-content: flex-start; padding: 12px 16px 20px; overflow-y: auto; }
.viewer-top { width: 100%; display: flex; align-items: center; justify-content: space-between; padding-top: env(safe-area-inset-top); }
.viewer-in { margin: auto 0; }
.viewer .img { cursor: zoom-in; background: #000; }
.viewer .img img { object-fit: contain; }
.viewer .img.zoomed { aspect-ratio: auto; height: 62vh; overflow: auto; cursor: zoom-out; }
.viewer .img.zoomed img { width: 230%; height: auto; max-width: none; }
.viewer-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.nav-btn { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; display: flex; align-items: center; justify-content: center; }
.nav-btn:disabled { opacity: 0.25; }
.dots { display: flex; gap: 6px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.dots span.on { background: #fff; }
.event { display: flex; gap: 14px; align-items: flex-start; }
.date-chip { width: 54px; flex-shrink: 0; border-radius: 14px; background: var(--primary-soft); color: var(--primary); text-align: center; padding: 6px 0; }
.date-chip b { display: block; font-family: var(--font-display); font-size: 22px; line-height: 24px; }
.date-chip span { font-size: 12px; font-weight: 700; text-transform: lowercase; }
.event-note b { display: block; }
.bill-total { display: flex; flex-direction: column; gap: 2px; }
.bill-total b { font-family: var(--font-display); font-size: 32px; line-height: 38px; font-variant-numeric: tabular-nums; }
a.btn { text-decoration: none; }

/* a long link or word in a message wraps inside the bubble */
.bubble { overflow-wrap: anywhere; }
