/* ============================================================
   CBT PLATFORM — GLOBAL STYLES
   Mobile-first, clean SaaS design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
  /* Brand palette */
  --green-900: #064e3b;
  --green-800: #065f46;
  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10b981;
  --green-400: #34d399;
  --green-100: #d1fae5;
  --green-50:  #ecfdf5;

  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --blue-500:  #3b82f6;
  --blue-100:  #dbeafe;

  /* Semantic tokens */
  --bg-primary:   #ffffff;
  --bg-secondary: var(--slate-50);
  --bg-card:      #ffffff;
  --border:       var(--slate-200);
  --border-focus: var(--green-500);
  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-muted:   var(--slate-400);

  /* Brand */
  --brand:        var(--green-600);
  --brand-dark:   var(--green-700);
  --brand-light:  var(--green-100);
  --brand-glow:   rgba(16,185,129,.18);

  /* Effects */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.12);
  --shadow-brand: 0 4px 20px rgba(16,185,129,.25);

  /* Spacing */
  --header-h: 64px;

  /* Font */
  --font-base: 'Sora', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Dark mode ──────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary:   var(--slate-900);
    --bg-secondary: var(--slate-950);
    --bg-card:      var(--slate-800);
    --border:       var(--slate-700);
    --text-primary: var(--slate-50);
    --text-secondary: var(--slate-400);
    --text-muted:   var(--slate-500);
    --brand-light:  rgba(16,185,129,.15);
    --shadow:       0 4px 16px rgba(0,0,0,.4);
    --shadow-lg:    0 10px 40px rgba(0,0,0,.5);
  }
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background:  var(--bg-secondary);
  color:       var(--text-primary);
  line-height: 1.6;
  min-height:  100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a   { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
* {
  text-decoration: none;
}

a, button {
  -webkit-tap-highlight-color: transparent;
}
a:focus,
button:focus,
a:active,
button:active {
  outline: none;
  background: transparent;
  box-shadow: none;
}

/* ── Typography ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { line-height: 1.25; font-weight: 700; color: var(--text-primary); }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem,  3vw, 2rem); }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

/* ── Utility classes ────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.card {
  background:    var(--bg-card);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow);
  padding:       1.75rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             .5rem;
  font-family:     var(--font-base);
  font-size:       .9375rem;
  font-weight:     600;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
  padding:         .75rem 1.5rem;
  transition:      background .18s, transform .1s, box-shadow .18s, opacity .18s;
  text-decoration: none;
  white-space:     nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background:  var(--brand);
  color:       #fff;
  box-shadow:  var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  box-shadow: 0 6px 24px rgba(16,185,129,.35);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--brand-light);
  color:      var(--brand-dark);
}
.btn-secondary:hover:not(:disabled) { background: var(--green-100); }

.btn-outline {
  background:  transparent;
  color:       var(--text-primary);
  border:      1.5px solid var(--border);
}
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

.btn-danger {
  background: var(--red-500);
  color:      #fff;
}

.btn-sm  { padding: .5rem 1rem;   font-size: .875rem; }
.btn-lg  { padding: .9rem 2rem;   font-size: 1rem; }
.btn-full { width: 100%; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content:     '';
  position:    absolute;
  width:       1.1rem; height: 1.1rem;
  border:      2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation:   spin .6s linear infinite;
}

/* ── Form elements ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .375rem; }

.form-label {
  font-size:   .875rem;
  font-weight: 600;
  color:       var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  font-family:   var(--font-base);
  font-size:     .9375rem;
  padding:       .7rem 1rem;
  border:        1.5px solid var(--border);
  border-radius: var(--radius);
  background:    var(--bg-primary);
  color:         var(--text-primary);
  width:         100%;
  transition:    border-color .15s, box-shadow .15s;
  outline:       none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow:   0 0 0 3px var(--brand-glow);
}
.form-input.error { border-color: var(--red-500); }
.form-hint  { font-size: .8125rem; color: var(--text-muted); }
.form-error { font-size: .8125rem; color: var(--red-500); }

.input-group { position: relative; }
.input-group .form-input { padding-right: 2.75rem; }
.input-group .input-icon {
  position:    absolute;
  right: .85rem; top: 50%;
  transform:   translateY(-50%);
  cursor:      pointer;
  color:       var(--text-muted);
  background:  none;
  border:      none;
  padding:     0;
  display:     flex;
}

/* ── Alert / Toast ──────────────────────────────────────────── */
.alert {
  padding:       .875rem 1.1rem;
  border-radius: var(--radius);
  font-size:     .9rem;
  font-weight:   500;
  display:       flex;
  align-items:   flex-start;
  gap:           .6rem;
}
.alert-success { background: var(--green-50);  color: var(--green-800);  border: 1px solid var(--green-100); }
.alert-error   { background: var(--red-100);   color: #991b1b;           border: 1px solid #fca5a5; }
.alert-info    { background: var(--blue-100);  color: #1e40af;           border: 1px solid #bfdbfe; }

/* Toast container */
#toast-container {
  position:   fixed;
  top: 1.25rem; right: 1.25rem;
  z-index:    9999;
  display:    flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  min-width:     260px;
  max-width:     360px;
  padding:       .875rem 1.1rem;
  border-radius: var(--radius);
  font-size:     .9rem;
  font-weight:   500;
  box-shadow:    var(--shadow-lg);
  animation:     slideIn .25s ease;
  display:       flex;
  align-items:   center;
  gap:           .6rem;
}
.toast-success { background: var(--green-700); color: #fff; }
.toast-error   { background: var(--red-500);   color: #fff; }
.toast-info    { background: var(--slate-800); color: #fff; }
.toast.fade-out { animation: fadeOut .3s ease forwards; }

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display:       inline-flex;
  align-items:   center;
  gap:           .3rem;
  padding:       .25rem .7rem;
  border-radius: 999px;
  font-size:     .78rem;
  font-weight:   600;
}
.badge-success { background: var(--green-100);  color: var(--green-800); }
.badge-warning { background: #fef3c7;            color: #92400e; }
.badge-danger  { background: var(--red-100);     color: #991b1b; }
.badge-neutral { background: var(--slate-100);   color: var(--slate-600); }

/* ── Navigation ─────────────────────────────────────────────── */
.navbar {
  position:   sticky; top: 0; z-index: 100;
  height:     var(--header-h);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display:    flex;
  align-items: center;
}
.navbar .container {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}
.nav-logo {
  font-size:   1.35rem;
  font-weight: 800;
  color:       var(--text-primary);
  display:     flex;
  align-items: center;
  gap:         .5rem;
  text-decoration: none;
}
.nav-logo span { color: var(--brand); }
.nav-links {
  display:     flex;
  align-items: center;
  gap:         .25rem;
  list-style:  none;
}
.nav-links a {
  font-size:   .9rem;
  font-weight: 500;
  color:       var(--text-secondary);
  padding:     .5rem .75rem;
  border-radius: var(--radius-sm);
  transition:  color .15s, background .15s;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text-primary); background: var(--slate-100); }
.nav-links a.active { color: var(--brand); background: var(--brand-light); }

/* Mobile nav */
.nav-toggle {
  display:    none;
  background: none;
  border:     none;
  cursor:     pointer;
  padding:    .4rem;
  color:      var(--text-primary);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display:       none;
    position:      fixed;
    top:           var(--header-h); left: 0; right: 0;
    background:    var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding:       1rem;
    gap:           .25rem;
    align-items:   stretch;
    box-shadow:    var(--shadow-lg);
  }
  .nav-links.open { display: flex; }
  .nav-links a    { padding: .75rem 1rem; }
}

/* ── Auth layout ─────────────────────────────────────────────── */
.auth-page {
  min-height:      100vh;
  display:         flex;
  align-items:     center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--slate-900) 60%);
  padding:         2rem 1.25rem;
}
.auth-card {
  background:    var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow:    var(--shadow-lg);
  padding:       2.5rem 2rem;
  width:         100%;
  max-width:     460px;
}
@media (max-width: 480px) {
  .auth-card { padding: 1.75rem 1.25rem; }
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-logo .logo-mark {
  width:         56px; height: 56px;
  background:    var(--brand);
  border-radius: var(--radius-lg);
  display:       inline-flex;
  align-items:   center;
  justify-content: center;
  margin-bottom: .75rem;
  box-shadow:    var(--shadow-brand);
}
.auth-logo h1  { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-logo p   { font-size: .9rem;  color: var(--text-muted); }

.auth-divider {
  display:     flex;
  align-items: center;
  gap:         .75rem;
  color:       var(--text-muted);
  font-size:   .8rem;
  margin:      1rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex:    1;
  height:  1px;
  background: var(--border);
}

.auth-footer {
  text-align:  center;
  font-size:   .875rem;
  color:       var(--text-muted);
  margin-top:  1.25rem;
}
.auth-footer a { font-weight: 600; color: var(--brand); }

/* ── Dashboard layout ───────────────────────────────────────── */
.app-layout {
  display:    flex;
  min-height: 100vh;
}

.sidebar {
  width:      260px;
  min-height: 100vh;
  background: var(--slate-900);
  color:      #fff;
  flex-shrink: 0;
  display:    flex;
  flex-direction: column;
  position:   sticky;
  top:        0;
  height:     100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding:     1.5rem 1.25rem 1rem;
  font-size:   1.25rem;
  font-weight: 800;
  display:     flex;
  align-items: center;
  gap:         .5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: .75rem;
}
.sidebar-logo span { color: var(--green-400); }

/* Close button — hidden on desktop, visible only when sidebar is mobile overlay */
.sidebar-close {
  display:        none;
  margin-left:    auto;
  background:     none;
  border:         none;
  color:          rgba(255,255,255,.6);
  cursor:         pointer;
  padding:        .3rem .4rem;
  border-radius:  var(--radius);
  line-height:    1;
  font-size:      1.1rem;
  transition:     color .15s, background .15s;
  flex-shrink:    0;
}
.sidebar-close:hover {
  color:       #fff;
  background:  rgba(255,255,255,.1);
}
@media (max-width: 900px) {
  .sidebar-close { display: flex; align-items: center; justify-content: center; }
}

.sidebar-nav { flex: 1; padding: .5rem .75rem; }
.sidebar-nav a {
  display:       flex;
  align-items:   center;
  gap:           .75rem;
  padding:       .7rem .85rem;
  border-radius: var(--radius);
  color:         rgba(255,255,255,.65);
  font-size:     .9rem;
  font-weight:   500;
  text-decoration: none;
  transition:    background .15s, color .15s;
  margin-bottom: .15rem;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: var(--brand); color: #fff; }
.sidebar-nav .nav-section {
  font-size:    .7rem;
  font-weight:  700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color:        rgba(255,255,255,.3);
  padding:      .75rem .85rem .3rem;
  margin-top:   .5rem;
}

.sidebar-footer {
  padding:       1rem .75rem;
  border-top:    1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display:       flex;
  align-items:   center;
  gap:           .75rem;
  padding:       .6rem .85rem;
  border-radius: var(--radius);
}
.sidebar-user .avatar {
  width:       36px; height: 36px;
  border-radius: 50%;
  background:  var(--brand);
  display:     flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size:   .875rem;
  color:       #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name {
  font-size:  .875rem;
  font-weight: 600;
  color:      #fff;
  white-space: nowrap;
  overflow:   hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-plan {
  font-size: .75rem;
  color:     rgba(255,255,255,.4);
}

.main-content {
  flex:       1;
  min-width:  0;
  background: var(--bg-secondary);
}

.main-header {
  background:    var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding:       1rem 1.75rem;
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  gap:           .75rem;
  position:      sticky;
  top:           0;
  z-index:       50;
  /* Prevent header items from pushing the page wider */
  min-width:     0;
  overflow:      hidden;
}

/* Left side: title group — clamp so long titles don't crowd right actions */
.main-header > div:first-child,
.main-header > .header-left {
  display:   flex;
  align-items: center;
  gap:       .75rem;
  min-width: 0;        /* allow shrinking */
  flex:      1 1 0;    /* grow but yield space to right side */
}

/* Page title truncates instead of wrapping */
.page-title {
  font-size:     1.15rem;
  font-weight:   700;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  min-width:     0;
}

/* Right side: action group — never shrinks below its content */
.main-header > div:last-child:not(:first-child),
.main-header > .header-actions {
  display:    flex;
  align-items: center;
  gap:        .6rem;
  flex-shrink: 0;
}

.page-body {
  padding: 1.75rem;
}

/* Stats grid */
.stats-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap:                   1rem;
  margin-bottom:         1.5rem;
}
.stat-card {
  background:    var(--bg-card);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       1.25rem;
}
.stat-card .stat-icon {
  width:         40px; height: 40px;
  border-radius: var(--radius);
  display:       flex;
  align-items:   center;
  justify-content: center;
  margin-bottom: .75rem;
}
.stat-card .stat-value {
  font-size:   1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: .2rem;
}
.stat-card .stat-label {
  font-size: .8125rem;
  color:     var(--text-muted);
  font-weight: 500;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes slideIn  { from { opacity:0; transform: translateX(1rem); } to { opacity:1; transform: none; } }
@keyframes fadeOut  { to   { opacity:0; transform: translateX(1rem); } }
@keyframes fadeUp   { from { opacity:0; transform: translateY(.75rem); } to { opacity:1; transform:none; } }
@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:.5} }

.fade-up { animation: fadeUp .35s ease both; }
.fade-up-2 { animation: fadeUp .35s .1s ease both; }
.fade-up-3 { animation: fadeUp .35s .2s ease both; }

/* ── Responsive mobile sidebar ──────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0; bottom: 0;
    z-index: 200;
    transition: left .25s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,.5);
    z-index:    199;
  }
  .sidebar-overlay.open { display: block; }
  .main-content { width: 100%; }
  .page-body { padding: 1rem; }
}

/* ── Misc ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-brand  { color: var(--brand); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.gap-1 { gap: .5rem; }
.d-flex { display: flex; align-items: center; }

/* Password strength */
.pw-strength { margin-top: .375rem; }
.pw-strength-bar {
  height:        5px;
  border-radius: 999px;
  background:    var(--border);
  overflow:      hidden;
  margin-bottom: .25rem;
}
.pw-strength-fill {
  height:     100%;
  border-radius: 999px;
  transition: width .3s, background .3s;
  width:      0;
}
.pw-strength-text { font-size: .75rem; color: var(--text-muted); }

/* ── Font Awesome Icon Styles ────────────────────────────────── */
.fa-solid, .fa-regular, .fa-brands {
  font-size: inherit;
  line-height: 1;
}

/* Sidebar nav icons */
.sidebar-nav a .fa-solid,
.sidebar-nav a .fa-regular {
  width: 18px;
  font-size: .9rem;
  opacity: .85;
  flex-shrink: 0;
}

/* Button icons */
.btn .fa-solid,
.btn .fa-regular {
  font-size: .85em;
  margin-right: .15em;
}

/* Toast icons */
.toast .fa-solid { font-size: .9rem; }

/* Table action button icons */
.data-table .fa-solid { font-size: .85rem; }

/* Admin sidebar icons */
.admin-sidebar .fa-solid {
  width: 18px;
  font-size: .9rem;
  opacity: .8;
}

/* Menu toggle icon */
#menuToggle .fa-solid { font-size: 1rem; }

/* Mode tab icons */
.mode-tab .fa-solid { font-size: .85rem; }

/* Step icons on referral page */
.step-icon .fa-solid { font-size: 2rem; }

/* ── Font Awesome Icon Styles ─────────────────────────────────────────────── */
/* Ensure icons align properly with text */
.fa-solid, .fa-regular, .fa-brands {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* Sidebar nav icons - fixed width so text aligns */
.sidebar-nav a .fa-solid,
.sidebar-nav a .fa-regular {
  width: 1.25rem;
  text-align: center;
  font-size: .875rem;
  margin-right: .35rem;
  opacity: .85;
  flex-shrink: 0;
}

.sidebar-nav a:hover .fa-solid,
.sidebar-nav a.active .fa-solid { opacity: 1; }

/* Button icons */
.btn .fa-solid,
.btn .fa-regular {
  font-size: .85em;
  vertical-align: middle;
}

/* Page title icons */
.page-title .fa-solid { font-size: .9em; margin-right: .35rem; }

/* Badge icons */
.badge .fa-solid { font-size: .75em; }

/* Table action icons */
.data-table .fa-solid { font-size: .85rem; }

/* Auth page logo icons */
.auth-logo .fa-solid { font-size: 1.5rem; }

/* Large decorative icons */
[style*="font-size:3"] .fa-solid,
[style*="font-size:2"] .fa-solid { vertical-align: middle; }

/* Admin sidebar icons */
.admin-sidebar .sidebar-nav a .fa-solid {
  width: 1.25rem;
  text-align: center;
  font-size: .875rem;
  margin-right: .35rem;
  opacity: .8;
}

/* Stat/card icons */
.stat-icon .fa-solid,
.as-icon .fa-solid,
.qa-icon .fa-solid,
.em-icon .fa-solid,
.feature-icon .fa-solid,
.include-icon .fa-solid {
  font-size: 1.25rem;
  vertical-align: middle;
}

/* Menu toggle */
#menuToggle .fa-solid { font-size: 1.1rem; }

/* Toast icons */
.toast span .fa-solid { font-size: .9rem; vertical-align: middle; }

/* Mode tabs */
.mode-tab .fa-solid { font-size: .85rem; margin-right: .3rem; }

/* Exam card stats */
.exam-stats .fa-solid { font-size: .78rem; vertical-align: middle; }

/* Step icons - referral page */
.step-icon .fa-solid { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* Certificate icons */
.cert-logo .fa-solid { font-size: 2.5rem; }
.cert-seal .fa-solid { font-size: 3rem; }

/* Explanation icons */
.rq-explanation .fa-solid { font-size: .9rem; color: var(--brand); }

/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE FIXES
   ══════════════════════════════════════════════════════════════ */

/* ── Main header mobile toggle visibility ─────────────────── */
/* menuToggle button exists in all app pages – always show on mobile */
@media (max-width: 900px) {
  #menuToggle { display: flex !important; }
}
@media (min-width: 901px) {
  #menuToggle { display: none; }
}

/* ── Page body padding on small screens ───────────────────── */
@media (max-width: 600px) {
  .page-body { padding: .875rem; }
  .main-header { padding: .75rem 1rem; gap: .5rem; }

  /* Hide button text labels in header on small screens — keep icons */
  .main-header .btn .btn-label,
  .main-header .btn span:not(.badge) {
    display: none;
  }
  /* Hide decorative greeting text */
  .header-greeting { display: none; }
  /* Give icon-only buttons a square feel */
  .main-header .btn {
    padding-left:  .55rem;
    padding-right: .55rem;
  }
  /* Keep menuToggle as-is */
  .main-header #menuToggle {
    padding: .4rem !important;
  }
}

/* ── Stats grid: never overflow on tiny screens ───────────── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utility: full-width button groups on mobile ──────────── */
@media (max-width: 480px) {
  .btn-group-mobile { flex-direction: column; width: 100%; }
  .btn-group-mobile .btn { width: 100%; }
}

/* ── Toast should not overlap content on small screens ────── */
@media (max-width: 480px) {
  #toast-container {
    top: auto;
    bottom: 1rem;
    right: .75rem;
    left: .75rem;
  }
  .toast { min-width: unset; max-width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   ICON COLOUR — green-toned to match background containers
   Sidebar nav icons are explicitly excluded.
   ══════════════════════════════════════════════════════════════ */

/* ── Stat / card icon containers ──────────────────────────── */
.stat-icon   .fa-solid,
.stat-icon   .fa-regular,
.as-icon     .fa-solid,
.as-icon     .fa-regular,
.qa-icon     .fa-solid,
.qa-icon     .fa-regular,
.em-icon     .fa-solid,
.em-icon     .fa-regular,
.feature-icon .fa-solid,
.feature-icon .fa-regular,
.include-icon .fa-solid,
.include-icon .fa-regular,
.step-icon   .fa-solid,
.step-icon   .fa-regular,
.card-icon   .fa-solid,
.card-icon   .fa-regular {
  color: var(--brand);
}

/* ── Auth page logo mark (sits on brand-green bg → white looks fine,
      but request is green theme — use a lighter green for contrast) ── */
.auth-logo .logo-mark .fa-solid,
.auth-logo .logo-mark .fa-regular {
  color: #fff; /* keep white — it sits on solid green bg */
}

/* ── Empty-state decorative icons ─────────────────────────── */
.empty-state .fa-solid,
.empty-state .fa-regular,
.empty-lb    .fa-solid,
.empty-lb    .fa-regular {
  color: var(--brand);
}

/* ── Certificate decorative icons ─────────────────────────── */
.cert-logo .fa-solid,
.cert-seal .fa-solid {
  color: var(--brand);
}

/* ── Input group icons (search bars, password toggles) ────── */
.input-group .input-icon .fa-solid,
.input-group .input-icon .fa-regular {
  color: var(--brand);
}

/* ── Page-title / section-header icons ────────────────────── */
.page-title  .fa-solid,
.section-title .fa-solid,
.card-header .fa-solid {
  color: var(--brand);
}

/* ── Button icons — keep white on filled buttons, green on outline ── */
.btn-primary .fa-solid,
.btn-primary .fa-regular,
.btn-danger  .fa-solid,
.btn-danger  .fa-regular {
  color: inherit; /* white inherited from button text */
}
.btn-outline .fa-solid,
.btn-outline .fa-regular,
.btn-ghost   .fa-solid,
.btn-ghost   .fa-regular {
  color: var(--brand);
}

/* ── Badge icons ───────────────────────────────────────────── */
.badge .fa-solid,
.badge .fa-regular {
  color: inherit;
}

/* ── Mode-tab icons ────────────────────────────────────────── */
.mode-tab .fa-solid {
  color: var(--brand);
}
.mode-tab.active .fa-solid {
  color: var(--brand-dark);
}

/* ── Table action icons ────────────────────────────────────── */
.action-btn .fa-solid,
.action-btn .fa-regular {
  color: var(--brand);
}

/* ── Alert / toast icons ───────────────────────────────────── */
.alert-success .fa-solid { color: var(--green-700); }
.alert-error   .fa-solid { color: #dc2626; }
.alert-info    .fa-solid { color: #2563eb; }
.toast-success .fa-solid { color: #fff; }

/* ── Explanation / answer icons in review ─────────────────── */
.rq-explanation .fa-solid { color: var(--brand); }

/* ── EXPLICITLY EXCLUDE sidebar nav icons ─────────────────── */
/* These must NOT be overridden — they use white/muted on dark bg */
.sidebar     .sidebar-nav a .fa-solid,
.sidebar     .sidebar-nav a .fa-regular,
.admin-sidebar .sidebar-nav a .fa-solid,
.admin-sidebar .sidebar-nav a .fa-regular {
  color: inherit !important;
}
