/* ===== VARIABLES ===== */
:root {
  --blue:        #2563eb;
  --blue-dark:   #1d4ed8;
  --blue-light:  #dbeafe;
  --blue-xlight: #eff6ff;
  --navy:        #0d1f3c;
  --navy2:       #162847;
  --gold:        #f59e0b;
  --gold-dark:   #d97706;
  --gold-light:  #fef3c7;
  --mid:         #64748b;
  --light:       #f1f5f9;
  --white:       #ffffff;
  --success:     #10b981;
  --danger:      #ef4444;
  --border:      #e2e8f0;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.08);
  --radius:      12px;
  --sidebar-w:   288px;
  --header-h:    64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--navy); background: var(--light); }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }
textarea, input, select { font-family: inherit; }
.hidden { display: none !important; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--blue);
  color: var(--white);
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  transition: background .18s, transform .1s, box-shadow .18s;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.btn-primary:hover  { background: var(--blue-dark); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--border);
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  transition: border-color .18s, background .18s;
}
.btn-secondary:hover { border-color: var(--blue); background: var(--blue-xlight); }
.btn-full  { width: 100%; }
.btn-large { padding: 14px 32px; font-size: 1.05rem; }
.btn-sm { padding: 5px 12px; border-radius: 6px; font-size: .78rem; font-weight: 600; border: none; }
.btn-sm.btn-edit    { background: var(--blue-xlight); color: var(--blue); }
.btn-sm.btn-edit:hover { background: var(--blue-light); }
.btn-sm.btn-danger  { background: #fef2f2; color: var(--danger); }
.btn-sm.btn-danger:hover { background: #fee2e2; }
.btn-sm.btn-reset   { background: #f0fdf4; color: var(--success); }
.btn-sm.btn-reset:hover { background: #dcfce7; }
.btn-sm.btn-progress { background: var(--gold-light); color: var(--gold-dark); }
.btn-sm.btn-progress:hover { background: #fde68a; }
.btn-sm.btn-pdf { background: #ecfdf5; color: #047857; }
.btn-sm.btn-pdf:hover { background: #d1fae5; }
.regs-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.regs-eval-btn { margin-top: 10px; }
.btn-sm.btn-primary { background: var(--blue-light); color: var(--blue-dark); }
.btn-sm.btn-primary:hover { background: var(--blue); color: white; }
.btn-sm-add { background: var(--blue-xlight) !important; color: var(--blue) !important; }
.btn-sm.btn-translate { background: #f0fdf4; color: #166534; }
.btn-sm.btn-translate:hover { background: #dcfce7; }
.btn-sm.btn-translate:disabled { opacity: .6; cursor: default; }

.progress-bar-track { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.progress-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--blue), #60a5fa); border-radius: 99px; transition: width .45s ease; }

/* ===== AUTH PAGE ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy2) 55%, #1e3a6e 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.22) 0%, transparent 70%);
  top: -200px; right: -150px;
  pointer-events: none;
  animation: authFloat1 14s ease-in-out infinite;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,.16) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
  animation: authFloat2 18s ease-in-out infinite;
}
@keyframes authFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 50px) scale(1.12); }
}
@keyframes authFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(50px, -40px) scale(1.15); }
}
.auth-wrapper {
  width: 100%; max-width: 420px; position: relative; z-index: 1;
  animation: authCardIn .7s cubic-bezier(.22,1,.36,1) both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.12);
}
/* staggered entrance for form fields */
.auth-card .form-group,
.auth-card .form-error,
.auth-card .btn-full { animation: authItemIn .55s ease both; }
.auth-card .auth-logo { animation: authItemIn .6s ease both; }
.auth-card .form-group:nth-of-type(1) { animation-delay: .12s; }
.auth-card .form-group:nth-of-type(2) { animation-delay: .20s; }
.auth-card .btn-full { animation-delay: .30s; }
@keyframes authItemIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-img {
  max-height: 64px; max-width: 220px; width: auto; object-fit: contain;
  margin-bottom: 10px; display: block; margin-left: auto; margin-right: auto;
  animation: authLogoPop .8s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes authLogoPop {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
.logo-icon  { font-size: 2.8rem; margin-bottom: 10px; display: block; }
.auth-logo h1 { font-size: 2rem; font-weight: 800; color: var(--navy); letter-spacing: -.5px; }
.auth-logo h1 span { color: var(--blue); }
.auth-subtitle { color: var(--mid); font-size: .875rem; margin-top: 5px; }
.auth-divider { height: 1px; background: var(--border); margin: 0 0 28px; }
/* auth input + button micro-interactions */
.auth-card .form-group input { transition: border-color .18s, box-shadow .18s, transform .18s; }
.auth-card .form-group input:focus { transform: translateY(-1px); }
.auth-card .btn-full { transition: background .18s, transform .14s, box-shadow .25s; }
.auth-card .btn-full:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(37,99,235,.4); }
.auth-card .btn-full:active:not(:disabled) { transform: translateY(0) scale(.99); }
.toggle-pw { transition: color .15s, transform .15s; }
.toggle-pw:hover { color: var(--blue); transform: translateY(-50%) scale(1.12); }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.form-group label { font-size: .825rem; font-weight: 700; color: var(--navy); letter-spacing: .02em; text-transform: uppercase; }
.label-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .8rem; }
.form-group input, .form-group textarea, .form-group select {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  font-size: .95rem;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  background: var(--white);
  color: var(--navy);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-check { flex-direction: row; align-items: center; gap: 8px; }
.form-check label { display: flex; align-items: center; gap: 6px; font-size: .9rem; cursor: pointer; text-transform: none; font-weight: 500; letter-spacing: 0; }
.password-wrapper { position: relative; }
.password-wrapper input { width: 100%; padding-right: 44px; }
.toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 1rem; color: var(--mid); }
.form-error   { color: #b91c1c; font-size: .875rem; background: #fef2f2; padding: 10px 14px; border-radius: 8px; border: 1px solid #fecaca; margin-bottom: 12px; }
.form-success { color: #065f46; font-size: .875rem; background: #f0fdf4; padding: 10px 14px; border-radius: 8px; border: 1px solid #bbf7d0; margin-bottom: 12px; }

/* Inline text link / secondary action inside the auth card (e.g. "Passwort vergessen?") */
.auth-link {
  display: block; width: 100%; margin-top: 14px;
  background: none; border: none; cursor: pointer;
  color: var(--blue); font-size: .9rem; font-weight: 600; text-align: center;
  font-family: inherit; transition: color .15s;
}
.auth-link:hover { color: var(--navy); text-decoration: underline; }
.auth-form-title { font-size: 1.3rem; font-weight: 800; color: var(--navy); text-align: center; margin-bottom: 6px; }
.auth-form-sub   { color: var(--mid); font-size: .9rem; text-align: center; margin-bottom: 20px; line-height: 1.45; }

/* ===== HEADER ===== */
.portal-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  color: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-logo { display: flex; align-items: center; gap: 10px; }
.header-logo-img { height: 36px; max-width: 160px; width: auto; object-fit: contain; display: block; }
.header-logo span { font-size: 1.1rem; font-weight: 800; color: var(--white); letter-spacing: -.3px; }
.header-logo strong { color: var(--blue); font-size: 1.15rem; }
.logo-icon-sm { font-size: 1.3rem; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,.6); font-size: 1.3rem; padding: 6px 8px; border-radius: 6px; transition: color .15s, background .15s; }
.sidebar-toggle:hover { color: var(--white); background: rgba(255,255,255,.08); }
.header-right { display: flex; align-items: center; gap: 14px; }
.user-greeting { font-size: .85rem; color: rgba(255,255,255,.5); }
.user-greeting strong { color: rgba(255,255,255,.9); font-weight: 600; }
.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.55);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  transition: all .18s;
}
.btn-logout:hover { border-color: var(--blue); color: var(--white); background: rgba(37,99,235,.2); }
.btn-back {
  color: rgba(255,255,255,.85);
  font-size: .82rem;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  transition: background .18s, border-color .18s, transform .1s, color .18s;
}
.btn-back:hover { background: rgba(37,99,235,.25); border-color: var(--blue); color: var(--white); }
.btn-back:active { transform: scale(.97); }
.btn-admin-link {
  background: rgba(37,99,235,.2);
  color: #93c5fd;
  padding: 5px 13px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
  border: 1px solid rgba(37,99,235,.3);
  transition: all .18s;
}
.btn-admin-link:hover { background: rgba(37,99,235,.35); color: white; }
.admin-badge { background: var(--gold); color: var(--navy); font-size: .65rem; font-weight: 800; padding: 2px 7px; border-radius: 4px; margin-left: 6px; }

/* ===== LAYOUT ===== */
.portal-layout { display: flex; margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }
.sidebar-scrim {
  display: none;
  position: fixed; inset: var(--header-h) 0 0 0;
  background: rgba(0,0,0,.5); z-index: 80;
  animation: modalFade .25s ease both;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  position: fixed;
  top: var(--header-h);
  left: 0;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 90;
  border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
.course-title-sidebar { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.course-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-size: .65rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 4px;
  margin-bottom: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.course-title-sidebar h2 { font-size: .875rem; color: rgba(255,255,255,.85); line-height: 1.45; font-weight: 600; }
.sidebar-progress-wrap { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: rgba(255,255,255,.4); margin-bottom: 7px; }
.sidebar .progress-bar-track { background: rgba(255,255,255,.1); height: 5px; }
.course-nav { padding: 8px 0 24px; }
.nav-loading { padding: 16px; color: rgba(255,255,255,.35); font-size: .85rem; }
.nav-section { margin-bottom: 2px; }
.nav-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.nav-section-header:hover { background: rgba(255,255,255,.04); }
.nav-section-title { font-size: .775rem; font-weight: 700; color: rgba(255,255,255,.55); flex: 1; line-height: 1.35; text-transform: uppercase; letter-spacing: .05em; }
.nav-section-arrow { font-size: .65rem; color: rgba(255,255,255,.25); transition: transform .2s; }
.nav-section.open .nav-section-arrow { transform: rotate(180deg); }
.nav-section-items { display: none; }
.nav-section.open .nav-section-items { display: block; }
.nav-lesson {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 18px 9px 26px;
  font-size: .82rem;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  line-height: 1.4;
}
.nav-lesson:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.85); }
.nav-lesson.active { background: rgba(37,99,235,.2); color: #93c5fd; border-left-color: var(--blue); }
.nav-lesson.completed { color: rgba(255,255,255,.55); }
.nav-lesson.active.completed { color: #93c5fd; }
.lesson-check { font-size: .75rem; min-width: 16px; flex-shrink: 0; margin-top: 1px; color: rgba(255,255,255,.3); }
.nav-lesson.completed .lesson-check { color: #4ade80; font-size: .8rem; }

/* ===== PORTAL MAIN ===== */
.portal-main { flex: 1; margin-left: var(--sidebar-w); padding: 32px; transition: margin .3s cubic-bezier(.4,0,.2,1); }
.portal-main.full { margin-left: 0; }

.welcome-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a7a 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 36px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-bottom: 28px; flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(13,31,60,.25);
  position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute; right: -40px; top: -60px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-text h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.3px; }
.welcome-text p { color: rgba(255,255,255,.55); font-size: .9rem; }
.welcome-stats { display: flex; gap: 16px; flex-wrap: wrap; position: relative; }
.stat-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 16px 22px; text-align: center;
  backdrop-filter: blur(4px);
}
.stat-number { font-size: 2rem; font-weight: 800; color: var(--gold); line-height: 1; }
.stat-label  { font-size: .72rem; color: rgba(255,255,255,.5); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
.continue-btn-wrap { margin-bottom: 28px; }
.sections-overview { display: grid; gap: 14px; }
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
}
.section-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.section-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.section-card-title  { font-size: 1rem; font-weight: 700; color: var(--navy); flex: 1; }
.section-card-badge  { font-size: .75rem; color: var(--mid); white-space: nowrap; background: var(--light); padding: 3px 10px; border-radius: 6px; }
.section-card-desc   { font-size: .85rem; color: var(--mid); line-height: 1.6; margin-bottom: 14px; }
.section-card-progress { display: flex; align-items: center; gap: 12px; }
.section-card-progress .progress-bar-track { flex: 1; }
.section-progress-label { font-size: .75rem; color: var(--mid); white-space: nowrap; font-weight: 600; }
.load-error { color: var(--danger); padding: 16px; }

/* ===== LESSON ===== */
.lesson-main { flex: 1; margin-left: var(--sidebar-w); padding: 32px; max-width: calc(860px + var(--sidebar-w)); transition: margin .3s cubic-bezier(.4,0,.2,1); }
.lesson-main.full { margin-left: 0; }
.lesson-header { margin-bottom: 22px; }
.lesson-breadcrumb { font-size: .78rem; color: var(--mid); margin-bottom: 7px; display: flex; align-items: center; gap: 5px; }
.lesson-title { font-size: 1.65rem; font-weight: 800; color: var(--navy); line-height: 1.3; letter-spacing: -.4px; }
.lesson-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  line-height: 1.8;
}
.lesson-content h2 { font-size: 1.15rem; font-weight: 800; color: var(--navy); margin: 28px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--blue-light); }
.lesson-content h2:first-child { margin-top: 0; }
.lesson-content h3 { font-size: 1rem; font-weight: 700; color: var(--navy); margin: 18px 0 8px; }
.lesson-content p { color: var(--mid); margin-bottom: 13px; font-size: .95rem; }
.lesson-content ul, .lesson-content ol { color: var(--mid); padding-left: 22px; margin-bottom: 13px; }
.lesson-content li { margin-bottom: 6px; font-size: .95rem; }
.lesson-content .info-box  { background: var(--blue-xlight); border-left: 4px solid var(--blue); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 18px 0; }
.lesson-content .warn-box  { background: #fffbeb; border-left: 4px solid var(--gold); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 18px 0; }
.lesson-content .danger-box{ background: #fef2f2; border-left: 4px solid var(--danger); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 18px 0; }
.lesson-content .box-title { font-weight: 800; font-size: .82rem; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .875rem; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.lesson-content th { background: var(--navy); color: var(--white); padding: 11px 15px; text-align: left; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.lesson-content td { padding: 10px 15px; border-bottom: 1px solid var(--border); color: var(--mid); }
.lesson-content tr:last-child td { border-bottom: none; }
.lesson-content tr:nth-child(even) td { background: var(--blue-xlight); }
/* Inline figures / SVG graphics in AI-generated content */
.lesson-content .lesson-figure,
.material-article .lesson-figure,
.lesson-content figure,
.material-article figure { margin: 20px auto; max-width: 480px; text-align: center; }
.lesson-content .lesson-figure svg,
.material-article .lesson-figure svg,
.lesson-content figure svg,
.material-article figure svg { max-width: 100%; height: auto; background: var(--blue-xlight); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.lesson-content figcaption,
.material-article figcaption { font-size: .82rem; color: var(--mid); margin-top: 8px; font-style: italic; }
.lesson-completed-badge { display: flex; align-items: center; gap: 8px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 9px; padding: 12px 18px; color: #065f46; font-weight: 700; font-size: .875rem; margin-bottom: 20px; }
.lesson-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-complete { background: var(--success) !important; color: white !important; box-shadow: 0 2px 8px rgba(16,185,129,.3) !important; }
.btn-complete:hover { background: #059669 !important; }
.btn-complete.done { background: #d1fae5 !important; color: var(--success) !important; box-shadow: none !important; }

/* ===== EXAM (new Führerschein-style) ===== */
.exam-main { margin-top: var(--header-h); height: calc(100vh - var(--header-h)); display: flex; flex-direction: column; }
.exam-screen { flex: 1; display: flex; align-items: center; justify-content: center; }
.exam-screen.hidden { display: none; }
.exam-intro-card { background: var(--white); border-radius: 18px; padding: 48px; text-align: center; box-shadow: var(--shadow-lg); border: 1px solid var(--border); max-width: 560px; width: 100%; margin: 20px; }
.exam-intro-icon { font-size: 3rem; margin-bottom: 16px; }
.exam-intro-card h2 { font-size: 1.5rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.exam-intro-sub { color: var(--mid); font-size: .9rem; margin-bottom: 24px; }
.exam-rules-list { list-style: none; text-align: left; background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 10px; padding: 16px 20px; margin-bottom: 28px; }
.exam-rules-list li { color: var(--mid); font-size: .9rem; margin-bottom: 6px; }
.exam-layout { display: flex; width: 100%; height: 100%; gap: 0; }
.exam-sidebar { width: 200px; min-width: 180px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 16px; gap: 12px; overflow-y: auto; }
.exam-sidebar-head { font-weight: 700; font-size: .85rem; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.exam-q-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.eq-bubble { width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--border); background: var(--white); font-size: .82rem; font-weight: 600; color: var(--mid); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.eq-bubble:hover { border-color: var(--blue); color: var(--blue); }
.eq-bubble.eq-current { border-color: var(--blue); background: var(--blue); color: white; }
.eq-bubble.eq-answered { border-color: var(--success); background: var(--success); color: white; }
.eq-bubble.eq-flagged  { border-color: var(--gold-dark); background: var(--gold-light); color: var(--gold-dark); }
.eq-bubble.eq-answered.eq-current { filter: brightness(0.85); }
.eq-bubble.eq-flagged.eq-current  { filter: brightness(0.9); }
.exam-legend { display: flex; flex-direction: column; gap: 5px; font-size: .75rem; color: var(--mid); }
.exam-legend span { display: flex; align-items: center; gap: 6px; }
.exam-legend .eq-bubble { width: 18px; height: 18px; border-radius: 4px; font-size: 0; pointer-events: none; flex-shrink: 0; }
.exam-submit-btn { margin-top: auto; width: 100%; }
.exam-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.exam-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--white); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.exam-timer { font-size: 1.4rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.exam-timer.exam-timer-warn { color: var(--danger); animation: timerPulse 1s ease infinite; }
@keyframes timerPulse { 0%,100% { opacity:1 } 50% { opacity:.6 } }
.exam-q-label { color: var(--mid); font-size: .9rem; font-weight: 600; }
.exam-card { flex: 1; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.exam-q-text { font-size: 1.15rem; font-weight: 700; color: var(--navy); line-height: 1.5; }
.exam-options { display: flex; flex-direction: column; gap: 10px; }
.exam-option { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; border-radius: 12px; border: 2px solid var(--border); background: var(--white); cursor: pointer; text-align: left; font-size: .95rem; color: var(--text); transition: border-color .15s, background .15s; }
.exam-option:hover { border-color: var(--blue-light); background: var(--blue-xlight); }
.exam-option.selected { border-color: var(--blue); background: var(--blue-xlight); }
.exam-opt-letter { width: 28px; height: 28px; border-radius: 50%; background: var(--border); color: var(--mid); font-weight: 700; font-size: .82rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.exam-option.selected .exam-opt-letter { background: var(--blue); color: white; }
.exam-opt-text { flex: 1; padding-top: 3px; }
.exam-nav-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-top: 1px solid var(--border); background: var(--white); flex-shrink: 0; }
.exam-nav-btn { min-width: 120px; }
.exam-flag-btn.active { background: var(--gold-light); color: var(--gold-dark); border-color: var(--gold-dark); }
.exam-submitted-card { background: var(--white); border-radius: 18px; padding: 56px 48px; text-align: center; box-shadow: var(--shadow-lg); border: 1px solid var(--border); max-width: 480px; width: 100%; margin: 20px; }
.exam-submitted-icon { font-size: 4rem; margin-bottom: 20px; }
.exam-submitted-card h2 { font-size: 1.5rem; font-weight: 800; color: var(--navy); margin-bottom: 12px; }
.exam-submitted-card p { color: var(--mid); line-height: 1.6; }
@media (max-width: 640px) {
  /* Compact sidebar: horizontal scrollable bubble strip */
  .exam-layout { flex-direction: column; }
  .exam-sidebar {
    width: 100%; min-width: 0;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 8px 12px 6px;
    gap: 6px;
    overflow: visible;
    flex-direction: column;
  }
  .exam-sidebar-head { display: none; }
  .exam-legend { display: none; }
  .exam-q-grid {
    display: flex !important;
    grid-template-columns: unset;
    overflow-x: auto;
    gap: 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .exam-q-grid::-webkit-scrollbar { display: none; }
  .eq-bubble { flex-shrink: 0; width: 26px; height: 26px; font-size: .72rem; border-radius: 5px; }
  .exam-submit-btn { width: 100%; margin-top: 2px; padding: 8px; font-size: .85rem; }

  /* Topbar */
  .exam-topbar { padding: 8px 14px; }
  .exam-timer { font-size: 1.1rem; }
  .exam-q-label { font-size: .8rem; }

  /* Question card: compact */
  .exam-card { padding: 12px 14px; gap: 10px; }
  .exam-q-text { font-size: .95rem; }
  .exam-option { padding: 9px 11px; gap: 8px; font-size: .88rem; }
  .exam-opt-letter { width: 24px; height: 24px; font-size: .75rem; }
  .exam-opt-text { padding-top: 2px; }

  /* Nav row */
  .exam-nav-row { padding: 9px 14px; gap: 6px; }
  .exam-nav-btn { min-width: 80px; font-size: .83rem; padding: 7px 11px; }
  .exam-flag-btn { font-size: .8rem; padding: 7px 9px; }
}

/* ===== QUIZ ===== */
.quiz-main { max-width: 680px; margin: calc(var(--header-h) + 40px) auto 40px; padding: 0 20px; }
.quiz-intro-card, .quiz-result-card {
  background: var(--white); border-radius: 18px; padding: 44px;
  text-align: center; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.quiz-icon  { font-size: 3.2rem; margin-bottom: 16px; display: block; }
.quiz-intro-card h2, .quiz-result-card h2 { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin-bottom: 12px; letter-spacing: -.4px; }
.quiz-intro-card p { color: var(--mid); margin-bottom: 22px; }
.quiz-rules { text-align: left; background: var(--blue-xlight); border-radius: 10px; padding: 16px 20px; margin-bottom: 28px; display: inline-block; border: 1px solid var(--blue-light); }
.quiz-rules li { color: var(--mid); font-size: .9rem; margin-bottom: 6px; }
.quiz-card { background: var(--white); border-radius: 18px; padding: 36px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.quiz-progress-row { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.quiz-progress-track { flex: 1; }
#quizProgressLabel { font-size: .82rem; color: var(--mid); white-space: nowrap; font-weight: 700; }
.quiz-question { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 22px; line-height: 1.55; }
.quiz-options  { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 18px;
  border: 2px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: all .18s;
  background: var(--white);
  text-align: left;
}
.quiz-option:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-xlight); }
.quiz-option.correct { border-color: var(--success); background: #f0fdf4; pointer-events: none; }
.quiz-option.wrong   { border-color: var(--danger);  background: #fef2f2; pointer-events: none; }
.quiz-option:disabled:not(.correct):not(.wrong) { opacity: .55; cursor: default; }
.option-letter {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem; flex-shrink: 0;
  color: var(--mid);
}
.quiz-option:hover:not(:disabled) .option-letter { border-color: var(--blue); color: var(--blue); }
.quiz-option.correct .option-letter { border-color: var(--success); background: var(--success); color: white; }
.quiz-option.wrong   .option-letter { border-color: var(--danger);  background: var(--danger);  color: white; }
.option-text { font-size: .9rem; color: var(--navy); line-height: 1.45; }
.quiz-feedback { border-radius: 9px; padding: 12px 16px; font-size: .875rem; font-weight: 600; margin-bottom: 16px; }
.quiz-feedback.correct { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.quiz-feedback.wrong   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.result-icon   { font-size: 4rem; margin-bottom: 16px; display: block; }
.result-score  { font-size: 3.5rem; font-weight: 900; color: var(--blue); margin: 12px 0; letter-spacing: -1px; }
.result-details{ background: var(--light); border-radius: 10px; padding: 16px 20px; margin: 22px 0; font-size: .875rem; color: var(--mid); }
.result-actions{ display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ===== ADMIN ===== */
.admin-page   { background: var(--light); }
.admin-layout { display: flex; margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }
.admin-nav {
  width: 210px; min-width: 210px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex; flex-direction: column; gap: 3px;
}
.admin-nav-label { padding: 6px 20px 4px; font-size: .68rem; font-weight: 800; color: var(--mid); text-transform: uppercase; letter-spacing: .08em; }
.admin-nav-btn {
  background: none; border: none; text-align: left;
  padding: 11px 20px;
  font-size: .875rem; font-weight: 600; color: var(--mid);
  border-left: 3px solid transparent;
  transition: all .15s;
  display: flex; align-items: center; gap: 9px;
}
.admin-nav-btn:hover  { background: var(--light); color: var(--navy); }
.admin-nav-btn.active { background: var(--blue-xlight); color: var(--blue); border-left-color: var(--blue); }
.admin-main { flex: 1; padding: 36px; max-width: 1100px; }
.admin-tab        { display: none; }
.admin-tab.active { display: block; }
.admin-section-title  { font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: 22px; letter-spacing: -.3px; }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; max-width: 560px; margin-bottom: 28px; }
.admin-stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 26px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.admin-stat-num   { font-size: 2.6rem; font-weight: 900; color: var(--blue); letter-spacing: -1px; }
.admin-stat-label { font-size: .75rem; color: var(--mid); margin-top: 5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.admin-form-card { background: var(--white); border-radius: var(--radius); padding: 26px; margin-bottom: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.admin-form-card h3 { font-size: 1rem; margin-bottom: 18px; font-weight: 700; color: var(--navy); }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.admin-table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table th { background: var(--light); padding: 13px 16px; text-align: left; font-weight: 700; color: var(--mid); border-bottom: 1px solid var(--border); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--blue-xlight); }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.role-badge { display: inline-block; padding: 3px 9px; border-radius: 5px; font-size: .72rem; font-weight: 700; }
.role-admin { background: var(--gold-light); color: #92400e; }
.role-user  { background: var(--blue-xlight); color: #1e40af; }
.admin-loading    { padding: 24px; color: var(--mid); font-size: .9rem; text-align: center; }
.admin-empty      { padding: 24px; color: var(--mid); font-size: .9rem; text-align: center; }
.admin-empty-small{ padding: 8px 16px; color: #94a3b8; font-size: .8rem; }
.admin-error      { color: var(--danger); padding: 16px; }
.admin-section-card { background: var(--white); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.admin-section-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--blue-xlight); gap: 12px; }
.admin-section-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.admin-sec-num   { font-size: .68rem; background: var(--blue); color: white; padding: 3px 9px; border-radius: 5px; font-weight: 800; white-space: nowrap; letter-spacing: .03em; }
.admin-sec-title { font-size: .95rem; font-weight: 700; color: var(--navy); }
.admin-section-actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-lessons-list  { padding: 6px 0; }
.admin-lesson-row { display: flex; align-items: center; padding: 10px 20px; gap: 12px; border-bottom: 1px solid var(--border); }
.admin-lesson-row:last-child { border-bottom: none; }
.admin-les-num   { font-size: .72rem; color: #94a3b8; min-width: 36px; font-weight: 600; }
.admin-les-title { flex: 1; font-size: .875rem; color: var(--navy); }
.admin-lesson-actions { display: flex; gap: 6px; }
.admin-quiz-section { border-top: 1px solid var(--border); background: #f8fafc; }
.admin-quiz-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; }
.admin-quiz-label { font-size: .8rem; font-weight: 700; color: var(--mid); text-transform: uppercase; letter-spacing: .4px; }
.admin-quiz-list { padding: 0 0 4px; }
.admin-quiz-row { display: flex; align-items: center; padding: 9px 20px; gap: 12px; border-top: 1px solid var(--border); }
.admin-quiz-q { flex: 1; font-size: .85rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-quiz-actions { display: flex; gap: 6px; flex-shrink: 0; }
.quiz-options-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.quiz-option-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.quiz-option-row input[type=radio] { cursor: pointer; width: 18px; height: 18px; accent-color: var(--success); }
.quiz-opt-input { width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.quiz-opt-input:focus { outline: none; border-color: var(--blue); }
.quiz-correct-hint { font-size: .75rem; color: var(--mid); margin-top: 4px; }
.exam-review-q { background: var(--light); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.exam-review-q-text { font-weight: 700; font-size: .9rem; color: var(--navy); margin-bottom: 10px; }
.exam-review-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: .87rem; margin-bottom: 4px; }
.exam-review-opt.user-answer { background: #fef9c3; }
.exam-review-opt.correct-answer { background: #f0fdf4; border: 1px solid #bbf7d0; }
.exam-review-opt.both { background: #dcfce7; border: 1px solid var(--success); }
.exam-review-opt.wrong-answer { background: #fef2f2; border: 1px solid #fecaca; }
.exam-review-score { font-size: 1.3rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.exam-review-meta { font-size: .82rem; color: var(--mid); margin-bottom: 20px; }
.submission-row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.submission-row:last-child { border-bottom: none; }
.sub-user { font-weight: 600; color: var(--navy); }
.sub-meta { font-size: .8rem; color: var(--mid); }
.sub-score { font-size: .85rem; font-weight: 700; }
.sub-status { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.sub-status.pending { background: #fef9c3; color: #92400e; }
.sub-status.passed  { background: #dcfce7; color: #166534; }
.sub-status.failed  { background: #fef2f2; color: var(--danger); }
.modal-lg { max-width: 820px; }
.admin-fq-row { display: flex; align-items: center; padding: 11px 16px; gap: 12px; border-bottom: 1px solid var(--border); }
.admin-fq-row:last-child { border-bottom: none; }
.admin-fq-num { font-size: .75rem; color: var(--mid); min-width: 28px; font-weight: 600; }
.admin-fq-q   { flex: 1; font-size: .88rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-fq-actions { display: flex; gap: 6px; flex-shrink: 0; }

.exam-info-pop { text-align: center; padding: 12px 8px 4px; }
.exam-info-icon { font-size: 3.4rem; margin-bottom: 14px; }
.exam-info-pop h4 { font-size: 1.25rem; font-weight: 800; color: var(--navy); margin-bottom: 12px; }
.exam-info-pop p { color: var(--mid); line-height: 1.6; margin-bottom: 10px; }
.exam-info-hint { font-size: .88rem; color: var(--blue); font-weight: 600; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-overlay:not(.hidden) { animation: modalFade .22s ease both; }
.modal-card { background: var(--white); border-radius: 16px; width: 100%; max-width: 860px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-overlay:not(.hidden) .modal-card { animation: modalPop .3s cubic-bezier(.22,1,.36,1) both; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-sm { max-width: 480px; }
.modal-reg { max-width: 560px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; font-weight: 800; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--mid); line-height: 1; border-radius: 6px; padding: 2px 6px; }
.modal-close:hover { color: var(--danger); background: #fef2f2; }
.modal-body { padding: 26px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 26px; border-top: 1px solid var(--border); }
/* "Add images & graphics" checkbox in the AI/bulk generators */
.ai-img-toggle { display: flex; align-items: flex-start; gap: 9px; margin-top: 6px; padding: 11px 13px; background: var(--blue-xlight); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-size: .9rem; color: var(--navy); font-weight: 600; }
.ai-img-toggle input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.ai-img-toggle small { display: block; font-weight: 400; color: var(--mid); font-size: .8rem; margin-top: 2px; }
.editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-btn { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: .75rem; background: var(--light); color: var(--navy); font-weight: 600; transition: all .15s; }
.tool-btn:hover { background: var(--blue-xlight); border-color: var(--blue); color: var(--blue); }
.preview-btn { margin-left: auto; background: var(--navy); color: var(--white); border-color: var(--navy); }
.preview-btn:hover { background: var(--navy2); }
.editor-wrap textarea { width: 100%; min-height: 300px; font-family: 'Consolas', 'Monaco', monospace; font-size: .82rem; line-height: 1.5; padding: 12px; border: 2px solid var(--border); border-radius: 9px; resize: vertical; outline: none; }
.editor-wrap textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.lesson-preview-pane { min-height: 300px; border: 2px solid var(--border); border-radius: 9px; padding: 18px; background: var(--white); overflow-y: auto; }

/* ===== CHAPTER QUIZ ===== */
.chapter-quiz-cta {
  margin: 0 32px 32px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: flex; align-items: center; gap: 20px;
  box-shadow: 0 4px 24px rgba(13,31,60,.18);
}
.cqa-icon { font-size: 2.4rem; flex-shrink: 0; }
.cqa-text { flex: 1; }
.cqa-text h3 { color: var(--white); font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.cqa-text p  { color: rgba(255,255,255,.72); font-size: .9rem; }

.chapter-quiz-panel {
  margin: 0 32px 48px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cq-panel-header {
  position: relative;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
  padding: 28px 36px 24px;
  color: var(--white);
}
.cq-panel-close {
  position: absolute; top: 16px; right: 18px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none;
  color: var(--white); font-size: 1.4rem; line-height: 1;
  cursor: pointer; transition: background .15s;
  display: flex; align-items: center; justify-content: center;
}
.cq-panel-close:hover { background: rgba(255,255,255,.26); }

/* intro + attempt history */
.cq-intro { padding: 32px 36px 40px; }
.cq-attempts { margin-bottom: 28px; }
.cq-attempts-empty {
  text-align: center; padding: 28px 20px; color: var(--mid);
  background: var(--blue-xlight); border-radius: 12px;
}
.cq-attempts-empty-icon { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.cq-attempts-empty p { font-size: .92rem; }

.cq-best-card {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 24px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-xlight) 0%, #eef4ff 100%);
  border: 1px solid var(--blue-light);
  margin-bottom: 18px;
}
.cq-best-card.passed {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #bbf7d0;
}
.cq-best-icon { font-size: 2.6rem; flex-shrink: 0; }
.cq-best-info { display: flex; flex-direction: column; flex: 1; }
.cq-best-label { font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--mid); }
.cq-best-score { font-size: 1.5rem; font-weight: 900; color: var(--navy); }
.cq-best-score em { font-style: normal; font-size: 1rem; font-weight: 700; color: var(--blue); }
.cq-best-meta { display: flex; flex-direction: column; gap: 4px; text-align: right; }
.cq-best-meta span { font-size: .8rem; font-weight: 600; color: var(--mid); }

.cq-attempts-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cq-attempts-title {
  font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--mid); padding: 12px 18px; background: var(--light);
  border-bottom: 1px solid var(--border);
}
.cq-attempt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.cq-attempt-row:last-child { border-bottom: none; }
.cq-attempt-date { color: var(--mid); flex: 1; }
.cq-attempt-score { font-weight: 700; color: var(--navy); }
.cq-attempt-pill {
  font-size: .72rem; font-weight: 800; padding: 4px 11px; border-radius: 20px;
  white-space: nowrap;
}
.cq-attempt-pill.pass { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.cq-attempt-pill.fail { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.cq-intro .btn-large { width: 100%; }
.cq-panel-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: white;
  font-size: .72rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px;
  margin-bottom: 10px;
}
.cq-panel-header h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.cq-panel-sub { color: rgba(255,255,255,.65); font-size: .875rem; }

.cq-loading { padding: 48px; text-align: center; color: var(--mid); font-size: .95rem; }

/* question screen */
#cqScreen { padding: 36px; }
.cq-progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.cq-progress-row span { font-size: .82rem; font-weight: 700; color: var(--mid); white-space: nowrap; }
.cq-progress-track { flex: 1; height: 8px; }
.cq-question-text {
  font-size: 1.1rem; font-weight: 700; color: var(--navy);
  line-height: 1.5; margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--blue-xlight);
  border-radius: 10px;
  border-left: 4px solid var(--blue);
}
.cq-options-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
.cq-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--white); border: 2px solid var(--border);
  border-radius: 10px; text-align: left;
  font-size: .9rem; font-weight: 500; color: var(--navy);
  transition: all .15s; cursor: pointer;
}
.cq-option:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-xlight); transform: translateY(-1px); }
.cq-option:disabled { cursor: not-allowed; }
.cq-opt-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--light); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; flex-shrink: 0;
  color: var(--mid);
}
.cq-option.cq-correct { border-color: var(--success); background: #f0fdf4; }
.cq-option.cq-correct .cq-opt-letter { background: var(--success); border-color: var(--success); color: white; }
.cq-option.cq-wrong   { border-color: var(--danger);  background: #fef2f2; }
.cq-option.cq-wrong .cq-opt-letter  { background: var(--danger);  border-color: var(--danger);  color: white; }

.cq-feedback {
  padding: 14px 18px; border-radius: 9px;
  font-size: .9rem; line-height: 1.55; margin-bottom: 20px;
}
.cq-fb-correct { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.cq-fb-wrong   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.cq-nav { display: flex; justify-content: flex-end; }

/* result panel */
.cq-result-panel {
  padding: 52px 36px;
  text-align: center;
}
.cqr-icon { font-size: 3.5rem; margin-bottom: 16px; }
.cq-result-panel h3 { font-size: 1.6rem; font-weight: 900; color: var(--navy); margin-bottom: 14px; }
.cqr-score { margin-bottom: 12px; }
.cqr-num { font-size: 2.2rem; font-weight: 900; color: var(--blue); }
.cqr-pct { font-size: 1.2rem; font-weight: 700; color: var(--mid); margin-left: 8px; }
.cq-result-panel p { color: var(--mid); font-size: 1rem; margin-bottom: 32px; }
.cqr-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* sidebar quiz link */
.nav-quiz-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px 9px 28px;
  font-size: .82rem; color: #94a3b8;
  cursor: pointer; transition: color .15s;
  font-style: italic;
}
.nav-quiz-link:hover { color: var(--blue); }

/* ===== RESPONSIVE ===== */
/* ===== TABLET / MOBILE ===== */
@media (max-width: 900px) {
  /* Course/lesson sidebar becomes an off-canvas drawer with scrim */
  .sidebar { box-shadow: 0 10px 40px rgba(0,0,0,.4); }
  .portal-main, .lesson-main { margin-left: 0 !important; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 280px; --header-h: 58px; }

  /* Header: compact, hide greeting text */
  .portal-header { padding: 0 14px; }
  .header-right { gap: 8px; }
  .user-greeting { display: none; }
  .header-right > strong#headerUserName { display: none; }
  .btn-back { padding: 6px 11px; font-size: .78rem; }
  .btn-back span { display: none; }
  .btn-back::before { content: '←'; font-size: .9rem; }
  .btn-logout { padding: 6px 11px; font-size: .76rem; }
  .header-logo-img { height: 30px; max-width: 130px; }

  /* Off-canvas sidebar */
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .portal-main, .lesson-main { margin-left: 0 !important; padding: 16px; }
  .sidebar-scrim.visible { display: block; }

  .welcome-banner { flex-direction: column; padding: 22px 18px; gap: 18px; }
  .welcome-stats { width: 100%; }

  /* Admin: turn the side nav into a top tab bar (was hidden before!) */
  .admin-layout { flex-direction: column; }
  .admin-nav {
    width: 100%; min-width: 0;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px; gap: 6px;
    position: sticky; top: var(--header-h); z-index: 50;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-label { display: none; }
  .admin-nav-btn {
    white-space: nowrap; flex-shrink: 0;
    border-left: none; border-radius: 9px;
    padding: 9px 15px;
  }
  .admin-nav-btn.active { border-left-color: transparent; background: var(--blue); color: #fff; }
  .admin-main { padding: 20px 16px; max-width: 100%; }
  .admin-section-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .admin-section-header .btn-primary { width: 100%; }
  .admin-form-grid { grid-template-columns: 1fr; }

  /* Tables scroll horizontally instead of overflowing */
  .admin-table-wrap { overflow-x: auto; }
  .admin-table { min-width: 640px; }

  /* Appointments admin cards stack */
  .admin-appt-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .admin-appt-date { min-width: 0; }
  .admin-appt-actions { flex-wrap: wrap; }

  .lesson-content { padding: 22px 18px; }
  .lesson-footer { flex-wrap: wrap; gap: 10px; }
  .lesson-footer .btn-primary, .lesson-footer .btn-secondary { flex: 1; }
  .quiz-card, .quiz-intro-card, .quiz-result-card { padding: 28px 20px; }
  .auth-card { padding: 32px 24px; }
  .chapter-quiz-cta { flex-direction: column; text-align: center; margin: 0 16px 24px; padding: 24px 20px; }
  .chapter-quiz-panel { margin: 0 16px 32px; }
  .cq-options-grid { grid-template-columns: 1fr; }
  #cqScreen { padding: 24px 18px; }
  .cq-result-panel { padding: 36px 18px; }
  .cq-intro { padding: 24px 18px 32px; }
  .cq-best-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cq-best-meta { text-align: left; flex-direction: row; gap: 14px; }
  .cq-attempt-row { flex-wrap: wrap; gap: 6px 12px; }
  .dashboard-tiles { grid-template-columns: 1fr; gap: 16px; }

  .appt-card { flex-direction: column; }
  .appt-date-col { flex-direction: row; gap: 14px; padding: 14px 20px; min-width: unset; align-items: center; }
  .appointments-main { padding: 0 16px; margin-top: calc(var(--header-h) + 16px); }

  /* Modals: near full screen, scrollable */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card { max-width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal-reg, .modal-sm, .modal-quiz { max-width: 100%; }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 14px 18px; }
  .reg-billing-options { flex-direction: column; }
  .reg-radio { min-width: 0; }
  .reg-overview-banner { flex-direction: column; text-align: center; padding: 20px; }
  .reg-overview-footer { flex-direction: column; align-items: stretch; }
  .reg-overview-footer .btn-secondary { width: 100%; }
  .regs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .portal-header { padding: 0 10px; }
  .header-left { gap: 8px; }
  .header-right { gap: 6px; }
  .header-logo-img { height: 26px; max-width: 104px; }
  .btn-back { padding: 6px 9px; }
  .btn-logout { padding: 6px 9px; }
  .welcome-stats { flex-wrap: wrap; }
  .stat-card { flex: 1; min-width: 90px; }
  .practice-intro-title { font-size: 1.6rem; }
  .reg-overview-title { font-size: 1.2rem; }
  .quiz-pop-nav { flex-direction: column-reverse; }
  .quiz-pop-nav .btn-primary, .quiz-pop-nav .btn-secondary { width: 100%; }
  .admin-section-title { font-size: 1.2rem; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn-primary, .modal-footer .btn-secondary { width: 100%; }

  /* Chapter quiz popup: flex layout so nav/feedback never scroll off screen */
  .modal-card.modal-quiz { display: flex; flex-direction: column; max-height: 94vh; }
  .modal-quiz .modal-body {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
    padding: 12px 16px;
  }
  .modal-quiz .quiz-pop-topbar { flex-shrink: 0; margin-bottom: 10px; }
  .modal-quiz .quiz-question { flex: 1; min-height: 0; overflow-y: auto; font-size: .92rem; margin-bottom: 8px; }
  .modal-quiz .quiz-options { flex-shrink: 0; gap: 7px; margin-bottom: 0; }
  .modal-quiz .quiz-option { padding: 9px 12px; font-size: .87rem; gap: 9px; }
  .modal-quiz .option-letter { width: 26px; height: 26px; font-size: .8rem; }
  .modal-quiz .quiz-feedback { flex-shrink: 0; font-size: .8rem; max-height: 65px; overflow-y: auto; margin-top: 6px; }
  .modal-quiz .quiz-pop-nav { flex-shrink: 0; margin-top: 8px; }
}

/* ===== DASHBOARD TILES ===== */
.dashboard-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.dash-tile {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .15s, border-color .18s;
  cursor: pointer;
}
.dash-tile:not(.tile-locked):hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--blue); }
.dash-tile.tile-locked { background: #f8fafc; border-style: dashed; border-color: #cbd5e1; cursor: default; }
.dash-tile-icon { font-size: 2.2rem; line-height: 1; display: block; }
.tile-locked .dash-tile-icon { filter: grayscale(1); opacity: .35; }
.dash-tile-title { font-size: 1.1rem; font-weight: 800; color: var(--navy); }
.dash-tile-desc  { font-size: .875rem; color: var(--mid); line-height: 1.5; }
.tile-locked .dash-tile-title, .tile-locked .dash-tile-desc { color: var(--mid); }
.dash-tile-progress { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--mid); font-weight: 600; }
.dash-tile-progress .progress-bar-track { flex: 1; }
.dash-tile-lock {
  display: flex; align-items: center; gap: 8px;
  background: #e2e8f0; border-radius: 8px; padding: 9px 13px;
  font-size: .82rem; color: var(--mid); font-weight: 600;
}
.dash-tile-lock-icon { font-size: .9rem; }
.dash-tile .btn-primary { margin-top: auto; }
.tile-locked .btn-primary {
  background: #e2e8f0 !important; color: #94a3b8 !important;
  box-shadow: none !important; cursor: not-allowed; pointer-events: none;
}
.tile-exam-passed .dash-tile-title::after { content: ' ✓'; color: var(--success); font-size: .9rem; }
.btn-gold { background: var(--gold) !important; color: var(--navy) !important; box-shadow: 0 2px 8px rgba(245,158,11,.3) !important; }
.btn-gold:hover { background: var(--gold-dark) !important; }

/* ===== APPOINTMENTS ===== */
.appointments-main {
  max-width: 860px;
  margin: calc(var(--header-h) + 32px) auto 40px;
  padding: 0 24px;
}
.appointments-header { margin-bottom: 28px; }
.appointments-header h1 { font-size: 1.7rem; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.appointments-header p { color: var(--mid); font-size: .95rem; }

/* ── Learning materials (Schulungsmaterial) ─────────────────────────── */
.materials-main {
  max-width: 900px;
  margin: calc(var(--header-h) + 32px) auto 40px;
  padding: 0 24px;
}
.material-grid { display: flex; flex-direction: column; gap: 14px; }
.material-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.material-card:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(37,99,235,.12); transform: translateY(-1px); }
.material-card-icon { font-size: 1.9rem; flex-shrink: 0; }
.material-card-body { flex: 1; min-width: 0; }
.material-card-title { font-size: 1.08rem; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
.material-card-summary { font-size: .9rem; color: var(--mid); margin: 0; }
.material-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.material-reader-bar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.material-article {
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  padding: 32px 34px;
}
.material-article-title { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin: 0 0 18px; line-height: 1.25; }
.material-ad {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 16px;
  font-size: .82rem;
  font-style: italic;
  color: var(--blue);
  opacity: .85;
}
.material-ad-logo { height: 22px; width: auto; }

@media (max-width: 640px) {
  .materials-main { padding: 0 14px; margin-top: calc(var(--header-h) + 16px); }
  .material-card { flex-wrap: wrap; padding: 16px; }
  .material-card-actions { width: 100%; }
  .material-card-actions .btn-sm { flex: 1; }
  .material-article { padding: 22px 18px; }
  .material-reader-bar { flex-direction: column; }
  .material-reader-bar .btn-secondary, .material-reader-bar .btn-primary { width: 100%; }
}
.appointments-list { display: flex; flex-direction: column; gap: 16px; }
.appt-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.appt-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.appt-date-col {
  background: var(--navy);
  color: white;
  padding: 22px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 96px; text-align: center; flex-shrink: 0;
}
.appt-day     { font-size: 2.2rem; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.appt-month   { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.65); margin-top: 4px; }
.appt-weekday { font-size: .7rem; color: rgba(255,255,255,.4); margin-top: 3px; }
.appt-body { flex: 1; padding: 20px 24px; }
.appt-title { font-size: 1.1rem; font-weight: 800; color: var(--navy); margin-bottom: 10px; }
.appt-meta  { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.appt-meta-item { display: flex; align-items: center; gap: 5px; font-size: .83rem; color: var(--mid); font-weight: 500; }
.appt-meta-icon { font-size: .95rem; }
.appt-desc  { font-size: .875rem; color: var(--mid); line-height: 1.6; margin-bottom: 14px; }
.appt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.appt-participants { font-size: .8rem; color: var(--mid); font-weight: 500; }
.appt-actions { display: flex; align-items: center; gap: 8px; }
.appt-registered-badge { background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46; font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 6px; }
.appt-full-badge       { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 6px; }
.appointments-empty {
  background: var(--white); border-radius: var(--radius);
  padding: 60px 24px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.appointments-empty p { color: var(--mid); font-size: 1rem; margin-top: 12px; }

/* Admin appointments */
.admin-appt-list { display: flex; flex-direction: column; gap: 12px; }
.admin-appt-card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
}
.admin-appt-date {
  background: var(--navy); color: white; border-radius: 8px;
  padding: 8px 14px; text-align: center; font-size: .82rem;
  font-weight: 700; white-space: nowrap; min-width: 90px; line-height: 1.5;
}
.admin-appt-info { flex: 1; min-width: 0; }
.admin-appt-title { font-size: .95rem; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.admin-appt-meta  { font-size: .8rem; color: var(--mid); }

/* ===== PRACTICE PAGE ===== */
.practice-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}
.practice-intro-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  text-align: center;
}
.practice-intro-title { font-size: 2rem; font-weight: 900; color: var(--navy); margin-bottom: 10px; }
.practice-intro-sub   { color: var(--mid); font-size: 1rem; margin-bottom: 32px; }
.practice-mode-grid   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.practice-mode-btn {
  position: relative;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .18s, box-shadow .18s, transform .12s;
  cursor: pointer;
}
.practice-mode-btn:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 20px rgba(37,99,235,.15);
  transform: translateY(-2px);
}
.practice-mode-icon  { font-size: 2.4rem; }
.practice-mode-title { font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.practice-mode-desc  { font-size: .82rem; color: var(--mid); line-height: 1.45; }
.practice-wrong-badge {
  position: absolute;
  top: -10px; right: -10px;
  background: var(--danger);
  color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.practice-intro-msg {
  color: var(--mid);
  font-size: .9rem;
  margin-top: 4px;
  padding: 12px 16px;
  background: var(--light);
  border-radius: 8px;
}

/* quiz area */
.practice-quiz-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.practice-mode-label {
  font-size: .85rem; font-weight: 700;
  color: var(--blue);
  background: var(--blue-xlight);
  padding: 4px 12px;
  border-radius: 20px;
}
.practice-quiz-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 36px 28px;
  margin-top: 16px;
}
.practice-section-tag {
  font-size: .78rem; font-weight: 700;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}
.practice-card-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}

/* result */
.practice-result { display: flex; justify-content: center; }
.practice-result-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 60px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

/* chapter selection */
.practice-chapter-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; text-align: left; }
.practice-chapter-btn {
  display: flex; align-items: center; gap: 16px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color .18s, box-shadow .18s, transform .12s;
  cursor: pointer;
  text-align: left;
}
.practice-chapter-btn:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 16px rgba(37,99,235,.12);
  transform: translateY(-1px);
}
.practice-chapter-num {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-xlight);
  color: var(--blue);
  border-radius: 9px;
  font-weight: 800; font-size: 1rem;
}
.practice-chapter-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.practice-chapter-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.practice-chapter-count { font-size: .8rem; color: var(--mid); }
.practice-chapter-arrow { flex-shrink: 0; color: var(--blue); font-size: 1.2rem; font-weight: 700; }
.practice-chapter-back { margin-top: 4px; }

@media (max-width: 700px) {
  .practice-mode-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .practice-intro-card { padding: 32px 20px; }
  .practice-quiz-card  { padding: 24px 16px 20px; }
  .practice-result-card{ padding: 40px 20px; }
}
.admin-appt-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== PROGRESS EDIT MODAL ===== */
.progress-modal-toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.progress-modal-toolbar .btn-sm { background: var(--light); color: var(--mid); }
.progress-modal-toolbar .btn-sm:hover { background: var(--border); color: var(--navy); }
.progress-tree { display: flex; flex-direction: column; gap: 18px; }
.progress-sec { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.progress-sec-title { font-size: .9rem; font-weight: 800; color: var(--navy); margin-bottom: 10px; }
.progress-lesson {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 7px;
  font-size: .9rem; color: var(--navy); cursor: pointer;
  transition: background .14s;
}
.progress-lesson:hover { background: var(--blue-xlight); }
.progress-lesson input { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.progress-exam-toggle {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 20px; padding: 14px 16px;
  background: var(--gold-light); border: 1px solid #fde68a; border-radius: 10px;
  font-size: .875rem; color: var(--navy); cursor: pointer;
}
.progress-exam-toggle input { width: 18px; height: 18px; accent-color: var(--gold-dark); cursor: pointer; flex-shrink: 0; margin-top: 1px; }

/* ===== APPOINTMENT REGISTRATION FORM ===== */
.reg-hint { font-size: .875rem; color: var(--mid); background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 9px; padding: 11px 14px; margin-bottom: 20px; }
.reg-file-input { padding: 9px; border: 1.5px dashed var(--border); border-radius: 9px; width: 100%; font-size: .88rem; cursor: pointer; background: var(--light); transition: border-color .18s; }
.reg-file-input:hover { border-color: var(--blue); }
.reg-photo-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.reg-photo-preview img { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--border); object-fit: contain; background: var(--light); }
.reg-photo-status { font-size: .82rem; color: var(--success); font-weight: 600; }
.passport-hint { background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 9px; padding: 10px 14px; margin: 8px 0 10px; font-size: .83rem; color: var(--navy); }
.passport-hint strong { display: block; margin-bottom: 5px; font-size: .85rem; color: var(--blue-dark); }
.passport-hint ul { padding-left: 16px; list-style: disc; }
.passport-hint li { margin-bottom: 2px; color: var(--mid); }
.reg-billing { margin: 6px 0 18px; }
.reg-billing-label { font-size: .825rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .02em; display: block; margin-bottom: 10px; }
.reg-billing-options { display: flex; gap: 12px; flex-wrap: wrap; }
.reg-radio {
  flex: 1; min-width: 160px;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: .9rem; font-weight: 600; color: var(--navy); cursor: pointer;
  transition: border-color .16s, background .16s;
}
.reg-radio:hover { border-color: var(--blue); }
.reg-radio:has(input:checked) { border-color: var(--blue); background: var(--blue-xlight); }
.reg-radio input { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }

/* ===== REGISTERED OVERVIEW (Google Maps) ===== */
.reg-overview { animation: authItemIn .5s ease both; }
.reg-overview-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #fff; border-radius: var(--radius); padding: 22px 26px; margin-bottom: 22px;
  box-shadow: 0 6px 22px rgba(16,185,129,.3);
}
.reg-overview-check {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 900;
}
.reg-overview-banner h2 { font-size: 1.35rem; font-weight: 800; }
.reg-overview-banner p { font-size: .9rem; opacity: .92; margin-top: 2px; }
.reg-overview-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); padding: 28px; }
.reg-overview-title { font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: 20px; }
.reg-overview-facts { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.reg-fact { display: flex; align-items: flex-start; gap: 13px; }
.reg-fact-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.3; }
.reg-fact-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mid); font-weight: 700; }
.reg-fact-value { display: block; font-size: 1rem; font-weight: 600; color: var(--navy); margin-top: 1px; }
.reg-overview-desc { background: var(--gold-light); border: 1px solid #fde68a; border-radius: 10px; padding: 14px 16px; margin-bottom: 22px; }
.reg-overview-desc strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #92400e; margin-bottom: 5px; }
.reg-overview-desc p { font-size: .9rem; color: var(--navy); line-height: 1.6; }
.reg-overview-map { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 10px; }
.reg-overview-map iframe { display: block; }
.reg-map-link { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--blue); margin-bottom: 22px; }
.reg-map-link:hover { text-decoration: underline; }
.reg-overview-footer { border-top: 1px solid var(--border); padding-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.reg-overview-note { font-size: .82rem; color: var(--mid); flex: 1; min-width: 200px; }
.reg-overview-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== ADMIN REGISTRATIONS LIST ===== */
.regs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.regs-card { display: flex; gap: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--white); }
.regs-photos-col { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; align-items: center; }
.regs-photo { width: 82px; height: 58px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); display: block; }
.regs-photo.regs-passport { width: 58px; height: 78px; }
.regs-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.regs-photo:hover img { transform: scale(1.05); }
.regs-photo-empty { display: flex; align-items: center; justify-content: center; font-size: .65rem; color: var(--mid); background: var(--light); text-align: center; padding: 4px; }
.regs-photo-caption { font-size: .68rem; color: var(--mid); text-align: center; }
.regs-info { flex: 1; min-width: 0; }
.regs-name { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.regs-meta { font-size: .8rem; color: var(--mid); line-height: 1.5; }
.regs-meta strong { color: var(--navy); font-weight: 600; }

/* ===== SMOOTH PAGE / CHAPTER TRANSITIONS ===== */
@keyframes contentFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes contentFade { from { opacity: 0; } to { opacity: 1; } }
.lesson-content { animation: contentFadeUp .45s ease both; }
.lesson-header-bar, .lesson-nav-row { animation: contentFade .5s ease both; }
.portal-main .welcome-banner { animation: contentFadeUp .5s ease both; }
.dashboard-tiles .dash-tile { animation: contentFadeUp .5s ease both; }
.dashboard-tiles .dash-tile:nth-child(1) { animation-delay: .04s; }
.dashboard-tiles .dash-tile:nth-child(2) { animation-delay: .10s; }
.dashboard-tiles .dash-tile:nth-child(3) { animation-delay: .16s; }
.dashboard-tiles .dash-tile:nth-child(4) { animation-delay: .22s; }
.sections-overview .section-card { animation: contentFadeUp .5s ease both; }
.practice-quiz-card, .practice-intro-card, .practice-result-card { animation: contentFadeUp .4s ease both; }
.quiz-option { transition: background .16s, border-color .16s, transform .12s, box-shadow .16s; }
.quiz-option:not(:disabled):hover { transform: translateX(3px); }
.quiz-feedback:not(.hidden) { animation: contentFadeUp .35s ease both; }
.nav-section-items { transition: max-height .25s ease; }
/* shared quiz progress bar (practice page + chapter popup) */
.quiz-progress-bar-wrap { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.quiz-progress-bar { height: 100%; background: linear-gradient(90deg, var(--blue), #60a5fa); border-radius: 99px; transition: width .4s ease; }

/* ===== CHAPTER QUIZ POPUP ===== */
.modal-quiz { max-width: 600px; }
.quiz-pop-topbar { margin-bottom: 18px; }
.quiz-pop-topbar .quiz-progress-label { display: block; font-size: .8rem; color: var(--mid); font-weight: 600; margin-bottom: 7px; }
.quiz-pop-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.quiz-pop-nav.center { justify-content: center; }
.quiz-pop-result { text-align: center; padding: 20px 0 8px; }
.quiz-pop-result .result-icon { font-size: 3rem; }
.quiz-pop-result .result-title { font-size: 1.3rem; font-weight: 800; color: var(--navy); margin: 8px 0; }
.quiz-pop-result .result-score { font-size: 1.6rem; font-weight: 900; color: var(--blue); margin-bottom: 8px; letter-spacing: -.5px; }

/* ===== ADMIN REDESIGN / POLISH ===== */
.admin-page { background: linear-gradient(180deg, #f8fafc 0%, var(--light) 100%); }
.admin-nav { box-shadow: 1px 0 0 var(--border); }
.admin-nav-btn { border-radius: 0 8px 8px 0; margin-right: 10px; }
.admin-nav-btn.active { font-weight: 700; box-shadow: inset 0 0 0 1px var(--blue-light); }
.admin-main { animation: contentFade .4s ease both; }

/* Stat cards — colored, with hover lift */
.admin-stats-grid { max-width: 640px; }
.admin-stat-card {
  position: relative; overflow: hidden;
  padding: 24px 22px; text-align: left;
  transition: box-shadow .2s, transform .15s;
}
.admin-stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--blue);
}
.admin-stat-card:nth-child(2)::before { background: var(--gold); }
.admin-stat-card:nth-child(3)::before { background: var(--success); }
.admin-stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.admin-stat-num { font-size: 2.8rem; line-height: 1; }
.admin-stat-card:nth-child(2) .admin-stat-num { color: var(--gold-dark); }
.admin-stat-card:nth-child(3) .admin-stat-num { color: var(--success); }
.admin-stat-label { margin-top: 8px; }

/* Section header with accent */
.admin-section-title { position: relative; padding-left: 14px; }
.admin-section-title::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 5px;
  background: linear-gradient(180deg, var(--blue), var(--gold)); border-radius: 99px;
}

/* Cards & tables lift */
.admin-section-card { transition: box-shadow .2s; }
.admin-section-card:hover { box-shadow: var(--shadow-lg); }
.admin-table th:first-child { padding-left: 20px; }
.admin-table td:first-child { padding-left: 20px; font-weight: 600; }
.admin-appt-card { transition: box-shadow .2s, transform .15s; }
.admin-appt-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

/* Buttons in admin feel a touch more substantial */
.admin-page .btn-primary { padding: 10px 20px; }

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher { position: relative; }
.lang-switcher-floating { position: fixed; top: 16px; right: 16px; z-index: 150; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .82rem; font-weight: 700;
  transition: background .18s, border-color .18s;
}
.lang-btn:hover { background: rgba(37,99,235,.25); border-color: var(--blue); }
.lang-flag { font-size: 1.05rem; line-height: 1; }
.lang-caret { font-size: .65rem; opacity: .7; }
.lang-switcher-floating .lang-btn { background: var(--white); color: var(--navy); border-color: var(--border); box-shadow: var(--shadow); }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 200;
  animation: modalPop .18s ease both;
}
[dir=rtl] .lang-menu { right: auto; left: 0; }
.lang-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: none; padding: 9px 12px; border-radius: 7px;
  font-size: .88rem; font-weight: 600; color: var(--navy); transition: background .14s;
}
.lang-item:hover { background: var(--blue-xlight); }
.lang-item.active { background: var(--blue-xlight); color: var(--blue); }

/* First-login language picker */
.lang-firstrun {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy2) 55%, #1e3a6e 100%);
  display: flex; align-items: flex-start; justify-content: center; padding: 20px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: modalFade .3s ease both;
}
.lang-firstrun-card {
  background: var(--white); border-radius: 20px; padding: 40px 36px;
  max-width: 480px; width: 100%; text-align: center;
  margin: auto; /* centers when it fits, but stays scrollable when taller than the viewport */
  box-shadow: 0 24px 70px rgba(0,0,0,.35); animation: authCardIn .6s cubic-bezier(.22,1,.36,1) both;
}
.lang-firstrun-globe { font-size: 3rem; margin-bottom: 10px; }
.lang-firstrun-card h2 { font-size: 1.6rem; font-weight: 900; color: var(--navy); margin-bottom: 8px; }
.lang-firstrun-sub { color: var(--mid); font-size: .92rem; margin-bottom: 26px; }
.lang-firstrun-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.lang-firstrun-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border: 2px solid var(--border); border-radius: 11px;
  background: var(--white); font-size: .95rem; font-weight: 700; color: var(--navy);
  cursor: pointer; transition: border-color .16s, background .16s, transform .12s;
}
.lang-firstrun-opt:hover { border-color: var(--blue); transform: translateY(-1px); }
.lang-firstrun-opt.active { border-color: var(--blue); background: var(--blue-xlight); color: var(--blue); }
.lang-firstrun-opt .lang-flag { font-size: 1.3rem; }

/* RTL adjustments */
[dir=rtl] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid rgba(255,255,255,.05); }
[dir=rtl] .portal-main, [dir=rtl] .lesson-main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir=rtl] .sidebar.collapsed { transform: translateX(var(--sidebar-w)); }
[dir=rtl] .nav-lesson, [dir=rtl] .admin-nav-btn { text-align: right; }
[dir=rtl] .admin-nav-btn { border-left: none; border-right: 3px solid transparent; }
[dir=rtl] .admin-nav-btn.active { border-right-color: var(--blue); }
@media (max-width: 768px) {
  [dir=rtl] .portal-main, [dir=rtl] .lesson-main { margin-right: 0; }
  [dir=rtl] .sidebar { transform: translateX(var(--sidebar-w)); }
  [dir=rtl] .sidebar.open { transform: translateX(0); }
  /* First-run language picker: keep two compact columns so all 14 languages
     stay reachable, and tighten spacing so the card scrolls smoothly on phones. */
  .lang-firstrun { padding: 14px; }
  .lang-firstrun-card { padding: 26px 18px; }
  .lang-firstrun-globe { font-size: 2.2rem; margin-bottom: 6px; }
  .lang-firstrun-card h2 { font-size: 1.3rem; }
  .lang-firstrun-sub { margin-bottom: 16px; }
  .lang-firstrun-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
  .lang-firstrun-opt { padding: 11px 10px; font-size: .9rem; gap: 7px; }
  .lang-firstrun-opt .lang-flag { font-size: 1.15rem; }
  .lang-btn .lang-code { display: none; }
}

/* ===== CONTENT LANGUAGE TABS (lesson / section editor) ===== */
.lesson-lang-tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
}
.lesson-lang-tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 7px 11px 8px; font-size: .78rem; font-weight: 700; color: var(--mid);
  margin-bottom: -2px; border-radius: 6px 6px 0 0; cursor: pointer;
  transition: color .14s, border-color .14s, background .14s;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.lesson-lang-tab:hover { color: var(--navy); background: var(--light); }
.lesson-lang-tab.active { color: var(--blue); border-bottom-color: var(--blue); background: var(--blue-xlight); }
@media (max-width: 600px) { .lesson-lang-tab { padding: 6px 8px; font-size: .72rem; } }
.lang-autohint {
  font-size: .78rem; color: var(--mid); background: var(--blue-xlight);
  border: 1px solid var(--blue-light); border-radius: 8px;
  padding: 8px 11px; margin: 10px 0 4px; line-height: 1.4;
}

/* ===== ADMIN VIDEO EDITOR ===== */
.video-editor { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.video-editor-head label { font-size: .9rem; font-weight: 800; color: var(--navy); display: block; }
.video-editor-hint { font-size: .8rem; color: var(--mid); margin: 4px 0 12px; }
.video-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.video-field label { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.video-field textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: .8rem; font-family: monospace; resize: vertical; }
.video-field textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.regs-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* Practical-day documents (admin registrations modal) */
.regs-docs { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.regs-doc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.regs-doc-label { font-size: .8rem; font-weight: 700; color: var(--navy); }
.regs-doc-missing { font-size: .8rem; color: var(--muted); font-style: italic; }
.regs-doc-view { background: var(--blue-xlight); color: var(--blue); border: 1px solid var(--blue-light); text-decoration: none; }
.regs-upload-btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; background: var(--navy); color: #fff; border: none; border-radius: 7px; padding: 5px 10px; font-size: .78rem; font-weight: 600; }
.regs-upload-btn:hover { opacity: .9; }
.regs-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.regs-photo-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.regs-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.regs-photo-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(220,38,38,.92); color: #fff; font-size: .7rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Participant view of their practical-day documents */
.reg-overview-docs { background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 10px; padding: 16px 18px; margin-bottom: 22px; }
.reg-overview-docs strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--blue); margin-bottom: 10px; }
.reg-doc-download { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); color: #fff; text-decoration: none; border-radius: 8px; padding: 9px 16px; font-size: .88rem; font-weight: 600; }
.reg-doc-download:hover { opacity: .92; }
.reg-doc-photos-label { font-size: .85rem; font-weight: 700; color: var(--navy); margin: 14px 0 8px; }
.reg-doc-photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.reg-doc-photo { width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); display: block; }
.reg-doc-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .15s; }
.reg-doc-photo:hover img { transform: scale(1.05); }

@media (max-width: 600px) { .video-fields { grid-template-columns: 1fr; } }

/* ===== LESSON TRAINING VIDEO ===== */
.lesson-video {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 22px;
  animation: contentFadeUp .45s ease both;
}
.lesson-video-heading { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.lesson-video-icon { font-size: 1.2rem; }
.lesson-video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.lesson-video-frame iframe, .lesson-video-frame video, .lesson-video-frame embed, .lesson-video-frame object {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-delay: 0s !important; }
}

/* ===== BACKGROUND TASK BAR ===== */
.taskbar {
  position: fixed; right: 20px; bottom: 20px; z-index: 4000;
  width: 330px; max-width: calc(100vw - 32px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(13,31,60,.22), 0 2px 8px rgba(13,31,60,.12);
  overflow: hidden;
  animation: taskbarIn .25s ease;
}
.taskbar.hidden { display: none; }
@keyframes taskbarIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.taskbar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
  color: var(--white);
}
.taskbar-title { font-size: .82rem; font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.taskbar-count {
  background: rgba(255,255,255,.22); color: #fff;
  font-size: .7rem; font-weight: 800; min-width: 19px; height: 19px;
  border-radius: 10px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.taskbar-collapse {
  background: rgba(255,255,255,.14); border: none; color: #fff;
  width: 24px; height: 24px; border-radius: 6px; font-size: .85rem; line-height: 1;
  transition: background .15s;
}
.taskbar-collapse:hover { background: rgba(255,255,255,.28); }

.taskbar-list { max-height: 50vh; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.taskbar.collapsed .taskbar-list { display: none; }

.taskcard {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; background: var(--white);
  animation: taskbarIn .2s ease;
}
.taskcard.done  { border-color: #bbf7d0; background: #f0fdf4; }
.taskcard.error { border-color: #fecaca; background: #fef2f2; }

.taskcard-top { display: flex; align-items: center; gap: 10px; }
.taskcard-text { flex: 1; min-width: 0; }
.taskcard-title { font-size: .85rem; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.taskcard-sub { font-size: .74rem; color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.taskcard-pct { font-size: .76rem; font-weight: 800; color: var(--blue); flex-shrink: 0; }

.taskcard-spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2.5px solid var(--blue-light); border-top-color: var(--blue);
  border-radius: 50%; animation: taskSpin .7s linear infinite;
}
@keyframes taskSpin { to { transform: rotate(360deg); } }

.taskcard-icon {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 900; color: #fff;
}
.taskcard.done  .taskcard-icon { background: var(--success); }
.taskcard.error .taskcard-icon { background: var(--danger); }

.taskcard-close {
  background: none; border: none; color: var(--mid); font-size: 1.15rem; line-height: 1;
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 5px; transition: all .15s;
}
.taskcard-close:hover { background: rgba(0,0,0,.07); color: var(--navy); }

.taskcard-bar { height: 6px; background: var(--light); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.taskcard-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue) 0%, #4f86f7 100%); border-radius: 4px; transition: width .35s ease; }

.taskcard-action {
  width: 100%; margin-top: 9px; padding: 7px 10px;
  background: var(--blue); color: #fff; border: none; border-radius: 7px;
  font-size: .78rem; font-weight: 700; transition: background .15s;
}
.taskcard-action:hover { background: var(--blue-dark); }
.taskcard.error .taskcard-action { background: var(--danger); }

@media (max-width: 640px) {
  .taskbar { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

/* ===== USER CHAT WIDGET ===== */
.chatw { position: fixed; right: 22px; bottom: 22px; z-index: 4500; }
.chatw-launcher {
  position: relative; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border: none; box-shadow: 0 6px 20px rgba(37,99,235,.42);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s, box-shadow .18s;
}
.chatw-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 28px rgba(37,99,235,.5); }
.chatw-launcher.active { transform: scale(.96); }
.chatw-launcher-icon { font-size: 1.6rem; line-height: 1; }
.chatw-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.chatw-badge.hidden, .chatw-panel.hidden, .chatw-choice.hidden, .chatw-convo.hidden { display: none; }

.chatw-panel {
  position: absolute; right: 0; bottom: 74px;
  width: 374px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 120px);
  background: var(--white); border-radius: 18px;
  box-shadow: 0 16px 48px rgba(13,31,60,.28), 0 4px 12px rgba(13,31,60,.14);
  display: flex; flex-direction: column; overflow: hidden;
  animation: chatwIn .22s ease;
}
@keyframes chatwIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.chatw-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
  color: #fff; flex-shrink: 0;
}
.chatw-header-main { display: flex; flex-direction: column; gap: 2px; }
.chatw-header-title { font-size: 1rem; font-weight: 800; }
.chatw-header-sub { font-size: .76rem; color: rgba(255,255,255,.68); }
.chatw-close {
  background: rgba(255,255,255,.14); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 8px; font-size: 1.3rem; line-height: 1;
  transition: background .15s;
}
.chatw-close:hover { background: rgba(255,255,255,.28); }

/* choice screen */
.chatw-choice { padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; }
.chatw-choice-q { font-size: 1rem; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 4px; }
.chatw-choice-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px 18px; border-radius: 14px;
  background: var(--white); border: 2px solid var(--border);
  transition: all .15s;
}
.chatw-choice-btn:hover { border-color: var(--blue); background: var(--blue-xlight); transform: translateY(-1px); }
.chatw-choice-ic { font-size: 1.8rem; flex-shrink: 0; }
.chatw-choice-tx { display: flex; flex-direction: column; gap: 3px; }
.chatw-choice-tx strong { font-size: .92rem; font-weight: 800; color: var(--navy); }
.chatw-choice-tx small { font-size: .77rem; color: var(--mid); line-height: 1.35; }

/* conversation */
.chatw-convo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chatw-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chatw-tab {
  flex: 1; padding: 11px 8px; background: var(--light); border: none;
  font-size: .8rem; font-weight: 700; color: var(--mid);
  border-bottom: 2px solid transparent; transition: all .15s;
}
.chatw-tab:hover { color: var(--navy); }
.chatw-tab.active { background: var(--white); color: var(--blue); border-bottom-color: var(--blue); }

.chatw-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; }
.chatw-loading, .chatw-empty { text-align: center; color: var(--mid); font-size: .85rem; padding: 24px 12px; line-height: 1.5; }

.chatw-msg { display: flex; flex-direction: column; max-width: 82%; }
.chatw-msg.from-user { align-self: flex-end; align-items: flex-end; }
.chatw-msg.from-ai, .chatw-msg.from-instructor { align-self: flex-start; align-items: flex-start; }
.chatw-msg-label { font-size: .68rem; font-weight: 800; color: var(--mid); margin-bottom: 3px; padding: 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.chatw-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: .87rem; line-height: 1.45;
  word-wrap: break-word; white-space: normal;
}
.from-user .chatw-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.from-ai .chatw-bubble { background: #fff; color: var(--navy); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.from-instructor .chatw-bubble { background: var(--navy); color: #fff; border-bottom-left-radius: 4px; }
.chatw-msg-time { font-size: .66rem; color: var(--mid); margin-top: 3px; padding: 0 4px; }

.chatw-typing { display: flex; gap: 4px; align-items: center; }
.chatw-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--mid); opacity: .5; animation: chatwBlink 1.2s infinite; }
.chatw-typing span:nth-child(2) { animation-delay: .2s; }
.chatw-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chatwBlink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.chatw-input { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.chatw-input textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; font-size: .87rem; line-height: 1.4; max-height: 110px;
  outline: none; transition: border-color .15s;
}
.chatw-input textarea:focus { border-color: var(--blue); }
.chatw-send {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue); color: #fff; border: none; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.chatw-send:hover:not(:disabled) { background: var(--blue-dark); }
.chatw-send:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
  .chatw { right: 14px; bottom: 14px; }
  .chatw-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); bottom: 70px; }
}

/* ===== ADMIN CHATS ===== */
.admin-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800;
  border-radius: 9px;
}
.admin-nav-badge.hidden { display: none; }

.admin-chats-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; min-height: 520px; }
.admin-chats-list {
  border: 1px solid var(--border); border-radius: 12px; overflow-y: auto;
  max-height: 620px; background: var(--white);
}
.admin-chat-item { padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.admin-chat-item:hover { background: var(--blue-xlight); }
.admin-chat-item.active { background: var(--blue-xlight); border-left: 3px solid var(--blue); padding-left: 13px; }
.admin-chat-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-chat-item-name { font-weight: 700; color: var(--navy); font-size: .9rem; }
.admin-chat-item-badge {
  background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-chat-item-preview { font-size: .8rem; color: var(--mid); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.admin-chat-view { border: 1px solid var(--border); border-radius: 12px; background: var(--white); display: flex; flex-direction: column; min-height: 520px; }
.admin-chat-empty { margin: auto; color: var(--mid); font-size: .9rem; padding: 40px; text-align: center; }
.admin-chat-active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.admin-chat-active.hidden { display: none; }
.admin-chat-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.admin-chat-name { font-weight: 800; color: var(--navy); font-size: 1rem; }
.admin-chat-email { font-size: .8rem; color: var(--mid); }
.admin-chat-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; max-height: 460px; }

.admin-cmsg { display: flex; flex-direction: column; max-width: 78%; }
.admin-cmsg.mine { align-self: flex-end; align-items: flex-end; }
.admin-cmsg.theirs { align-self: flex-start; align-items: flex-start; }
.admin-cmsg-label { font-size: .68rem; font-weight: 700; color: var(--mid); margin-bottom: 3px; padding: 0 4px; }
.admin-cmsg-bubble { padding: 10px 14px; border-radius: 12px; font-size: .87rem; line-height: 1.45; }
.admin-cmsg.mine .admin-cmsg-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.admin-cmsg.theirs .admin-cmsg-bubble { background: #fff; color: var(--navy); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.admin-chat-reply { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: flex-end; }
.admin-chat-reply textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: .87rem; line-height: 1.4; outline: none; }
.admin-chat-reply textarea:focus { border-color: var(--blue); }

@media (max-width: 768px) {
  .admin-chats-layout { grid-template-columns: 1fr; }
  .admin-chats-list { max-height: 240px; }
}

/* ===== POST-COURSE COMPLETED GATE ===== */
.completed-gate { max-width: 920px; margin: 0 auto; padding: 30px 20px 60px; }
.cg-inner { display: flex; flex-direction: column; gap: 26px; }
.cg-hero { text-align: center; background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff; border-radius: 18px; padding: 40px 28px; box-shadow: 0 10px 30px rgba(13,31,60,.25); }
.cg-hero-badge { font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.cg-hero h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 8px; }
.cg-hero p { font-size: .98rem; opacity: .9; max-width: 560px; margin: 0 auto; }
.cg-block-title { font-size: 1.05rem; font-weight: 800; color: var(--navy); margin-bottom: 14px; }

/* Slideshow */
.cg-slideshow { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.cg-slide-frame { position: relative; display: flex; align-items: center; justify-content: center; background: #0b1424; border-radius: 12px; overflow: hidden; min-height: 240px; }
.cg-slide-img { max-width: 100%; max-height: 460px; display: block; object-fit: contain; }
.cg-slide-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff; border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.6rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.cg-slide-nav:hover { background: rgba(0,0,0,.7); }
.cg-slide-nav.cg-prev { left: 12px; }
.cg-slide-nav.cg-next { right: 12px; }
.cg-slide-caption { text-align: center; font-size: .9rem; color: var(--mid); margin-top: 12px; }
.cg-slide-dots { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.cg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); cursor: pointer; transition: background .15s, transform .15s; }
.cg-dot.active { background: var(--blue); transform: scale(1.25); }

/* Action tiles */
.cg-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cg-tile { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 20px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cg-tile:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(37,99,235,.12); transform: translateY(-2px); }
.cg-tile-ic { font-size: 1.9rem; flex-shrink: 0; }
.cg-tile-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cg-tile-tx strong { font-size: 1.02rem; color: var(--navy); }
.cg-tile-tx small { font-size: .84rem; color: var(--mid); }
.cg-tile-disabled { opacity: .6; }

/* Completed-gate modals */
.cg-due-box { background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 9px; padding: 12px 14px; font-size: .9rem; color: var(--navy); margin-bottom: 16px; }
.cg-due-box:empty { display: none; }
.cg-due-ok { color: var(--success); font-weight: 700; }
.cg-cost-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.cg-cost-box strong { color: var(--gold-dark); font-size: 1rem; }
.cg-cost-box p { font-size: .85rem; color: var(--mid); margin-top: 4px; }
.cg-consent { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; color: var(--navy); cursor: pointer; margin-top: 4px; }
.cg-consent input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.cg-success { text-align: center; padding: 10px 0; }
.cg-success-ic { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: #ecfdf5; color: var(--success); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.cg-success p { font-size: .92rem; color: var(--mid); margin-bottom: 10px; }
.cg-bank { background: var(--navy); color: #e2e8f0; border-radius: 10px; padding: 14px 16px; font-size: .86rem; white-space: pre-wrap; text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 8px 0 12px; }

/* Admin: completion tab */
.role-completed { background: #ecfdf5 !important; color: #065f46 !important; }
.completion-code-form { display: flex; gap: 10px; flex-wrap: wrap; }
.completion-code-form input { flex: 1; min-width: 160px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.completion-status { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: .82rem; background: var(--white); }

@media (max-width: 768px) {
  .cg-actions { grid-template-columns: 1fr; }
  .cg-hero h1 { font-size: 1.4rem; }
}

/* ===== CHAT FILE ATTACHMENTS ===== */
.chatw-attach { display: flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; color: var(--mid); transition: color .15s, background .15s; flex-shrink: 0; }
.chatw-attach:hover { color: var(--blue); background: var(--blue-xlight); }
.chatw-input-col { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chatw-attach-preview { display: flex; align-items: center; gap: 6px; background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 8px; padding: 6px 10px; font-size: .82rem; }
.chatw-attach-img-prev { max-height: 56px; max-width: 80px; border-radius: 6px; object-fit: cover; }
.chatw-attach-file-prev { color: var(--navy); font-weight: 500; }
.chatw-attach-clear { background: none; border: none; color: var(--mid); font-size: 1.1rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.chatw-attach-clear:hover { color: var(--danger); }
.chatw-msg-img { max-width: 220px; max-height: 260px; border-radius: 10px; display: block; cursor: pointer; margin-bottom: 4px; object-fit: cover; }
.chatw-msg-file { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border-radius: 8px; padding: 7px 10px; text-decoration: none; color: inherit; font-size: .83rem; margin-bottom: 4px; }
.from-user .chatw-msg-file { background: rgba(255,255,255,.22); color: #fff; }
.chatw-bubble-text:empty { display: none; }

/* ===== ADMIN CHAT FILE ATTACHMENTS ===== */
.admin-chat-attach-btn { display: flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer; padding: 8px; border-radius: 8px; color: var(--mid); align-self: flex-end; transition: color .15s, background .15s; flex-shrink: 0; }
.admin-chat-attach-btn:hover { color: var(--blue); background: var(--blue-xlight); }
.admin-chat-reply-col { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-chat-file-preview { display: flex; align-items: center; gap: 6px; background: var(--blue-xlight); border: 1px solid var(--blue-light); border-radius: 8px; padding: 5px 10px; font-size: .82rem; }
.admin-chat-file-img-prev { max-height: 48px; max-width: 72px; border-radius: 6px; object-fit: cover; }
.admin-chat-file-name-prev { color: var(--navy); font-weight: 500; }
.admin-chat-file-clear { background: none; border: none; color: var(--mid); font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.admin-chat-file-clear:hover { color: var(--danger); }
.admin-cmsg-img { max-width: 240px; max-height: 280px; border-radius: 10px; display: block; cursor: pointer; margin-bottom: 4px; object-fit: cover; }
.admin-cmsg-file { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.06); border-radius: 8px; padding: 7px 10px; text-decoration: none; color: inherit; font-size: .83rem; margin-bottom: 4px; }
.admin-cmsg.mine .admin-cmsg-file { background: rgba(255,255,255,.2); color: #fff; }

/* ===== CHAT CONTEXT MENU ===== */
.chat-ctx-menu { position: fixed; z-index: 9999; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px 0; min-width: 168px; }
.chat-ctx-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 16px; font-size: .88rem; color: var(--navy); cursor: pointer; transition: background .12s; }
.chat-ctx-menu button:hover { background: var(--blue-xlight); color: var(--blue); }
#chatCtxDelete:hover { background: #fef2f2; color: var(--danger); }

/* ===== USER ROW HIGHLIGHT (jump from chat) ===== */
.user-highlight { animation: highlight-pulse 2.5s ease-out; }
@keyframes highlight-pulse { 0%,20% { background: #dbeafe; } 100% { background: transparent; } }

/* ===== ADMIN HEADER ACTIONS ===== */
.admin-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== BULK LESSON EDITOR MODAL ===== */
.modal-bulk { background: var(--white); border-radius: 14px; width: min(92vw, 860px); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.modal-bulk-header { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); position: relative; }
.modal-bulk-header h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--navy); }
.modal-bulk-sub { margin: 0; font-size: .8rem; color: var(--mid); }
.modal-bulk-close { position: absolute; top: 16px; right: 18px; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--mid); line-height: 1; padding: 4px 6px; border-radius: 6px; }
.modal-bulk-close:hover { background: var(--blue-xlight); color: var(--navy); }
.modal-bulk-body { flex: 1; overflow-y: auto; padding: 16px 24px; }
.modal-bulk-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.bulk-save-status { flex: 1; font-size: .85rem; }
.bulk-loading { color: var(--mid); font-size: .9rem; text-align: center; padding: 24px; }
.bulk-section { margin-bottom: 24px; }
.bulk-section-header { font-weight: 700; font-size: .95rem; color: var(--navy); background: var(--blue-xlight); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.bulk-lesson-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.bulk-lesson-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bulk-lesson-title { font-size: .88rem; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-family: inherit; }
.bulk-lesson-content { font-size: .8rem; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-family: monospace; resize: vertical; }
.bulk-lesson-status { font-size: .85rem; font-weight: 600; min-width: 28px; text-align: center; padding-top: 4px; }
