/* ═══════════════════════════════════════════════════
   DESIGN TOKENS — Clean Minimal / White-Grey
═══════════════════════════════════════════════════ */
:root {
  --white:       #ffffff;
  --bg:          #f7f7f5;
  --bg-card:     #ffffff;
  --bg-subtle:   #f2f2f0;
  --border:      #e8e8e4;
  --border-mid:  #d4d4ce;
  --text-primary:#1a1a18;
  --text-secondary:#6b6b64;
  --text-tertiary:#9b9b90;
  --accent:      #2563eb;
  --accent-light:#eff4ff;
  --accent-mid:  #bdd0ff;
  --green:       #16a34a;
  --green-light: #f0fdf4;
  --green-mid:   #bbf7d0;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --amber:       #d97706;
  --amber-light: #fffbeb;
  --purple:      #7c3aed;
  --purple-light:#f5f3ff;
  --grey:        #57534e;
  --grey-light:  #f4f4f2;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 12px rgba(0,0,0,.07),0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.10),0 4px 8px rgba(0,0,0,.05);
  --font:        'Times New Roman', Times, serif;
  --font-mono:   'DM Mono', monospace;
  --sidebar-w:   230px;
  --topbar-h:    56px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); min-height: 100vh; line-height: 1.5; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── SCREENS ── */
.screen { display: none !important; }
.screen.active { display: block !important; }
#screen-login.active, #screen-student.active { display: flex !important; }
#screen-quiz.active { display: flex !important; flex-direction: column; }
#screen-result.active { display: flex !important; flex-direction: column; align-items: center; }
#screen-dashboard.active { display: flex !important; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  background: var(--bg);
  flex-direction: column;
  align-items: stretch;
}
/* header */
/* ── Login screen: split panel ── */
:root {
  --login-blue-900: #2e4fc4;
  --login-blue-700: #3b5fe0;
  --login-blue-500: #6fa8f5;
  --login-text-dark:     #ffffff;
  --login-text-dark-dim: rgba(255,255,255,.82);
  --login-text-dark-dimmer: rgba(255,255,255,.65);
  --login-chip-bg: rgba(255,255,255,.15);
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.login-brand-panel {
  flex: 0 0 44%;
  min-width: 380px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.25rem;
  background: linear-gradient(160deg, var(--login-blue-900) 0%, var(--login-blue-700) 45%, var(--login-blue-500) 100%);
  color: var(--login-text-dark);
}
.login-brand-panel::before,
.login-brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}
.login-brand-panel::before { width: 260px; height: 260px; top: -90px; right: -90px; }
.login-brand-panel::after { width: 320px; height: 320px; bottom: -140px; left: -100px; background: rgba(255,255,255,.07); }
.login-brand-top { position: relative; z-index: 1; display: flex; flex-direction: column; gap: .8rem; }
.login-brand-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--login-chip-bg);
  display: flex; align-items: center; justify-content: center;
}
.login-brand-mark {
  font-size: .8rem; font-weight: 700; letter-spacing: .16em;
  color: var(--login-text-dark-dim);
}
.login-brand-mid { max-width: 420px; position: relative; z-index: 1; }
.login-headline {
  font-family: var(--font);
  font-size: 2.5rem; font-weight: 700; line-height: 1.14;
  letter-spacing: -.01em;
  color: var(--login-text-dark);
  margin-bottom: 1.4rem;
}
.login-feature-list { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.5rem; }
.login-feature-item { display: flex; align-items: center; gap: .65rem; }
.login-feature-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--login-chip-bg);
  display: flex; align-items: center; justify-content: center;
}
.login-feature-text { font-size: .85rem; color: var(--login-text-dark-dim); }
.login-brand-tagline {
  font-size: .8rem; line-height: 1.6; max-width: 340px;
  color: var(--login-text-dark-dimmer);
  position: relative; z-index: 1;
}
.login-form-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.5rem;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}
.login-brand { margin-bottom: 1.75rem; }
.login-brand-name { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.5px; }
.login-brand-tag { font-size: .82rem; color: var(--text-tertiary); margin-top: 6px; }
.login-footer { text-align: center; font-size: .72rem; color: var(--text-tertiary); margin-top: 1.5rem; }
.login-footer strong { color: var(--text-secondary); font-weight: 600; }

@media (max-width: 860px) {
  .login-brand-panel { flex: 0 0 36%; min-width: 0; padding: 2rem 1.75rem; }
  .login-headline { font-size: 1.9rem; }
  .login-feature-text { font-size: .78rem; }
  .login-brand-tagline { display: none; }
  .login-form-panel { padding: 2.5rem 1.5rem; }
}
@media (max-width: 620px) {
  .login-wrap { flex-direction: column; }
  .login-brand-panel {
    flex: 0 0 auto; min-width: 0; padding: 1.75rem 1.5rem;
  }
  .login-brand-panel::before { width: 160px; height: 160px; top: -60px; right: -60px; }
  .login-brand-panel::after { display: none; }
  .login-brand-mid { max-width: none; }
  .login-headline { font-size: 1.5rem; margin-bottom: .9rem; }
  .login-feature-list { display: none; }
  .login-brand-tagline { display: block; font-size: .78rem; max-width: none; }
  .login-form-panel { padding: 2rem 1.25rem 2.5rem; }
  .login-card { padding: 1.75rem 1.5rem 1.5rem; max-width: 100%; }
}
@media (max-width: 380px) {
  .pw-input-wrap { padding: 0 10px; }
  .pw-input-divider { margin: 0 8px; }
  .pw-input { font-size: .85rem; }
}

/* login forms below cards */
.login-form-wrap {
  width: 100%;
  max-width: 100%;
}



.pin-area { margin-bottom: 1.2rem; }
.pin-label { font-size: .78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .7rem; }
.pin-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 1rem; }
.pin-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--white); transition: background .15s; }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.pin-key {
  padding: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: .95rem; font-weight: 600; color: var(--text-primary);
  transition: all .1s;
}
.pin-key:hover { background: var(--bg); border-color: var(--border-mid); }
.pin-key:active { transform: scale(.94); }
.pin-submit { background: var(--accent); color: var(--white); border-color: var(--accent); }
.pin-submit:hover { background: #1d4ed8; }
.pin-clear { color: var(--text-secondary); }

.login-error { font-size: .78rem; color: var(--red); font-weight: 600; min-height: 18px; margin-top: .5rem; text-align: center; }

.pw-section { display: flex; flex-direction: column; gap: 1.1rem; }
.pw-field { display: flex; flex-direction: column; gap: .35rem; }
.pw-label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.pw-input-wrap {
  display: flex; align-items: center;
  background: var(--white);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 0 14px;
  height: 46px;
  transition: box-shadow .15s;
}
.pw-input-wrap:focus-within { box-shadow: 0 2px 10px rgba(37,99,235,.22); }
.pw-input-icon { display: flex; align-items: center; color: var(--text-tertiary); flex-shrink: 0; }
.pw-input-divider { width: 1px; height: 20px; background: var(--border); margin: 0 12px; flex-shrink: 0; }
.pw-input-eye { display: flex; align-items: center; color: var(--text-tertiary); cursor: pointer; flex-shrink: 0; background: none; border: none; padding: 0; }
.pw-input {
  border: none;
  outline: none;
  font-size: .92rem;
  background: transparent;
  width: 100%;
  height: 100%;
  padding: 0;
}
.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--login-blue-700), var(--login-blue-500));
  color: var(--white);
  border: none; border-radius: 999px;
  font-size: .95rem; font-weight: 700;
  transition: opacity .15s; margin-top: .25rem;
}
.btn-login:hover { opacity: .92; }
.btn-login:disabled { background: var(--border-mid); cursor: not-allowed; }

/* ═══════════════════════════════════════════════════
   STUDENT TEST SCREEN
═══════════════════════════════════════════════════ */
#screen-student {
  min-height: 100vh;
  background: var(--bg);
  flex-direction: column;
  align-items: stretch;
}
/* ── Student home ── */
/* ── Student identity bar ── */
/* ══════════════════════════════════════════
   STUDENT HOME v2
══════════════════════════════════════════ */
.stu-home-v2 {
  display: flex; flex-direction: column;
  min-height: 100vh; background: var(--bg, #f5f5f5);
}
/* Top bar */
.stu-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; background: #185fa5; color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.stu-top-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.stu-top-info { flex: 1; min-width: 0; }
.stu-top-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stu-top-meta { font-size: .7rem; opacity: .78; margin-top: 1px; }
.stu-top-btn {
  background: rgba(255,255,255,.15); border: 0.5px solid rgba(255,255,255,.3);
  color: #fff; border-radius: 8px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.stu-top-btn:hover { background: rgba(255,255,255,.28); }
/* Hero */
.stu-hero {
  background: #185fa5; padding: 12px 16px 0; text-align: center;
}
.stu-hero-school { font-size: 1.05rem; font-weight: 700; color: #fff; }
.stu-hero-sub { font-size: .62rem; letter-spacing: 1.3px; color: rgba(255,255,255,.6); margin-top: 2px; text-transform: uppercase; }
.stu-hero-wave { display: block; width: 100%; height: 28px; margin-top: 14px; }
/* Body */
.stu-body { padding: 0 14px 24px; }
.stu-section-label {
  font-size: .67rem; font-weight: 700; letter-spacing: .9px;
  color: var(--text-tertiary, #888); text-transform: uppercase;
  margin: 18px 0 9px;
}
/* Action grid */
.stu-action-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px;
}
.stu-action-card {
  background: var(--white, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column;
  gap: 7px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.stu-action-card:hover { border-color: #185fa5; box-shadow: 0 2px 10px rgba(24,95,165,.1); }
.stu-ac-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stu-ac-title { font-size: .84rem; font-weight: 700; color: var(--text-primary, #111); }
.stu-ac-desc { font-size: .7rem; color: var(--text-secondary, #555); line-height: 1.45; }
.stu-ac-arrow { font-size: .7rem; color: var(--text-tertiary, #aaa); align-self: flex-end; margin-top: auto; }
/* Stats */
.stu-stat-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.stu-stat-card {
  background: var(--bg-secondary, #f0f4f8); border-radius: 10px; padding: 13px 14px;
}
.stu-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--text-primary, #111); }
.stu-stat-lbl { font-size: .68rem; color: var(--text-secondary, #666); margin-top: 2px; }
/* Diary / notif card */
.stu-notif-card {
  background: var(--white, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; overflow: hidden;
}
.stu-notif-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.stu-notif-card-title { font-size: .85rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.stu-notif-badge {
  background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 99px; min-width: 20px; text-align: center;
  display: none;
}
.stu-notif-list { max-height: 260px; overflow-y: auto; }
.stu-notif-item {
  padding: 12px 18px; border-bottom: 1px solid var(--bg-subtle);
  display: flex; gap: 12px; align-items: flex-start;
}
.stu-notif-item:last-child { border-bottom: none; }
.stu-notif-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
  background: #3b82f6;
}
.stu-notif-dot.warn  { background: #f59e0b; }
.stu-notif-dot.alert { background: #ef4444; }
.stu-notif-dot.ok    { background: #10b981; }
.stu-notif-body { flex: 1; }
.stu-notif-item-title { font-size: .82rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.stu-notif-item-body  { font-size: .78rem; color: var(--text-secondary); line-height: 1.5; }
.stu-notif-item-time  { font-size: .68rem; color: var(--text-tertiary); margin-top: 4px; }
.stu-notif-empty { padding: 20px 18px; font-size: .8rem; color: var(--text-tertiary); text-align: center; }
.stu-fab {
  position: fixed; bottom: 1.4rem; right: 1.2rem; z-index: 999;
  background: #185fa5; color: #fff; border: none;
  border-radius: 50px; padding: 12px 20px;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 18px rgba(24,95,165,.35);
  transition: background .15s, box-shadow .15s;
}
.stu-fab:hover { background: #1350a0; box-shadow: 0 6px 22px rgba(24,95,165,.45); }
/* ── Study pane ── */
.stu-learn-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: var(--white);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.stu-back-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 14px;
  font-size: .82rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.stu-back-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.stu-learn-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.stu-learn-body { flex: 1; padding: 24px 28px; overflow-y: auto; }
.stu-learn-filters { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stu-learn-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; color: var(--text-tertiary); font-size: .9rem; text-align: center; }
/* book/chapter cards */
.stu-book-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 14px; overflow: hidden; }
.stu-book-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; transition: background .12s; }
.stu-book-header:hover { background: var(--bg-subtle); }
.stu-book-icon { width: 38px; height: 38px; background: var(--accent-light); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stu-book-name { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.stu-book-meta { font-size: .72rem; color: var(--text-secondary); margin-top: 2px; }
.stu-book-chevron { margin-left: auto; color: var(--text-tertiary); transition: transform .2s; }
.stu-book-chevron.open { transform: rotate(90deg); }
.stu-chapters { border-top: 1px solid var(--border); display: none; }
.stu-chapters.open { display: block; }
.stu-chapter-row { padding: 10px 16px 10px 52px; border-bottom: 1px solid var(--bg-subtle); }
.stu-chapter-row:last-child { border-bottom: none; }
.stu-chapter-title { font-size: .82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
/* Classes panel — subjects & chapters */
.class-subjects-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.subject-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.subject-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none; transition: background .12s; }
.subject-row:hover { background: var(--bg-subtle); }
.subject-row .subject-chevron { color: var(--text-tertiary); font-size: .7rem; transition: transform .2s; flex-shrink: 0; }
.subject-row.open .subject-chevron { transform: rotate(90deg); }
.subject-name { flex: 1; font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.subject-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chapter-list { display: none; border-top: 1px solid var(--border); background: var(--white); padding: 6px 0 8px; }
.chapter-list.open { display: block; }
.chapter-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 12px 6px 28px; font-size: .78rem; }
.chapter-item:hover { background: var(--bg-subtle); }
.chapter-item-body { flex: 1; min-width: 0; }
.chapter-item-title { font-weight: 600; color: var(--text-primary); }
.chapter-item-desc { font-size: .72rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.chapter-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.chapter-item-actions button { background: none; border: none; cursor: pointer; padding: 2px 6px; font-size: .85rem; border-radius: 4px; }
.chapter-item-actions button:hover { background: var(--bg); }
#cl-chapter-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; align-items: center; justify-content: center; }
#cl-chapter-overlay.open { display: flex; }
.stu-lessons { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.stu-lesson-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); cursor: pointer; transition: border-color .12s; }
.stu-lesson-item:hover { border-color: var(--accent); background: var(--accent-light); }
.stu-lesson-icon { width: 28px; height: 28px; background: var(--accent-light); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.stu-lesson-title { font-size: .8rem; font-weight: 600; flex: 1; }
.stu-lesson-type { font-size: .68rem; color: var(--text-tertiary); }
.stu-video-embed { margin-top: 8px; border-radius: 8px; overflow: hidden; position: relative; padding-top: 56.25%; background: #000; }
.stu-video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.stu-text-content { margin-top: 8px; padding: 12px 14px; background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); font-size: .82rem; line-height: 1.8; color: var(--text-primary); max-height: 300px; overflow-y: auto; }

/* ── Student Class Cards Grid ── */
.stu-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; padding: 4px 0 20px; }
.stu-class-card { background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 20px 12px 16px; text-align: center; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .12s; user-select: none; }
.stu-class-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.stu-class-card.active { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-mid); }
.stu-class-card-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.stu-class-card.active .stu-class-card-icon { background: var(--accent); color: var(--white); }
.stu-class-card-name { font-size: .82rem; font-weight: 700; color: var(--text-primary); }

/* ── Subject Tabs ── */
.stu-subject-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.stu-subject-tab { padding: 6px 16px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--white); font-size: .78rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all .12s; }
.stu-subject-tab:hover { border-color: var(--accent); color: var(--accent); }
.stu-subject-tab.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Breadcrumb ── */
.stu-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text-tertiary); margin-bottom: 16px; flex-wrap: wrap; }
.stu-breadcrumb span { cursor: pointer; }
.stu-breadcrumb span:hover { color: var(--accent); text-decoration: underline; }
.stu-breadcrumb .sep { color: var(--border-mid); }
.stu-breadcrumb .current { color: var(--text-primary); font-weight: 600; cursor: default; }
.stu-breadcrumb .current:hover { text-decoration: none; color: var(--text-primary); }

/* ── Chapter content (HTML render area) ── */
.stu-chapter-content { margin: 8px 0 12px; padding: 16px; background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); line-height: 1.8; color: var(--text-primary); overflow-x: auto; }
.stu-chapter-content.hidden { display: none; }
.stu-chapter-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--accent); padding: 4px 0; user-select: none; }
.stu-chapter-toggle svg { transition: transform .2s; }
.stu-chapter-toggle.open svg { transform: rotate(90deg); }
.stu-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.2rem 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
}
.stu-top { text-align: center; margin-bottom: 1.6rem; }
.stu-icon { font-size: 2.2rem; margin-bottom: .5rem; display: block; }
.stu-title { font-size: 1.15rem; font-weight: 700; margin-bottom: .25rem; }
.stu-sub { font-size: .8rem; color: var(--text-secondary); line-height: 1.6; }
.session-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .8rem; font-weight: 600; color: var(--accent);
  margin-bottom: 1rem;
}
.no-session-banner {
  background: var(--amber-light);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .8rem; font-weight: 600; color: var(--amber);
  text-align: center; margin-bottom: 1rem;
}
.roll-input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem; font-weight: 600;
  outline: none; transition: border-color .15s;
  margin-bottom: 10px;
}
.roll-input:focus { border-color: var(--accent); }
.btn-start {
  width: 100%; padding: 12px;
  background: var(--text-primary); color: var(--white);
  border: none; border-radius: var(--radius);
  font-size: .9rem; font-weight: 700;
  transition: opacity .15s;
}
.btn-start:hover { opacity: .85; }
.stu-error { font-size: .78rem; color: var(--red); font-weight: 600; min-height: 18px; text-align: center; }

/* ═══════════════════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════════════════ */
#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(247,247,245,.95);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
}
.load-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin-bottom: 1.2rem;
}
.load-text { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: .3rem; }
.load-sub { font-size: .78rem; color: var(--text-secondary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════
   QUIZ SCREEN
═══════════════════════════════════════════════════ */
#screen-quiz { min-height: 100vh; background: var(--bg); }

.quiz-topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
}
.qtb-left { display: flex; align-items: center; gap: .8rem; }
.qtb-school { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.qtb-divider { width: 1px; height: 16px; background: var(--border); }
.qtb-student { font-size: .85rem; font-weight: 700; }
.qtb-roll { font-size: .72rem; color: var(--text-tertiary); }
.qtb-right { display: flex; align-items: center; gap: 1rem; }
.timer {
  font-family: var(--font-mono);
  font-size: .88rem; font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px; color: var(--text-primary);
}
.timer.urgent { background: var(--red-light); border-color: #fca5a5; color: var(--red); }
.q-counter { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.quiz-progress { height: 3px; background: var(--border); }
.quiz-progress-fill { height: 100%; background: var(--accent); transition: width .4s; }

.quiz-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.q-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 620px; width: 100%;
  box-shadow: var(--shadow);
}
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.q-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .5px;
  background: var(--accent-light); color: var(--accent);
  padding: 3px 10px; border-radius: 20px;
}
.q-subject-tag { font-size: .72rem; color: var(--text-tertiary); font-weight: 500; }
.q-text { font-size: 1rem; font-weight: 600; color: var(--text-primary); line-height: 1.65; margin-bottom: 1.4rem; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: .88rem; font-weight: 500;
  text-align: left; width: 100%;
  transition: all .15s; color: var(--text-primary);
}
.choice:hover { background: var(--bg); border-color: var(--border-mid); }
.choice.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.choice.correct { border-color: var(--green); background: var(--green-light); color: var(--green); }
.choice.wrong { border-color: var(--red); background: var(--red-light); color: var(--red); }
.choice-letter {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; color: var(--text-secondary);
}
.choice.selected .choice-letter { background: var(--accent); border-color: var(--accent); color: var(--white); }
.choice.correct .choice-letter { background: var(--green); border-color: var(--green); color: var(--white); }
.choice.wrong .choice-letter { background: var(--red); border-color: var(--red); color: var(--white); }

.hint-bar { display: flex; align-items: flex-start; gap: 8px; background: var(--amber-light); border-radius: var(--radius); padding: 9px 12px; margin-top: 1rem; font-size: .8rem; color: var(--amber); }
.exp-bar { background: var(--green-light); border-radius: var(--radius); padding: 9px 12px; margin-top: .8rem; font-size: .8rem; color: #166534; line-height: 1.6; }
.q-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 1.4rem; }
.btn-hint { background: none; border: 1.5px solid var(--border); border-radius: 20px; padding: 7px 16px; font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.btn-hint:hover { border-color: var(--border-mid); background: var(--bg); }
.btn-next { background: var(--text-primary); color: var(--white); border: none; border-radius: 20px; padding: 9px 22px; font-size: .82rem; font-weight: 700; transition: opacity .15s; }
.btn-next:hover { opacity: .8; }

/* ═══════════════════════════════════════════════════
   RESULT SCREEN
═══════════════════════════════════════════════════ */
#screen-result { min-height: 100vh; background: var(--bg); }
.result-bar {
  width: 100%; background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  flex-shrink: 0;
}
.result-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 2rem 1.5rem;
  overflow-y: auto; max-width: 580px; width: 100%;
  margin: 0 auto;
}
.result-ring-wrap { position: relative; width: 130px; height: 130px; margin: 0 auto 1.5rem; }
.result-ring-wrap svg { width: 130px; height: 130px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 9; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 283; stroke-dashoffset: 283; transition: stroke-dashoffset 1s ease; }
.ring-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.ring-pct { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.ring-grade { font-size: .9rem; font-weight: 700; color: var(--accent); }
.result-name { font-size: 1.1rem; font-weight: 700; margin-bottom: .2rem; }
.result-roll { font-size: .75rem; color: var(--text-secondary); margin-bottom: 1.2rem; }
.result-stats { display: flex; gap: 10px; margin-bottom: 1.2rem; width: 100%; }
.rs { flex: 1; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.rs-n { font-size: 1.4rem; font-weight: 800; }
.rs-l { font-size: .7rem; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.rs.green .rs-n { color: var(--green); }
.rs.red .rs-n { color: var(--red); }
.rs.blue .rs-n { color: var(--accent); }
.result-msg { font-size: .85rem; color: var(--text-secondary); text-align: center; margin-bottom: 1.5rem; }
.review-item {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
  font-size: .8rem; width: 100%;
}
.ri-q { font-weight: 600; margin-bottom: 4px; }
.ri-ok { color: var(--green); font-weight: 700; }
.ri-bad { color: var(--red); font-weight: 700; }
.btn-again {
  width: 100%; padding: 12px;
  background: var(--text-primary); color: var(--white);
  border: none; border-radius: var(--radius);
  font-size: .9rem; font-weight: 700; margin-top: 1rem;
  transition: opacity .15s;
}
.btn-again:hover { opacity: .8; }

/* ═══════════════════════════════════════════════════
   PENDING SCREEN
═══════════════════════════════════════════════════ */
#screen-pending { min-height: 100vh; background: var(--bg); align-items: center; justify-content: center; }
#screen-pending.active { display: flex !important; }
.pending-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2.5rem; max-width: 340px; width: 90%; text-align: center; }
.pending-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .6rem; }
.pending-card p { font-size: .82rem; color: var(--text-secondary); line-height: 1.6; }

/* ═══════════════════════════════════════════════════
   DASHBOARD SHELL
═══════════════════════════════════════════════════ */
#screen-dashboard { min-height: 100vh; }
.dash-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #F1F5FD;
  border-right: 1px solid #DCE7FA;
  display: flex; flex-direction: column;
  min-height: 100vh; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
  transition: width .18s ease;
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin: .7rem 0 0 .9rem;
  background: var(--white); border: 1px solid #DCE7FA;
  border-radius: 6px; color: var(--text-tertiary); cursor: pointer;
  transition: all .15s; flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--white); color: var(--text-primary); border-color: #B8CCF2; }
.dash-sidebar.collapsed .sidebar-collapse-btn { margin-left: 0; align-self: center; }

/* Collapsed state — icon-only rail */
.dash-sidebar.collapsed { width: 64px; }
.dash-sidebar.collapsed .sidebar-logo { padding: 1rem .5rem 1rem; display: flex; flex-direction: column; align-items: center; }
.dash-sidebar.collapsed .sidebar-school,
.dash-sidebar.collapsed .sidebar-city,
.dash-sidebar.collapsed .nav-section-label,
.dash-sidebar.collapsed .nav-item span:not(.nav-icon),
.dash-sidebar.collapsed .nav-badge,
.dash-sidebar.collapsed .sidebar-role { display: none; }
.dash-sidebar.collapsed .sidebar-emblem { margin-bottom: 0; }
.dash-sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; border-left: none; }
.dash-sidebar.collapsed .nav-item.active { background: linear-gradient(135deg,#3B5FE0,#6FA8F5); border-radius: 6px; margin: 0 10px; width: calc(100% - 20px); }
.dash-sidebar.collapsed .nav-item.active .nav-icon { color: #fff; }
.dash-sidebar.collapsed .nav-icon { width: auto; font-size: 1.05rem; }
.dash-sidebar.collapsed .sidebar-footer { padding: 1rem .5rem; display: flex; flex-direction: column; align-items: center; }
.dash-sidebar.collapsed .btn-logout { width: 34px; height: 34px; padding: 0; font-size: 0; display: flex; align-items: center; justify-content: center; }
.dash-sidebar.collapsed .btn-logout::after { content: "⏻"; font-size: .9rem; }

.sidebar-logo { padding: 1.4rem 1.2rem 1.2rem; border-bottom: 1px solid #DCE7FA; }
.sidebar-emblem { font-size: 1.4rem; margin-bottom: .4rem; }
.sidebar-school { font-size: .82rem; font-weight: 700; color: var(--text-primary); line-height: 1.35; }
.sidebar-city { font-size: .68rem; color: var(--text-tertiary); }

.sidebar-search {
  display: flex; align-items: center; gap: 8px;
  margin: .8rem 1rem 0; padding: 7px 10px;
  background: var(--white); border: 1px solid #DCE7FA;
  border-radius: 8px;
}
.sidebar-search-icon { color: var(--text-tertiary); flex-shrink: 0; }
.sidebar-search-input {
  border: none; outline: none; background: transparent;
  font-size: .78rem; color: var(--text-primary); width: 100%;
  font-family: var(--font);
}
.sidebar-search-input::placeholder { color: var(--text-tertiary); }
.dash-sidebar.collapsed .sidebar-search { display: none; }

.sidebar-nav { flex: 1; padding: .8rem .6rem; }
.nav-section-label { font-size: .6rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-tertiary); padding: 1rem .6rem .35rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: 8px .9rem;
  font-size: .78rem; font-weight: 600; color: var(--text-secondary);
  width: 100%; text-align: left; background: none;
  border: none; border-radius: 8px;
  transition: all .15s;
}
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,.6); }
.nav-item.active { color: #fff; background: linear-gradient(135deg,#3B5FE0,#6FA8F5); }
.nav-icon { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; font-size: .58rem; background: var(--white); color: var(--text-tertiary); padding: 1px 6px; border-radius: 4px; }
.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid #DCE7FA; }
.sidebar-role { font-size: .68rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: .6rem; }
.btn-logout {
  width: 100%; padding: 8px; background: var(--white);
  border: 1px solid #DCE7FA;
  border-radius: var(--radius-sm);
  font-size: .75rem; font-weight: 600; color: var(--text-secondary);
  transition: all .15s;
}
.btn-logout:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

.dash-main { flex: 1; overflow-y: auto; min-width: 0; }
.dash-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.topbar-badge {
  font-size: .7rem; font-weight: 700;
  background: var(--accent-light); color: var(--accent);
  padding: 4px 10px; border-radius: 20px;
}
.topbar-gear-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .15s;
}
.topbar-gear-btn:hover { background: var(--bg-card); color: var(--text-primary); transform: rotate(35deg); }
.cur-btn {
  font-size: .7rem; font-weight: 700; border: none; background: transparent;
  color: var(--text-secondary); padding: 4px 11px; border-radius: 16px; cursor: pointer;
  transition: background .12s, color .12s; white-space: nowrap;
}
.cur-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.cur-btn-active { background: var(--white) !important; color: var(--accent) !important; box-shadow: var(--shadow-sm); }

.panel { display: none; padding: 2rem; }
.panel.active { display: block; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.8rem; }
.panel-title { font-size: 1.1rem; font-weight: 700; }
.panel-sub { font-size: .78rem; color: var(--text-secondary); margin-top: .2rem; }

/* ═══════════════════════════════════════════════════
   COMPONENTS
═══════════════════════════════════════════════════ */

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 12px; margin-bottom: 1.6rem; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat-n { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); }
.stat-l { font-size: .72rem; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.stat-change { font-size: .68rem; margin-top: 4px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change.flat { color: var(--text-tertiary); }

/* Dashboard widgets row: trend chart + top list */
.dash-widgets-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .dash-widgets-grid { grid-template-columns: 1fr; } }

.widget-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.2rem 1.3rem; }
.widget-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.widget-card-title { font-size: .84rem; font-weight: 700; color: var(--text-primary); }
.widget-card-sub { font-size: .68rem; color: var(--text-tertiary); margin-top: 1px; }
.widget-select { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); font-size: .72rem; font-weight: 600; color: var(--text-secondary); padding: 4px 8px; }
.widget-chart-wrap { position: relative; height: 210px; }
.widget-empty { font-size: .78rem; color: var(--text-tertiary); text-align: center; padding: 2.4rem 0; }

/* Top list (bar-style ranking) */
.top-list { display: flex; flex-direction: column; gap: .8rem; }
.top-list-item { display: flex; align-items: center; gap: 10px; }
.top-list-rank { font-size: .68rem; font-weight: 700; color: var(--text-tertiary); width: 14px; flex-shrink: 0; }
.top-list-body { flex: 1; min-width: 0; }
.top-list-label { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.top-list-label span:last-child { color: var(--text-secondary); font-weight: 700; flex-shrink: 0; }
.top-list-track { height: 6px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.top-list-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-mid)); }

/* Recent sessions table */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); font-weight: 700; padding: 0 10px 8px; border-bottom: 1px solid var(--border); }
.dash-table td { padding: 10px 10px; border-bottom: 1px solid var(--bg-subtle); font-size: .8rem; color: var(--text-primary); vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table td.dt-meta { color: var(--text-secondary); font-size: .74rem; }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; }
.activity-feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--bg-subtle); }
.activity-feed-item:last-child { border-bottom: none; }
.activity-feed-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-feed-body { flex: 1; min-width: 0; }
.activity-feed-text { font-size: .78rem; color: var(--text-primary); line-height: 1.4; }
.activity-feed-time { font-size: .66rem; color: var(--text-tertiary); margin-top: 2px; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.4rem; margin-bottom: 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: .9rem; font-weight: 700; }
.card-meta { font-size: .72rem; color: var(--text-secondary); margin-top: 3px; }
.card-actions { display: flex; gap: 6px; align-items: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700; border: none; transition: all .15s; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--bg); border: 1.5px solid var(--border); color: var(--text-primary); }
.btn-secondary:hover { border-color: var(--border-mid); background: var(--bg-subtle); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--green-light); color: var(--green); border: 1px solid var(--green-mid); }
.btn-success:hover { background: #dcfce7; }
.btn-sm { padding: 5px 11px; font-size: .72rem; }
.btn-lg { padding: 11px 22px; font-size: .88rem; border-radius: var(--radius); }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Status Pill */
.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: .68rem; font-weight: 700; }
.pill-pending { background: var(--bg-subtle); color: var(--text-secondary); }
.pill-active { background: var(--green-light); color: var(--green); }
.pill-completed { background: var(--accent-light); color: var(--accent); }
.pill-present { background: var(--green-light); color: var(--green); }
.pill-absent { background: var(--red-light); color: var(--red); }
.pill-late { background: var(--amber-light); color: var(--amber); }

/* Grade pills */
.grade { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .72rem; font-weight: 800; }
.grade-Ap,.grade-A { background: #dcfce7; color: #15803d; }
.grade-B { background: #dbeafe; color: #1d4ed8; }
.grade-C { background: #fef9c3; color: #854d0e; }
.grade-D { background: #fed7aa; color: #9a3412; }
.grade-F { background: #fee2e2; color: #991b1b; }

/* Forms */
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.4rem; margin-bottom: 1.2rem; }

/* Finance: collapsible accordion sections (Fee Setup) */
.fin-accordion { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: .7rem; overflow: hidden; background: var(--white); }
.fin-accordion-head {
  width: 100%; display: flex; align-items: center; gap: .6rem;
  background: none; border: none; cursor: pointer;
  padding: .8rem 1rem; font-size: .88rem; font-weight: 700; color: var(--text-primary);
  text-align: left;
}
.fin-accordion-head:hover { background: var(--bg-secondary); }
.fin-accordion-meta { font-size: .72rem; font-weight: 500; color: var(--text-tertiary); }
.fin-accordion-chevron { margin-left: auto; font-size: .75rem; color: var(--text-tertiary); transition: transform .15s; }
.fin-accordion-body { padding: 0 1rem 1rem; display: none; border-top: 1px solid var(--border); padding-top: .9rem; }
.fin-accordion.open .fin-accordion-body { display: block; }
.fin-accordion.open .fin-accordion-chevron { transform: rotate(180deg); }

/* Edit Student modal — tab bar (Certificates / Student Info / Parents Info / Fee Info / Other Info) */
.es-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .9rem;
}
.es-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.es-tab:hover { background: var(--bg-secondary); color: var(--text-primary); }
.es-tab.active { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; }
.es-tab-panel { display: none; }
.es-tab-panel.active { display: block; }

/* Certificates tab — document/report generation buttons */
.es-cert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.es-cert-btn {
  display: flex; align-items: center; gap: .6rem;
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .9rem; font-size: .82rem; font-weight: 600; color: var(--text-primary);
  cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.es-cert-btn:hover { border-color: var(--accent, #2563eb); background: var(--bg-secondary); }
.es-cert-icon { font-size: 1.1rem; flex-shrink: 0; }

.form-grid { display: grid; gap: 12px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.form-req { color: var(--red); }
.form-input, .form-select, .form-textarea {
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text-primary);
  outline: none; transition: border-color .15s;
  background: var(--white);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6b64' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.form-hint { font-size: .7rem; color: var(--text-tertiary); }

/* ── Searchable select (combobox) — e.g. student picker on long rosters ── */
.searchable-select { position: relative; }
.searchable-select-trigger {
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text-primary);
  background: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: border-color .15s;
}
.searchable-select-trigger:hover, .searchable-select-trigger:focus { border-color: var(--accent); outline: none; }
.searchable-select-trigger .ss-placeholder-active { color: var(--text-tertiary); }
.searchable-select-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 2000; padding: 6px;
}
.searchable-select-panel.hidden { display: none; }
.searchable-select-search { width: 100%; margin-bottom: 4px; box-sizing: border-box; }
.searchable-select-list { max-height: 240px; overflow-y: auto; }
.ss-option { padding: 7px 10px; font-size: .85rem; border-radius: 6px; cursor: pointer; }
.ss-option:hover, .ss-option.ss-active { background: var(--bg-secondary, #f1f5f9); }
.ss-option.ss-selected { font-weight: 600; }
.ss-empty { padding: 10px; font-size: .8rem; color: var(--text-tertiary); text-align: center; }
.ss-option-check { display: flex; align-items: center; gap: 8px; }
.ss-option-check input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ── Admission/Withdrawal mode toggle — grouped segmented control ──────
   Deliberately styled differently from the page-level tab bar above it
   (bordered pill, connected segments) so it doesn't read as another row
   of navigation tabs. */
.aw-seg {
  display: inline-flex; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 8px;
}
.aw-seg-btn {
  border: none; background: transparent; color: var(--text-secondary);
  font-size: .8rem; font-weight: 600; padding: 8px 16px; cursor: pointer;
  transition: background .12s, color .12s;
}
.aw-seg-btn + .aw-seg-btn { border-left: 1.5px solid var(--border); }
.aw-seg-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
#aw-mode-withdraw-btn[aria-pressed="true"] { background: var(--red); }
.aw-seg-note {
  font-size: .72rem; color: var(--text-tertiary); background: var(--bg-secondary, #f5f5f4);
  border-radius: var(--radius-sm); padding: 7px 11px; margin-bottom: 1rem; max-width: 520px;
}
.aw-seg-note.hidden { display: none; }
.form-error { font-size: .75rem; color: var(--red); font-weight: 600; min-height: 17px; }
.form-section { font-size: .68rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: .6rem; margin-top: .4rem; }

/* ── Toggle switch (auto-backup on/off) ─────────────────────────────── */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-mid); transition: .15s; border-radius: 999px; }
.switch-slider::before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--white); transition: .15s; border-radius: 50%; }
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent-mid); outline-offset: 2px; }

/* Table */
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th { background: var(--bg); color: var(--text-secondary); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--bg-subtle); color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .td-mono { font-family: var(--font-mono); font-size: .75rem; }
.no-data { text-align: center; padding: 3rem; color: var(--text-tertiary); font-size: .85rem; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius);
  padding: 1.8rem 1.2rem;
  text-align: center; cursor: pointer;
  transition: all .2s; background: var(--bg);
}
.drop-zone:hover, .drop-zone.drag, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-light); }
.drop-zone.has-file { border-color: var(--green); background: var(--green-light); }
.dz-icon { font-size: 1.6rem; margin-bottom: .4rem; }
.dz-text { font-size: .82rem; font-weight: 700; color: var(--text-primary); margin-bottom: .2rem; }
.dz-hint { font-size: .72rem; color: var(--text-tertiary); }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.progress-label { font-size: .72rem; color: var(--text-secondary); font-weight: 600; }

/* Pool progress */
.pool-bar-track { width: 200px; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pool-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 4px; transition: width .5s; }

/* Toggle */
.toggle-row { display: flex; align-items: center; gap: 8px; }
.toggle-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.toggle-row input[type=checkbox]:disabled { cursor: not-allowed; opacity: .5; }
.toggle-row:has(input[type=checkbox]:disabled) .toggle-label { color: var(--text-tertiary); }
.toggle-label { font-size: .82rem; font-weight: 500; color: var(--text-primary); }

/* Toast */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--text-primary); color: var(--white);
  padding: 10px 18px; border-radius: var(--radius);
  font-size: .82rem; font-weight: 700;
  z-index: 99999; opacity: 0; transform: translateY(8px);
  transition: all .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* Section divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }

/* Filter row */
.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-row .form-select { max-width: 180px; }
.filter-count { font-size: .75rem; color: var(--text-secondary); font-weight: 600; margin-left: auto; }

/* ═══════════════════════════════════════════════════
   SESSIONS LIST
═══════════════════════════════════════════════════ */
.session-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.sc-left { flex: 1; min-width: 0; }
.sc-title { font-size: .88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { font-size: .72rem; color: var(--text-secondary); margin-top: 2px; }
.sc-pool-wrap { margin-top: 5px; }
.sc-pool-label { font-size: .65rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 3px; }
.sc-right { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* Study Content — play-card browser */
.sc-play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.sc-play-card {
  background: var(--white); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem 1rem; text-align: center; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 120px;
}
.sc-play-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.sc-play-card.class-card { background: linear-gradient(160deg, #eff6ff 0%, #fff 55%); }
.sc-play-card.chapter-card { background: linear-gradient(160deg, #f5f3ff 0%, #fff 55%); }
.sc-play-card.content-card { min-height: 140px; text-align: left; align-items: stretch; padding: 1rem; cursor: default; }
.sc-play-card.content-card:hover { transform: none; }
.sc-play-card.stu-content-card { text-align: center; align-items: center; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.sc-play-card.stu-content-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.sc-play-card.stu-content-card.expanded { grid-column: 1 / -1; transform: none; border-color: var(--accent); }
.sc-play-card.sc-card-anchor { cursor: default; }
.sc-play-card.sc-card-anchor:hover { transform: translateY(-3px); }
.sc-card-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; width: 100%; cursor: pointer; }
.sc-card-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.sc-play-card.sc-add-card {
  border-style: dashed; border-color: var(--accent-mid); background: var(--bg);
  justify-content: center; cursor: pointer; min-height: 120px;
}
.sc-play-card.sc-add-card:hover { border-color: var(--accent); background: var(--accent-light); }
.sc-play-icon { font-size: 2rem; line-height: 1; }
.sc-play-title { font-weight: 700; font-size: .88rem; color: var(--text-primary); line-height: 1.3; word-break: break-word; overflow-wrap: break-word; }
.sc-play-meta { font-size: .7rem; color: var(--text-tertiary); overflow-wrap: break-word; word-break: break-word; }
/* ── Preview thumbnails in content cards ── */
.sc-preview-thumb {
  width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
  background: #1a1a2e; position: relative; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sc-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-preview-thumb canvas { width: 100% !important; height: 100% !important; object-fit: cover; display: block; }
.sc-preview-thumb .sc-preview-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
}
.sc-preview-thumb .sc-preview-play svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.sc-preview-thumb .sc-preview-badge {
  position: absolute; bottom: 5px; right: 6px; background: rgba(0,0,0,.65);
  color: #fff; font-size: .62rem; padding: 2px 6px; border-radius: 4px; font-weight: 600;
}
.sc-preview-thumb .sc-preview-loading {
  font-size: .65rem; color: #888; text-align: center; padding: 8px;
}
.sc-play-card.stu-content-card.has-preview {
  padding: 0; gap: 0; align-items: stretch; text-align: left;
}
.sc-play-card.stu-content-card.has-preview .sc-preview-info {
  padding: .65rem .8rem .7rem; display: flex; flex-direction: column; gap: 3px;
}
.sc-play-card.stu-content-card.has-preview .sc-play-title { font-size: .82rem; }
.sc-play-card.stu-content-card.has-preview .sc-play-meta  { font-size: .68rem; }
.sc-browse-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 1.2rem; }
.sc-browse-crumb { font-size: .82rem; color: var(--text-secondary); flex: 1; min-width: 0; }
.sc-browse-crumb strong { color: var(--text-primary); }
.sc-content-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }

/* ═══════════════════════════════════════════════════
   RESULTS TABLE PANEL
═══════════════════════════════════════════════════ */
.results-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 10px; margin-bottom: 1.4rem; }
.res-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; text-align: center; }
.res-n { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.res-l { font-size: .68rem; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }

/* ═══════════════════════════════════════════════════
   ATTENDANCE
═══════════════════════════════════════════════════ */
.att-grid { display: flex; flex-direction: column; gap: 8px; }
.att-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
}
.att-roll { font-family: var(--font-mono); font-size: .75rem; font-weight: 500; color: var(--text-secondary); width: 44px; flex-shrink: 0; }
.att-name { flex: 1; font-size: .82rem; font-weight: 600; }
.att-status-btns { display: flex; gap: 5px; }
.att-btn {
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: .68rem; font-weight: 700; border: 1.5px solid transparent;
  transition: all .12s;
}
.att-btn[data-s=present] { border-color: var(--green-mid); color: var(--green); }
.att-btn[data-s=present].sel, .att-btn[data-s=present]:hover { background: var(--green); color: var(--white); border-color: var(--green); }
.att-btn[data-s=absent] { border-color: #fca5a5; color: var(--red); }
.att-btn[data-s=absent].sel, .att-btn[data-s=absent]:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.att-btn[data-s=late] { border-color: #fde68a; color: var(--amber); }
.att-btn[data-s=late].sel, .att-btn[data-s=late]:hover { background: var(--amber); color: var(--white); border-color: var(--amber); }
.att-btn[data-s=leave] { border-color: var(--border); color: var(--text-secondary); }
.att-btn[data-s=leave].sel, .att-btn[data-s=leave]:hover { background: var(--text-secondary); color: var(--white); border-color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════
   TEACHER PANEL
═══════════════════════════════════════════════════ */
.teacher-card { display: flex; align-items: center; gap: 12px; }
.teacher-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800; flex-shrink: 0; }
.teacher-info { flex: 1; }
.teacher-name { font-size: .88rem; font-weight: 700; }
.teacher-meta { font-size: .72rem; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════
   PROGRESS TRACKER
═══════════════════════════════════════════════════ */
.progress-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bg-subtle); }
.progress-row:last-child { border-bottom: none; }
.pr-subject { flex: 1; font-size: .82rem; font-weight: 600; }
.pr-bar-wrap { flex: 1; }
.pr-pct { font-size: .75rem; font-weight: 700; color: var(--text-primary); min-width: 34px; text-align: right; }

/* ═══════════════════════════════════════════════════
   NOTIFICATION CENTER
═══════════════════════════════════════════════════ */
.notif-card { display: flex; gap: 12px; align-items: flex-start; }
.notif-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0; }
.notif-icon.info { background: var(--accent-light); }
.notif-icon.warning { background: var(--amber-light); }
.notif-icon.success { background: var(--green-light); }
.notif-icon.alert { background: var(--red-light); }
.notif-icon.purple { background: var(--purple-light); }
.notif-icon.grey { background: var(--grey-light); }

.activity-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .64rem; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
  flex-shrink: 0;
}
.activity-badge.finance { background: var(--green-light); color: var(--green); }
.activity-badge.students { background: var(--accent-light); color: var(--accent); }
.activity-badge.staff { background: var(--purple-light); color: var(--purple); }
.activity-badge.academics { background: var(--amber-light); color: var(--amber); }
.activity-badge.notifications { background: var(--amber-light); color: var(--amber); }
.activity-badge.system { background: var(--grey-light); color: var(--grey); }
.notif-body { flex: 1; }
.notif-title { font-size: .82rem; font-weight: 700; }
.notif-text { font-size: .75rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.notif-meta { font-size: .68rem; color: var(--text-tertiary); margin-top: 4px; }

/* Autosave banner */
.autosave-banner { background: var(--green-light); border: 1px solid var(--green-mid); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .75rem; color: var(--green); font-weight: 600; margin-bottom: 1rem; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤900px)
═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
  .dash-sidebar:not(.collapsed) { width: 56px; }
  .dash-sidebar:not(.collapsed) .nav-item span:not(.nav-icon) { display: none; }
  .dash-sidebar:not(.collapsed) .sidebar-logo .sidebar-school,
  .dash-sidebar:not(.collapsed) .sidebar-logo .sidebar-city,
  .dash-sidebar:not(.collapsed) .sidebar-footer .sidebar-role { display: none; }
  .dash-sidebar:not(.collapsed) .btn-logout { font-size: 0; }
  .sidebar-collapse-btn { display: none; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤600px)
   Full slide-in sidebar with hamburger + overlay
═══════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Login ── */
  .form-grid-2 { grid-template-columns: 1fr; }
  .quiz-body { padding: 1rem; }
  .q-card { padding: 1.2rem; }
  .result-stats { gap: 7px; }
  .login-card { padding: 1.5rem 1.25rem 1.25rem; border-radius: 16px; }
  .pw-section { grid-template-columns: 1fr; }

  /* ── Dashboard shell ── */
  #screen-dashboard { display: block; position: relative; }

  /* Sidebar: hidden off-screen by default, slides in when .open */
  .dash-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px !important;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .dash-sidebar.open { transform: translateX(0); }

  /* Show all text inside sidebar on mobile, ignore desktop collapse state */
  .nav-item span:not(.nav-icon) { display: inline !important; }
  .sidebar-logo .sidebar-school,
  .sidebar-logo .sidebar-city,
  .sidebar-footer .sidebar-role { display: block !important; }
  .btn-logout { font-size: .75rem !important; width: 100% !important; height: auto !important; padding: 8px !important; }
  .btn-logout::after { content: none !important; }
  .sidebar-collapse-btn { display: none !important; }
  .dash-sidebar.collapsed { width: 240px !important; }
  .dash-sidebar.collapsed .nav-item { justify-content: flex-start !important; padding: 8px 1.2rem !important; }
  .dash-sidebar.collapsed .nav-section-label { display: block !important; }
  .dash-sidebar.collapsed .sidebar-logo,
  .dash-sidebar.collapsed .sidebar-footer { align-items: normal !important; }

  /* Overlay behind open sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
  }
  .sidebar-overlay.open { display: block; }

  /* Main takes full width */
  .dash-main {
    width: 100%;
    min-height: 100vh;
  }

  /* Topbar: make room for hamburger */
  .dash-topbar {
    padding: 0 1rem;
    gap: .6rem;
  }

  /* Hamburger button */
  .hamburger-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text-primary);
  }

  /* Panel padding tighter on mobile */
  .panel { padding: 1rem; }
  .panel-header { flex-direction: column; align-items: flex-start; gap: .5rem; }

  /* Stats grid: 2 columns on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: .6rem; }
  .stat-card { padding: 1rem .8rem; }
  .stat-n { font-size: 1.6rem; }

  /* Tables: horizontal scroll */
  .table-wrap, .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Modals: full screen on mobile */
  .modal-box, .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 50vh;
    border-radius: 16px 16px 0 0 !important;
    margin: auto 0 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
  }
  .modal-overlay, .modal-backdrop {
    align-items: flex-end !important;
  }

  /* Topbar title shorter */
  .topbar-title { font-size: .85rem; }
  .topbar-badge { font-size: .65rem; padding: 3px 8px; }

  /* Buttons: bigger tap targets */
  .btn, button.btn { min-height: 40px; font-size: .82rem; }
}

/* ═══════════════════════════════════════════════════
   CHAPTER OPTIONS MODAL
═══════════════════════════════════════════════════ */
#stu-chapter-options-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.48);
  z-index: 9500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#stu-chapter-options-overlay.open { display: flex; }

.stu-options-modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem 1.75rem;
  width: min(92vw, 400px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: optionsModalIn .18s ease;
}
@keyframes optionsModalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.stu-options-chapter-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: .9rem;
}

.stu-options-subtitle {
  font-size: .75rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: -.4rem;
  letter-spacing: .2px;
}

.stu-options-btn {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  padding: .95rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-align: left;
}
.stu-options-btn:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
  box-shadow: var(--shadow-sm);
}
.stu-options-btn-icon {
  font-size: 1.7rem;
  line-height: 1;
  flex-shrink: 0;
}
.stu-options-btn-text strong {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.stu-options-btn-text span {
  font-size: .74rem;
  color: var(--text-tertiary);
}
.stu-options-btn.pres-btn:hover {
  border-color: #a78bfa;
  background: #f5f3ff;
}
.stu-options-cancel {
  background: none;
  border: none;
  font-size: .78rem;
  color: var(--text-tertiary);
  cursor: pointer;
  text-align: center;
  padding: .25rem;
}
.stu-options-cancel:hover { color: var(--text-secondary); }


/* ═══════════════════════════════════════════════════
   PRESENTATION FULLSCREEN OVERLAY
═══════════════════════════════════════════════════ */
#stu-presentation-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0f0f0f;
  z-index: 99998;
  flex-direction: column;
}

.stu-pres-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 8px 14px;
  background: #1a1a1a;
  border-bottom: 1px solid #2e2e2e;
  flex-shrink: 0;
  min-height: 46px;
}
.stu-pres-toolbar-title {
  flex: 1;
  font-size: .82rem;
  font-weight: 700;
  color: #e8e8e4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stu-pres-toolbar-btn {
  background: none;
  border: 1px solid #3a3a3a;
  color: #bbb;
  border-radius: var(--radius-sm);
  padding: 4px 11px;
  font-size: .75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.stu-pres-toolbar-btn:hover { border-color: #666; color: #eee; }
.stu-pres-toolbar-btn.close-btn { background: #c0392b; border-color: #c0392b; color: #fff; font-weight: 700; }
.stu-pres-toolbar-btn.close-btn:hover { background: #a93226; }

#stu-presentation-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ── Curriculum Chapter Content Cards ── */
.cur-content-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--white);
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .12s;
}
.cur-content-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.cur-content-card-muted { opacity: .85; }
.cur-content-card-muted:hover { opacity: 1; }
.cur-content-card-icon {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cur-content-card-body {
  padding: .75rem .9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.cur-content-card-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.cur-content-card-title {
  font-weight: 700;
  font-size: .84rem;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}
.cur-content-card-meta {
  font-size: .7rem;
  color: var(--text-tertiary);
  margin-top: .1rem;
}
.cur-content-card-arrow {
  padding: .5rem .9rem;
  font-size: .85rem;
  color: var(--accent);
  font-weight: 700;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* ── Chapter Folder Panel ─────────────────────────────────────────────────── */
.chapter-card.ch-active {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.chapter-card.ch-active .sc-play-icon {
  transform: scale(1.1);
}

.ch-folder-panel {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  margin: .5rem 0 1rem;
  overflow: hidden;
  animation: ch-fold-in .18s ease;
}
@keyframes ch-fold-in {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}

.ch-folder-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  background: var(--accent);
  color: #fff;
}
.ch-folder-icon { font-size: 1.1rem; flex-shrink: 0; }
.ch-folder-title {
  flex: 1;
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-folder-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 2px 9px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ch-folder-close:hover { background: rgba(255,255,255,.35); }

.ch-folder-body { padding: .5rem; }

.ch-folder-desc {
  font-size: .8rem;
  color: var(--text-secondary);
  padding: .5rem .75rem .25rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
  margin-bottom: .3rem;
}

.ch-folder-items {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.ch-folder-loading {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-tertiary);
  font-size: .82rem;
}
.ch-folder-empty {
  text-align: center;
  padding: 1.2rem;
  color: var(--text-tertiary);
  font-size: .82rem;
  font-style: italic;
}

.ch-folder-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background .13s, transform .1s;
  border: 1px solid transparent;
  background: var(--bg);
}
.ch-folder-item:hover {
  background: var(--bg-hover, #f0f4ff);
  border-color: var(--accent);
  transform: translateX(3px);
}
.ch-folder-item:active { transform: scale(.98); }

.ch-item-pdf  .ch-item-icon { color: #e74c3c; }
.ch-item-slides .ch-item-icon { color: #8b5cf6; }
.ch-item-video .ch-item-icon { color: #0ea5e9; }
.ch-item-text .ch-item-icon  { color: #16a34a; }

.ch-item-icon { font-size: 1.4rem; flex-shrink: 0; width: 2rem; text-align: center; }
.ch-item-info { flex: 1; min-width: 0; }
.ch-item-name {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-item-desc {
  font-size: .72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.ch-item-arrow {
  color: var(--accent);
  font-size: .9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ch-lesson-inline {
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  margin: 0 0 .2rem;
  border: 1px solid var(--border);
  background: var(--white);
}

/* ── Chapter Elements Page (full page swap view) ─────────────────────────── */
.ch-elements-page {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  overflow: hidden;
  animation: ch-fold-in .18s ease;
}
.ch-elements-page .ch-folder-desc {
  padding: .75rem 1rem .5rem;
}
.ch-elements-page .ch-folder-items {
  padding: .5rem;
}
.ch-elements-page .ch-folder-empty,
.ch-elements-page .ch-folder-loading {
  padding: 2.5rem 1rem;
}

/* ── Download Center ──────────────────────────────────────────────────── */
.dc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.dc-card { margin-bottom: 0; display: flex; flex-direction: column; }
.dc-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.dc-filters .form-label { display: block; margin-bottom: .3rem; }
.dc-actions { display: flex; gap: .6rem; margin-top: auto; }
.dc-actions .btn { flex: 1; }
