/* =====================================================================
   LearnHub — design system (ported from the design handoff app.css).
   Editorial-academic: warm paper light shell + deep ink viewer.
   Type: Newsreader (display serif) + Hanken Grotesk (UI grotesque).
   Theming via CSS variables; accent injected inline from app.js.
   ===================================================================== */

/* ---- base / app integration (not in prototype: it ran in a device frame) -- */
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
}
#app { height: 100%; }
.boot {
  height: 100%; display: grid; place-items: center;
  color: var(--muted); font-family: var(--font-ui);
}

:root {
  /* accent (overridden inline by app.js) */
  --accent: oklch(0.52 0.16 280);
  --accent-press: oklch(0.46 0.16 280);
  --accent-tint: oklch(0.52 0.16 280 / 0.12);
  --accent-ink: oklch(0.99 0.01 280);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --font-ui: "Hanken Grotesk", -apple-system, system-ui, sans-serif;
  --font-display: "Newsreader", Georgia, serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Light (default app shell) ---- */
[data-theme="light"] {
  --bg: oklch(0.984 0.004 80);
  --bg-grad-1: oklch(0.985 0.006 80);
  --bg-grad-2: oklch(0.965 0.008 70);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.975 0.004 80);
  --ink: oklch(0.24 0.012 65);
  --ink-2: oklch(0.42 0.012 65);
  --muted: oklch(0.58 0.012 65);
  --faint: oklch(0.72 0.01 70);
  --line: oklch(0.91 0.005 75);
  --line-strong: oklch(0.86 0.006 75);
  --shadow-card: 0 1px 2px oklch(0.4 0.02 70 / 0.04), 0 8px 24px oklch(0.4 0.02 70 / 0.06);
  --shadow-pop: 0 12px 40px oklch(0.3 0.02 70 / 0.16);
  --glass: oklch(0.99 0.003 80 / 0.86);
  --on-accent: oklch(0.99 0.01 280);
}

/* ---- Dark ---- */
[data-theme="dark"] {
  --bg: oklch(0.17 0.014 268);
  --bg-grad-1: oklch(0.19 0.016 268);
  --bg-grad-2: oklch(0.15 0.014 268);
  --surface: oklch(0.22 0.016 268);
  --surface-2: oklch(0.255 0.018 268);
  --ink: oklch(0.96 0.005 80);
  --ink-2: oklch(0.82 0.008 80);
  --muted: oklch(0.68 0.012 268);
  --faint: oklch(0.5 0.012 268);
  --line: oklch(0.31 0.016 268);
  --line-strong: oklch(0.38 0.018 268);
  --shadow-card: 0 1px 2px oklch(0 0 0 / 0.3), 0 10px 30px oklch(0 0 0 / 0.35);
  --shadow-pop: 0 16px 50px oklch(0 0 0 / 0.5);
  --glass: oklch(0.21 0.016 268 / 0.86);
  --on-accent: oklch(0.99 0.01 280);
}

* { box-sizing: border-box; }

.lh-app {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 80% -10%, var(--bg-grad-1), transparent 60%),
    linear-gradient(var(--bg-grad-1), var(--bg-grad-2));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.lh-app input, .lh-app textarea { user-select: text; }

/* top safe-area spacer (replaces the prototype's fixed 56px iOS island) */
.lh-statuspad { height: max(env(safe-area-inset-top, 0px), 12px); flex: none; }

/* ---------------------------------------------------------------- App bar */
.appbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
  gap: 12px;
}
.appbar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), oklch(0.62 0.15 320));
  display: grid; place-items: center;
  color: var(--on-accent);
  box-shadow: 0 4px 12px var(--accent-tint);
  flex: none;
}
.brand-mark svg { width: 17px; height: 17px; }

.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
}
.role-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.role-pill.tutor .dot { background: oklch(0.62 0.15 150); }
.role-pill.member .dot { background: oklch(0.62 0.15 150); }

/* ---------------------------------------------------------------- Screen */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 20px calc(96px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

.screen-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 6px 0 2px;
  text-wrap: balance;
}
.screen-sub { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; line-height: 1.45; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  margin: 0 0 8px;
}

/* ---------------------------------------------------------------- Cards */
.cardgrid { display: grid; gap: 14px; }
@media (min-width: 380px) { .cardgrid.cols-2 { grid-template-columns: 1fr 1fr; } }

.course {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
  box-shadow: var(--shadow-card);
}
.course:active { transform: scale(0.985); }
.course .cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.course .cover .cover-glyph {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 500;
  color: oklch(1 0 0 / 0.92);
  text-shadow: 0 2px 18px oklch(0 0 0 / 0.25);
}
.cover-tag {
  position: absolute; top: 11px; left: 11px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 5px 9px; border-radius: 8px;
  background: oklch(0.16 0.02 270 / 0.5);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cover-tag svg { width: 12px; height: 12px; }
.cover-dur {
  position: absolute; bottom: 11px; right: 11px;
  font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 7px;
  background: oklch(0.16 0.02 270 / 0.55);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.course .lock {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 7px;
  align-items: center; justify-content: center;
  background: oklch(0.14 0.02 270 / 0.46);
  backdrop-filter: blur(3px) saturate(120%);
  -webkit-backdrop-filter: blur(3px) saturate(120%);
  color: #fff;
}
.course .lock .lock-badge {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: oklch(1 0 0 / 0.16);
  border: 1px solid oklch(1 0 0 / 0.3);
}
.course .lock .lock-badge svg { width: 17px; height: 17px; }
.course .lock span { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.course .body { padding: 12px 14px 14px; }
.course .body .ctitle {
  font-family: var(--font-display);
  font-weight: 500; font-size: 17px; line-height: 1.18;
  letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course .body .cmeta {
  display: flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: 12.5px; margin-top: 7px;
}
.course .body .cmeta .av {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  font-size: 9px; font-weight: 800; color: #fff;
}

/* compact list variant */
.course.row { display: flex; align-items: stretch; }
.course.row .cover { aspect-ratio: auto; width: 116px; flex: none; }
.course.row .cover .cover-glyph { font-size: 30px; }
.course.row .cover-tag { top: 8px; left: 8px; padding: 3px 7px; font-size: 10px; }
.course.row .cover-dur { display: none; }
.course.row .body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; min-width: 0; }
.course.row .body .ctitle { -webkit-line-clamp: 2; font-size: 16px; }
.course.row .lock .lock-badge { width: 30px; height: 30px; }
.course.row .lock span { display: none; }

/* ---------------------------------------------------------------- Paywall banner */
.paywall {
  position: relative;
  border-radius: var(--r-lg);
  padding: 16px 16px 16px 18px;
  margin-bottom: 18px;
  color: var(--on-accent);
  background:
    radial-gradient(120% 140% at 0% 0%, oklch(0.6 0.16 320), transparent 55%),
    linear-gradient(120deg, var(--accent), var(--accent-press));
  overflow: hidden;
  box-shadow: 0 10px 30px var(--accent-tint);
  cursor: pointer;
}
.paywall .pw-row { display: flex; align-items: center; gap: 14px; }
.paywall .pw-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: oklch(1 0 0 / 0.16); border: 1px solid oklch(1 0 0 / 0.22);
}
.paywall .pw-ic svg { width: 20px; height: 20px; }
.paywall h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.paywall p { margin: 2px 0 0; font-size: 13px; opacity: 0.9; line-height: 1.4; }
.paywall .pw-btn {
  margin-left: auto; flex: none; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  padding: 10px 15px; border-radius: 11px; border: 0; cursor: pointer;
  background: oklch(1 0 0 / 0.95); color: var(--accent-press);
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: 15.5px;
  white-space: nowrap;
  background: var(--accent); color: var(--on-accent);
  padding: 14px 18px; border-radius: 14px; width: 100%;
  min-height: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter 0.14s, transform 0.06s, background 0.14s;
  box-shadow: 0 6px 18px var(--accent-tint);
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--accent-press); }
.btn.secondary {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; }
.btn.danger { background: transparent; color: oklch(0.55 0.18 25); border: 1px solid oklch(0.55 0.18 25 / 0.4); box-shadow: none; }
.btn.danger:hover { background: oklch(0.55 0.18 25 / 0.08); }
.btn.small { width: auto; min-height: 42px; padding: 10px 16px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }

/* ---------------------------------------------------------------- Forms */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 7px;
}
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 13px; padding: 13px 15px; min-height: 50px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 88px; resize: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.4; }

.check {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  padding: 13px 15px; border-radius: 13px;
  border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.check.on { border-color: var(--accent); background: var(--accent-tint); }
.check .box {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  border: 2px solid var(--line-strong); display: grid; place-items: center;
  transition: all 0.15s;
}
.check.on .box { background: var(--accent); border-color: var(--accent); }
.check .box svg { width: 13px; height: 13px; opacity: 0; transition: opacity 0.12s; }
.check.on .box svg { opacity: 1; }
.check .ctxt { font-size: 14.5px; font-weight: 600; }

/* segmented tabs (auth + plan toggle) */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 20px;
}
.seg button {
  flex: 1; appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 14.5px;
  background: transparent; color: var(--muted);
  padding: 11px; border-radius: 10px;
  transition: all 0.16s var(--ease);
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* ---------------------------------------------------------------- Notices */
.notice {
  border-radius: 13px; padding: 12px 14px; font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; gap: 10px; align-items: flex-start;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.error { border-color: oklch(0.6 0.18 25 / 0.4); background: oklch(0.6 0.18 25 / 0.08); color: oklch(0.45 0.16 25); }
.notice.ok { border-color: oklch(0.62 0.14 150 / 0.4); background: oklch(0.62 0.14 150 / 0.08); color: oklch(0.42 0.12 150); }

/* ---------------------------------------------------------------- List rows */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 13px;
  padding: 14px;
}
.list .item {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.item .ic {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: var(--accent);
  background: var(--accent-tint);
}
.item .ic svg { width: 19px; height: 19px; }
.item .grow { flex: 1; min-width: 0; }
.item .grow .t { font-weight: 700; font-size: 14.5px; }
.item .grow .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings-style grouped rows */
.group {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card);
}
.group .grow .s { white-space: normal; }
.group .item { border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); }
.group .item:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- Plan card */
.plan {
  border-radius: var(--r-xl); padding: 22px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.plan .price { font-family: var(--font-display); font-weight: 500; font-size: 42px; line-height: 1; letter-spacing: -0.02em; }
.plan .price .per { font-family: var(--font-ui); font-size: 15px; color: var(--muted); font-weight: 600; }
.plan .price .strike { font-size: 18px; color: var(--faint); text-decoration: line-through; margin-left: 8px; vertical-align: middle; }
.plan .feat { list-style: none; margin: 18px 0; padding: 0; }
.plan .feat li { display: flex; align-items: flex-start; gap: 11px; padding: 8px 0; font-size: 14.5px; color: var(--ink-2); }
.plan .feat li .tick {
  width: 21px; height: 21px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent);
}
.plan .feat li .tick svg { width: 12px; height: 12px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-weight: 700; font-size: 12.5px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.status-chip.active { color: oklch(0.5 0.13 150); border-color: oklch(0.62 0.14 150 / 0.45); background: oklch(0.62 0.14 150 / 0.08); }
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.save-badge {
  font-size: 11px; font-weight: 800; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 7px;
  background: oklch(0.62 0.14 150 / 0.14); color: oklch(0.46 0.12 150);
}

/* ---------------------------------------------------------------- Upload */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  padding: 26px 18px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-tint); }
.dropzone .dz-ic {
  width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 12px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent);
}
.dropzone .dz-ic svg { width: 22px; height: 22px; }
.dropzone .dz-title { font-weight: 700; font-size: 14.5px; }
.dropzone .dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--accent-tint); }

.progress-wrap { margin-top: 4px; }
.progress-bar { height: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), oklch(0.62 0.15 320)); transition: width 0.18s var(--ease); }
.progress-pct { font-size: 12.5px; color: var(--muted); margin-top: 7px; display: flex; justify-content: space-between; }

/* ---------------------------------------------------------------- Auth */
.auth {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  padding: 4px 26px calc(34px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
}
.auth::-webkit-scrollbar { display: none; }
.auth-hero { text-align: center; padding: 10px 0 22px; }
.auth-mark {
  width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 18px;
  display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(150deg, var(--accent), oklch(0.62 0.15 320));
  box-shadow: 0 12px 30px var(--accent-tint);
}
.auth-mark svg { width: 30px; height: 30px; }
.auth-hero h1 { font-family: var(--font-display); font-weight: 500; font-size: 27px; letter-spacing: -0.015em; margin: 0 0 6px; }
.auth-hero p { color: var(--muted); font-size: 14.5px; margin: 0; line-height: 1.45; }

/* ---------------------------------------------------------------- Bottom nav */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 8px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 4px;
}
.tabbar-inner {
  flex: 1; display: flex;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 7px;
  box-shadow: var(--shadow-pop);
}
.tabbar button {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 10.5px; font-weight: 600;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 0; border-radius: 15px;
  transition: color 0.16s, background 0.16s;
}
.tabbar button .ic { width: 24px; height: 24px; display: grid; place-items: center; }
.tabbar button .ic svg { width: 23px; height: 23px; }
.tabbar button.active { color: var(--accent); background: var(--accent-tint); }

/* ---------------------------------------------------------------- Viewer (always dark ink) */
.viewer {
  position: absolute; inset: 0; z-index: 60;
  background: oklch(0.13 0.012 268);
  display: flex; flex-direction: column;
  color: oklch(0.96 0.005 80);
  animation: viewer-in 0.28s var(--ease);
}
@keyframes viewer-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.viewer-top {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: calc(max(env(safe-area-inset-top, 0px), 14px) + 12px) 16px 12px;
}
.viewer-back {
  appearance: none; border: 1px solid oklch(1 0 0 / 0.16); cursor: pointer;
  background: oklch(1 0 0 / 0.08); color: #fff;
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 14px 9px 11px; border-radius: 12px;
  backdrop-filter: blur(8px);
}
.viewer-back svg { width: 15px; height: 15px; }
.viewer-shield {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: oklch(0.78 0.07 150);
  padding: 7px 12px; border-radius: 999px;
  background: oklch(0.62 0.14 150 / 0.14); border: 1px solid oklch(0.62 0.14 150 / 0.3);
}
.viewer-shield svg { width: 13px; height: 13px; }
.viewer-fs {
  appearance: none; cursor: pointer; color: #fff;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 13px;
  padding: 8px 13px; border-radius: 12px;
  background: oklch(1 0 0 / 0.08); border: 1px solid oklch(1 0 0 / 0.16);
  backdrop-filter: blur(8px);
}
.viewer-fs svg { width: 16px; height: 16px; }
.viewer-fs:hover { background: oklch(1 0 0 / 0.14); }
/* Quality control overlaid on the player itself (top-right of the video). */
.player-quality { position: absolute; top: 12px; right: 12px; z-index: 8; }
.pq-btn {
  appearance: none; cursor: pointer; color: #fff;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 12.5px;
  padding: 7px 11px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
}
.pq-btn:hover { background: rgba(0, 0, 0, 0.72); }
.pq-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: rgba(18, 18, 24, 0.96); border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px; padding: 5px; min-width: 112px;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
.pq-menu[hidden] { display: none; }
.pq-menu button {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  color: #fff; font: inherit; font-size: 13.5px; font-weight: 600;
  text-align: left; padding: 8px 11px; border-radius: 7px;
}
.pq-menu button:hover { background: rgba(255, 255, 255, 0.12); }

.stage {
  position: relative; background: #000;
  width: 100%; overflow: hidden;
}
/* Fill the space between the header and the meta panel (instead of forcing height
   from width via a fixed aspect-ratio, which on wide screens pushed the player's
   control bar below the fold). The <video> letterboxes inside via object-fit. */
.stage.video { flex: 1; min-height: 0; display: grid; place-items: center; }
/* In fullscreen the stage must fill the screen — neutralise the desktop
   max-width/centering that would otherwise shrink the fullscreen video. */
.stage.video:fullscreen, .stage.video:-webkit-full-screen {
  max-width: none; width: 100%; height: 100%; margin: 0;
}

.doc-scroll { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: none; position: relative; }
.doc-scroll::-webkit-scrollbar { display: none; }

.viewer-meta { flex: none; padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px)); background: oklch(0.15 0.012 268); border-top: 1px solid oklch(1 0 0 / 0.07); }
.viewer-meta.scrolly { overflow-y: auto; }
.viewer-meta h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; margin: 0 0 6px; }
.viewer-meta .vmeta { display: flex; align-items: center; gap: 8px; color: oklch(0.7 0.01 270); font-size: 13px; margin-bottom: 10px; }
.viewer-meta p { color: oklch(0.74 0.01 270); font-size: 14px; line-height: 1.55; margin: 0; }

/* watermark */
.watermark {
  position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  mix-blend-mode: difference;
}
.watermark .wm-row {
  white-space: nowrap; font-family: var(--font-ui);
  font-weight: 700; color: #fff; letter-spacing: 0.1em;
  transform: rotate(-22deg);
  will-change: transform;
}
.watermark.subtle { opacity: 0.1; }
.watermark.subtle .wm-row { font-size: 12px; }
.watermark.prominent { opacity: 0.22; }
.watermark.prominent .wm-row { font-size: 14px; }

/* ---------------------------------------------------------------- Toast */
.toast-host { position: absolute; left: 0; right: 0; bottom: 108px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--bg);
  font-size: 13.5px; font-weight: 600;
  padding: 12px 16px; border-radius: 13px; max-width: 86%;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.24s var(--ease);
}
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Empty state */
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .e-ic { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); border: 1px solid var(--line); }
.empty .e-ic svg { width: 26px; height: 26px; }
.empty .e-t { font-weight: 700; color: var(--ink-2); font-size: 15px; }
.empty .e-s { font-size: 13px; margin-top: 5px; }

/* section heading */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 12px; }
.sec-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.sec-head .count { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- Subscribers (tutor) */
.stat-row { display: flex; gap: 10px; margin-bottom: 18px; }
.stat {
  flex: 1; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 8px; box-shadow: var(--shadow-card);
}
.stat .n { font-family: var(--font-display); font-weight: 600; font-size: 25px; line-height: 1; letter-spacing: -0.01em; }
.stat .l { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.stat.paid .n { color: oklch(0.5 0.13 150); }

.sub-av {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px oklch(0 0 0 / 0.3);
}
.sub-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sub-state { font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); }
.sub-state.paid { color: oklch(0.5 0.13 150); }

/* paid/unpaid toggle */
.switch {
  appearance: none; border: 0; padding: 0; cursor: pointer; flex: none;
  width: 44px; height: 26px; border-radius: 999px; position: relative;
  background: var(--line-strong); transition: background 0.18s var(--ease);
}
.switch.on { background: var(--accent); }
.switch .knob {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px oklch(0 0 0 / 0.3);
  transition: transform 0.18s var(--ease);
}
.switch.on .knob { transform: translateX(18px); }
.switch.busy { opacity: 0.55; cursor: progress; }

/* ---------------------------------------------------------------- Pending payments + badge */
.status-chip.pending {
  color: oklch(0.55 0.13 70);
  border-color: oklch(0.7 0.13 70 / 0.5);
  background: oklch(0.72 0.14 70 / 0.12);
}
.pay-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.pay-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 11px;
}
.pay-top { display: flex; align-items: center; gap: 12px; }
.pay-amount { flex: none; font-weight: 800; font-size: 12.5px; color: var(--accent); white-space: nowrap; }
.pay-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.pay-msg svg { flex: none; margin-top: 2px; color: var(--accent); }
.pay-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* unread-style badge on the Members tab */
.tabbar button .ic { position: relative; }
.tab-badge {
  position: absolute; top: -5px; right: -9px;
  min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; background: oklch(0.62 0.21 25); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}

/* fade-in for screen swaps */
.screen-fade { animation: screen-in 0.26s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===================================================================
   Real-media wiring (additions beyond the prototype's simulated content)
   =================================================================== */

/* real <video> fills the 16:9 stage; watermark overlays it (pointer-events:none) */
.stage.video video {
  position: absolute; top: 0; left: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: contain; background: #000; display: block;
}
.video-unsupported {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; text-align: center; padding: 22px;
  background: rgba(8, 8, 12, 0.94); color: #fff;
}
.video-unsupported svg { color: var(--accent); flex: none; }
.video-unsupported .vu-t { font-weight: 700; font-size: 15px; }
.video-unsupported .vu-s { font-size: 13px; color: rgba(255, 255, 255, 0.82); line-height: 1.55; max-width: 380px; }
.video-unsupported b { color: #fff; font-weight: 700; }

/* real document pages (PDF -> <canvas>, or image) rendered in the doc scroll */
.doc-real-page {
  position: relative; background: #fff; border-radius: 8px; overflow: hidden;
  margin: 0 auto 16px; max-width: 560px;
  box-shadow: 0 8px 30px oklch(0 0 0 / 0.5);
}
.doc-real-page canvas, .doc-real-page img { display: block; width: 100%; height: auto; }

.spinner {
  width: 26px; height: 26px; margin: 44px auto;
  border: 3px solid oklch(1 0 0 / 0.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Install sheet (iOS Add-to-Home-Screen help) */
.install-sheet {
  position: absolute; inset: 0; z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  background: oklch(0.2 0.02 270 / 0.5);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: screen-in 0.2s var(--ease);
}
.install-card {
  width: 100%; max-width: 460px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 22px 22px calc(26px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-pop);
}
.install-card .install-ic {
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 14px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent);
}
.install-card .install-ic svg { width: 23px; height: 23px; }
.install-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em; }
.install-card ol { margin: 0 0 18px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; line-height: 1.75; }
.install-card ol b { color: var(--ink); font-weight: 700; }

/* ---------------------------------------------------------------- Marketplace */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 0 14px; margin-bottom: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.search-bar > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-bar input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); padding: 13px 0; min-height: 50px; outline: none; }
.search-bar input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; appearance: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  transition: all 0.15s var(--ease);
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px var(--accent-tint); }
.chip-static { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.chip-static svg { color: var(--muted); }

.disc-filters { display: flex; gap: 10px; margin-bottom: 18px; }
.select {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 11px 34px 11px 13px; cursor: pointer; min-height: 46px;
  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='%239a9a9a' 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 11px center;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }

.tutor-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.hscroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .tutor-card { flex: none; width: 200px; }
/* Course cards in a horizontal rail (recommended / recently viewed / related). */
.hscroll .course { flex: none; width: 220px; }
/* Keyboard-focusable rail strip: a visible focus ring on the strip itself.
   (Each card is independently tab-focusable + Enter/Space activatable.) */
.hscroll.rail { scroll-snap-type: x proximity; outline: none; border-radius: var(--r-md); }
.hscroll.rail:focus-visible { box-shadow: 0 0 0 3px var(--accent-tint); }
.hscroll.rail > * { scroll-snap-align: start; }
/* Rail skeletons reuse the course-card width so there's no layout jump. */
.hscroll.rail-skel .skel-card { flex: none; width: 220px; }

/* Section heading with an optional subtitle (rail "reason") + right-aligned action. */
.sec-head-main { min-width: 0; }
.sec-head .sec-sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; line-height: 1.35; font-weight: 500; }
.sec-head .sec-action { flex: none; align-self: center; }

/* Related/similar rail block at the foot of a detail page. */
.cp-related:empty { display: none; }
.cp-related { margin-top: 4px; }

.tutor-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-card);
  transition: transform 0.16s var(--ease), box-shadow 0.2s;
}
.tutor-card:active { transform: scale(0.985); }
.tutor-card:hover { box-shadow: var(--shadow-pop); }
.tc-head { position: relative; height: 76px; display: flex; align-items: flex-end; padding: 12px; }
.tc-av {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #fff; background: oklch(1 0 0 / 0.25);
  border: 2px solid oklch(1 0 0 / 0.65); text-shadow: 0 1px 4px oklch(0 0 0 / 0.3);
  transform: translateY(26px); box-shadow: var(--shadow-card);
}
.tc-flag { position: absolute; top: 10px; left: 10px; font-size: 10.5px; font-weight: 800; padding: 4px 9px; border-radius: 999px; background: oklch(0.2 0.02 270 / 0.45); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tc-fav { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: oklch(0.2 0.02 270 / 0.4); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tc-fav svg { width: 17px; height: 17px; }
.tc-fav.on { color: oklch(0.68 0.2 15); }
.tc-fav.on svg { fill: currentColor; }
.tc-body { padding: 32px 14px 14px; }
.tc-name { display: flex; align-items: center; gap: 5px; font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.tc-name .verified { color: var(--accent); flex: none; }
.tc-headline { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.tc-meta { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-meta svg { flex: none; }
.tc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.tc-rating { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.tc-price { font-size: 14.5px; font-weight: 800; color: var(--accent); }
.muted { color: var(--muted); font-weight: 500; }
.stars-inline { display: inline-flex; gap: 1px; vertical-align: -1px; }

/* tutor detail overlay */
.tutor-page { position: absolute; inset: 0; z-index: 55; background: var(--bg); display: flex; flex-direction: column; animation: viewer-in 0.26s var(--ease); }
.tp-top { flex: none; padding: calc(max(env(safe-area-inset-top, 0px), 12px) + 8px) 16px 8px; }
.tp-back { appearance: none; border: 1px solid var(--line-strong); cursor: pointer; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 5px; font: inherit; font-weight: 700; font-size: 14px; padding: 9px 14px 9px 10px; border-radius: 12px; }
.tp-back svg { width: 16px; height: 16px; }
.tp-body { flex: 1; overflow-y: auto; padding: 8px 20px calc(28px + env(safe-area-inset-bottom, 0px)); scrollbar-width: none; }
.tp-body::-webkit-scrollbar { display: none; }
.tp-hero { display: flex; gap: 15px; align-items: center; margin-bottom: 18px; }
.tp-av { width: 76px; height: 76px; border-radius: 22px; flex: none; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px oklch(0 0 0 / 0.3); box-shadow: var(--shadow-card); }
.tp-id { min-width: 0; }
.tp-name { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.015em; }
.tp-name .verified { color: var(--accent); flex: none; }
.tp-headline { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.tp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tp-stats { display: flex; gap: 10px; margin-bottom: 16px; }
.tp-stat { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 6px; box-shadow: var(--shadow-card); }
.tp-stat .n { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.tp-stat .l { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.tp-bio { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin: 0 0 18px; }
.tp-cta { display: flex; gap: 10px; margin-bottom: 8px; }
.tp-fav.on { color: oklch(0.62 0.2 15); border-color: oklch(0.62 0.2 15 / 0.4); }
.tp-fav.on svg { fill: currentColor; }
.course-row.locked .ic { opacity: 0.55; }
.course-row.locked .t { color: var(--muted); }

.rate-row { display: flex; gap: 6px; margin-bottom: 4px; }
.rate-star { appearance: none; border: 0; background: transparent; cursor: pointer; padding: 3px; color: var(--line-strong); transition: color 0.12s; }
.rate-star svg { width: 30px; height: 30px; }
.rate-star:hover { color: oklch(0.72 0.16 75); }
.rate-star.on { color: oklch(0.72 0.16 75); }
.rate-star.on svg { fill: currentColor; }

/* tutor earnings / balance card */
.balance-card {
  border-radius: var(--r-xl); padding: 22px; margin-bottom: 18px;
  color: var(--on-accent);
  background:
    radial-gradient(120% 140% at 0% 0%, oklch(0.6 0.16 320), transparent 55%),
    linear-gradient(120deg, var(--accent), var(--accent-press));
  box-shadow: 0 12px 34px var(--accent-tint);
}
.balance-card .bal-label { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.85; }
.balance-card .bal-amount { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; margin: 6px 0 2px; }
.balance-card .bal-sub { font-size: 13px; opacity: 0.9; }
.balance-card .btn { background: oklch(1 0 0 / 0.96); color: var(--accent-press); box-shadow: none; }
.balance-card .btn:hover { background: #fff; }
.balance-card .btn[disabled] { background: oklch(1 0 0 / 0.16); color: var(--on-accent); opacity: 0.55; cursor: not-allowed; }

/* ===================================================================
   Desktop / wide screens (>= 900px) — a dedicated PC layout.
   -------------------------------------------------------------------
   Phones keep the mobile layout (bottom tab bar, full-bleed) untouched.
   On desktop the app switches to a left sidebar + top bar + centered
   content column, so it's properly laid out in a browser on PC/Mac.
   =================================================================== */
@media (min-width: 900px) {
  .lh-statuspad { display: none; }
  .lh-app {
    width: 100%; height: 100%;
    border: 0; border-radius: 0; box-shadow: none;
  }

  /* Logged-out auth screen: a centered column instead of full-bleed. */
  .auth { max-width: 480px; width: 100%; margin-inline: auto; }

  /* Top bar across the full width. */
  .appbar {
    height: 64px; box-sizing: border-box;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    position: relative; z-index: 46;
  }
  .appbar .brand { font-size: 22px; }

  /* Bottom tab bar -> left sidebar. */
  .tabbar {
    position: fixed; left: 0; right: auto; top: 64px; bottom: 0; width: 240px;
    display: block; padding: 18px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    z-index: 45;
  }
  .tabbar-inner {
    flex-direction: column; align-items: stretch; gap: 4px;
    height: auto; padding: 0;
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tabbar button {
    flex-direction: row; justify-content: flex-start; gap: 13px;
    font-size: 14.5px; font-weight: 600;
    padding: 12px 14px; border-radius: 12px;
  }
  .tabbar button .ic, .tabbar button .ic svg { width: 22px; height: 22px; }

  /* Content column, right of the sidebar, capped for readability. */
  .screen { margin-left: 240px; padding: 30px 36px 48px; }
  .screen > * { max-width: 940px; margin-left: auto; margin-right: auto; }

  /* A roomier catalog grid on desktop. */
  .cardgrid.cols-2 { grid-template-columns: repeat(3, 1fr); }
  .tutor-grid { grid-template-columns: repeat(4, 1fr); }
  .hscroll .tutor-card { width: 220px; }

  /* Centre the tutor detail overlay's content too. */
  .tp-top, .tp-body > * { max-width: 940px; margin-left: auto; margin-right: auto; }
  .tp-body > * { width: 100%; }

  /* Toasts to the bottom-right of the content area. */
  .toast-host { left: auto; right: 28px; bottom: 28px; align-items: flex-end; }

  /* Viewer: center its content in a comfortable column (don't blow the
     video up to the full window width). */
  .viewer-top, .viewer-meta { max-width: 940px; width: 100%; margin-inline: auto; box-sizing: border-box; }
  .stage.video { max-width: 880px; margin-inline: auto; }
  .doc-scroll { max-width: 940px; margin-inline: auto; width: 100%; }
}

/* ===================================================================
   Professionalism pass — accessibility, skeletons, error states,
   inline validation, sharing, and in-app legal/help/about pages.
   =================================================================== */

/* ---------------------------------------------------------------- Focus ring
   A single, consistent, visible keyboard-focus ring for every interactive
   control. Pointer users never see it (:focus-visible); keyboard users always
   do. We deliberately use box-shadow so it follows border-radius. */
:where(
  a, button, input, textarea, select, summary,
  .chip, .seg button, .tabbar button, .tutor-card, .item[role="button"],
  .check, .switch, .tc-fav, .rate-star, .pwd-toggle, .share-btn,
  [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--accent);
  border-radius: 12px;
}
/* Controls that already carry their own focus glow keep it; just make the
   ring crisp and never clipped. */
.field input:focus-visible, .field textarea:focus-visible,
.search-bar input:focus-visible, .select:focus-visible {
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.tabbar button:focus-visible, .tutor-card:focus-visible, .chip:focus-visible,
.check:focus-visible, .tc-fav:focus-visible, .rate-star:focus-visible {
  position: relative; z-index: 1;
}
/* Round controls get a round ring. */
.tc-fav:focus-visible, .switch:focus-visible { border-radius: 999px; }

/* Skip-to-content link for keyboard / screen-reader users. */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 12px; text-decoration: none;
  box-shadow: var(--shadow-pop); transition: top 0.16s var(--ease);
}
.skip-link:focus { top: max(env(safe-area-inset-top, 0px), 12px); }

/* Visually-hidden helper (labels read by SR but not shown). */
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- Skeletons
   Lightweight shimmer placeholders that mirror the real card/list layout so
   there's no jump when content arrives. */
.skel {
  position: relative; overflow: hidden;
  background: var(--surface-2); border-radius: 8px;
}
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, oklch(0.7 0.01 80 / 0.18), transparent);
  animation: skel-shimmer 1.35s var(--ease) infinite;
}
[data-theme="dark"] .skel::after {
  background: linear-gradient(90deg, transparent, oklch(0.8 0.01 270 / 0.1), transparent);
}
@keyframes skel-shimmer { 100% { transform: translateX(100%); } }

.skel-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .skel-grid { grid-template-columns: repeat(4, 1fr); } }
.skel-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card);
}
.skel-card .skel-head { height: 76px; border-radius: 0; }
.skel-card .skel-body { padding: 32px 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.skel-line { height: 11px; border-radius: 6px; }
.skel-line.w-60 { width: 60%; } .skel-line.w-80 { width: 80%; } .skel-line.w-40 { width: 40%; }
.skel-list { display: flex; flex-direction: column; gap: 10px; }
.skel-row {
  display: flex; align-items: center; gap: 13px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
}
.skel-row .skel-ic { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.skel-row .skel-rt { flex: 1; display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- Error/retry
   A failed load must look different from genuinely-empty data. */
.errstate { text-align: center; color: var(--muted); padding: 40px 20px; }
.errstate .er-ic {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  display: grid; place-items: center;
  background: oklch(0.6 0.18 25 / 0.1); color: oklch(0.55 0.16 25);
  border: 1px solid oklch(0.6 0.18 25 / 0.3);
}
.errstate .er-ic svg { width: 26px; height: 26px; }
.errstate .er-t { font-weight: 700; color: var(--ink-2); font-size: 15px; }
.errstate .er-s { font-size: 13px; margin-top: 5px; line-height: 1.45; }
.errstate .btn { width: auto; margin: 16px auto 0; }

/* inline field-level validation message */
.field-err {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12.5px; color: oklch(0.55 0.16 25); font-weight: 600;
  margin-top: 7px; line-height: 1.4;
}
.field-err svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.field input.invalid, .field textarea.invalid { border-color: oklch(0.6 0.18 25 / 0.55); }
/* Non-blocking amber warning (e.g. an upload that may not play on all devices). */
.field-warn {
  display: flex; align-items: flex-start; gap: 7px; margin-top: 8px;
  padding: 9px 11px; border-radius: 10px;
  background: oklch(0.96 0.05 80); color: oklch(0.45 0.09 65);
  font-size: 12.5px; line-height: 1.45; font-weight: 600;
}
.field-warn svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: oklch(0.62 0.13 65); }
.field-warn b { font-weight: 800; }

/* ---------------------------------------------------------------- Password show/hide */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 46px; }
.pwd-toggle {
  position: absolute; top: 0; right: 0; height: 50px; width: 44px;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--muted); border-radius: 0 13px 13px 0;
}
.pwd-toggle:hover { color: var(--ink-2); }
.pwd-toggle svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------- Share button (tutor profile) */
.share-btn {
  appearance: none; cursor: pointer; flex: none;
  width: 50px; min-height: 50px; padding: 0;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 14px;
  transition: background 0.14s, border-color 0.14s;
}
.share-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.share-btn svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------- Your-review card (editable) */
.my-review {
  background: var(--accent-tint); border: 1px solid var(--accent);
  border-radius: var(--r-md); padding: 14px; margin-bottom: 4px;
}
.my-review .mr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.my-review .mr-title { font-weight: 700; font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.my-review .mr-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin-top: 8px; white-space: pre-wrap; }
.my-review .mr-edit {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 13px; color: var(--accent); padding: 4px 6px; border-radius: 8px;
}
.review-form { margin-bottom: 6px; }
.review-form textarea { margin-top: 10px; }
.review-form .rf-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ---------------------------------------------------------------- Doc pages (legal / help / about) */
.doc-page { padding-top: 4px; }
.doc-page .doc-meta {
  font-size: 12.5px; color: var(--muted); margin: 0 0 18px;
  padding: 11px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px dashed var(--line-strong); line-height: 1.5;
}
.doc-page h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  letter-spacing: -0.01em; margin: 24px 0 8px;
}
.doc-page h2:first-of-type { margin-top: 4px; }
.doc-page p, .doc-page li { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.doc-page p { margin: 0 0 12px; }
.doc-page ul { margin: 0 0 14px; padding-left: 20px; }
.doc-page li { margin-bottom: 6px; }
.doc-page a { color: var(--accent); font-weight: 600; }
.doc-page .faq {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow-card);
}
.doc-page .faq .q { font-weight: 700; font-size: 14.5px; color: var(--ink); margin-bottom: 6px; }
.doc-page .faq .a { font-size: 14px; color: var(--ink-2); line-height: 1.6; }

/* small footer link set (Account + auth) */
.foot-links {
  display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center;
  margin: 22px 0 4px; font-size: 12.5px;
}
.foot-links button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--muted); padding: 4px 7px; border-radius: 8px;
}
.foot-links button:hover { color: var(--accent); }
.foot-links .sep { color: var(--faint); align-self: center; }

/* ---------------------------------------------------------------- Reduced motion
   Honour the user's OS preference: kill non-essential animation/transition. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .skel::after { animation: none; }
  .watermark .wm-row { transform: rotate(-22deg) !important; }
}

/* ===================================================================
   Account management + money-records (wave 2)
   Avatars, appbar account button, verify-email banner, editable
   account, purchase history, earnings breakdown, expiry/renewal.
   =================================================================== */

/* ---- Avatar image (fills any sized avatar host: .tc-av/.tp-av/.sub-av/…) ---- */
.av-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
/* When an <img> fails to load we swap in this span (same initials look). */
.av-fallback { width: 100%; height: 100%; display: grid; place-items: center; }
/* Standalone avatar element from avatar(). Inherits the gradient via inline style
   when there's no image; otherwise the image fills it. */
.avatar {
  display: grid; place-items: center; flex: none;
  border-radius: 50%; overflow: hidden;
  font-weight: 800; color: #fff; text-shadow: 0 1px 4px oklch(0 0 0 / 0.3);
}
/* Round avatar hosts must clip their <img>. */
.tc-av, .sub-av { overflow: hidden; }
.tp-av { overflow: hidden; }

/* ---- Appbar account button (avatar + role pill, taps to Account) ---- */
.appbar-acc {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 9px; padding: 2px; border-radius: 999px;
}
.appbar-acc .appbar-av { box-shadow: 0 1px 4px oklch(0 0 0 / 0.16); border: 1.5px solid var(--surface); }

/* ---- Verify-email banner ---- */
.verify-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: oklch(0.72 0.14 70 / 0.1); border: 1px solid oklch(0.7 0.13 70 / 0.4);
  border-radius: var(--r-md); padding: 13px 14px; margin: 0 0 18px;
}
.verify-banner .vb-ic {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: oklch(0.72 0.14 70 / 0.18); color: oklch(0.5 0.13 70);
}
.verify-banner .vb-ic svg { width: 18px; height: 18px; }
.verify-banner .vb-txt { flex: 1; min-width: 0; }
.verify-banner .vb-t { font-weight: 700; font-size: 14px; color: var(--ink); }
.verify-banner .vb-s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.verify-banner .vb-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.verify-banner .vb-close {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
}
.verify-banner .vb-close:hover { background: oklch(0.72 0.14 70 / 0.14); color: var(--ink); }
.verify-banner .vb-close svg { width: 16px; height: 16px; }

/* email-verify result spinner sits on the light auth screen */
.verify-result { text-align: center; padding: 30px 0; }
.verify-result .spinner { border-color: var(--accent-tint); border-top-color: var(--accent); }

/* ---- Forgot-password link under the login password field ---- */
.form-aux { display: flex; justify-content: flex-end; margin-top: 8px; }
.linkbtn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 4px 4px; border-radius: 8px;
}
.linkbtn:hover { text-decoration: underline; }

/* ---- Account header (avatar + identity) ---- */
.acc-head { display: flex; gap: 15px; align-items: center; margin-bottom: 16px; }
.acc-av-wrap { position: relative; flex: none; }
.acc-av { box-shadow: var(--shadow-card); }
.acc-av-edit {
  position: absolute; right: -2px; bottom: -2px;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); border: 2px solid var(--surface);
  box-shadow: var(--shadow-card);
}
.acc-av-edit:hover { background: var(--accent-press); }
.acc-id { min-width: 0; }
.acc-name { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -0.015em; }
.acc-email { font-size: 13.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.acc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }

/* ---- Purchase history (orders) ---- */
.order-row .order-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.order-amount { font-weight: 800; font-size: 14px; color: var(--ink); white-space: nowrap; }

/* ---- Earnings breakdown (per-sale earning) ---- */
.sale-earn { flex: none; font-weight: 800; font-size: 13.5px; color: oklch(0.5 0.13 150); white-space: nowrap; }

/* ---- Enrollment expiry badge on tutor cards ---- */
.tc-expiry {
  position: absolute; bottom: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 999px;
  color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden;
}
.tc-expiry svg { flex: none; }
.tc-expiry.soon { background: oklch(0.55 0.16 60 / 0.92); }
.tc-expiry.expired { background: oklch(0.55 0.2 25 / 0.92); }

/* ===================================================================
   Courses + tiers marketplace (wave 3)
   Course catalog cards, course detail page, per-tutor course rows,
   and the tutor's course-management UI.
   =================================================================== */

/* ---- Course catalog card footer (extends the existing `.course` card) ---- */
.course .body .cfoot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.course .body .cf-rating { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.course .body .cf-price { font-size: 14.5px; font-weight: 800; color: var(--accent); }
.course .body .cf-sub { margin-top: 8px; font-size: 11.5px; }
.course .body .cf-sub svg { flex: none; color: var(--muted); }
.course .body .cmeta .av { overflow: hidden; }
.course .cover .av-img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Course detail page (reuses `.tutor-page` shell via `.course-page`) ---- */
.cp-cover {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-lg);
  overflow: hidden; display: grid; place-items: center; margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.cp-cover .cp-glyph {
  font-family: var(--font-display); font-size: 64px; font-weight: 500;
  color: oklch(1 0 0 / 0.92); text-shadow: 0 2px 18px oklch(0 0 0 / 0.25);
}
.cp-cover-tags { position: absolute; top: 11px; left: 11px; display: flex; gap: 6px; flex-wrap: wrap; }
.cp-title {
  font-family: var(--font-display); font-weight: 500; font-size: 26px;
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 12px; text-wrap: balance;
}
.cp-tutor {
  display: flex; align-items: center; gap: 12px; width: 100%;
  appearance: none; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 13px; margin-bottom: 16px; box-shadow: var(--shadow-card);
  transition: border-color 0.14s, background 0.14s;
}
.cp-tutor:hover { border-color: var(--accent); background: var(--surface-2); }
.cp-tutor-av {
  width: 42px; height: 42px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px oklch(0 0 0 / 0.3);
}
.cp-tutor-id { flex: 1; min-width: 0; }
.cp-tutor-name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.cp-tutor-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Per-tutor course rows + all-access note (on the tutor storefront) ---- */
.tp-allaccess-note {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  margin: 4px 0 0;
}
.tp-allaccess-note svg { flex: none; margin-top: 1px; color: var(--accent); }
.tutor-course-row .course-buy-btn { flex: none; white-space: nowrap; min-width: 64px; }
.tutor-course-row .status-chip { flex: none; }
/* Course label on a lesson row, so students see which course a lesson belongs to. */
.lesson-course-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; margin-right: 7px; border-radius: 999px;
  background: var(--accent-tint); color: var(--accent);
  font-weight: 700; font-size: 11px; vertical-align: middle;
}
.lesson-course-tag svg { width: 11px; height: 11px; flex: none; }

/* ---- Tutor course management (Upload screen) ---- */
.course-manage-row .cm-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.course-manage-row .cm-actions .status-chip { padding: 6px 10px; }
.upload-group { margin-bottom: 4px; }

/* ---- Course create/edit sheet ---- */
.course-editor { max-height: calc(100vh - 60px); overflow-y: auto; scrollbar-width: none; }
.course-editor::-webkit-scrollbar { display: none; }
.course-editor h3 { margin-bottom: 16px; }
.course-editor .ce-row { display: flex; gap: 10px; }
.course-editor .ce-row .field { margin-bottom: 14px; }
.course-editor .field:last-of-type { margin-bottom: 14px; }

/* "New course" button in a sec-head shouldn't stretch full width. */
.sec-head .btn.small { width: auto; flex: none; }

/* ---- Course-catalog skeleton (matches `.course` cards: 16:10 cover) ---- */
.skel-grid.cards { grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .skel-grid.cards { grid-template-columns: repeat(3, 1fr); } }
.skel-course .skel-cover { aspect-ratio: 16 / 10; border-radius: 0; }
.skel-course .skel-body { padding: 12px 14px 16px; }

/* ===================================================================
   Coupons + refunds (wave 3b/4): checkout coupon field, the applied-
   discount summary, the tutor Promotions list, and the refunds inbox.
   =================================================================== */

/* ---- Coupon field in the mobile-money checkout sheet ---- */
.coupon-box { margin-bottom: 12px; }
.coupon-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.coupon-row { display: flex; gap: 8px; align-items: stretch; }
.coupon-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px;
  padding: 12px 14px; min-height: 48px; text-transform: uppercase; letter-spacing: 0.04em;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.coupon-row input::placeholder { text-transform: none; letter-spacing: normal; color: var(--faint); }
.coupon-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.coupon-row .btn.small { flex: none; min-height: 48px; }

/* Applied-coupon summary: original struck through, discounted total, the saving. */
.coupon-applied {
  margin-top: 10px; padding: 11px 13px; border-radius: 12px;
  background: oklch(0.62 0.14 150 / 0.08); border: 1px solid oklch(0.62 0.14 150 / 0.4);
}
.coupon-applied .ca-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.coupon-applied .ca-tag {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 12.5px; font-weight: 700; color: oklch(0.42 0.12 150);
}
.coupon-applied .ca-tag svg { flex: none; }
.coupon-applied .ca-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coupon-applied .ca-remove {
  appearance: none; border: 0; background: transparent; cursor: pointer; flex: none;
  font: inherit; font-weight: 700; font-size: 12.5px; color: var(--muted); padding: 4px 6px; border-radius: 8px;
}
.coupon-applied .ca-remove:hover { color: oklch(0.55 0.16 25); text-decoration: underline; }
.coupon-applied .ca-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
.coupon-applied .ca-was { font-size: 14px; color: var(--faint); text-decoration: line-through; }
.coupon-applied .ca-now { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1; color: var(--ink); letter-spacing: -0.01em; }
.coupon-applied .ca-save { margin-left: auto; font-size: 11.5px; font-weight: 800; color: oklch(0.46 0.12 150); }

/* ---- Tutor Promotions (coupon management) ---- */
.coupon-card .cm-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.coupon-code {
  font-family: var(--font-ui); font-weight: 800; font-size: 14.5px; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 6px;
}
.coupon-code .cc-pill {
  font-size: 11px; font-weight: 800; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 7px;
  background: var(--accent-tint); color: var(--accent);
}
.coupon-card.off { opacity: 0.66; }
.coupon-editor .ce-row { display: flex; gap: 10px; }
.coupon-editor .ce-row .field { flex: 1; }

/* ---- Studio sub-view toggle (Students / Refunds) shares the .seg look ---- */
.studio-seg { margin-bottom: 18px; }

/* ---- Refunds inbox (tutor) + request status (student order rows) ---- */
.refund-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid oklch(0.62 0.18 25);
  border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 11px;
}
.refund-card.resolved { border-left-color: var(--line-strong); }
.refund-top { display: flex; align-items: center; gap: 12px; }
.refund-amount { flex: none; font-weight: 800; font-size: 13px; color: oklch(0.5 0.16 25); white-space: nowrap; }
.refund-reason { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.refund-reason svg { flex: none; margin-top: 2px; color: var(--muted); }
.refund-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.refund-actions .status-chip { margin-right: auto; }
.status-chip.refunded { color: oklch(0.5 0.16 25); border-color: oklch(0.62 0.18 25 / 0.45); background: oklch(0.62 0.18 25 / 0.08); }

/* Refund affordance + status on a student's purchase row. */
.order-row .order-refund {
  appearance: none; cursor: pointer; align-self: flex-end;
  font: inherit; font-weight: 700; font-size: 12px; color: var(--accent);
  background: transparent; border: 0; padding: 4px 4px; border-radius: 8px;
}
.order-row .order-refund:hover { text-decoration: underline; }

/* ===================================================================
   Learning experience (wave 4): curriculum, progress, "continue
   learning", and certificates.
   =================================================================== */

/* ---- Reusable labelled progress bar (extends `.progress-bar`) ---- */
.progress-pct { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.progress-pct span:last-child { color: var(--accent); }

/* ---- Course detail: progress card + certificate banner ---- */
.cp-progress {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; margin: 4px 0 16px; box-shadow: var(--shadow-card);
}
.cp-progress .progress-wrap { margin-top: 0; }
.cp-continue { width: auto; }

/* Certificate "you earned it" banner (course page + 100% progress state). */
.cert-banner {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  background:
    radial-gradient(120% 140% at 100% 0%, oklch(0.72 0.16 75 / 0.16), transparent 60%),
    var(--accent-tint);
  border: 1px solid oklch(0.72 0.16 75 / 0.4); border-radius: var(--r-md);
  padding: 14px; margin: 4px 0 16px;
}
.cert-banner .cert-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: oklch(0.62 0.16 70);
  background: oklch(0.72 0.16 75 / 0.18);
}
.cert-banner .cert-ic svg { width: 24px; height: 24px; }
.cert-banner .cert-txt { flex: 1; min-width: 140px; }
.cert-banner .cert-t { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.cert-banner .cert-s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.cert-banner .btn.small { flex: none; width: auto; }

/* ---- Curriculum: expandable sections + lesson rows w/ completion ticks ---- */
.cp-section {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-card);
  margin-bottom: 10px; overflow: hidden;
}
.cp-section-head {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 13px 14px; list-style: none; user-select: none;
}
.cp-section-head::-webkit-details-marker { display: none; }
.cp-sec-toggle { flex: none; color: var(--muted); transition: transform 0.18s var(--ease); display: grid; place-items: center; }
.cp-section[open] .cp-sec-toggle { transform: rotate(90deg); }
.cp-sec-title { flex: 1; min-width: 0; font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-sec-count { flex: none; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.cp-section .list { padding: 0 10px 10px; }
.cp-section .list .item { box-shadow: none; }

/* Per-lesson completion checkbox + tick (replaces the type icon when owned). */
.lesson-check {
  width: 40px; height: 40px; border-radius: 11px; flex: none; cursor: pointer;
  display: grid; place-items: center; appearance: none;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: transparent;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.lesson-check:hover { border-color: var(--accent); }
.lesson-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lesson-tick { display: grid; place-items: center; width: 100%; height: 100%; color: currentColor; }
.lesson-row.done .t { color: var(--muted); }
.lesson-row .lr-num { color: var(--faint); font-weight: 700; }

/* ---- My Learning: continue-learning course cards ---- */
.learn-list { display: flex; flex-direction: column; gap: 12px; }
.learn-card {
  display: flex; gap: 13px; align-items: stretch; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px; box-shadow: var(--shadow-card);
  transition: transform 0.16s var(--ease), box-shadow 0.2s;
}
.learn-card:active { transform: scale(0.99); }
.learn-card:hover { box-shadow: var(--shadow-pop); }
.learn-cover {
  position: relative; width: 88px; flex: none; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; align-self: stretch; min-height: 88px;
}
.learn-cover .av-img { width: 100%; height: 100%; object-fit: cover; }
.learn-cover .cover-glyph { font-family: var(--font-display); font-size: 32px; font-weight: 500; color: oklch(1 0 0 / 0.92); text-shadow: 0 2px 12px oklch(0 0 0 / 0.25); }
.learn-done-flag {
  position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 9.5px; font-weight: 800; padding: 3px 6px; border-radius: 999px;
  background: oklch(0.55 0.13 150 / 0.92); color: #fff;
}
.learn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.learn-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.learn-tutor { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.learn-tutor svg { flex: none; }
.learn-body .progress-wrap { margin-top: 2px; }
.learn-body .progress-pct { margin-top: 4px; }
.learn-actions { margin-top: auto; display: flex; gap: 8px; }
.learn-actions .btn.small { width: auto; }

/* ---- Viewer: in-player progress controls ("Mark complete & next") ---- */
.viewer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.viewer-actions .btn.small { width: auto; flex: none; }
.viewer-actions .btn.small.ghost { color: oklch(0.78 0.01 270); background: transparent; border: 1px solid oklch(1 0 0 / 0.16); }
.viewer-done {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: oklch(0.78 0.09 150);
  padding: 8px 12px; border-radius: 10px;
  background: oklch(0.62 0.14 150 / 0.16); border: 1px solid oklch(0.62 0.14 150 / 0.3);
}
.viewer-done svg { flex: none; }

/* ===================================================================
   Certificate page (#/certificate/:id) — printable / save-as-PDF
   =================================================================== */
.cert-page .tp-body { padding-top: 8px; }
.certificate {
  position: relative; background: #fffdf7; color: #2a2a30;
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow-pop); margin: 4px 0 16px;
  /* double-rule gilt border */
  border: 2px solid oklch(0.72 0.13 75);
}
.certificate .cert-inner {
  position: relative; text-align: center;
  padding: 34px 26px 30px; margin: 8px;
  border: 1.5px solid oklch(0.78 0.1 75 / 0.7); border-radius: 10px;
  background:
    radial-gradient(120% 80% at 50% -10%, oklch(0.72 0.16 75 / 0.08), transparent 55%);
}
.cert-brand { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; color: oklch(0.4 0.13 285); }
.cert-brand .cert-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: oklch(0.52 0.16 285 / 0.12); color: oklch(0.46 0.16 285); }
.cert-brand .cert-mark svg { width: 18px; height: 18px; }
.cert-brandname { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; color: #2a2a30; }
.cert-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: oklch(0.55 0.13 75); margin-bottom: 18px; }
.cert-present { font-size: 13px; color: #6b6b73; margin: 6px 0; }
.cert-name { font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; color: #1f1f25; margin: 2px 0 6px; }
.cert-course { font-family: var(--font-display); font-weight: 500; font-size: 21px; line-height: 1.25; color: #2a2a30; margin: 2px auto 4px; max-width: 90%; text-wrap: balance; }
.cert-tutor { font-size: 13.5px; color: #6b6b73; margin-bottom: 8px; }
.cert-seal { width: 56px; height: 56px; margin: 14px auto 16px; border-radius: 50%; display: grid; place-items: center; color: oklch(0.6 0.15 70); background: oklch(0.72 0.16 75 / 0.16); border: 1.5px solid oklch(0.7 0.14 75 / 0.5); }
.cert-seal svg { width: 30px; height: 30px; }
.cert-foot { display: flex; justify-content: space-around; gap: 14px; margin-top: 12px; padding-top: 16px; border-top: 1px solid oklch(0.8 0.06 75 / 0.6); }
.cert-foot-col { min-width: 0; }
.cert-foot-v { font-weight: 700; font-size: 13.5px; color: #2a2a30; word-break: break-word; }
.cert-foot-l { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8a8a92; margin-top: 3px; }
.cert-actions { display: flex; gap: 10px; }
.cert-actions .btn { flex: 1; }
.cert-actions .btn.secondary { flex: none; width: auto; }

/* ---- Tutor curriculum editor (sheet) ---- */
.curriculum-editor p { margin-top: 0; }
.cur-newsec { display: flex; gap: 8px; align-items: center; }
.cur-newsec input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 12px; padding: 11px 13px; font: inherit; font-size: 15px; color: var(--ink); outline: none;
}
.cur-newsec input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.cur-newsec .btn.small { flex: none; width: auto; }
.cur-section { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: 10px; margin-bottom: 10px; }
.cur-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cur-sec-title { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 8px; font: inherit; font-weight: 700; font-size: 14.5px; color: var(--ink); outline: none; }
.cur-sec-title:hover { background: var(--surface); }
.cur-sec-title:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint); }
.cur-sec-actions { display: flex; gap: 4px; flex: none; }
.cur-mv {
  width: 32px; height: 32px; border-radius: 9px; flex: none; cursor: pointer; appearance: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  display: grid; place-items: center; transition: border-color 0.14s, color 0.14s;
}
.cur-mv:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.cur-mv[disabled] { opacity: 0.4; cursor: not-allowed; }
.cur-mv.danger:hover:not([disabled]) { border-color: oklch(0.55 0.18 25); color: oklch(0.55 0.18 25); }
.cur-lesson { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; }
.cur-lesson.sub { background: var(--surface); border: 1px solid var(--line); margin-bottom: 6px; }
.cur-lessons { display: flex; flex-direction: column; gap: 6px; }
.cur-lessons .cur-lesson { background: var(--surface); border: 1px solid var(--line); }
.cur-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; color: var(--accent); background: var(--accent-tint); }
.cur-ic svg { width: 17px; height: 17px; }
.cur-grow { flex: 1; min-width: 0; }
.cur-t { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cur-s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cur-assign { flex: none; width: auto; max-width: 130px; min-height: 38px; padding: 7px 28px 7px 10px; font-size: 12.5px; }
.cur-move { display: flex; gap: 4px; flex: none; }
.cur-empty { font-size: 12px; color: var(--muted); padding: 6px 8px; }

/* ===================================================================
   Print: certificate only. Hide app chrome so it saves as a clean PDF.
   =================================================================== */
@media print {
  /* Reveal the whole document column (the app normally clips to 100vh). */
  html, body, #app, .lh-app { height: auto !important; overflow: visible !important; background: #fff !important; }
  .lh-app { display: block !important; }
  /* Hide everything except the certificate overlay + its card. */
  .appbar, .tabbar, .toast-host, .verify-banner, .screen,
  .no-print, .cert-actions, .install-sheet, .viewer { display: none !important; }
  .cert-page { position: static !important; inset: auto !important; background: #fff !important; animation: none !important; }
  .cert-page .tp-body { overflow: visible !important; padding: 0 !important; }
  .certificate { box-shadow: none !important; margin: 0 auto !important; max-width: 760px; page-break-inside: avoid; break-inside: avoid; }
  /* Make the gilt/print colours faithful. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ===================================================================
   Offline downloads (native app). Inert on the web (the controls only
   render when downloadsSupported() is true).
   =================================================================== */
.viewer-dl { margin-top: 12px; }
.viewer-dl .btn { width: 100%; justify-content: center; }

.dl-sheet .dl-card { text-align: left; max-width: 480px; }
.dl-card > .install-ic, .dl-card > h3 { text-align: center; }
.dl-card > h3 { margin-bottom: 2px; }
.dl-sub { color: var(--muted, #6b6b76); font-size: 13px; margin: 0 0 14px; text-align: center; }
.dl-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; margin-bottom: 14px; }
.dl-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, #e7e7ee); border-radius: 12px; }
.dl-rowic { display: inline-flex; color: var(--muted, #6b6b76); flex: none; }
.dl-info { flex: 1; min-width: 0; }
.dl-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-meta { color: var(--muted, #6b6b76); font-size: 12px; }
.dl-row .btn.small { flex: none; }
.dl-row .dl-rm { padding-left: 10px; padding-right: 10px; }
.dl-empty { text-align: center; color: var(--muted, #6b6b76); padding: 18px 8px; font-size: 14px; }
