/* ═══════════════════════════════════════════════════════════════
   VIORA TRAINING PORTAL — training.css  (v2 · full rewrite)
   ─────────────────────────────────────────────────────────────
   Every rule in this file is scoped to the training portal.
   No dependency on main.css. No shared class names with the
   admin dashboard beyond cosmetic coincidence (`.card-3d`,
   `.badge-*`, etc. resolve here to portal-specific values).

   Sections:
     1.  Design tokens (:root + [data-theme="light"])
     2.  Reset + base
     3.  Animated background layers
     4.  Keyframes
     5.  LOGIN SCREEN — shell, card, brand, tabs, mode indicator
     6.  LOGIN FORM — fields, password toggle, password meter
     7.  LOGIN HELPERS — forgot, switch, signup intro/benefits/
         requirements/terms/callout, footer, messages
     8.  PENDING SCREEN
     9.  APP SHELL — topbar, brand, user actions, tabs
     10. CONTENT — .main, .ptab, page headers
     11. SHARED COMPONENTS — buttons, stat cards, badges,
         card-3d, progress, chart-box, table-wrapper
     12. PORTAL-SPECIFIC — module list, lesson, quiz,
         checklist, cert, resource
     13. MODALS
     14. TOASTS + loading overlay + live sync
     15. MOBILE CHROME (≤899px + body.is-app-view)
     16. PRINT
   ═══════════════════════════════════════════════════════════════ */


/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ───────────────────────────────────────────────────────────── */
:root {
  font-size: 16px;

  /* Surfaces */
  --bg-body: #0a0a0f;
  --bg-body-2: #12121a;
  --bg-card: rgba(18, 18, 26, .72);
  --bg-card-solid: #12121a;
  --bg-input: rgba(26, 26, 46, .65);
  --bg-table-alt: rgba(0, 212, 255, .05);

  /* Text */
  --text-primary: #f0f4ff;
  --text-secondary: #94a3b8;
  --text-light: #64748b;

  /* Borders + shadows */
  --border-color: rgba(0, 212, 255, .14);
  --border-glow: rgba(0, 212, 255, .35);
  --shadow: 0 4px 20px rgba(0, 0, 0, .55);
  --shadow-3d: 0 10px 30px -8px rgba(0, 0, 0, .75), 0 4px 12px -4px rgba(0, 212, 255, .08);
  --shadow-3d-strong: 0 20px 45px -12px rgba(0, 212, 255, .35), 0 8px 20px -6px rgba(124, 58, 237, .30);

  /* Accents */
  --accent-blue: #00d4ff;
  --accent-green: #22e6a0;
  --accent-red: #ff5c7c;
  --accent-gold: #ffc857;
  --accent-purple: #a855f7;
  --accent-pink: #ff6ec7;

  /* Shape + motion */
  --radius: 16px;
  --transition: .22s ease;

  /* Gradients */
  --gradient-accent: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  --gradient-soft: linear-gradient(135deg, rgba(0, 212, 255, .18) 0%, rgba(124, 58, 237, .18) 100%);

  /* Glass */
  --glass-blur: blur(14px);
  --glass-bg: rgba(18, 18, 26, .55);

  /* Layout */
  --nav-h: 64px;
  --header-h: 58px;
}

[data-theme="light"] {
  --bg-body: #eef2f9;
  --bg-body-2: #e2e8f4;
  --bg-card: rgba(255, 255, 255, .92);
  --bg-card-solid: #fff;
  --bg-input: rgba(240, 244, 255, .9);
  --bg-table-alt: rgba(0, 150, 199, .06);

  --text-primary: #0a0a0f;
  --text-secondary: #334155;
  --text-light: #64748b;

  --border-color: rgba(0, 150, 199, .25);
  --border-glow: rgba(0, 150, 199, .4);
  --shadow: 0 4px 20px rgba(10, 10, 15, .10);
  --shadow-3d: 0 10px 30px -8px rgba(10, 10, 15, .18), 0 4px 12px -4px rgba(0, 150, 199, .15);
  --shadow-3d-strong: 0 20px 45px -12px rgba(0, 150, 199, .35), 0 8px 20px -6px rgba(124, 58, 237, .22);

  --accent-blue: #0096c7;
  --accent-green: #0d9e6e;
  --accent-red: #d92b4b;
  --accent-gold: #b8860b;
  --accent-purple: #7c3aed;

  --gradient-accent: linear-gradient(135deg, #0096c7 0%, #7c3aed 100%);
  --gradient-soft: linear-gradient(135deg, rgba(0, 150, 199, .14) 0%, rgba(124, 58, 237, .14) 100%);

  --glass-bg: rgba(255, 255, 255, .65);
}


/* ─────────────────────────────────────────────────────────────
   2. RESET + BASE
   ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-body);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(0, 212, 255, .10), transparent 45%),
    radial-gradient(circle at 88% 92%, rgba(124, 58, 237, .10), transparent 45%),
    linear-gradient(180deg, var(--bg-body) 0%, var(--bg-body-2) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.btn,
.stat-card .number {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -.02em;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { opacity: .85; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--gradient-accent); border-radius: 20px; }


/* ─────────────────────────────────────────────────────────────
   3. ANIMATED BACKGROUND LAYERS
   ───────────────────────────────────────────────────────────── */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}

.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  opacity: .55;
}
.bg-aurora::before,
.bg-aurora::after {
  content: '';
  position: absolute;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .35;
  animation: auroraFloat 24s ease-in-out infinite;
}
.bg-aurora::before {
  background: radial-gradient(circle, rgba(0, 212, 255, .55), transparent 70%);
  top: -20%;
  left: -15%;
}
.bg-aurora::after {
  background: radial-gradient(circle, rgba(168, 85, 247, .55), transparent 70%);
  bottom: -25%;
  right: -15%;
  animation-delay: -12s;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-orbs .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .25;
  animation: orbFloat 18s ease-in-out infinite;
}
.bg-orbs .orb:nth-child(1) { width: 200px; height: 200px; background: radial-gradient(circle, rgba(0, 212, 255, .6), transparent); top: 15%; left: 10%; }
.bg-orbs .orb:nth-child(2) { width: 250px; height: 250px; background: radial-gradient(circle, rgba(168, 85, 247, .5), transparent); top: 60%; right: 8%; animation-delay: -6s; }
.bg-orbs .orb:nth-child(3) { width: 180px; height: 180px; background: radial-gradient(circle, rgba(34, 230, 160, .5), transparent); bottom: 10%; left: 30%; animation-delay: -12s; }
.bg-orbs .orb:nth-child(4) { width: 220px; height: 220px; background: radial-gradient(circle, rgba(255, 200, 87, .4), transparent); top: 35%; right: 25%; animation-delay: -9s; }

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 212, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, .03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 8s ease-in-out infinite;
}


/* ─────────────────────────────────────────────────────────────
   4. KEYFRAMES
   ───────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes auroraFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(8%, 6%) scale(1.08); }
  66%      { transform: translate(-6%, -4%) scale(.95); }
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -40px) scale(1.15); }
  66%      { transform: translate(-20px, 30px) scale(.9); }
}
@keyframes gridPulse {
  0%, 100% { opacity: .4; }
  50%      { opacity: .8; }
}


/* ─────────────────────────────────────────────────────────────
   5. LOGIN SCREEN — SHELL, CARD, BRAND, TABS
   ───────────────────────────────────────────────────────────── */
#loginScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(circle at 20% 20%, #1E1B4B 0%, #0B1220 60%, #060913 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity .4s ease;
  overflow-y: auto;
}
#loginScreen.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

/* ── Card ── */
.login-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, .045);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 22px;
  padding: 40px 36px 32px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(0, 212, 255, .02) inset;
  color: #E2E8F0;
  margin: auto;
  animation: fadeInUp .6s ease both;
}

/* ── Brand row ── */
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-brand .logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 15px;
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, .5);
  overflow: hidden;
  flex-shrink: 0;
}
.login-brand .logo-mark img {
  max-height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}
.login-brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: #F8FAFC;
  line-height: 1.2;
}
.login-brand h1 span {
  background: linear-gradient(135deg, #7de8ff, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-brand p {
  font-size: 11.5px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 3px;
}

/* ── Noscript warning ── */
.noscript-warning {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255, 92, 124, .12);
  border-left: 3px solid #ff5c7c;
  border-radius: 10px;
  color: #ff9eb1;
  font-size: .82rem;
  line-height: 1.5;
}
.noscript-warning a { color: #ff9eb1; text-decoration: underline; }

/* ── Auth mode indicator (below brand) ── */
.auth-mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: rgba(0, 212, 255, .10);
  color: #7de8ff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  transition: background .25s ease, color .25s ease;
}
.auth-mode-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
.auth-mode-indicator.signup {
  background: rgba(168, 85, 247, .14);
  color: #c4b5fd;
}

/* ── Tabs ── */
.login-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: rgba(15, 23, 42, .60);
  padding: 4px;
  border-radius: 12px;
}
.login-tabs button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.login-tabs button i { font-size: .78rem; }
.login-tabs button:hover:not(.active) {
  color: #cbd5e1;
  background: rgba(148, 163, 184, .08);
}
.login-tabs button.active {
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 212, 255, .35);
}


/* ─────────────────────────────────────────────────────────────
   6. LOGIN FORM — FIELDS, PASSWORD TOGGLE, PASSWORD METER
   ───────────────────────────────────────────────────────────── */
.login-field {
  position: relative;
  margin-bottom: 16px;
}
.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
.login-field input,
.login-field select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(15, 23, 42, .60);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  color: #F1F5F9;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
}
.login-field input:hover,
.login-field select:hover {
  background: rgba(15, 23, 42, .75);
}
.login-field input:focus,
.login-field select:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 4px rgba(0, 212, 255, .18);
  background: rgba(15, 23, 42, .85);
}
.login-field input::placeholder { color: #64748b; }

/* Password fields need right padding for the toggle button */
.login-field input[type="password"],
.login-field input[data-pw-target] {
  padding-right: 42px;
}

/* ── Password visibility toggle ── */
.pw-toggle {
  position: absolute;
  right: 10px;
  top: calc(50% + 6px);
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .2s ease, background .2s ease;
}
.pw-toggle:hover { color: #cbd5e1; background: rgba(148, 163, 184, .10); }
.pw-toggle i { font-size: .82rem; }

/* ── Password strength meter ── */
.pw-meter {
  margin-top: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
}
.pw-meter.show { display: flex; }
.pw-meter .pw-bars {
  display: flex;
  gap: 4px;
}
.pw-meter .pw-bars span {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: rgba(148, 163, 184, .18);
  transition: background .25s ease;
}
.pw-meter[data-strength="1"] .pw-bars span:nth-child(1) { background: #ff5c7c; }
.pw-meter[data-strength="2"] .pw-bars span:nth-child(-n+2) { background: #ffc857; }
.pw-meter[data-strength="3"] .pw-bars span:nth-child(-n+3) { background: #22e6a0; }
.pw-meter[data-strength="4"] .pw-bars span { background: #22e6a0; }
.pw-meter small {
  font-size: .68rem;
  color: #94a3b8;
  font-weight: 500;
}
.pw-meter[data-strength="1"] small { color: #ff9eb1; }
.pw-meter[data-strength="2"] small { color: #f8d58a; }
.pw-meter[data-strength="3"] small,
.pw-meter[data-strength="4"] small { color: #7de8bf; }


/* ─────────────────────────────────────────────────────────────
   7. LOGIN HELPERS — forgot, switch, signup context, footer
   ───────────────────────────────────────────────────────────── */

/* ── Forgot password row ── */
.forgot-row {
  margin: -6px 0 14px;
  text-align: right;
  font-size: .76rem;
}
.forgot-row a {
  color: #7de8ff;
  font-weight: 500;
}
.forgot-row a:hover { text-decoration: underline; }

/* ── Submit button ── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 212, 255, .4);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 212, 255, .55);
}
.btn-login:active:not(:disabled) {
  transform: translateY(0) scale(.99);
}
.btn-login:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}
.btn-login i { font-size: .88rem; }

/* ── Helper text below button ("New? Enroll now →") ── */
.login-helper {
  margin-top: 14px;
  text-align: center;
  font-size: .78rem;
  color: #94a3b8;
  line-height: 1.5;
}
.login-helper a {
  color: #7de8ff;
  font-weight: 600;
}
.login-helper a:hover { text-decoration: underline; }

/* ── Signup intro banner ── */
.signup-intro {
  padding: 14px 16px;
  margin-bottom: 16px;
  background: rgba(255, 200, 87, .08);
  border-left: 3px solid #ffc857;
  border-radius: 10px;
  font-size: .78rem;
  line-height: 1.55;
  color: #f8d58a;
}
.signup-intro strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffc857;
  font-size: .82rem;
  margin-bottom: 4px;
  font-weight: 700;
}
.signup-intro p { margin: 0; color: #cbd5e1; }

/* ── Signup benefits + requirements cards ── */
.signup-benefits,
.signup-requirements {
  padding: 14px 16px;
  margin-bottom: 16px;
  background: rgba(0, 212, 255, .06);
  border: 1px solid rgba(0, 212, 255, .18);
  border-radius: 10px;
  font-size: .78rem;
  line-height: 1.55;
}
.signup-requirements {
  background: rgba(168, 85, 247, .06);
  border-color: rgba(168, 85, 247, .22);
}
.signup-benefits strong,
.signup-requirements h4 {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #7de8ff;
  margin-bottom: 8px;
}
.signup-requirements h4 { color: #c4b5fd; }
.signup-benefits ul,
.signup-requirements ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #cbd5e1;
}
.signup-benefits li,
.signup-requirements li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-left: 0;
}
.signup-benefits li::before {
  content: '✓';
  color: #22e6a0;
  font-weight: 800;
  flex-shrink: 0;
}
.signup-requirements li::before {
  content: '›';
  color: #a855f7;
  font-weight: 800;
  flex-shrink: 0;
}

/* ── Signup terms line ── */
.signup-terms {
  margin-top: 12px;
  text-align: center;
  font-size: .7rem;
  color: #64748b;
  line-height: 1.5;
}
.signup-terms a {
  color: #7de8ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Enrollment callout ── */
.enroll-callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 10px;
  font-size: .76rem;
  line-height: 1.5;
  color: #94a3b8;
}
.enroll-callout i {
  color: #00d4ff;
  margin-top: 2px;
  flex-shrink: 0;
}
.enroll-callout a {
  color: #7de8ff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.enroll-callout p { margin: 0; }

/* ── Login error/info/success message ── */
.login-message {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .8rem;
  line-height: 1.5;
  display: none;
}
.login-message.error {
  display: block;
  background: rgba(255, 92, 124, .12);
  border-left: 3px solid #ff5c7c;
  color: #ff9eb1;
}
.login-message.info {
  display: block;
  background: rgba(0, 212, 255, .12);
  border-left: 3px solid #00d4ff;
  color: #7dd8ff;
}
.login-message.success {
  display: block;
  background: rgba(34, 230, 160, .12);
  border-left: 3px solid #22e6a0;
  color: #7de8bf;
}

/* ── Login footer (below card) ── */
.login-footer {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, .10);
  font-size: 11px;
  color: #64748b;
  line-height: 1.7;
  text-align: center;
}
.login-footer strong { font-weight: 700; }


/* ─────────────────────────────────────────────────────────────
   8. PENDING SCREEN
   ───────────────────────────────────────────────────────────── */
#pendingScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 20% 20%, #1E1B4B 0%, #0B1220 60%, #060913 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
#pendingScreen.active { display: flex; }

.pending-card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, .045);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 22px;
  padding: 40px 34px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  color: #E2E8F0;
  text-align: center;
  margin: auto;
  animation: fadeInUp .55s ease both;
}

.pending-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffc857, #b8860b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(255, 200, 87, .35);
  animation: pulse 2s ease-in-out infinite;
}

.pending-card h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #F8FAFC;
  margin-bottom: 10px;
  letter-spacing: -.4px;
}
.pending-card p {
  font-size: .85rem;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 16px;
}
.pending-card p strong { color: #F8FAFC; font-weight: 700; }

/* ── Pending progress steps ── */
.pending-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  text-align: left;
}
.pending-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, .55);
  border-radius: 10px;
  border-left: 3px solid rgba(148, 163, 184, .18);
  font-size: .82rem;
  color: #94a3b8;
  transition: border-color .3s ease, background .3s ease, color .3s ease;
}
.pending-step > span:first-child {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background .3s ease, color .3s ease;
}
.pending-step.done {
  border-left-color: #22e6a0;
  color: #cbd5e1;
}
.pending-step.done > span:first-child {
  background: #22e6a0;
  color: #0a0a0f;
}
.pending-step.active {
  border-left-color: #ffc857;
  background: rgba(255, 200, 87, .06);
  color: #F8FAFC;
}
.pending-step.active > span:first-child {
  background: linear-gradient(135deg, #ffc857, #b8860b);
  color: #fff;
}

/* ── Mini spinner inside active step ── */
.spinner-mini {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  display: inline-block;
}

/* ── Check row ("This page checks automatically") ── */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-size: .78rem;
  color: #7de8c2;
  padding: 10px;
  background: rgba(34, 230, 160, .08);
  border-radius: 10px;
  margin-top: 14px;
}

.dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22e6a0;
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(34, 230, 160, .8);
}

/* ── Pending help line ── */
.pending-help {
  font-size: .78rem;
  color: #94a3b8;
  margin-top: 14px;
  line-height: 1.55;
}
.pending-help a {
  color: #7de8ff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Sign-out button in pending card */
.pending-card #pendingLogout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
  font-size: 12px;
  color: #cbd5e1;
}
.pending-card #pendingLogout:hover { background: rgba(255, 255, 255, .14); }


/* ─────────────────────────────────────────────────────────────
   9. APP SHELL — TOPBAR, BRAND, USER ACTIONS, TABS
   ───────────────────────────────────────────────────────────── */
#appShell {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
#appShell.visible { display: flex; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.brand img {
  height: 32px;
  width: auto;
  max-height: 32px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.brand > i {
  font-size: 1.3rem;
  color: var(--accent-blue);
  line-height: 1;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Centered advanced tabs ── */
.tabs {
  position: sticky;
  top: 60px;
  z-index: 49;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: 40px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
  position: relative;
}
.tab-btn i {
  font-size: .92rem;
  transition: transform .25s ease;
}
.tab-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.tab-btn:hover i { transform: scale(1.12); }
.tab-btn.active {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 212, 255, .35);
  transform: translateY(-1px);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-blue);
  box-shadow: 0 0 12px var(--border-glow);
  animation: pulse 2s ease-in-out infinite;
}


/* ─────────────────────────────────────────────────────────────
   10. CONTENT — .main, .ptab, page headers
   ───────────────────────────────────────────────────────────── */
.main {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.ptab { display: none; }
.ptab.active {
  display: block;
  animation: fadeInUp .35s ease both;
}
.ptab.active > * { animation: fadeInUp .4s ease both; }
.ptab.active > *:nth-child(1) { animation-delay: .02s; }
.ptab.active > *:nth-child(2) { animation-delay: .06s; }
.ptab.active > *:nth-child(3) { animation-delay: .10s; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h1 {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-primary);
}
.page-header h1 .pillar-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  background: var(--gradient-accent);
  box-shadow: 0 4px 14px rgba(0, 212, 255, .35);
}
.page-header h1 .highlight {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-desc {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 6px;
  max-width: 780px;
  line-height: 1.5;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}


/* ─────────────────────────────────────────────────────────────
   11. SHARED COMPONENTS
   ───────────────────────────────────────────────────────────── */

/* ── Buttons ── */
.btn {
  padding: 9px 16px;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: all .22s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--glass-bg);
  color: var(--text-primary);
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -8px rgba(0, 212, 255, .35);
  border-color: var(--accent-blue);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(0, 212, 255, .4);
}
.btn-success {
  background: linear-gradient(135deg, #22e6a0, #0d9e6e);
  color: #fff;
  border-color: transparent;
}
.btn-danger {
  background: linear-gradient(135deg, #ff5c7c, #d92b4b);
  color: #fff;
  border-color: transparent;
}
.btn-gold {
  background: linear-gradient(135deg, #ffc857, #b8860b);
  color: #fff;
  border-color: transparent;
}
.btn-purple {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  border-color: transparent;
}
.btn-outline { background: transparent; }
.btn-sm { padding: 6px 14px; font-size: .72rem; }
.btn-xs { padding: 4px 10px; font-size: .65rem; }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── KPI grid + stat cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  padding: 16px 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-3d);
  position: relative;
  overflow: hidden;
  transition: .3s;
  animation: fadeInUp .5s ease both;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-accent);
}
.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-3d-strong);
}
.stat-card .stat-icon {
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-soft);
  color: var(--accent-blue);
  margin-bottom: 6px;
}
.stat-card .number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .label {
  font-size: .66rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-top: 2px;
  font-weight: 600;
}
.stat-card .kpi-sub {
  font-size: .66rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Badges ── */
.badge {
  padding: 3px 12px;
  border-radius: 40px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: inline-block;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}
.badge-active,
.badge-paid,
.badge-completed,
.badge-approved,
.badge-awarded,
.badge-certified {
  background: rgba(34, 230, 160, .14);
  color: var(--accent-green);
  border-color: rgba(34, 230, 160, .35);
}
.badge-pending,
.badge-inprogress,
.badge-submitted,
.badge-review,
.badge-awaiting {
  background: rgba(255, 200, 87, .14);
  color: var(--accent-gold);
  border-color: rgba(255, 200, 87, .35);
}
.badge-closed,
.badge-locked,
.badge-gray {
  background: rgba(148, 163, 184, .14);
  color: var(--text-secondary);
  border-color: rgba(148, 163, 184, .35);
}
.badge-overdue,
.badge-failed,
.badge-rejected {
  background: rgba(255, 92, 124, .14);
  color: var(--accent-red);
  border-color: rgba(255, 92, 124, .35);
}
.badge-purple {
  background: rgba(168, 85, 247, .14);
  color: var(--accent-purple);
  border-color: rgba(168, 85, 247, .35);
}
.badge-gold {
  background: rgba(255, 200, 87, .14);
  color: var(--accent-gold);
  border-color: rgba(255, 200, 87, .35);
}

/* ── Card grid + card-3d ── */
.card-3d-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (min-width: 900px) {
  .card-3d-grid { grid-template-columns: 1fr 1fr; }
}
.card-3d {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 18px;
  padding: 16px;
  position: relative;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-3d);
  display: flex;
  gap: 14px;
  align-items: center;
  transition: .4s;
  animation: fadeInUp .5s ease both;
  overflow: hidden;
}
.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 18px 0 0 18px;
}
.card-3d.completed::before,
.card-3d.done::before { background: linear-gradient(180deg, var(--accent-green), #0d9e6e); }
.card-3d.inprogress::before { background: linear-gradient(180deg, var(--accent-gold), #b8860b); }
.card-3d.pending::before { background: linear-gradient(180deg, var(--accent-purple), #7c3aed); }
.card-3d:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3d-strong);
}
.card-3d .card-icon {
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--gradient-soft);
  color: var(--accent-blue);
  flex-shrink: 0;
}
.card-3d .card-info { flex: 1; min-width: 0; }
.card-3d .card-title {
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-primary);
}
.card-3d .card-sub {
  font-size: .76rem;
  color: var(--text-secondary);
  margin-top: 3px;
}
.card-3d .card-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.card-3d .card-stats .stat {
  display: flex;
  flex-direction: column;
}
.card-3d .card-stats .val {
  font-weight: 700;
  font-size: .82rem;
  color: var(--text-primary);
}
.card-3d .card-stats .lbl {
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: .56rem;
  letter-spacing: .4px;
}
.card-3d .card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

/* ── Progress bars ── */
.progress-3d {
  height: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .15));
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .40);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.progress-3d-bar {
  height: 100%;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, .25) 100%),
    var(--gradient-accent);
  transition: width 1s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 0 20px rgba(0, 212, 255, .65);
}
.progress-3d-bar.green {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, .25) 100%),
    linear-gradient(90deg, #22e6a0, #0d9e6e);
}
.progress-3d-bar.gold {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, .25) 100%),
    linear-gradient(90deg, #ffc857, #b8860b);
}
.progress-3d-label {
  display: flex;
  justify-content: space-between;
  font-size: .66rem;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary);
  font-size: .85rem;
  line-height: 1.6;
}

/* ── Chart box ── */
.chart-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 18px;
  box-shadow: var(--shadow-3d);
  position: relative;
  overflow: hidden;
  animation: fadeInUp .55s ease both;
  margin-bottom: 20px;
}
.chart-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
}
.chart-box h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Tables ── */
.table-wrapper {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left;
  padding: 13px 12px 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: .85rem;
  color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-table-alt); }


/* ─────────────────────────────────────────────────────────────
   12. PORTAL-SPECIFIC — modules, lessons, quizzes, checklists, certs, resources
   ───────────────────────────────────────────────────────────── */

/* ── Module list ── */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.module-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-input);
  border-radius: 12px;
  border-left: 4px solid var(--accent-blue);
  cursor: pointer;
  transition: .2s;
}
.module-item:hover {
  background: var(--bg-table-alt);
  transform: translateX(3px);
}
.module-item.done { border-left-color: var(--accent-green); opacity: .85; }
.module-item.quiz { border-left-color: var(--accent-purple); }
.module-item.quiz.done { border-left-color: var(--accent-green); }
.module-item.submitted { border-left-color: var(--accent-gold); }
.module-item.locked { opacity: .5; cursor: not-allowed; }
.module-item .mod-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-soft);
  color: var(--accent-blue);
  flex-shrink: 0;
  font-size: .8rem;
  font-weight: 700;
}
.module-item.done .mod-icon { background: linear-gradient(135deg, #22e6a0, #0d9e6e); color: #fff; }
.module-item.quiz .mod-icon { background: linear-gradient(135deg, #a855f7, #7c3aed); color: #fff; }
.module-item .mod-body { flex: 1; min-width: 0; }
.module-item .mod-title { font-weight: 600; font-size: .85rem; color: var(--text-primary); }
.module-item .mod-meta { font-size: .7rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Lesson content ── */
.lesson-content {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  line-height: 1.7;
  font-size: .9rem;
  margin: 16px 0;
  max-height: 60vh;
  overflow-y: auto;
  color: var(--text-primary);
}
.lesson-content h2 { margin: 16px 0 8px; font-size: 1.1rem; color: var(--text-primary); }
.lesson-content h3 { margin: 12px 0 6px; font-size: .95rem; color: var(--text-primary); }
.lesson-content p { margin: 8px 0; }
.lesson-content ul,
.lesson-content ol { margin: 8px 0 8px 20px; }
.lesson-content code {
  background: rgba(0, 212, 255, .1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: .85em;
  color: var(--accent-blue);
}
.lesson-content pre {
  background: var(--bg-card-solid);
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: monospace;
  font-size: .82em;
  margin: 10px 0;
  border: 1px solid var(--border-color);
}
.lesson-content img {
  max-width: 100%;
  border-radius: 10px;
  margin: 10px 0;
}
.lesson-content iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 10px;
  margin: 10px 0;
}
.lesson-video { margin: 14px 0; }

/* ── Quiz ── */
.quiz-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
}
.quiz-question {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg-card-solid);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: .2s;
  font-size: .88rem;
  color: var(--text-primary);
}
.quiz-option:hover { border-color: var(--accent-blue); }
.quiz-option.selected { border-color: var(--accent-blue); background: var(--gradient-soft); }
.quiz-option.correct { border-color: var(--accent-green); background: rgba(34, 230, 160, .1); }
.quiz-option.wrong { border-color: var(--accent-red); background: rgba(255, 92, 124, .1); }
.quiz-option input { width: auto; accent-color: var(--accent-blue); }

/* ── Checklist ── */
.checklist-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: 10px;
  border-left: 3px solid var(--accent-blue);
  margin-bottom: 8px;
  transition: .2s;
  cursor: pointer;
}
.checklist-item:hover { background: var(--bg-table-alt); }
.checklist-item.done {
  border-left-color: var(--accent-green);
  background: rgba(34, 230, 160, .05);
}
.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent-green);
  flex-shrink: 0;
}
.checklist-item .cl-text {
  flex: 1;
  font-size: .85rem;
  line-height: 1.5;
  user-select: none;
  color: var(--text-primary);
}
.checklist-item.done .cl-text {
  text-decoration: line-through;
  color: var(--text-light);
}
.checklist-item .cl-required {
  font-size: .6rem;
  color: var(--accent-gold);
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
}

/* ── Certificates ── */
.cert-card {
  background: linear-gradient(135deg, rgba(255, 200, 87, .1) 0%, rgba(0, 212, 255, .1) 100%);
  border: 2px solid var(--accent-gold);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}
.cert-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 200, 87, .15) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
}
.cert-card h3 {
  font-size: 1.2rem;
  position: relative;
  z-index: 1;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cert-card .cert-icon {
  font-size: 3rem;
  color: var(--accent-gold);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 12px rgba(255, 200, 87, .6));
}
.cert-code {
  font-family: monospace;
  font-size: .75rem;
  background: var(--bg-card-solid);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 8px;
  position: relative;
  z-index: 1;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.cert-pending {
  background: linear-gradient(135deg, rgba(255, 200, 87, .08) 0%, rgba(168, 85, 247, .08) 100%);
  border: 2px dashed var(--accent-gold);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 14px;
}
.cert-pending .cert-icon {
  font-size: 3rem;
  color: var(--accent-gold);
  margin-bottom: 8px;
  opacity: .6;
}

/* ── Resources ── */
.resource-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: .2s;
}
.resource-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}
.resource-card .res-icon {
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}
.resource-card .res-body { flex: 1; min-width: 0; }
.resource-card .res-title {
  font-weight: 600;
  font-size: .88rem;
  color: var(--text-primary);
}
.resource-card .res-meta {
  font-size: .7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Avatars (used in course cards, cert cards) ── */
.avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: .85rem;
  overflow: hidden;
  background: var(--gradient-accent);
  flex-shrink: 0;
  border: 2px solid var(--bg-card-solid);
}
.avatar-mini.lg {
  width: 52px;
  height: 52px;
  font-size: 1.15rem;
  border-radius: 14px;
}


/* ─────────────────────────────────────────────────────────────
   13. MODALS
   ───────────────────────────────────────────────────────────── */
/* ════════ MODALS (learner portal) ════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 7, 13, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 180ms ease;
}
.modal-overlay.active { display: flex !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #12121a;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 60px rgba(0, 212, 255, 0.12);
}
.modal.xl { max-width: 820px; }

/* Forms inside modals */
.modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.modal input,
.modal textarea,
.modal select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #0f1117;
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  outline: none;
}
.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.14);
}


/* ─────────────────────────────────────────────────────────────
   14. TOASTS + LOADING + LIVE SYNC
   ───────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: 100%;
  padding: 0 12px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeInUp .35s;
  font-size: .88rem;
  color: var(--text-primary);
  pointer-events: auto;
}
.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error   { border-left: 4px solid var(--accent-red); }
.toast.info    { border-left: 4px solid var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-gold); }
.toast .toast-close {
  margin-left: auto;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  padding: 0 4px;
  transition: color .2s ease;
}
.toast .toast-close:hover { color: var(--text-primary); }

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity .5s;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}
.loading-overlay .spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(0, 212, 255, .15);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.loading-overlay .loading-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.live-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  color: var(--accent-green);
  background: rgba(34, 230, 160, .1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(34, 230, 160, .3);
}
.live-sync .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(34, 230, 160, .9);
}


/* ─────────────────────────────────────────────────────────────
   15. MOBILE CHROME (≤899px + body.is-app-view)
   ───────────────────────────────────────────────────────────── */
#mobileAppBar,
#mobileBottomNav { display: none; }

@media (max-width: 899px) {
  html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .topbar { display: none; }
  .tabs   { display: none; }

  body.is-app-view #mobileAppBar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--header-h) + env(safe-area-inset-top, 0));
    z-index: 210;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
  }
  body.is-app-view #mobileAppBar .mab-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
  }
  body.is-app-view #mobileAppBar .mab-brand img {
    height: 26px;
    width: auto;
    max-height: 26px;
    border-radius: 9px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
  }
  body.is-app-view #mobileAppBar .mab-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    cursor: pointer;
  }

  body.is-app-view #mobileBottomNav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
    z-index: 210;
    justify-content: space-around;
    align-items: center;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0));
    background: var(--bg-card-solid);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .3);
  }
  body.is-app-view #mobileBottomNav .mnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: .55rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 12px;
    transition: color .2s ease;
  }
  body.is-app-view #mobileBottomNav .mnav-item i {
    font-size: 1.1rem;
    transition: transform .25s ease;
  }
  body.is-app-view #mobileBottomNav .mnav-item.active {
    color: var(--accent-blue);
  }
  body.is-app-view #mobileBottomNav .mnav-item.active i {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 0 8px var(--border-glow));
  }

  body.is-app-view .main {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0));
    left: 0; right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
    padding: 14px 12px 24px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .card-3d {
    flex-direction: column;
    text-align: center;
    padding: 14px;
    gap: 10px;
  }
  .card-3d .card-actions {
    justify-content: center;
    width: 100%;
  }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px 10px; }
  .stat-card .number { font-size: 1.05rem; }

  .modal {
    max-width: 100% !important;
    border-radius: 22px 22px 0 0;
    max-height: 90vh;
    padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0));
  }

  .toast-container {
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0) + 10px);
    left: 8px; right: 8px;
    max-width: none;
    padding: 0;
  }

  /* Login screen also adjusts on mobile */
  #loginScreen { padding: 16px; }
  .login-card {
    padding: 28px 22px 24px;
    border-radius: 20px;
  }
  .login-brand h1 { font-size: 18px; }
  .login-brand .logo-mark { width: 48px; height: 48px; font-size: 20px; }
}


/* ─────────────────────────────────────────────────────────────
   16. PRINT
   ───────────────────────────────────────────────────────────── */
@media print {
  .topbar,
  .tabs,
  .no-print,
  .toast-container,
  #mobileAppBar,
  #mobileBottomNav,
  #loginScreen,
  #pendingScreen { display: none !important; }

  body { background: #fff !important; color: #000 !important; }
  .main { padding: 0 !important; }
}
