/* Kriyon design system: the brand's burgundy and ivory, Manrope throughout (Noto Sans for Hindi and Telugu, sent
   only to devices that show those scripts). One distinctive mark: the exercise-book margin rule beside page titles.
   Layout: sidebar on desktop (1180px and up), icon rail on tablets, top bar plus bottom tabs on phones (under 768px). */
/* Manrope served by Kriyon (SIL Open Font License, static/fonts/MANROPE-LICENSE.txt): no third-party request,
   cached for offline use. */
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('../fonts/manrope-latin-ext-wght-normal.woff2') format('woff2-variations'), url('../fonts/manrope-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('../fonts/manrope-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/manrope-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --wine: #6c1f3d; --wine-dark: #4a1429; --rose: #f4e8ed; --rose-2: #f3e6eb;
  --ivory: #f7f3ec; --pearl: #fcfaf7; --page: #f7f3ec; --sand: #f1ece4;
  --text: #1f1a1d; --muted: #5e555a; --faint: #766c71; --border: #e6ded6; --border-2: #d3c9c1;
  --success: #2f6f52; --success-bg: #e8f2ec; --warn: #85560f; --warn-bg: #fbf1e1; --bad: #9e2a3f; --bad-bg: #fbe9ec;
  --info-bg: #edf1f7; --info: #34466e;
  --radius: 10px; --radius-lg: 14px;
  --body: 'Manrope', 'Noto Sans Devanagari', 'Noto Sans Telugu', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: var(--body); --hand: var(--body);
  --sidebar-w: 256px; --rail-w: 76px; --tabbar-h: 64px;
  /* aliases used by feature stylesheets below */
  --ink: var(--wine); --ink-soft: #8a4a63; --pencil: var(--muted); --rule: var(--border); --margin: var(--bad);
  --leaf: var(--success); --amber: #b7791f; --focus: var(--wine);
}
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--text); background: var(--page); line-height: 1.6; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11"; }
a { color: var(--wine); text-underline-offset: 3px; }
a:hover { color: var(--wine-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.25; margin: 0 0 .6rem; color: var(--text); }
h1 { font-size: 1.95rem; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em; margin-top: 1.4rem; }
h3 { font-size: 1.0625rem; font-weight: 700; }
p { max-width: 72ch; }
small, .muted, .meta { color: var(--muted); }
.meta { font-size: .875rem; }
table, .kpi strong, .countdown, .timer { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 100; background: var(--wine); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; color: #fff; }
main:focus { outline: none; }

/* ---------- Shell: desktop sidebar ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60; background: var(--pearl); border-right: 1px solid var(--border);
  padding: 24px 16px 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0 4px 20px 10px; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 1.7rem; letter-spacing: -.03em; color: var(--wine); text-decoration: none; line-height: 1; display: block; }
.wordmark small { display: block; font-size: .72rem; margin-left: 2px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-top: 6px; }
.wordmark .wm-mark { display: none; }
.logo { display: inline-block; aspect-ratio: 1137 / 317; background-color: currentColor;
  -webkit-mask: url('../img/logo.svg') center / contain no-repeat; mask: url('../img/logo.svg') center / contain no-repeat; }
.wordmark .logo { width: 148px; color: var(--wine); }
@media (forced-colors: active) { .logo { background-color: CanvasText; } }
.sidebar .nav-close { display: none; }
.school-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 0 2px 18px; background: #fff; }
.school-card .ic { flex: 0 0 auto; width: 32px; height: 32px; padding: 6px; background: var(--sand); border-radius: 8px; color: #6f604e; }
.school-card strong { display: block; font-size: .84rem; line-height: 1.3; } .school-card span { display: block; font-size: .75rem; color: var(--muted); }
.nav-label { font-size: .78rem; font-weight: 700; color: var(--muted); margin: 16px 12px 6px; max-width: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #4d4549; text-decoration: none; font-size: .92rem; font-weight: 500; }
.sidebar nav a svg { flex: 0 0 auto; color: #7d7176; }
.sidebar nav a:hover { background: #f1ebe5; color: var(--text); }
.sidebar nav a.active { background: var(--rose-2); color: var(--wine); font-weight: 700; box-shadow: inset 3px 0 0 var(--wine); }
.sidebar nav a.active svg { color: var(--wine); }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.sidebar-user { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 14px 2px; }
.sidebar-user .who { flex: 1; min-width: 0; } .sidebar-user b { display: block; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .sidebar-user small { display: block; font-size: .75rem; }
.avatar-chip { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--rose); color: var(--wine); border: 1px solid #e4cfd8; flex: 0 0 auto; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: #6f6368; cursor: pointer; text-decoration: none; padding: 0; min-height: 0; }
.icon-btn:hover { background: #efe7e2; color: var(--wine); }
.workspace { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { min-height: 68px; background: rgba(252, 250, 247, .94); backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 40px; position: sticky; top: 0; z-index: 30; }
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); flex: 1; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { display: inline-flex; color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.role-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 4px 8px 4px 4px; border-radius: 999px; }
.role-chip:hover { background: #f1ebe5; color: var(--text); }
.role-chip small { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; line-height: 1.2; }
.role-chip b { display: block; font-size: .86rem; line-height: 1.3; }
.bell { position: relative; } .bell i { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--wine); color: #fff; font-style: normal; font-size: .66rem; font-weight: 800; display: grid; place-items: center; }
.strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 40px; font-size: .8rem; color: var(--muted); background: var(--sand); border-bottom: 1px solid var(--border); }
.strip .sep { width: 1px; height: 12px; background: var(--border-2); }
.strip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.strip .sample { margin-left: auto; color: var(--warn); font-weight: 600; }
.content { width: 100%; max-width: 1240px; padding: 32px 40px 56px; }
.content.wide { max-width: 1480px; }
.footer { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 18px 40px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }
.nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(31, 18, 24, .42); }
.nav-backdrop[hidden] { display: none; }
.tabbar { display: none; }

/* ---------- Shell: tablet rail (768px to 1179px) ---------- */
@media (max-width: 1179px) {
  .sidebar { width: var(--rail-w); padding: 18px 10px 0; }
  .sidebar .wordmark .logo, .sidebar .wordmark small, .school-card, .nav-label, .nav-text, .sidebar-user .who { display: none; }
  .sidebar .wordmark .wm-mark { display: block; width: 44px; height: 44px; }
  .sidebar-head { margin: 0 0 14px; justify-content: center; }
  .sidebar nav + .nav-label + nav, .sidebar nav ~ nav { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
  .sidebar nav a { justify-content: center; padding: 0; }
  .sidebar nav a.active { box-shadow: inset 3px 0 0 var(--wine); }
  .sidebar-user { flex-direction: column; padding: 12px 0; }
  .sidebar-user .avatar-chip { display: none; }
  .workspace { margin-left: var(--rail-w); }
  .menu-btn { display: inline-grid; }
  .topbar, .strip, .footer { padding-left: 24px; padding-right: 24px; }
  .content { padding: 28px 24px 48px; }
  /* opened from the menu button: the full menu slides over the page */
  .sidebar.open { width: min(320px, 88vw); padding: 20px 14px 0; box-shadow: 0 20px 60px rgba(40, 20, 30, .25); }
  .sidebar.open .nav-text { display: inline; } .sidebar.open .wordmark .logo { display: inline-block; }
  .sidebar.open .wordmark small, .sidebar.open .nav-label, .sidebar.open .sidebar-user .who { display: block; }
  .sidebar.open .sidebar-user .avatar-chip { display: grid; }
  .sidebar.open .school-card { display: flex; } .sidebar.open .wordmark .wm-mark { display: none; }
  .sidebar.open .sidebar-head { justify-content: space-between; margin: 0 2px 18px 10px; }
  .sidebar.open .nav-close { display: inline-grid; }
  .sidebar.open nav a { justify-content: flex-start; padding: 0 12px; }
  .sidebar.open nav ~ nav { border-top: 0; padding-top: 0; margin-top: 0; }
  .sidebar.open .sidebar-user { flex-direction: row; padding: 14px 2px; }
}

/* ---------- Shell: phones (under 768px) ---------- */
@media (max-width: 767px) {
  .sidebar { width: min(320px, 88vw); padding: 20px 14px 0; transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar .nav-text { display: inline; } .sidebar .wordmark .logo { display: inline-block; }
  .sidebar .wordmark small, .sidebar .nav-label, .sidebar .sidebar-user .who { display: block; }
  .sidebar .sidebar-user .avatar-chip { display: grid; }
  .sidebar .school-card { display: flex; } .sidebar .wordmark .wm-mark { display: none; }
  .sidebar .sidebar-head { justify-content: space-between; margin: 0 2px 18px 10px; }
  .sidebar .nav-close { display: inline-grid; }
  .sidebar nav a { justify-content: flex-start; padding: 0 12px; }
  .sidebar nav ~ nav { border-top: 0; padding-top: 0; margin-top: 0; }
  .sidebar .sidebar-user { flex-direction: row; padding: 14px 2px calc(14px + env(safe-area-inset-bottom)); }
  .sidebar.open { transform: none; }
  .workspace { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { min-height: 56px; padding: 0 8px 0 4px; gap: 4px; }
  .menu-btn { display: none; }
  .crumbs { padding-left: 12px; font-size: 1rem; } .crumb-role, .crumb-sep { display: none; }
  .role-text { display: none; } .role-chip { padding: 4px; }
  .strip { display: none; }
  .content { padding: 20px 16px 32px; }
  .footer { padding: 14px 16px; font-size: .75rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    min-height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: rgba(252, 250, 247, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tabbar-h);
    padding: 6px 2px; border: 0; border-radius: 0; background: none; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 600; text-decoration: none; cursor: pointer; }
  .tabbar a:hover, .tabbar button:hover { background: none; color: var(--wine); }
  .tabbar a.active { color: var(--wine); font-weight: 800; }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px; border-radius: 0 0 3px 3px; background: var(--wine); }
  h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
body.nav-open { overflow: hidden; }
@media print { .tabbar, .nav-backdrop { display: none !important; } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { background: var(--wine-dark); color: #f6eef1; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand .wordmark { color: #fff; margin: 0; } .auth-brand .wordmark .logo { width: 190px; color: #fff; } .auth-brand .wordmark small { color: #e8cfd9; font-size: .82rem; }
.auth-brand h2 { color: #fff; font-size: 2.1rem; max-width: 14ch; } .auth-brand p { color: #e3c7d2; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--pearl); }
.auth-form > div { width: 100%; max-width: 380px; }
@media (max-width: 860px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-brand { padding: 28px 24px; gap: 18px; } .auth-brand h2 { font-size: 1.55rem; margin: 0; } .auth-brand p { margin: 6px 0 0; } .auth-brand p + p { display: none; } }

/* ---------- Page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.eyebrow { display: block; font-size: .86rem; font-weight: 600; letter-spacing: 0; color: var(--muted); margin: 0 0 6px; }
.page-head h1 { margin: 0; padding-left: 14px; border-left: 3px solid var(--wine); }
.page-head .eyebrow { padding-left: 17px; }
.page-head .lede { padding-left: 17px; }
.lede { margin: 8px 0 0; color: var(--muted); font-size: 1.04rem; max-width: 68ch; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; text-decoration: none; margin-bottom: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.cols > * { min-width: 0; }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.card, .panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.card + .card { margin-top: 18px; }
.card h2, .panel h2 { margin-top: 0; font-size: 1.08rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; } .card-head p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.side-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.side-card + .side-card { margin-top: 16px; }
.side-card.soft { background: var(--info-bg); border-color: #dde3ee; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi strong { display: block; font-family: var(--display); font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; }
.kpi em { font-style: normal; font-size: .8rem; color: var(--muted); }
.list-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid #f0ebe6; }
.list-row:last-child { border-bottom: 0; }
.list-row > div:first-child { flex: 1; min-width: 0; }
.list-row b, .list-row strong { display: block; }
.action-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); background: #fff; }
.action-row:hover { border-color: #d7c4cc; background: #fffdfb; }
.action-row + .action-row { margin-top: 10px; }
.action-row > div { flex: 1; min-width: 0; } .action-row b { display: block; } .action-row span.sub { font-size: .85rem; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius-lg); background: var(--pearl); }

/* ---------- Messages and banners ---------- */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin: 0 0 1.1rem; background: var(--info-bg); color: var(--info); border: 1px solid #dde3ee; }
.flash.error, .flash.warning { background: var(--warn-bg); color: var(--warn); border-color: #f0dfc0; }
.flash.success { background: var(--success-bg); color: var(--success); border-color: #d3e6da; }
.placeholder-banner { border: 1px dashed #d8b37a; color: var(--warn); background: var(--warn-bg); padding: .65rem .9rem; border-radius: var(--radius); margin: .75rem 0; font-weight: 600; font-size: .9rem; }

/* ---------- Tables, lists ---------- */
table { border-collapse: collapse; width: 100%; margin: .5rem 0 1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
th, td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid #f0ebe6; vertical-align: top; }
th { font-size: .82rem; letter-spacing: 0; color: var(--muted); font-weight: 700; background: var(--pearl); }
tr:last-child td { border-bottom: 0; }
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }  /* relative: hidden labels inside can't stretch the page */
@media (max-width: 767px) { th, td { padding: .65rem .7rem; } .table-wrap table { min-width: 560px; } .cols { gap: 16px; } .card, .panel { padding: 18px; } }
.row { display: flex; gap: .75rem 1rem; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stack > * + * { margin-top: .9rem; }
.item { padding: .9rem 0; border-bottom: 1px solid #f0ebe6; }
.item:last-child { border-bottom: 0; }

/* ---------- Pills: words, never colour alone ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; padding: .2rem .6rem; border-radius: 6px; background: #f1ede8; color: #5c5357; white-space: nowrap; }
.pill.logged, .pill.awaiting_review, .pill.in_review, .pill.reviewed, .pill.waiting, .pill.running, .pill.generating, .pill.rendering, .pill.triaged { background: #f3ece4; color: #7a5a35; }
.pill.confirmed, .pill.released, .pill.published, .pill.done, .pill.imported, .pill.submitted, .pill.ingested, .pill.answered, .pill.corrected, .pill.resolved { background: var(--success-bg); color: var(--success); }
.pill.not_logged, .pill.failed, .pill.retake, .pill.late, .pill.abstained, .pill.overdue, .pill.rejected { background: var(--bad-bg); color: var(--bad); }
.pill.fallback { background: var(--warn-bg); color: var(--warn); }
.pill.grounded { background: #e9f2ec; color: var(--success); }

/* ---------- Forms and buttons ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin: .7rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=date], input[type=time], input[type=search], input[type=url],
select, textarea { width: 100%; max-width: 600px; font: inherit; font-size: 1rem; color: var(--text); min-height: 44px; padding: .6rem .8rem; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; }
textarea { max-width: 100%; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(108, 31, 61, .35); outline-offset: 0; border-color: var(--wine); }
input[type=checkbox], input[type=radio] { accent-color: var(--wine); width: 18px; height: 18px; }
.helptext, .help { display: block; font-size: .8rem; color: var(--muted); }
.errorlist { color: var(--bad); padding-left: 1rem; margin: .25rem 0; font-size: .88rem; }
button, .btn { white-space: nowrap; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; min-height: 44px; padding: .5rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--wine); background: var(--wine); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:hover, .btn:hover { background: var(--wine-dark); border-color: var(--wine-dark); color: #fff; }
.btn.quiet, button.quiet { background: #fff; color: var(--text); border-color: var(--border-2); }
.btn.quiet:hover, button.quiet:hover { background: var(--pearl); color: var(--wine); border-color: #d7c4cc; }
.btn.warn, button.warn { background: var(--bad); border-color: var(--bad); }
.btn.tiny, button.tiny { min-height: 34px; padding: .2rem .7rem; font-size: .84rem; }
@media (pointer: coarse) { .btn.tiny, button.tiny { min-height: 40px; } }
.btn.big, button.big { min-height: 52px; padding: .6rem 1.4rem; font-size: 1rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
.inline { display: inline; }
ul.checks { list-style: none; padding: 0; columns: 2 260px; }
ul.checks li { break-inside: avoid; display: flex; gap: .5rem; align-items: baseline; margin: .25rem 0; }
ul.checks label { font-weight: 400; display: inline; margin: 0; }
details > summary { cursor: pointer; font-weight: 600; }
.segmented { display: inline-flex; border: 1px solid var(--border-2); border-radius: 9px; overflow: hidden; background: #fff; }
.segmented button, .segmented label { border: 0; border-radius: 0; background: #fff; color: var(--text); margin: 0; min-height: 42px; padding: .4rem 1rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.segmented > * + * { border-left: 1px solid var(--border-2); }
.segmented { max-width: 100%; overflow-x: auto; } .segmented > * { flex: 0 0 auto; }
.big-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.big-choice label { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 70px; margin: 0; padding: 10px; border: 1px solid var(--border-2); border-radius: 12px; background: #fff; font-weight: 600; cursor: pointer; }
.big-choice input { position: absolute; opacity: 0; }
.big-choice input:checked + span { color: var(--wine); }
.big-choice label:has(input:checked) { border: 2px solid var(--wine); background: var(--rose); }

/* ---------- Teacher day ---------- */
.slot { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #f0ebe6; align-items: center; }
.slot:last-child { border-bottom: 0; }
.slot .period { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--wine); line-height: 1.2; }
.slot .period small { display: block; font-family: var(--body); font-weight: 500; font-size: .78rem; color: var(--muted); }
.slot .note { font-size: .9rem; color: #4d4448; font-style: italic; }
.target { color: var(--muted); font-size: .88rem; }
@media (max-width: 700px) { .slot { grid-template-columns: 56px 1fr; } .slot > :last-child { grid-column: 1 / -1; } }
.correction { border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; margin: .7rem 0; background: #fff; }
.correction.needs { border-color: #e5c2cb; background: #fffafb; box-shadow: inset 3px 0 0 var(--bad); }
.answer-text { font-size: 1rem; white-space: pre-wrap; background: var(--pearl); border: 1px solid #f0ebe6; border-radius: 8px; padding: .6rem .8rem; }
.ruled { line-height: 1.7; }

/* ---------- Study, avatar, graph, misc ---------- */
.study { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 820px) { .study { grid-template-columns: minmax(0, 1fr); } }
.avatar { width: 180px; height: 180px; position: sticky; top: 90px; }
.avatar svg { width: 100%; height: 100%; }
.avatar .mouth-open { display: none; }
.avatar.talking.open .mouth-open { display: inline; } .avatar.talking.open .mouth-closed { display: none; }
.avatar .lids { transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(0); } 97% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .avatar .lids { animation: none; } }
.answer { font-size: 1rem; } .answer sup { color: var(--wine); font-weight: 700; }
.bubble { background: var(--ivory); border-radius: var(--radius); padding: .75rem 1rem; }
.cites { font-size: .85rem; color: var(--muted); }
.source-pick { columns: 2 280px; list-style: none; padding: 0; }
#graph { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; }
.legend span::before { content: ""; display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; background: var(--c); }
.suggest-list { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); list-style: none; padding: .25rem 0; margin: 0; z-index: 5; min-width: 240px; box-shadow: 0 8px 24px rgba(40, 21, 30, .08); }
.suggest-list li { padding: .35rem .8rem; cursor: pointer; }
.suggest-list li[aria-selected="true"], .suggest-list li:hover { background: var(--rose); }
.stage { aspect-ratio: 16 / 9; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.5rem 3rem; display: flex; flex-direction: column; }
.stage h2 { font-size: 2rem; margin: 0 0 1rem; } .stage li { font-size: 1.3rem; margin: .4rem 0; }
.player { display: grid; grid-template-columns: 1fr 180px; gap: 1rem; align-items: start; }
@media (max-width: 820px) { .player { grid-template-columns: minmax(0, 1fr); } }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Study notebook: sources | conversation | studio */
.nb { display: grid; grid-template-columns: 270px minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.nb > section { min-width: 0; }
.nb .panel { padding: 1rem; }
.nb .panel h2 { font-size: 1rem; margin: 0 0 .5rem; }
@media (max-width: 1180px) { .nb { grid-template-columns: minmax(0, 1fr); } .nb .side-toggle { display: block; } }

.src-row { display: flex; gap: .4rem; align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--rule); }
.src-row label { font-weight: 400; margin: 0; flex: 1; font-size: .95rem; }
.src-row.off label { color: var(--pencil); text-decoration: line-through; }
.src-row .tiny { font-size: .78rem; padding: .05rem .4rem; border-width: 1px; }
.chat { display: flex; flex-direction: column; gap: .9rem; }
.turn .q { align-self: flex-end; background: var(--wine); color: #fff; border-radius: 14px 14px 2px 14px; padding: .55rem .85rem; max-width: 85%; margin-left: auto; width: fit-content; }
.turn .a { background: var(--ivory); border-radius: 14px 14px 14px 2px; padding: .7rem .9rem; margin-top: .4rem; }
.turn.forgotten { opacity: .55; }
.cite-btn { font: inherit; font-size: .78rem; font-weight: 700; padding: 0 .3rem; margin: 0 .1rem; border: 1px solid var(--ink-soft); border-radius: 4px; background: #fff; color: var(--ink-soft); vertical-align: super; line-height: 1.2; }
.meta { font-size: .8rem; color: var(--pencil); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .85rem; font-weight: 500; min-height: 36px; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border-2); background: #fff; color: var(--text); cursor: pointer; }
.chip:hover { background: var(--rose); color: var(--wine); border-color: #d7c4cc; }
.askbar { position: sticky; bottom: 0; background: #fff; padding-top: .6rem; border-top: 1px solid var(--rule); }
.passage .hl { background: #fff1b8; box-shadow: 0 0 0 2px #fff1b8; border-radius: 2px; }
.passage .dim { color: var(--pencil); font-size: .92rem; }
.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.studio-grid button { font-size: .85rem; padding: .4rem .5rem; }
.mindmap { width: 100%; height: 460px; border: 1px solid var(--rule); border-radius: var(--radius); }
.audio .hosts { display: flex; gap: 1rem; justify-content: center; }
.audio .hosts .avatar { width: 120px; height: 120px; position: static; }
.audio .host-b .avatar svg circle:first-of-type { fill: #e8f4ec; }
.audio .script li { cursor: pointer; padding: .25rem .4rem; border-radius: 4px; }
.audio .script li.now { background: #fff1b8; }
.output-body.ruled-off h2 { font-size: 1.05rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nb .avatar { width: 84px; height: 84px; position: static; }

/* Notes: Obsidian-style editor */
.vault { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.5rem; }
@media (max-width: 900px) { .vault { grid-template-columns: minmax(0, 1fr); } }
.vault aside ul { list-style: none; padding: 0; margin: .2rem 0 1rem; }
.vault aside li { margin: .15rem 0; }
.note-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 1.25rem; }
@media (max-width: 1100px) { .note-layout { grid-template-columns: minmax(0, 1fr); } }
#editor { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
#editor[data-view="edit"] { grid-template-columns: minmax(0, 1fr); } #editor[data-view="edit"] #preview-wrap { display: none; }
#editor[data-view="preview"] { grid-template-columns: minmax(0, 1fr); } #editor[data-view="preview"] #edit-wrap { display: none; }
@media (max-width: 900px) { #editor { grid-template-columns: minmax(0, 1fr); } }
#note-body { min-height: 540px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.65; background: var(--pearl); }
.toolbar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .5rem; }
.toolbar button { font-size: .85rem; padding: .3rem .6rem; }
.toolbar [aria-pressed="true"] { background: var(--wine); color: #fff; border-color: var(--wine); }
.md-body { line-height: 1.65; overflow-wrap: anywhere; }
.md-body h1 { font-size: 1.6rem; } .md-body h2 { font-size: 1.3rem; margin-top: 1.2rem; } .md-body h3 { font-size: 1.1rem; }
.md-body blockquote { border-left: 3px solid #d7c4cc; margin: .6rem 0; padding: .3rem 1rem; background: var(--pearl); border-radius: 0 8px 8px 0; }
.md-body code { background: var(--ivory); padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }
.md-body pre { background: var(--ivory); padding: .7rem; border-radius: var(--radius); overflow-x: auto; }
.md-body table { width: auto; } .md-body img { max-width: 100%; border-radius: var(--radius); }
.md-body li:has(> input[type=checkbox]) { list-style: none; margin-left: -1.2rem; }
.md-body input[type=checkbox] { width: 1.05rem; height: 1.05rem; vertical-align: -2px; margin-right: .35rem; }
.wikilink { color: var(--wine); font-weight: 600; text-decoration: none; border-bottom: 1px solid #d7c4cc; }
.wikilink.topic { color: var(--leaf); }
.wikilink.missing { color: var(--margin); border-bottom: 1px dashed var(--margin); }
a.tag { background: var(--rose); color: var(--wine); border-radius: 999px; padding: 0 .45rem; font-size: .88em; text-decoration: none; }
#outline { list-style: none; padding: 0; font-size: .9rem; }
.mention { font-size: .88rem; padding: .3rem 0; border-bottom: 1px solid var(--rule); }
.diff-del { background: #fbeeed; } .diff-add { background: #ebf5ef; }
/* Canvas */
.canvas-wrap { position: relative; height: 640px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius);
  background-color: #fbfcfe; background-image: radial-gradient(#d5e1f2 1px, transparent 1px); background-size: 22px 22px; }
#board { position: relative; width: 2400px; height: 1600px; }
#edges { position: absolute; inset: 0; width: 2400px; height: 1600px; pointer-events: none; }
#edges line, #edges text { pointer-events: auto; }
.edge-label { font-size: 12px; fill: var(--ink-soft); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.cv-card { position: absolute; background: #fff; border: 1px solid var(--border-2); border-radius: 8px; padding: .5rem .7rem; box-shadow: 0 1px 3px rgba(40,21,30,.06); cursor: grab; touch-action: none; font-size: .9rem; }
.cv-card p { margin: .25rem 0 0; color: var(--pencil); }
.cv-card.card-text p.cardtext { color: var(--ink); font-family: var(--hand); font-size: 1.05rem; }
.cv-card.card-topic { border-color: var(--leaf); }
.cv-card.selected { outline: 3px solid var(--focus); } .cv-card.from { outline: 3px dashed var(--ink-soft); }

.side-card .action-row { flex-wrap: wrap; padding: 12px 14px; }
.side-card .action-row form { width: 100%; justify-content: flex-end; }

/* Chapter progress */
.progress-list { display: flex; flex-direction: column; gap: 14px; }
.subj-progress { display: flex; flex-direction: column; gap: 5px; }
.bar { height: 9px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--wine); }
.bar.small { height: 7px; }
/* Calendar */
.cal-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-toolbar .icon-btn { font-size: 1.4rem; border: 1px solid var(--border-2); background: #fff; }
.segmented a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; text-decoration: none; color: var(--text); background: #fff; }
.segmented a + a { border-left: 1px solid var(--border-2); }
.segmented a.on { background: var(--wine); color: #fff; font-weight: 600; }
.cal-legend { margin: 0 0 12px; font-size: .8rem; }
.cal-legend span::before { background: var(--tint-line, var(--c)); }
.cal-legend .key::before { border-radius: 2px; }
.cal-legend .key.taught::before { background: var(--success); } .cal-legend .key.partly::before { background: var(--amber); } .cal-legend .key.planned::before { background: #fff; border: 1.5px dashed var(--faint); }
.tint-0 { --tint: #f3e5ec; --tint-line: #8a3d5d; } .tint-1 { --tint: #e6eef6; --tint-line: #3b5f8a; } .tint-2 { --tint: #e7f1ea; --tint-line: #34785a; }
.tint-3 { --tint: #f7eedf; --tint-line: #a26a1b; } .tint-4 { --tint: #ece8f5; --tint-line: #5f4b8b; } .tint-5 { --tint: #e5f2f2; --tint-line: #2f6f73; }
.cal-week { display: grid; grid-template-columns: 64px repeat(var(--days), minmax(120px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; overflow: hidden; min-width: 760px; }
.cal-corner, .cal-dayhead, .cal-time, .cal-cell { border-bottom: 1px solid #f0ebe6; border-right: 1px solid #f0ebe6; }
.cal-dayhead { padding: 10px; text-align: center; background: var(--pearl); }
.cal-dayhead span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
.cal-dayhead strong { font-family: var(--display); font-size: 1.35rem; }
.cal-dayhead em { display: block; font-style: normal; font-size: .72rem; color: var(--warn); }
.cal-dayhead.today strong { background: var(--wine); color: #fff; border-radius: 999px; padding: 0 9px; }
.cal-time { padding: 10px 8px; font-weight: 700; color: var(--wine); font-size: .85rem; background: var(--pearl); }
.cal-time small { display: block; font-weight: 500; color: var(--muted); }
.cal-cell { padding: 6px; min-height: 86px; }
.cal-cell.today { background: #fffaf8; }
.cal-cell.due { min-height: 48px; background: var(--pearl); }
.ev { height: 100%; border-radius: 8px; padding: 7px 9px; background: var(--tint); border-left: 4px solid var(--tint-line); display: flex; flex-direction: column; gap: 2px; font-size: .82rem; }
.ev b { font-size: .84rem; } .ev span { color: var(--text); line-height: 1.35; } .ev small { color: var(--muted); font-size: .72rem; margin-top: auto; }
.ev.st-planned { background: #fff; border: 1.5px dashed var(--tint-line); border-left-width: 4px; border-left-style: solid; }
.ev.st-partly small::before { content: "◐ "; } .ev.st-taught small::before { content: "✓ "; color: var(--success); }
.ev.st-closed, .ev.st-not_taught { opacity: .55; background: var(--sand); border-left-color: var(--faint); }
.ev.st-not_logged small, .ev.st-past small { color: var(--bad); }
.due-chip { display: block; font-size: .72rem; font-weight: 600; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 3px 7px; margin-bottom: 4px; text-decoration: none; }
.cal-month { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; overflow: hidden; min-width: 700px; }
.cal-mhead { padding: 8px; text-align: center; font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--pearl); border-bottom: 1px solid var(--border); }
.cal-mday { min-height: 118px; padding: 6px; border-right: 1px solid #f0ebe6; border-bottom: 1px solid #f0ebe6; display: flex; flex-direction: column; gap: 3px; }
.cal-mday.out { background: var(--pearl); } .cal-mday.out .num { color: var(--faint); }
.cal-mday .num { font-weight: 700; font-size: .85rem; }
.cal-mday.today .num { background: var(--wine); color: #fff; border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-mday .closed { font-size: .72rem; color: var(--warn); background: var(--warn-bg); border-radius: 6px; padding: 3px 6px; }
.mev { font-size: .7rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; background: var(--tint); border-left: 3px solid var(--tint-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mev.st-planned { background: #fff; border: 1px dashed var(--tint-line); border-left: 3px solid var(--tint-line); }
.mev.st-closed, .mev.st-not_taught { opacity: .5; }
.cal-cols { grid-template-columns: minmax(0, 1fr) 290px; }
.progress-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ev.st-past small { color: var(--faint); } .ev.st-past { opacity: .75; }
.register { display: flex; flex-direction: column; }
.reg-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0ebe6; }
.reg-row > span { flex: 1; }
.reg-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 999px; font-weight: 500; cursor: pointer; }
.reg-chip input { position: absolute; opacity: 0; }
.reg-chip.absent:has(input:checked) { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); font-weight: 700; }
.reg-chip.late:has(input:checked) { background: var(--warn-bg); border-color: var(--amber); color: var(--warn); font-weight: 700; }
.reg-chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
table.tt td { min-width: 150px; } table.tt select { font-size: .85rem; padding: .35rem .5rem; }
table.tt tr.tt-new { background: var(--pearl); }
.ev-chip { display: block; margin-top: 4px; font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--info-bg); color: var(--info); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-chip.kind-exam { background: var(--bad-bg); color: var(--bad); } .ev-chip.kind-meeting { background: var(--success-bg); color: var(--success); }

/* Study tutor stage (SVG tutors from static/js/tutors) */
.tutor-stage { position: relative; height: 250px; flex: 1 1 320px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: #e9eef6 center / cover no-repeat; overflow: hidden; }
.tutor-stage .stage-top { position: absolute; z-index: 3; top: 8px; right: 8px; display: flex; gap: 6px; }
.tutor-stage .stage-top select { width: auto; font-size: .82rem; padding: .3rem .5rem; background: rgba(255,255,255,.92); }
.tutor-stage #puppet { position: absolute; inset: 0; z-index: 2; display: none; align-items: flex-end; justify-content: center; pointer-events: none; }
.tutor-stage #puppet[style*="display: block"] { display: flex !important; }
.tutor-stage #puppet svg { height: 96%; width: auto; max-width: 100%; overflow: visible; pointer-events: auto; filter: drop-shadow(0 6px 10px rgba(40,21,30,.18)); }
@media (prefers-reduced-motion: reduce) { .tutor-stage #puppet svg { filter: none; } }

/* Pages opened inside a My notes tab: no shell */
.in-frame .sidebar, .in-frame .topbar, .in-frame .strip, .in-frame .footer { display: none !important; }
.in-frame .workspace { margin-left: 0; } .in-frame .content { padding: 16px 18px 28px; max-width: none; }
.in-frame .back { display: none; }
/* My notes workspace */
.ws { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: stretch; height: calc(100vh - 250px); min-height: 520px; }
@media (max-width: 1000px) { .ws { grid-template-columns: minmax(0, 1fr); height: auto; } .ws-panes { height: 75vh; } }
.ws-tree { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; overflow-y: auto; }
.ws-subject summary { padding: 8px 6px; font-weight: 700; display: flex; gap: 8px; align-items: center; border-radius: 8px; }
.ws-subject summary:hover { background: var(--pearl); }
.ws-folder, .ws-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 4px 8px 4px 26px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-weight: 500; font-size: .88rem; text-align: left; cursor: pointer; }
.ws-folder span { flex: 1; } .ws-folder b { font-size: .75rem; color: var(--muted); font-weight: 600; }
.ws-folder:hover, .ws-item:hover { background: var(--rose); color: var(--wine); }
.ws-folder.on { background: var(--rose-2); color: var(--wine); font-weight: 700; }
.ws-list { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; }
.ws-list-head { padding: 4px 6px 8px; font-size: .85rem; }
.ws-row { display: flex; align-items: center; }
.ws-row .ws-item { padding-left: 8px; } .ws-item span { display: flex; flex-direction: column; min-width: 0; }
.ws-item small { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-side { border: 0; background: none; min-height: 32px; padding: 0 8px; color: var(--muted); cursor: pointer; font-size: 1rem; }
.ws-side:hover { color: var(--wine); background: var(--rose); }
.ws-newform { display: flex; gap: 6px; padding: 0 6px 8px; } .ws-newform input, .ws-newform select { min-width: 0; font-size: .82rem; padding: .35rem .5rem; }
.ws-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; }
.ws-panes.split { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .ws-panes.split { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 1fr; } }
.ws-pane { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.ws-pane.focus { border-color: #c79caf; box-shadow: 0 0 0 2px var(--rose); }
.ws-tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--pearl); border-bottom: 1px solid var(--border); overflow-x: auto; min-height: 42px; }
.ws-tab { display: flex; align-items: center; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: transparent; flex: 0 0 auto; }
.ws-tab.on { background: #fff; border-color: var(--border); margin-bottom: -1px; }
.ws-tab > button { border: 0; background: none; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600; min-height: 34px; padding: 0 8px; cursor: pointer; }
.ws-tab.on > button:first-child { color: var(--wine); }
.ws-tab .ws-x { padding: 0 6px; font-weight: 400; } .ws-tab .ws-x:hover { color: var(--bad); }
.ws-body { flex: 1; min-height: 0; position: relative; }
.ws-body .empty { margin: 16px; }
.ws-frame { width: 100%; height: 100%; border: 0; display: block; }
.doc-frame { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 10px; }
button.quiet[aria-pressed="true"] { background: var(--rose); color: var(--wine); border-color: #d7c4cc; }

/* ===== Study notebook (NotebookLM-style), app layout ===== */
.nb-page.content { padding-top: 18px; padding-bottom: 16px; }
.nb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 16px; margin-bottom: 12px; }
.nb-head h1 { font-size: 1.55rem; margin: 2px 0 0; } .nb-head .back { margin: 0; } .nb-head .meta { margin: 2px 0 0; }
.nb-tabs { display: none; gap: 4px; padding: 4px; margin-bottom: 10px; background: var(--sand); border-radius: 12px; }
.nb-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); min-height: 40px; border-radius: 9px; font-size: .88rem; }
.nb-tabs [aria-selected="true"] { background: #fff; color: var(--wine); box-shadow: 0 1px 3px rgba(40,21,30,.1); }
.nb3 { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 14px; height: calc(100vh - 205px); min-height: 560px; }
.nb3.right-wide { grid-template-columns: minmax(0, 1fr) minmax(460px, 48%); } .nb3.right-wide .nb-sources { display: none; }
.nb-pane { background: #fff; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.pane-scroll { flex: 1; overflow-y: auto; padding: 14px; min-height: 0; } .pane-scroll[hidden] { display: none; }
@media (max-width: 1179px) {
  .nb-tabs { display: flex; }
  .nb3, .nb3.right-wide { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 250px); }
  .nb3 > .nb-pane { display: none; }
  .nb3[data-show="sources"] .nb-sources, .nb3[data-show="chat"] .nb-chat, .nb3[data-show="right"] .nb-right { display: flex; }
}
/* chat */
.tutor-strip { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--pearl); }
.tutor-strip[hidden] { display: none; }
.tutor-stage.mini { flex: 0 0 136px; height: 116px; border-radius: 10px; }
.tutor-info { display: flex; flex-direction: column; min-width: 0; } .tutor-info select { width: auto; font-size: .82rem; padding: .3rem .5rem; }
.memory { margin: 8px 14px 0; font-size: .85rem; } .memory p { margin: .4rem 0 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 18px; min-height: 0; }
.chat { display: flex; flex-direction: column; gap: 18px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; color: var(--muted); padding: 40px 20px; }
.chat-empty svg { color: var(--wine); } .chat-empty b { color: var(--text); font-family: var(--display); }
.turn .q { margin-left: auto; max-width: 82%; width: fit-content; background: var(--wine); color: #fff; border-radius: 16px 16px 4px 16px; padding: .55rem .9rem; line-height: 1.5; }
.turn .a { margin-top: 8px; max-width: 95%; background: var(--ivory); border: 1px solid #efe7df; border-radius: 4px 16px 16px 16px; padding: .75rem .95rem; }
.turn.forgotten { opacity: .5; }
.answer { font-size: .97rem; line-height: 1.65; }
.sample-tag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--warn); background: var(--warn-bg); border: 1px dashed #d8b37a; border-radius: 999px; padding: 1px 9px; margin-bottom: 6px; cursor: help; }
.answer .cite-btn { font-size: .68rem; font-weight: 700; padding: 0 5px; min-height: 0; line-height: 1.35; vertical-align: 2px; margin: 0 2px; border-radius: 5px; border: 1px solid #d7b9c5; background: #fff; color: var(--wine); }
.answer .cite-btn:hover { background: var(--rose); }
.a-foot { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.a-meta { font-size: .74rem; }
.a-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -6px; } .a-actions[hidden] { display: none; }
.act { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.act:hover { background: var(--rose); color: var(--wine); } .act.done { color: var(--success); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; } .typing i { width: 7px; height: 7px; border-radius: 50%; background: #c7a9b6; animation: nbdot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes nbdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } }
.composer { border-top: 1px solid var(--border); padding: 10px 12px 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.composer .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; } .composer .chip { flex: 0 0 auto; }
.ask-box { border: 1px solid var(--border-2); border-radius: 14px; padding: 6px 8px 6px 12px; background: #fff; }
.ask-box:focus-within { border-color: #c79caf; box-shadow: 0 0 0 3px var(--rose); }
.ask-box textarea { border: 0; outline: 0; resize: none; width: 100%; max-width: none; padding: 6px 0; min-height: 30px; font-size: .97rem; background: transparent; }
.ask-box textarea:focus { outline: 0; box-shadow: none; }
.ask-tools { display: flex; align-items: center; gap: 4px; } .ask-tools .icon-btn { width: 36px; height: 36px; }
.send { min-height: 38px; border-radius: 10px; padding: 0 14px; }
.file-chip { font-size: .75rem; background: var(--sand); border-radius: 999px; padding: 2px 9px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* sources */
.pane-headrow { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pane-headrow h2 { font-size: 1rem; margin: 0; }
.count { font-size: .72rem; background: var(--sand); color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-left: 4px; font-weight: 700; font-style: normal; }
.src { display: flex; align-items: flex-start; gap: 8px; padding: 9px 6px; border-radius: 10px; }
.src:hover { background: var(--pearl); } .src input { margin-top: 3px; flex: 0 0 auto; }
.src-ic { color: var(--muted); margin-top: 1px; } .src-main { flex: 1; min-width: 0; margin: 0; font-weight: 500; cursor: pointer; }
.src-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; line-height: 1.35; }
.src small { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; } .src .bad { color: var(--bad); }
.src.off .src-title { color: var(--faint); text-decoration: line-through; }
.src-act { display: flex; opacity: .55; } .src:hover .src-act, .src:focus-within .src-act { opacity: 1; }
.src-act .icon-btn { width: 30px; height: 30px; font-size: 1.1rem; }
@media (hover: none) { .src-act { opacity: 1; } }
/* right pane */
.rtabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--pearl); }
.rtabs button { flex: 1; border: 0; background: transparent; color: var(--muted); min-height: 36px; border-radius: 8px; font-size: .85rem; gap: 6px; }
.rtabs button:hover { background: #fff; color: var(--wine); }
.rtabs [aria-selected="true"] { background: #fff; color: var(--wine); box-shadow: 0 1px 2px rgba(40,21,30,.08); }
.studio-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { flex-direction: column; min-height: 72px; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: .8rem; font-weight: 600; border-radius: 12px; padding: 8px; }
.tile svg { color: var(--wine); } .tile:hover { background: var(--rose); border-color: #e2c7d1; color: var(--wine); }
.pane-h { font-size: .86rem; font-weight: 700; color: var(--muted); margin: 16px 0 8px; }
.out-list { display: flex; flex-direction: column; gap: 6px; }
.out-card { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 10px; text-align: left; font-weight: 500; justify-content: flex-start; }
.out-card:hover { border-color: #d7c4cc; background: var(--pearl); color: var(--text); }
.out-ic { color: var(--wine); display: inline-flex; } .out-main { flex: 1; display: flex; flex-direction: column; }
.out-main small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.pane-sub { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.nb-right .mindmap { height: 380px; } .nb-right .output-body h2 { font-size: 1.05rem; }
.note-frame { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 10px; } .note-frame[hidden] { display: none; }
.note-frame iframe { flex: 1; width: 100%; border: 0; border-radius: 8px; background: #fff; }
.note-title { flex: 1; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-tools input[type=search] { max-width: none; }
.chip.on { background: var(--rose); color: var(--wine); border-color: #d7c4cc; }
.notes-tools .chips { margin-top: 8px; }
.new-note { display: flex; gap: 6px; margin: 10px 0; } .new-note input { flex: 1; min-width: 0; } .new-note select { width: 110px; }
.note-list { display: flex; flex-direction: column; gap: 6px; }
.note-card { display: flex; align-items: flex-start; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.note-open { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; border: 0; background: transparent; color: var(--text); padding: 10px 12px; font-weight: 500; min-height: 0; justify-content: flex-start; }
.note-open:hover { background: var(--pearl); color: var(--text); }
.note-open small { color: var(--muted); font-size: .76rem; font-weight: 400; line-height: 1.4; }
.note-tags i { font-style: normal; font-size: .7rem; color: var(--wine); background: var(--rose); border-radius: 999px; padding: 0 6px; margin-right: 4px; }
.notes-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
/* dialogs */
.nb-dialog { border: 0; border-radius: 16px; padding: 18px; width: min(520px, 92vw); box-shadow: 0 20px 60px rgba(40,21,30,.25); color: var(--text); }
.nb-dialog.wide { width: min(920px, 94vw); } .nb-dialog::backdrop { background: rgba(40,21,30,.35); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dlg-head h2 { margin: 0; font-size: 1.15rem; } .dlg-head .icon-btn { font-size: 1.4rem; }
.nb-dialog .rtabs { margin: 0 -18px 14px; border-top: 1px solid var(--border); }
.nb-dialog form[hidden] { display: none; }
.nb-graph { height: 60vh; border: 1px solid var(--border); border-radius: 12px; }
.nb-chat { container-type: inline-size; }
@container (max-width: 620px) {
  .act span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .act { padding: 0 9px; min-width: 36px; justify-content: center; }
}

/* note editor inside a tab or the notebook's notes pane */
.in-frame .crumb { display: none; }
.in-frame h1 { font-size: 1.35rem; }
.in-frame .toolbar { gap: 4px; } .in-frame .toolbar button, .in-frame .toolbar .btn { min-height: 32px; padding: .2rem .55rem; font-size: .78rem; }
.in-frame .note-layout { grid-template-columns: minmax(0, 1fr); } .in-frame .note-layout > aside { display: none; }
.note-frame .pane-sub { flex-wrap: wrap; } .note-frame .note-title { order: -1; flex: 1 1 100%; font-size: .95rem; }
/* calendar day view (Google-style) */
a.cal-dayhead { display: block; text-decoration: none; color: inherit; } a.cal-dayhead:hover { background: var(--rose); }
.cal-mday a.num { color: inherit; text-decoration: none; border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; }
.cal-mday a.num:hover { background: var(--rose); color: var(--wine); }
.cal-mday.today a.num { background: var(--wine); color: #fff; }
.cal-day { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cal-day { grid-template-columns: minmax(0, 1fr); } }
.cal-day-main { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 18px; }
.cal-allday { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.cal-allday .ev-chip, .cal-allday .due-chip { display: inline-block; margin: 0; font-size: .78rem; padding: 4px 10px; }
.cal-dayline { position: relative; margin-left: 60px; margin-top: 10px; }
.cal-dayline .hr { position: absolute; left: 0; right: 0; border-top: 1px solid #efe9e3; }
.cal-dayline .hr span { position: absolute; left: -58px; top: -9px; font-size: .75rem; color: var(--faint); width: 48px; text-align: right; }
.now-line { position: absolute; left: -6px; right: 0; border-top: 2px solid var(--bad); z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.day-ev { position: absolute; left: 6px; right: 8px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; padding: 6px 10px; border-radius: 8px; border: 0; border-left: 4px solid var(--tint-line); background: var(--tint); color: var(--text); text-align: left; font-weight: 500; overflow: hidden; min-height: 0; }
.day-ev:hover { filter: brightness(.97); color: var(--text); background: var(--tint); }
.day-ev.sel { box-shadow: 0 0 0 2px var(--wine); }
.day-ev b { font-size: .9rem; } .day-ev .t { font-size: .74rem; color: var(--muted); } .day-ev .topic { font-size: .82rem; }
.day-ev small { font-size: .72rem; color: var(--muted); margin-top: auto; }
.day-ev.st-planned { background: #fff; border: 1.5px dashed var(--tint-line); border-left: 4px solid var(--tint-line); }
.day-ev.st-closed, .day-ev.st-not_taught { opacity: .55; }
.day-ev.st-taught small::before { content: "✓ "; color: var(--success); } .day-ev.st-partly small::before { content: "◐ "; }
.cal-day-side { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; position: sticky; top: 90px; }
/* tutor window size */
.tutor-stage.mini { flex: 0 0 210px; height: 184px; }
.tutor-strip[data-size="s"] .tutor-stage.mini { flex-basis: 140px; height: 120px; }
.tutor-strip[data-size="l"] { flex-direction: column; align-items: stretch; }
.tutor-strip[data-size="l"] .tutor-stage.mini { flex: 0 0 auto; width: 100%; height: 300px; }
.size-switch { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.size-switch button { border: 0; border-radius: 0; min-height: 30px; padding: 0 10px; background: #fff; color: var(--muted); font-size: .78rem; }
.size-switch button + button { border-left: 1px solid var(--border-2); }
.size-switch [aria-pressed="true"] { background: var(--wine); color: #fff; }
.day-detail { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }

/* learn */
.learn-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.learn-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); }
.learn-tile svg { color: var(--wine); } .learn-tile b { font-family: var(--display); font-size: 1.05rem; } .learn-tile span { font-size: .85rem; color: var(--muted); }
.learn-tile:hover { border-color: #d7c4cc; background: #fffdfb; }
.flip { text-align: center; max-width: 640px; margin: 0 auto; padding: 32px; }
.flip-front { font-family: var(--display); font-size: 1.5rem; font-weight: 700; } .flip-back { margin-top: 1rem; font-size: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--border-2); }
.rate .row { justify-content: center; } .rate { margin-top: 1rem; }
.timer { font-family: var(--display); font-size: 5rem; font-weight: 800; text-align: center; letter-spacing: -.03em; color: var(--wine); margin: 18px 0 4px; }
.week-row { display: grid; grid-template-columns: 34px 1fr 32px; gap: 8px; align-items: center; margin: 6px 0; font-size: .85rem; }
.score-ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--wine) calc(var(--p) * 1%), var(--sand) 0); }
.score-ring b { width: 64px; height: 64px; border-radius: 50%; background: var(--page); display: grid; place-items: center; font-family: var(--display); font-size: 1.4rem; }
.q-card.ok { border-left: 4px solid var(--success); } .q-card.no { border-left: 4px solid var(--bad); }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 10px; align-items: center; margin: 0; font-weight: 400; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--wine); background: var(--rose); }
.opt.right { border-color: var(--success); background: var(--success-bg); } .opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.countdown { font-family: var(--display); font-size: 1.8rem; font-weight: 800; padding: 6px 16px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.countdown.low { color: var(--bad); border-color: var(--bad); }
.ew-signals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; } .ew.done { opacity: .65; }
.plan-step { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); } .plan-step:first-of-type { border-top: 0; } .plan-step .mins { font-weight: 700; color: var(--wine); } .plan-step p { margin: .25rem 0 0; }
@media print { .sidebar, .topbar, .strip, .head-actions, .back, aside .side-card:last-child { display: none !important; } .workspace { margin: 0; } }

/* low data mode: no background images, animated tutor or animations */
.low-data .tutor-strip, .low-data .tutor-stage { display: none !important; }
.low-data *, .low-data *::before, .low-data *::after { animation: none !important; transition: none !important; }
.low-data .kstage { background-image: none !important; }
.offline-bar { position: sticky; top: 0; z-index: 50; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #e8cfa4; padding: 8px 18px; font-size: .88rem; font-weight: 600; }
.offline-bar[hidden] { display: none; }

/* exam lock screen */
.lock-body { background: var(--page); min-height: 100vh; }
.lock-wrap { max-width: 760px; margin: 0 auto; padding: 28px 18px; }
.lock-card { padding: 22px; }
.lock-note { margin: 14px 0 0; padding: 10px 14px; background: var(--rose); color: var(--wine); border-radius: 10px; font-weight: 600; font-size: .92rem; }
.upload-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 2px dashed #d7c4cc; border-radius: 14px; cursor: pointer; text-align: center; color: var(--wine); font-weight: 500; }
.upload-drop:hover { background: var(--rose); }
.page-list { margin: 0; padding-left: 1.4rem; } .page-list li { display: flex; align-items: center; gap: 10px; padding: 4px 0; } .page-list li a { flex: 1; }

/* who has submitted */
.sub-visual { margin-bottom: 16px; }
.sv-top { display: grid; grid-template-columns: auto 1fr minmax(220px, 300px); gap: 22px; align-items: center; margin-bottom: 16px; }
@media (max-width: 900px) { .sv-top { grid-template-columns: auto 1fr; } .sv-timeline { grid-column: 1 / -1; } }
.ring { --p: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: conic-gradient(var(--success) calc(var(--p) * 1%), var(--sand) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.ring b, .ring span { position: relative; } .ring b { font-family: var(--display); font-size: 1.6rem; line-height: 1; } .ring b small { font-size: .9rem; color: var(--muted); }
.ring span { font-size: .72rem; color: var(--muted); }
.sv-legend { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; }
.lg { display: flex; align-items: center; gap: 8px; } .lg i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); } .lg b { margin-left: auto; padding-left: 10px; }
.st-submitted { --c: #2f7a55; --bg: #e7f3ec; } .st-on_screen { --c: #c08a1e; --bg: #fbf1dc; } .st-not_seen { --c: #a59a93; --bg: #f3f0ec; }
.st-absent { --c: #a8324a; --bg: #f8e4e8; } .st-released { --c: #3b5f8a; --bg: #e6edf6; }
.sv-timeline .bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; border-bottom: 1px solid var(--border); }
.sv-timeline .bars span { flex: 1; background: var(--wine); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.sv-timeline .axis { display: flex; justify-content: space-between; font-size: .7rem; color: var(--faint); margin-top: 2px; }
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 6px; border-radius: 12px; background: var(--bg); border: 1.5px solid var(--c); color: var(--text); text-decoration: none; text-align: center; }
.seat b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: .8rem; margin-bottom: 3px; }
.seat .nm { font-size: .82rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat small { font-size: .7rem; color: var(--muted); } .seat:hover { filter: brightness(.97); }
.seat.st-on_screen b { animation: seatpulse 2s infinite; } @keyframes seatpulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .seat.st-on_screen b { animation: none; } }
.script-row { display: grid; grid-template-columns: 220px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.script-row:first-child { border-top: 0; } .script-who { display: flex; flex-direction: column; } @media (max-width: 800px) { .script-row { grid-template-columns: minmax(0, 1fr); } }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 84px; text-decoration: none; color: var(--muted); font-size: .7rem; }
.thumb img, .thumb .pdf { width: 84px; height: 108px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.thumb .pdf { display: grid; place-items: center; font-weight: 800; color: var(--bad); }
.thumb.late img, .thumb.late .pdf { border: 2px solid var(--amber); }
.sv-legend { max-width: 340px; }

/* exam correction review */
.review-split { display: grid; grid-template-columns: minmax(280px, 42%) 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .review-split { grid-template-columns: minmax(0, 1fr); } }
.pages-col { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.pages-col img { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; } .pages-col figure { margin: 0; }
.qm.lowq { border-left: 4px solid var(--amber); } .qm.unmarked { border-left: 4px solid var(--bad); }
.conf { display: inline-block; width: 70px; height: 8px; border-radius: 99px; background: var(--sand); vertical-align: middle; overflow: hidden; }
.conf i { display: block; height: 100%; } .conf.hic i { background: var(--success); } .conf.midc i { background: var(--amber); } .conf.lowc i { background: var(--bad); }
.conf-tag { font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 2px 8px; }
.conf-tag.hic { background: var(--success-bg); color: var(--success); } .conf-tag.midc { background: var(--warn-bg); color: var(--warn); } .conf-tag.lowc { background: var(--bad-bg); color: var(--bad); }
.paper-qs li { margin: 0 0 12px; } .paper-qs ol { margin: 6px 0 0; }

.pq .pq-no { color: var(--wine); } .pq .pq-text { font-weight: 500; }
.pq-key { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 10px 0 6px; font-size: .88rem; }
.pq-key dt { color: var(--muted); font-weight: 600; } .pq-key dd { margin: 0; }
.opts-field { display: none; } form:has(select[name="qtype"] option[value="mcq"]:checked) .opts-field { display: block; }

/* exam screen header */
.lock-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; }
.lock-brand .logo { width: 132px; color: var(--wine); }
.lock-note svg { vertical-align: -2px; }

.pin-mark { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--wine); }
.kpi strong.streak { display: flex; align-items: center; gap: 6px; } .kpi strong.streak svg { color: #c2541b; }
.pill svg, .btn svg, button svg { vertical-align: -2px; }

/* homework correction review: verdict, full-width feedback, save */
.corr-form { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; margin-top: 8px; }
.corr-form label { margin: 0; font-size: .84rem; color: var(--muted); }
.corr-form select, .corr-form textarea { margin-top: 4px; max-width: none; }
.corr-form textarea { min-height: 44px; resize: vertical; }
@media (max-width: 760px) { .corr-form { grid-template-columns: minmax(0, 1fr); } }

/* ---------- photo register: green ring present, red absent, amber late ---------- */
.register-form { --present: #2f7a52; --absent: #b3263f; --late: #b7791f; --excused: #6f6a73; }
.reg-bar { position: sticky; top: 68px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 16px;
  margin: 0 0 6px; background: var(--pearl); border: 1px solid var(--border); border-radius: 12px; }
.tally { font-size: .95rem; color: var(--muted); } .tally b { font-size: 1.35rem; margin-right: 4px; font-variant-numeric: tabular-nums; }
.t-present b { color: var(--present); } .t-absent b { color: var(--absent); } .t-late b { color: var(--late); }
.reg-bar [data-all-present] { margin-left: auto; }
.reg-help { margin: 4px 0 14px; }
.faces { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px 10px; }
.face { position: relative; text-align: center; border-radius: 16px; }
.face-btn { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
  padding: 12px 6px 10px; border-radius: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.face-btn:hover { background: #f4eee9; } .face-btn:focus-visible { outline: 3px solid var(--wine); outline-offset: 2px; }
.face-ring { position: relative; display: inline-grid; place-items: center; width: 88px; height: 88px; border-radius: 50%;
  box-shadow: 0 0 0 4px var(--ring, var(--present)); margin-bottom: 8px; transition: box-shadow .15s ease; }
.face-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; display: block; background: #e9e2dc; }
.face-initials { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; }
.face-badge { position: absolute; right: -4px; bottom: -4px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ring, var(--present)); color: #fff; border: 3px solid #fff; font-weight: 800; font-size: .8rem; }
.face-badge > span { display: none; } .face-badge svg { stroke-width: 3; }
.face-name { font-weight: 700; font-size: .95rem; line-height: 1.2; color: var(--text); }
.face-sur { font-size: .8rem; color: var(--muted); line-height: 1.2; min-height: 1em; }
.face-state { font-size: .78rem; font-weight: 800; min-height: 1.1em; color: var(--ring); text-transform: none; }
.face.st-present { --ring: var(--present); } .face.st-present .b-present { display: grid; }
.face.st-absent { --ring: var(--absent); background: #fbe9ec; } .face.st-absent .b-absent { display: grid; }
.face.st-absent .face-img { filter: grayscale(.55); opacity: .8; }
.face.st-late { --ring: var(--late); background: #fbf1df; } .face.st-late .b-late { display: grid; }
.face.st-excused { --ring: var(--excused); } .face.st-excused .b-excused { display: grid; }
.face-choice { border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; font-size: .8rem; }
.face-choice label { display: inline-flex; gap: 4px; margin: 0; font-weight: 500; }
html.js .face-choice { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html:not(.js) .face-btn { pointer-events: none; }
.face .pill { margin-top: 2px; }
.reg-save { position: sticky; bottom: 0; padding: 14px 0 6px; background: linear-gradient(transparent, var(--page) 35%); margin-top: 8px; }
.reg-save button { width: 100%; max-width: 360px; }
@media (max-width: 767px) { .reg-bar { top: 56px; } .reg-save { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .faces { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } .face-ring { width: 72px; height: 72px; } .face-img { width: 64px; height: 64px; } }
@media (prefers-reduced-motion: reduce) { .face-ring { transition: none; } }

/* notifications */
.notify-list { padding: 6px; }
.notify-item { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 10px; color: var(--text); text-decoration: none; }
.notify-item + .notify-item { border-top: 1px solid var(--border); border-radius: 0; }
.notify-item:hover { background: var(--pearl); color: var(--text); }
.notify-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: transparent; }
.notify-item.unread .notify-dot { background: var(--wine); }
.notify-item.unread b { font-weight: 800; }
.notify-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notify-main b { font-weight: 600; }
.notify-kind { font-size: .78rem; font-weight: 700; color: var(--muted); }
.notify-when { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }

/* personal calendar */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-bar .btn:first-child svg { transform: rotate(180deg); }
.add-entry { padding: 12px 16px; margin-bottom: 14px; } .add-entry summary { cursor: pointer; }
.add-entry-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 10px; }
.add-entry-form label { margin: 0; font-size: .84rem; } .add-entry-form input { margin-top: 4px; }
.add-entry-form .wide-field { grid-column: 1 / -2; }
@media (max-width: 900px) { .add-entry-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .add-entry-form .wide-field { grid-column: 1 / -1; } }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-week.one { grid-template-columns: minmax(0, 1fr); max-width: 720px; }
@media (max-width: 1100px) { .cal-week { grid-template-columns: minmax(0, 1fr); } }
.cal-col { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.cal-col.today { border-color: var(--wine); box-shadow: inset 0 3px 0 var(--wine); }
.cal-colhead { font-size: .9rem; margin: 0 0 4px; } .cal-colhead a { color: var(--text); text-decoration: none; } .cal-colhead span { color: var(--muted); font-weight: 600; }
.cal-item { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 7px 26px 7px 9px; border-radius: 8px; border-left: 4px solid var(--c, var(--border-2)); background: var(--bg, var(--pearl)); font-size: .84rem; }
.cal-item b { font-weight: 700; line-height: 1.3; } .cal-item a { color: var(--text); text-decoration: none; } .cal-item a:hover { text-decoration: underline; }
.cal-item .meta { font-size: .76rem; }
.ci-time { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; background: none; border: 0; padding: 0; }
.cal-del { position: absolute; top: 2px; right: 2px; } .cal-del .icon-btn { width: 28px; height: 28px; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: .76rem; font-weight: 600; background: var(--bg, var(--sand)); color: var(--c, var(--text)); }
.chip a { color: inherit; } .chip span { font-weight: 500; }
.cal-empty { margin: 4px 0 0; font-size: .8rem; }
.cal-legend { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ci-taught, .ci-done { --c: #2f6f52; --bg: #e8f2ec; } .ci-partly, .ci-not_logged { --c: #85560f; --bg: #fbf1e1; }
.ci-planned, .ci-past, .ci-period { --c: #8a7f84; --bg: #f6f2ee; } .ci-due { --c: #6c1f3d; --bg: #f4e8ed; } .ci-late { --c: #9e2a3f; --bg: #fbe9ec; }
.ci-exam { --c: #34466e; --bg: #edf1f7; } .ci-cover { --c: #5b3f8c; --bg: #efeaf7; } .ci-meeting { --c: #1f6b6b; --bg: #e6f3f3; }
.ci-personal { --c: #a2486c; --bg: #fbeef3; } .ci-closed, .ci-away, .ci-not_taught { --c: #6f6368; --bg: #ece8e4; } .ci-event { --c: #34466e; --bg: #edf1f7; }
.cal-month { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.cal-mrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mday { min-height: 96px; padding: 6px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; color: var(--text); text-decoration: none; overflow: hidden; }
.cal-mday:hover { background: var(--pearl); color: var(--text); } .cal-mday.other { opacity: .5; } .cal-mday.today b { color: var(--wine); }
.cal-mday .chip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* AI allowance meter */
.allow-card { display: block; margin: 0 2px 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); text-decoration: none; }
.allow-card:hover { border-color: var(--border-2); color: var(--text); }
.allow-top { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; } .allow-top span { color: var(--muted); font-weight: 600; }
.allow-card small { display: block; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.allow-bar { display: block; height: 6px; border-radius: 999px; background: var(--sand); overflow: hidden; margin-top: 6px; }
.allow-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--success); }
.allow-bar.big { height: 12px; }
.low .allow-bar > span, .allow-bar.low > span { background: var(--amber); } .out .allow-bar > span, .allow-bar.out > span { background: var(--bad); }
.allow-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--success); background: var(--success-bg); text-decoration: none; }
.allow-pill.low { color: var(--warn); background: var(--warn-bg); } .allow-pill.out { color: var(--bad); background: var(--bad-bg); }
.allow-hero-num b { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; } .allow-hero-num span { display: block; color: var(--muted); }
@media (max-width: 1179px) { .sidebar:not(.open) .allow-card { display: none; } }
@media (max-width: 767px) { .sidebar .allow-card { display: block; } .allow-pill span:not(.visually-hidden) { display: none; } }


.voice-form select, .voice-form input[type=range] { max-width: 520px; width: 100%; } .voice-form output { color: var(--muted); font-weight: 600; margin-left: 6px; }

/* waiting and typing */
@keyframes kspin { to { transform: rotate(360deg); } }
.ai-wait { display: inline-flex; align-items: center; gap: 10px; }
.ai-wait::before { content: ""; flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rose); border-top-color: var(--wine); animation: kspin .8s linear infinite; }
.ai-wait::after { content: ""; width: 1.2em; text-align: left; animation: kdots 1.2s steps(4, end) infinite; }
@keyframes kdots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
button.is-busy, .btn.is-busy, button.htmx-request:not(.icon-btn), form.htmx-request button:not([type=button]):not(.icon-btn), a.btn.htmx-request { pointer-events: none; opacity: .85; }
button.is-busy::before, .btn.is-busy::before, button.htmx-request:not(.icon-btn)::before, form.htmx-request button:not([type=button]):not(.icon-btn)::before, a.btn.htmx-request::before {
  content: ""; display: inline-block; width: .9em; height: .9em; margin-right: .5em; vertical-align: -.12em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: kspin .7s linear infinite; }
.is-typing::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -.15em; background: var(--wine); animation: kcaret .9s steps(1) infinite; }
@keyframes kcaret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ai-wait::before, .is-busy::before, .htmx-request::before { animation: none; } .ai-wait::after { content: "..."; animation: none; } .is-typing::after { animation: none; } }

/* top progress bar and the chat typing bubble */
.kbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, transparent 0, var(--wine) 30%, #c2547d 50%, var(--wine) 70%, transparent 100%); background-size: 50% 100%; background-repeat: no-repeat; }
.kbar.on { opacity: 1; animation: kbarmove 1.1s ease-in-out infinite; }
@keyframes kbarmove { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.typing-bubble { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: var(--rose-2); color: var(--wine); font-size: .86rem; font-weight: 600; }
.typing-bubble .typing i { background: var(--wine); }
@media (prefers-reduced-motion: reduce) { .kbar.on { animation: none; background: var(--wine); } }

/* AI question paper */
.ai-paper { padding: 14px 18px; margin-bottom: 14px; } .ai-paper summary { cursor: pointer; }
.ai-paper-form fieldset { border: 0; padding: 0; margin: 12px 0 0; } .ai-paper-form legend { font-weight: 700; margin-bottom: 6px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 14px; }
.chapter-grid label { margin: 0; font-weight: 400; font-size: .9rem; }
.division input, .division select { max-width: 160px; } .division td, .division th { padding: 6px 8px; }

/* library picker */
.lib-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; } .lib-filters label { margin: 0; font-size: .84rem; flex: 1 1 160px; }
.lib-filters select { margin-top: 4px; }
.lib-items { list-style: none; margin: 10px 0 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.lib-items li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.lib-items li:first-child { border-top: 0; } .lib-items label { margin: 0; }
.chosen-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; } .chosen-sources .chip { background: var(--rose-2); color: var(--wine); }

.mindmap.flowchart { height: 560px; } .flow-text { margin-top: 6px; } .flow-text ol { margin: .4rem 0 0; }

.weak-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); } .weak-row:first-of-type { border-top: 0; } .weak-row .meta { display: block; }

/* study planner */
.plan-task { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.plan-task:first-of-type { border-top: 0; } .plan-task .meta { display: block; }
.plan-task.done b { text-decoration: line-through; color: var(--muted); }
.task-tick { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 8px; border: 2px solid var(--border-2); background: #fff; color: #fff; display: grid; place-items: center; }
.plan-task.done .task-tick { background: var(--success); border-color: var(--success); }
.plan-day { font-size: .95rem; margin: 14px 0 4px; color: var(--muted); }
.ci-study { --c: #5b3f8c; --bg: #efeaf7; }
/* AI timetable */
.tt-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 14px; counter-reset: s; }
.tt-steps li { counter-increment: s; padding: 6px 12px; border-radius: 999px; background: var(--sand); color: var(--muted); font-weight: 600; font-size: .84rem; }
.tt-steps li::before { content: counter(s) ". "; } .tt-steps li.on { background: var(--wine); color: #fff; }
.tt-limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; margin-bottom: 10px; } .tt-limits label { margin: 0; font-size: .86rem; }
.tt-grid td { min-width: 110px; vertical-align: top; } .tt-grid td b, .tt-grid td small { display: block; } .tt-grid td small { color: var(--muted); }
.tt-grid td.tt-buffer { background: #efeaf7; } .tt-grid td.tt-buffer b { color: #5b3f8c; }

.catch-card h3 { font-size: .95rem; margin: 14px 0 6px; } .buffer-row { justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }

.lesson-note { margin: .4rem 0 0; padding: 8px 12px; border-left: 3px solid var(--amber); background: #fff8ec; border-radius: 0 8px 8px 0; font-size: .9rem; }
.catch-summary { margin: .6rem 0 0; padding: 10px 14px; background: var(--pearl); border-radius: 10px; }
