/* School Teacher — "notebook back cover" theme: chalkboard green, wooden frames,
   ruled notebook paper, crayon colours, Kalam handwriting. Animations use
   transform / opacity only and stop for prefers-reduced-motion. */

:root {
  --board: #1f4d3a;
  --board-2: #2a6049;
  --chalk: #f7f5ee;
  --wood: #9a6232;
  --wood-dark: #6e4220;
  --paper: #fffdf6;
  --paper-2: #fbf5e3;
  --rule: #d6e6f6;
  --margin: #f3a8a8;
  --ink: #23324a;
  --ink-soft: #5d6c85;
  --ink-faint: #8e9bb0;
  --red: #e5533d;
  --yellow: #ffc83d;
  --blue: #3b7dd8;
  --green: #3fa45b;
  --orange: #f08a24;
  --purple: #8b5cf6;
  --teal: #14a3a3;
  --pink: #ec6fa8;
  --wa: #25d366;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(35, 50, 74, .06), 0 10px 26px -12px rgba(35, 50, 74, .28);
  --shadow-lift: 0 2px 0 rgba(35, 50, 74, .05), 0 18px 34px -14px rgba(35, 50, 74, .38);
  --hand: 'Kalam', 'Segoe Print', 'Comic Sans MS', cursive;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', 'Nirmala UI', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.2, .9, .3, 1.25);
  --top-h: 60px;
  --nav-h: 66px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 0 46px, var(--margin) 46px 48px, transparent 48px),
    repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
html.lang-hi body { line-height: 1.62; }
h1, h2, h3 { font-family: var(--hand); font-weight: 700; line-height: 1.2; margin: 0 0 .4em; letter-spacing: .2px; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.18rem; }
p { margin: 0 0 .7em; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hand { font-family: var(--hand); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .88em; }
.small { font-size: .88rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ shell */
#app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 10px;
  background: linear-gradient(180deg, var(--board-2), var(--board));
  color: var(--chalk);
  border-bottom: 6px solid var(--wood);
  box-shadow: 0 3px 0 var(--wood-dark), 0 8px 20px -10px rgba(0,0,0,.5);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--chalk); min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--yellow); display: grid; place-items: center; font-size: 20px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); flex: none; }
.brand-name { font-family: var(--hand); font-weight: 700; font-size: 1.3rem; white-space: nowrap; text-shadow: 0 0 1px rgba(255,255,255,.4), 1px 1px 0 rgba(0,0,0,.15); }
.topbar .top-title { font-family: var(--hand); font-size: 1.2rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
@media (max-width: 640px) { .topbar .brand-name { display: none; } .top-search { padding: 6px 10px; } }
/* an inner page on a phone: the search is an icon, the page's title gets the room (two lines if needed) */
@media (max-width: 640px) {
  .topbar { gap: 6px; padding: 0 8px 0 4px; }
  .topbar .lang-btn { padding: 4px 9px; }
  .topbar.inner .top-search { flex: none; width: 40px; height: 40px; padding: 0; justify-content: center; }
  .topbar.inner .top-search span { display: none; }
  .topbar.inner .top-title { flex: 1 1 auto; min-width: 0; font-size: 1.05rem; line-height: 1.15; white-space: normal; overflow-wrap: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.today-list { list-style: none; margin: 10px 0 0; padding: 0; }
.today-list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed var(--rule); cursor: pointer; border-radius: 10px; transition: background .15s; }
.today-list li:hover { background: #f6f9fe; }
.today-list .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.review-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-bar .warn { flex: 1 1 160px; font-size: .86rem; color: #9a5c00; margin: 0; }
.top-search {
  flex: 1 1 auto; max-width: 520px; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); border: 1.5px dashed rgba(247,245,238,.45);
  border-radius: 999px; padding: 6px 12px; color: var(--chalk); cursor: text;
  transition: background .2s var(--ease);
}
.top-search:hover { background: rgba(255,255,255,.18); }
.top-search span { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.lang-btn {
  border: 2px solid rgba(247,245,238,.6); background: transparent; color: var(--chalk);
  border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  font-family: var(--hand); font-size: 1rem; transition: transform .2s var(--spring), background .2s;
}
.lang-btn:hover { background: rgba(255,255,255,.12); }
.lang-btn:active { transform: scale(.92) rotate(-3deg); }
/* sync state of the copy on this phone: ✓ all on the server · ⏳ n waiting · 📴 offline */
.sync-pill {
  border: 0; border-radius: 999px; padding: 4px 10px; min-width: 34px; height: 30px; flex: none;
  font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
  background: rgba(255,255,255,.14); color: var(--chalk);
  transition: transform .2s var(--spring), background .25s, color .25s;
}
.sync-pill:active { transform: scale(.9); }
.sync-pill.ok { opacity: .8; }
.sync-pill.wait, .sync-pill.busy { background: var(--yellow); color: var(--ink); }
.sync-pill.busy { animation: syncPulse 1.1s ease-in-out infinite; }
.sync-pill.off, .sync-pill.warn { background: #ffe1dc; color: #9a2b1b; }
@keyframes syncPulse { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .sync-pill.busy { animation: none; } }
.icon-btn { border: 0; background: transparent; color: inherit; width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; cursor: pointer; transition: background .15s, transform .2s var(--spring); flex: none; }
.icon-btn:hover { background: rgba(127,127,127,.12); }
.icon-btn:active { transform: scale(.9); }
.topbar .avatar { border: 2px solid var(--chalk); }

main#view {
  max-width: 1180px; margin: 0 auto;
  padding: 16px 14px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom));
}

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--paper);
  border-top: 2px solid var(--rule);
  box-shadow: 0 -10px 24px -16px rgba(35,50,74,.4);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--ink-soft); font-size: .74rem; font-weight: 600; padding: 6px 0;
  transition: color .2s;
}
.bottomnav a .ic { transition: transform .25s var(--spring); }
.bottomnav a.on { color: var(--blue); }
.bottomnav a.on .ic { transform: translateY(-2px) scale(1.12); }
.bottomnav .fab {
  width: 60px; height: 60px; margin: -26px auto 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, var(--yellow) 60%, #e9a800);
  color: var(--ink); display: grid; place-items: center;
  box-shadow: 0 8px 18px -6px rgba(233,168,0,.8), inset 0 -4px 0 rgba(0,0,0,.12);
  border: 4px solid var(--paper); cursor: pointer;
  transition: transform .25s var(--spring);
}
.bottomnav .fab:active { transform: scale(.9) rotate(-8deg); }
.bottomnav .fab .ic { stroke-width: 3; }

@media (min-width: 900px) {
  .bottomnav { top: calc(var(--top-h) + 6px); bottom: 0; right: auto; width: 92px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 78px; align-content: start; padding-top: 14px; border-top: 0; border-right: 2px solid var(--rule); box-shadow: none; background: rgba(255,253,246,.9); }
  .bottomnav .fab { margin: 0 auto; }
  main#view { padding: 22px 26px 40px 118px; }
  body { background-image: linear-gradient(90deg, transparent 0 92px, var(--margin) 92px 94px, transparent 94px), repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px); }
}

/* ------------------------------------------------------------------ view transitions */
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes viewOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }
.view-enter { animation: viewIn .38s var(--ease) both; }
::view-transition-old(root) { animation: viewOut .18s ease both; }
::view-transition-new(root) { animation: viewIn .34s var(--ease) both; }
::view-transition-group(*) { animation-duration: .38s; animation-timing-function: var(--ease); }

@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96) rotate(var(--tilt, 0deg)); } to { opacity: 1; transform: rotate(var(--tilt, 0deg)); } }
.pop { animation: pop .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* ------------------------------------------------------------------ buttons, chips, fields */
.btn {
  --bg: var(--blue); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 11px 18px; min-height: 46px;
  background: var(--bg); color: var(--fg); font-weight: 700; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.16), 0 6px 14px -8px var(--bg);
  transition: transform .18s var(--spring), filter .15s, box-shadow .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px) scale(.98); box-shadow: inset 0 -2px 0 rgba(0,0,0,.16); }
.btn[disabled] { opacity: .55; cursor: default; filter: grayscale(.3); }
.btn.primary { --bg: var(--blue); }
.btn.green { --bg: var(--green); }
.btn.yellow { --bg: var(--yellow); --fg: var(--ink); }
.btn.danger { --bg: var(--red); }
.btn.wa { --bg: var(--wa); --fg: #fff; }
.btn.ghost { --bg: transparent; --fg: var(--ink); box-shadow: inset 0 0 0 2px var(--rule); }
.btn.ghost:hover { background: rgba(59,125,216,.06); }
.btn.small { min-height: 36px; padding: 6px 12px; border-radius: 11px; font-size: .9rem; }
.btn.big { min-height: 56px; font-size: 1.1rem; border-radius: 18px; padding: 14px 24px; }
.btn.block { width: 100%; }
.btn.chalk { --bg: var(--board); --fg: var(--chalk); font-family: var(--hand); font-size: 1.1rem; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 2px solid var(--rule); background: #fff; border-radius: 999px; padding: 6px 13px; cursor: pointer;
  font-weight: 600; font-size: .92rem; color: var(--ink-soft);
  transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--blue); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 12px -8px var(--blue); }
.chip .count { opacity: .75; margin-left: 4px; font-weight: 500; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 700; font-size: .9rem; color: var(--ink-soft); margin-bottom: 4px; }
.field-hint { display: block; font-size: .82rem; color: var(--ink-faint); margin-top: 4px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; border: 2px solid var(--rule); background: #fff; border-radius: 12px; padding: 11px 12px; min-height: 46px;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(59,125,216,.15); }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------------ paper cards */
.card {
  position: relative; background: #fff; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(35,50,74,.06);
}
.card.tape::before {
  content: ''; position: absolute; top: -10px; left: 50%; width: 92px; height: 22px; margin-left: -46px;
  background: rgba(255,214,102,.62); transform: rotate(-3deg); border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.card.lined { background-color: #fff; background-image: repeating-linear-gradient(180deg, transparent 0 27px, #e8f0fa 27px 28px); }
.card h2, .card h3 { margin-top: 0; }
.card + .card { margin-top: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.section-title h2 { margin: 0; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ------------------------------------------------------------------ notebook covers (classes) */
.notebook {
  --c: var(--blue);
  position: relative; display: block; text-decoration: none; color: var(--ink);
  border-radius: 8px 18px 18px 8px; min-height: 196px; padding: 18px 16px 16px 40px;
  background:
    radial-gradient(circle at 12px 22px, rgba(0,0,0,.25) 0 4px, transparent 5px) 0 0 / 26px 28px repeat-y,
    linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff), var(--c));
  box-shadow: inset 6px 0 0 rgba(0,0,0,.12), var(--shadow);
  transition: transform .3s var(--spring), box-shadow .3s;
  transform: rotate(var(--tilt, 0deg));
  overflow: hidden;
}
.notebook::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 10px, transparent 10px 20px); pointer-events: none; }
.notebook:hover { transform: translateY(-4px) rotate(0deg); box-shadow: inset 6px 0 0 rgba(0,0,0,.12), var(--shadow-lift); }
.notebook:active { transform: scale(.98); }
.nb-label {
  position: relative; z-index: 1; background: #fff; border-radius: 12px; padding: 10px 12px 8px;
  border: 2px solid rgba(35,50,74,.12);
  background-image: repeating-linear-gradient(180deg, transparent 0 25px, #e3ecf7 25px 26px);
}
.nb-title { font-family: var(--hand); font-weight: 700; font-size: 1.35rem; line-height: 1.15; margin-bottom: 2px; }
.nb-sub { font-size: .86rem; color: var(--ink-soft); }
.nb-foot { position: relative; z-index: 1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.nb-badge { background: rgba(255,255,255,.9); color: var(--ink); border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.nb-badge.warn { background: #fff4d6; }
.notebook.c-red { --c: #e5533d; } .notebook.c-blue { --c: #3b7dd8; } .notebook.c-green { --c: #3fa45b; } .notebook.c-orange { --c: #f08a24; }
.notebook.c-purple { --c: #8b5cf6; } .notebook.c-teal { --c: #14a3a3; } .notebook.c-pink { --c: #ec6fa8; } .notebook.c-yellow { --c: #e2a800; }
.notebook.add { --c: #c9d6e6; display: grid; place-items: center; text-align: center; color: var(--ink-soft); }
.notebook.add .plus { font-size: 2.4rem; font-family: var(--hand); }

/* ------------------------------------------------------------------ scene */
.scene { position: relative; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: #fff3d6; aspect-ratio: 800 / 420; border: 4px solid #fff; }
.scene svg { display: block; width: 100%; height: 100%; }
.scene.small { aspect-ratio: 800 / 300; }
.sc-fan { transform-box: fill-box; transform-origin: center; animation: spin .6s linear infinite; }
.sc-sun { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }
.sc-sec { animation: spin 60s steps(60) infinite; }
.sc-min { animation: spin 3600s linear infinite; }
.sc-hr { transform: rotate(60deg); }
.sc-cloud { animation: drift 16s ease-in-out infinite alternate; }
.sc-cloud.c2 { animation-duration: 21s; animation-delay: -6s; }
.sc-bird { animation: fly 9s linear infinite; }
.sc-bird.b2 { animation-delay: -4s; animation-duration: 11s; }
.sc-head { transform-box: fill-box; transform-origin: 50% 90%; animation: bob 3.2s ease-in-out infinite; }
.sc-h1 { animation-delay: -.8s; } .sc-h2 { animation-delay: -1.6s; animation-duration: 3.8s; } .sc-h3 { animation-delay: -2.4s; animation-duration: 2.9s; }
.sc-hand { transform-box: fill-box; transform-origin: 30% 100%; animation: raise 5s ease-in-out infinite; }
.sc-flag { transform-box: fill-box; transform-origin: 50% 0; animation: sway 3s ease-in-out infinite; }
.sc-f1 { animation-delay: -1s; } .sc-f2 { animation-delay: -2s; }
.sc-plane { animation: plane 11s cubic-bezier(.45,.05,.55,.95) infinite; animation-delay: 2s; opacity: 0; }
.sc-write { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(0); animation: write 1.6s steps(28) forwards; }
.sc-wr2 { animation-delay: 1.4s; } .sc-wr3 { animation-delay: 2.5s; animation-duration: 1.2s; }
.sc-duster { animation: duster 7s ease-in-out infinite; animation-delay: 4s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(18px); } }
@keyframes fly { from { transform: translate(-60px, 10px); } to { transform: translate(170px, -16px); } }
@keyframes bob { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-2px); } }
@keyframes raise { 0%, 55%, 100% { transform: rotate(80deg) scaleY(.4); opacity: 0; } 62%, 88% { transform: rotate(0deg); opacity: 1; } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes plane { 0% { transform: translate(-60px, 300px) rotate(-14deg); opacity: 0; } 8% { opacity: 1; } 55% { transform: translate(430px, 120px) rotate(-6deg); opacity: 1; } 80% { transform: translate(860px, 60px) rotate(4deg); opacity: 1; } 81%, 100% { opacity: 0; transform: translate(900px, 60px); } }
@keyframes write { to { transform: scaleX(1); } }
@keyframes duster { 0%, 70%, 100% { transform: translateX(0); } 78% { transform: translate(-60px, -8px); } 86% { transform: translate(-20px, -4px); } }

/* ------------------------------------------------------------------ login (the notebook cover) */
.cover {
  min-height: 100vh; display: grid; align-items: start; justify-items: center; padding: 18px 14px 40px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,200,61,.35), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(59,125,216,.25), transparent 45%),
    linear-gradient(160deg, #2e6db8, #1f4f8f);
  position: relative; overflow: hidden;
}
.cover::before {
  content: '1×1=1 2×2=4 3×3=9 4×4=16 5×5=25 6×6=36 7×7=49 8×8=64 9×9=81 10×10=100 क ख ग घ A B C D 2+2=4 ★ ✏️ 📏 ✂️ 📐 🍎 ';
  position: absolute; inset: -20px; font-family: var(--hand); color: rgba(255,255,255,.07); font-size: 34px; line-height: 2.1; word-spacing: 30px;
  transform: rotate(-12deg); pointer-events: none;
}
.cover-inner { position: relative; width: 100%; max-width: 980px; display: grid; gap: 20px; }
@media (min-width: 900px) { .cover-inner { grid-template-columns: 1.25fr 1fr; align-items: center; margin-top: 4vh; } }
.cover-brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.cover-brand .brand-mark { width: 48px; height: 48px; font-size: 26px; }
.cover-brand h1 { color: #fff; margin: 0; font-size: 2.1rem; text-shadow: 2px 2px 0 rgba(0,0,0,.15); }
.cover-brand p { margin: 0; color: rgba(255,255,255,.85); }
.cover .lang-btn { margin-left: auto; }
.label-card {
  position: relative; background: #fff; border-radius: 22px; padding: 22px 22px 18px; border: 4px solid #1d3e6e;
  box-shadow: 0 0 0 6px #fff, 0 26px 50px -18px rgba(0,0,0,.55);
  animation: pop .6s var(--spring) both .15s;
}
.label-card::before { content: ''; position: absolute; inset: 8px; border: 2px dashed rgba(29,62,110,.25); border-radius: 15px; pointer-events: none; }
.label-card h2 { color: #1d3e6e; text-align: center; margin-bottom: 2px; }
.label-card .sub { text-align: center; color: var(--ink-soft); font-size: .92rem; margin-bottom: 14px; }
.label-line { display: flex; align-items: flex-end; gap: 10px; margin: 10px 0 14px; }
.label-line .ll { font-family: var(--hand); font-weight: 700; color: #1d3e6e; white-space: nowrap; font-size: 1.1rem; padding-bottom: 6px; }
.label-line input { border: 0 !important; border-bottom: 2px dotted #1d3e6e !important; border-radius: 0 !important; padding: 6px 4px !important; font-family: var(--hand); font-size: 1.35rem !important; background: transparent !important; box-shadow: none !important; min-height: 40px; letter-spacing: 1px; }
.label-line input:focus { border-bottom-style: solid !important; border-bottom-color: var(--blue) !important; }
/* a narrow phone: the number gets the whole line under its label, so the hint fits */
@media (max-width: 440px) {
  .label-line.phone { flex-wrap: wrap; gap: 0 10px; }
  .label-line.phone .ll { flex: 1 0 100%; padding-bottom: 0; }
  .label-line.phone input::placeholder { font-size: 1.1rem; }
}
.cover-links { text-align: center; margin: 2px 0 0; font-size: .92rem; color: rgba(255,255,255,.85); }
.cover-links a { color: #fff; font-weight: 600; text-underline-offset: 3px; }
.cover-notice { background: #e2f6e7; color: #23793e; border-radius: 14px; padding: 10px 14px; font-weight: 700; margin: 0; box-shadow: var(--shadow); }
.otp { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.otp input { width: 46px !important; height: 56px; text-align: center; font-size: 1.6rem !important; font-family: var(--hand); font-weight: 700; padding: 0 !important; border-radius: 12px !important; }
.label-card .note { font-size: .82rem; color: var(--ink-faint); text-align: center; margin-top: 12px; }
.label-card .err { color: var(--red); text-align: center; font-weight: 600; min-height: 1.4em; margin: 6px 0 0; }
.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ------------------------------------------------------------------ home */
.hero { display: grid; gap: 16px; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.5fr 1fr; align-items: stretch; } }
.hello { font-family: var(--hand); font-size: 1.15rem; color: var(--ink-soft); margin: 0; }
.today-card { display: flex; flex-direction: column; justify-content: space-between; }
.today-date { font-family: var(--hand); font-size: 1.6rem; font-weight: 700; color: var(--board); line-height: 1.1; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick button {
  --c: var(--blue);
  border: 0; border-radius: 18px; padding: 14px 12px; text-align: left; cursor: pointer; color: var(--ink);
  background: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .25s var(--spring), box-shadow .25s; min-height: 96px;
  border-bottom: 5px solid var(--c);
}
.quick button:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: var(--shadow-lift); }
.quick button:active { transform: scale(.97); }
.quick .q-emoji { font-size: 1.8rem; display: block; line-height: 1; margin-bottom: 6px; }
.quick .q-title { font-weight: 800; display: block; }
.quick .q-sub { font-size: .8rem; color: var(--ink-soft); }
.wa-card { background: linear-gradient(135deg, #e7fbe9, #fff); border-left: 6px solid var(--wa); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px dashed var(--rule); cursor: pointer; border-radius: 10px; transition: background .15s; }
.feed li:hover { background: rgba(59,125,216,.05); }
.feed .f-emoji { font-size: 1.4rem; width: 36px; height: 36px; display: grid; place-items: center; background: var(--paper-2); border-radius: 10px; flex: none; }
.feed .f-text { min-width: 0; flex: 1; }
.feed .f-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .f-sub { font-size: .86rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed .f-time { font-size: .78rem; color: var(--ink-faint); white-space: nowrap; }
.banner { border-radius: 14px; padding: 12px 14px; background: #fff4d6; border: 2px dashed #f0c64a; display: flex; gap: 10px; align-items: center; cursor: pointer; }

/* ------------------------------------------------------------------ page header (chalkboard strip) */
.pagehead {
  position: relative; border-radius: 18px; padding: 16px 16px 14px; margin-bottom: 14px; color: var(--chalk);
  background: linear-gradient(160deg, var(--board-2), var(--board)); border: 6px solid var(--wood); box-shadow: inset 0 0 0 2px var(--wood-dark), var(--shadow);
}
.pagehead h1 { color: var(--chalk); margin: 0; font-size: 1.7rem; text-shadow: 0 0 1px rgba(255,255,255,.5); }
.pagehead .ph-sub { color: rgba(247,245,238,.82); font-size: .92rem; }
.pagehead .ph-row { display: flex; gap: 10px; align-items: center; }
.pagehead .icon-btn { color: var(--chalk); }
.pagehead .btn.ghost { --fg: var(--chalk); box-shadow: inset 0 0 0 2px rgba(247,245,238,.4); }
.pagehead.c-red { --board: #7a2a20; --board-2: #94372a; } .pagehead.c-blue { --board: #1d4479; --board-2: #275897; }
.pagehead.c-green { --board: #1f4d3a; --board-2: #2a6049; } .pagehead.c-orange { --board: #7a4210; --board-2: #95561a; }
.pagehead.c-purple { --board: #44297a; --board-2: #573694; } .pagehead.c-teal { --board: #0f5555; --board-2: #166b6b; }
.pagehead.c-pink { --board: #7a2550; --board-2: #943163; } .pagehead.c-yellow { --board: #6b5000; --board-2: #846300; }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.stat-chip { background: rgba(255,255,255,.14); border: 1.5px solid rgba(247,245,238,.35); color: var(--chalk); border-radius: 999px; padding: 3px 11px; font-size: .84rem; font-weight: 600; }

/* ------------------------------------------------------------------ tabs (notebook dividers) */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 4px 0 14px; padding: 4px 2px 0; border-bottom: 3px solid var(--rule); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  --c: var(--blue);
  border: 0; background: var(--paper-2); color: var(--ink-soft); padding: 9px 15px 8px; border-radius: 14px 14px 0 0; cursor: pointer;
  font-weight: 700; white-space: nowrap; position: relative; top: 3px; border-bottom: 3px solid transparent;
  transition: background .2s, color .2s, transform .25s var(--spring);
}
.tab:hover { transform: translateY(-2px); }
.tab.on { background: #fff; color: var(--ink); border-bottom-color: #fff; box-shadow: 0 -3px 0 var(--c) inset, 0 -8px 16px -12px rgba(0,0,0,.3); }
.tab:nth-child(5n+1) { --c: var(--blue); } .tab:nth-child(5n+2) { --c: var(--green); } .tab:nth-child(5n+3) { --c: var(--orange); }
.tab:nth-child(5n+4) { --c: var(--purple); } .tab:nth-child(5n+5) { --c: var(--red); }
.tab-panel { animation: viewIn .32s var(--ease) both; }

/* ------------------------------------------------------------------ student rows (register) */
.register { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.register li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #edf2f9; cursor: pointer; transition: background .15s; position: relative; }
.register li:last-child { border-bottom: 0; }
.register li:hover { background: #f6f9fe; }
.register li::before { content: ''; position: absolute; left: 52px; top: 0; bottom: 0; width: 2px; background: var(--margin); opacity: .5; }
.roll { width: 34px; flex: none; text-align: center; font-family: var(--hand); font-weight: 700; font-size: 1.1rem; color: var(--ink-soft); }
.avatar { border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 800; flex: none; object-fit: cover; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.15); }
.name-block { display: flex; flex-direction: column; min-width: 0; }
.name-block .n1 { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-block .n2 { font-size: .84rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-meta { font-size: .8rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.pill.P { background: #e2f6e7; color: #23793e; } .pill.A { background: #fde4df; color: #b33522; } .pill.L { background: #fff1d6; color: #9a5c00; } .pill.H { background: #e9e4ff; color: #5b3cc4; }
.pill.gray { background: #eef2f7; color: var(--ink-soft); } .pill.blue { background: #e2edfb; color: #1f5fb8; } .pill.green { background: #e2f6e7; color: #23793e; } .pill.red { background: #fde4df; color: #b33522; } .pill.yellow { background: #fff1d6; color: #9a5c00; }
.att-bar { width: 54px; height: 7px; border-radius: 9px; background: #eef2f7; overflow: hidden; flex: none; }
.att-bar i { display: block; height: 100%; border-radius: 9px; background: var(--green); transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }

/* ------------------------------------------------------------------ attendance */
.att-today { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.att-kid {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; border: 2px solid var(--rule); background: #fff; cursor: pointer;
  transition: transform .25s var(--spring), background .2s, border-color .2s; user-select: none; text-align: left; width: 100%;
}
.att-kid:active { transform: scale(.95); }
.att-kid .flip { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-family: var(--hand); font-size: 1.2rem; background: #eef2f7; color: var(--ink-faint); flex: none; transition: transform .35s var(--spring), background .2s; }
.att-kid.P { border-color: #a6dfb5; background: #f1fbf3; } .att-kid.P .flip { background: var(--green); color: #fff; }
.att-kid.A { border-color: #f5b3a8; background: #fff3f1; } .att-kid.A .flip { background: var(--red); color: #fff; }
.att-kid.L { border-color: #f6d488; background: #fffaf0; } .att-kid.L .flip { background: var(--orange); color: #fff; }
.att-kid.H .flip { background: var(--purple); color: #fff; }
.att-kid.flipping .flip { transform: rotateY(180deg) scale(1.1); }
.att-kid .nm { font-weight: 700; font-size: .92rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.att-kid .rl { font-size: .75rem; color: var(--ink-faint); }
.att-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.att-tools input[type=date] { width: auto !important; min-height: 40px; padding: 6px 10px; }
.grid-wrap { overflow: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; }
table.reg { border-collapse: separate; border-spacing: 0; font-size: .86rem; }
table.reg th, table.reg td { border-bottom: 1px solid #edf2f9; border-right: 1px solid #f3f6fb; padding: 0; text-align: center; min-width: 32px; height: 34px; }
table.reg th { position: sticky; top: 0; background: #f7faff; z-index: 2; font-weight: 700; color: var(--ink-soft); padding: 4px 2px; }
table.reg th.today { background: #fff4d6; color: var(--ink); }
table.reg .sticky { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; padding: 0 10px; min-width: 150px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
table.reg th.sticky { z-index: 3; background: #f7faff; }
table.reg td.cell { cursor: pointer; font-weight: 800; transition: background .15s; }
table.reg td.cell:hover { background: #eef5ff; }
table.reg td.P { color: var(--green); } table.reg td.A { color: var(--red); background: #fff3f1; } table.reg td.L { color: var(--orange); } table.reg td.H { color: var(--purple); background: #f6f3ff; }
table.reg td.hol { background: repeating-linear-gradient(45deg, #f6f3ff 0 6px, #fff 6px 12px); }
table.reg td.sun, table.reg th.sun { background: #fafafa; color: #b0b8c6; }
table.reg td.unsure { outline: 2px dashed var(--orange); outline-offset: -3px; }
table.reg td.pct { font-weight: 700; color: var(--ink-soft); min-width: 52px; }

/* ------------------------------------------------------------------ marks */
.test-card { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: transform .2s var(--spring); }
.test-card:hover { transform: translateY(-2px); }
.test-badge { width: 54px; height: 54px; border-radius: 14px; background: var(--paper-2); display: grid; place-items: center; font-family: var(--hand); font-weight: 700; font-size: 1.1rem; color: var(--board); flex: none; border: 2px dashed var(--rule); }
.marks-list { list-style: none; padding: 0; margin: 0; }
.marks-list li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--rule); }
.marks-list input.mk { width: 86px !important; text-align: center; font-weight: 800; font-size: 1.1rem; min-height: 42px; padding: 6px !important; }
.marks-list label.ab { display: flex; gap: 4px; align-items: center; font-size: .82rem; color: var(--ink-soft); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 4px 0; border-bottom: 2px solid var(--rule); }
.bars .bar { flex: 1; min-width: 14px; border-radius: 8px 8px 0 0; background: var(--blue); transform-origin: bottom; animation: rise .7s var(--spring) both; position: relative; }
.bars .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
@keyframes rise { from { transform: scaleY(0); } }
.bar-labels { display: flex; gap: 6px; padding: 4px; }
.bar-labels span { flex: 1; min-width: 14px; font-size: .68rem; text-align: center; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a big class's marks: the chart scrolls sideways; a faded edge + a hint say there is more */
.chart-scroll { overflow-x: auto; overflow-y: hidden; padding-top: 18px; overscroll-behavior-x: contain; scrollbar-width: thin; }
.chart-scroll.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.chart-scroll.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
.chart-scroll.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 40px), transparent); }
.chart-hint { margin: 6px 0 0; text-align: right; font-weight: 600; }

/* ------------------------------------------------------------------ student page */
.idcard {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
  background: #fff; border-radius: 20px; padding: 0 16px 16px; box-shadow: var(--shadow); overflow: hidden;
}
/* the card's band (its first grid row) in the class's colour, with the school · class written on it */
.idcard::before { content: attr(data-school); grid-column: 1 / -1; margin: 0 -16px; padding: 6px 16px;
  background: var(--c, var(--blue)); color: #fff; font-weight: 800; font-size: .76rem; line-height: 1.35; letter-spacing: 1px;
  text-transform: uppercase; overflow-wrap: break-word; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.idcard .photo { position: relative; cursor: pointer; }
.idcard .photo .cam { position: absolute; right: -4px; bottom: -4px; background: var(--yellow); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.idcard h1 { margin: 0; font-size: 1.6rem; }
.idcard .id-sub { color: var(--ink-soft); font-size: .92rem; }
.idcard .id-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ring-c, var(--green)) calc(var(--p) * 1%), #eef2f7 0); position: relative; transition: --p 1s; }
.ring::before { content: ''; position: absolute; inset: 9px; background: #fff; border-radius: 50%; }
.ring b { position: relative; font-family: var(--hand); font-size: 1.35rem; }
.stats-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.contact { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.contact:last-child { border-bottom: 0; }
.contact .rel { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-faint); }
.contact .ph { font-weight: 700; font-size: 1.05rem; letter-spacing: .4px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; color: #fff; text-decoration: none; transition: transform .2s var(--spring); flex: none; }
.round-btn:active { transform: scale(.88); }
.round-btn.call { background: var(--blue); } .round-btn.wa { background: var(--wa); } .round-btn.gray { background: #eef2f7; color: var(--ink-soft); }
.masked { font-family: ui-monospace, monospace; letter-spacing: 1px; }

/* timeline */
.composer { display: grid; gap: 10px; }
.composer textarea { min-height: 70px; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 19px; top: 6px; bottom: 6px; width: 3px; background: repeating-linear-gradient(180deg, var(--rule) 0 6px, transparent 6px 12px); }
.timeline > li { position: relative; padding: 0 0 14px 52px; }
.tl-dot { position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; font-size: 1.2rem; }
.tl-card { background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); border-left: 4px solid var(--c, var(--rule)); }
.tl-card.positive { --c: var(--green); } .tl-card.concern { --c: var(--red); } .tl-card.neutral { --c: var(--blue); }
.tl-card.call { --c: var(--teal); } .tl-card.sms { --c: var(--purple); }
.tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); margin-bottom: 4px; }
.tl-text { white-space: pre-wrap; word-break: break-word; }
.tl-actions { display: flex; gap: 4px; margin-left: auto; }
/* a note's head: kind + time wrap on the left, the pin / edit / delete buttons stay top right */
.tl-head.split { flex-wrap: nowrap; align-items: flex-start; }
.tl-meta { display: flex; gap: 2px 8px; align-items: center; flex-wrap: wrap; min-width: 0; flex: 1 1 auto; padding-top: 5px; }
.tl-head.split .tl-actions { flex: none; gap: 0; margin: -2px -6px 0 0; }
.tl-actions .icon-btn { width: 32px; height: 32px; }
.tl-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tl-photos img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
details.more > summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: .88rem; list-style: none; margin-top: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
.transcript { white-space: pre-wrap; font-size: .9rem; background: var(--paper-2); border-radius: 10px; padding: 10px; max-height: 320px; overflow: auto; margin-top: 6px; }

/* bilingual AI blocks */
.bi { display: grid; gap: 10px; }
@media (min-width: 760px) { .bi { grid-template-columns: 1fr 1fr; } }
.bi-col { background: var(--paper-2); border-radius: 12px; padding: 10px 12px; position: relative; }
.bi-col[lang=hi] { background: #f3f8f0; }
.bi-tag { position: absolute; top: -9px; right: 10px; background: var(--board); color: var(--chalk); font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; letter-spacing: .4px; }
.bi-col p { margin: 0; }
.bi-col ul { margin: 0; padding-left: 18px; }
.bi-col li { margin: 2px 0; }
.ai-sec + .ai-sec { margin-top: 14px; }
.ai-sec h3 { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; margin-bottom: 8px; }
.ai-card { border: 2px solid #d9c8ff; background: linear-gradient(180deg, #faf7ff, #fff 120px); }
.ai-card .ai-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-card .ai-head h2 { margin: 0; }
.stale { background: #fff4d6; border-radius: 10px; padding: 8px 10px; font-size: .88rem; margin-bottom: 10px; }
.thinking { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------------ sheets, toasts, loaders */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20,30,48,0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s var(--ease); }
.sheet-wrap.open { background: rgba(20,30,48,.42); }
.sheet {
  width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column; background: var(--paper);
  border-radius: 24px 24px 0 0; box-shadow: 0 -20px 40px -20px rgba(0,0,0,.5); transform: translateY(100%); transition: transform .32s var(--ease);
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(214,230,246,.6) 31px 32px);
}
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.closing { background: rgba(20,30,48,0); }
.sheet-wrap.closing .sheet { transform: translateY(100%); }
@media (min-width: 820px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; transform: translateY(24px) scale(.97); opacity: 0; transition: transform .3s var(--spring), opacity .2s; }
  .sheet.wide { max-width: 1040px; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-wrap.closing .sheet { opacity: 0; transform: translateY(16px) scale(.98); }
}
.sheet-grip { width: 46px; height: 5px; border-radius: 5px; background: #cfd9e6; margin: 8px auto 0; }
@media (min-width: 820px) { .sheet-grip { display: none; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px 18px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1.35rem; }
.sheet-body { overflow: auto; padding: 4px 18px calc(20px + env(safe-area-inset-bottom)); }
.confirm p { font-size: 1.05rem; }
.confirm .err { color: var(--red); font-weight: 600; min-height: 1.2em; margin: 4px 0; }
.danger-zone { border: 2px dashed #f5b3a8; }
.danger-zone h2 { color: #b33522; }
.btn.danger-text { --fg: #b33522; box-shadow: inset 0 0 0 2px #f5b3a8; }
.delete-list { margin: 0 0 12px; padding-left: 22px; }
.delete-list li { margin: 3px 0; }
.warn-text { color: #9a2b1b; font-weight: 600; }
input.confirm-digits { max-width: 170px; font-size: 1.4rem; letter-spacing: 8px; text-align: center; font-weight: 800; }

#toasts { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 14px; box-shadow: 0 12px 26px -10px rgba(0,0,0,.5); display: flex; align-items: center; gap: 10px; animation: toastIn .35s var(--spring) both; font-weight: 600; }
.toast.err { background: #b33522; }
.toast.ok::before { content: '✓'; color: #7ee49b; font-weight: 900; }
.toast.out { animation: toastOut .35s var(--ease) both; }
.toast-act { margin-left: auto; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 9px; padding: 5px 10px; cursor: pointer; font-weight: 700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

.loader { display: grid; place-items: center; gap: 6px; padding: 26px 10px; color: var(--ink-soft); text-align: center; }
.pencil-loader .scribble { stroke-dasharray: 260; stroke-dashoffset: 260; animation: scribble 1.8s ease-in-out infinite; }
.pencil-loader .pencil { offset-path: path('M5 25 C 20 5, 30 35, 45 18 S 70 5, 80 25 S 105 35, 115 15'); offset-rotate: 0deg; animation: pencil 1.8s ease-in-out infinite; }
@keyframes scribble { 0% { stroke-dashoffset: 260; } 60% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -260; } }
@keyframes pencil { 0% { offset-distance: 0%; } 60%, 100% { offset-distance: 100%; } }
.skel { background: linear-gradient(90deg, #eef2f7 0%, #f8fafd 50%, #eef2f7 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; min-height: 64px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 26px 12px; color: var(--ink-soft); }
.empty-art { font-size: 2.6rem; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px) rotate(-4deg); } }
.burst { position: fixed; z-index: 90; pointer-events: none; }
.burst span { position: absolute; font-size: 22px; font-weight: 900; animation: burst 1.1s var(--ease) forwards; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(.3); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)) scale(1); opacity: 0; } }

/* ------------------------------------------------------------------ import */
.dropzone {
  border: 3px dashed #9fbde4; border-radius: 22px; padding: 22px 16px; text-align: center; background: rgba(255,255,255,.75);
  transition: background .2s, border-color .2s, transform .25s var(--spring);
}
.dropzone.drag { background: #eef5ff; border-color: var(--blue); transform: scale(1.01); }
.dropzone .dz-art { font-size: 2.4rem; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.thumb { position: relative; width: 88px; height: 88px; border-radius: 14px; overflow: hidden; background: #eef2f7; box-shadow: var(--shadow); animation: pop .4s var(--spring) both; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; font-size: 14px; }
.thumb .prog { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--green); transition: width .2s; }
.thumb .doc { display: grid; place-items: center; height: 100%; font-size: .75rem; padding: 6px; text-align: center; word-break: break-all; }
.reading { text-align: center; padding: 18px 8px; }
.reading .paper { width: 150px; height: 180px; margin: 6px auto 12px; background: #fff; border-radius: 6px; box-shadow: var(--shadow); position: relative; overflow: hidden; background-image: repeating-linear-gradient(180deg, transparent 0 17px, #dbe7f5 17px 18px); }
.reading .paper::after { content: '🔍'; position: absolute; font-size: 42px; animation: magnify 3s ease-in-out infinite; }
.reading .paper .scan { position: absolute; left: 0; right: 0; height: 26px; background: linear-gradient(180deg, transparent, rgba(255,200,61,.45), transparent); animation: scan 2.2s ease-in-out infinite; }
@keyframes magnify { 0% { transform: translate(10px, 20px); } 25% { transform: translate(90px, 40px); } 50% { transform: translate(30px, 100px); } 75% { transform: translate(85px, 120px); } 100% { transform: translate(10px, 20px); } }
@keyframes scan { 0% { top: -26px; } 100% { top: 180px; } }
.op { border-radius: 16px; background: #fff; box-shadow: var(--shadow); padding: 12px 14px; border-left: 6px solid var(--c, var(--blue)); }
.op + .op { margin-top: 12px; }
.op.check { --c: var(--orange); }
.op.skip { opacity: .55; }
.op-head { display: flex; align-items: center; gap: 10px; }
.op-head .op-title { font-weight: 800; flex: 1; min-width: 0; }
.op-why { font-size: .84rem; color: #9a5c00; background: #fff4d6; border-radius: 8px; padding: 3px 8px; display: inline-block; margin-top: 6px; }
.op-body { margin-top: 10px; }
.op .chg { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 10px; font-size: .92rem; }
.op .chg dt { color: var(--ink-soft); font-weight: 600; padding-top: 10px; }
.op .chg dd { margin: 0; }
.op .chg .old { font-size: .78rem; color: var(--ink-faint); text-decoration: line-through; }
.row-pick { min-width: 170px; max-width: 240px; font-size: .86rem; min-height: 34px !important; padding: 4px 6px !important; }
.unmatched { background: #fff8e6; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.photo-strip img { height: 160px; border-radius: 12px; cursor: zoom-in; box-shadow: var(--shadow); }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(10,15,25,.9); display: grid; place-items: center; animation: viewIn .25s var(--ease); }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px; touch-action: pinch-zoom; }

/* ------------------------------------------------------------------ search */
.search-page .searchbox { position: sticky; top: calc(var(--top-h) + 10px); z-index: 5; }
.searchbox { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 18px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow); border: 2px solid var(--rule); }
.searchbox:focus-within { border-color: var(--blue); }
.searchbox input { border: 0 !important; box-shadow: none !important; padding: 8px 0 !important; font-size: 1.08rem; min-height: 44px; }
.results { list-style: none; padding: 0; margin: 0; }
.results li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s var(--spring); }
.results li + li { margin-top: 10px; }
.results li:hover { transform: translateX(3px); }
.results .r-icon { font-size: 1.4rem; width: 40px; height: 40px; display: grid; place-items: center; background: var(--paper-2); border-radius: 12px; flex: none; }
.results .r-title { font-weight: 800; }
.results .r-sub { font-size: .84rem; color: var(--ink-soft); }
.results .r-match { font-size: .86rem; margin-top: 4px; color: var(--ink); }
.results .r-match b { color: var(--ink-faint); font-weight: 600; }
mark { background: #fff0a8; color: inherit; border-radius: 4px; padding: 0 2px; }

/* ------------------------------------------------------------------ whatsapp */
.wa-hero { background: linear-gradient(135deg, #075e54, #128c7e); color: #fff; border-radius: 22px; padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.wa-hero h1 { color: #fff; }
.wa-hero::after { content: '💬'; position: absolute; right: -10px; bottom: -24px; font-size: 120px; opacity: .14; transform: rotate(-12deg); }
.wa-hero .btn.ghost { --fg: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.bubble { background: #dcf8c6; border-radius: 14px 14px 14px 4px; padding: 10px 12px; white-space: pre-wrap; font-size: .92rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); max-height: 260px; overflow: auto; }
.bubble.in { background: #fff; border-radius: 14px 14px 4px 14px; }
.q-card { border-left: 6px solid var(--orange); }
.q-opts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.q-opts label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--rule); cursor: pointer; background: #fff; }
.q-opts label:has(input:checked) { border-color: var(--blue); background: #eef5ff; }

/* ------------------------------------------------------------------ misc */
.kbd { font-family: ui-monospace, monospace; background: #eef2f7; border-radius: 6px; padding: 1px 6px; font-size: .85em; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid #edf2f9; text-align: left; vertical-align: top; }
.admin-table th { background: #f7faff; font-weight: 700; color: var(--ink-soft); }
.table-scroll { overflow-x: auto; }
.update-bar { position: fixed; top: calc(var(--top-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 70; background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 8px 8px 8px 16px; display: flex; gap: 10px; align-items: center; font-weight: 700; box-shadow: var(--shadow-lift); animation: toastIn .4s var(--spring) both; }
.offline-bar { background: #fff4d6; color: #7a5200; text-align: center; font-size: .86rem; padding: 6px; font-weight: 600; }
.chalk-title { font-family: var(--hand); color: var(--board); }
.divider { border: 0; border-top: 2px dashed var(--rule); margin: 18px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; background: #fff; padding: 6px 6px 8px; border-radius: 6px; box-shadow: var(--shadow); transform: rotate(var(--tilt, 0deg)); transition: transform .25s var(--spring); cursor: zoom-in; }
.photo-grid figure:hover { transform: rotate(0deg) scale(1.03); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.photo-grid figcaption { font-size: .76rem; color: var(--ink-soft); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--hand); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .sc-write { transform: none; }
  .sc-plane { display: none; }
}
@media print {
  .topbar, .bottomnav, .tabs, .btn, .icon-btn { display: none !important; }
  body { background: #fff; }
  main#view { padding: 0; }
}
