/* NAALAI demo app: teacher, parent, student views. */
.app-page { --accent: var(--blue); --accent-soft: var(--blue-soft); background: var(--app-bg); }
.app-page[data-role="parent"] { --accent: #d9542f; --accent-soft: var(--coral-soft); }
.app-page[data-role="student"] { --accent: var(--lilac); --accent-soft: var(--lilac-soft); }

.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; font-weight: 800; color: var(--ink-2); }
.boot img { animation: float 2s ease-in-out infinite; }

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.side .brand { padding: 0 8px; font-size: 23px; }
.side-school { padding: 2px 10px 14px; font-size: 13px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-nav { display: grid; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 15px; color: var(--ink-2); transition: background .15s, color .15s; }
.nav-item svg { width: 21px; height: 21px; flex: none; }
.nav-item:hover { background: var(--muted-bg); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 900; display: grid; place-items: center; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--muted-bg); }
.side-user-text { min-width: 0; flex: 1; }
.side-user strong { display: block; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { font-size: 12px; color: var(--ink-3); font-weight: 700; text-transform: capitalize; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 15px; border: 0; }
.avatar-btn { cursor: pointer; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--muted-bg); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 28px; background: rgba(251, 248, 242, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand-mobile { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-pill { font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--sun-soft); color: #7a5200; }
.kids { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.kid-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.kid-chip .avatar { width: 28px; height: 28px; font-size: 13px; }
.kid-chip small { font-weight: 700; color: var(--ink-3); }
.kid-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.kid-chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .7); }

.banner-slot:empty { display: none; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 28px; font-weight: 700; font-size: 14.5px; }
.banner svg { width: 20px; height: 20px; flex: none; }
.banner .btn { margin-left: auto; }
.banner-trial { background: var(--sun-soft); color: #6b4800; }
.banner-locked { background: var(--red-soft); color: #8f2323; }

.view { width: 100%; max-width: 1080px; padding: 28px 28px 110px; outline: none; }
.view > * { animation: view-in .35s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; }
.page-head p { margin-top: 6px; color: var(--ink-2); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-weight: 800; font-size: 14.5px; text-decoration: none; color: var(--ink-2); }
.back-link:hover { color: var(--ink); }
.back-link svg { width: 18px; height: 18px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.stat b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1.1; letter-spacing: -.03em; }
.stat span { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.block + .block { margin-top: 20px; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.block-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.block-head a { font-size: 14px; font-weight: 800; color: var(--accent); text-decoration: none; }
.section-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 17px; font-weight: 800; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.section-title svg { width: 20px; height: 20px; color: var(--accent); }
.section-title .count { font-family: var(--font-body); font-size: 13px; color: var(--ink-3); font-weight: 800; }

.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.class-card { display: block; text-decoration: none; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .15s, transform .2s var(--spring); }
.class-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.class-card b { display: block; font-family: var(--font-display); font-size: 20px; }
.class-card small { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.class-card .tag { margin-top: 8px; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: start; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
a.item, button.item { text-decoration: none; text-align: left; width: 100%; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
a.item:hover, button.item:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.item-main { min-width: 0; }
.item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.item h3 { font-family: var(--font-body); font-size: 16px; font-weight: 800; letter-spacing: 0; line-height: 1.3; overflow-wrap: anywhere; }
.item p { font-size: 14px; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; color: var(--ink-3); font-weight: 700; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { width: 15px; height: 15px; }
.due-soon { color: #b8431f; }
.sec-chip { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 8px; background: var(--muted-bg); color: var(--ink-2); }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.cancelled { opacity: .55; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-none { background: var(--muted-bg); color: var(--ink-3); }
.s-submitted { background: var(--sky-soft); color: #17639f; }
.s-review { background: var(--lilac-soft); color: #5436c4; }
.s-returned { background: var(--sun-soft); color: #7a5200; }
.s-reviewed { background: var(--mint-soft); color: #1b7543; }
.s-accepted { background: var(--mint); color: #fff; }
.s-done { background: var(--muted-bg); color: #3e4458; }

.tick-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 800; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.tick-btn .tick { width: 20px; height: 20px; margin: 0; border-radius: 6px; }
.tick-btn[aria-pressed="true"] { background: var(--mint-soft); border-color: #bfe8cf; color: #1b7543; }
.tick-btn[aria-pressed="true"] .tick { background: var(--mint); border-color: var(--mint); }
.tick-btn[aria-pressed="true"] .tick svg { transform: none; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 36px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1.5px dashed var(--line-2); }
.empty img { width: 84px; height: auto; }
.empty strong { font-family: var(--font-display); font-size: 19px; }
.empty p { color: var(--ink-2); font-size: 15px; max-width: 32em; }

.urgent-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--red-soft); color: #7d1f1f; margin-bottom: 16px; }
.urgent-card svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.urgent-card strong { display: block; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--muted-bg); margin-bottom: 18px; flex-wrap: wrap; }
.tab { text-decoration: none; border: 0; background: none; padding: 8px 14px; border-radius: 10px; font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* forms */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 28px); display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chip-group .chip small { opacity: .7; font-weight: 700; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--muted-bg); }
.switch-row p { font-size: 13.5px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.switch-row strong { font-size: 15px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -10px var(--accent); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-danger { background: var(--red); color: #fff; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); font-weight: 800; font-size: 14px; }

.preview { border: 2px solid var(--accent-soft); border-radius: var(--r-lg); padding: 18px; background: var(--paper); }
.preview-label { font-size: 12px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.audience-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.audience-list li { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); font-weight: 800; }
.audience-total { font-weight: 800; margin-top: 8px; }
.confirm-check { display: flex; gap: 10px; align-items: center; font-weight: 700; cursor: pointer; }
.confirm-check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* submission */
.tracker { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.tracker li { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--ink-3); }
.tracker li::before { content: ""; position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 3px solid var(--line-2); }
.tracker li::after { content: ""; position: absolute; top: 10px; left: 50%; width: 100%; height: 3px; background: var(--line-2); }
.tracker li:last-child::after { display: none; }
.tracker li.on { color: var(--ink); }
.tracker li.on::before { background: var(--accent); border-color: var(--accent); }
.tracker li.on::after { background: var(--accent); }
.tracker li.warn::before { background: var(--sun); border-color: var(--sun); }
.feedback { padding: 14px 16px; border-radius: 14px; background: var(--sun-soft); }
.feedback.good { background: var(--mint-soft); }
.feedback strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.drop { position: relative; display: grid; justify-items: center; gap: 6px; padding: 26px 16px; border-radius: 18px; border: 2px dashed var(--line-2); background: var(--muted-bg); text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 30px; height: 30px; color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop strong { font-size: 15.5px; }
.drop small { color: var(--ink-3); font-weight: 600; font-size: 13px; }
.drop:focus-within { outline: 3px solid var(--blue-2); outline-offset: 2px; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--muted-bg); font-weight: 700; font-size: 14px; }
.files li svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.files li span { min-width: 0; overflow-wrap: anywhere; }
.files li small { margin-left: auto; color: var(--ink-3); white-space: nowrap; }
.files li.bad { background: var(--red-soft); color: #8f2323; }

/* student flavour */
.hello { position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: var(--r-lg); background: linear-gradient(135deg, #efe8ff, #fff3cf); margin-bottom: 20px; }
.hello img { width: 86px; height: auto; flex: none; }
.hello h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; }
.hello p { color: var(--ink-2); font-weight: 600; margin-top: 4px; }
.hello .ring { margin-left: auto; width: 64px; height: 64px; }
.hello .ring span { font-size: 14px; }
.app-page[data-role="student"] .item { border-radius: 20px; padding: 16px 18px; }
.app-page[data-role="student"] .item h3 { font-size: 17px; }

.lock-screen { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 44px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.lock-screen .lock-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.lock-screen .lock-icon svg { width: 30px; height: 30px; }
.lock-screen h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.lock-screen p { color: var(--ink-2); max-width: 34em; }
.plan-box { display: grid; gap: 14px; }
.plan-price { font-family: var(--font-display); font-size: 40px; font-weight: 800; letter-spacing: -.04em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { color: var(--ink-3); font-weight: 700; }
.kv dd { margin: 0; font-weight: 800; }
.help-list { display: grid; gap: 10px; }
.help-list details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.help-list summary { cursor: pointer; padding: 14px 0; font-weight: 800; }
.help-list details p { padding-bottom: 14px; color: var(--ink-2); }

/* files: cards, inline preview, viewer */
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.stack > .block + .block { margin-top: 0; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.fgrid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fgrid:empty { display: none; }
.fcard { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-radius: 16px; background: var(--muted-bg); border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.fcard:hover { border-color: var(--line-2); background: var(--paper); }
.fcard-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.fthumb { position: relative; flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--paper) center / cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.fthumb.has-img .fbadge { display: none; }
.fbadge { font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; padding: 2px 5px; border-radius: 6px; background: var(--ink); color: var(--on-ink); }
.fcard[data-kind="pdf"] .fbadge { background: #d64545; }
.fcard[data-kind="word"] .fbadge { background: #2b5fbf; }
.fcard[data-kind="sheet"] .fbadge { background: #1f8a4c; }
.fcard[data-kind="slides"] .fbadge { background: #d9742f; }
.fcard[data-kind="link"] .fbadge { background: var(--lilac); }
.fcard-text { min-width: 0; display: grid; }
.fcard-text strong { font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard-text small { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.fcard-err { flex-basis: 100%; font-size: 12.5px; font-weight: 800; color: #a52a2a; padding: 0 4px 2px; }
.fcard:has(.fcard-err) { background: var(--red-soft); border-color: #f3c4c4; }
.drop-sm { padding: 18px 14px; }
.cam-btn { position: relative; justify-self: start; overflow: hidden; }
.cam-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cam-btn svg { width: 18px; height: 18px; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row .input { flex: 1; min-width: 0; }
.pv-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pv-tabs button { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1.5px solid var(--line-2); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; cursor: pointer; }
.pv-tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.pv-inline { position: relative; min-height: 220px; border-radius: 16px; background: var(--muted-bg); overflow: hidden; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pv-actions svg { width: 16px; height: 16px; }
.pv-loading, .pv-empty { display: grid; place-items: center; gap: 8px; min-height: 220px; padding: 20px; text-align: center; color: var(--ink-2); font-weight: 700; }
.pv-loading { grid-auto-flow: column; justify-content: center; }
.pv-empty strong { display: block; color: var(--ink); }
.pv-pdfpages { display: grid; gap: 12px; justify-items: center; padding: 12px; max-height: 62vh; overflow: auto; }
.pv-page { width: 100%; max-width: 900px; height: auto; background: #fff; border-radius: 4px; box-shadow: var(--shadow-1); }
.viewer-body .pv-pdfpages { max-height: none; }
.pv-image { display: grid; place-items: center; padding: 12px; }
.pv-image img { max-width: 100%; max-height: 70vh; border-radius: 10px; box-shadow: var(--shadow-1); background: #fff; }
.pv-frame { display: block; width: 100%; height: 62vh; min-height: 360px; border: 0; background: #fff; }
.pv-table-wrap { overflow: auto; max-height: 62vh; background: #fff; }
.pv-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.pv-table th, .pv-table td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
.pv-table th { position: sticky; top: 0; background: var(--muted-bg); font-weight: 900; }
.pv-table tr:nth-child(even) td { background: var(--muted-bg); }
.pv-note { padding: 8px 12px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.pv-link { display: grid; gap: 10px; padding: 10px; }
.pv-link-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--paper); border-radius: 14px; padding: 10px 12px; }
.pv-link-text { flex: 1; min-width: 0; display: grid; }
.pv-link-text small { color: var(--ink-3); font-weight: 600; overflow-wrap: anywhere; }
.pv-badge { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; background: var(--lilac-soft); color: #5436c4; }
.pv-frame-wrap { border-radius: 12px; overflow: hidden; background: #fff; }
.viewer { width: min(1100px, calc(100% - 24px)); height: calc(100% - 40px); max-height: none; border-radius: 22px; padding: 0; display: none; }
.viewer[open] { display: flex; flex-direction: column; animation: pop .3s var(--spring); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer-title { min-width: 0; display: grid; }
.viewer-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title small { color: var(--ink-3); font-weight: 700; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; background: var(--muted-bg); }
.viewer-slot { height: 100%; }
.viewer-body .pv-frame { height: 100%; min-height: 70vh; }
.viewer-body .pv-image img { max-height: calc(100vh - 160px); }
.viewer-body .pv-table-wrap { max-height: none; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

/* dialogs */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(28, 26, 46, .35); backdrop-filter: blur(2px); }
.sheet { width: min(360px, calc(100% - 24px)); border-radius: 22px; padding: 14px; margin: 70px 16px auto auto; }
.sheet[open] { animation: pop .3s var(--spring); }
.sheet-head { display: flex; gap: 12px; align-items: center; padding: 6px 6px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.sheet-head strong { display: block; }
.sheet-head small { color: var(--ink-3); font-weight: 700; text-transform: capitalize; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px; border: 0; border-radius: 12px; background: none; cursor: pointer; font-weight: 700; text-align: left; }
.sheet-item:hover { background: var(--muted-bg); }
.sheet-item svg { width: 20px; height: 20px; color: var(--ink-3); }
.sheet .btn { margin-top: 8px; }
.confirm { width: min(420px, calc(100% - 32px)); border-radius: 22px; }
.confirm[open] { animation: pop .3s var(--spring); }
.confirm form { padding: 22px; display: grid; gap: 10px; }
.confirm h2 { font-size: 21px; }
.confirm p { color: var(--ink-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* bottom tab bar (mobile) */
.tabbar { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 8px 14px; min-height: 58px; }
  .brand-mobile { display: block; }
  .brand-mobile img { border-radius: 10px; }
  .demo-pill { display: none; }
  .banner { padding: 10px 16px; }
  .view { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 24px; }
  .stat span { font-size: 12.5px; }
  .grid-2, .form-row, .review-grid { grid-template-columns: 1fr; }
  .viewer { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; }
  .app-page .kg { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .app-page.kid-mode .kg { bottom: 12px; }
  .app-page .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .viewer-actions .btn { min-height: 36px; padding: 0 12px; }
  .pv-frame { height: 56vh; min-height: 300px; }
  .pv-actions { gap: 6px; }
  .pv-actions .btn { flex: 1 1 auto; min-width: 0; padding: 0 10px; font-size: 13.5px; white-space: nowrap; gap: 6px; }
  .pv-pdfpages { max-height: 70vh; padding: 8px; }
  .tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar .nav-item { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; justify-content: center; text-align: center; }
  .tabbar .nav-item[aria-current="page"] { background: none; }
  .tabbar .nav-item[aria-current="page"] svg { background: var(--accent-soft); border-radius: 10px; }
  .tabbar .nav-item svg { width: 40px; height: 28px; padding: 3px 9px; }
  .tabbar .nav-count { position: absolute; top: 2px; left: 55%; min-width: 18px; height: 18px; font-size: 11px; }
  .item { grid-template-columns: 1fr; }
  .item-side { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .hello { padding: 16px; }
  .hello img { width: 64px; }
  .hello .ring { width: 54px; height: 54px; }
  .sheet { margin: auto 8px 8px; width: calc(100% - 16px); max-width: none; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .kid-chip small { display: none; }
}

/* ---------- additions: admin, kid mode, misc ---------- */
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.gap-top { margin-top: 20px; }
.muted { color: var(--ink-2); font-size: 15px; }
.small { font-size: 13.5px; }
.h-small { font-size: 19px; font-weight: 800; }
.note { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--muted-bg); font-style: italic; color: var(--ink-2); }
.big-text { font-size: 17px; line-height: 1.6; }
.preview-text { margin-top: 12px; color: var(--ink-2); white-space: pre-line; }
.meta-note { font-size: 13px; font-weight: 800; color: var(--ink-2); align-self: center; margin-right: auto; }
.link-plain { border: 0; background: none; padding: 0; cursor: pointer; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 14px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; background: var(--muted-bg); padding: 1px 6px; border-radius: 6px; }
.setup { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.setup li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--muted-bg); font-weight: 700; }
.setup li svg { width: 22px; height: 22px; flex: none; padding: 3px; border-radius: 8px; background: var(--line-2); color: #fff; }
.setup li.done svg { background: var(--mint); }
.setup strong { display: block; }
.setup small { color: var(--ink-3); font-weight: 600; }
.import { display: grid; grid-template-columns: 240px 1fr; gap: 16px; margin: 14px 0; }
.import-table { display: grid; gap: 6px; margin: 16px 0 6px; max-height: 360px; overflow: auto; }
.import-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; }
.import-row svg { width: 20px; height: 20px; margin-top: 2px; }
.import-row.good { background: var(--mint-soft); color: #145c33; }
.import-row.bad { background: var(--red-soft); color: #8f2323; }
.import-row strong { display: block; }
.import-row small { font-weight: 700; opacity: .85; overflow-wrap: anywhere; }
.import-row em { display: block; font-style: normal; font-weight: 800; font-size: 13.5px; margin-top: 2px; }
.creds { margin-top: 16px; padding: 18px; border-radius: 18px; background: var(--mint-soft); }
.creds h3 { display: flex; gap: 8px; align-items: center; font-size: 18px; }
.creds h3 svg { width: 22px; height: 22px; color: var(--mint); }
.creds > p { margin: 6px 0 12px; color: #245c3c; font-size: 14.5px; }
.cred-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.cred-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--paper); border-radius: 12px; padding: 9px 12px; }
.cred-list strong { display: block; font-size: 14.5px; }
.cred-list small { color: var(--ink-3); font-weight: 700; overflow-wrap: anywhere; }
.cred-list code { font-size: 15px; background: var(--sun-soft); }
.shake-x { animation: shake-x .4s ease; }
@keyframes shake-x { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.pin-input { font-size: 26px; letter-spacing: .5em; text-align: center; font-family: var(--font-display); }
.confirm .pin-input { margin: 6px 0 2px; }

.kid-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.kid-card { display: grid; justify-items: center; gap: 6px; padding: 24px 16px; border-radius: 24px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .25s var(--spring), border-color .2s, box-shadow .2s; }
.kid-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-1); }
.kid-card .avatar { width: 64px; height: 64px; font-size: 26px; background: var(--sun); color: var(--ink); }
.kid-card strong { font-family: var(--font-display); font-size: 22px; }
.kid-card small { color: var(--ink-3); font-weight: 700; }

.app-page.kid-mode { --accent: var(--lilac); --accent-soft: var(--lilac-soft); }
.kid-mode .app { grid-template-columns: 1fr; }
.kid-mode .side, .kid-mode .tabbar, .kid-mode .avatar-btn, .kid-mode .kids { display: none !important; }
.kid-mode .brand-mobile { display: block; pointer-events: none; }
.kid-mode .demo-pill { display: inline-block; }
.kid-mode .demo-pill::after { content: " · Kid mode"; }
.kid-mode .view { max-width: 820px; margin: 0 auto; padding-bottom: 48px; }
.kid-list .item { border-radius: 22px; padding: 16px 18px; border-width: 2px; }
.kid-list .item h3 { font-size: 18px; }
.kid-mode .tick-btn { padding: 10px 16px 10px 10px; font-size: 15px; }
.kid-mode .tick-btn .tick { width: 24px; height: 24px; }
.kid-mode .big-text { font-size: 19px; }
.kid-exit { display: flex; justify-content: center; margin-top: 28px; }

@media (max-width: 860px) {
  .stats-4 { grid-template-columns: repeat(2, 1fr); }
  .import { grid-template-columns: 1fr; }
  .page-head .btn { width: 100%; }
  .kid-mode .view { padding: 18px 14px 40px; }
}


/* ---------- class page: attendance, today's work, class list ---------- */
.class-open { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--accent); }
.class-open svg { width: 16px; height: 16px; }
.att-summary .att-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.att-summary h2 { font-size: 20px; }
.att-count { font-size: 16px; color: var(--ink-2); margin-top: 2px; }
.att-count b { color: var(--ink); font-size: 18px; }
.att-summary .status svg { width: 14px; height: 14px; }
.att-summary .status:has(svg)::before { display: none; }
.absent-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--coral-soft); border: 1.5px solid var(--coral); }
.absent-card > div { flex: 1 1 220px; }
.absent-card strong { display: block; font-size: 16px; }
.absent-card small { color: var(--ink-2); font-size: 14px; font-weight: 700; }
.absent-ic { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--coral); color: #fff; }
.absent-ic svg { width: 20px; height: 20px; }
.banner-ok { margin-top: 16px; border-radius: var(--r-md); background: var(--mint-soft); color: #1b7543; padding: 12px 16px; }
.att-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.att-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s, transform .15s var(--spring); }
.att-row:hover { border-color: var(--line-2); }
.att-row:active { transform: scale(.98); }
.att-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.att-roll { min-width: 22px; font-size: 13px; font-weight: 800; color: var(--ink-3); text-align: right; }
.att-row .avatar, .roster-row .avatar { width: 34px; height: 34px; font-size: 13px; background: var(--accent-soft); color: var(--accent); }
.att-name { flex: 1; font-weight: 800; font-size: 15px; line-height: 1.25; }
.att-sent { display: block; font-size: 12px; color: var(--mint); font-weight: 800; }
.att-pill { font-size: 12.5px; font-weight: 900; padding: 4px 11px; border-radius: 999px; background: var(--mint-soft); color: #1b7543; }
.att-row.is-absent { background: var(--red-soft); border-color: var(--red); }
.att-row.is-absent .att-pill { background: var(--red); color: #fff; }
.att-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: flex-end; margin: 16px -4px 0; padding: 12px 4px calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--app-bg) 70%, transparent); }
.att-bar .btn[disabled] { opacity: .5; cursor: default; }
.sub-tabs .count { font-weight: 800; color: var(--ink-3); margin-left: 4px; }
.invite-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.invite-card .btn svg { width: 18px; height: 18px; }
.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.roster-main { flex: 1 1 220px; display: grid; }
.roster-main strong { font-size: 15px; }
.roster-main small { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.st-line { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; }
.st-line i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-joined { color: #1b7543; }
.st-invited { color: #9a6700; }
.st-none { color: var(--ink-3); }
.contact-links { display: inline-flex; gap: 6px; }
.sheet-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 48px); border-radius: 24px; overflow: auto; }
.sheet-body { display: grid; gap: 12px; padding: 22px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { display: flex; align-items: center; gap: 8px; font-size: 22px; }
.ok-ic { width: 22px; height: 22px; color: var(--mint); }
.kid-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kid-chip-sm { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--coral-soft); font-weight: 800; font-size: 14px; }
.kid-chip-sm .avatar, .plain-list .avatar { width: 26px; height: 26px; font-size: 11px; }
.list.compact .item { padding: 10px 12px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.contact-row { flex-wrap: wrap; padding: 10px; border-radius: 14px; background: var(--muted-bg); }
.contact-row > span:nth-child(2) { flex: 1 1 180px; display: grid; }
.contact-row small { color: var(--ink-2); font-weight: 700; }
.catchup-card { display: grid; gap: 12px; padding: 16px; margin-bottom: 16px; border-radius: var(--r-lg); background: var(--coral-soft); border: 1.5px solid var(--coral); }
.catchup-head { display: flex; gap: 12px; align-items: flex-start; }
.catchup-head strong { display: block; font-size: 16px; }
.catchup-head small { color: var(--ink-2); font-weight: 700; }
.catchup-note { font-weight: 700; }
.catchup-card > .btn { justify-self: start; }

/* ---------- dark theme: follows the device's light or dark setting ---------- */
@media (prefers-color-scheme: dark) {
  .app-page {
    color-scheme: dark;
    --ink: #f1eff9;
    --ink-2: #c8c5d8;
    --ink-3: #9a97b0;
    --bg: #11101a;
    --surface: #1b1a28;
    --line: #2c2a3e;
    --line-2: #3a3852;
    --app-bg: #11101a;
    --muted-bg: #242337;
    --paper: #1b1a28;
    --on-ink: #11101a;
    --blue: #7fa7ee;
    --blue-2: #9ab9f3;
    --blue-soft: #1d2a47;
    --sun-soft: #3a3014;
    --coral: #ff8f6f;
    --coral-soft: #3c231c;
    --mint: #3ec07a;
    --mint-soft: #16342a;
    --sky-soft: #14304a;
    --lilac: #a28cff;
    --lilac-soft: #2a2450;
    --red: #ff6b6b;
    --red-soft: #3f1d21;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px -6px rgba(0, 0, 0, .6);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 50px -20px rgba(0, 0, 0, .7);
  }
  .app-page[data-role="parent"] { --accent: #ff8a66; }
  .app-page .topbar { background: rgba(17, 16, 26, .86); }
  .app-page .btn-accent, .app-page .avatar, .app-page .nav-count, .app-page .s-accepted { color: #0f0e18; }
  .app-page .att-row .avatar, .app-page .roster-row .avatar { color: var(--accent); }
  .app-page .banner-trial { color: #f5d27a; }
  .app-page .banner-locked, .app-page .urgent-card, .app-page .files li.bad, .app-page .import-row.bad, .app-page .fcard-err { color: #ffb4b4; }
  .app-page .banner-ok, .app-page .att-pill, .app-page .st-joined, .app-page .s-reviewed, .app-page .import-row.good, .app-page .creds > p { color: #8fe0b3; }
  .app-page .st-invited, .app-page .s-returned { color: #f5d27a; }
  .app-page .s-submitted { color: #8ccaff; }
  .app-page .s-review { color: #c6b7ff; }
  .app-page .due-soon { color: #ff9a76; }
  .app-page .tick-btn[aria-pressed="true"] { border-color: #2d5c45; color: #8fe0b3; }
  .app-page .fcard:has(.fcard-err) { border-color: #6b2b2b; }
  .app-page .task[aria-checked="true"] { background: var(--mint-soft); border-color: #2d5c45; }
  .app-page .toast[data-kind="error"] { background: #ffb4b4; color: #3a0d0d; }
  .app-page .kg-head { background: linear-gradient(135deg, #3a3014, #2a2450); }
  .app-page dialog::backdrop { background: rgba(0, 0, 0, .55); }
  .app-page .input:focus, .app-page .textarea:focus { box-shadow: 0 0 0 4px rgba(127, 167, 238, .22); }
}

/* Attendance bar: left-aligned so the floating Help button never covers "Save attendance". */
.att-bar { justify-content: flex-start; }
@media (max-width: 860px) {
  .att-bar { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); padding-right: 76px; }
  .att-bar .btn { flex: 1 1 auto; white-space: nowrap; min-height: 46px; padding: 0 14px; font-size: 15px; }
  .att-bar [data-all-present] { flex: 0 0 auto; }
}
@media (prefers-color-scheme: dark) {
  .app-page .tabbar { background: rgba(27, 26, 40, .96); border-color: var(--line); }
  .app-page .demo-pill, .app-page .t-parent { color: #f5d27a; }
  .app-page .t-do { color: #ff9a76; }
  .app-page .t-study { color: #c6b7ff; }
  .app-page .t-bring { color: #8fe0b3; }
  .app-page .t-attend { color: #8ccaff; }
  .app-page .t-know { color: var(--ink-2); }
  .app-page .t-urgent { color: #ffb4b4; }
}
