/* Hallmark · page: Live Classes · pre-emit critique: P5 H5 E4 S5 R5 V4
 * genre: modern-minimal · macrostructure: Workbench · theme: OnLearn locked
 * designed-as-app · enrichment: none · contrast: pass · mobile: pass
 */
/* ============================================================================
   OnLearn — application styles
   Loaded after tokens.css. Server-rendered (HTMX/Alpine), no build step.
   Sections: base · type · layout shell · sidebar · topbar · buttons · cards ·
   badges · spine (signature) · progress · forms · menu · toast · skeleton ·
   auth · landing · motion · responsive.
   ========================================================================== */

/* ------------------------------------------- community unread (WhatsApp-style) */
/* The contrast lives in the READ state being calmer: read threads dim to a
   lighter, lower-weight title; unread threads keep full-strength bold + a tint,
   an accent bar, and a haloed dot. Opening a thread clears the marker so it
   renders in the calm read state next time. */
.community-thread__unread {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--violet); margin-right: 2px; flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 22%, transparent);
}
/* read = calmer (weights pinned to the loaded Manrope steps: 500 vs 800) */
.community-thread:not(.is-unread) .community-thread__title { font-weight: 500; color: var(--text-muted); }
.community-thread:not(.is-unread) .community-thread__author { font-weight: 500; }
/* unread = full strength */
.community-thread.is-unread { background: color-mix(in srgb, var(--violet) 8%, transparent); box-shadow: inset 3px 0 0 var(--violet); }
.community-thread.is-unread .community-thread__title { font-weight: 800; color: var(--heading); }
.community-thread.is-unread .community-thread__author { font-weight: 700; color: var(--text); }

.community-reply.is-unread { border-left: 2px solid var(--violet); background: color-mix(in srgb, var(--violet) 6%, transparent); }
.community-reply.is-unread .community-reply__body { font-weight: 600; }

/* ----------------------------------------------- notifications bell (topbar) */
.notif { position: relative; }
.notif__bell { position: relative; }
.notif__badge-slot { position: absolute; top: -3px; right: -3px; pointer-events: none; }
.notif__dot {
  display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #e5484d; color: #fff;
  font: 700 10px/1 var(--font-mono); border: 2px solid var(--surface);
}
.notif__panel { min-width: 320px; max-width: 360px; max-height: 72vh; overflow-y: auto; }
.notif__item {
  position: relative; display: grid;
  grid-template-columns: calc(var(--sp-8) + var(--sp-1)) minmax(0, 1fr) var(--sp-4);
  gap: var(--sp-3); align-items: start; padding: var(--sp-3);
  border: 1px solid transparent; border-radius: var(--r-md);
  color: inherit; text-decoration: none;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
              transform var(--dur-1) var(--ease);
}
.notif__item:hover {
  background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px);
}
.notif__item.is-unread {
  background: color-mix(in srgb, var(--violet) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--violet) 28%, var(--border));
}
.notif__icon {
  display: grid; place-items: center;
  width: calc(var(--sp-8) + var(--sp-1)); height: calc(var(--sp-8) + var(--sp-1));
  border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-muted);
}
.notif__item.is-unread .notif__icon {
  background: color-mix(in srgb, var(--violet) 18%, var(--surface-3)); color: var(--accent-text);
}
.notif__icon svg { width: var(--sp-4); height: var(--sp-4); }
.notif__text { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; font-size: var(--fs-sm); }
.notif__title-row { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.notif__title-row strong {
  min-width: 0; color: var(--text); font-weight: 600; line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif__item.is-unread .notif__title-row strong { font-weight: 700; }
.notif__unread {
  width: var(--sp-2); height: var(--sp-2); margin-top: var(--sp-1); flex: none;
  border-radius: var(--r-pill); background: var(--violet-300);
  box-shadow: 0 0 0 var(--sp-1) color-mix(in srgb, var(--violet) 16%, transparent);
}
.notif__text > span:not(.notif__title-row):not(.notif__meta) {
  color: var(--text-muted); font-size: var(--fs-xs); line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1);
  color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-xs);
}
.notif__meta time { white-space: nowrap; }
.notif__chevron {
  align-self: center; width: var(--sp-4); height: var(--sp-4); color: var(--text-faint);
  transition: color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.notif__item:hover .notif__chevron { color: var(--accent-text); transform: translateX(var(--sp-1)); }
.notifications-feed { display: grid; gap: var(--sp-3); }
.notifications-feed .notif__item {
  grid-template-columns: var(--sp-10) minmax(0, 1fr) var(--sp-5);
  padding: var(--sp-4); background: var(--surface); border-color: var(--border);
  box-shadow: var(--shadow-1);
}
.notifications-feed .notif__item.is-unread {
  background: color-mix(in srgb, var(--violet) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--violet) 30%, var(--border));
}
.notifications-feed .notif__icon { width: var(--sp-10); height: var(--sp-10); }
.notifications-feed .notif__text { gap: var(--sp-2); }
.notifications-feed .notif__text > span:not(.notif__title-row):not(.notif__meta) {
  font-size: var(--fs-sm); -webkit-line-clamp: 3;
}
.notif__empty { padding: 18px 8px; text-align: center; color: var(--text-faint); font-size: var(--fs-sm); }

/* ----------------------------------------------------------- base + reset */
*, *::before, *::after { box-sizing: border-box; }
/* Content protection (soft): images can't be dragged out or text-selected for
   saving. Right-click is blocked in shell.js. Editable surfaces stay untouched. */
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[x-cloak] { display: none !important; }
::selection { background: rgba(124,58,237,.4); color: #fff; }

/* Ambient backdrop: a faint dual-color aurora, fixed behind everything. */
.aura {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60vw 50vh at 12% -8%, rgba(124,58,237,.16), transparent 60%),
    radial-gradient(55vw 45vh at 100% 0%, rgba(6,182,212,.12), transparent 55%);
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #3a4757; }

/* --------------------------------------------------------------- typography */
.eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted);
}
.grad-text { color: var(--violet-300); }  /* visible fallback */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .grad-text {
    background: var(--grad-text); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
  }
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono  { font-family: var(--font-mono); }
.h1 { font-size: var(--fs-3xl); }
.h2 { font-size: var(--fs-2xl); }
.lead { font-size: var(--fs-lg); color: var(--text-muted); line-height: 1.5; }

/* ------------------------------------------------------------------ layout */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-6); }
.container--wide { max-width: var(--container-wide); }
.stack > * + * { margin-top: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.grid { display: grid; gap: var(--sp-5); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }

/* --------------------------------------------------------------- app shell */
.app {
  --rail: var(--sidebar-w);
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  transition: grid-template-columns var(--dur-3) var(--ease);
}
.app.is-collapsed { --rail: var(--sidebar-w-min); }
/* focus mode: sidebar is display:none, so collapse to a single full-width column
   (otherwise app__main would land in a 0-width track). */
.app.is-focus { grid-template-columns: 1fr; }
/* full mode (course hub): no sidebar in any form — the whole viewport belongs
   to the content. The topbar stays (crumbs are the way back) and picks up the
   brand; the rail toggles and the mobile drawer chrome go with the rail.
   Two-class specificity keeps the 1fr grid winning inside the mobile
   breakpoint too. */
.app.is-full { grid-template-columns: 1fr; }
.app.is-full .sidebar,
.app.is-full .sidebar__toggle,
.app.is-full .topbar__hamburger,
.app.is-full .scrim { display: none; }
/* the brand gets its own zone — the full-height divider sits where the
   sidebar's edge would be, so the shell still reads as brand | content */
.topbar__brand {
  display: none; align-items: center; gap: var(--sp-3); flex-shrink: 0;
  align-self: stretch; padding-right: var(--sp-6); margin-right: var(--sp-2);
  border-right: 1px solid var(--border);
}
.app.is-full .topbar__brand { display: flex; }
/* the shared collapse preference still lands on #app — don't let it zero the wordmark */
.app.is-collapsed .topbar__brand .brand-word { opacity: 1; width: auto; }

.app__main { min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: var(--sp-8) var(--sp-8) var(--sp-16); }
.content--narrow { max-width: 1080px; width: 100%; margin-inline: auto; }
.content--flush { padding: 0; }  /* full-bleed workspaces (Practice / Conversational) */

/* ----------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-deep) 100%);
  border-right: 1px solid var(--border);
  overflow: hidden; z-index: 30;
}
.app.is-focus .sidebar { display: none; }
/* head row: just the brand — same height as the topbar (--topbar-h), so the
   two divider lines form one symmetric line across the shell. The sidebar
   toggle lives in the topbar, immediately right of this line. */
.sidebar__head {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding-inline: var(--sp-5);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar__brand { display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 0; }
/* the brand mark IS the actual OnLearn logo (static/img/onlearn_self.svg, the
   magenta arrow — 728×399, ~1.82:1) rendered as a contained background;
   font-size:0 swallows legacy "O" text fallbacks and any icon child is hidden */
.brand-mark {
  width: 40px; height: 24px; border-radius: 0; flex-shrink: 0;
  background: url("../img/onlearn_self.1309ed2c7c1c.svg") center / contain no-repeat;
  font-size: 0; color: transparent; box-shadow: none;
}
.brand-mark i, .brand-mark svg { display: none; }
.brand-mark--logo {
  background: transparent;
  object-fit: contain;
  padding: 2px;
  box-shadow: none;
}
.brand-mark--logo-sm { width: 26px; height: 26px; padding: 1px; }
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; }
.app.is-collapsed .brand-word { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
/* collapsed rail: the brand link stops stretching (flex:1) and drops its gap so
   the mark itself sits dead-center in the rail, like the nav icons below it */
.app.is-collapsed .sidebar__brand { flex: 0 0 auto; gap: 0; justify-content: center; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: 2px; }

/* faculty rail: working-course dropdown — one pick scopes every section.
   The panel OVERLAYS the nav (user decision) — absolute inside the nav
   scroller, so nothing shifts down; collapsed rail shows just the code chip. */
.course-scope { position: relative; margin-bottom: var(--sp-2); }
.course-scope__btn {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  padding: var(--sp-2); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.course-scope__btn:hover { border-color: var(--border-strong); }
.course-scope__btn > i, .course-scope__btn > svg { width: 15px; height: 15px; color: var(--text-faint); flex-shrink: 0; }
.course-scope__code {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--grad); color: #fff;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
}
.course-scope__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.course-scope__name { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-scope__sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.course-scope__panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 45;
  padding: var(--sp-1); max-height: min(48vh, 380px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; gap: 2px;
}
.course-scope__opt {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px var(--sp-2); border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--text-muted);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.course-scope__opt:hover { background: var(--surface-2); color: var(--text); }
.course-scope__opt.is-current { color: var(--text); background: var(--grad-soft); }
.course-scope__opt i, .course-scope__opt svg { width: 14px; height: 14px; flex-shrink: 0; margin-left: auto; color: var(--accent-text); }
.course-scope__optcode {
  width: 34px; flex-shrink: 0; text-align: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--text-faint);
}
.course-scope__optname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-scope__new { border-top: 1px solid var(--border); margin-top: var(--sp-1); }
.course-scope__new i, .course-scope__new svg { margin-left: 0; color: var(--text-faint); }
.app.is-collapsed .course-scope__meta,
.app.is-collapsed .course-scope__btn > i,
.app.is-collapsed .course-scope__btn > svg,
.app.is-collapsed .course-scope__optname,
.app.is-collapsed .course-scope__opt > i,
.app.is-collapsed .course-scope__opt > svg { display: none; }
.app.is-collapsed .course-scope__btn { justify-content: center; }
.app.is-collapsed .course-scope__optcode { width: auto; }
.app.is-collapsed .course-scope__opt { justify-content: center; }
.nav-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.app.is-collapsed .nav-label { opacity: 0; height: var(--sp-4); padding: 0; overflow: hidden; white-space: nowrap; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-3); border-radius: var(--r-sm);
  color: var(--text-muted); font-weight: 500; font-size: var(--fs-base);
  white-space: nowrap; transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.nav-item i, .nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { color: var(--text); background: var(--grad-soft); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -3px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--grad);
  box-shadow: var(--glow-violet);
}
.nav-item__label { transition: opacity var(--dur-2) var(--ease); }
.app.is-collapsed .nav-item__label { opacity: 0; width: 0; overflow: hidden; }
/* collapsed rail: icons sit dead-center (item 5 — the off-center look came from
   keeping the expanded padding + label gap around a zero-width label) */
.app.is-collapsed .nav-item { justify-content: center; padding-inline: 0; gap: 0; }
/* collapsed rail: the onlearn logo sits centered up top, nothing else */
.app.is-collapsed .sidebar__head { justify-content: center; padding-inline: 0; }
.nav-item__badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted); padding: 1px 7px; border-radius: var(--r-pill);
}
.app.is-collapsed .nav-item__badge { display: none; }

.sidebar__foot { flex-shrink: 0; border-top: 1px solid var(--border); padding: var(--sp-3); }
.app.is-collapsed .user-chip { justify-content: center; padding-inline: 0; }
.user-chip {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md); width: 100%; transition: background var(--dur-2) var(--ease);
}
.user-chip > .avatar { flex: 0 0 30px; }
.user-chip:hover { background: var(--surface-2); }
.user-chip__meta { min-width: 0; text-align: left; }
.app.is-collapsed .user-chip__meta { display: none; }
.user-chip__name { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__sub { font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--sp-4);
  padding-inline: var(--sp-6);
  background: rgba(13,17,23,.8);  /* fallback for engines without color-mix */
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.app.is-focus .topbar { display: none; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-sm);
  color: var(--text-muted); transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn i, .icon-btn svg { width: 19px; height: 19px; }

.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-faint); min-width: 0; }
/* ancestor crumbs are the way back — hovering one turns it into a pill and a
   back-chevron slides in, so "this navigates up" needs no label */
.crumbs a {
  position: relative; display: inline-flex; align-items: center;
  padding: 6px 10px; border-radius: var(--r-pill); color: var(--text-muted);
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease),
              padding var(--dur-2) var(--ease);
}
.crumbs a::before {
  content: ""; position: absolute; left: 9px; top: 50%;
  width: 6px; height: 6px;
  border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translate(-4px, -50%) rotate(45deg); opacity: 0;
  transition: transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.crumbs a:hover { color: var(--text); background: var(--surface-2); padding-left: 22px; }
.crumbs a:hover::before { opacity: 1; transform: translate(0, -50%) rotate(45deg); }
.crumbs__sep { color: var(--border-strong); }
.crumbs__here { color: var(--text); font-weight: 600; }

.topbar__spacer { flex: 1; }
.searchbox {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 7px var(--sp-4); color: var(--text-faint); font-size: var(--fs-sm); min-width: 200px;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.searchbox input { flex: 1; border: none; background: none; color: var(--text); outline: none; font-size: var(--fs-sm); padding: 0; box-shadow: none; }
.searchbox kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px;
}

/* streak flame chip */
.streak {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-weight: 600;
  font-size: var(--fs-sm); padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.streak i, .streak svg { width: 15px; height: 15px; color: var(--ember); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-base);
  padding: 10px var(--sp-5); border-radius: var(--r-sm); white-space: nowrap;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease),
              background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
  border: 1px solid transparent;
}
.btn i, .btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px) scale(.99); }
/* text-shadow lifts white labels to AA across the whole gradient (the cyan end
   alone is ~2.4:1 against white) */
.btn--primary { background: var(--grad); color: #fff; box-shadow: var(--glow-violet); text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.btn--primary:hover { box-shadow: 0 14px 50px -10px rgba(124,58,237,.7); transform: translateY(-1px); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn--outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover { background: var(--surface); }
.btn--subtle { background: transparent; color: var(--text-muted); padding-inline: var(--sp-3); }
.btn--subtle:hover { color: var(--text); background: var(--surface-2); }
.btn--block { width: 100%; }
.btn--lg { padding: 14px var(--sp-8); font-size: var(--fs-md); border-radius: var(--r-md); }
.btn--sm { padding: 6px var(--sp-3); font-size: var(--fs-sm); }
.btn:disabled { opacity: .62; pointer-events: none; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-6);
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.card--pad-sm { padding: var(--sp-4); }
.card--raise:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card--glow { position: relative; overflow: hidden; }
.card--glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-3) var(--ease);
  background: radial-gradient(40% 60% at 100% 0%, rgba(124,58,237,.16), transparent 70%);
}
.card--glow:hover::after { opacity: 1; }
.card-link { display: block; color: inherit; }

/* course card */
.course-card { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 220px; }
.course-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.course-glyph {
  width: 46px; height: 46px; border-radius: var(--r-md); display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--violet-300);
}
.course-glyph i, .course-glyph svg { width: 22px; height: 22px; }
.course-card__title { font-size: var(--fs-lg); }
.course-card__desc { color: var(--text-muted); font-size: var(--fs-sm); flex: 1; }
/* Footer: a meta row + full-width stacked CTAs — a clean, professional block
   that never crams two buttons onto one line. */
.course-card__foot { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.course-card__metarow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono);
  font-size: var(--fs-xs); font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--easy   { color: var(--easy);   border-color: color-mix(in srgb, var(--easy) 40%, transparent); }
.badge--medium { color: var(--medium); border-color: color-mix(in srgb, var(--medium) 40%, transparent); }
.badge--hard   { color: var(--hard);   border-color: color-mix(in srgb, var(--hard) 40%, transparent); }
.badge--done   { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.badge--accent { background: var(--grad-soft); color: var(--accent-text); border-color: transparent; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); }
a.pill { color: var(--text-muted); transition: color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
a.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill--on { background: var(--grad-soft); border-color: var(--accent); color: var(--text); }

/* --------------------------------------------------- spine (the signature) */
/* A gradient learning-path rail. Completed portion fills violet->cyan; the
   current node pulses; future nodes stay faint. Used vertically in module/
   topic lists and the timeline, and horizontally in the landing hero. */
.spine { position: relative; }
.spine__node {
  position: relative; display: grid; grid-template-columns: 44px 1fr; gap: var(--sp-4);
  padding-bottom: var(--sp-5);
}
.spine__node:last-child { padding-bottom: 0; }
.spine__rail { position: relative; display: flex; flex-direction: column; align-items: center; }
.spine__rail::after {
  content: ""; position: absolute; top: 30px; bottom: -6px; width: 2px; left: 50%; transform: translateX(-50%);
  background: var(--border-strong);
}
.spine__node:last-child .spine__rail::after { display: none; }
.spine__node.is-done .spine__rail::after { background: var(--grad); }
.spine__dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--text-muted);
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; z-index: 1;
  transition: all var(--dur-3) var(--ease);
}
.spine__dot i, .spine__dot svg { width: 15px; height: 15px; }
.spine__node.is-done .spine__dot { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow-violet); }
.spine__node.is-current .spine__dot { border-color: var(--accent); color: var(--violet-300); animation: pulse-ring 2.4s var(--ease) infinite; }
.spine__body { padding-top: 2px; min-width: 0; }

/* ---------------------------------------------------------------- progress */
/* Stage-colored like the monorepo tracker: violet while getting started
   (<50%), the brand violet→cyan in flight, green once complete. shell.js
   reads data-pct, animates the width, and stamps data-stage on the .bar. */
.bar { display: block; height: 8px; border-radius: var(--r-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); overflow: hidden; }
.bar__fill { display: block; height: 100%; border-radius: inherit; background: var(--grad); width: 0; transition: width var(--dur-4) var(--ease-out); }
.bar[data-stage="start"] .bar__fill { background: linear-gradient(90deg, #6366F1, var(--violet)); box-shadow: 0 0 10px -2px rgba(124, 58, 237, .55); }
.bar[data-stage="mid"] .bar__fill { background: var(--grad); box-shadow: 0 0 10px -2px rgba(6, 182, 212, .5); }
.bar[data-stage="done"] .bar__fill { background: linear-gradient(90deg, var(--success), #10B981); box-shadow: 0 0 10px -2px rgba(52, 211, 153, .55); }

/* ---------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px var(--sp-3); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-faint); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

/* Moderation: a hidden thread/reply is dimmed in the faculty queue. */
.is-hidden-row { opacity: .55; }

/* Faculty discussion moderation: queue first, composer on demand. */
.moderation-page { display: grid; gap: var(--sp-5); }
.moderation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5); margin-bottom: 0; }
.moderation-head .btn { flex: none; margin-top: var(--sp-6); }
.moderation-composer { display: grid; gap: var(--sp-5); }
.moderation-composer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.moderation-composer__head h2 { margin: var(--sp-1) 0; font-size: var(--fs-xl); }
.moderation-composer__head p:last-child { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.moderation-composer__options { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.moderation-composer__options > summary { padding: var(--sp-3) var(--sp-4); }
.moderation-composer__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.moderation-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); }
.moderation-summary > div { display: flex; align-items: baseline; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.moderation-summary strong { color: var(--text); font-family: var(--font-display); font-size: var(--fs-xl); }
.moderation-summary span { color: var(--text-muted); font-size: var(--fs-xs); }
.moderation-toolbar { display: grid; grid-template-columns: minmax(var(--moderation-search-min), 1fr) repeat(3, minmax(var(--moderation-filter-min), auto)) auto auto; gap: var(--sp-2); align-items: center; padding: var(--sp-3); }
.moderation-toolbar .input { min-height: var(--sp-9); padding-block: var(--sp-2); font-size: var(--fs-xs); }
.moderation-search { position: relative; }
.moderation-search svg { position: absolute; left: var(--sp-3); top: 50%; width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); transform: translateY(-50%); pointer-events: none; }
.moderation-search .input { padding-left: var(--sp-8); }
.moderation-list { display: grid; gap: var(--sp-3); }
.moderation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-4) var(--sp-5); }
.moderation-row.is-unread { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: inset var(--sp-1) 0 0 var(--accent), var(--shadow-1); }
.moderation-row.is-unread h2 { color: var(--heading); font-weight: 800; }
.moderation-unread-dot { width: var(--sp-2); height: var(--sp-2); border-radius: var(--r-pill); background: var(--accent); box-shadow: 0 0 0 var(--sp-1) color-mix(in srgb, var(--accent) 18%, transparent); }
.moderation-row__main { min-width: 0; color: inherit; }
.moderation-row__badges { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.moderation-row__badges .badge { gap: var(--sp-1); }
.moderation-row__badges svg { width: var(--sp-3); height: var(--sp-3); }
.moderation-row h2 { margin: 0; font-size: var(--fs-base); }
.moderation-row__excerpt { display: -webkit-box; margin: var(--sp-2) 0; overflow: hidden; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.moderation-row__meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); color: var(--text-faint); font-size: var(--fs-xs); }
.moderation-row__meta span { display: inline-flex; align-items: center; gap: var(--sp-1); }
.moderation-row__meta svg { width: var(--sp-3); height: var(--sp-3); }
.moderation-row__tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); color: var(--accent-text); font-size: var(--fs-xs); }
.moderation-row__menu { flex: none; }
.moderation-row__menu form { margin: 0; }
.moderation-row__menu form .menu__item { border: 0; background: transparent; }
.moderation-row__menu form .menu__item:hover { background: var(--surface-2); }

@media (max-width: 900px) {
  .moderation-toolbar { grid-template-columns: 1fr 1fr; }
  .moderation-search { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .moderation-head { flex-direction: column; }
  .moderation-head .btn { width: 100%; margin-top: 0; }
  .moderation-summary { grid-template-columns: 1fr 1fr; }
  .moderation-toolbar { grid-template-columns: 1fr; }
  .moderation-search { grid-column: auto; }
  .moderation-row { padding: var(--sp-4); }
}

.ring { --p: 0; --sz: 96px; width: var(--sz); height: var(--sz); display: grid; place-items: center; position: relative; }
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from -90deg, var(--violet), var(--cyan) calc(var(--p) * 1%), var(--surface-3) calc(var(--p) * 1%));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(50% - 7px), #000 calc(50% - 6px));
          mask: radial-gradient(farthest-side, transparent calc(50% - 7px), #000 calc(50% - 6px));
}
/* ring stages mirror the bar's monorepo semantics (violet → brand → green) */
.ring[data-stage="start"]::before {
  background: conic-gradient(from -90deg, #6366F1, var(--violet) calc(var(--p) * 1%), var(--surface-3) calc(var(--p) * 1%));
}
.ring[data-stage="done"]::before {
  background: conic-gradient(from -90deg, var(--success), #10B981 calc(var(--p) * 1%), var(--surface-3) calc(var(--p) * 1%));
}
/* labels sit above the disc so they stay visible even if mask is unsupported */
.ring__num { position: relative; z-index: 1; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); }
.ring__lbl { position: relative; z-index: 1; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: .1em; }

/* metric stat */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__num { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); line-height: 1; }
.stat__lbl { font-size: var(--fs-xs); color: var(--text-muted); font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

/* -------------------------------------------------------------------- forms
   One input component (demo feedback item 18): every text-like control shares
   the same box, and every control answers hover / focus / error / disabled. */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.input,
input:where([type=text],[type=email],[type=password],[type=tel],[type=url],[type=number],[type=search],[type=date],[type=time],[type=datetime-local]),
textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px var(--sp-4); transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
.input:hover:not(:focus):not(:disabled),
input:where([type=text],[type=email],[type=password],[type=tel],[type=url],[type=number],[type=search],[type=date],[type=time],[type=datetime-local]):hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled) { border-color: var(--border-strong); }
.input:focus,
input:where([type=text],[type=email],[type=password],[type=tel],[type=url],[type=number],[type=search],[type=date],[type=time],[type=datetime-local]):focus,
textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 2.75em; }

/* selects: replace the native OS arrow with a token-colored chevron */
select:not([multiple]):not([size]) {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239AA7B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 38px;
}

/* file inputs: the picker button reads as one of our small ghost buttons */
input[type=file] { padding: 8px var(--sp-3); cursor: pointer; }
input[type=file]::file-selector-button {
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  padding: 6px var(--sp-3); margin-right: var(--sp-3); cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}
input[type=file]::file-selector-button:hover { background: var(--surface-3); }

/* error + disabled states (Django forms set aria-invalid on invalid fields) */
.input--error, .input[aria-invalid=true],
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
}
.input:disabled, input:disabled, textarea:disabled, select:disabled {
  opacity: .55; cursor: not-allowed; background: var(--surface-2);
}

/* toggles must escape the full-width text-input styling above */
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
.form-error { color: var(--danger); font-size: var(--fs-sm); margin-top: 4px; }
.form-error ul { list-style: none; }

/* Shared creation system --------------------------------------------------
   Used by faculty authoring, student posts, uploads, and compact composers. */
.form-page { width: min(100%, 900px); margin-inline: auto; }
.form-page-head { margin-bottom: var(--sp-6); }
.form-page-head__back {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: var(--sp-3);
  color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600;
}
.form-page-head__back:hover { color: var(--text); }
.form-page-head__back svg { width: 15px; height: 15px; }
.form-page-head h1 { margin: 0; }
.form-page-head .lead { max-width: 66ch; margin-top: 8px; }

.form-card { display: grid; gap: 0; padding: 0 !important; overflow: hidden; }
.form-card__intro {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: 22px 25px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.form-card__intro-icon {
  display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px;
  color: var(--accent); background: var(--soft-violet); border-radius: 11px;
}
.form-card__intro-icon svg { width: 18px; height: 18px; }
.form-card__intro h2 { margin: 0; font-size: var(--fs-md); }
.form-card__intro p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.55; }
.form-card__body { display: grid; gap: 20px; padding: 25px; }
.form-section { display: grid; gap: 18px; }
.form-section + .form-section { padding-top: 23px; border-top: 1px solid var(--border); }
.form-section__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.form-section__head h2 { margin: 0; font-size: var(--fs-base); }
.form-section__head p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-field { min-width: 0; gap: 8px; }
.form-field__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.form-field__label-row label { color: var(--text); }
.form-required, .form-optional {
  flex: none; color: var(--text-faint); font-size: 10px; font-weight: 700;
  letter-spacing: .055em; text-transform: uppercase;
}
.form-required { color: var(--accent); }
.form-help { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.55; }
.form-field.has-error > input, .form-field.has-error > textarea, .form-field.has-error > select {
  border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent);
}
.form-error { display: flex; align-items: flex-start; gap: 6px; line-height: 1.45; }
.form-error svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.form-error-summary {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border)); border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.form-error-summary > svg { width: 18px; height: 18px; flex: none; }
.form-error-summary ul { margin: 3px 0 0; padding-left: 18px; }
.form-actions {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 18px 25px; background: var(--surface-2); border-top: 1px solid var(--border);
}
.form-actions__hint { max-width: 52ch; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }
.form-actions__buttons { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.form-actions .btn[aria-busy=true] { cursor: wait; opacity: .78; }
.form-disclosure { border-top: 1px solid var(--border); }
.form-disclosure > summary {
  display: flex; align-items: center; gap: var(--sp-3); padding: 18px 25px;
  cursor: pointer; list-style: none; background: var(--surface-2);
}
.form-disclosure > summary::-webkit-details-marker { display: none; }
.form-disclosure > summary > span:nth-child(2) { display: grid; flex: 1; gap: var(--sp-1); }
.form-disclosure > summary small { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 400; }
.form-disclosure > summary > svg { width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); transition: transform var(--dur-2) var(--ease); }
.form-disclosure[open] > summary > svg { transform: rotate(180deg); }
.form-disclosure__body { display: grid; gap: 18px; padding: 22px 25px 25px; }
.guided-form .form-card__body { gap: 24px; }
.inline-create {
  display: grid; gap: 14px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
}
.inline-create__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.inline-create__head span { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: var(--fs-sm); }
.inline-create__head svg { width: 16px; height: 16px; color: var(--accent); }
.inline-create__row { display: flex; align-items: flex-end; gap: 10px; }
.inline-create__row .form-field { flex: 1; }
.inline-create__row .btn { flex: none; }

.form-field--toggle { padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.toggle-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle-row__control { padding-top: 2px; }
.toggle-row__control input { width: 18px; height: 18px; }
.toggle-row__copy { display: grid; gap: 3px; }
.toggle-row__copy strong { color: var(--text); font-size: var(--fs-sm); }
.toggle-row__copy small { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }

/* One composer language for people and AI conversations. */
.message-composer {
  display: flex; align-items: flex-end; gap: 9px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-1); transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.message-composer:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow-1); }
.message-composer textarea {
  flex: 1; min-height: 40px; max-height: 180px; padding: 9px 10px; resize: none;
  background: transparent; border: 0; box-shadow: none; line-height: 1.45;
}
.message-composer textarea:focus { border: 0; box-shadow: none; }
.message-composer__send { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; border-radius: 12px; }
.composer-hint { margin: 7px 2px 0; color: var(--text-faint); font-size: 10px; line-height: 1.4; }

@media (max-width: 700px) {
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .form-card__body, .form-card__intro { padding: 19px; }
  .form-actions { align-items: stretch; flex-direction: column; padding: 16px 19px; }
  .form-actions__buttons { width: 100%; margin-left: 0; }
  .form-actions__buttons .btn { flex: 1; }
  .inline-create__row { align-items: stretch; flex-direction: column; }
}

/* ------------------------------------------------------------- menu / popover */
.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); padding: 6px; overflow: hidden;
}
.menu__item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  padding: 9px var(--sp-3); border-radius: var(--r-xs); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.menu__item:hover { background: var(--surface-2); color: var(--text); }
.menu__item i, .menu__item svg { width: 16px; height: 16px; }
.menu__item--danger:hover { color: var(--danger); }
.menu__sep { height: 1px; background: var(--border); margin: 5px 0; }

/* Authoring rows keep one visible next step; maintenance and destructive
   operations live in the adjacent overflow menu. */
.author-row__main { min-width: 0; flex: 1; }
.author-row__title {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  color: var(--text); font-weight: 600;
}
.author-row__title > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-row__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-1); color: var(--text-faint); font-size: var(--fs-xs);
}
.author-row__meta > * + *::before { content: "\00b7"; margin-right: var(--sp-2); color: var(--text-faint); }
.author-row__meta a { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-muted); }
.author-row__meta a:hover { color: var(--text); }
.author-row__meta svg { width: 13px; height: 13px; }
.author-row__status { display: inline-flex; align-items: center; gap: var(--sp-1); }
.author-row__status::after { content: ""; width: var(--sp-1); height: var(--sp-1); border-radius: var(--r-pill); background: currentColor; order: -1; }
.author-row__status--published { color: var(--success); }
.author-row__status--draft { color: var(--warning); }
.author-row__actions { display: flex; align-items: center; gap: var(--sp-1); flex: none; }
.author-row__menu-trigger { aspect-ratio: 1; padding-inline: var(--sp-2); }
.author-row__menu form { margin: 0; }
.author-row__menu form .menu__item { border: 0; background: transparent; }
.author-row__menu form .menu__item:hover { background: var(--surface-2); }

@media (max-width: 700px) {
  .author-row__actions { width: 100%; margin-top: var(--sp-3); }
  .author-row__actions > .btn { flex: 1; }
  .author-row__menu { margin-left: auto; }
}
.avatar {
  width: 36px; height: 36px; flex: 0 0 36px; aspect-ratio: 1; overflow: hidden;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--violet); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-base);
  border: 1px solid rgba(255,255,255,.18); line-height: 1; text-align: center;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; flex-basis: 30px; font-size: var(--fs-sm); }

/* --------------------------------------------------------------- blog cards
   Editorial layout (item 10): a featured hero + a grid of even, clamped cards. */
.blog-hero {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--sp-6);
  text-decoration: none; color: inherit; margin-bottom: var(--sp-6);
}
.blog-hero__art {
  border-radius: var(--r-md); min-height: 168px;
  background: var(--grad-soft); border: 1px solid var(--border-strong);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.blog-hero__art::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 20% 0%, rgba(124,58,237,.25), transparent 55%),
              radial-gradient(120% 90% at 90% 100%, rgba(6,182,212,.2), transparent 55%);
}
.blog-hero__glyph {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-5xl);
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.blog-hero__body { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.blog-hero__title { font-size: var(--fs-2xl); letter-spacing: -.02em; line-height: var(--lh-snug); margin: 0; }
.blog-card { display: flex; flex-direction: column; gap: var(--sp-3); text-decoration: none; color: inherit; }
.blog-card__title {
  font-size: var(--fs-lg); line-height: var(--lh-snug); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card__excerpt {
  font-size: var(--fs-sm); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card__meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: auto; font-size: var(--fs-xs); flex-wrap: wrap; }
.blog-card__author { font-weight: 600; font-size: var(--fs-sm); }
@media (max-width: 720px) {
  .blog-hero { grid-template-columns: 1fr; }
  .blog-hero__art { min-height: 110px; }
}

/* ------------------------------------------------------ live-session card
   Fixed hierarchy (item 7): date anchor · badges · title · meta · host + CTA.
   Base layout restored after the origin/main CSS merge dropped it — the module
   Overview "Up next" rows and Learn's upcoming-lecture cards depend on it
   (elevate.css only carries .app-scoped refinements on top). */
.session-card { display: flex; gap: var(--sp-5); align-items: flex-start; }
.session-card__date {
  flex: none; width: 64px; padding: var(--sp-3) 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
}
.session-card__dow { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.session-card__day { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.05; }
.session-card__mon { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.session-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.session-card__title { font-size: var(--fs-lg); margin: 0; line-height: var(--lh-snug); }
.session-card__meta { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-xs); }
.session-card__meta i, .session-card__meta svg { width: 13px; height: 13px; flex-shrink: 0; }
.session-card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-1); padding-top: var(--sp-3); border-top: 1px solid var(--border);
}
.session-card__host { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-card--past .session-card__date { background: var(--surface); }
.session-card--past .session-card__day { color: var(--text-muted); }
.session-card__pending { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-faint); }

.live-page {
  display: grid;
  gap: var(--sp-8);
  min-width: 0;
}

.live-alerts {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-block: 1px solid var(--border);
}
.live-alerts__head p {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.live-alerts__items { display: grid; gap: var(--sp-1); }
.live-alert {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  color: var(--text);
  background: var(--surface-2);
  border-inline-start: 2px solid var(--warning);
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.live-alert b,
.live-alert small { display: block; }
.live-alert b { color: var(--heading); font-size: var(--fs-sm); }
.live-alert small { margin-top: var(--sp-1); color: var(--text-muted); font-size: var(--fs-xs); }
.live-alert__action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  flex: none;
  color: var(--accent-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}
.live-alert__action svg { width: 14px; height: 14px; }
.live-alert:focus-visible,
.live-row__meet-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.live-alert:active { transform: translateY(1px); }

.live-section { display: grid; gap: var(--sp-4); min-width: 0; }
.live-section__head {
  display: grid;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--border-strong);
}
.live-section__head h2 {
  margin: 0;
  font-size: var(--fs-2xl);
  letter-spacing: -.03em;
}
.live-section__head p {
  margin: var(--sp-1) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.live-section__count {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.live-session-list {
  display: grid;
  min-width: 0;
}
.live-section--upcoming .live-section__head { border-bottom-color: var(--accent); }
.live-section--archive .live-section__head { border-bottom-width: 1px; }
.live-section--archive .live-section__head h2 { color: var(--text); }
.app .live-section .live-empty {
  padding: var(--sp-8) 0;
  border-block: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.live-empty .empty__glyph {
  width: 36px;
  height: 36px;
  margin-bottom: var(--sp-3);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.live-empty .empty__glyph svg { width: 20px; height: 20px; }
.live-empty .h2 { font-size: var(--fs-lg); }

.live-row {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
  padding-block: var(--sp-5);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-2) var(--ease-out);
}
.live-row__when {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-decoration: none;
}
.live-row__weekday { color: var(--text-faint); font-weight: 600; }
.live-row__date { color: var(--heading); font-size: var(--fs-sm); font-weight: 700; }
.live-row__time { justify-self: end; white-space: nowrap; }
.live-row__main { min-width: 0; }
.live-row__labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}
.live-row__labels span + span::before {
  content: "·";
  margin-inline-end: var(--sp-3);
  color: var(--border-strong);
}
.live-row__label--mandatory { color: var(--streak-text); }
.live-row__label--soon { color: var(--accent-text); }
.live-row__label--urgent { color: var(--danger); font-weight: 700; }
.live-row__main h3 {
  margin: var(--sp-2) 0 0;
  color: var(--heading);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.live-row__notice {
  margin: var(--sp-2) 0 0;
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.live-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin: var(--sp-3) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.live-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.live-row__actions .btn { min-height: 44px; white-space: nowrap; }
.live-row__meet-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 44px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.live-row__meet-link:active { transform: translateY(1px); }
.live-row__meet-link svg,
.live-row__pending svg { width: 14px; height: 14px; flex: none; }
.live-row__pending {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.live-row--past .live-row__main h3 { color: var(--text); }
.live-row--past .live-row__when,
.live-row--past .live-row__labels { opacity: .8; }

@media (hover: hover) and (pointer: fine) {
  .live-alert:hover { background: var(--surface-3); transform: translateY(-1px); }
  .live-row:hover { background: color-mix(in srgb, var(--surface-2) 52%, transparent); }
  .live-row__meet-link:hover { color: var(--accent-text); }
}

@media (min-width: 48rem) {
  .live-alerts { grid-template-columns: 9rem minmax(0, 1fr); align-items: start; gap: var(--sp-5); }
  .live-alert { flex-direction: row; align-items: center; justify-content: space-between; }
  .live-section__head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .live-row { grid-template-columns: 7rem minmax(0, 1fr) auto; align-items: center; gap: var(--sp-6); padding-inline: var(--sp-2); }
  .live-row__when { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
  .live-row__time { justify-self: auto; }
  .live-row__actions { justify-content: flex-end; max-width: 22rem; }
  .live-row__meta span + span::before {
    content: "·";
    margin-inline-end: var(--sp-3);
    color: var(--text-faint);
  }
}

@media (pointer: coarse) {
  .live-alert,
  .live-row__meet-link { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-alert,
  .live-row { transition-duration: var(--dur-1); }
  .live-alert:hover { transform: none; }
}

/* ------------------------------------------------------------------- toast */
.toasts { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 100; display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); box-shadow: var(--shadow-2);
  font-size: var(--fs-sm); animation: toast-in var(--dur-3) var(--ease-out);
}
.toast--error { border-left-color: var(--danger); }
.toast--success { border-left-color: var(--success); }

/* --------------------------------------------------------------- skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; border-radius: var(--r-sm); animation: shimmer 1.4s ease infinite; }
.htmx-indicator { opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* terminal (AI planner / onboarding stream) + spinner */
.terminal {
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.65;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5); color: var(--text-muted); white-space: pre-wrap;
  overflow-y: auto; word-break: break-word;
}
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* empty state */
.empty { text-align: center; padding: var(--sp-16) var(--sp-6); color: var(--text-muted); }
.empty__glyph { width: 64px; height: 64px; margin: 0 auto var(--sp-5); border-radius: var(--r-lg); display: grid; place-items: center; background: var(--grad-soft); border: 1px solid var(--border-strong); color: var(--violet-300); }
.empty__glyph i, .empty__glyph svg { width: 28px; height: 28px; }

/* ----------------------------------------------- page header / segmented / banner */
.page-head { margin-bottom: var(--sp-8); }
.page-head h1 { font-size: var(--fs-3xl); letter-spacing: -.02em; }
.page-head .lead { margin-top: var(--sp-2); }

.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.segmented button, .segmented label { padding: 6px 16px; border-radius: var(--r-pill); font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.segmented button.is-on, .segmented label.is-on { background: var(--grad); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.segmented button:not(.is-on):hover, .segmented label:not(.is-on):hover { color: var(--text); }
.segmented label { position: relative; }
.segmented label:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* resume / spotlight banner — the one place a course card gets the gradient edge */
.banner { position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--sp-6); padding: var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-strong); }
.banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.banner__glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(50% 120% at 100% 0%, rgba(124,58,237,.14), transparent 60%); }
.banner__body { flex: 1; min-width: 0; position: relative; }
.banner__icon { width: 52px; height: 52px; flex-shrink: 0; border-radius: var(--r-md); display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--glow-violet); position: relative; }
.banner__icon i, .banner__icon svg { width: 24px; height: 24px; }

/* metric tiles row */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-4); }
.tile { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); }
.tile__icon { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-2); color: var(--violet-300); flex-shrink: 0; }
.tile__icon i, .tile__icon svg { width: 20px; height: 20px; }
.tile__num { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-2xl); line-height: 1; }
.tile__lbl { font-size: var(--fs-xs); color: var(--text-muted); font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }

/* grids */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--sp-5); }
.col-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-6); align-items: start; }
@media (max-width: 900px) { .col-2 { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------- activity heatmap */
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.heatmap__cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); transition: transform var(--dur-1) var(--ease); }
.heatmap__cell:hover { transform: scale(1.25); }
.heatmap__cell[data-level="1"] { background: rgba(124,58,237,.35); }
.heatmap__cell[data-level="2"] { background: rgba(124,58,237,.6); }
.heatmap__cell[data-level="3"] { background: rgba(56,135,232,.78); }
.heatmap__cell[data-level="4"] { background: var(--cyan); }
.heatmap-legend { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.heatmap-legend .heatmap__cell { width: 12px; height: 12px; aspect-ratio: auto; }

/* module spine row (course hub) — accordion built on the signature spine */
.module { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; transition: border-color var(--dur-2) var(--ease); }
.module + .module { margin-top: var(--sp-3); }
.module:hover { border-color: var(--border-strong); }
.module__head { display: flex; align-items: center; gap: var(--sp-4); width: 100%; padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-3); text-align: left; }
.module__enter { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-4); padding: 7px var(--sp-3); border-radius: var(--r-sm); transition: background var(--dur-2) var(--ease); }
.module__enter:hover { background: var(--surface-2); }
.module__no { width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--r-sm); display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-muted); }
.module.is-done .module__no { background: var(--grad); color: #fff; border-color: transparent; }
.module__title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module__toggle { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--text-faint); transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.module__toggle:hover { background: var(--surface-2); color: var(--text); }
.module__chev { transition: transform var(--dur-2) var(--ease); }
.module__chev.is-open { transform: rotate(90deg); }
.module__meta { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); flex-shrink: 0; }
.module__body { border-top: 1px solid var(--border); padding: var(--sp-2); }

/* topic overview (course hub — brief, no question rows) */
.topic-ov { display: flex; flex-direction: column; gap: 2px; }
.topic-ov__row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-3); border-radius: var(--r-sm); color: var(--text); transition: background var(--dur-1) var(--ease); }
a.topic-ov__row:hover { background: var(--surface-2); }
.topic-ov__row.is-empty { pointer-events: none; }
.topic-ov__dot { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-faint); }
.topic-ov__dot i, .topic-ov__dot svg { width: 13px; height: 13px; }
.topic-ov__row.is-done .topic-ov__dot { background: var(--grad); color: #fff; border-color: transparent; }
.topic-ov__title { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-ov__meta { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); flex-shrink: 0; }
.topic-ov__go { width: 15px; height: 15px; color: var(--text-faint); opacity: 0; transition: opacity var(--dur-1) var(--ease); flex-shrink: 0; }
a.topic-ov__row:hover .topic-ov__go { opacity: 1; }

/* topic group + question rows */
.topic-group { padding: var(--sp-3) var(--sp-5); }
.topic-group__label { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: var(--sp-2) 0; }
.q-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-3); border-radius: var(--r-sm); color: var(--text); transition: background var(--dur-1) var(--ease); }
.q-row:hover { background: var(--surface-2); }
.q-row__status { flex-shrink: 0; width: 18px; height: 18px; }
.q-row__status--done { color: var(--success); }
.q-row__status--prog { color: var(--warning); }
.q-row__status--todo { color: var(--text-faint); }
.q-row__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* module card extras: hover enter-arrow, chevron toggle, unfolded topic body */
.module__go { width: 17px; height: 17px; color: var(--text-faint); opacity: 0; transition: opacity var(--dur-1) var(--ease); flex-shrink: 0; margin-left: auto; }
.module__enter:hover .module__go { opacity: 1; }
.module__toggle i, .module__toggle svg { transition: transform var(--dur-2) var(--ease); }
.module__toggle.is-open i, .module__toggle.is-open svg { transform: rotate(90deg); }
.module-product .module__body { margin-top: var(--sp-3); }
.module-product.is-done .module__no { background: var(--grad); color: #fff; border-color: transparent; }
.topic-ov__more { border-top: 1px solid var(--border); margin-top: var(--sp-2); color: var(--text-muted); }

/* revision sheet (module dropdown): textual topic recaps + reserved visual slot */
.rev-visual {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  margin: var(--sp-2) var(--sp-3) var(--sp-3); padding: var(--sp-6) var(--sp-5);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: .08em; text-transform: uppercase;
}
.rev-visual i, .rev-visual svg { width: 16px; height: 16px; }
.rev-topic { display: flex; gap: var(--sp-3); padding: 9px var(--sp-3); }
.rev-topic__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rev-topic__title { font-size: var(--fs-sm); font-weight: 600; }
.rev-topic__text { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }
.rev-topic.is-done .topic-ov__dot { background: var(--grad); color: #fff; border-color: transparent; }

/* course hub: curriculum ⇄ timeline tabs (heading-sized, gradient underline) */
.hub-tabs { display: flex; align-items: baseline; gap: var(--sp-5); }
.hub-tab {
  position: relative; padding-bottom: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl);
  letter-spacing: -.02em; line-height: 1.2; color: var(--text-faint);
  transition: color var(--dur-2) var(--ease);
}
.hub-tab:hover { color: var(--text-muted); }
.hub-tab.is-active { color: var(--text); }
.hub-tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  border-radius: 3px; background: var(--grad); box-shadow: var(--glow-violet);
}

/* timeline flow — the plan as a snake path. Rows alternate direction
   (nth-child(even) reverses), a track line runs behind each row's dots, and a
   C-shaped connector wraps down to the next row on the turning side. All
   geometry hangs off --dot: the track/connector sit at half a dot so they pass
   through the dot centers. */
.flow { --dot: 48px; --flow-gap: 56px; display: flex; flex-direction: column; gap: var(--flow-gap); padding-block: var(--sp-4) var(--sp-2); }
.flow__row { position: relative; display: flex; justify-content: space-between; padding-inline: var(--sp-6); }
.flow__row:nth-child(even) { flex-direction: row-reverse; }
.flow__row::before {
  content: ""; position: absolute; top: calc(var(--dot) / 2 - 1px);
  left: var(--sp-6); right: var(--sp-6); height: 2px; background: var(--border-strong);
}
.flow__row:not(:last-child)::after {
  content: ""; position: absolute; top: calc(var(--dot) / 2 - 1px);
  bottom: calc(-1 * var(--flow-gap) - var(--dot) / 2 + 1px); width: 30px;
  border: 2px solid var(--border-strong);
}
.flow__row:nth-child(odd):not(:last-child)::after { right: 0; border-left: 0; border-radius: 0 26px 26px 0; }
.flow__row:nth-child(even):not(:last-child)::after { left: 0; border-right: 0; border-radius: 26px 0 0 26px; }

.flow__node {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: clamp(110px, 31%, 170px); text-align: center; padding-bottom: var(--sp-2);
}
.flow__node--link { color: inherit; cursor: pointer; text-decoration: none; }
.flow__node--link:hover .flow__focus { color: var(--accent-text); }
.flow__open { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 700; opacity: 0; transform: translateY(calc(-1 * var(--sp-1))); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.flow__open svg { width: var(--sp-3); height: var(--sp-3); }
.flow__node--link:hover .flow__open, .flow__node--link:focus-visible .flow__open { opacity: 1; transform: translateY(0); }
.flow__node-hit { position: absolute; inset: 0; z-index: 1; border-radius: var(--r-sm); }
.flow__node-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: var(--sp-1); }
.flow__node > form { z-index: 2; }
.flow__dot {
  width: var(--dot); height: var(--dot); border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; margin-bottom: var(--sp-2);
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-base);
  background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--text-muted);
  box-shadow: 0 0 0 5px var(--bg);  /* halo lifts the dot off the track line */
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.flow__dot i, .flow__dot svg { width: 18px; height: 18px; }
.flow__node:hover .flow__dot { transform: scale(1.1); }
.flow__node.is-done .flow__dot { background: var(--grad); border-color: transparent; color: #fff; }
.flow__node.is-current .flow__dot { background: var(--grad-soft); border-color: transparent; color: var(--text); box-shadow: 0 0 0 5px var(--bg), var(--glow-violet); }
.flow__node.is-open .flow__dot { transform: scale(1.1); box-shadow: 0 0 0 5px var(--bg), var(--glow-violet); }
.flow__wk { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.flow__node.is-open .flow__wk { color: var(--accent-text); }
.flow__focus { max-width: 100%; font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow__count { font-size: var(--fs-xs); color: var(--text-muted); }
.flow__panel { margin-top: var(--sp-6); }
@media (max-width: 720px) {
  .flow { --dot: 40px; --flow-gap: 44px; }
  .flow__row { padding-inline: var(--sp-4); }
  .flow__row::before { left: var(--sp-4); right: var(--sp-4); }
  .flow__node { width: clamp(88px, 31%, 130px); }
  .flow__focus { font-size: var(--fs-xs); }
}

/* ===========================================================================
   MODULE WORKSPACE — one chrome row + a collapsible tutor dock (item 12).
   Lesson-only: no rail, no section switcher — the whole width belongs to
   the lesson (video column scrolls; the dock keeps the right edge).
   ========================================================================== */
.wsx {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}

/* (2) the module's questions live in the PROBLEMS OVERLAY now; these rows are
   reused there (grouped by topic, current highlighted, keyboard-focusable). */
.wsx-topic + .wsx-topic { margin-top: var(--sp-3); }
.wsx-topic__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); padding: var(--sp-2) var(--sp-2) 4px; }
.wsx-q { position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-3); border-radius: var(--r-sm); color: var(--text-muted); font-size: var(--fs-sm); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.wsx-q:hover, .wsx-q.is-focus { background: var(--surface-2); color: var(--text); }
.wsx-q.is-active { background: var(--grad-soft); color: var(--text); font-weight: 600; }
.wsx-q.is-active::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--grad); }
.wsx-q__status { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; color: var(--text-faint); }
.wsx-q__status--completed { color: var(--success); }
.wsx-q__status--in_progress { color: var(--warning); }
.wsx-q__status i, .wsx-q__status svg { width: 14px; height: 14px; }
.wsx-q__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* main column */
.wsx-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
/* ONE chrome row: brand | back · breadcrumb (module › topic › lesson) ·
   (center) mode switch · (right) pager · theme · progress chip · account */
.wsx-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); height: var(--topbar-h); padding: 0 var(--sp-4) 0 var(--sp-5); border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; transition: background var(--dur-3) var(--ease), border-color var(--dur-3) var(--ease); }
.wsx-top__left { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.wsx-top__right { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
/* the workspace is sidebar-free, so the brand anchors the chrome — the divider
   sits where the rail's edge would be (same brand | content split as is-full) */
.wsx-brand { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; align-self: stretch; padding-right: var(--sp-5); margin-right: var(--sp-2); border-right: 1px solid var(--border); }
.wsx-brand .brand-mark { width: 34px; height: 20px; }
.wsx-brand .brand-word { font-size: 1.02rem; }
/* lesson mode toggle (Video | Practice) — a segmented control anchored in the
   chrome so the switch never moves; only the center pane changes */
.wsx-modes { display: flex; align-items: center; gap: 2px; flex-shrink: 0; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-pill); }
.wsx-modes .wsx-mode { border: none; background: none; padding: 6px 16px; }
.wsx-modes .wsx-mode.is-on { background: var(--grad); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.wsx-back { display: grid; place-items: center; flex-shrink: 0; }
.wsx-back i, .wsx-back svg { width: 17px; height: 17px; }
.wsx-lesson { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 5px 10px; border-radius: var(--r-sm); text-align: left; transition: background var(--dur-2) var(--ease); }
.wsx-lesson:hover { background: var(--surface-2); }
.wsx-lesson__mod { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48ch; }
.wsx-lesson__mod em { font-style: normal; color: var(--accent-text); margin: 0 2px; }
.wsx-lesson__ttl { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 42ch; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-base); color: var(--text); }
.wsx-lesson__txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsx-lesson__caret { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-faint); }
.wsx-lesson:hover .wsx-lesson__caret { color: var(--text-muted); }
/* lesson pager — the position lives between its own controls (‹ n/N ›) */
.wsx-pager { display: flex; align-items: center; gap: 2px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-pill); }
.wsx-pager__btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--text-muted); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.wsx-pager__btn:hover { background: var(--surface-2); color: var(--text); }
.wsx-pager__btn.is-off { opacity: .3; }
.wsx-pager__btn i, .wsx-pager__btn svg { width: 16px; height: 16px; }
.wsx-pager__pos { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); padding: 0 7px; white-space: nowrap; }
.wsx-pager__pos em { font-style: normal; color: var(--text-faint); margin: 0 2px; }
.wsx-body { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.wsx-panel { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: var(--sp-6) var(--sp-8); }
.wsx-panel--fill { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.wsx-panel--fill > .lab, .wsx-panel--fill > .convo { flex: 1; min-height: 0; }

/* Lesson ▸ Video (wireframe): a full-height split — the video column scrolls,
   the tutor dock is pinned to the right edge. Closing the dock (or cinema)
   animates its column to zero width. */
/* No dead margins: the stage width is height-derived (the fold math — see
   .wsx-stage) and the dock absorbs EXACTLY the leftover viewport width
   (viewport − stage − the vcol's side padding), clamped to a sane chat width.
   Within the clamp, video + dock tile the row edge-to-edge. */
.wsx-video {
  --stage-w: min(1600px, max(560px, calc((100dvh - var(--topbar-h) - 200px) * 1.7778)));
  display: grid; grid-template-columns: 1fr clamp(320px, calc(100vw - var(--stage-w) - 2 * var(--sp-6)), 560px);
  padding: 0; overflow: hidden; transition: grid-template-columns var(--dur-3) var(--ease);
}
.wsx-video.is-nodock { grid-template-columns: 1fr 0; }
/* ONE content column: the stage width is height-derived (--stage-w, declared
   on .wsx-video so the grid sizes the dock from it) — the player + under-row +
   the Discussion · Resources strip all fit the first screen; the tabs must
   peek above the fold so learners know they exist. EVERYTHING in the column
   (player, quiz callout, tabs, discussion) shares that same width — one
   aligned column, no mixed alignments. */
.wsx-vcol { min-width: 0; min-height: 0; overflow-y: auto; padding: var(--sp-5) var(--sp-6) var(--sp-8); }
.wsx-stage { width: min(100%, var(--stage-w, 100%)); margin-inline: auto; }
.vid__frame { aspect-ratio: 16/9; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--surface) 0%, var(--bg-deep) 100%); border: 1px solid var(--border-strong); display: grid; place-items: center; position: relative; overflow: hidden; transition: border-radius var(--dur-3) var(--ease); }
.vid__frame--embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid__play { width: 72px; height: 72px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: var(--glow-violet); }
.vid__play i, .vid__play svg { width: 30px; height: 30px; }
.vid__meta { position: absolute; left: var(--sp-5); bottom: var(--sp-4); }
.vid__meta b { font-family: var(--font-display); font-size: var(--fs-lg); }

/* cinema toggle rides the player's corner so the exit is always where the entry was */
.wsx-cine {
  position: absolute; top: var(--sp-3); right: var(--sp-3); z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: rgba(10,14,20,.82); border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  padding: 5px 10px; cursor: pointer; transition: color var(--dur-2) var(--ease);
}
.wsx-cine:hover { color: var(--text); }
.wsx-cine i, .wsx-cine svg { width: 13px; height: 13px; }

/* under-video row: keycap hints dead-center below the player; the Ask-tutor
   pill (only shown when the dock is closed) keeps the left slot of a 1fr auto
   1fr grid, so the keys stay centered whether or not the pill is there */
.wsx-under { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); }
.wsx-under > .wsx-mode { grid-column: 1; justify-self: start; }
.wsx-under__meta { grid-column: 2; font-size: var(--fs-xs); color: var(--text-faint); }
.wsx-keys { display: inline-flex; align-items: center; gap: var(--sp-4); }
.wsx-key { display: inline-flex; align-items: center; gap: 6px; }
.wsx-key kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; min-width: 19px; text-align: center;
}
.wsx-mode { display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.wsx-mode i, .wsx-mode svg { width: 15px; height: 15px; }
.wsx-mode:hover { color: var(--text); }
.wsx-mode.is-on { background: var(--grad-soft); border-color: var(--accent); color: var(--text); }

/* tutor dock — live-chat pattern (item 12, wireframe note 3): full-height on the
   right edge, pulse header, messages pinned to a bottom input like a live chat.
   ✕ hides the whole column (the grid animates it away). */
.vid-ask { border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.wsx-video.is-nodock .vid-ask { visibility: hidden; border-left-width: 0; }
.vid-ask__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.vid-ask__head .mono { font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--violet-300); display: inline-flex; align-items: center; gap: 6px; }
.vid-ask .chat__log { padding: var(--sp-4); }
.vid-ask .chat__log > :first-child { margin-top: auto; }  /* live-chat: content hugs the input */
.vid-ask .suggestions { padding: 0 var(--sp-4) var(--sp-2); }
.vid-ask .chat__input { padding: var(--sp-3) var(--sp-4) var(--sp-4); border-top: 1px solid var(--border); }
.vid-ask .chat__input.message-composer { margin: 8px 10px 10px; padding: 7px; border: 1px solid var(--border-strong); }
.vid-ask .chat__input.message-composer .input { border-radius: 10px; padding-block: 8px; }
.vid-ask__send { width: 38px; height: 38px; padding: 0; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; }
.vid-ask__send i, .vid-ask__send svg { width: 15px; height: 15px; }

/* ── CINEMA (item 12): the video owns the viewport; everything else steps back.
   Applied on .wsx via Alpine while on the video mode. ── */
.wsx.is-cinema .wsx-top { background: var(--bg-deep); border-bottom-color: transparent; }
.wsx.is-cinema .wsx-video { grid-template-columns: 1fr 0; }
.wsx.is-cinema .vid-ask { visibility: hidden; border-left-width: 0; }
.wsx.is-cinema .wsx-vcol { padding: 0; overflow: hidden; }
.wsx.is-cinema .wsx-stage { width: 100%; }
.wsx.is-cinema .wsx-under, .wsx.is-cinema .vbelow { display: none; }
.wsx.is-cinema .vid__frame { aspect-ratio: auto; height: calc(100dvh - var(--topbar-h)); border-radius: 0; border: 0; }

/* below-video tab strip (YouTube-style): Discussion (default, with inline reply
   trees) · Resources — same width as the stage so the whole column lines up */
.vbelow { margin-top: var(--sp-7); width: min(100%, var(--stage-w, 100%)); margin-inline: auto; }
/* quiz pointer — a compact pill riding the right end of the tab strip, in line
   with Discussion · Resources (the quiz itself lives in the module Quizzes tab) */
.vtab-quiz {
  margin-left: auto; align-self: center; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--r-pill);
  background: var(--grad-soft); border: 1px solid var(--border);
  color: var(--text); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.vtab-quiz:hover { border-color: var(--accent); }
.vtab-quiz i, .vtab-quiz svg { width: 13px; height: 13px; color: var(--accent-text); }
.vtab-quiz em { font-style: normal; color: var(--accent-text); max-width: 24ch; overflow: hidden; text-overflow: ellipsis; }
.vtabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-6); overflow-x: auto; scrollbar-width: none; }
.vtabs::-webkit-scrollbar { display: none; }
.vtab { padding: 11px var(--sp-4); font-weight: 600; font-size: var(--fs-sm); color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.vtab i, .vtab svg { width: 15px; height: 15px; }
.vtab:hover { color: var(--text); }
.vtab.is-on { color: var(--text); border-bottom-color: var(--accent); }

.disc { max-width: none; }
.disc__head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.disc__head h3 { font-size: var(--fs-lg); }
.topic-composer { padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.topic-composer textarea { min-height: 88px; background: var(--surface); }
.topic-composer > .spread { align-items: center; gap: var(--sp-3); }
.disc__compose { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.disc__compose .input { flex: 1; }
.disc__list { display: flex; flex-direction: column; gap: var(--sp-5); }
.disc-c { display: flex; gap: var(--sp-3); }
.disc-c__body { flex: 1; min-width: 0; }
.disc-c__meta { font-size: var(--fs-sm); margin-bottom: 3px; }
.disc-c__body p { font-size: var(--fs-sm); color: var(--text); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
/* inline reply tree — depth indents come from the template (margin-left per reply) */
.disc-c__replies { margin-top: var(--sp-3); padding-left: var(--sp-4); border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: var(--sp-3); }
.disc-r p { margin: 0 0 2px; }
.disc-r__act { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); transition: color var(--dur-2) var(--ease); }
.disc-r__act:hover { color: var(--text); }
.disc-r__act i, .disc-r__act svg { width: 13px; height: 13px; }
.disc-c__foot { margin-top: var(--sp-3); }

/* peek modal — "what's inside" preview for coursework cards (test/assignment).
   Content is illustrative: mocks are pointer-inert so a preview can never start or submit. */
.peek { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-4); background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.peek__panel { width: min(720px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; animation: rise var(--dur-3) var(--ease-out); }
.peek__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.peek__head .eyebrow { margin: 0; }
.peek__body { padding: var(--sp-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.peek__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); flex-shrink: 0; }
.peek__frame { width: 100%; height: min(46vh, 420px); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
/* a mock is a look, not a control: inert + slightly dimmed so it reads as illustration */
.peek__mock { pointer-events: none; user-select: none; opacity: .9; border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.peek__mock-label { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-family: var(--font-mono); }

/* problems overlay — the module's questions, on demand (closes on select) */
.wsx-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 10vh var(--sp-4) var(--sp-4); background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ovl { width: min(620px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; animation: rise var(--dur-3) var(--ease-out); }
.ovl__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ovl__head i, .ovl__head svg { width: 17px; height: 17px; color: var(--text-faint); flex-shrink: 0; }
.ovl__search { flex: 1; border: none; background: none; color: var(--text); font: inherit; outline: none; padding: 6px 0; }
.ovl__search:focus { box-shadow: none; }
.ovl__search::placeholder { color: var(--text-faint); }
.ovl__head kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }
.ovl__list { flex: 1; overflow-y: auto; padding: var(--sp-3); }
.ovl__empty { text-align: center; color: var(--text-faint); font-size: var(--fs-sm); padding: var(--sp-8) var(--sp-4); }

/* practice (lab) — resizable panes (OnlearnSplit manages flex on the children) */
.lab { display: flex; flex-direction: row; height: 100%; min-height: 0; }
.lab__panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; }
.lab__panel:last-child { border-right: none; }
.lab__problem { padding: var(--sp-5); overflow-y: auto; }
.lab__problem > * + * { margin-top: var(--sp-4); }
.lab__editor { background: var(--bg-deep); }
.lab__toolbar { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.lab__toolbar .grow { flex: 1; }
.lab__tbl { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.lab__tbl i, .lab__tbl svg { width: 14px; height: 14px; }
.lab__lang { padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: 10px; letter-spacing: .04em; text-transform: lowercase; color: var(--text-muted); }
/* Scratchpad ⇄ Solve segmented toggle (code panel) */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-pill); }
.seg__btn { font-size: var(--fs-xs); font-weight: 600; padding: 4px 12px; border-radius: var(--r-pill); color: var(--text-muted); white-space: nowrap; transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-on { background: var(--grad); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.lab__monaco { flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
/* terminal (editor⇕terminal split, Tests/Output/Input tabs) lives in workspace.css */

/* ── AI-tutor problem panel: structured sample test cases under the statement ── */
.probe { border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.probe__h { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--sp-3); }
.probe__h i, .probe__h svg { width: 15px; height: 15px; color: var(--accent-text); }
.probe__case { position: relative; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-bottom: var(--sp-3); }
.probe__case--ex { background: var(--grad-soft); border-color: transparent; }
.probe__tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 7px; }
.probe__io + .probe__io { margin-top: 7px; }
.probe__io > span { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }
.probe__io pre { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 7px 9px; margin: 0; color: var(--text); }
.probe__why { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.55; margin: 7px 0 0; }

/* ── Tests tab (terminal pane): summary chip + per-case verdict cards ── */
.term__count { font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 6px; margin-left: 2px; color: var(--text-faint); }
.term__count.is-ok { color: var(--success); }
.term__count.is-err { color: var(--danger); }
.tcx-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 11px; border-radius: var(--r-sm); margin-bottom: var(--sp-3); font-size: var(--fs-sm); font-weight: 600; }
.tcx-sum i, .tcx-sum svg { width: 16px; height: 16px; flex-shrink: 0; }
.tcx-sum span { font-weight: 400; font-size: var(--fs-xs); color: var(--text-muted); flex-basis: 100%; }
.tcx-sum.is-ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.tcx-sum.is-err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.tcx-sum.is-warn { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.tcx-list { display: flex; flex-direction: column; gap: 7px; }
.tcx-case { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.tcx-case--pass { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.tcx-case--fail { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.tcx-case__head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; background: var(--surface); cursor: pointer; text-align: left; }
.tcx-case__head:hover { background: var(--surface-2); }
.tcx-case__mark { display: grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; color: var(--text-faint); }
.tcx-case__mark i, .tcx-case__mark svg { width: 14px; height: 14px; }
.tcx-case--pass .tcx-case__mark { color: var(--success); }
.tcx-case--fail .tcx-case__mark { color: var(--danger); }
.tcx-case__name { font-size: var(--fs-sm); font-weight: 600; }
.tcx-case__name em { font-style: normal; font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-left: 5px; }
.tcx-case__time { margin-left: auto; font-size: var(--fs-xs); color: var(--text-faint); }
.tcx-case__chev { width: 15px; height: 15px; color: var(--text-faint); transition: transform var(--dur-2) var(--ease); }
.tcx-case:not(.is-open) .tcx-case__time { margin-left: auto; }
.tcx-case:not(.is-open) .tcx-case__body { display: none; }
.tcx-case.is-open .tcx-case__chev { transform: rotate(180deg); }
.tcx-case:not(.is-open) .tcx-case__chev { transform: none; }
.tcx-case:not(:has(.tcx-case__time)) .tcx-case__chev { margin-left: auto; }
.tcx-case__body { padding: 9px 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--bg-deep); }
.tcx-io > span { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }
.tcx-io pre { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 8px; margin: 0; }
.tcx-io--ok pre { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.tcx-io--got pre { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.tcx-io--err pre { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.tcx-ask { align-self: flex-start; }

/* chat (mentor + conversational) */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat__head .mono { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--violet-300); display: inline-flex; align-items: center; gap: 6px; }
.chat__log { flex: 1; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }
.chat__empty { margin: auto; text-align: center; color: var(--text-faint); font-size: var(--fs-sm); max-width: 30ch; }
.msg { font-size: var(--fs-sm); line-height: 1.6; }
.msg--user { align-self: flex-end; max-width: 88%; background: var(--surface-2); border: 1px solid var(--border-strong); padding: 9px 13px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg--assistant { align-self: flex-start; width: 100%; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 var(--sp-5) var(--sp-3); }
.suggestion-chip { font-size: var(--fs-xs); padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-muted); transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.suggestion-chip:hover { color: var(--text); border-color: var(--accent); }
.chat__input { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); flex-shrink: 0; }
.chat__input .input { flex: 1; }
.chat__input.message-composer {
  margin: 10px 12px 12px; padding: 8px; border: 1px solid var(--border-strong);
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1);
}
.chat__input.message-composer:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow-1); }
.chat__input.message-composer textarea.input { min-height: 40px; padding: 9px 10px; background: transparent; border: 0; box-shadow: none; }
.cursor { display: inline-block; width: 7px; height: 1em; background: var(--accent); vertical-align: -2px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.pulse-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); animation: live-dot 2s var(--ease) infinite; }

/* conversational = centered chat */
.convo { width: 100%; max-width: 860px; margin-inline: auto; height: 100%; }

/* rendered markdown — problem statements + AI replies. Tuned to read like a
   real coding-platform problem: clear section headings, distinct code blocks. */
.md { font-size: var(--fs-sm); line-height: 1.7; color: var(--text); }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-display); margin: 1.3em 0 .5em; line-height: 1.3; letter-spacing: -.01em; }
.md h1 { font-size: var(--fs-lg); }
.md h2 { font-size: var(--fs-md); padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.md h3 { font-size: var(--fs-base); color: var(--text); }
.md h4 { font-size: var(--fs-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); }
.md p { margin: .65em 0; }
.md ul, .md ol { margin: .55em 0; padding-left: 1.4em; list-style: revert; }
.md li { margin: .3em 0; }
.md li::marker { color: var(--text-faint); }
.md code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; color: var(--violet-300); }
.md pre { position: relative; background: var(--bg-deep); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); overflow-x: auto; margin: .8em 0; font-size: var(--fs-xs); line-height: 1.6; }
.md pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 1em; }
.md a { color: var(--violet-300); text-decoration: underline; }
.md strong { color: var(--text); font-weight: 700; }
.md blockquote { border-left: 3px solid var(--accent); padding: .2em var(--sp-4); color: var(--text-muted); margin: .8em 0; background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.md table { border-collapse: collapse; width: 100%; margin: .8em 0; font-size: var(--fs-xs); }
.md th, .md td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.md th { background: var(--surface-2); font-family: var(--font-mono); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }

/* structured sample I/O cards (runnable samples, alongside the statement) */
.io { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin: var(--sp-2) 0; }
.io__col { min-width: 0; }
.io__k { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.io pre { margin: 0; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text); }
@media (max-width: 560px) { .io { grid-template-columns: 1fr; } }

/* test cases + run output */
.testcase { border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3); margin-top: var(--sp-2); background: var(--surface); font-family: var(--font-mono); font-size: var(--fs-xs); }
.testcase--pass { border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.testcase--fail { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.success { color: var(--success); } .warning { color: var(--warning); } .error { color: var(--danger); }

/* ----------------------------------------------------------- onboarding */
.onb { max-width: 720px; margin-inline: auto; padding: var(--sp-10) var(--sp-6) var(--sp-8); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.onb__head { text-align: center; margin-bottom: var(--sp-6); }
.onb__head .brand-mark { margin-inline: auto; }
.onb__chat { display: flex; flex-direction: column; height: min(56vh, 520px); overflow: hidden; padding: 0; }

/* ----------------------------------------------------------- checkout */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
@media (max-width: 720px) { .plan-grid { grid-template-columns: 1fr; } }
.plan { position: relative; }
.plan--pro { border-color: var(--accent); box-shadow: var(--glow-violet); }
.plan__price { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-3xl); }
.plan__price small { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-muted); font-weight: 400; }
.plan__feat { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); padding: 5px 0; }
.plan__feat i { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }

/* ---------------------------------------- pricing (catalog + Free-vs-Pro plans) */
/* One reusable card used by the public catalog, the course-about page and the
   checkout comparison. Tokens only; tints via color-mix like the badges. */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-5); align-items: stretch; }
.pricing-grid--duo { max-width: 780px; margin-inline: auto; }
@media (max-width: 680px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-6); height: 100%; }
.pricing-card--featured { border-color: var(--accent); box-shadow: var(--glow-violet); }
.pricing-card__head { display: flex; flex-direction: column; gap: var(--sp-2); }
.pricing-card__title { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -.01em; }
.pricing-card__desc { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; }
.pricing-card__price { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-4xl); line-height: 1; letter-spacing: -.02em; }
.pricing-card__price .per { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 400; color: var(--text-muted); }
.pricing-card__price .strike { font-size: var(--fs-xl); color: var(--text-faint); text-decoration: line-through; font-weight: 400; }
.pricing-card__hr { height: 1px; background: var(--border); border: 0; margin: 0; }
.pricing-feats { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.pricing-feat { display: flex; gap: var(--sp-3); font-size: var(--fs-sm); align-items: flex-start; }
.pricing-feat > i { width: 18px; height: 18px; color: var(--success); flex-shrink: 0; margin-top: 1px; }
.pricing-feat--off > i { color: var(--text-faint); }
.pricing-feat b { display: block; font-weight: 600; color: var(--text); }
.pricing-feat small { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.4; }
.pricing-card__cta { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-2); }
.pricing-card__fineprint { font-size: var(--fs-xs); color: var(--text-faint); text-align: center; }
.price-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); padding: 3px var(--sp-2); border-radius: var(--r-pill); }

/* AI-tutor upsell shown in the workspace chat column for free-preview learners */
.tutor-lock { display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); margin: auto; max-width: 42ch; padding: var(--sp-6); }
.tutor-lock .empty__glyph { color: var(--accent-text); }
.tutor-lock p { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }


/* ----------------------------------------------- platform tour (driver.js theme) */
.driver-popover.onlearn-tour { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-3); }
.driver-popover.onlearn-tour .driver-popover-title { font-family: var(--font-display); font-size: var(--fs-md); color: var(--text); }
.driver-popover.onlearn-tour .driver-popover-description { color: var(--text-muted); font-size: var(--fs-sm); }
.driver-popover.onlearn-tour .driver-popover-progress-text { color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-xs); }
.driver-popover.onlearn-tour button.driver-popover-next-btn { background: var(--grad); color: #fff; border: none; text-shadow: none; border-radius: var(--r-xs); font-weight: 600; }
.driver-popover.onlearn-tour button.driver-popover-prev-btn { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-strong); text-shadow: none; border-radius: var(--r-xs); }
.driver-popover.onlearn-tour button.driver-popover-close-btn { color: var(--text-muted); }
.driver-popover.onlearn-tour .driver-popover-arrow-side-left.driver-popover-arrow { border-left-color: var(--surface); }
.driver-popover.onlearn-tour .driver-popover-arrow-side-right.driver-popover-arrow { border-right-color: var(--surface); }
.driver-popover.onlearn-tour .driver-popover-arrow-side-top.driver-popover-arrow { border-top-color: var(--surface); }
.driver-popover.onlearn-tour .driver-popover-arrow-side-bottom.driver-popover-arrow { border-bottom-color: var(--surface); }

@media (max-width: 1100px) {
  /* OnlearnSplit is inert below this width — panels stack vertically via flex */
  .lab { flex-direction: column; height: auto; min-height: 100%; }
  .lab__panel { border-right: none; border-bottom: 1px solid var(--border); flex: 0 0 auto !important; min-height: 300px; }
  .lab__panel.is-collapsed { min-height: 0; }
  .lab__split { min-height: 360px; }
}

/* ===========================================================================
   AUTH
   ========================================================================== */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside {
  position: relative; overflow: hidden; padding: var(--sp-16) var(--sp-12);
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, var(--surface) 0%, var(--bg-deep) 100%); border-right: 1px solid var(--border);
}
.auth-aside__glow { position: absolute; inset: 0; background: radial-gradient(50% 40% at 20% 10%, rgba(124,58,237,.22), transparent 60%), radial-gradient(45% 45% at 90% 100%, rgba(6,182,212,.16), transparent 60%); pointer-events: none; }
.auth-aside__content { position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: var(--sp-12) var(--sp-6); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: var(--fs-2xl); margin-bottom: 6px; }
.auth-box__sub { color: var(--text-muted); margin-bottom: var(--sp-8); }
.auth-divider { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-6) 0; color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .1em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-quote { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.4; font-weight: 500; }
.auth-foot { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-6); text-align: center; }
.auth-foot a, .link { color: var(--accent-text); font-weight: 600; }
.link:hover, .auth-foot a:hover { text-decoration: underline; }
.auth-box__brand { display: none; }
.pwd-reqs { list-style: none; display: grid; gap: 6px; margin: 10px 0 0; padding: 0; }
.pwd-reqs li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--text-faint);
  transition: color var(--dur-2) var(--ease);
}
.pwd-reqs__mark {
  position: relative; flex: none; width: 14px; height: 14px;
  border: 1.5px solid currentColor; border-radius: 50%;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.pwd-reqs li.is-ok { color: var(--success); }
.pwd-reqs li.is-ok .pwd-reqs__mark { background: var(--success); border-color: var(--success); }
.pwd-reqs li.is-ok .pwd-reqs__mark::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 3px; height: 6px;
  border: solid var(--bg-deep); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}

/* ===========================================================================
   LANDING
   ========================================================================== */
.lp { position: relative; }
.lp-nav { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background: rgba(13,17,23,.72); background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--border); }
.lp-nav__inner { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.lp-nav__links { display: flex; align-items: center; gap: var(--sp-6); }
.lp-nav__links a { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500; }
.lp-nav__links a:hover { color: var(--text); }

.hero { position: relative; padding: var(--sp-24) 0 var(--sp-20); text-align: center; overflow: hidden; }
.hero__tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-strong); font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-6); }
.hero__tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); animation: live-dot 2s var(--ease) infinite; }
@keyframes live-dot { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 50% { box-shadow: 0 0 0 5px rgba(52,211,153,0); } }
.hero h1 { font-size: clamp(2.4rem, 6vw, var(--fs-5xl)); line-height: 1.04; letter-spacing: -.03em; max-width: 16ch; margin-inline: auto; }
.hero__sub { font-size: var(--fs-lg); color: var(--text-muted); max-width: 56ch; margin: var(--sp-6) auto var(--sp-8); line-height: 1.5; }
.hero__cta { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* hero path visualization (the signature, horizontal) */
.hero-path { margin: var(--sp-16) auto 0; max-width: 820px; }
.hero-path__track { display: flex; align-items: center; }
.hpn { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
/* The hero path is the signature spine shown horizontally — and it demonstrates
   the mechanic: done nodes fill with the gradient, the current node pulses, future
   nodes stay faint. (Same states as the in-app vertical .spine.) */
.hpn__dot { width: 52px; height: 52px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-muted); box-shadow: var(--shadow-2); }
.hpn__dot i, .hpn__dot svg { width: 22px; height: 22px; }
.hpn--done .hpn__dot { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--glow-violet); }
.hpn--current .hpn__dot { border: 2px solid var(--accent); color: var(--violet-300); animation: pulse-ring 2.4s var(--ease) infinite; }
.hpn--future .hpn__dot { opacity: .6; }
.hpn__lbl { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: .04em; }
.hpn--done .hpn__lbl, .hpn--current .hpn__lbl { color: var(--text); }
.hpn__seg { height: 3px; flex: 1; border-radius: 2px; background: var(--border-strong); position: relative; transform-origin: left; animation: draw-x var(--dur-4) var(--ease-out) backwards; }
.hpn__seg--done { background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.hpn__seg--current { background: linear-gradient(90deg, var(--cyan) 0, var(--cyan) 45%, var(--border-strong) 45%); }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.feature { padding: var(--sp-6); }
.feature__icon { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--violet-300); margin-bottom: var(--sp-4); }
.feature__icon i, .feature__icon svg { width: 21px; height: 21px; }
.feature h3 { font-size: var(--fs-lg); margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: var(--fs-sm); }

.statline { display: flex; gap: var(--sp-12); justify-content: center; flex-wrap: wrap; padding: var(--sp-10) 0; }
.section-pad { padding: var(--sp-20) 0; }
.section-pad--tight { padding: var(--sp-16) 0; }

.lp-foot { border-top: 1px solid var(--border); padding: var(--sp-10) 0; color: var(--text-faint); font-size: var(--fs-sm); }

/* ===========================================================================
   MOTION
   ========================================================================== */
@keyframes pulse-ring { 0%,100% { box-shadow: 0 0 0 0 rgba(139,92,246,.45); } 50% { box-shadow: 0 0 0 7px rgba(139,92,246,0); } }
@keyframes shimmer { to { background-position: -400% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes float-soft { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* page-load reveal: children rise in sequence (set --i on each child) */
.reveal > * { animation: rise var(--dur-3) var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.float { animation: float-soft 5s var(--ease) infinite; }

/* ===========================================================================
   A11Y FLOORS
   ========================================================================== */
/* outline (not box-shadow) so the ring is never clipped by overflow:hidden
   ancestors like .sidebar / .menu__panel */
:focus-visible { outline: 2px solid var(--violet-300); outline-offset: 2px; }
a:focus-visible { text-decoration: underline; }  /* robust secondary cue for inline links */
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--surface); border: 1px solid var(--accent); padding: 8px 14px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  /* content that starts hidden for a reveal must never stay hidden */
  .reveal > *, [data-reveal] > *, .hpn__seg { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* ===========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .feature-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-box {
    max-width: 420px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: var(--sp-8); box-shadow: var(--shadow-2);
  }
  .auth-box__brand { display: inline-flex; margin-bottom: var(--sp-6); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(86vw, var(--sidebar-w)); transform: translateX(-100%); transition: transform var(--dur-3) var(--ease); box-shadow: var(--shadow-3); }
  .app.is-mobile-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 25; opacity: 0; pointer-events: none; transition: opacity var(--dur-2) var(--ease); }
  .app.is-mobile-open .scrim { opacity: 1; pointer-events: auto; }
  .content { padding: var(--sp-5) var(--sp-4) var(--sp-12); }
  .searchbox { display: none; }
  /* mobile drawer is always the full panel — the hamburger replaces the toggle */
  .sidebar__toggle { display: none; }
  .app.is-collapsed .nav-item__label, .app.is-collapsed .brand-word { opacity: 1; width: auto; }
  .app.is-collapsed .sidebar__brand { flex: 1; gap: var(--sp-3); justify-content: flex-start; }
  .app.is-collapsed .user-chip__meta { display: block; }
  .app.is-collapsed .nav-item__badge { display: inline-block; }
  .app.is-collapsed .nav-label { opacity: 1; height: auto; padding: var(--sp-4) var(--sp-3) var(--sp-2); }
  .app.is-collapsed .nav-item { justify-content: flex-start; padding-inline: var(--sp-3); gap: var(--sp-3); }
  .app.is-collapsed .sidebar__head { justify-content: flex-start; padding-inline: var(--sp-5); }
  .app.is-collapsed .user-chip { justify-content: flex-start; padding-inline: var(--sp-3); }
  /* mobile drawer is always the full panel — restore the course dropdown too */
  .app.is-collapsed .course-scope__meta { display: flex; }
  .app.is-collapsed .course-scope__optname { display: block; }
  .app.is-collapsed .course-scope__btn > i, .app.is-collapsed .course-scope__btn > svg,
  .app.is-collapsed .course-scope__opt > i, .app.is-collapsed .course-scope__opt > svg { display: block; }
  .app.is-collapsed .course-scope__btn, .app.is-collapsed .course-scope__opt { justify-content: flex-start; }
  .app.is-collapsed .course-scope__optcode { width: 34px; }

  /* workspace: tighten the single chrome row for small screens (the questions
     live in the overlay, so there's no sidebar to manage here) */
  .wsx-brand, .wsx-lesson__mod, .wsx-under__meta, .wsx-pager { display: none; }
  .wsx-lesson__ttl { max-width: 14ch; }
  /* the chrome mode toggle squeezes to icon pills */
  .wsx-mode__lbl { display: none; }
  .wsx-modes .wsx-mode { padding: 7px 11px; }
  .vtab-quiz em { display: none; }
  .wsx-panel { padding: var(--sp-5) var(--sp-4); }
  /* Single-column lesson with the professor-requested live-comments tutor as
     an explicit full-screen sheet. The video remains the default focus; the
     Ask tutor pill opens this surface and Escape / close returns to the video. */
  .wsx-video, .wsx-video.is-nodock { grid-template-columns: 1fr; padding: 0; }
  .vid-ask {
    position: fixed; inset: var(--topbar-h) 0 0; z-index: 70;
    display: flex; border-left: 0; border-top: 1px solid var(--border);
    box-shadow: var(--shadow-3); transform: translateY(0);
    transition: transform var(--dur-3) var(--ease-out), visibility var(--dur-3);
  }
  .wsx-video.is-nodock .vid-ask {
    display: flex; visibility: hidden; pointer-events: none;
    transform: translateY(100%); border-left-width: 0;
  }
  .vid-ask__head { min-height: 58px; padding-inline: var(--sp-5); }
  .vid-ask__head small { color: var(--text-faint); font: inherit; }
  .vid-ask .chat__log { padding: var(--sp-5); }
  .vid-ask .suggestions { padding-inline: var(--sp-5); }
  .vid-ask .chat__input { padding: var(--sp-3) var(--sp-5) max(var(--sp-4), env(safe-area-inset-bottom)); }
  .wsx-vcol { padding: var(--sp-4) var(--sp-4) var(--sp-8); }
}
@media (min-width: 861px) { .scrim, .topbar__hamburger { display: none; } }

/* Faculty preview-as-student banner (Phase 5c) — pinned above the app shell. */
.preview-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  padding: 8px var(--sp-4);
  background: var(--grad-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text); font-size: var(--fs-sm); font-weight: 500;
  backdrop-filter: blur(6px);
}
.preview-bar i { width: 16px; height: 16px; }
.preview-bar a { color: var(--accent-text); font-weight: 600; }

/* ------------------------------------------------- progress dashboard (v2)
   Monorepo-informed multi-viz: streak flame card, overall ring + assignment
   chips, per-course cards with per-module completion rings. */
.streak-card { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; position: relative; overflow: hidden; }
.streak-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 120% at 8% 50%, rgba(251,146,60,.14), transparent 60%);
}
.streak-card__flame {
  position: relative; width: 64px; height: 64px; flex: none;
  display: grid; place-items: center; border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(251,146,60,.25), rgba(251,113,133,.18));
  border: 1px solid rgba(251,146,60,.4); color: var(--ember);
}
.streak-card__flame i, .streak-card__flame svg { width: 30px; height: 30px; position: relative; z-index: 1; }
.streak-card__glow { position: absolute; inset: 8px; border-radius: 50%; background: rgba(251,146,60,.45); filter: blur(14px); }
@media (prefers-reduced-motion: no-preference) {
  .streak-card__flame { animation: streak-flicker 2.4s var(--ease) infinite; }
  @keyframes streak-flicker { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.06); } }
}
.streak-card__main { flex: 1; min-width: 180px; position: relative; }
.streak-card__num b {
  font-family: var(--font-display); font-weight: 800; font-size: var(--fs-4xl); line-height: 1;
  background: linear-gradient(120deg, var(--ember), #FBBF24); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.streak-card__num span { color: var(--text-muted); font-size: var(--fs-sm); }
.streak-card__msg { margin: 4px 0 0; color: var(--ember); font-size: var(--fs-sm); font-weight: 600; }
.streak-card__side { display: flex; gap: var(--sp-6); position: relative; }
.streak-card__best { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.streak-card__best i, .streak-card__best svg { width: 15px; height: 15px; color: var(--text-faint); }
.streak-card__best span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.streak-card__best b { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; line-height: 1.1; }
.streak-card__best small { font-size: var(--fs-xs); color: var(--text-muted); }

.progress-overall__body { display: flex; align-items: center; gap: var(--sp-8); margin-top: var(--sp-5); flex-wrap: wrap; }
.progress-overall__facts p { margin: 0 0 var(--sp-2); }
.progress-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.progress-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--fs-xs); color: var(--text-muted);
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.progress-chip b { color: var(--text); }
.progress-chip:hover { border-color: var(--border-strong); color: var(--text); }
.progress-chip.is-alert { border-color: rgba(251,113,133,.45); }
.progress-chip.is-alert b { color: var(--danger); }

.progress-course { margin-bottom: var(--sp-5); }
.progress-course__quiz { display: flex; align-items: center; gap: 7px; margin: 0 0 var(--sp-4); font-size: var(--fs-sm); color: var(--text-muted); }
.progress-course__quiz i, .progress-course__quiz svg { width: 15px; height: 15px; flex: none; color: var(--violet-300); }
.module-rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.module-ring {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-2) var(--ease);
}
.module-ring:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-2px); }
.module-ring .ring { flex: none; }
.module-ring__label { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-xs); line-height: 1.35; }
.module-ring__label small { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; color: var(--text-faint); }
.ring--sm .ring__num { font-size: var(--fs-xs); font-weight: 700; }
.ring--sm .ring__lbl { display: none; }

/* ---------------------------------------------- attached-file chip (authoring)
   Clean replacement for the raw ClearableFileInput on resource content items. */
.attached-file {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 10px var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); flex-wrap: wrap;
}
.attached-file__name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attached-file__name i, .attached-file__name svg { width: 15px; height: 15px; flex: none; color: var(--violet-300); }

/* ---------------------------------------------- faculty course builder */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.faculty-builder-content { max-width: var(--container-wide); padding-inline: var(--sp-6); }
.builder-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); margin-bottom: var(--sp-6); }
.builder-head h1 { margin: 0; font-size: var(--fs-3xl); }
.builder-head p:last-child { max-width: 70ch; margin: var(--sp-2) 0 0; }
.builder-head__actions { flex: none; padding-top: var(--sp-6); }
.course-builder { display: grid; grid-template-columns: var(--builder-outline-w) minmax(var(--builder-editor-min), 1fr); min-height: calc(100vh - var(--topbar-h) - var(--sp-24)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); }

.builder-outline { display: flex; flex-direction: column; min-width: 0; background: var(--bg-deep); border-right: 1px solid var(--border); }
.builder-outline__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.builder-outline__head > div { display: flex; flex-direction: column; gap: var(--sp-1); }
.builder-outline__head small { color: var(--text-faint); font-size: var(--fs-xs); }
.builder-outline__search { position: relative; display: block; margin: var(--sp-3); }
.builder-outline__search svg { position: absolute; left: var(--sp-3); top: 50%; width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); transform: translateY(-50%); pointer-events: none; }
.builder-outline__search input { min-height: var(--sp-8); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-8); font-size: var(--fs-xs); }
.builder-tree { flex: 1; overflow: auto; padding: var(--sp-2); }
.builder-module { margin-bottom: var(--sp-2); }
.builder-module > summary { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); font-weight: 700; list-style: none; }
.builder-module > summary::-webkit-details-marker { display: none; }
.builder-module > summary:hover { background: var(--surface); }
.builder-module__number { display: grid; place-items: center; width: var(--sp-6); height: var(--sp-6); border-radius: var(--r-xs); background: var(--surface-2); color: var(--accent-text); font-family: var(--font-mono); font-size: var(--fs-xs); }
.builder-module__body { margin-left: var(--sp-3); padding-left: var(--sp-3); border-left: 1px solid var(--border); }
.builder-module__links { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-2); font-size: var(--fs-xs); }
.builder-module__links a { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-faint); }
.builder-module__links a:hover { color: var(--accent-text); }
.builder-module__links svg { width: var(--sp-3); height: var(--sp-3); }
.builder-topic { margin-bottom: var(--sp-2); }
.builder-topic__head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }
.builder-topic__head svg { width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); }
.builder-tree__label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builder-tree__count, .builder-tree__draft { color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; }
.builder-lessons { display: grid; gap: var(--sp-1); margin-left: var(--sp-3); }
.builder-lesson-row { display: flex; align-items: center; min-width: 0; }
.builder-lesson-row > .builder-lesson { flex: 1; }
.builder-lesson { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); color: var(--text-muted); font-size: var(--fs-xs); }
.builder-lesson:hover { color: var(--text); background: var(--surface); }
.builder-lesson.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.builder-lesson__status { width: var(--sp-2); height: var(--sp-2); flex: none; border-radius: var(--r-pill); background: var(--warning); }
.builder-lesson__status.is-published { background: var(--success); }
.builder-tree__empty { margin: var(--sp-2) var(--sp-3); color: var(--text-faint); font-size: var(--fs-xs); }
.builder-add-row button { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3); border: 0; background: transparent; color: var(--text-faint); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.builder-add-row button:hover { color: var(--accent-text); }
.builder-add-row svg { width: var(--sp-3); height: var(--sp-3); }
.builder-tree-menu { position: relative; flex: none; }
.builder-tree-menu > summary { display: grid; place-items: center; width: var(--sp-6); height: var(--sp-6); border-radius: var(--r-xs); color: var(--text-faint); cursor: pointer; list-style: none; }
.builder-tree-menu > summary::-webkit-details-marker { display: none; }
.builder-tree-menu > summary:hover { color: var(--text); background: var(--surface-2); }
.builder-tree-menu > summary svg { width: var(--sp-4); height: var(--sp-4); }
.builder-tree-menu > div { position: absolute; top: calc(100% + var(--sp-1)); right: 0; z-index: 5; display: grid; gap: var(--sp-3); width: calc(var(--builder-outline-w) - var(--sp-8)); padding: var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-2); }
.builder-tree-menu label { color: var(--text-muted); font-size: var(--fs-xs); }
.builder-tree-menu .input { min-height: var(--sp-8); padding-block: var(--sp-1); font-size: var(--fs-xs); }
.builder-tree-menu--lesson > div { width: auto; }
.builder-inline-create { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); padding: var(--sp-2); }
.builder-inline-create .input { min-height: var(--sp-8); padding-block: var(--sp-1); font-size: var(--fs-xs); }
.builder-inline-create--module { padding: var(--sp-3); border-top: 1px solid var(--border); }
.builder-outline__empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-8); color: var(--text-faint); text-align: center; }

.builder-editor { min-width: 0; background: var(--surface); }
#lesson-builder { max-width: var(--builder-editor-max); margin-inline: auto; padding: var(--sp-6); }
.builder-editor__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5); padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border); }
.builder-save-state { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-faint); font-size: var(--fs-xs); }
.builder-save-state svg { width: var(--sp-4); height: var(--sp-4); }
.builder-save-state.is-saving svg { animation: spin var(--dur-4) linear infinite; }
.builder-save-state.is-error { color: var(--danger); }
.builder-readiness { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); background: color-mix(in srgb, var(--warning) 8%, var(--surface-2)); color: var(--warning); font-size: var(--fs-sm); }
.builder-readiness.is-ready { background: color-mix(in srgb, var(--success) 8%, var(--surface-2)); color: var(--success); }
.builder-readiness svg { width: var(--sp-4); height: var(--sp-4); }
.builder-section { padding: var(--sp-6) 0; border-bottom: 1px solid var(--border); }
.builder-section__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.builder-section__head > div { display: flex; align-items: center; gap: var(--sp-3); }
.builder-section__head h2 { margin: 0; font-size: var(--fs-lg); }
.builder-section__head p { max-width: 48ch; margin: 0; color: var(--text-faint); font-size: var(--fs-xs); text-align: right; }
.builder-section__step { display: grid; place-items: center; width: var(--sp-6); height: var(--sp-6); border-radius: var(--r-pill); background: var(--surface-3); color: var(--accent-text); font-family: var(--font-mono); font-size: var(--fs-xs); }
.field-required { float: right; color: var(--accent-text); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; }
.builder-title-input { font-size: var(--fs-lg); font-weight: 700; }
.builder-items { display: grid; gap: var(--sp-3); }
.builder-item { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: start; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.builder-item__icon { display: grid; place-items: center; width: var(--sp-8); height: var(--sp-8); border-radius: var(--r-sm); background: var(--surface-3); color: var(--accent-text); }
.builder-item__icon svg { width: var(--sp-4); height: var(--sp-4); }
.builder-item__body { min-width: 0; }
.builder-item__grid { grid-template-columns: minmax(0, .5fr) minmax(0, 1.5fr); gap: var(--sp-3); }
.builder-item__remove { width: var(--sp-8); height: var(--sp-8); }
.builder-advanced { margin-top: var(--sp-3); }
.builder-advanced > summary { color: var(--text-muted); cursor: pointer; font-size: var(--fs-xs); font-weight: 700; }
.builder-advanced[open] > summary { margin-bottom: var(--sp-3); }
.builder-empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-6); border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-faint); text-align: center; }
.builder-empty p { margin: 0; font-size: var(--fs-sm); }
.builder-add-actions { margin-top: var(--sp-3); }
.builder-file-button { cursor: pointer; }
.builder-section--advanced { border-bottom: 0; }
.builder-section--advanced > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); cursor: pointer; }
.builder-section--advanced > summary span { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 700; }
.builder-section--advanced > summary small { color: var(--text-faint); font-size: var(--fs-xs); }
.builder-section--advanced[open] > summary { margin-bottom: var(--sp-4); }
.builder-welcome { display: grid; justify-items: center; align-content: center; min-height: 60vh; padding: var(--sp-8); text-align: center; }
.builder-welcome__icon { display: grid; place-items: center; width: var(--sp-16); height: var(--sp-16); border-radius: var(--r-lg); background: var(--surface-2); color: var(--accent-text); }
.builder-welcome p { color: var(--text-muted); }
.builder-unassigned { display: grid; gap: var(--sp-2); margin-top: var(--sp-8); }

/* Focused lesson editor — a compact command bar above distinct work cards. */
.lesson-page-head { max-width: var(--lesson-editor-max); margin-inline: auto; margin-bottom: var(--sp-4); }
.lesson-page-head h1 { font-size: var(--fs-2xl); }
.lesson-page-head .builder-head__actions { padding-top: var(--sp-5); }
.lesson-editor-page { width: 100%; max-width: var(--lesson-editor-max); margin-inline: auto; }
.lesson-editor-page .builder-editor { background: transparent; }
.lesson-editor-page #lesson-builder { display: grid; gap: var(--sp-4); max-width: none; padding: 0 0 var(--sp-12); }
.builder-control-bar {
  position: sticky; top: calc(var(--topbar-h) + var(--sp-3)); z-index: 10;
  display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-2);
}
.lesson-editor-page .builder-editor__head { align-items: center; padding: 0; border: 0; }
.builder-editor__status { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.builder-editor__actions { margin-left: auto; }
.lesson-editor-page .builder-readiness { margin: 0; padding: var(--sp-2) var(--sp-3); }
.lesson-editor-page .builder-section {
  display: grid; gap: var(--sp-4); padding: var(--sp-6);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-1);
}
.lesson-editor-page .builder-section__head { margin: 0 0 var(--sp-1); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.lesson-editor-page .builder-section__head h2 { font-size: var(--fs-xl); }
.lesson-editor-page .builder-section__head p { align-self: center; }
.lesson-editor-page .builder-section > .field { max-width: none; }
.lesson-editor-page .builder-section .field + .field { margin-top: 0; }
.lesson-editor-page .builder-item { padding: var(--sp-5); }
.lesson-editor-page .builder-add-actions { margin-top: 0; padding-top: var(--sp-1); }
.lesson-editor-page .builder-section--advanced { padding: var(--sp-5) var(--sp-6); }
.lesson-editor-page .builder-section--advanced > summary { min-height: var(--sp-8); }

.form-shell { max-width: var(--builder-editor-max); }
.form-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.form-card__section { display: grid; gap: var(--sp-4); padding: var(--sp-6); border-bottom: 1px solid var(--border); }
.form-card__section > header { display: flex; align-items: flex-start; gap: var(--sp-3); }
.form-card__section h2 { margin: 0; font-size: var(--fs-md); }
.form-card__section header p { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: var(--fs-xs); }
.form-card__icon { display: grid; place-items: center; width: var(--sp-8); height: var(--sp-8); flex: none; border-radius: var(--r-sm); background: var(--surface-2); color: var(--accent-text); }
.form-card__icon svg { width: var(--sp-4); height: var(--sp-4); }
.form-card__details > summary { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; list-style: none; }
.form-card__details > summary::-webkit-details-marker { display: none; }
.form-card__details > summary > span:nth-child(2) { display: grid; flex: 1; gap: var(--sp-1); }
.form-card__details > summary small { color: var(--text-faint); font-size: var(--fs-xs); }
.form-card__details > summary > svg { width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); transition: transform var(--dur-2) var(--ease); }
.form-card__details[open] > summary > svg { transform: rotate(180deg); }
.form-card__footer { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); background: var(--surface-2); }
.form-card__footer > span { font-size: var(--fs-xs); }
.preview-notice { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent-text); font-size: var(--fs-sm); }
.preview-notice > span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.preview-notice svg, .draft-preview__section h2 svg { width: var(--sp-4); height: var(--sp-4); }
.draft-preview__section { margin-top: var(--sp-8); }
.draft-preview__section h2 { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); }

/* Support — calm queues and a conversation-first ticket thread. */
.support-page { display: grid; gap: var(--sp-6); }
.support-page__head, .support-thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); }
.support-page__head > div, .support-thread-head > div { min-width: 0; }
.support-back { justify-self: start; }
.support-section { display: grid; gap: var(--sp-3); }
.support-section .section-head { margin: 0; }
.support-ticket-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.support-ticket-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3); padding: var(--sp-4); color: inherit; text-decoration: none; transition: background var(--dur-2) var(--ease); }
.support-ticket-row + .support-ticket-row { border-top: 1px solid var(--border); }
.support-ticket-row:hover { background: var(--surface-2); }
.support-ticket-row__icon { display: grid; place-items: center; width: var(--sp-8); height: var(--sp-8); border-radius: var(--r-sm); background: var(--surface-2); color: var(--accent-text); }
.support-ticket-row__icon svg, .support-ticket-row__arrow { width: var(--sp-4); height: var(--sp-4); }
.support-ticket-row__body, .support-message__author > span:last-child, .support-closed > span { display: grid; min-width: 0; gap: var(--sp-1); }
.support-ticket-row__title { overflow: hidden; color: var(--text); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.support-ticket-row__meta, .support-message__author small, .support-closed small { color: var(--text-faint); font-size: var(--fs-xs); }
.support-ticket-row__arrow { color: var(--text-faint); }
.support-thread { display: grid; gap: var(--sp-3); }
.support-message { display: grid; gap: var(--sp-3); max-width: var(--builder-editor-max); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.support-message--mine { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.support-message__author { display: flex; align-items: center; gap: var(--sp-2); }
.support-message p { margin: 0; color: var(--text-muted); line-height: 1.65; white-space: pre-wrap; }
.support-reply { margin-top: var(--sp-2); }
.support-reply .form-disclosure__body { display: grid; gap: var(--sp-3); }
.support-closed { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-muted); }
.support-closed > svg { width: var(--sp-5); height: var(--sp-5); }
.ticket-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.ticket-summary > * { display: grid; gap: var(--sp-1); padding: var(--sp-4); color: inherit; text-decoration: none; }
.ticket-summary > * + * { border-left: 1px solid var(--border); }
.ticket-summary b { color: var(--text); font-size: var(--fs-xl); }
.ticket-summary span { color: var(--text-faint); font-size: var(--fs-xs); }
.ticket-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: var(--sp-2); align-items: center; }
.ticket-search { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--control-h); padding-inline: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.ticket-search:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ticket-search svg { width: var(--sp-4); height: var(--sp-4); color: var(--text-faint); }
.ticket-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.ticket-controls__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); }
.ticket-controls__grid section { min-width: 0; }
.ticket-controls__grid .h2 { margin: 0 0 var(--sp-3); }
.ticket-controls__grid p { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); }
.ticket-faculty-list { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: 0; list-style: none; }
.ticket-faculty-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.ticket-faculty-list li > span { display: grid; gap: var(--sp-1); min-width: 0; }
.ticket-faculty-list small { color: var(--text-faint); font-size: var(--fs-xs); }
.form-card__intro > span:last-child { display: grid; gap: var(--sp-1); }
.form-card__intro > span:last-child small { color: var(--text-muted); font-size: var(--fs-xs); }

@media (max-width: 960px) {
  .builder-head, .builder-editor__head, .builder-section__head { flex-direction: column; }
  .builder-head__actions { padding-top: 0; }
  .course-builder { grid-template-columns: 1fr; }
  .builder-outline { border-right: 0; border-bottom: 1px solid var(--border); max-height: 44vh; }
  .builder-section__head p { text-align: left; }
  .builder-control-bar { position: static; }
  .builder-editor__actions { margin-left: 0; }
}
@media (max-width: 640px) {
  .faculty-builder-content, #lesson-builder { padding-inline: var(--sp-3); }
  .builder-item__grid { grid-template-columns: 1fr; }
  .builder-editor__head .cluster { flex-wrap: wrap; }
  .form-card__footer { align-items: stretch; flex-direction: column; }
  .lesson-page-head, .lesson-editor-page { max-width: none; }
  .lesson-editor-page .builder-section { padding: var(--sp-4); }
  .builder-control-bar { padding: var(--sp-3); }
  .builder-editor__actions { width: 100%; flex-wrap: wrap; }
  .support-page__head, .support-thread-head { flex-direction: column; }
  .support-ticket-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .support-ticket-row .badge { grid-column: 2; justify-self: start; }
  .support-ticket-row__arrow { grid-column: 3; grid-row: 1; }
  .ticket-summary { grid-template-columns: 1fr; }
  .ticket-summary > * + * { border-top: 1px solid var(--border); border-left: 0; }
  .ticket-filters { grid-template-columns: 1fr 1fr; }
  .ticket-search { grid-column: 1 / -1; }
  .ticket-controls__grid { grid-template-columns: 1fr; }
}
