/* EduSpread — design tokens from the architecture doc (§10) */
:root {
  --primary:      #4F35D8;
  --primary-dark: #3A24B0;
  --on-primary:   #FFFFFF;
  --bg:           #F7F6FB;
  --surface:      #FFFFFF;
  --text:         #1B1830;
  --muted:        #5B5870;
  --border:       #E4E2EE;
  --border-strong:#D4D1E2;
  --skeleton:     #ECEAF4;
  --success:      #0B6B50;
  --thumb:        #E7E2FF;
  --radius-input: 8px;
  --radius-card:  12px;
  --radius-pill:  99px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary:      #8B78FF;
    --primary-dark: #A898FF;
    --on-primary:   #120F24;
    --bg:           #121020;
    --surface:      #1C1930;
    --text:         #EEECF7;
    --muted:        #A9A5C0;
    --border:       #2E2A48;
    --border-strong:#3D3860;
    --skeleton:     #26223D;
    --success:      #5FD3AE;
    --thumb:        #2A2450;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.muted { color: var(--muted); font-size: 15px; }

/* ── Header ─────────────────────────── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { height: 72px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 36px; height: 36px; border-radius: var(--radius-input);
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 18px;
}
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.topnav { display: flex; gap: 24px; font-size: 15px; }
.topnav a { color: var(--text); }
.topnav a:hover { color: var(--primary); }

/* ── Hero ───────────────────────────── */
.hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 72px 0 56px; }
.eyebrow {
  margin: 0 0 16px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary);
}
.hero h1 {
  margin: 0; font-size: clamp(32px, 5vw, 56px); line-height: 1.08;
  font-weight: 600; letter-spacing: -0.03em; max-width: 820px;
}
.lede { margin: 20px 0 0; font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 640px; }

.search { display: flex; gap: 12px; margin-top: 32px; max-width: 720px; }
.search-box {
  flex: 1; height: 56px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  background: var(--surface); color: var(--muted);
  display: flex; align-items: center; gap: 12px;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--text); min-width: 0;
}

.btn {
  white-space: nowrap;
  height: 56px; padding: 0 28px; border: none; border-radius: var(--radius-input);
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: wait; }

/* ── Sections ───────────────────────── */
.section { padding-top: 40px; }
.section h2 { margin: 0 0 16px; font-size: 20px; font-weight: 600; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.link-btn {
  margin-left: auto; background: none; border: none; padding: 8px 0;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--primary); cursor: pointer;
}

/* ── Category chips ─────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  height: 44px; padding: 0 18px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-count { font-weight: 400; opacity: 0.8; }
.chip-skeleton { width: 120px; border: none; background: var(--skeleton); cursor: default; }

/* ── Course grid ────────────────────── */
.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  padding-bottom: 64px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  overflow: hidden; display: flex; flex-direction: column; color: var(--text);
}
.card-skeleton { height: 340px; border: none; background: var(--skeleton); }
.card-thumb {
  aspect-ratio: 16 / 9; background: var(--thumb); position: relative;
  display: flex; align-items: flex-end; padding: 12px;
}
.card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: relative; font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: var(--radius-pill); background: var(--surface); color: var(--text);
}
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.card-meta { font-size: 14px; color: var(--muted); }
.card-price { margin-top: auto; padding-top: 12px; display: flex; align-items: baseline; gap: 8px; }
.price-now { font-size: 20px; font-weight: 600; }
.price-old { font-size: 14px; color: var(--muted); text-decoration: line-through; }
.price-free { font-size: 20px; font-weight: 600; color: var(--success); }

/* ── Empty / error states ───────────── */
.state {
  grid-column: 1 / -1; padding: 48px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-card);
}
.state h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.state p { margin: 0 0 16px; color: var(--muted); }
.state .btn { height: 44px; padding: 0 20px; font-size: 15px; }

/* ── Footer ─────────────────────────── */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: 14px; color: var(--muted); }


/* ── Buttons: extra sizes ───────────── */
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
a.btn { display: inline-flex; align-items: center; justify-content: center; }
a.btn-primary:hover { color: var(--on-primary); }
.topbar-inner .btn-sm { margin-left: auto; }
#auth-slot { margin-left: auto; }
#auth-slot .btn-sm { margin-left: 0; }

/* ── Forms ──────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field label, .reject-box label { font-size: 14px; font-weight: 600; }
.input {
  width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-input);
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); }
.phone-box {
  display: flex; height: 48px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-input); background: var(--surface); overflow: hidden;
}
.phone-box:focus-within { border-color: var(--primary); }
.phone-prefix {
  padding: 0 14px; display: flex; align-items: center; color: var(--muted);
  border-right: 1px solid var(--border); font-size: 16px;
}
.phone-box input { flex: 1; border: none; outline: none; background: transparent; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); min-width: 0; }
.otp-input { letter-spacing: 0.4em; font-size: 20px; text-align: center; }
.alert {
  margin-bottom: 16px; padding: 12px 14px; border-radius: var(--radius-input);
  background: #FDECEC; color: #8A1F1F; font-size: 14px;
}
@media (prefers-color-scheme: dark) { .alert { background: #3A1C24; color: #FFB4B4; } }
.link-btn.inline { margin: 0; padding: 0; font-size: inherit; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.center { text-align: center; }

/* ── Login page ─────────────────────── */
.auth-main { display: flex; justify-content: center; padding: 48px 16px 64px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px;
}
.auth-card h1 { margin: 0 0 24px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.auth-hint { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.auth-hint.center { margin: 16px 0 0; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 24px; background: var(--bg); border-radius: var(--radius-input); }
.tabs button {
  flex: 1; height: 40px; border: none; border-radius: 6px; background: transparent;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ── Account page ───────────────────── */
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 15px; font-weight: 600; }
.pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; background: var(--skeleton); color: var(--text); white-space: nowrap;
}
.pill-ok   { background: #E3F4EC; color: #0B6B50; }
.pill-warn { background: #FFF1E8; color: #8A3412; }
.pill-bad  { background: #FDECEC; color: #8A1F1F; }
@media (prefers-color-scheme: dark) {
  .pill-ok   { background: #173A30; color: #7FE0C0; }
  .pill-warn { background: #3D2A1C; color: #FFC49A; }
  .pill-bad  { background: #3A1C24; color: #FFB4B4; }
}
.account-main { padding-top: 40px; padding-bottom: 64px; }
.page-title { margin: 0 0 24px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.account-section { margin-bottom: 40px; }
.account-section .section-head { margin-bottom: 12px; }
.account-section h2 { margin: 0; font-size: 20px; font-weight: 600; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.list-title { margin: 0; font-size: 16px; font-weight: 600; }
.list-side { font-size: 15px; font-weight: 600; }
.note { font-size: 14px; color: #8A3412; }
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--skeleton); overflow: hidden; margin-top: 6px; max-width: 360px; }
.progress-fill { height: 100%; background: var(--primary); }
.row-actions { display: flex; gap: 8px; }
.reject-box { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; }
.reject-box .btn { align-self: flex-start; }
.reject-box .alert { margin: 0; }
.row-skeleton { height: 72px; border-radius: var(--radius-card); background: var(--skeleton); margin-bottom: 12px; }


/* ── LMS portals ────────────────────── */
body.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-top {
  height: 64px; flex-shrink: 0; padding: 0 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.portal-top .brand-mark { width: 32px; height: 32px; font-size: 16px; }
.portal-top .brand-name { font-size: 18px; }
.portal-name { font-size: 14px; font-weight: 600; color: var(--muted); padding-left: 16px; border-left: 1px solid var(--border); }
.menu-btn {
  display: none; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  background: var(--surface); color: var(--text); align-items: center; justify-content: center; cursor: pointer;
}
.portal-body { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 272px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius-input); color: var(--text);
  display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.3;
}
.side-link svg { color: var(--muted); flex-shrink: 0; }
.side-link:hover { background: var(--bg); color: var(--text); }
.side-link[aria-current="page"] { background: var(--bg); font-weight: 600; color: var(--primary); }
.side-link[aria-current="page"] svg { color: var(--primary); }
.side-soon { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); }
.portal-content { flex: 1; min-width: 0; padding: 32px; max-width: 1080px; }
.portal-content .page-title { margin-bottom: 24px; }

/* Admin panel looks different so you always know where you are */
body.portal-admin .sidebar { background: #1B1830; border-right-color: #1B1830; }
body.portal-admin .side-link { color: #CFCBE3; }
body.portal-admin .side-link svg { color: #8F8AAD; }
body.portal-admin .side-link:hover { background: #2E2A48; color: #FFFFFF; }
body.portal-admin .side-link[aria-current="page"] { background: #2E2A48; color: #FFFFFF; }
body.portal-admin .side-link[aria-current="page"] svg { color: #A898FF; }
body.portal-admin .side-soon { color: #8F8AAD; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 20px; display: flex; flex-direction: column; gap: 6px;
}
.stat-value { font-size: 26px; font-weight: 600; }
.state.soon .pill { margin-bottom: 12px; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.inline-form .btn { height: 48px; }
.account-section > .alert { margin-top: 12px; }
.account-section > p.muted { margin: 0 0 12px; }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .portal-name { display: none; }
  .sidebar {
    position: fixed; top: 64px; left: 0; bottom: 0; height: auto; z-index: 15;
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 12px 32px rgba(0,0,0,0.18); }
  .portal-content { padding: 24px 16px; }
  .portal-top { gap: 10px; padding: 0 12px; }
}
@media (max-width: 480px) {
  .portal-top #user-role { display: none; }
  .portal-top .brand-name { font-size: 16px; }
  .topbar-user { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }


/* ── Course Builder ─────────────────── */
.builder-form, .portal-content .panel { max-width: 880px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.form-grid-unit { grid-template-columns: minmax(120px, 180px) 1fr; }
.field-hint { font-size: 13px; color: var(--muted); }
select.input { appearance: auto; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-card);
}
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice-radio { margin-top: 3px; accent-color: var(--primary); width: 18px; height: 18px; }
.choice-body { display: flex; flex-direction: column; gap: 4px; }
.choice-title { font-weight: 600; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check { width: 20px; height: 20px; accent-color: var(--primary); }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.saved-note { font-size: 14px; color: var(--success); font-weight: 600; }
.alert-list { margin: 8px 0 0; padding-left: 20px; }

.builder-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.builder-title { margin: 0; font-size: 22px; font-weight: 600; }
.builder-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.banner { padding: 14px 16px; border-radius: var(--radius-input); background: var(--skeleton); margin-bottom: 24px; font-size: 15px; }
.banner-info { background: #E3F4EC; color: #0B4F3B; }
.banner-warn { background: #FFF1E8; color: #7A2E0E; }
@media (prefers-color-scheme: dark) {
  .banner-info { background: #173A30; color: #9FE8CF; }
  .banner-warn { background: #3D2A1C; color: #FFC49A; }
}
.checklist { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 24px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check-mark {
  width: 22px; height: 22px; border-radius: 99px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #FFFFFF;
}
.checklist .done .check-mark { background: var(--success); }
.checklist .todo .check-mark { background: #B4461B; }
.checklist .todo { color: var(--text); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 32px; }
.panel > summary, .add-lesson > summary {
  cursor: pointer; padding: 16px 20px; font-weight: 600; list-style-position: inside;
}
.panel-body { padding: 4px 20px 20px; }

.unit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 16px; overflow: hidden; }
.unit-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; background: var(--bg); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.unit-head .list-main { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.unit-label { font-size: 13px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.04em; }
.inline-edit { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.lesson-list { padding: 4px 0; }
.lesson-row { display: flex; align-items: center; gap: 8px; padding: 12px 20px; flex-wrap: wrap; }
.lesson-wrap + .lesson-wrap, .lesson-list > .lesson-row + .lesson-row { border-top: 1px solid var(--border); }
.lesson-title { font-size: 15px; font-weight: 600; }
.lesson-empty { margin: 0; padding: 12px 20px; }
.lesson-edit { border-top: 1px dashed var(--border-strong); background: var(--bg); }
.lesson-edit .panel-body { padding-top: 16px; }
.add-lesson { border-top: 1px solid var(--border); }
.add-lesson > summary { color: var(--primary); padding: 14px 20px; }
.add-unit {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-card);
  padding: 20px; margin-top: 8px;
}
.move-btns { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-input); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; cursor: pointer;
}
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn:not(:disabled):hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 640px) {
  .form-grid-unit { grid-template-columns: 1fr; }
  .unit-head, .lesson-row { padding-left: 16px; padding-right: 16px; }
}

.co-preview { list-style: none; margin: -4px 0 16px; padding: 12px 16px; background: var(--bg); border-radius: var(--radius-input); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.co-preview strong { color: var(--primary); margin-right: 4px; }


/* ── Course Player ──────────────────── */
.portal-content:has(.player) { max-width: 1320px; }
.player-head { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.player-progress { margin-top: 12px; max-width: 420px; }
.player-progress .progress { max-width: none; }
.player-progress-text { font-size: 14px; color: var(--muted); margin-top: 6px; }
.countdown {
  flex-shrink: 0; min-width: 120px; padding: 12px 16px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--border); text-align: center;
  display: flex; flex-direction: column;
}
.countdown-num { font-size: 28px; font-weight: 600; color: var(--primary); line-height: 1.1; }
.countdown-label { font-size: 13px; color: var(--muted); }
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.player-main { min-width: 0; }
.player-crumb { font-size: 13px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.04em; }
.player-title { margin: 6px 0 16px; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.player-video {
  position: relative; aspect-ratio: 16 / 9; background: #0E0C1A; border-radius: var(--radius-card); overflow: hidden;
}
.player-video iframe, .player-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-video-empty { display: flex; align-items: center; justify-content: center; padding: 24px; aspect-ratio: auto; min-height: 140px; }
.player-video-empty p { margin: 0; color: #CFCBE3; text-align: center; }
.player-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.player-actions a[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.player-desc { color: var(--muted); }
.player-notes {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 20px 24px; margin-top: 8px;
}
.player-notes h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.player-notes-body { white-space: pre-wrap; line-height: 1.7; font-size: 15px; }
.player-side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px 0; position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow-y: auto;
}
.player-side-title { margin: 0 16px 8px; font-size: 16px; font-weight: 600; }
.player-unit + .player-unit { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.player-unit-title { padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--muted); }
.player-lessons { list-style: none; margin: 0; padding: 0; }
.player-lesson { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; color: var(--text); font-size: 14px; }
.player-lesson:hover { background: var(--bg); color: var(--text); }
.player-lesson[aria-current="true"] { background: var(--bg); box-shadow: inset 3px 0 0 var(--primary); font-weight: 600; }
.player-lesson-text { display: flex; flex-direction: column; gap: 2px; }
.player-lesson-text .muted { font-size: 12px; font-weight: 400; }
.dot {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 99px; border: 2px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; margin-top: 1px;
}
.dot-done { background: var(--success); border-color: var(--success); color: #FFFFFF; }
@media (max-width: 1080px) {
  .player-layout { grid-template-columns: 1fr; }
  .player-side { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .player-head { flex-direction: column; gap: 12px; }
  .player-title { font-size: 20px; }
}


/* ── Question Bank & Tests ──────────── */
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 24px; }
.tab-link { padding: 12px 16px; font-size: 15px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-link[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 20px; }
.filter-bar .field { margin-bottom: 0; min-width: 200px; }
.filter-bar > .btn { height: 48px; }
.q-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 20px; margin-bottom: 12px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.q-text { margin: 10px 0; font-size: 15px; white-space: pre-wrap; }
.q-options { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; font-size: 14px; }
.q-options li { padding: 6px 10px; border-radius: var(--radius-input); background: var(--bg); }
.q-options li.correct { background: #E3F4EC; color: #0B4F3B; font-weight: 600; }
@media (prefers-color-scheme: dark) { .q-options li.correct { background: #173A30; color: #9FE8CF; } }
.sr-tag { font-weight: 600; }
.q-actions { display: flex; gap: 8px; margin-top: 8px; }
.q-form { max-width: 880px; }
.q-form-title { margin: 0; padding: 16px 20px 0; font-size: 17px; font-weight: 600; }
.hi-box { margin-bottom: 16px; }
.hi-box > summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 14px; padding: 4px 0 12px; }
.field-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.opt-box { margin-bottom: 16px; }
.opt-row { display: grid; grid-template-columns: 24px 24px minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.opt-key { font-weight: 600; color: var(--primary); text-align: center; }
.units-box { border: 1px solid var(--border); border-radius: var(--radius-input); padding: 8px 16px 12px; margin: 0 0 16px; }
.units-box legend { font-size: 14px; font-weight: 600; padding: 0 6px; }
.test-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.test-title { margin: 0; font-size: 19px; font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-x { border: none; background: none; font: inherit; font-size: 16px; line-height: 1; margin-left: 6px; cursor: pointer; color: var(--muted); padding: 0 2px; }
.tq-row { gap: 10px; }
.input-sm { height: 40px; width: auto; min-width: 140px; font-size: 14px; }
.input-marks { width: 80px; min-width: 80px; }
.bank-pick { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-input); padding: 4px; }
.bank-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-input); cursor: pointer; }
.bank-item:hover { background: var(--bg); }
.bank-item .check { margin-top: 2px; flex-shrink: 0; }
@media (max-width: 640px) {
  .opt-row { grid-template-columns: 20px 24px 1fr; }
  .opt-row input[lang="hi"] { grid-column: 3; }
  .filter-bar .field { min-width: 100%; }
}

/* ── Notice Board ───────────────────── */
.notice-form { max-width: 880px; margin-bottom: 32px; }
.notice-form-title { padding: 0 0 12px; }
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 20px; margin-bottom: 12px; }
.notice-pinned { border-color: #F2C9A8; }
.notice-title { margin: 8px 0 4px; font-size: 17px; font-weight: 600; }
.notice-body { margin: 0; white-space: pre-wrap; line-height: 1.6; color: var(--text); }

/* ── Admin: educators + users ───────── */
.person-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 20px; margin-bottom: 12px; }
.person-top { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.person-stats { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 12px 0 4px; }
.person-stats div { display: flex; flex-direction: column; font-size: 14px; }
.person-stats strong { font-size: 16px; }
.person-manage { margin-top: 8px; border-top: 1px solid var(--border); }
.person-manage > summary { cursor: pointer; padding: 12px 0 4px; font-weight: 600; color: var(--primary); }
.person-manage .panel-body { padding: 12px 0 0; }
.reset-form { padding-top: 12px; margin-top: 8px; border-top: 1px dashed var(--border-strong); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.strong-cell { font-weight: 600; }

/* ── Doubts ─────────────────────────── */
.doubt-row { color: var(--text); }
.doubt-row:hover { background: var(--bg); color: var(--text); }
.thread { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 20px; max-width: 880px; }
.bubble { padding: 12px 16px; border-radius: var(--radius-card); border: 1px solid var(--border); max-width: 88%; }
.bubble-student { align-self: flex-start; background: var(--surface); }
.bubble-teacher { align-self: flex-end; background: #EFECFF; border-color: #DCD6FF; }
@media (prefers-color-scheme: dark) { .bubble-teacher { background: #2A2450; border-color: #3D3860; } }
.bubble-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bubble-body { white-space: pre-wrap; line-height: 1.6; }
.rate-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); max-width: 880px; }
.reply-form { max-width: 880px; }

/* ── Mobile (375px) ─────────────────── */
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .topnav { display: none; }
  .hero { padding: 40px 0 32px; }
  .lede { font-size: 16px; }
  .search { flex-direction: column; }
  .search-box { flex: none; }
  .search .btn { width: 100%; }
  .auth-card { padding: 24px 20px; }
  .user-name { display: none; }
  .grid { grid-template-columns: 1fr; }
}
