/* ===================================================
   Weiirdoo – Design System v2
   Brand: #F4B400 · Navy: #1E3A5F · Inter + Plus Jakarta Sans
=================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

/* ── Design Tokens ───────────────────────────────── */
:root {
  --brand:       #F4B400;
  --brand-dark:  #C9960A;
  --brand-light: #FEF3C7;
  --brand-glow:  rgba(244,180,0,.25);

  --bg:          #F0F4F8;
  --surface:     #FFFFFF;
  --surface2:    #F1F5F9;
  --surface3:    #E8EDF3;
  --border:      #E2E8F0;

  --text:        #0F172A;
  --text-muted:  #64748B;
  --text-subtle: #94A3B8;

  --success:     #16A34A; --success-bg: #DCFCE7; --success-border: #BBF7D0;
  --info:        #2563EB; --info-bg:    #DBEAFE; --info-border:    #BFDBFE;
  --danger:      #DC2626; --danger-bg:  #FEE2E2; --danger-border:  #FECACA;
  --warning:     #D97706; --warning-bg: #FEF3C7; --warning-border: #FDE68A;
  --purple:      #7C3AED; --purple-bg:  #EDE9FE; --purple-border:  #DDD6FE;

  --sidebar-w:         260px;
  --sidebar-bg:        #1E3A5F;
  --sidebar-border:    rgba(255,255,255,.09);
  --sidebar-text:      #CBD5E1;
  --sidebar-muted:     #7FA3C4;
  --sidebar-hover:     rgba(255,255,255,.07);
  --sidebar-active-bg: rgba(244,180,0,.18);
  --sidebar-active-tx: #F4B400;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --shadow-md: 0 4px 24px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.12);

  --t-fast: .12s ease;
  --t-base: .2s ease;
  --t-slow: .35s cubic-bezier(.4,0,.2,1);

  --bottom-nav-h: 68px;
}

/* ── Dark Mode ───────────────────────────────────── */
[data-theme="dark"] {
  --brand-light: rgba(244,180,0,.13);
  --brand-glow:  rgba(244,180,0,.2);

  --bg:          #0B1120;
  --surface:     #131F35;
  --surface2:    #1B2B42;
  --surface3:    #243346;
  --border:      #2A3D55;

  --text:        #E8F0F8;
  --text-muted:  #94A3B8;
  --text-subtle: #6B7F98;

  --success:     #4ADE80; --success-bg: rgba(74,222,128,.12); --success-border: rgba(74,222,128,.25);
  --info:        #60A5FA; --info-bg:    rgba(96,165,250,.12);  --info-border:    rgba(96,165,250,.25);
  --danger:      #F87171; --danger-bg:  rgba(248,113,113,.12); --danger-border:  rgba(248,113,113,.25);
  --warning:     #FBBF24; --warning-bg: rgba(251,191,36,.12);  --warning-border: rgba(251,191,36,.25);
  --purple:      #A78BFA; --purple-bg:  rgba(167,139,250,.12); --purple-border:  rgba(167,139,250,.25);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.45), 0 4px 16px rgba(0,0,0,.25);
  --shadow-md: 0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.55);

  --sidebar-bg:        #0C1829;
  --sidebar-border:    rgba(255,255,255,.06);
  --sidebar-hover:     rgba(255,255,255,.06);
  --sidebar-active-bg: rgba(244,180,0,.14);
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--t-slow), color var(--t-base);
}
img { max-width: 100%; display: block; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Typography ──────────────────────────────────── */
h1, h2, h3, h4, h5 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
a  { color: var(--info); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand); }
p  { color: var(--text-muted); line-height: 1.7; }
code { font-family: 'Fira Code', 'Cascadia Code', monospace; font-size: .875em; background: var(--surface2); padding: 2px 6px; border-radius: 4px; }

/* ── Layout ──────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform var(--t-slow), box-shadow var(--t-base);
  box-shadow: 4px 0 32px rgba(0,0,0,.22);
}
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo a {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.2rem; font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -.3px;
}
.logo-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #E89E00);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 17px; color: #111; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(244,180,0,.35);
}
.logo-sub { font-size: .65rem; font-weight: 500; color: var(--sidebar-muted); letter-spacing: .04em; line-height: 1; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 10px; }
.nav-section { margin-bottom: 28px; }
.nav-section-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--sidebar-muted);
  padding: 0 10px 8px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--sidebar-text); font-size: .875rem; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast); margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-tx);
  font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--brand); border-radius: 0 2px 2px 0;
}
.nav-icon { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--sidebar-border);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--sidebar-hover);
  transition: background var(--t-fast);
  cursor: pointer;
}
.user-pill:hover { background: rgba(255,255,255,.12); }
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #111827;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(244,180,0,.3);
}
.user-pill .info { flex: 1; min-width: 0; }
.user-pill .uname { font-size: .83rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill .urole { font-size: .7rem; color: var(--sidebar-muted); }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  transition: background-color var(--t-slow), border-color var(--t-base);
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 9px;
  font-size: 18px; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background var(--t-fast), color var(--t-fast);
}
.menu-toggle:hover { background: var(--surface2); color: var(--text); }

/* Dark mode toggle */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  color: var(--text-muted);
}
.theme-toggle:hover { background: var(--brand-light); border-color: var(--brand); transform: scale(1.08); }

/* Topbar avatar */
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #111; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.topbar-greeting { font-size: .82rem; color: var(--text-muted); }
.topbar-greeting strong { color: var(--text); font-weight: 600; }

/* Page Body */
.page-body {
  padding: 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* Page Header */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-header-title h1 { font-size: 1.6rem; font-weight: 800; }
.page-header-title p { color: var(--text-muted); font-size: .875rem; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.card-body { }
.card-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Stat Cards ──────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex; align-items: flex-start; gap: 16px;
  box-shadow: var(--shadow);
  transition: all var(--t-base);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--brand), #FFD760); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--info), #60A5FA); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #4ADE80); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--danger), #F87171); }

.stat-icon {
  width: 50px; height: 50px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.yellow { background: var(--brand-light); }
.stat-icon.blue   { background: var(--info-bg); }
.stat-icon.green  { background: var(--success-bg); }
.stat-icon.purple { background: var(--purple-bg); }
.stat-icon.red    { background: var(--danger-bg); }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 2rem; font-weight: 800; color: var(--text);
  line-height: 1; letter-spacing: -1px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  margin-top: 6px;
}
.stat-trend.up   { background: var(--success-bg); color: var(--success); }
.stat-trend.down { background: var(--danger-bg); color: var(--danger); }
.stat-trend.flat { background: var(--surface2); color: var(--text-muted); }

/* ── Grid ────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2    { grid-template-columns: repeat(2, 1fr); }
.grid-3    { grid-template-columns: repeat(3, 1fr); }
.grid-4    { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.col-span-2 { grid-column: span 2; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: .875rem;
  font-weight: 600; border: none; cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap; text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--brand); color: #111; }
.btn-primary:hover  { background: var(--brand-dark); color: #fff; box-shadow: 0 4px 12px var(--brand-glow); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); color: var(--text); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #B91C1C; box-shadow: 0 4px 12px rgba(220,38,38,.3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; }
.btn-info    { background: var(--info); color: #fff; }
.btn-info:hover    { background: #1D4ED8; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--surface2); color: var(--text); }
.btn-sm  { padding: 6px 12px; font-size: .8rem; border-radius: 7px; }
.btn-lg  { padding: 13px 28px; font-size: 1rem; border-radius: 10px; }
.btn-xl  { padding: 16px 36px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon  { padding: 8px; border-radius: var(--radius-sm); aspect-ratio: 1; }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; font-family: inherit; color: var(--text);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-slow);
  outline: none;
}
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.form-control::placeholder { color: var(--text-subtle); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }

/* ── Tables ──────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: .73rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--surface2); }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.badge-yellow  { background: var(--brand-light); color: #92400E; border: 1px solid #FDE68A; }
.badge-green   { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-blue    { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-red     { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-gray    { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple  { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }

[data-theme="dark"] .badge-yellow { color: #F4B400; }

/* Dot indicator */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-green  { background: var(--success); }
.dot-red    { background: var(--danger); }
.dot-yellow { background: var(--brand); }
.dot-gray   { background: var(--text-subtle); }

/* ── Alerts / Flash ──────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: .875rem; font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px;
  animation: slideDown .3s ease;
  border: 1px solid transparent;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.alert-close   { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: 16px; padding: 0; flex-shrink: 0; }
.alert-close:hover { opacity: 1; }

/* ── Progress ─────────────────────────────────────── */
.progress-bar  { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); transition: width .7s cubic-bezier(.4,0,.2,1); }
.progress-fill.blue   { background: linear-gradient(90deg, var(--info), #60A5FA); }
.progress-fill.green  { background: linear-gradient(90deg, var(--success), #4ADE80); }
.progress-fill.purple { background: linear-gradient(90deg, var(--purple), #A78BFA); }

/* Progress Ring (SVG) */
.progress-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-text {
  position: absolute;
  text-align: center; line-height: 1.1;
}
.progress-ring-pct  { font-size: 1.2rem; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; color: var(--text); display: block; }
.progress-ring-sub  { font-size: .65rem; color: var(--text-muted); font-weight: 500; display: block; }

/* ── Course Cards ─────────────────────────────────── */
.course-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--t-base); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.course-thumb {
  width: 100%; height: 155px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--brand-light), #FEF9EE);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  flex-shrink: 0;
}
[data-theme="dark"] .course-thumb { background: linear-gradient(135deg, rgba(244,180,0,.12), rgba(244,180,0,.05)); }
.course-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-title { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.course-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.course-meta  { display: flex; gap: 10px; flex-wrap: wrap; font-size: .75rem; color: var(--text-muted); margin-top: 12px; }
.course-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* ── Lesson Layout ────────────────────────────────── */
.lesson-layout { display: grid; grid-template-columns: 1fr 300px; gap: 0; min-height: calc(100vh - 60px); }
.lesson-main    { padding: 28px; overflow-y: auto; }
.lesson-sidebar {
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto; position: sticky; top: 60px;
  height: calc(100vh - 60px);
}
.lesson-sidebar-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.lesson-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; cursor: pointer;
  font-size: .84rem; border-left: 3px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  color: var(--text-muted);
}
.lesson-item:hover { background: var(--surface2); color: var(--text); }
.lesson-item.active { background: var(--brand-light); border-left-color: var(--brand); color: var(--brand-dark); }
.lesson-item.done   { color: var(--text); }
[data-theme="dark"] .lesson-item.active { color: var(--brand); }

.check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 9px; flex-shrink: 0; }
.check.done { background: var(--success); border-color: var(--success); color: #fff; }

/* ── Video Player ─────────────────────────────────── */
.video-container { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-md); }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* ── Auth Layout ──────────────────────────────────── */
.auth-page  { min-height: 100vh; display: flex; align-items: stretch; }
.auth-panel {
  width: 50%; padding: 60px;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--surface);
}
.auth-brand {
  width: 50%; padding: 60px;
  background: linear-gradient(135deg, #0f1c35 0%, #1a2f52 50%, #1E3A5F 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; color: #fff; position: relative; overflow: hidden;
}
.auth-brand::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(244,180,0,.12) 0%, transparent 70%);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo-big { font-size: 60px; margin-bottom: 20px; }
.auth-tagline  { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 12px; line-height: 1.2; }
.auth-sub      { font-size: 1rem; color: rgba(255,255,255,.65); max-width: 340px; line-height: 1.65; }
.auth-features { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; text-align: left; max-width: 300px; }
.auth-feature  { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: rgba(255,255,255,.75); }
.auth-feature-icon { width: 28px; height: 28px; border-radius: 7px; background: rgba(244,180,0,.2); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.auth-form         { max-width: 400px; width: 100%; margin: 0 auto; }
.auth-mobile-logo  { display: none; }
.auth-mobile-card  { }
.auth-card-header  { margin-bottom: 24px; }
.auth-card-footer  { }
.input-icon-wrap   { position: relative; }
.auth-logo   { margin-bottom: 32px; }
.auth-title  { font-size: 1.7rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.auth-hint   { font-size: .875rem; color: var(--text-muted); margin-bottom: 0; }

/* ── Divider ─────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }

/* ── Pagination ──────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 24px; flex-wrap: wrap; }
.page-btn {
  padding: 7px 13px; border-radius: 7px; border: 1px solid var(--border);
  font-size: .84rem; font-weight: 500; background: var(--surface);
  color: var(--text); cursor: pointer; transition: all var(--t-fast); text-decoration: none;
  display: inline-flex; align-items: center;
}
.page-btn:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #111; font-weight: 700; }

/* ── Quiz ─────────────────────────────────────────── */
.quiz-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: all var(--t-fast);
  margin-bottom: 10px;
}
.quiz-option:hover { border-color: var(--brand); background: var(--brand-light); }
.quiz-option input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.quiz-option label { cursor: pointer; font-weight: 500; flex: 1; }

/* ── Charts ──────────────────────────────────────── */
.chart-container { position: relative; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); }
.chart-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Empty States ─────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon  { font-size: 48px; line-height: 1; }
.empty-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.empty-desc  { font-size: .875rem; color: var(--text-muted); max-width: 320px; }

/* ── Activity Feed ────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
.activity-dot-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; padding-top: 3px; }
.activity-text { font-size: .875rem; color: var(--text); line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: .75rem; color: var(--text-subtle); margin-top: 3px; }

/* ── Welcome Banner ───────────────────────────────── */
.welcome-banner {
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #1E3A5F 0%, #1a5276 60%, #1E3A5F 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.welcome-banner::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(244,180,0,.10);
}
.welcome-banner::after {
  content: ''; position: absolute; bottom: -50px; right: 80px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.welcome-banner > * { position: relative; z-index: 1; }
.welcome-text h2 { color: #fff; font-size: 1.5rem; margin-bottom: 6px; }
.welcome-text p  { color: rgba(255,255,255,.7); font-size: .9rem; margin: 0; }
.welcome-badge {
  background: rgba(244,180,0,.2); border: 1px solid rgba(244,180,0,.35);
  color: var(--brand); font-size: .8rem; font-weight: 700;
  padding: 5px 12px; border-radius: 99px; display: inline-block; margin-top: 10px;
}
.welcome-emoji { font-size: 64px; flex-shrink: 0; }

/* ── Skeleton Loading ─────────────────────────────── */
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: skeleton-wave 1.5s infinite; }
@keyframes skeleton-wave { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Info Row ─────────────────────────────────────── */
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text-muted); font-weight: 500; }
.info-row-value { font-weight: 600; color: var(--text); }

/* ── Course Row ───────────────────────────────────── */
.course-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--surface2); margin-bottom: 8px;
  transition: background var(--t-fast);
}
.course-row:hover { background: var(--surface3); }
.course-row-thumb {
  width: 44px; height: 44px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-light), #FEF9EE);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
[data-theme="dark"] .course-row-thumb { background: rgba(244,180,0,.1); }
.course-row-body { flex: 1; min-width: 0; }
.course-row-title { font-size: .875rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-row-meta  { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }

/* ── Mobile Bottom Nav ────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 300; height: var(--bottom-nav-h);
  padding: 0 8px; align-items: center; justify-content: space-around;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  transition: background-color var(--t-slow);
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 12px; border-radius: 12px; flex: 1; max-width: 80px;
  color: var(--text-muted); font-size: .62rem; font-weight: 600;
  text-decoration: none; transition: all var(--t-fast); text-align: center;
}
.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--brand); background: var(--brand-light); }
[data-theme="dark"] .bottom-nav-item.active { background: rgba(244,180,0,.12); }
.bottom-nav-item .bn-icon { font-size: 20px; line-height: 1; }
.bottom-nav-item .bn-label { line-height: 1; }

/* ── Sidebar Overlay ──────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 199;
  backdrop-filter: blur(2px);
  transition: opacity var(--t-base);
}
.sidebar-overlay.visible { display: block; }

/* ── Utilities ────────────────────────────────────── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-6 { padding: 24px; }
.text-muted    { color: var(--text-muted); }
.text-subtle   { color: var(--text-subtle); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-brand    { color: var(--brand); }
.text-sm   { font-size: .85rem; }
.text-xs   { font-size: .75rem; }
.text-lg   { font-size: 1.1rem; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.w-full    { width: 100%; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden    { display: none !important; }
.rounded   { border-radius: var(--radius); }
.separator { height: 1px; background: var(--border); margin: 20px 0; }
.overflow-hidden { overflow: hidden; }

/* ── Animations ───────────────────────────────────── */
@keyframes slideDown  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp    { from { opacity: 0; transform: translateY(10px);  } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn    { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse      { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes spin       { to { transform: rotate(360deg); } }

.animate-fade   { animation: fadeIn  .4s ease; }
.animate-slide  { animation: slideUp .35s ease; }
.animate-scale  { animation: scaleIn .3s ease; }

/* Count-up animation target */
.counter-animated { transition: none; }

/* ── Responsive Mobile ────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.35); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; padding-bottom: calc(var(--bottom-nav-h) + 16px); }

  .auth-brand { display: none; }
  .auth-panel {
    width: 100%;
    padding: 40px 20px 48px;
    background: linear-gradient(150deg, #0f1c35 0%, #1a2f52 55%, #1E3A5F 100%);
    justify-content: flex-start;
  }
  .auth-form { max-width: 100%; }

  /* Logo flottant au-dessus de la carte */
  .auth-mobile-logo {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-bottom: 24px;
  }
  .auth-mobile-logo img { height: 48px; width: auto; border-radius: 9px; }
  .auth-mobile-logo span { font-weight: 900; font-size: 2rem; letter-spacing: -.5px; color: #fff; }

  /* Carte formulaire */
  .auth-mobile-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 28px 24px 24px;
    box-shadow: 0 12px 48px rgba(0,0,0,.35);
    border: 1px solid rgba(255,255,255,.06);
  }
  .auth-card-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
  .auth-card-header .auth-title { font-size: 1.45rem; margin-bottom: 4px; }
  .auth-card-header .auth-hint  { font-size: .82rem; }
  .auth-card-footer { padding-top: 4px; }
  .auth-card-footer a { display: inline-flex; align-items: center; gap: 4px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { border-left: none; border-top: 1px solid var(--border); position: static; height: auto; }

  .welcome-emoji { display: none; }
  .welcome-banner { padding: 22px 24px; }
  .welcome-text h2 { font-size: 1.25rem; }

  .bottom-nav { display: flex; }

  .stat-value { font-size: 1.6rem; }

  .col-span-2 { grid-column: span 1; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 1.4rem; }

  .topbar-greeting { display: none; }

  .form-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page-body { padding: 12px; padding-bottom: calc(var(--bottom-nav-h) + 12px); }
  .card { padding: 18px; }
  .stat-card { padding: 16px 18px; }
  .welcome-banner { padding: 18px; }
}

/* ── Notification Bell & Dropdown ──────────────────────── */
.notif-wrapper { position: relative; }

.notif-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-muted);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.notif-btn:hover { background: var(--brand-light); border-color: var(--brand); transform: scale(1.08); }
.notif-btn.has-unread { animation: bell-ring .7s ease; }

@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  20%       { transform: rotate(15deg); }
  40%       { transform: rotate(-12deg); }
  60%       { transform: rotate(8deg); }
  80%       { transform: rotate(-4deg); }
}

.notif-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); line-height: 1;
}

.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 500;
  display: none; flex-direction: column;
  overflow: hidden;
  transform-origin: top right;
}
.notif-dropdown.open { display: flex; animation: scaleIn .18s ease; }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-header-title { font-size: .9rem; font-weight: 700; color: var(--text); }

.notif-list { max-height: 360px; overflow-y: auto; flex: 1; }
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  transition: background var(--t-fast); cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: var(--brand-light); }
[data-theme="dark"] .notif-item.unread { background: rgba(244,180,0,.07); }

.notif-item-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.notif-icon-lesson    { background: var(--info-bg); }
.notif-icon-course    { background: var(--success-bg); }
.notif-icon-cert      { background: var(--brand-light); }
.notif-icon-quiz      { background: var(--purple-bg); }
.notif-icon-published { background: var(--success-bg); }
.notif-icon-enrolled  { background: var(--info-bg); }
.notif-icon-default   { background: var(--surface2); }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-msg   { font-size: .76rem; color: var(--text-muted); line-height: 1.4; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-time  { font-size: .7rem; color: var(--text-subtle); margin-top: 4px; }

.notif-item-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 6px; display: none; }
.notif-item.unread .notif-item-dot { display: block; }

.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: .875rem; }
.notif-empty-icon { font-size: 34px; display: block; margin-bottom: 8px; line-height: 1; }

.notif-loading { padding: 22px 16px; text-align: center; color: var(--text-muted); font-size: .82rem; }

.notif-footer { padding: 11px 16px; border-top: 1px solid var(--border); text-align: center; flex-shrink: 0; }
.notif-footer-link { font-size: .82rem; color: var(--brand); font-weight: 600; }
.notif-footer-link:hover { color: var(--brand-dark); }

/* ── Notification History Page ─────────────────────────── */
.notif-history-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 8px; transition: all var(--t-fast);
  text-decoration: none; color: inherit;
}
.notif-history-item:hover { border-color: var(--brand); box-shadow: var(--shadow); color: inherit; }
.notif-history-item.unread { border-left: 3px solid var(--brand); }
[data-theme="dark"] .notif-history-item.unread { background: rgba(244,180,0,.05); }

.notif-history-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.notif-history-body { flex: 1; min-width: 0; }
.notif-history-title { font-size: .9rem; font-weight: 700; color: var(--text); }
.notif-history-msg   { font-size: .82rem; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.notif-history-meta  { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: .73rem; color: var(--text-subtle); flex-wrap: wrap; }
.notif-history-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.notif-dot-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

/* ── Toast Notifications ───────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
@media (max-width: 768px) {
  .toast-container { bottom: calc(var(--bottom-nav-h) + 10px); right: 12px; left: 12px; }
}

.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .875rem; color: var(--text);
  max-width: 340px; width: 100%;
  pointer-events: all;
  animation: slideUp .28s ease;
  transition: opacity .28s ease, transform .28s ease;
}
.toast.hiding { opacity: 0; transform: translateY(8px); }
.toast-icon  { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body  { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: .84rem; color: var(--text); line-height: 1.3; }
.toast-msg   { font-size: .78rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-subtle); font-size: 13px; padding: 0; flex-shrink: 0; line-height: 1; margin-top: 1px; }
.toast-close:hover { color: var(--text); }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-info    { border-left: 3px solid var(--info); }

/* ══════════════════════════════════════════════════════
   Course Detail — Smart Progress UX
   ══════════════════════════════════════════════════════ */

/* Breadcrumb */
.cd-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-muted); margin-bottom: 14px;
}
.cd-breadcrumb a { color: var(--text-muted); }
.cd-breadcrumb a:hover { color: var(--brand); }

/* Title block */
.cd-title-block {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.cd-title-block h1 { margin-bottom: 6px; }
.cd-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cd-by { font-size: .88rem; color: var(--text-muted); }
.cd-completed-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--success-bg); color: var(--success);
  border: 1.5px solid var(--success-border);
  border-radius: 20px; padding: 6px 16px;
  font-size: .88rem; font-weight: 700; white-space: nowrap;
  flex-shrink: 0;
}

/* ── Hero Progress Card ──────────────────────────────── */
.cd-hero { margin-bottom: 22px; }
.cd-hero-inner {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.cd-ring-wrap {
  flex-shrink: 0;
}
.cd-ring-wrap .progress-ring-text {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cd-ring-wrap .progress-ring-pct {
  font-size: 1.05rem; font-weight: 800; color: var(--text);
}
.cd-ring-done .progress-ring-pct { color: var(--success); }

.cd-hero-stats { flex: 1; min-width: 0; }
.cd-hero-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.cd-progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cd-progress-bar  { flex: 1; height: 10px; }
.cd-pct-label     { font-size: .85rem; font-weight: 800; color: var(--brand); min-width: 36px; text-align: right; }
.cd-hero-sub      { font-size: .82rem; color: var(--text-muted); margin-bottom: 14px; }
.cd-cta-row       { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Smart Checklist ─────────────────────────────────── */
.cd-checklist { display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; }

.cd-check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cd-check-item:last-child { border-bottom: none; }
.cd-check-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.cd-check-body { flex: 1; min-width: 0; }

.cd-check-label {
  display: flex; align-items: center; gap: 8px;
  font-size: .88rem; font-weight: 600; color: var(--text); margin-bottom: 6px;
}
.cd-check-emoji { font-size: .95rem; }
.cd-check-count {
  margin-left: auto; font-size: .78rem; font-weight: 700;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.cd-check-count.done { color: var(--success); }

.cd-check-bar-wrap { display: flex; align-items: center; gap: 8px; }
.cd-check-bar      { flex: 1; height: 6px; }
.cd-check-pct      { font-size: .72rem; font-weight: 700; color: var(--text-muted); min-width: 32px; text-align: right; }
.cd-check-item.done .cd-check-pct { color: var(--success); }

/* Next Step Banner */
.cd-next-step {
  display: flex; align-items: center; gap: 12px;
  background: var(--brand-light); border: 1.5px solid var(--brand-glow);
  border-radius: var(--radius-sm); padding: 12px 14px;
  flex-wrap: wrap;
}
.cd-next-icon { font-size: 1.1rem; color: var(--brand-dark); flex-shrink: 0; }
.cd-next-body { flex: 1; min-width: 0; }
.cd-next-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-dark); margin-bottom: 2px; }
.cd-next-title { font-size: .9rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-next-module { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
[data-theme="dark"] .cd-next-step { background: rgba(244,180,0,.08); }

/* ── Module Card ─────────────────────────────────────── */
.cd-module-card { padding: 18px 20px; }
.cd-module-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.cd-module-info { flex: 1; min-width: 0; }
.cd-module-title { font-weight: 700; font-size: .97rem; color: var(--text); margin-bottom: 5px; }
.cd-module-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-module-done-count { font-size: .75rem; color: var(--text-muted); }
.cd-module-ring { flex-shrink: 0; }
.cd-module-pct { font-size: .82rem; font-weight: 800; color: var(--text-muted); }
.cd-module-complete-badge { font-size: 1.1rem; }
.cd-module-bar { height: 5px; border-radius: 3px; }

/* ── Lesson Rows ─────────────────────────────────────── */
.cd-lessons { display: flex; flex-direction: column; gap: 5px; }

.cd-lesson-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.cd-lesson-row:hover { background: var(--surface2); }
.cd-lesson-row.done { background: var(--success-bg); border-color: var(--success-border); }
.cd-lesson-row.next { background: var(--brand-light); border-color: var(--brand-glow); border-width: 1.5px; }
[data-theme="dark"] .cd-lesson-row.next { background: rgba(244,180,0,.08); }

.cd-lesson-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; transition: all var(--t-fast);
  background: var(--surface);
}
.cd-lesson-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.cd-lesson-check.next { background: var(--brand); border-color: var(--brand); color: #111; font-size: .75rem; }

.cd-lesson-info { flex: 1; min-width: 0; }
.cd-lesson-title { font-size: .88rem; font-weight: 500; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-lesson-title.done { color: var(--text-muted); text-decoration: line-through; }
.cd-lesson-tags { display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap; }

.cd-type-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 600; padding: 1px 7px;
  border-radius: 10px; line-height: 1.5;
}
.cd-type-tag.blue   { background: var(--info-bg);    color: var(--info); }
.cd-type-tag.green  { background: var(--success-bg); color: var(--success); }
.cd-type-tag.purple { background: var(--purple-bg);  color: var(--purple); }
.cd-type-tag.gray   { background: var(--surface2);   color: var(--text-muted); border: 1px solid var(--border); }

.cd-duration     { font-size: .7rem; color: var(--text-subtle); }
.cd-next-badge   { font-size: .68rem; font-weight: 700; color: var(--brand-dark); background: var(--brand-light); padding: 1px 8px; border-radius: 8px; }

/* Quiz row in module */
.cd-quiz-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 10px 11px;
  background: var(--purple-bg); border: 1px solid var(--purple-border);
  border-radius: var(--radius-sm); flex-wrap: wrap;
}
.cd-quiz-icon  { font-size: 1rem; flex-shrink: 0; }
.cd-quiz-title { flex: 1; font-size: .88rem; font-weight: 600; color: var(--purple); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .cd-hero-inner { gap: 16px; }
  .cd-ring-wrap  { display: none; }
  .cd-lesson-row { flex-wrap: wrap; }
  .cd-lesson-title { white-space: normal; }
  .cd-module-head { flex-direction: column; }
}

/* ════════════════════════════════════════════════════
   QUIZ TAKE (quiz_take.php)
════════════════════════════════════════════════════ */

/* Timer */
.qk-timer {
  display: flex; align-items: center; gap: 6px;
  font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text); background: var(--surface2);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 6px 14px; flex-shrink: 0; transition: background .3s, color .3s;
}
.qk-timer-icon { font-size: .95rem; }
.qk-timer.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.qk-timer.danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border);
                    animation: timerPulse 1s ease-in-out infinite; }

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* Question block */
.qk-question { transition: border-color .2s; }
.qk-question:has(input:checked) { border-left: 3px solid var(--brand); }

.qk-q-header {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px;
}
.qk-q-num {
  min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: .78rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.qk-q-text  { flex: 1; font-weight: 600; font-size: .95rem; line-height: 1.5; color: var(--text); }
.qk-pts     { flex-shrink: 0; }

/* Options */
.qk-options { display: flex; flex-direction: column; gap: 8px; }

.qk-option {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
}
.qk-option:hover { border-color: var(--brand); background: var(--brand-light); }
.qk-option.selected { border-color: var(--brand); background: var(--brand-light); }
.qk-option input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; }
.qk-option-text { font-size: .9rem; color: var(--text); line-height: 1.4; }

/* Open textarea */
.qk-open { resize: vertical; }

/* ════════════════════════════════════════════════════
   QUIZ REVIEW (quiz_review.php)
════════════════════════════════════════════════════ */

.qr-card { border-left: 4px solid var(--border); }
.qr-card.correct { border-left-color: var(--success); }
.qr-card.wrong   { border-left-color: var(--danger); }
.qr-card.open    { border-left-color: var(--purple); }

.qr-header {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px;
}
.qr-num {
  min-width: 28px; height: 28px; border-radius: 50%; font-size: .78rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--surface2); color: var(--text-muted);
}
.qr-card.correct .qr-num { background: var(--success-bg); color: var(--success); }
.qr-card.wrong   .qr-num { background: var(--danger-bg);  color: var(--danger); }
.qr-card.open    .qr-num { background: var(--purple-bg);  color: var(--purple); }

.qr-question { flex: 1; font-weight: 600; font-size: .95rem; line-height: 1.5; color: var(--text); }

/* Options review */
.qr-options { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }

.qr-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--surface2);
}
.qr-option.correct        { background: var(--success-bg);  border-color: var(--success-border); }
.qr-option.wrong          { background: var(--danger-bg);   border-color: var(--danger-border);  }
.qr-option.selected-correct { background: var(--success-bg); border-color: var(--success); }

.qr-opt-icon { font-size: .9rem; flex-shrink: 0; width: 18px; text-align: center; }
.qr-opt-text { flex: 1; font-size: .88rem; color: var(--text); }
.qr-opt-badge {
  font-size: .68rem; font-weight: 700; padding: 1px 8px; border-radius: 8px;
  background: var(--success-bg); color: var(--success); flex-shrink: 0;
}
.qr-opt-badge.wrong { background: var(--danger-bg); color: var(--danger); }

/* Open answer */
.qr-open-answer { margin-bottom: 4px; }

/* Explanation */
.qr-explanation {
  margin-top: 12px; padding: 12px 14px;
  background: rgba(244,180,0,.08); border: 1px solid rgba(244,180,0,.3);
  border-radius: 9px;
}
.qr-exp-label { font-size: .78rem; font-weight: 700; color: var(--brand-dark); margin-bottom: 5px; }
.qr-exp-text  { font-size: .87rem; color: var(--text); line-height: 1.6; }

/* ── Responsive quiz ────────────────────────────────── */
@media (max-width: 640px) {
  .qk-timer     { font-size: .9rem; padding: 5px 10px; }
  .qk-q-header  { flex-wrap: wrap; }
  .qr-header    { flex-wrap: wrap; }
  .grid.grid-4  { grid-template-columns: repeat(2, 1fr); }
}
