/* Moodle+  —  one brand color, generous space, quiet surfaces. */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #A1A1A6;
  --line: #E3E3E8;
  --brand: #3B4BD8;
  --brand-ink: #FFFFFF;
  --brand-soft: #ECEEFC;
  --danger: #C4314B;
  --danger-soft: #FBEAEE;
  --ok: #1E7F4F;
  --ok-soft: #E6F4EC;
  --warn: #9A6200;
  --warn-soft: #FFF4DC;
  --warn-ink: #5C3B00;
  --fill: rgba(0, 0, 0, .05);      /* quiet button / chip background */
  --fill-2: rgba(0, 0, 0, .09);    /* hover, tracks */
  --toast: #1D1D1F;
  --toast-ink: #FFFFFF;
  --chip-on: #1D1D1F;              /* selected tab */
  --chip-on-ink: #FFFFFF;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 29, 31, .04), 0 8px 24px rgba(29, 29, 31, .06);
  --shadow-pop: 0 12px 40px rgba(29, 29, 31, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-md: 17px;
  --fs-lg: 22px;
  --fs-xl: 30px;
  --fs-2xl: 44px;
  color-scheme: light;
}

/* dark mode: follows the system unless the user picked a theme (html[data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E10;
    --surface: #1C1C1F;
    --ink: #F2F2F4;
    --ink-2: #A1A1A8;
    --ink-3: #6C6C73;
    --line: #2E2E33;
    --brand: #5E6CF5;
    --brand-soft: rgba(94, 108, 245, .18);
    --danger: #FF5C70;
    --danger-soft: rgba(255, 92, 112, .15);
    --ok: #34C77B;
    --ok-soft: rgba(52, 199, 123, .15);
    --warn: #F2B544;
    --warn-soft: rgba(242, 181, 68, .14);
    --warn-ink: #F7D58F;
    --fill: rgba(255, 255, 255, .07);
    --fill-2: rgba(255, 255, 255, .12);
    --toast: #F2F2F4;
    --toast-ink: #111113;
    --chip-on: #F2F2F4;
    --chip-on-ink: #111113;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E10;
  --surface: #1C1C1F;
  --ink: #F2F2F4;
  --ink-2: #A1A1A8;
  --ink-3: #6C6C73;
  --line: #2E2E33;
  --brand: #5E6CF5;
  --brand-soft: rgba(94, 108, 245, .18);
  --danger: #FF5C70;
  --danger-soft: rgba(255, 92, 112, .15);
  --ok: #34C77B;
  --ok-soft: rgba(52, 199, 123, .15);
  --warn: #F2B544;
  --warn-soft: rgba(242, 181, 68, .14);
  --warn-ink: #F7D58F;
  --fill: rgba(255, 255, 255, .07);
  --fill-2: rgba(255, 255, 255, .12);
  --toast: #F2F2F4;
  --toast-ink: #111113;
  --chip-on: #F2F2F4;
  --chip-on-ink: #111113;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); font-weight: 800; }
h2 { font-size: var(--fs-lg); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }

/* iOS-style back link: chevron points right because the page is RTL */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: -8px 0 14px; padding: 6px 2px;
  font-size: var(--fs-md); font-weight: 500; color: var(--brand); max-width: 100%;
}
.back-link:hover { text-decoration: none; opacity: .75; }
.back-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-link svg { flex: none; }
.topnav { display: flex; gap: 4px; margin-inline-start: auto; }
.topnav a { color: var(--ink-2); font-size: var(--fs-sm); padding: 6px 10px; border-radius: 999px; }
.topnav a:hover { color: var(--ink); background: var(--fill); text-decoration: none; }
.account { position: relative; }
.account summary { list-style: none; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 700;
}
.account-menu {
  position: absolute; inset-inline-end: 0; top: 44px; width: 250px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  padding: 16px; display: grid; gap: 6px; font-size: var(--fs-sm);
  animation: pop .16s var(--ease);
}
.account-menu .muted { word-break: break-all; }
.account-menu form { margin-top: 8px; }

/* ---------- layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 28px 16px 80px; }
.page-narrow { max-width: 720px; margin: 0 auto; padding: 28px 16px 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { margin-top: 6px; }
.stack { display: grid; gap: 16px; }
.stack-lg { display: grid; gap: 28px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }

.panel {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
@media (min-width: 720px) { .panel { padding: 28px; } }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: var(--fs-sm); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink);
  transition: transform .12s var(--ease), background-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 88%, black); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-quiet { background: var(--fill); color: var(--ink); }
.btn-quiet:hover { background: var(--fill-2); }
.btn-ghost { background: transparent; color: var(--brand); padding: 0 10px; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 80%, var(--danger)); color: #fff; }
.btn-lg { min-height: 54px; font-size: var(--fs-md); padding: 0 28px; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--ink-2);
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 18px;
}
.icon-btn:hover { background: var(--fill); color: var(--ink); }

/* ---------- forms ---------- */
label { display: grid; gap: 6px; font-size: var(--fs-sm); font-weight: 500; }
.field-hint { font-weight: 400; color: var(--ink-2); font-size: var(--fs-xs); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=search], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type=file] { font: inherit; font-size: var(--fs-sm); }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .form-grid.cols { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

/* ---------- pills, badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px; width: fit-content;
  padding: 2px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600;
  background: var(--fill); color: var(--ink-2);
}
.pill-brand { background: var(--brand-soft); color: var(--brand); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- lists & tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 600; font-size: var(--fs-xs); }
td.center, th.center { text-align: center; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-size: var(--fs-md); margin-bottom: 4px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 66px; inset-inline: 0; z-index: 50; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 520px; padding: 12px 18px; border-radius: var(--r-md);
  background: var(--toast); color: var(--toast-ink); font-size: var(--fs-sm); box-shadow: var(--shadow-pop);
  animation: drop .28s var(--ease);
}
.toast-error { background: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: all .3s var(--ease); }

/* ---------- dialog ---------- */
dialog {
  border: 0; padding: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(29,29,31,.36); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .2s var(--ease); }
.dialog-body { padding: 24px; display: grid; gap: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- login ---------- */
.login { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); text-align: center; display: grid; gap: 22px; }
.login-mark { font-size: 64px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.login-mark span { color: var(--brand); }
.login-card .panel { text-align: start; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: var(--fs-xs); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- courses ---------- */
.course-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .course-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.course-tile {
  display: grid; gap: 10px; min-height: 150px; align-content: space-between;
  background: var(--surface); border-radius: var(--r-lg); padding: 22px; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.course-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 16px 36px rgba(0,0,0,.08); }
.course-tile .code { font-size: var(--fs-xs); color: var(--ink-2); }
.course-tile h2 { font-size: 21px; }

.course-hero { padding: 12px 0 8px; display: grid; gap: 10px; }
.course-hero h1 { font-size: clamp(32px, 7vw, 52px); letter-spacing: -.025em; }
.course-hero .lecturers { color: var(--ink-2); }
.course-nav {
  position: sticky; top: 55px; z-index: 10; display: flex; gap: 6px; overflow-x: auto;
  padding: 10px 0; margin: 12px 0 20px; background: var(--bg); scrollbar-width: none;
}
.course-nav::-webkit-scrollbar { display: none; }
.course-nav a {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: var(--fs-sm); color: var(--ink-2);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset;
}
.course-nav a:hover { color: var(--ink); text-decoration: none; }
.section { scroll-margin-top: 110px; }

/* ---------- content blocks ---------- */
.blocks { display: grid; gap: 4px; }
.block { padding: 16px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.block:first-child { border-top: 0; padding-top: 0; }
.block-title { font-weight: 600; font-size: var(--fs-md); }
.block-body { white-space: pre-wrap; color: var(--ink); }
.block-link, .block-file {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--fill); color: var(--ink);
}
.block-link:hover, .block-file:hover { text-decoration: none; background: var(--brand-soft); }
.block-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--brand); font-size: 17px; }
.block-tools { display: flex; gap: 2px; }
.block-edit { display: none; }
.block.editing .block-view { display: none; }
.block.editing .block-edit { display: grid; }
.block-view { display: flex; gap: 10px; align-items: flex-start; }
.block-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.block-tools { opacity: .55; transition: opacity .15s; }
.block:hover .block-tools, .block-tools:focus-within { opacity: 1; }
@media (max-width: 640px) { .block-view { flex-direction: column; } .block-tools { opacity: 1; align-self: flex-end; } }
.block-tools .icon-btn:disabled { opacity: .3; cursor: default; }

/* segmented control */
.segmented { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented label { flex: 1; display: block; cursor: pointer; font-weight: 500; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px 0; border-radius: 9px; font-size: var(--fs-sm); color: var(--ink-2); transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.segmented input:focus-visible + span { outline: 3px solid var(--brand-soft); }

/* ---------- attendance: course section ---------- */
.attend-live { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-md); background: var(--brand-soft); }
.attend-live .grow { flex: 1; min-width: 180px; }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 var(--brand); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 50%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.attend-done { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--ok-soft); }
.check-badge { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-weight: 700; flex: none; }
.attend-cta { min-height: 64px; font-size: 20px; }

.notice { padding: 14px 18px; border-radius: var(--r-md); font-size: var(--fs-sm); }
.notice-warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------- attendance: lecturer stage (projected) ---------- */
body.stage {
  --bg: #FFFFFF; --surface: #FFFFFF; --ink: #1D1D1F; --ink-2: #6E6E73; --ink-3: #A1A1A6; --line: #E3E3E8;
  --brand: #3B4BD8; --brand-soft: #ECEEFC; --danger: #C4314B; --danger-soft: #FBEAEE; --ok: #1E7F4F; --ok-soft: #E6F4EC;
  --warn: #9A6200; --warn-soft: #FFF4DC; --fill: rgba(0,0,0,.05); --fill-2: rgba(0,0,0,.09);
  --shadow-pop: 0 12px 40px rgba(29,29,31,.18); color-scheme: light; background: #fff;
}
.stage-main { min-height: 100vh; display: grid; }
.stage-grid {
  display: grid; gap: clamp(24px, 4vw, 64px); align-items: center;
  padding: clamp(20px, 4vw, 56px); grid-template-columns: 1fr;
}
@media (min-width: 900px) { .stage-grid { grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); } }
.stage-names { align-self: stretch; display: grid; grid-template-rows: auto 1fr; gap: 18px; min-height: 0; }
.stage-names-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stage-names-head h2 { font-size: clamp(26px, 2.6vw, 40px); }
.names-grid {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px;
  max-height: calc(100vh - 220px); overflow-y: auto;
}
.name-chip {
  padding: 8px 16px; border-radius: 999px; background: var(--ok-soft); color: var(--ok);
  font-size: clamp(16px, 1.5vw, 22px); font-weight: 600; white-space: nowrap;
}
.name-chip.name-manual { background: var(--fill); color: var(--ink-2); }
.name-chip.name-new { animation: namein .5s var(--ease); }
@keyframes namein { 0% { opacity: 0; transform: scale(.7); background: var(--ok); color: #fff; } 60% { opacity: 1; transform: scale(1.06); background: var(--ok); color: #fff; } 100% { transform: none; } }
.names-empty { font-size: clamp(18px, 1.6vw, 24px); color: var(--ink-3); }
.stage-side { display: grid; gap: clamp(18px, 3vh, 36px); align-content: center; }
.stage-course { font-size: clamp(22px, 2.4vw, 34px); font-weight: 700; letter-spacing: -.02em; }
.stage-lesson { font-size: clamp(17px, 1.6vw, 24px); color: var(--ink-2); margin-top: 4px; }
.stage-timer {
  font-size: clamp(88px, 13vw, 200px); font-weight: 800; line-height: .9; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; direction: ltr; text-align: right;
}
.stage-timer.ending { color: var(--danger); }
.stage-count { display: flex; align-items: baseline; gap: 14px; }
.stage-count > span:first-child { font-size: clamp(56px, 7vw, 120px); font-weight: 800; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.stage-count-label { font-size: clamp(20px, 2vw, 30px); color: var(--ink-2); font-weight: 500; }
.stage-hint { font-size: clamp(16px, 1.4vw, 21px); color: var(--ink-2); max-width: 36ch; }
.stage-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stage-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(255,255,255,.86); backdrop-filter: blur(10px); padding: 16px; }
.stage-overlay-card { background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-pop); padding: 40px 32px; width: min(520px, 100%); display: grid; gap: 16px; text-align: center; justify-items: center; }
.stage-overlay-card h1 { font-size: 36px; }

/* ---------- attendance: student panel on the course page ---------- */
.attend-inline { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 6px 0; }
.attend-inline > p { max-width: 42ch; margin: 0; }
.attend-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.attend-icon-ok { background: var(--ok); color: #fff; animation: pop .3s var(--ease); }
.attend-icon-warn { background: var(--warn-soft); color: var(--warn); }
.listen-rings { position: relative; width: 96px; height: 96px; }
.listen-rings span { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--brand); opacity: 0; animation: ring 2.1s infinite var(--ease); }
.listen-rings span:nth-child(2) { animation-delay: .7s; }
.listen-rings span:nth-child(3) { animation-delay: 1.4s; }
.listen-rings::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: var(--brand); }
@keyframes ring { from { transform: scale(.35); opacity: .9; } to { transform: scale(1); opacity: 0; } }
.level { width: 100%; max-width: 260px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.level span { display: block; height: 100%; background: var(--brand); transform: scaleX(0); transform-origin: right; transition: transform .1s linear; }

/* ---------- attendance: report ---------- */
.matrix td, .matrix th { padding: 10px 12px; }
.matrix tbody tr:hover { background: var(--bg); }
.cell { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 14px; }
.cell-ok { background: var(--ok-soft); color: var(--ok); }
.cell-btn { border: 1px dashed var(--line); background: transparent; cursor: pointer; font-size: 16px; }
.cell-btn:hover, .cell-btn:focus-visible { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.cell-present { display: inline-flex; align-items: center; gap: 4px; }
.cell-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--fill); color: var(--ink-2); font-size: 11px; font-weight: 600; }
.cell-remove { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 12px; padding: 4px; border-radius: 6px; opacity: 0; }
.matrix tr:hover .cell-remove, .cell-remove:focus-visible { opacity: 1; }
.cell-remove:hover { color: var(--danger); background: var(--danger-soft); }
@media (hover: none) { .cell-remove { opacity: 1; } }
.percent { font-weight: 700; font-variant-numeric: tabular-nums; }
.percent-low { color: var(--danger); }

/* ---------- debug ---------- */
.debug-meter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.debug-big { background: var(--bg); border-radius: var(--r-md); padding: 14px; display: grid; gap: 2px; text-align: center; }
.debug-big span { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.debug-big small { color: var(--ink-2); font-size: var(--fs-xs); }
.debug-bars { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; height: 140px; direction: ltr; }
.debug-bar { display: grid; grid-template-rows: 1fr auto; gap: 4px; text-align: center; }
.debug-bar span { background: var(--brand); border-radius: 6px 6px 2px 2px; transform-origin: bottom; transform: scaleY(.02); transition: transform .08s linear; }
.debug-bar:first-child span { background: var(--ink); }
.debug-bar small { font-size: 11px; color: var(--ink-2); }
.debug-log { margin: 0; padding-left: 20px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; max-height: 160px; overflow: auto; color: var(--ink-2); }

/* ---------- chat ---------- */
.chat-panel { padding-bottom: 0; overflow: hidden; }
.chat { position: relative; margin: 0 -22px; }
@media (min-width: 720px) { .chat { margin: 0 -28px; } }
.chat-scroll {
  height: min(64vh, 620px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); padding: 16px 12px; border-top: 1px solid var(--line);
}
.chat-list { display: flex; flex-direction: column; gap: 6px; }
.chat-empty { height: 100%; display: grid; place-content: center; text-align: center; gap: 4px; color: var(--ink-2); font-size: var(--fs-sm); }
.chat-empty strong { color: var(--ink); font-size: var(--fs-md); }

.msg { display: flex; flex-direction: column; max-width: min(82%, 520px); }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.has-poll { width: min(88%, 420px); }
.msg.has-poll .bubble { width: 100%; }
.bubble {
  position: relative; padding: 7px 12px 6px; border-radius: 18px; font-size: 16px; line-height: 1.4;
  background: var(--surface); box-shadow: 0 1px 1px rgba(0,0,0,.06); max-width: 100%;
}
.msg.theirs .bubble { border-start-start-radius: 6px; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-start-end-radius: 6px; }
.bubble:focus-visible { outline-offset: 3px; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; }
.time { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.msg.mine .time { color: rgba(255,255,255,.7); }

/* read receipts: ✓ sent, ✓✓ someone read, blue ✓✓ everyone read */
.ticks { display: inline-flex; line-height: 0; color: rgba(255,255,255,.8); }
.ticks svg { display: block; }
.msg.mine .ticks.read-all { color: #9BE7FF; }
.info-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); margin-bottom: 4px; }
.info-head .ticks { color: #34B7F1; }
.info-preview { padding: 10px 14px; border-radius: 14px; background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow: auto; }
.info-list { max-height: 260px; overflow: auto; }
.info-list > li { padding: 9px 0; }

.msg.deleted .bubble { background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line) inset; }
.msg.mine.deleted .bubble { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.msg.deleted .time { color: var(--ink-3); }
.deleted-text { font-style: italic; font-size: 15px; }
.who { font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 1px; display: flex; align-items: center; gap: 6px; }
.who-anon { color: var(--ink-2); font-weight: 500; }
.msg.mine .who-anon { color: rgba(255,255,255,.8); font-size: 12px; }
.who-badge { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.quote {
  all: unset; cursor: pointer; display: grid; gap: 1px; margin: 2px 0 5px; padding: 5px 10px;
  border-inline-start: 3px solid var(--brand); border-radius: 8px; background: var(--fill);
  font-size: 13px; max-width: 100%; box-sizing: border-box;
}
.quote strong { color: var(--brand); font-weight: 600; }
.quote span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.mine .quote { background: rgba(255,255,255,.16); border-color: #fff; }
.msg.mine .quote strong, .msg.mine .quote span { color: #fff; }
/* side buttons: appear on hover, but only a click opens anything */
.msg-tools {
  position: absolute; top: 50%; transform: translateY(-50%); display: flex; gap: 4px;
  /* the padding bridges the gap to the bubble, so the mouse never "leaves" on the way */
  padding: 8px 10px;
  opacity: 0; visibility: hidden;
  /* stay visible for a moment after the mouse leaves */
  transition: opacity .2s ease .6s, visibility 0s linear .8s;
}
.msg.theirs .msg-tools { inset-inline-start: 100%; }
.msg.mine .msg-tools { inset-inline-end: 100%; flex-direction: row-reverse; }
.msg:hover .msg-tools, .msg.active .msg-tools, .msg-tools:focus-within {
  opacity: 1; visibility: visible; transition: opacity .12s ease 0s, visibility 0s linear 0s;
}
.msg-tool {
  width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-size: 15px; color: var(--ink-2);
}
.msg-tool:hover { color: var(--ink); background: var(--bg); }
@media (hover: none) {
  .msg-tools { display: none; }
  .msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.reactions {
  all: unset; cursor: pointer; display: inline-flex; gap: 6px; margin-top: -4px; z-index: 1;
  padding: 2px 8px; border-radius: 999px; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.12);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.msg.flash .bubble { animation: flash 1s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 40%, transparent); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.06); } }

/* popover: emoji row on top, menu below (either one, or both on long-press) */
.msg-pop { position: absolute; z-index: 5; display: grid; gap: 6px; justify-items: end; animation: pop .16s var(--ease); }
.msg-pop.align-left { justify-items: start; }
.reaction-bar {
  display: flex; align-items: center; gap: 2px; padding: 5px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-pop);
}
.reaction-bar button { border: 0; background: transparent; font-size: 24px; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; transition: transform .12s var(--ease), background .12s; }
.reaction-bar button:hover { transform: scale(1.18); }
.reaction-bar button.active { background: var(--brand-soft); }
@media (max-width: 420px) { .reaction-bar button { width: 36px; height: 36px; font-size: 21px; } }
.msg-menu {
  display: grid; min-width: 180px; padding: 6px; background: var(--surface);
  border-radius: 14px; box-shadow: var(--shadow-pop);
}
.msg-menu button {
  border: 0; background: transparent; font: inherit; font-size: 15px; text-align: start; cursor: pointer;
  padding: 10px 12px; border-radius: 9px; color: var(--ink);
}
.msg-menu button:hover { background: var(--bg); }
.msg-menu button.danger { color: var(--danger); }

.composer { padding: 10px 12px 14px; background: var(--surface); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-poll { flex: none; min-height: 46px; }
.composer-field { position: relative; flex: 1; min-width: 0; }
.composer-field textarea {
  display: block; min-height: 46px; height: 46px; max-height: 140px; resize: none; border-radius: 23px;
  padding: 11px 16px; padding-inline-start: 46px; line-height: 1.4;
}
.emoji-toggle {
  position: absolute; inset-inline-start: 6px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center;
  transition: color .15s, background .15s;
}
.emoji-toggle:hover, .emoji-toggle.on { color: var(--brand); background: var(--brand-soft); }

/* send: grey and quiet while empty, wakes up in the brand colour once you type */
.send-btn {
  --send-cut: var(--line);
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--line); color: var(--ink-3); cursor: default;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s;
}
.send-btn svg { transform: scaleX(-1); } /* point left: forward in Hebrew */
.send-btn.ready {
  --send-cut: var(--brand);
  background: var(--brand); color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent);
  animation: sendReady .28s var(--ease);
}
.send-btn.ready:hover { transform: scale(1.06); }
.send-btn.ready:active { transform: scale(.92); }
.send-btn.sending svg { animation: sendFly .45s var(--ease); }
@keyframes sendReady { 0% { transform: scale(.82); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes sendFly { 0% { transform: scaleX(-1) translate(0, 0); opacity: 1; } 50% { transform: scaleX(-1) translate(10px, -10px); opacity: 0; } 51% { transform: scaleX(-1) translate(-8px, 8px); opacity: 0; } 100% { transform: scaleX(-1) translate(0, 0); opacity: 1; } }

/* emoji keyboard */
.emoji-panel { border-radius: 16px; background: var(--bg); box-shadow: 0 0 0 1px var(--line) inset; overflow: hidden; animation: pop .16s var(--ease); }
.emoji-tabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.emoji-tabs button { flex: none; border: 0; background: transparent; font-size: 20px; width: 40px; height: 36px; border-radius: 10px; cursor: pointer; opacity: .6; }
.emoji-tabs button[aria-selected="true"] { opacity: 1; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); padding: 6px 8px 10px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.emoji-title { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); padding: 4px 4px 6px; }
.emoji-grid button { border: 0; background: transparent; font-size: 26px; height: 44px; border-radius: 10px; cursor: pointer; transition: transform .1s, background .1s; }
.emoji-grid button:hover { background: var(--surface); transform: scale(1.12); }

/* small dialogs (who reacted, message info) */
dialog.dialog-compact { width: min(340px, calc(100vw - 32px)); }
.dialog-compact .dialog-body { padding: 18px 18px 14px; gap: 10px; }
.dialog-compact h2 { font-size: 18px; }
.dialog-compact .list > li { padding: 8px 0; gap: 10px; }
.dialog-compact .dialog-actions .btn { min-height: 36px; }

/* "who reacted" dialog: change your own reaction */
.who-mine { display: grid; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--bg); }
.who-mine .small { font-size: 12.5px; }
.who-emoji { display: flex; gap: 2px; justify-content: space-between; }
.who-emoji button { border: 0; background: transparent; font-size: 20px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; transition: transform .12s, box-shadow .12s; }
#who-list { max-height: 240px; overflow: auto; }
#who-list li span:first-child { font-size: 19px !important; }

/* delete confirmation inside the message popover */
.msg-confirm { padding: 12px; gap: 10px; min-width: 210px; }
.msg-confirm p { font-size: 15px; font-weight: 500; }
.msg-confirm-actions { display: flex; gap: 6px; justify-content: flex-end; }
.msg-confirm-actions button { padding: 8px 14px; border-radius: 999px; font-weight: 600; text-align: center; }
.msg-confirm-actions button:not(.danger) { background: var(--bg); }
.msg-confirm-actions button.danger { background: var(--danger); color: #fff; }
.msg-confirm-actions button.danger:hover { background: color-mix(in srgb, var(--danger) 85%, black); }
.who-emoji button:hover { transform: scale(1.1); }
.who-emoji button.active { box-shadow: 0 0 0 2px var(--brand); background: var(--brand-soft); }
.composer-reply { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 12px; background: var(--bg); border-inline-start: 3px solid var(--brand); font-size: 13px; }
.composer-reply .grow { flex: 1; min-width: 0; display: grid; }
.composer-reply strong { color: var(--brand); }
.composer-reply span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-anon { display: grid; gap: 4px; }
.anon-note { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: 10px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 14px; width: fit-content; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--line); transition: background .18s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--brand-soft); outline-offset: 2px; }

/* ---------- polls ---------- */
.poll { display: grid; gap: 8px; padding: 4px 0 2px; }
.poll-q { font-weight: 700; font-size: 16px; }
.poll-hint { font-size: 12px; opacity: .75; margin-top: -6px; }
.poll-opts { display: grid; gap: 6px; }
.poll-opt {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: 22px 1fr auto; grid-template-rows: auto 6px;
  column-gap: 10px; row-gap: 5px; align-items: center; padding: 8px 2px; cursor: default;
}
button.poll-opt { cursor: pointer; }
.poll-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; opacity: .55; box-sizing: border-box; }
.poll-opt.chosen .poll-radio { opacity: 1; background: currentColor; box-shadow: inset 0 0 0 3px var(--surface); }
.msg.mine .poll-opt.chosen .poll-radio { box-shadow: inset 0 0 0 3px var(--brand); }
.poll-text { font-size: 15px; }
.poll-count { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.poll-bar { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.poll-bar span { display: block; height: 100%; background: var(--brand); transform-origin: right; transition: transform .35s var(--ease); }
.msg.mine .poll-bar { background: rgba(255,255,255,.25); }
.msg.mine .poll-bar span { background: #fff; }
.poll-total { font-size: 12px; opacity: .7; }
button.poll-opt:focus-visible { outline: 2px solid var(--brand); border-radius: 8px; }
.poll-options-edit { display: grid; gap: 8px; }

/* ---------- recordings ---------- */
.recordings { display: grid; gap: 10px; }
.recording { border-radius: var(--r-md); background: var(--bg); overflow: hidden; }
.recording > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.recording > summary::-webkit-details-marker { display: none; }
.recording > summary .grow { flex: 1; min-width: 0; display: grid; }
.recording-title { font-weight: 600; }
.recording-body { padding: 0 16px 16px; display: grid; gap: 18px; }
.player video, .player audio { width: 100%; display: block; border-radius: 12px; background: #000; }
.player audio { background: transparent; }
.recording-grid { display: grid; gap: 20px; }
@media (min-width: 860px) { .recording-grid { grid-template-columns: 1.4fr 1fr; } }
.recording-grid h3 { margin-bottom: 6px; }
.recording-summary { line-height: 1.65; max-width: 65ch; }
.key-points { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.chapters ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chapters button {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; gap: 12px; align-items: baseline;
  padding: 8px 10px; border-radius: 10px;
}
.chapters button:hover { background: var(--surface); }
.chapters button:focus-visible { outline: 2px solid var(--brand); }
.chapter-time { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; min-width: 44px; }
button.chapter-time { all: unset; cursor: pointer; color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.transcript > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: var(--fs-sm); }
.transcript-lines { margin-top: 10px; max-height: 340px; overflow: auto; display: grid; gap: 6px; font-size: var(--fs-sm); line-height: 1.6; padding-inline-end: 6px; }
.spinner { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* in-page confirm dialog */
.confirm-text { font-size: 17px; font-weight: 500; line-height: 1.5; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, black); }

/* poll: anonymous toggle in the create dialog, and "who voted" for open polls */
.poll-anon { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.poll-voters { all: unset; cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; opacity: .85; }
.poll-voters:hover { opacity: 1; }
.poll-voters:focus-visible { outline: 2px solid currentColor; border-radius: 4px; }
.voters { display: grid; gap: 12px; max-height: 340px; overflow: auto; }
.voters h3 { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.voters ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }

/* live submit: grey and inert until the form changed, then wakes up in the brand colour */
.btn.is-idle, .btn.is-idle:hover { background: var(--line); color: var(--ink-3); opacity: 1; box-shadow: none; }
form[data-live-submit] .btn:not(.is-idle) { animation: sendReady .28s var(--ease); }

/* file picker with an ✕ to clear the choice */
.file-pick { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border-radius: var(--r-sm); border: 1px dashed var(--line); background: var(--surface); }
.file-pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-pick-btn { flex: none; border: 0; font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); cursor: pointer; }
.file-pick-btn:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 12%); }
.file-pick-name { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.file-pick-name.chosen { color: var(--ink); }
.file-pick-clear { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink-2); cursor: pointer; font-size: 13px; }
.file-pick-clear:hover { background: var(--danger-soft); color: var(--danger); }

/* selected tab chip (admin nav, lesson tabs) */
.course-nav a.chip-on { background: var(--chip-on); color: var(--chip-on-ink); box-shadow: none; }

/* theme picker in the account menu */
.theme-pick { display: grid; gap: 4px; margin-top: 6px; }
.theme-pick .segmented span { padding: 5px 0; font-size: 13px; }
/* smooth switch between themes, but not on first paint */
html.theme-anim, html.theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease !important; }

/* ---------- chat card on the course page ---------- */
.chat-card { display: flex; align-items: center; gap: 16px; color: var(--ink); transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.chat-card:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 14px 32px rgba(0,0,0,.1); }
.chat-card-icon { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.chat-card-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-card-title { font-size: var(--fs-lg); font-weight: 700; }
.chat-card-last { color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-card-last strong { color: var(--ink); font-weight: 600; }
.chat-card-go { flex: none; color: var(--ink-3); }

/* ---------- full-screen chat page ---------- */
body.chat-fullscreen { overflow: hidden; }
.chat-page {
  height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  max-width: 860px; margin: 0 auto; background: var(--surface);
}
@media (min-width: 900px) { .chat-page { box-shadow: 0 0 0 1px var(--line); } }
.chat-bar {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.chat-back {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 4px; border-radius: 10px;
  font-size: var(--fs-md); font-weight: 500; color: var(--brand);
}
.chat-back:hover { text-decoration: none; background: var(--brand-soft); }
.chat-bar-title { flex: 1; min-width: 0; display: grid; text-align: center; padding-inline-end: 64px; }
.chat-bar-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-page .chat { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-page .chat-scroll { flex: 1; height: auto; min-height: 0; border-top: 0; }
.chat-page .composer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.chat-page .toasts { top: 70px; }

.chat-status:not(:empty) { color: var(--danger); }
.chat-status:not(:empty)::before { content: " · "; color: var(--ink-3); }

/* mute students */
.chat-bar-title.has-tool { padding-inline-end: 0; }
.chat-mute {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: var(--fill); color: var(--ink-2);
  transition: background .15s, color .15s;
}
.chat-mute:hover { background: var(--fill-2); color: var(--ink); }
.chat-mute[aria-pressed="true"] { background: var(--warn-soft); color: var(--warn); }
.chat-mute:disabled { opacity: .6; cursor: default; }
@media (max-width: 480px) { .chat-mute span { display: none; } .chat-mute { padding: 9px; } }
.chat-locked-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px;
  background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; text-align: center;
  border-top: 1px solid var(--line);
}
.chat-locked-bar svg { flex: none; color: var(--warn); }

/* ---------- day separators (sticky, like WhatsApp) ---------- */
.day-divider { position: sticky; top: 4px; z-index: 2; display: flex; justify-content: center; margin: 10px 0 4px; pointer-events: none; }
.day-divider span {
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 1px 3px rgba(0,0,0,.12);
  backdrop-filter: blur(8px);
}

/* ---------- chat search ---------- */
.chat-icon-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 15px;
}
.chat-icon-btn:hover { background: var(--fill); color: var(--ink); }
.chat-search-bar { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-search-bar input {
  flex: 1; min-width: 0; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); font-size: 16px;
}
.chat-bar.searching .chat-bar-title, .chat-bar.searching #chat-search-open, .chat-bar.searching .chat-mute { display: none; }
.chat-page .chat { position: relative; }
.chat-search-results {
  position: absolute; inset: 0 0 auto 0; z-index: 6; max-height: 70%; overflow-y: auto;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-pop);
  animation: drop .18s var(--ease);
}
.search-count, .search-empty { margin: 0; padding: 10px 16px; font-size: 13px; color: var(--ink-2); }
.search-empty { padding: 18px 16px; text-align: center; }
.search-hit {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 3px; width: 100%;
  padding: 10px 16px; border-top: 1px solid var(--line);
}
.search-hit:hover, .search-hit:focus-visible { background: var(--fill); }
.search-hit-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.search-hit-top span { color: var(--ink-3); flex: none; }
.search-hit-text { font-size: 14.5px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-hit mark { background: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--ink); border-radius: 3px; padding: 0 1px; }

/* no scrollbar arrows in the composer until the text is taller than the box */
.composer-field textarea { overflow-y: hidden; scrollbar-width: thin; }

/* ---------- recordings: card grid on the course page ---------- */
.rec-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.rec-card { display: grid; gap: 10px; color: var(--ink); border-radius: var(--r-md); }
.rec-card:hover { text-decoration: none; }
.rec-card:focus-visible { outline-offset: 4px; }
.rec-thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 70%, #000), var(--brand));
  box-shadow: var(--shadow); transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.rec-card:hover .rec-thumb { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 16px 34px rgba(0,0,0,.14); }
.rec-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.rec-thumb audio { display: none; }
.rec-thumb-audio { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; color: rgba(255,255,255,.85); }
.rec-play {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  opacity: .9; transition: transform .18s var(--ease), background .18s;
}
.rec-play svg { transform: translateX(2px); }
.rec-card:hover .rec-play { transform: scale(1.08); background: var(--brand); }
.rec-duration {
  position: absolute; bottom: 8px; left: 8px; padding: 2px 7px; border-radius: 6px; direction: ltr;
  font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.7); font-variant-numeric: tabular-nums;
}
.rec-badge { position: absolute; top: 8px; right: 8px; box-shadow: var(--shadow); }
.rec-info { display: grid; gap: 2px; padding: 0 2px; }
.rec-title { font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rec-meta { font-size: 13px; color: var(--ink-2); }

/* ---------- recording page ---------- */
.rec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.rec-head h1 { font-size: clamp(24px, 4vw, 34px); }
.rec-head p { margin-top: 4px; }
.rec-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 960px) { .rec-layout { grid-template-columns: minmax(0, 1fr) 320px; } .rec-side { position: sticky; top: 76px; } }
.rec-main { display: grid; gap: 16px; min-width: 0; }
.rec-page .player video { border-radius: var(--r-lg); box-shadow: var(--shadow); max-height: 70vh; }
.audio-stage {
  aspect-ratio: 16 / 6; border-radius: var(--r-lg); margin-bottom: 10px; display: grid; place-items: center; font-size: 64px; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 70%, #000), var(--brand));
}
.rec-side .chapters ol { max-height: 60vh; overflow: auto; }
.rec-side .chapters button:hover { background: var(--fill); }

/* ---------- recording drafts and edit mode ---------- */
.rec-draft { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; }
.draft-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; padding: 14px 18px;
  border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink);
}
.draft-bar .grow { flex: 1; min-width: 220px; display: grid; gap: 2px; font-size: var(--fs-sm); }
.rec-edit .panel { display: grid; gap: 10px; }
.edit-list { display: grid; gap: 8px; }
.edit-list-head { font-weight: 700; font-size: var(--fs-md); }
.edit-row { display: flex; gap: 8px; align-items: center; }
.edit-row input { flex: 1; min-width: 0; }
.chapter-row .time-input { flex: none; width: 84px; text-align: center; font-variant-numeric: tabular-nums; }
.chapter-row [data-take-time] { flex: none; }
@media (max-width: 560px) { .chapter-row { flex-wrap: wrap; } .chapter-row input[name="chapter_title"] { flex-basis: 100%; order: 3; } }
.edit-add { justify-self: start; }
.transcript-edit { display: grid; gap: 6px; max-height: 60vh; overflow: auto; padding-inline-end: 4px; }
.seg-row { display: flex; gap: 10px; align-items: flex-start; }
.seg-row .chapter-time { flex: none; padding-top: 10px; min-width: 44px; }
.seg-row textarea { flex: 1; min-height: 40px; resize: none; overflow: hidden; padding: 8px 12px; font-size: 15px; line-height: 1.5; }
.edit-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* no chapters column (edit mode, or no chapters yet): use the full width */
@media (min-width: 960px) { .rec-layout.single { grid-template-columns: minmax(0, 1fr); max-width: 860px; } }

/* ---------- private feedback for the lecturer ---------- */
.feedback { border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.feedback-private { display: inline-flex; align-items: center; gap: 5px; background: var(--brand-soft); color: var(--brand); }
.feedback-wait { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.feedback-overall { line-height: 1.65; max-width: 65ch; }
.feedback-sub { font-size: var(--fs-md); margin: 18px 0 8px; }
.feedback-strengths { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.feedback-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feedback-item { padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); display: grid; gap: 6px; }
.feedback-item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feedback-item blockquote { margin: 0; padding-inline-start: 10px; border-inline-start: 3px solid var(--line); color: var(--ink-2); font-size: 14.5px; }
.feedback-item p { margin: 0; line-height: 1.55; }
.feedback-suggestion { color: var(--ok); }
.feedback-suggestion strong { font-weight: 700; }
.feedback-cat-language { background: var(--brand-soft); color: var(--brand); }
.feedback-cat-content { background: var(--danger-soft); color: var(--danger); }
.feedback-cat-clarity { background: var(--warn-soft); color: var(--warn); }
.feedback-cat-pace { background: var(--ok-soft); color: var(--ok); }

/* ---------- collapsible panels (summary, feedback) ---------- */
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
.fold-head { display: flex; align-items: center; gap: 10px; }
.fold-head h2 { flex: 1; }
.fold-chevron {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); transition: background .15s;
}
/* physical borders (not inline-*) so the arrow does not flip in RTL: ∧ when open, ∨ when folded */
.fold-chevron::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2);
  transform: translateY(2px) rotate(-135deg); transition: transform .2s var(--ease);
}
details.fold:not([open]) .fold-chevron::before { transform: translateY(-2px) rotate(45deg); }
.fold-head:hover .fold-chevron { background: var(--fill-2); }
details.fold:not([open]) > summary { margin-bottom: 0; }
.fold-body { margin-top: 12px; }
.feedback-wait { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 10px 12px; border-radius: var(--r-md); background: var(--fill); }
.feedback-wait .grow { flex: 1; }

/* ---------- the back link stays visible while scrolling ---------- */
.back-link {
  position: sticky; top: 62px; z-index: 15; width: fit-content; padding: 6px 14px 6px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
}

/* back link: full label at the top; once you scroll it shrinks to a round arrow bubble and keeps floating */
.back-link { transition: padding .22s var(--ease), gap .22s var(--ease), box-shadow .2s; }
.back-link span { display: inline-block; max-width: 70vw; transition: max-width .25s var(--ease), opacity .18s; }
.back-link.compact { gap: 0; padding: 8px 12px; box-shadow: var(--shadow); }
.back-link.compact span { max-width: 0; opacity: 0; }
.back-link { transition: padding .22s var(--ease), gap .22s var(--ease), box-shadow .2s, opacity .15s; }

/* ---------- reactions: "+" for any emoji ---------- */
.react-more {
  display: grid; place-items: center; border: 0; cursor: pointer; color: var(--ink-2);
  width: 42px; height: 42px; border-radius: 50%; background: var(--fill); transition: background .12s, color .12s;
}
.react-more:hover { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 420px) { .reaction-bar .react-more { width: 36px; height: 36px; } }
.who-emoji .react-more { width: 38px; height: 38px; }
.reaction-picker {
  position: absolute; z-index: 7; inset-inline: 12px; max-width: 380px; margin-inline: auto;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden;
  animation: pop .16s var(--ease);
}
.reaction-picker .emoji-grid { max-height: 240px; }
/* the phone keyboard opens on this field; it stays out of sight */
.native-emoji {
  position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0;
  opacity: 0; font-size: 16px; pointer-events: none;
}

/* a day bar that the next one already covers at the top fades out */
.day-divider.covered { visibility: hidden; }

/* ---------- pinned messages ---------- */
.pinned-bar {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; cursor: pointer; font: inherit;
  padding: 9px 16px; text-align: start; color: var(--ink); background: var(--surface);
  border-bottom: 1px solid var(--line); box-shadow: 0 4px 10px -8px rgba(0,0,0,.2);
}
.pinned-bar:hover { background: var(--fill); }
.pinned-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.pinned-text { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-text strong { font-weight: 600; }
.pinned-count { flex: none; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; direction: ltr; }
.msg-pin { display: inline-flex; color: var(--ink-3); }
.msg.mine .msg-pin { color: rgba(255,255,255,.75); }

/* ---------- list search (home, admin users / courses / course members) ---------- */
.list-search { position: relative; display: block; width: 100%; max-width: 420px; }
.list-search input {
  width: 100%; height: 42px; padding: 0 40px 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px;
}
.list-search svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.list-search-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.list-search-count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.search-none { padding: 18px 4px; color: var(--ink-2); text-align: center; }
.panel-head .list-search { max-width: 260px; }
.panel-head .list-search input { height: 36px; font-size: 15px; }

/* ---------- course page: bottom tab bar with iOS-style frosted glass ---------- */
:root {
  --glass: rgba(255, 255, 255, .62);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-line: rgba(0, 0, 0, .08);
  --glass-glow: rgba(59, 75, 216, .11);
  --glass-shadow: 0 10px 34px rgba(29, 29, 31, .16), 0 2px 6px rgba(29, 29, 31, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(42, 42, 48, .58);
    --glass-edge: rgba(255, 255, 255, .13);
    --glass-line: rgba(255, 255, 255, .05);
    --glass-glow: rgba(94, 108, 245, .26);
    --glass-shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(42, 42, 48, .58);
  --glass-edge: rgba(255, 255, 255, .13);
  --glass-line: rgba(255, 255, 255, .05);
  --glass-glow: rgba(94, 108, 245, .26);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
}

.tabbar {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(calc(100% - 28px), 420px);
  display: flex; padding: 5px; border-radius: 999px; isolation: isolate;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), 0 0 0 .5px var(--glass-line), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.tabbar a {
  flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 2px;
  padding: 7px 4px 6px; border-radius: 999px; color: var(--ink-2);
  font-size: 11px; font-weight: 500; letter-spacing: .01em; -webkit-tap-highlight-color: transparent;
  transition: color .2s var(--ease), transform .15s var(--ease);
}
.tabbar a:hover { text-decoration: none; color: var(--ink); }
.tabbar a:active { transform: scale(.92); }
.tabbar a.on { color: var(--brand); font-weight: 600; }
.tabbar svg {
  width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.tabbar svg .fill { fill: currentColor; stroke: none; }
/* the current tab's icon fills in softly, like iOS */
.tabbar a.on svg > :first-child { fill: color-mix(in srgb, currentColor 16%, transparent); }
.tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* the lit pill behind the current tab; slides between tabs (RTL: tab 0 is on the right) */
.tabbar-glow {
  position: absolute; z-index: -1; top: 5px; bottom: 5px; right: 5px;
  width: calc((100% - 10px) / var(--tab-n, 4)); border-radius: 999px;
  background: var(--glass-glow); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--brand) 22%, transparent);
  transform: translateX(calc(var(--tab-i, 0) * -100%));
  opacity: 0;
}
body.tabbed .tabbar-glow { opacity: 1; }
.tabbar.ready .tabbar-glow { transition: transform .38s cubic-bezier(.3, 1.3, .5, 1), opacity .2s; }

/* room for the bar under the last section */
body.has-tabbar main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
/* with JS each tab is its own screen; the chat card is replaced by the chat tab */
body.tabbed .stack-lg > .section:not(.tab-on) { display: none; }
body.tabbed .tab-on { animation: tab-in .24s var(--ease); }
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  body.tabbed .tab-on { animation: none; }
  .tabbar.ready .tabbar-glow { transition: none; }
}
/* browsers without backdrop-filter get a solid bar instead of an unreadable see-through one */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: var(--surface); }
}

/* unread count on the chat tab, like WhatsApp */
.tabbar a { position: relative; }
.tab-badge {
  position: absolute; top: 2px; left: calc(50% - 22px); min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: #FF3B30; color: #fff; font-size: 11px; font-weight: 700; line-height: 19px;
  text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface);
  animation: pop .2s var(--ease);
}

/* phones have their own emoji key on the keyboard, so the composer drops the smiley button */
@media (hover: none) and (pointer: coarse) {
  .emoji-toggle, .emoji-panel { display: none !important; }
  .composer-field textarea { padding-inline-start: 16px; }
}

/* icons only: the label stays for screen readers (sr-only) and as a tooltip (title) */
.tabbar a { padding: 11px 4px; }
.tabbar svg { width: 27px; height: 27px; }
.tab-badge { top: 4px; }

/* ---------- assignments ---------- */
.asg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.asg-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--fill); color: var(--ink); transition: background .15s, transform .15s var(--ease);
}
.asg-row:hover { text-decoration: none; background: var(--fill-2); }
.asg-row:active { transform: scale(.99); }
.asg-icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.asg-row.is-past .asg-icon { background: var(--fill-2); color: var(--ink-2); }
.asg-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.asg-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asg-due { font-size: var(--fs-xs); color: var(--ink-2); }
.asg-status { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.asg-status .pill, .roster .pill { white-space: nowrap; }

.asg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.asg-head h1 { font-size: clamp(26px, 6vw, 38px); letter-spacing: -.02em; }
.asg-h2 { margin-bottom: 12px; }
.asg-desc { white-space: pre-line; line-height: 1.6; }
.asg-desc + .file-chip { margin-top: 14px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 500; font-size: var(--fs-sm);
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip:hover { text-decoration: none; filter: brightness(.97); }
.sub-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.submit-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.submit-form .btn { justify-self: start; }
.note-warn { padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn-ink); font-size: var(--fs-sm); }

.grade-card {
  margin-top: 14px; display: flex; gap: 14px; align-items: baseline; padding: 12px 14px; border-radius: var(--r-md);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.grade-num { flex: none; line-height: 1.2; }
.grade-num strong { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.grade-num span { font-size: var(--fs-xs); color: var(--ink-2); }
.grade-note { white-space: pre-line; line-height: 1.55; }

/* grading: the pill opens a small form inside the row */
.roster > li { flex-wrap: wrap; }
.grade-box { flex: none; }
.grade-box > summary { cursor: pointer; list-style: none; }
.grade-box > summary::-webkit-details-marker { display: none; }
.grade-box[open] { flex-basis: 100%; order: 5; }
.grade-box[open] > summary { margin-bottom: 10px; }
.grade-form { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--fill); }
.grade-form input[type="number"] { max-width: 120px; }
.grade-form .btn { justify-self: start; }
/* names can be long ("מטלה 2: עיצוב ומימוש..."): two lines before the ellipsis */
.asg-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }

/* ---------- chat on a computer: the course tabs as a glass side strip on the right, like WhatsApp desktop ---------- */
.tabbar-rail { display: none; }
@media (min-width: 900px) {
  .tabbar-rail {
    display: flex; flex-direction: column; gap: 6px;
    left: auto; right: 18px; top: 50%; bottom: auto; transform: translateY(-50%);
    width: 62px; padding: 7px; border-radius: 31px;
  }
  .tabbar-rail a { flex: none; padding: 12px 0; }
  .tabbar-rail a.on { background: var(--glass-glow); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--brand) 22%, transparent); }
  .tabbar-rail a:active { transform: scale(.92); }
  /* the chat column moves over so the strip never covers it */
  body.has-rail .chat-page { margin-right: max(98px, calc((100vw - 860px) / 2)); margin-left: auto; }
}
/* the hover tools beside a bubble may poke past the edge on a narrow screen; never scroll sideways for them */
.chat-scroll { overflow-x: hidden; }

/* ---------- requests to the admins ---------- */
.nav-badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; margin-inline-start: 4px;
  background: #FF3B30; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums; vertical-align: 1px;
}
.account summary { position: relative; }
.avatar-dot {
  position: absolute; top: -1px; left: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #FF3B30; box-shadow: 0 0 0 2px var(--surface);
}
.account-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 10px 12px;
  border-radius: var(--r-sm); background: var(--fill); color: var(--ink); font-size: var(--fs-sm); font-weight: 500;
}
.account-link:hover { text-decoration: none; background: var(--fill-2); }

.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r-md);
  background: var(--fill); color: var(--ink); transition: background .15s;
}
.req-row:hover { text-decoration: none; background: var(--fill-2); }
.req-row.is-closed { opacity: .72; }
.req-row .pill { flex: none; white-space: nowrap; }
.req-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.req-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-meta { font-size: var(--fs-xs); color: var(--ink-2); }
.req-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF3B30; margin-inline-end: 6px; vertical-align: 1px; }
.req-foot { margin-top: 14px; text-align: center; }

.req-status { display: grid; gap: 6px; }
.req-status .segmented { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--fill); width: fit-content; max-width: 100%; flex-wrap: wrap; }
.req-status .segmented button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); font-weight: 500;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.req-status .segmented button:hover { color: var(--ink); background: var(--fill); }
.req-status .segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); cursor: default; opacity: 1; }

.req-thread { display: grid; gap: 12px; }
.req-msg { padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); max-width: 88%; justify-self: end; }
.req-msg.mine { justify-self: start; background: var(--brand-soft); }
.req-msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: var(--fs-sm); }
.req-msg-body { white-space: pre-line; line-height: 1.55; }
.req-event { justify-self: center; font-size: var(--fs-xs); color: var(--ink-2); background: var(--fill); padding: 4px 12px; border-radius: 999px; text-align: center; }
.req-closed { text-align: center; }

.req-send-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- long lists inside a panel scroll on their own, so the page stays short ---------- */
.list-scroll {
  max-height: min(62vh, 620px); overflow-y: auto; overscroll-behavior: contain;
  margin-inline: -10px; padding-inline: 10px;  /* room for the scrollbar without squeezing the rows */
  scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent;
  /* soft shadows at the top and bottom edge appear only when there is more to scroll to */
  background:
    linear-gradient(var(--surface) 30%, transparent) top / 100% 28px no-repeat local,
    linear-gradient(transparent, var(--surface) 70%) bottom / 100% 28px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .16), transparent) top / 100% 10px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .16), transparent) bottom / 100% 10px no-repeat scroll;
}
.list-scroll::-webkit-scrollbar { width: 8px; }
.list-scroll::-webkit-scrollbar-thumb { background: var(--fill-2); border-radius: 8px; }
.list-scroll::-webkit-scrollbar-track { background: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .list-scroll {
    background:
      linear-gradient(var(--surface) 30%, transparent) top / 100% 28px no-repeat local,
      linear-gradient(transparent, var(--surface) 70%) bottom / 100% 28px no-repeat local,
      radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .55), transparent) top / 100% 10px no-repeat scroll,
      radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .55), transparent) bottom / 100% 10px no-repeat scroll;
  }
}
:root[data-theme="dark"] .list-scroll {
  background:
    linear-gradient(var(--surface) 30%, transparent) top / 100% 28px no-repeat local,
    linear-gradient(transparent, var(--surface) 70%) bottom / 100% 28px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .55), transparent) top / 100% 10px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .55), transparent) bottom / 100% 10px no-repeat scroll;
}

/* ---------- grades: publish to everyone at once, appeals ---------- */
.publish-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r-lg);
  background: var(--warn-soft); color: var(--warn-ink);
}
.publish-bar .grow { flex: 1; min-width: 220px; display: grid; gap: 2px; font-size: var(--fs-sm); }
.publish-bar.is-published { background: var(--ok-soft); color: var(--ok); }
.publish-bar.is-published span { color: var(--ink-2); }
.note-info { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand); font-size: var(--fs-sm); }
.grade-old { font-size: 15px; color: var(--ink-3); margin-inline-end: 8px; }
.appeal-box { margin-top: 14px; }
.appeal-box > summary { list-style: none; width: fit-content; }
.appeal-box > summary::-webkit-details-marker { display: none; }
.appeal-box[open] > summary { display: none; }
.appeal-form { padding: 14px; border-radius: var(--r-md); background: var(--fill); }
.appeal-form .btn { justify-self: start; }
.appeal-card { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--fill); display: grid; gap: 8px; }
.appeal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appeal-text, .appeal-reply { white-space: pre-line; line-height: 1.55; font-size: var(--fs-sm); }
.appeal-reply { padding-top: 8px; border-top: 1px solid var(--line); }
.appeal-resolve .row .btn { min-width: 0; }
.asg-list.list-scroll { max-height: min(56vh, 560px); }

/* ---------- attendance report scrolls inside its panel: the header row and the names stay in view ---------- */
.table-scroll { max-height: min(66vh, 680px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.table-scroll .matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.table-scroll .matrix tbody td:first-child, .table-scroll .matrix thead th:first-child {
  position: sticky; right: 0; z-index: 1; background: var(--surface);
}
.table-scroll .matrix thead th:first-child { z-index: 3; }
.table-scroll .matrix tbody tr:hover td:first-child { background: var(--bg); }

/* ---------- attendance appeals ---------- */
.att-history { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.att-history h3 { font-size: var(--fs-md); margin-bottom: 10px; }
.att-lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: min(50vh, 460px); }
.att-lesson { border-radius: var(--r-md); background: var(--fill); }
.att-lesson > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none;
}
.att-lesson > summary::-webkit-details-marker { display: none; }
.att-lesson-title { font-weight: 600; flex: 1; }
.att-samples { list-style: none; margin: 0; padding: 0 14px 12px; display: grid; gap: 8px; }
.att-samples > li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.att-sample-name { min-width: 72px; font-size: var(--fs-sm); }
.att-reply { flex-basis: 100%; font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-line; }
.att-appeal { margin-top: 0; }
.att-appeal[open] { flex-basis: 100%; }
.att-appeals h2 { margin-bottom: 8px; }
.att-appeals .appeal-text { margin: 4px 0 10px; }
.att-resolve { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.att-resolve input { flex: 1; min-width: 200px; }

.att-appeals { margin-bottom: 20px; }

/* ---------- checking assignments with AI ---------- */
:root { --ai: #7C4DDB; --ai-soft: rgba(124, 77, 219, .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ai: #B39AF5; --ai-soft: rgba(179, 154, 245, .16); } }
:root[data-theme="dark"] { --ai: #B39AF5; --ai-soft: rgba(179, 154, 245, .16); }
.pill-ai { background: var(--ai-soft); color: var(--ai); }
.ai-spark { color: var(--ai); }
.ai-panel { display: grid; gap: 12px; }
.ai-panel > summary h2 { display: inline-flex; align-items: center; gap: 8px; }
.ai-panel > summary { display: flex; align-items: center; gap: 10px; }
.ai-panel > summary h2 { flex: 1; }
.ai-settings { padding: 14px; border-radius: var(--r-md); background: var(--fill); }
.ai-settings .btn { justify-self: start; }
.ai-run { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px; border-radius: var(--r-md); background: var(--ai-soft); }
.ai-run .grow { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.ai-run .level { height: 6px; border-radius: 6px; background: var(--fill-2); overflow: hidden; }
.ai-run .level span { display: block; height: 100%; background: var(--ai); transform-origin: right; transition: transform .5s var(--ease); }
.ai-error { color: var(--danger); }
.ai-suggest { display: grid; gap: 6px; padding: 12px 14px; margin-bottom: 10px; border-radius: var(--r-md); background: var(--ai-soft); font-size: var(--fs-sm); line-height: 1.55; }
.ai-suggest p { white-space: pre-line; }
.ai-suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-flag-text { margin-bottom: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: var(--fs-sm); white-space: pre-line; }
.publish-bar { margin-top: 0; }

.att-lesson > summary .fold-chevron { width: 28px; height: 28px; }
.att-lesson:not([open]) .fold-chevron::before { transform: translateY(-2px) rotate(45deg); }
.att-lesson > summary:hover .fold-chevron { background: var(--fill-2); }

/* ---------- funnel filter: a glass button with a small glass menu ---------- */
.list-search-row.has-funnel { flex-wrap: nowrap; margin-bottom: 10px; }
.list-search-row.has-funnel .list-search { flex: 1; }
.list-state { display: flex; align-items: center; gap: 10px; min-height: 30px; margin-bottom: 6px; }
.funnel { position: relative; flex: none; }
.funnel-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
  background: var(--glass); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .1), 0 0 0 .5px var(--glass-line), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: color .15s, transform .15s var(--ease), background .15s;
}
.funnel-btn:hover { color: var(--ink); }
.funnel-btn:active { transform: scale(.93); }
.funnel-btn.on { color: var(--brand); background: var(--glass-glow); }
.funnel-btn.on path { fill: color-mix(in srgb, currentColor 22%, transparent); }
.funnel-menu {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; min-width: 210px; padding: 6px; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(26px) saturate(190%); backdrop-filter: blur(26px) saturate(190%);
  box-shadow: var(--glass-shadow), 0 0 0 .5px var(--glass-line); animation: pop .16s var(--ease);
}
.funnel-menu button {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 0; border-radius: 14px;
  background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-sm); text-align: start; cursor: pointer;
}
.funnel-menu button:hover, .funnel-menu button:focus-visible { background: var(--fill-2); outline: none; }
.funnel-menu .grow { flex: 1; }
.funnel-check { width: 16px; color: var(--brand); font-weight: 700; visibility: hidden; }
.funnel-menu [aria-checked="true"] { font-weight: 600; }
.funnel-menu [aria-checked="true"] .funnel-check { visibility: visible; }
.funnel-n { color: var(--ink-2); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.funnel-chip {
  border: 0; padding: 5px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.funnel-chip:hover { filter: brightness(.96); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .funnel-menu, .funnel-btn { background: var(--surface); }
}

/* ---------- grades ---------- */
input[type=date], input[type=datetime-local] {
  font: inherit; font-size: 16px; color: var(--ink); width: 100%; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
}
.weights-note { margin-bottom: 12px; }
.grade-total { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); box-shadow: 0 0 0 1px var(--line) inset; }
.grade-total .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.grade-total-num { flex: none; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tone-ok { color: var(--ok); }
.tone-danger, .matrix td.tone-danger { color: var(--danger); }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.sub-head h3 { font-size: var(--fs-md); }
.asg-row.is-static, .asg-row.is-static:hover { background: var(--fill); cursor: default; }
.asg-row.is-static:active { transform: none; }
.exam-item .appeal-box { margin: 4px 0 0; }
.exam-item .appeal-box[open], .exam-item .appeal-card { margin-top: 8px; }
input[type=number].grade-input { width: 92px; flex: none; text-align: center; padding: 9px 8px; }
.att-resolve input[type=number].grade-input { flex: none; min-width: 0; }
.save-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.weights-total { font-weight: 600; font-variant-numeric: tabular-nums; }
.weights-total.is-over { color: var(--danger); }
.th-title { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-inline: auto; color: var(--ink); }
.th-sub { display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.solution-row { margin-bottom: 14px; }
/* no spinner arrows in the grade boxes: they push the number off centre, and a scroll could change a grade */
.grade-input { appearance: textfield; -moz-appearance: textfield; }
.grade-input::-webkit-inner-spin-button, .grade-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- chat look: wallpaper and the colour of my own messages, chosen by each user ---------- */
[data-wall="doodles"] { --wall-color: #EFE7DD; --wall-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 210' fill='none' stroke='rgba%28110%2C92%2C70%2C.16%29' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 30c6-3 12-3 16 0v18c-4-3-10-3-16 0zM34 30c4-3 10-3 16 0v18c-6-3-12-3-16 0z'/%3E%3Cpath d='M118 46l22-22 6 6-22 22h-6zM136 28l6 6'/%3E%3Cpath d='M78 70a10 10 0 1 1 12 15v5h-10v-5a10 10 0 0 1-2-15zM80 94h8'/%3E%3Cpath d='M165 80l3 7 7 .6-5.4 4.6 1.7 7-6.3-3.8-6.3 3.8 1.7-7-5.4-4.6 7-.6z'/%3E%3Cpath d='M22 112h26a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-16l-7 6v-6h-3a4 4 0 0 1-4-4v-12a4 4 0 0 1 4-4z'/%3E%3Cpath d='M100 132l18-8 18 8-18 8zM108 136v8c6 4 14 4 20 0v-8'/%3E%3Cpath d='M150 172l30-12-12 28-5-11zM163 177l17-17'/%3E%3Cpath d='M70 160c-6-4-10-7-10-11a5 5 0 0 1 10-2 5 5 0 0 1 10 2c0 4-4 7-10 11z'/%3E%3Cpath d='M112 192q5-6 10 0t10 0t10 0'/%3E%3Cpath d='M177 122a8 8 0 1 0 16 0a8 8 0 1 0-16 0M185 117v5l3 2'/%3E%3Cpath d='M58 196l8-14 8 14zM24 172h14M31 165v14'/%3E%3Cpath d='M150 16a3 3 0 1 0 6 0a3 3 0 1 0-6 0M92 28a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0-5 0M192 64a2 2 0 1 0 4 0a2 2 0 1 0-4 0'/%3E%3C/svg%3E"); --wall-size: 200px; }
[data-wall="sand"] { --wall-color: #F2E6D3; --wall-image: none; }
[data-wall="mint"] { --wall-color: #DCEFE4; --wall-image: none; }
[data-wall="sky"] { --wall-color: #DCEAF6; --wall-image: none; }
[data-wall="lavender"] { --wall-color: #E7E1F5; --wall-image: none; }
[data-wall="rose"] { --wall-color: #F6E1E4; --wall-image: none; }
[data-wall="slate"] { --wall-color: #D9DEE3; --wall-image: none; }
[data-bubble="brand"] { --mine-bg: var(--brand); --mine-ink: #fff; --mine-meta: rgba(255,255,255,.72); --mine-read: #9BE7FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="green"] { --mine-bg: #D9FDD3; --mine-ink: #111B21; --mine-meta: #667781; --mine-read: #53BDEB; --mine-quote: rgba(0,0,0,.05); --mine-line: #1DAA61; }
[data-bubble="teal"] { --mine-bg: #00897B; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.72); --mine-read: #B2F5EA; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="purple"] { --mine-bg: #7C4DDB; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.72); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="pink"] { --mine-bg: #D63A7A; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.75); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="orange"] { --mine-bg: #E8590C; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.78); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.18); --mine-line: #fff; }
[data-bubble="graphite"] { --mine-bg: #3A3A3C; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.65); --mine-read: #9BE7FF; --mine-quote: rgba(255,255,255,.12); --mine-line: #fff; }
[data-wall="plain"] { --wall-color: var(--bg); --wall-image: none; }
[data-wall="image"] { --wall-color: var(--bg); --wall-image: var(--wall-photo); --wall-size: cover; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    [data-wall="doodles"] { --wall-color: #0D1418; --wall-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 210' fill='none' stroke='rgba%28255%2C255%2C255%2C.055%29' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 30c6-3 12-3 16 0v18c-4-3-10-3-16 0zM34 30c4-3 10-3 16 0v18c-6-3-12-3-16 0z'/%3E%3Cpath d='M118 46l22-22 6 6-22 22h-6zM136 28l6 6'/%3E%3Cpath d='M78 70a10 10 0 1 1 12 15v5h-10v-5a10 10 0 0 1-2-15zM80 94h8'/%3E%3Cpath d='M165 80l3 7 7 .6-5.4 4.6 1.7 7-6.3-3.8-6.3 3.8 1.7-7-5.4-4.6 7-.6z'/%3E%3Cpath d='M22 112h26a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-16l-7 6v-6h-3a4 4 0 0 1-4-4v-12a4 4 0 0 1 4-4z'/%3E%3Cpath d='M100 132l18-8 18 8-18 8zM108 136v8c6 4 14 4 20 0v-8'/%3E%3Cpath d='M150 172l30-12-12 28-5-11zM163 177l17-17'/%3E%3Cpath d='M70 160c-6-4-10-7-10-11a5 5 0 0 1 10-2 5 5 0 0 1 10 2c0 4-4 7-10 11z'/%3E%3Cpath d='M112 192q5-6 10 0t10 0t10 0'/%3E%3Cpath d='M177 122a8 8 0 1 0 16 0a8 8 0 1 0-16 0M185 117v5l3 2'/%3E%3Cpath d='M58 196l8-14 8 14zM24 172h14M31 165v14'/%3E%3Cpath d='M150 16a3 3 0 1 0 6 0a3 3 0 1 0-6 0M92 28a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0-5 0M192 64a2 2 0 1 0 4 0a2 2 0 1 0-4 0'/%3E%3C/svg%3E"); }
    [data-wall="sand"] { --wall-color: #2A2520; }
    [data-wall="mint"] { --wall-color: #17241D; }
    [data-wall="sky"] { --wall-color: #15202A; }
    [data-wall="lavender"] { --wall-color: #1F1B2B; }
    [data-wall="rose"] { --wall-color: #2A1B1F; }
    [data-wall="slate"] { --wall-color: #1B1F24; }
    [data-bubble="green"] { --mine-bg: #005C4B; --mine-ink: #E9EDEF; --mine-meta: rgba(233,237,239,.62); --mine-read: #53BDEB; --mine-quote: rgba(0,0,0,.18); --mine-line: #06CF9C; }
    [data-bubble="graphite"] { --mine-bg: #4A4A4E; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.65); --mine-read: #9BE7FF; --mine-quote: rgba(255,255,255,.12); --mine-line: #fff; }
  }
}
:root[data-theme="dark"] [data-wall="doodles"] { --wall-color: #0D1418; --wall-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 210' fill='none' stroke='rgba%28255%2C255%2C255%2C.055%29' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 30c6-3 12-3 16 0v18c-4-3-10-3-16 0zM34 30c4-3 10-3 16 0v18c-6-3-12-3-16 0z'/%3E%3Cpath d='M118 46l22-22 6 6-22 22h-6zM136 28l6 6'/%3E%3Cpath d='M78 70a10 10 0 1 1 12 15v5h-10v-5a10 10 0 0 1-2-15zM80 94h8'/%3E%3Cpath d='M165 80l3 7 7 .6-5.4 4.6 1.7 7-6.3-3.8-6.3 3.8 1.7-7-5.4-4.6 7-.6z'/%3E%3Cpath d='M22 112h26a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-16l-7 6v-6h-3a4 4 0 0 1-4-4v-12a4 4 0 0 1 4-4z'/%3E%3Cpath d='M100 132l18-8 18 8-18 8zM108 136v8c6 4 14 4 20 0v-8'/%3E%3Cpath d='M150 172l30-12-12 28-5-11zM163 177l17-17'/%3E%3Cpath d='M70 160c-6-4-10-7-10-11a5 5 0 0 1 10-2 5 5 0 0 1 10 2c0 4-4 7-10 11z'/%3E%3Cpath d='M112 192q5-6 10 0t10 0t10 0'/%3E%3Cpath d='M177 122a8 8 0 1 0 16 0a8 8 0 1 0-16 0M185 117v5l3 2'/%3E%3Cpath d='M58 196l8-14 8 14zM24 172h14M31 165v14'/%3E%3Cpath d='M150 16a3 3 0 1 0 6 0a3 3 0 1 0-6 0M92 28a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0-5 0M192 64a2 2 0 1 0 4 0a2 2 0 1 0-4 0'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] [data-wall="sand"] { --wall-color: #2A2520; }
:root[data-theme="dark"] [data-wall="mint"] { --wall-color: #17241D; }
:root[data-theme="dark"] [data-wall="sky"] { --wall-color: #15202A; }
:root[data-theme="dark"] [data-wall="lavender"] { --wall-color: #1F1B2B; }
:root[data-theme="dark"] [data-wall="rose"] { --wall-color: #2A1B1F; }
:root[data-theme="dark"] [data-wall="slate"] { --wall-color: #1B1F24; }
:root[data-theme="dark"] [data-bubble="green"] { --mine-bg: #005C4B; --mine-ink: #E9EDEF; --mine-meta: rgba(233,237,239,.62); --mine-read: #53BDEB; --mine-quote: rgba(0,0,0,.18); --mine-line: #06CF9C; }
:root[data-theme="dark"] [data-bubble="graphite"] { --mine-bg: #4A4A4E; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.65); --mine-read: #9BE7FF; --mine-quote: rgba(255,255,255,.12); --mine-line: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-wall="image"] { --wall-image: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.35)), var(--wall-photo); }
}
:root[data-theme="dark"] [data-wall="image"] { --wall-image: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.35)), var(--wall-photo); }
.chat-scroll, .wall-surface {
  background-color: var(--wall-color, var(--bg)); background-image: var(--wall-image, none);
  background-size: var(--wall-size, auto); background-position: center;
}
.msg.mine .bubble { background: var(--mine-bg, var(--brand)); color: var(--mine-ink, #fff); }
.msg.mine .time, .msg.mine .who-anon, .msg.mine .msg-pin, .msg.mine .msg-star { color: var(--mine-meta, rgba(255,255,255,.72)); }
.msg.mine .ticks { color: var(--mine-meta, rgba(255,255,255,.8)); }
.msg.mine .ticks.read-all { color: var(--mine-read, #9BE7FF); }
.msg.mine .quote { background: var(--mine-quote, rgba(255,255,255,.16)); border-color: var(--mine-line, #fff); }
.msg.mine .quote strong { color: var(--mine-line, #fff); }
.msg.mine .quote span { color: var(--mine-ink, #fff); opacity: .85; }
.msg.mine .poll-bar { background: var(--mine-quote, rgba(255,255,255,.25)); }
.msg.mine .poll-bar span { background: var(--mine-line, #fff); }
.msg.mine .poll-opt.chosen .poll-radio { box-shadow: inset 0 0 0 3px var(--mine-bg, var(--brand)); }
.msg.mine.deleted .bubble { background: color-mix(in srgb, var(--mine-bg, var(--brand)) 14%, var(--surface)); color: var(--ink-2); }
.msg-star { display: inline-flex; color: var(--ink-3); font-size: 11px; line-height: 1; }

/* the round "back to the newest" button, like WhatsApp. It sits at the bottom of the scroll area */
.jump-wrap { position: sticky; bottom: 4px; height: 0; z-index: 3; }
.jump-latest {
  position: absolute; bottom: 0; inset-inline-end: 0; width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 2px 8px rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: opacity .18s, transform .18s var(--ease);
}
.jump-latest[hidden] { display: grid !important; opacity: 0; transform: translateY(8px) scale(.9); pointer-events: none; }
.jump-latest:hover { color: var(--ink); }
.jump-count {
  position: absolute; top: -6px; inset-inline-start: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}

/* the "more" menu in the chat header */
.chat-more { position: relative; flex: none; }
.chat-more-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 6px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--glass-edge, var(--line));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-pop); animation: pop .16s var(--ease);
}
.chat-more-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-sm); text-align: start; cursor: pointer;
}
.chat-more-menu button:hover, .chat-more-menu button:focus-visible { background: var(--fill-2); outline: none; }
.chat-more-menu svg { flex: none; color: var(--ink-2); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 8px; font-weight: 700; }

/* the look dialog */
.theme-dialog { width: min(460px, calc(100vw - 24px)); }
.theme-dialog .dialog-body { gap: 12px; }
.theme-preview { border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.theme-preview .wall-surface { display: grid; gap: 6px; padding: 14px 12px; }
.theme-preview .msg { max-width: 80%; }
.theme-dialog h3 { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.swatch {
  position: relative; display: grid; gap: 4px; justify-items: center; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 11px; color: var(--ink-2);
}
.swatch-tile { width: 100%; aspect-ratio: 1; border-radius: 14px; box-shadow: 0 0 0 1px var(--line) inset; display: grid; place-items: center; overflow: hidden; }
.swatch[aria-checked="true"] .swatch-tile { box-shadow: 0 0 0 2.5px var(--brand); }
.swatch[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.swatch-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--mine-bg); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.swatch-photo { background: var(--fill); color: var(--ink-2); background-size: cover; background-position: center; }
.scope-ask { display: grid; gap: 8px; padding: 14px; border-radius: var(--r-md); background: var(--fill); }
.scope-ask .btn { width: 100%; }
.theme-actions { display: flex; gap: 8px; align-items: center; }
.theme-actions .grow { flex: 1; }

/* colour swatches: just the round dot, with a ring when chosen */
.swatches.bubble-row { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.bubble-row .swatch-tile { aspect-ratio: auto; height: 44px; box-shadow: none; }
.bubble-row .swatch[aria-checked="true"] .swatch-tile { box-shadow: none; }
.bubble-row .swatch[aria-checked="true"] .swatch-dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand); }
.theme-dialog .swatches:not(.bubble-row) { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }

/* ---------- the chat slides in over the course page (chat_sheet.js) ---------- */
.chat-sheet {
  position: fixed; inset: 0; z-index: 70; background: var(--surface);
  transform: translateX(-100%); visibility: hidden;
  transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .34s;
  box-shadow: 0 0 40px rgba(0, 0, 0, .25);
}
.chat-sheet.open { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.chat-sheet iframe { display: block; width: 100%; height: 100%; border: 0; }
html.chat-sheet-open, html.chat-sheet-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .chat-sheet, .chat-sheet.open { transition: none; }
}
/* other pages: a soft cross-fade instead of a white flash, where the browser supports it */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- glass, like the bars in the WhatsApp app ---------- */
:root {
  --chrome-glass: rgba(248, 248, 250, .6);
  --chrome-edge: rgba(0, 0, 0, .09);
  --chrome-blur: blur(22px) saturate(185%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chrome-glass: rgba(26, 26, 30, .58); --chrome-edge: rgba(255, 255, 255, .08); }
}
:root[data-theme="dark"] { --chrome-glass: rgba(26, 26, 30, .58); --chrome-edge: rgba(255, 255, 255, .08); }

/* the chat page: the scrolling area fills the screen, and the header and input bar float over it */
.chat-page { position: relative; overflow: hidden; }
.chat-page .chat-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 8; border-bottom: .5px solid var(--chrome-edge);
  background: var(--chrome-glass); -webkit-backdrop-filter: var(--chrome-blur); backdrop-filter: var(--chrome-blur);
}
.chat-page .chat { position: absolute; inset: 0; display: block; margin: 0; }
.chat-page .chat-scroll {
  position: absolute; inset: 0; height: auto;
  padding-top: calc(var(--top-h, 60px) + 10px); padding-bottom: calc(var(--bottom-h, 72px) + 10px);
}
/* sticky counts from inside the scroll area's padding, so the date pill lands right under the glass header */
.chat-page .day-divider { top: 6px; }
.chat-page .pinned-bar {
  position: absolute; top: var(--bar-h, 60px); left: 0; right: 0; z-index: 7; border-bottom: .5px solid var(--chrome-edge);
  background: var(--chrome-glass); -webkit-backdrop-filter: var(--chrome-blur); backdrop-filter: var(--chrome-blur);
}
.chat-page .chat-search-results { top: var(--bar-h, 60px); z-index: 9; }
.chat-page .composer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; border-top: .5px solid var(--chrome-edge);
  background: var(--chrome-glass); -webkit-backdrop-filter: var(--chrome-blur); backdrop-filter: var(--chrome-blur);
}
.chat-page .chat-locked-bar {
  position: absolute; left: 0; right: 0; bottom: var(--composer-h, 0px); z-index: 7; border-top: 0;
  background: color-mix(in srgb, var(--warn-soft) 82%, transparent);
  -webkit-backdrop-filter: var(--chrome-blur); backdrop-filter: var(--chrome-blur);
}
.chat-page .jump-wrap { position: absolute; z-index: 6; height: auto; bottom: calc(var(--bottom-h, 72px) + 12px); inset-inline-end: 14px; }
.chat-page .jump-latest { position: relative; }
.chat-page .composer-field textarea { background: var(--surface); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chat-page .chat-bar, .chat-page .composer, .chat-page .pinned-bar { background: var(--surface); }
}

/* the course tab bar: lighter and clearer, with a bright rim on top, like iOS glass */
:root {
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .34));
  --glass-edge: rgba(255, 255, 255, .7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --glass: linear-gradient(180deg, rgba(70, 70, 78, .5), rgba(36, 36, 42, .42)); --glass-edge: rgba(255, 255, 255, .16); }
}
:root[data-theme="dark"] { --glass: linear-gradient(180deg, rgba(70, 70, 78, .5), rgba(36, 36, 42, .42)); --glass-edge: rgba(255, 255, 255, .16); }
.tabbar {
  -webkit-backdrop-filter: blur(16px) saturate(210%) brightness(1.04); backdrop-filter: blur(16px) saturate(210%) brightness(1.04);
  border-width: .5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06),
              inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(255, 255, 255, .12);
}
.tabbar::before {  /* the light catching the top edge */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 80% at 50% -30%, rgba(255, 255, 255, .45), transparent 60%);
  mix-blend-mode: soft-light;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: var(--surface); }
}

/* a tap leaves no hover or focus glow on the tab icons; the ring is only for keyboard users */
.tabbar a:hover { color: var(--ink-2); }
.tabbar a.on:hover { color: var(--brand); }
@media (hover: hover) and (pointer: fine) { .tabbar a:hover { color: var(--ink); } .tabbar a.on:hover { color: var(--brand); } }
.tabbar a:focus:not(:focus-visible) { outline: none; }

/* swiping a message: the browser keeps vertical scrolling, the sideways move is ours */
.msg { position: relative; touch-action: pan-y; }
.swipe-hint {
  position: absolute; top: 50%; z-index: 0; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2); background: color-mix(in srgb, var(--surface) 85%, transparent);
  box-shadow: 0 1px 3px rgba(0,0,0,.15); opacity: 0; transition: transform .15s var(--ease), color .15s;
  pointer-events: none;
}
.swipe-hint.ready { transform: scale(1.12); color: var(--brand); }
.msg .bubble { position: relative; z-index: 1; }

/* more colours for my messages. White text only on colours dark enough to read it */
[data-bubble="sky"] { --mine-bg: #0071E3; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="navy"] { --mine-bg: #1F3A8A; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="olive"] { --mine-bg: #4D7326; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="red"] { --mine-bg: #C9302C; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="brown"] { --mine-bg: #7A4E33; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="teal"] { --mine-bg: #00796B; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #B2F5EA; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="pink"] { --mine-bg: #C2255C; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="orange"] { --mine-bg: #C2410C; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
[data-bubble="lilac"] { --mine-bg: #EBDDFF; --mine-ink: #2A1A4A; --mine-meta: #6B5A8A; --mine-read: #2E9BD6; --mine-quote: rgba(0,0,0,.05); --mine-line: #7C4DDB; }
[data-bubble="peach"] { --mine-bg: #FFE2CC; --mine-ink: #3D2412; --mine-meta: #8A6A52; --mine-read: #2E9BD6; --mine-quote: rgba(0,0,0,.05); --mine-line: #C2410C; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-bubble="lilac"] { --mine-bg: #4B2E83; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
  :root:not([data-theme="light"]) [data-bubble="peach"] { --mine-bg: #7A3E12; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
}
:root[data-theme="dark"] [data-bubble="lilac"] { --mine-bg: #4B2E83; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
:root[data-theme="dark"] [data-bubble="peach"] { --mine-bg: #7A3E12; --mine-ink: #fff; --mine-meta: rgba(255,255,255,.74); --mine-read: #C7F0FF; --mine-quote: rgba(255,255,255,.16); --mine-line: #fff; }
.swatches.bubble-row { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.bubble-row .swatch-tile { height: 40px; }

/* ---------- the tab bar, take three: calm glass like the iPhone's music app ----------
   a thin hairline instead of a bright rim, a neutral pill behind the current tab, and in the dark no shine at all */
:root {
  --glass: rgba(250, 250, 252, .62);
  --glass-edge: rgba(0, 0, 0, .06);
  --glass-glow: rgba(0, 0, 0, .065);
  --tab-rim: rgba(255, 255, 255, .7);
  --tab-shadow: 0 8px 28px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .06);
  --tab-sheen: 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(38, 38, 42, .5);
    --glass-edge: rgba(255, 255, 255, .08);
    --glass-glow: rgba(255, 255, 255, .11);
    --tab-rim: rgba(255, 255, 255, .06);
    --tab-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --tab-sheen: 0;
  }
}
:root[data-theme="dark"] {
  --glass: rgba(38, 38, 42, .5);
  --glass-edge: rgba(255, 255, 255, .08);
  --glass-glow: rgba(255, 255, 255, .11);
  --tab-rim: rgba(255, 255, 255, .06);
  --tab-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --tab-sheen: 0;
}
.tabbar {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  border: .5px solid var(--glass-edge);
  box-shadow: var(--tab-shadow), inset 0 .5px 0 var(--tab-rim);
}
.tabbar::before { opacity: calc(.6 * var(--tab-sheen)); }
.tabbar-glow { box-shadow: none; }

.ai-deductions { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; }
.ai-deductions li { display: flex; gap: 8px; align-items: baseline; }
.ai-deductions b { flex: none; color: var(--danger); font-variant-numeric: tabular-nums; }
.grade-form textarea { line-height: 1.5; }
