/* ============================================================
   AutoLearn — App CSS
   Multi-device responsive: desktop / tablet / mobile
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* Brand colors */
  --blue:          #0057FF;
  --blue-dark:     #0041CC;
  --blue-light:    #EFF6FF;
  --blue-muted:    rgba(0,87,255,0.08);
  --cyan:          #00C8E0;
  --green:         #00C896;
  --orange:        #FF5C1A;
  --yellow:        #FFB800;
  --red:           #EF4444;

  /* Neutrals */
  --ink:           #0A1628;
  --ink2:          #1E3A5F;
  --ink3:          #4A6785;
  --ink4:          #8BA3BE;
  --bg:            #F0F4F8;
  --bg2:           #E8EEF5;
  --white:         #FFFFFF;
  --border:        #C8D8E8;
  --border2:       #D8E5F0;

  /* Tier badge colors */
  --tier-free:     #6B7280;
  --tier-pro:      #0057FF;
  --tier-corp:     #7C3AED;

  /* Spacing */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  32px;
  --sp-2xl: 48px;
  --sp-3xl: 64px;

  /* Typography */
  --font-sans:    'Cabinet Grotesk', 'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;

  /* Layout */
  --nav-h:          60px;
  --sidebar-w:      256px;
  --sidebar-w-col:  72px;   /* collapsed icon-only */
  --container:      1280px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(0,87,255,0.06);
  --shadow-sm:  0 2px 8px  rgba(0,87,255,0.08);
  --shadow-md:  0 4px 20px rgba(0,87,255,0.10);
  --shadow-lg:  0 8px 40px rgba(0,87,255,0.14);

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full: 9999px;

  /* Transitions */
  --t: 0.18s ease;
  --t-slow: 0.35s ease;
}

/* ── Dark mode ──────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #0D1B2A;
    --bg2:    #162033;
    --white:  #1A2740;
    --ink:    #E2ECF8;
    --ink2:   #B8CDE0;
    --ink3:   #8BA3BE;
    --ink4:   #4A6785;
    --border: #263850;
    --border2:#1E3050;
    --blue-muted: rgba(0,87,255,0.15);
    --blue-light: rgba(0,87,255,0.15);
  }
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.15; color: var(--ink); }
h2 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); font-weight: 700; line-height: 1.2; color: var(--ink); }
h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
h4 { font-size: 0.95rem; font-weight: 600; color: var(--ink2); }
p  { color: var(--ink3); line-height: 1.65; }
small { font-size: 0.8rem; color: var(--ink4); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--nav-h) 1fr;
  min-height: 100vh;
}

.main-content {
  grid-column: 2;
  grid-row: 2;
  padding: var(--sp-xl);
  max-width: 100%;
  overflow-x: hidden;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
}

.page-header {
  margin-bottom: var(--sp-xl);
}
.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}
.page-subtitle { color: var(--ink3); font-size: 0.9rem; }

/* ── Top Nav ────────────────────────────────────────────────── */
.app-nav {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-xl);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.nav-brand {
  display: flex; align-items: center; gap: var(--sp-sm);
  font-family: var(--font-display);
  font-size: 1.3rem; letter-spacing: 0.08em;
  color: var(--ink); text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }

.nav-brand-icon {
  width: 32px; height: 32px;
  background: var(--blue); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 800;
  font-family: var(--font-sans);
}

.nav-right {
  display: flex; align-items: center; gap: var(--sp-md);
}

.nav-user-info {
  display: flex; align-items: center; gap: var(--sp-sm);
}

.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-muted);
  border: 2px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--blue);
  flex-shrink: 0;
}

.nav-name {
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
}

.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; padding: 4px;
}
.nav-hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--ink3); border-radius: 2px;
  transition: var(--t);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.app-sidebar {
  grid-column: 1;
  grid-row: 2;
  width: var(--sidebar-w);
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--sp-lg) 0;
}

.sidebar-section {
  margin-bottom: var(--sp-lg);
}
.sidebar-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink4);
  padding: 0 var(--sp-md) var(--sp-xs);
}

.sidebar-link {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  font-size: 0.9rem; font-weight: 500;
  color: var(--ink3);
  text-decoration: none;
  border-radius: 0;
  transition: var(--t);
  position: relative;
}
.sidebar-link:hover { background: var(--blue-muted); color: var(--blue); text-decoration: none; }
.sidebar-link.active {
  background: var(--blue-muted); color: var(--blue); font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--blue); border-radius: 0 2px 2px 0;
}

.sidebar-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--blue); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 1px 7px; border-radius: var(--r-full);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--sp-md);
  border-top: 1px solid var(--border);
}

/* ── Tier Badge ─────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: var(--r-full);
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.tier-badge.free  { background: #F3F4F6; color: var(--tier-free); }
.tier-badge.pro   { background: var(--blue-light); color: var(--blue); }
.tier-badge.corp  { background: #F5F3FF; color: var(--tier-corp); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-sm);
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); color: white; }

.btn-secondary {
  background: var(--bg);
  color: var(--ink2);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-muted); }

.btn-ghost { background: none; color: var(--ink3); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg2); color: var(--ink); }

.btn-danger { background: #FEF2F2; color: var(--red); border: 1.5px solid #FCA5A5; }
.btn-danger:hover { background: var(--red); color: white; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-icon-only {
  padding: 8px;
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--ink3);
}
.btn-icon-only:hover { border-color: var(--blue); color: var(--blue); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-xs); }
.form-group + .form-group { margin-top: var(--sp-md); }

.form-label {
  font-size: 0.85rem; font-weight: 600;
  color: var(--ink2);
}
.form-label small { font-weight: 400; color: var(--ink4); }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: border-color var(--t);
  outline: none;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,87,255,0.1); }
.form-input::placeholder { color: var(--ink4); }
.form-input[readonly] { background: var(--bg); color: var(--ink3); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238BA3BE' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  font-size: 0.82rem; color: var(--red);
  display: flex; align-items: center; gap: 4px;
}
.form-error::before { content: '⚠'; font-size: 0.9em; }

.form-success {
  font-size: 0.82rem; color: var(--green);
  display: flex; align-items: center; gap: 4px;
}
.form-success::before { content: '✓'; }

.form-hint { font-size: 0.78rem; color: var(--ink4); }

.form-divider {
  display: flex; align-items: center; gap: var(--sp-md);
  margin: var(--sp-lg) 0;
  color: var(--ink4); font-size: 0.8rem;
}
.form-divider::before, .form-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Auth pages (login, register, reset) ────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.auth-visual {
  flex: 1;
  background: var(--ink);
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: var(--sp-3xl);
  position: relative; overflow: hidden;
}

.auth-visual-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0A1628 0%, #0D2147 60%, #0A1628 100%);
  opacity: 0.9;
}

.auth-visual-content { position: relative; z-index: 1; }

.auth-visual-brand {
  font-family: var(--font-display);
  font-size: 2rem; letter-spacing: 0.1em;
  color: white; margin-bottom: var(--sp-2xl);
  display: flex; align-items: center; gap: var(--sp-sm);
}
.auth-visual-icon {
  width: 40px; height: 40px;
  background: var(--blue); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: white; font-family: var(--font-sans);
}

.auth-visual-tagline {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 800; color: white;
  line-height: 1.15; margin-bottom: var(--sp-lg);
}
.auth-visual-tagline span { color: var(--blue); }

.auth-visual-sub {
  color: rgba(255,255,255,0.5);
  font-size: 0.95rem; line-height: 1.6;
  max-width: 380px;
}

.auth-visual-features {
  margin-top: var(--sp-2xl);
  display: flex; flex-direction: column; gap: var(--sp-sm);
}
.auth-feature {
  display: flex; align-items: center; gap: var(--sp-sm);
  font-size: 0.9rem; color: rgba(255,255,255,0.6);
}
.auth-feature::before {
  content: '✓';
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,200,150,0.15);
  color: var(--green); font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.auth-panel {
  width: 480px; min-width: 480px;
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-3xl) var(--sp-2xl);
  background: var(--white);
  overflow-y: auto;
}

.auth-header { margin-bottom: var(--sp-xl); }
.auth-title { font-size: 1.7rem; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.auth-subtitle { color: var(--ink3); font-size: 0.95rem; }

.auth-footer {
  margin-top: var(--sp-lg);
  text-align: center;
  font-size: 0.85rem; color: var(--ink4);
}
.auth-footer a { color: var(--blue); font-weight: 600; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border2);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--ink); }
.card-subtitle { font-size: 0.82rem; color: var(--ink4); margin-top: 2px; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-lg);
  display: flex; flex-direction: column;
  gap: var(--sp-xs);
  box-shadow: var(--shadow-xs);
  transition: var(--t);
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--blue); }

.stat-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink4);
}
.stat-value {
  font-size: 1.8rem; font-weight: 800; color: var(--ink);
  line-height: 1;
}
.stat-sub { font-size: 0.8rem; color: var(--ink4); }
.stat-bar {
  height: 4px; background: var(--bg2); border-radius: 2px;
  margin-top: var(--sp-xs); overflow: hidden;
}
.stat-bar-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.6s ease; }

/* ── Module cards ───────────────────────────────────────────── */
.track-section { margin-bottom: var(--sp-2xl); }
.track-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-lg);
}
.track-title {
  font-size: 1.05rem; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: var(--sp-sm);
}
.track-meta { font-size: 0.8rem; color: var(--ink4); }
.track-tag {
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--bg2); color: var(--ink3);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.track-tag.locked { background: #FEF3C7; color: #92400E; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-md);
}

.module-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  display: flex; flex-direction: column; gap: var(--sp-sm);
  text-decoration: none; color: inherit;
  transition: var(--t);
  position: relative; overflow: hidden;
  min-height: 160px;
}
.module-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.module-card.locked { opacity: 0.65; cursor: not-allowed; }
.module-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); }
.module-card.completed { border-color: rgba(0,200,150,0.3); }
.module-card.completed::before {
  content: '✓';
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: white;
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.module-card-top {
  display: flex; align-items: center; justify-content: space-between;
}

.module-type-badge {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 8px;
  border-radius: var(--r-full);
}
.type-lesson  { background: #EFF6FF; color: var(--blue); }
.type-sim     { background: #F0FDF4; color: #15803D; }
.type-quiz    { background: #FFF7ED; color: #C2410C; }
.type-project { background: #F5F3FF; color: #7C3AED; }
.type-capstone{ background: #FEF2F2; color: #DC2626; }

.module-duration { font-size: 0.75rem; color: var(--ink4); font-family: var(--font-mono); }

.module-title {
  font-size: 0.9rem; font-weight: 700; color: var(--ink);
  line-height: 1.3; flex: 1;
}

.module-sim-tag {
  font-size: 0.72rem; color: var(--ink4); font-family: var(--font-mono);
}

.module-progress-bar {
  height: 3px; background: var(--bg2); border-radius: 2px; overflow: hidden;
}
.module-progress-fill {
  height: 100%; background: var(--blue); border-radius: 2px;
  transition: width 0.5s ease;
}
.module-progress-label {
  font-size: 0.72rem; color: var(--ink4);
}

.module-lock-overlay {
  position: absolute; inset: 0;
  background: rgba(240,244,248,0.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  backdrop-filter: blur(1px);
}

/* ── Simulator page ─────────────────────────────────────────── */
.sim-page {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--nav-h));
  padding: var(--sp-lg);
  gap: var(--sp-md);
}

.sim-header {
  display: flex; align-items: center; gap: var(--sp-md);
  flex-shrink: 0;
}
.sim-back {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--ink3);
  text-decoration: none;
  transition: var(--t);
}
.sim-back:hover { color: var(--blue); text-decoration: none; }

.sim-title { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.sim-tier-req { font-size: 0.75rem; color: var(--ink4); }

.sim-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-md);
  min-height: 0;
}

.sim-canvas-wrap {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
}

.sim-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sim-controls-panel {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-md);
}

.sim-ctrl-section {}
.sim-ctrl-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink4);
  margin-bottom: var(--sp-sm);
}

.sim-slider-row {
  display: flex; flex-direction: column; gap: 4px;
}
.sim-slider-label {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; color: var(--ink3);
}
.sim-slider-val { font-family: var(--font-mono); color: var(--blue); font-weight: 600; }

.sim-slider {
  -webkit-appearance: none;
  width: 100%; height: 4px;
  background: var(--border); border-radius: 2px; outline: none;
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0,87,255,0.15);
}
.sim-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); border: none; cursor: pointer;
}

.sim-metrics {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--sp-sm);
}
.sim-metric {
  background: var(--bg); border-radius: var(--r-sm);
  padding: 8px 10px;
}
.sim-metric-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink4); }
.sim-metric-val { font-size: 1rem; font-weight: 700; color: var(--ink); font-family: var(--font-mono); }

.sim-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--white); gap: var(--sp-md);
  font-size: 0.9rem; color: var(--ink4);
}

/* ── Account / Profile page ─────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--sp-xl);
  align-items: start;
}

.profile-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: var(--sp-md);
  box-shadow: var(--shadow-xs);
}

.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--blue-light);
  border: 3px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: var(--blue);
  flex-shrink: 0;
}
.profile-name { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.profile-email { font-size: 0.85rem; color: var(--ink4); }
.profile-since { font-size: 0.78rem; color: var(--ink4); font-family: var(--font-mono); }

.profile-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--sp-sm); width: 100%;
  padding-top: var(--sp-md); border-top: 1px solid var(--border2);
}
.profile-stat-item { text-align: center; }
.profile-stat-val { font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.profile-stat-key { font-size: 0.7rem; color: var(--ink4); text-transform: uppercase; letter-spacing: 0.06em; }

.account-sections { display: flex; flex-direction: column; gap: var(--sp-lg); }

.account-section {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-xs);
}
.account-section-title {
  font-size: 1rem; font-weight: 700; color: var(--ink);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-sm); border-bottom: 1px solid var(--border2);
}

.sub-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}
.sub-info-item {}
.sub-info-label { font-size: 0.75rem; color: var(--ink4); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.sub-info-val { font-size: 0.95rem; font-weight: 600; color: var(--ink); }

.cert-list { display: flex; flex-direction: column; gap: var(--sp-sm); }
.cert-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg); border-radius: var(--r-sm);
  border: 1px solid var(--border2);
}
.cert-item-title { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.cert-item-meta { font-size: 0.75rem; color: var(--ink4); font-family: var(--font-mono); }

/* ── Progress history ────────────────────────────────────────── */
.progress-list { display: flex; flex-direction: column; gap: var(--sp-sm); }
.progress-row {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: 10px var(--sp-md);
  background: var(--bg); border-radius: var(--r-sm);
  border: 1px solid var(--border2);
}
.progress-row-title { font-size: 0.88rem; font-weight: 600; color: var(--ink); flex: 1; }
.progress-row-score {
  font-size: 0.82rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--green); min-width: 50px; text-align: right;
}
.progress-row-status {
  font-size: 0.72rem; padding: 2px 8px; border-radius: var(--r-full);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-completed { background: #D1FAE5; color: #065F46; }
.status-started   { background: #FEF3C7; color: #92400E; }

/* ── Loading states ─────────────────────────────────────────── */
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.loading-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--sp-md);
  min-height: 300px; color: var(--ink4); font-size: 0.9rem;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--sp-xl); right: var(--sp-xl);
  z-index: 9999;
  display: flex; flex-direction: column; gap: var(--sp-sm);
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: white;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--sp-sm);
  max-width: 360px;
}
.toast.show,
.toast.visible { transform: translateX(0); }

/* Legacy single-dash variants */
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red);   }
.toast.toast-warn    { background: var(--yellow); color: var(--ink); }

/* Double-dash variants (used by app JS) */
.toast.toast--success { background: var(--green); }
.toast.toast--error   { background: var(--red);   }
.toast.toast--warn    { background: var(--yellow); color: var(--ink); }
.toast.toast--info    { background: var(--blue); }

/* SW update toast — persists with Reload button */
.update-toast {
  background: var(--ink);
  gap: var(--sp-md);
  min-width: 240px;
}
.update-toast__btn {
  background: white;
  color: var(--ink);
  border: none;
  border-radius: var(--r-sm);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--t);
}
.update-toast__btn:hover { background: var(--blue-light); color: var(--blue); }

/* ── Mobile bottom nav ──────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white);
  border-top: 1px solid var(--border);
  height: 64px;
  padding: 0 var(--sp-sm);
  justify-content: space-around; align-items: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 16px;
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink4);
  text-decoration: none; border-radius: var(--r-sm);
  transition: var(--t); flex: 1;
}
.bottom-nav-item:hover { text-decoration: none; }
.bottom-nav-item.active { color: var(--blue); }
.bottom-nav-icon { font-size: 1.3rem; }

/* ── Mobile overlay ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 89;
  background: rgba(10,22,40,0.4);
  backdrop-filter: blur(2px);
}

/* ── Upgrade banner ─────────────────────────────────────────── */
.upgrade-banner {
  background: linear-gradient(135deg, #1E3A5F, #0057FF);
  color: white;
  border-radius: var(--r-md);
  padding: var(--sp-lg) var(--sp-xl);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-lg); flex-wrap: wrap;
  margin-bottom: var(--sp-xl);
  box-shadow: var(--shadow-md);
}
.upgrade-banner-text h3 { color: white; margin-bottom: 4px; }
.upgrade-banner-text p  { color: rgba(255,255,255,0.7); font-size: 0.88rem; }
.btn-upgrade {
  background: white; color: var(--blue);
  padding: 10px 24px; border-radius: var(--r-sm);
  font-weight: 700; font-size: 0.9rem;
  white-space: nowrap; text-decoration: none;
  transition: var(--t);
}
.btn-upgrade:hover { background: var(--blue-light); text-decoration: none; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: var(--sp-3xl) var(--sp-lg);
  color: var(--ink4);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--sp-md); }
.empty-state h3 { color: var(--ink2); margin-bottom: var(--sp-sm); }

/* ── Alert ──────────────────────────────────────────────────── */
.alert {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  border-left: 3px solid;
  margin-bottom: var(--sp-md);
}
.alert-error   { background: #FEF2F2; border-color: var(--red);    color: #991B1B; }
.alert-success { background: #F0FDF4; border-color: var(--green);  color: #065F46; }
.alert-warn    { background: #FFFBEB; border-color: var(--yellow); color: #92400E; }
.alert-info    { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }
.alert[hidden] { display: none; }

/* ── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.text-muted { color: var(--ink4); }
.text-sm { font-size: 0.85rem; }
.text-mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Responsive — Tablet (≤ 1100px) ────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .account-grid { grid-template-columns: 1fr; }
  .sub-info-grid { grid-template-columns: 1fr; }
  .sim-shell { grid-template-columns: 1fr 260px; }
}

/* ── Responsive — Tablet portrait (≤ 900px) ────────────────── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }

  .app-sidebar {
    position: fixed;
    left: -100%; top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    z-index: 90;
    width: var(--sidebar-w);
    transition: left 0.28s ease;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { left: 0; }

  .sidebar-overlay { display: block; }
  .sidebar-overlay.show { display: block; }

  .main-content {
    grid-column: 1;
    padding: var(--sp-md);
    padding-bottom: 80px; /* room for bottom nav */
  }

  .nav-hamburger { display: flex; }
  .nav-name { display: none; }

  .bottom-nav { display: flex; }

  .sim-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sim-controls-panel { max-height: 300px; }

  .auth-visual { display: none; }
  .auth-panel { width: 100%; min-width: unset; padding: var(--sp-xl) var(--sp-lg); }
  .auth-page { min-height: 100dvh; }

  .module-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ── Responsive — Mobile (≤ 600px) ─────────────────────────── */
@media (max-width: 600px) {
  :root { --sp-xl: 20px; --sp-2xl: 32px; }

  .app-nav { padding: 0 var(--sp-md); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-sm); }
  .stat-value { font-size: 1.4rem; }

  .module-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .module-card { min-height: auto; }

  .profile-stats { grid-template-columns: repeat(4, 1fr); }

  .sim-shell { grid-template-rows: 300px auto; }

  .toast-container { bottom: 72px; right: var(--sp-md); left: var(--sp-md); }
  .toast { max-width: 100%; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
}

/* ── Responsive — Small mobile (≤ 400px) ───────────────────── */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .auth-panel { padding: var(--sp-lg) var(--sp-md); }
  .bottom-nav-item span { display: none; }
}

/* ============================================================
   Module page (module.php)
   ============================================================ */

.module-main { max-width: 900px; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--ink4);
  margin-bottom: var(--sp-lg);
}
.breadcrumb__item { text-decoration: none; color: var(--ink4); }
.breadcrumb__item:hover { color: var(--blue); }
.breadcrumb__item--active { color: var(--ink2); font-weight: 600; }
.breadcrumb__sep { color: var(--ink4); }

/* Module tab bar */
.module-tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-xl);
}
.module-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px var(--sp-md);
  font-size: 0.88rem; font-weight: 600; color: var(--ink3);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--t);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.module-tab:hover { color: var(--blue); background: var(--blue-muted); }
.module-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--blue-muted);
}
.module-tab[hidden] { display: none; }

/* Module panes */
.module-pane { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Sidebar section labels and dividers */
.sidebar-nav__divider {
  height: 1px; background: var(--border2);
  margin: var(--sp-sm) var(--sp-sm);
}
.sidebar-nav__section-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink4);
  padding: var(--sp-xs) var(--sp-sm);
  margin-top: var(--sp-xs);
}

/* ============================================================
   Simulator page (simulator.php)
   ============================================================ */

/* Sim header bar */
.sim-header {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.sim-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.82rem; color: var(--ink3);
  text-decoration: none; transition: var(--t);
  white-space: nowrap;
}
.sim-back:hover { color: var(--blue); text-decoration: none; }

.sim-header__info { flex: 1; min-width: 0; }
.sim-code  { font-size: 0.72rem; font-family: var(--font-mono); color: var(--ink4); }
.sim-title { font-size: 1.1rem; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sim-header__meta {
  display: flex; align-items: center; gap: var(--sp-sm);
  flex-shrink: 0;
}
.sim-duration {
  font-size: 0.78rem; color: var(--ink4); font-family: var(--font-mono);
}

/* Simulator shell: canvas + controls side by side */
.sim-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: 1fr;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.sim-canvas-wrap {
  position: relative;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.sim-canvas { display: block; width: 100%; height: 100%; }

/* Loading overlay inside canvas wrap */
.sim-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-md); font-size: 0.9rem; color: var(--ink4);
  background: var(--bg);
  z-index: 10;
}

.sim-controls-panel {
  background: var(--white);
  border-left: 1px solid var(--border);
  padding: var(--sp-md);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-md);
}

@media (max-width: 900px) {
  .sim-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 280px;
  }
  .sim-canvas-wrap { border-right: none; border-bottom: 1px solid var(--border); }
  .sim-controls-panel { border-left: none; }
}

@media (max-width: 600px) {
  .sim-header { padding: var(--sp-sm) var(--sp-md); }
  .sim-title { font-size: 0.95rem; }
  .sim-shell { grid-template-rows: 1fr 220px; }
  .module-tabs { gap: 2px; overflow-x: auto; }
  .module-tab { font-size: 0.8rem; padding: 8px var(--sp-sm); white-space: nowrap; }
}

/* ============================================================
   Auth pages (login / register / forgot / reset)
   ============================================================ */

.auth-body {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  background: var(--bg);
}

.auth-body--centered {
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl) var(--sp-md);
}

/* Split layout */
.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  min-height: 100dvh;
}

.auth-visual {
  background: linear-gradient(160deg, #0A1628 0%, #1E3A5F 60%, #0057FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3xl) var(--sp-2xl);
  position: relative;
  overflow: hidden;
}
.auth-visual::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(0,87,255,0.15);
  top: -100px; right: -100px;
}
.auth-visual::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(0,200,224,0.10);
  bottom: -80px; left: -60px;
}

.auth-visual__content {
  position: relative; z-index: 1;
  max-width: 420px;
}

.auth-logo {
  display: inline-flex; align-items: center; gap: var(--sp-sm);
  text-decoration: none; margin-bottom: var(--sp-2xl);
}
.auth-logo .logo-mark {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 900;
}
.auth-logo .logo-text {
  font-size: 1.25rem; font-weight: 800; color: white; letter-spacing: -0.02em;
}

.auth-logo--center {
  justify-content: center;
  margin-bottom: var(--sp-xl);
}
.auth-logo--center .logo-text { color: var(--ink); }

.auth-visual__headline {
  font-size: 2rem; font-weight: 900; color: white;
  line-height: 1.2; margin-bottom: var(--sp-md);
  letter-spacing: -0.02em;
}

.auth-visual__sub {
  font-size: 1rem; color: rgba(255,255,255,0.7);
  line-height: 1.6; margin-bottom: var(--sp-xl);
}

.auth-feature-list {
  list-style: none;
  display: flex; flex-direction: column; gap: var(--sp-sm);
}
.auth-feature-list li {
  font-size: 0.9rem; color: rgba(255,255,255,0.85);
  display: flex; align-items: center; gap: var(--sp-sm);
}
.auth-feature-list li::before {
  content: '✓';
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,200,150,0.25);
  color: #00C896;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

.auth-visual__pricing {
  display: flex; flex-wrap: wrap; gap: var(--sp-sm);
  margin-top: var(--sp-xl);
}
.auth-pricing-pill {
  font-size: 0.78rem; font-weight: 600;
  padding: 6px 14px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
}
.auth-pricing-pill--pro {
  background: rgba(0,87,255,0.3);
  border-color: rgba(0,87,255,0.5);
  color: white;
}

/* Form panel */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3xl) var(--sp-2xl);
  background: var(--white);
}

.auth-form-wrap {
  width: 100%; max-width: 440px;
}

/* Centered card (forgot/reset) */
.auth-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-2xl);
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 1.6rem; font-weight: 900; color: var(--ink);
  letter-spacing: -0.02em; margin-bottom: var(--sp-xs);
}
.auth-subtitle {
  font-size: 0.95rem; color: var(--ink4);
  margin-bottom: var(--sp-xl);
}

/* Auth form inputs */
.auth-form { display: flex; flex-direction: column; gap: var(--sp-md); }

.form-group {
  display: flex; flex-direction: column; gap: 6px;
}
.form-group label {
  font-size: 0.85rem; font-weight: 600; color: var(--ink2);
  display: flex; align-items: center; justify-content: space-between;
}
.form-label-link {
  font-size: 0.8rem; font-weight: 400; color: var(--blue);
  text-decoration: none;
}
.form-label-link:hover { text-decoration: underline; }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  padding: 11px var(--sp-md);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  transition: var(--t);
  outline: none;
  width: 100%;
}
.form-group input:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--blue-muted);
}
.form-group input::placeholder { color: var(--ink4); }
.form-hint {
  font-size: 0.78rem; color: var(--ink4);
}

.input-pw-wrap {
  position: relative;
}
.input-pw-wrap input { padding-right: 48px; }
.btn-toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink4);
  display: flex; align-items: center;
  padding: 4px;
}
.btn-toggle-pw svg { width: 18px; height: 18px; }
.btn-toggle-pw:hover { color: var(--ink2); }

.auth-terms {
  font-size: 0.8rem; color: var(--ink4); text-align: center;
  margin-top: -4px;
}
.auth-terms a { color: var(--blue); text-decoration: none; }
.auth-terms a:hover { text-decoration: underline; }

.auth-switch {
  text-align: center;
  font-size: 0.88rem; color: var(--ink4);
  margin-top: var(--sp-lg);
}
.auth-switch a { color: var(--blue); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* Auth alerts */
.auth-alert {
  padding: 12px var(--sp-md);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  margin-bottom: var(--sp-sm);
  border-left: 3px solid;
}
.auth-alert--success { background: #F0FDF4; border-color: var(--green); color: #065F46; }
.auth-alert--error   { background: #FEF2F2; border-color: var(--red);   color: #991B1B; }
.auth-alert[hidden]  { display: none; }

/* ── App shell (dashboard / account) ────────────────────────── */
.app-body { background: var(--bg); min-height: 100dvh; }

.app-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-lg);
  box-shadow: var(--shadow-xs);
}
.app-nav__left  { display: flex; align-items: center; gap: var(--sp-md); }
.app-nav__right { display: flex; align-items: center; gap: var(--sp-sm); }

.app-nav__logo {
  display: flex; align-items: center; gap: var(--sp-sm);
  text-decoration: none; font-weight: 800;
  font-size: 1.05rem; color: var(--ink);
  letter-spacing: -0.01em;
}
.app-nav__logo .logo-mark {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 900;
}

.btn-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.btn-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink3); border-radius: 2px;
  transition: var(--t);
}

.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue-light);
  border: 2px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; color: var(--blue);
  cursor: pointer; text-decoration: none;
  transition: var(--t);
}
.nav-avatar:hover { background: var(--blue); color: white; text-decoration: none; }
.nav-avatar--active { background: var(--blue); color: white; }

/* App layout grid */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100dvh - var(--nav-h));
  margin-top: var(--nav-h);
}

.app-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: var(--nav-h);
  height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  padding: var(--sp-md) 0;
}

.app-main {
  padding: var(--sp-xl);
  min-width: 0;
}

/* Sidebar internals */
.sidebar-user {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md) var(--sp-md);
  border-bottom: 1px solid var(--border2);
  margin-bottom: var(--sp-sm);
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; flex-shrink: 0;
}
.sidebar-user__name {
  font-size: 0.88rem; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 var(--sp-sm); flex: 1;
}
.sidebar-nav__item {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 9px var(--sp-sm);
  border-radius: var(--r-sm);
  font-size: 0.88rem; font-weight: 600; color: var(--ink3);
  text-decoration: none; transition: var(--t);
}
.sidebar-nav__item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav__item:hover { background: var(--blue-muted); color: var(--blue); text-decoration: none; }
.sidebar-nav__item.active { background: var(--blue-muted); color: var(--blue); }
.sidebar-nav__item--danger { color: var(--red); }
.sidebar-nav__item--danger:hover { background: rgba(239,68,68,0.08); color: var(--red); }

.sidebar-upgrade {
  margin: var(--sp-md) var(--sp-sm);
  padding: var(--sp-md);
  background: linear-gradient(135deg, var(--blue-light), #e0eaff);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.sidebar-upgrade__text {
  font-size: 0.78rem; color: var(--ink2);
  margin-bottom: var(--sp-sm); line-height: 1.4;
}

.sidebar-footer {
  border-top: 1px solid var(--border2);
  padding-top: var(--sp-sm);
  margin-top: auto;
  padding-left: var(--sp-sm); padding-right: var(--sp-sm);
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  box-shadow: var(--shadow-xs);
}
.stats-bar__item {
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; text-align: center;
  padding: var(--sp-sm) 0;
}
.stats-bar__item + .stats-bar__item {
  border-left: 1px solid var(--border2);
}
.stats-bar__value {
  font-size: 1.5rem; font-weight: 900; color: var(--ink);
  line-height: 1;
}
.stats-bar__label {
  font-size: 0.72rem; font-weight: 600; color: var(--ink4);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Curriculum root */
.curriculum-root { display: flex; flex-direction: column; gap: 0; }

.track-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-md);
  padding: var(--sp-md) 0;
  border-bottom: 2px solid var(--border);
}
.track-header__info {}
.track-header__title {
  font-size: 1.1rem; font-weight: 800; color: var(--ink);
  display: flex; align-items: center; gap: var(--sp-sm);
  margin-bottom: 4px;
}
.track-num {
  font-size: 0.7rem; font-weight: 900; color: var(--blue);
  background: var(--blue-muted);
  padding: 2px 8px; border-radius: var(--r-full);
  font-family: var(--font-mono);
}
.track-header__desc { font-size: 0.85rem; color: var(--ink4); }

/* Module cards — extended from existing */
.module-card__header {
  display: flex; align-items: center; justify-content: space-between;
}
.module-card__check svg, .module-card__lock svg { width: 16px; height: 16px; }
.module-card__check { color: var(--green); }
.module-card__lock  { color: var(--ink4); }
.module-card__code  { font-size: 0.7rem; font-family: var(--font-mono); color: var(--ink4); }
.module-card__title { font-size: 0.9rem; font-weight: 700; color: var(--ink); line-height: 1.3; flex: 1; }
.module-card__meta  { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--ink4); }
.module-card__score { font-weight: 700; color: var(--green); font-family: var(--font-mono); }
.module-card__progress-bar { height: 3px; background: var(--bg2); border-radius: 2px; overflow: hidden; }
.module-card__progress-fill { height: 100%; background: var(--blue); border-radius: 2px; }
.module-card__locked-overlay {
  position: absolute; inset: 0;
  background: rgba(240,244,248,0.75);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--ink3);
  border-radius: var(--r-md);
  backdrop-filter: blur(1px);
}
.module-card--completed { border-color: rgba(0,200,150,0.4); background: #f6fffe; }
.module-card--started   { border-color: rgba(0,87,255,0.3); }
.module-card--locked    { opacity: 0.7; cursor: not-allowed; }
.module-card--locked:hover { transform: none !important; box-shadow: none !important; border-color: var(--border) !important; }

/* Module type badges */
.module-type-badge--lesson  { background: #EFF6FF; color: var(--blue); }
.module-type-badge--sim     { background: #F0FDF4; color: #15803D; }
.module-type-badge--quiz    { background: #FFF7ED; color: #C2410C; }
.module-type-badge--project { background: #F5F3FF; color: #7C3AED; }
.module-type-badge--capstone{ background: #FEF2F2; color: #DC2626; }

/* Error / empty in content area */
.error-msg  { color: var(--red); padding: var(--sp-xl); text-align: center; }
.empty-msg  { color: var(--ink4); font-size: 0.9rem; text-align: center; padding: var(--sp-xl); }

/* Skeleton loading */
.skeleton-block {
  height: 60px; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* Page title */
.page-title {
  font-size: 1.5rem; font-weight: 900; color: var(--ink);
  letter-spacing: -0.02em; margin-bottom: var(--sp-xl);
}

/* Account page */
.account-page { max-width: 800px; }

.account-section { margin-bottom: var(--sp-xl); }
.account-section__title {
  font-size: 1rem; font-weight: 700; color: var(--ink);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border2);
  margin-bottom: var(--sp-lg);
}

.account-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-xs);
}

/* Profile header inside account card */
.profile-header {
  display: flex; align-items: center; gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--border2);
}
.profile-meta {}
.profile-name  { font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.profile-email { font-size: 0.88rem; color: var(--ink4); margin-top: 2px; }
.profile-joined{ font-size: 0.78rem; color: var(--ink4); font-family: var(--font-mono); margin-top: 4px; }
.badge-unverified {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  background: #FEF3C7; color: #92400E;
  padding: 2px 6px; border-radius: var(--r-full);
  margin-left: 6px;
}

/* Account form */
.account-form { display: flex; flex-direction: column; gap: var(--sp-md); }
.form-actions { display: flex; gap: var(--sp-sm); padding-top: var(--sp-sm); }

/* Billing section */
.billing-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-lg);
  flex-wrap: wrap;
}
.billing-plan { display: flex; align-items: center; gap: var(--sp-md); }
.billing-plan__detail {}
.billing-plan__name   { font-size: 1rem; font-weight: 700; color: var(--ink); }
.billing-plan__renews { font-size: 0.82rem; color: var(--ink4); margin-top: 2px; }

/* Tier badge sizes */
.tier-badge--lg {
  font-size: 0.75rem; padding: 5px 14px;
}

/* Certs list */
.cert-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg); border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  margin-bottom: var(--sp-sm);
}
.cert-list-item__module { font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.cert-list-item__meta   { font-size: 0.75rem; color: var(--ink4); font-family: var(--font-mono); margin-top: 2px; }

/* Progress table */
.progress-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.progress-table th {
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink4); padding: 8px var(--sp-sm);
  border-bottom: 2px solid var(--border);
}
.progress-table td {
  padding: 10px var(--sp-sm);
  border-bottom: 1px solid var(--border2);
  color: var(--ink);
}
.progress-table tr:last-child td { border-bottom: none; }
.progress-table tr:hover td { background: var(--bg); }

.status-pill {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 2px 8px; border-radius: var(--r-full);
}
.status-pill--completed { background: #D1FAE5; color: #065F46; }
.status-pill--started   { background: #FEF3C7; color: #92400E; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 0.9rem; font-weight: 700;
  font-family: var(--font-sans); cursor: pointer;
  text-decoration: none; border: 1.5px solid transparent;
  transition: var(--t); white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--primary {
  background: var(--blue); color: white; border-color: var(--blue);
}
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn--outline {
  background: transparent; color: var(--blue); border-color: var(--blue);
}
.btn--outline:hover { background: var(--blue-muted); }

.btn--sm { padding: 6px 14px; font-size: 0.82rem; }
.btn--full { width: 100%; }

/* Tier badges */
.tier-badge {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 3px 10px; border-radius: var(--r-full);
}
.tier-badge--free { background: #F3F4F6; color: #4B5563; border: 1px solid #D1D5DB; }
.tier-badge--pro  { background: var(--blue-light); color: var(--blue); border: 1px solid rgba(0,87,255,0.2); }
.tier-badge--corp { background: #F5F3FF; color: #7C3AED; border: 1px solid rgba(124,58,237,0.2); }

/* Sidebar visible on all ≤900px */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    left: -260px; top: var(--nav-h);
    height: calc(100dvh - var(--nav-h));
    z-index: 90;
    width: var(--sidebar-w);
    transition: left 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { left: 0; }
  .sidebar-overlay.visible { opacity: 1; pointer-events: auto; }
  .sidebar-overlay {
    display: block;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .btn-hamburger { display: flex; }
  .app-main { padding: var(--sp-md); padding-bottom: 80px; }
  .sim-app-main { padding: 0; padding-bottom: 0; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .stats-bar__item + .stats-bar__item { border-left: none; }
  .stats-bar__item:nth-child(odd) { border-right: 1px solid var(--border2); }
}

@media (max-width: 600px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-panel { padding: var(--sp-xl) var(--sp-md); }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .account-card { padding: var(--sp-md); }
  .billing-row { flex-direction: column; align-items: flex-start; }
  .progress-table { display: block; overflow-x: auto; }
}

@media (max-width: 400px) {
  .auth-card { padding: var(--sp-lg) var(--sp-md); }
  .stats-bar { grid-template-columns: 1fr; }
  .stats-bar__item + .stats-bar__item { border-left: none; border-top: 1px solid var(--border2); }
  .stats-bar__item:nth-child(odd) { border-right: none; }
}

/* ── Lesson Player & Prose ───────────────────────────────── */
.player {
  max-width: 840px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.player-header {
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border2);
}
.player-meta-row {
  display: flex; align-items: center; gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}
.player-type { font-size: 0.75rem; color: var(--ink4); text-transform: uppercase; letter-spacing: 0.05em; }
.player-duration { font-size: 0.75rem; color: var(--ink4); }
.player-title { font-size: 1.6rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.player-footer { margin-top: var(--sp-xl); padding-top: var(--sp-lg); border-top: 1px solid var(--border2); }
.player-complete-msg { color: var(--green); font-weight: 600; }

/* Prose typography — renders module content HTML */
.prose { line-height: 1.75; color: var(--ink); }
.prose h2 { font-size: 1.25rem; font-weight: 700; margin: var(--sp-xl) 0 var(--sp-md); color: var(--ink); }
.prose h3 { font-size: 1rem; font-weight: 700; margin: var(--sp-lg) 0 var(--sp-sm); color: var(--ink2); }
.prose p  { margin-bottom: var(--sp-md); }
.prose ul, .prose ol { margin: 0 0 var(--sp-md) var(--sp-lg); }
.prose li { margin-bottom: var(--sp-xs); }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  white-space: nowrap;
}
.prose table {
  width: 100%; border-collapse: collapse;
  margin: var(--sp-lg) 0;
  font-size: 0.9rem;
}
.prose thead { background: var(--bg2); }
.prose th, .prose td {
  text-align: left;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--border);
}
.prose th { font-weight: 700; color: var(--ink2); }
.prose tr:hover { background: var(--bg); }

/* Callout boxes */
.callout {
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  margin: var(--sp-lg) 0;
  border-left: 4px solid;
  font-size: 0.95rem;
}
.callout--info  { background: var(--blue-muted); border-color: var(--blue); color: var(--ink2); }
.callout--warn  { background: rgba(255,184,0,0.1); border-color: var(--yellow); color: var(--ink2); }
.callout--error { background: rgba(239,68,68,0.08); border-color: var(--red); color: var(--ink2); }
.callout strong { font-weight: 700; }

/* Player loading / error states */
.player-loading {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-3xl); gap: var(--sp-md); color: var(--ink4);
}
.player-error {
  padding: var(--sp-xl); text-align: center; color: var(--red);
  background: rgba(239,68,68,0.06); border-radius: var(--r-md);
  margin: var(--sp-xl);
}

/* Complete button */
.btn-complete {
  background: var(--green); color: white;
  border: none; border-radius: var(--r-md);
  padding: var(--sp-sm) var(--sp-xl);
  font-weight: 700; cursor: pointer; font-size: 0.95rem;
  transition: var(--t);
}
.btn-complete:hover { opacity: 0.85; }
.btn-complete:disabled { opacity: 0.5; cursor: not-allowed; }

/* Module tabs */
.module-tabs { display: flex; gap: 2px; padding: 0 var(--sp-lg); border-bottom: 1px solid var(--border); }
.module-tab {
  display: flex; align-items: center; gap: 6px;
  padding: var(--sp-sm) var(--sp-md);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; color: var(--ink4); font-size: 0.9rem; font-weight: 500;
  transition: var(--t);
}
.module-tab:hover { color: var(--ink); }
.module-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.module-pane { min-height: 400px; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  font-size: 0.85rem; color: var(--ink4);
}
.breadcrumb__item { text-decoration: none; color: var(--ink4); }
.breadcrumb__item:first-child { color: var(--blue); }
.breadcrumb__sep { color: var(--border); }
.breadcrumb__item--active { color: var(--ink); }

/* Skeleton loading */
.skeleton-block {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
  height: 60px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Bottom nav items — BEM double-underscore alias ─────────── */
.bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 16px;
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink4);
  text-decoration: none; border-radius: var(--r-sm);
  transition: var(--t); flex: 1;
  background: none; border: none; cursor: pointer; font-family: var(--font-sans);
}
.bottom-nav__item:hover { text-decoration: none; color: var(--ink2); }
.bottom-nav__item.active { color: var(--blue); }
.bottom-nav__item svg { width: 22px; height: 22px; }

/* ── Sidebar nav button reset ────────────────────────────────── */
button.sidebar-nav__item {
  background: none; border: none; width: 100%; cursor: pointer;
  text-align: left; font-family: var(--font-sans);
}

/* ── Dashboard welcome ───────────────────────────────────────── */
.dash-welcome { margin-bottom: var(--sp-xl); }
.dash-welcome__title {
  font-size: 1.5rem; font-weight: 900; color: var(--ink);
  letter-spacing: -0.02em; line-height: 1.2;
}
.dash-welcome__sub { font-size: 0.88rem; color: var(--ink4); margin-top: 4px; }

/* ── Dashboard tab bar ───────────────────────────────────────── */
.dash-tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-xl);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.dash-tab-bar::-webkit-scrollbar { display: none; }

.dash-tab {
  flex-shrink: 0;
  padding: 11px var(--sp-md);
  border: none; background: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.88rem; font-weight: 600;
  color: var(--ink4);
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
  white-space: nowrap;
  font-family: var(--font-sans);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.dash-tab:hover { color: var(--ink); background: var(--bg2); }
.dash-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Dashboard panels ────────────────────────────────────────── */
.dash-panel { display: none; }
.dash-panel.active { display: block; animation: dashFadeIn 0.2s ease; }
@keyframes dashFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Track section polish ────────────────────────────────────── */
.track-section { margin-bottom: var(--sp-2xl); }

.track-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-md);
  padding-bottom: var(--sp-md);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-sm);
}
.track-header__right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0;
}
.track-progress-count {
  font-size: 0.75rem; color: var(--ink4); font-family: var(--font-mono);
}

.track-pbar {
  height: 4px; background: var(--bg2); border-radius: 2px;
  overflow: hidden; margin-bottom: var(--sp-lg);
}
.track-pbar__fill {
  height: 100%; background: var(--blue); border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Simulator: remove app-main padding inheritance ─────────── */
.sim-app-main { padding: 0 !important; }
