/* ═══════════════════════════════════════════════════════════════
   EXPERTLE — Design System
   Light purple brand, Inter font, clean professional UI.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */

:root {
  /* Fonts — v3: system stack, no external font load */
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Primary palette — v3: softer purple, warmer tints */
  --primary: #6F65D4;
  --primary-hover: #534AB7;
  --primary-light: #EEEDFE;
  --primary-surface: #FAFAFE;

  /* Neutrals — v3: warmer greys, less stark */
  --bg: #FFFFFF;
  --surface: #FAFAFE;
  --surface-2: #F5F4F8;
  --border: rgba(0,0,0,0.08);
  --border-focus: #6F65D4;
  --text: #1A1A1A;
  --text-secondary: #5F5E5A;
  --text-muted: #888780;

  /* Status — v3: richer greens, warmer ambers */
  --success: #1D9E75;
  --warning: #EF9F27;
  --error: #EF4444;
  --info: #3B82F6;

  /* Status tints */
  --success-tint: #E1F5EE;
  --warning-tint: #FAEEDA;
  --error-tint: #FEF2F2;
  --info-tint: #EFF6FF;

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

  /* Radii — v3: rounder, friendlier */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows — v3: subtler */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 20px rgba(0,0,0,0.06);

  /* Transitions */
  --transition: 150ms ease;
}

/* ── Reset ────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  line-height: 1.55;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: white;
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
}

.app-logo-text {
  font-size: 19px;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.app-logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.user-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 8px;
}

/* ── Auth Screen ──────────────────────────────────────────── */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  background: var(--surface);
}

.auth-card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.auth-card p {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-lg);
  font-size: 14px;
}

.auth-card .form-group {
  margin-bottom: var(--space-md);
}

.auth-toggle {
  text-align: center;
  margin-top: var(--space-md);
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-toggle a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

.auth-error {
  color: var(--error);
  font-size: 13px;
  text-align: center;
  margin-top: var(--space-sm);
  min-height: 20px;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  line-height: 1;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 0.5px solid rgba(0,0,0,0.15);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.unit-card-progress {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.unit-card-progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.unit-type-toggle {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.unit-type-toggle.active {
  background: var(--primary);
  color: #fff;
}

.btn-full {
  width: 100%;
}

/* ── Form Elements ────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  padding: 12px 14px;
  background: var(--bg);
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  transition: all var(--transition);
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111,101,212,0.15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

/* ── Tabs (v2.0.33 — 2-row grouped layout) ───────────────── */

.tab-bar {
  background: white;
  border-bottom: 0.5px solid var(--border);
}

/* Row wrapper */
.tab-row {
  display: flex;
  gap: 0;
  padding: 0 var(--space-lg);
}

/* Row 1: Core tabs share space equally */
#tab-row-core {
  border-bottom: 0.5px solid var(--border);
}
#tab-row-core .tab-btn {
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
}

/* Row 2: Compliance — scrollable on mobile */
.tab-row-compliance {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.tab-row-compliance::-webkit-scrollbar { height: 3px; }
.tab-row-compliance::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* Row label */
.tab-row-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px 8px 0;
  white-space: nowrap;
  align-self: center;
  flex-shrink: 0;
}

/* Tab buttons */
.tab-btn {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: var(--font-body);
  min-height: 44px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* CTA tab (Build Course) — stands out as the destination */
.tab-btn-cta {
  background: rgba(111, 101, 212, 0.08);
  color: var(--primary) !important;
  font-weight: 500 !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn-cta:hover { background: rgba(124, 92, 252, 0.15); }
.tab-btn-cta.active {
  background: rgba(124, 92, 252, 0.15);
  border-bottom-color: var(--primary);
}

/* Tab panels */
.tab-panel { display: none; padding: var(--space-lg); }
.tab-panel.active { display: block; }

/* ── Sticky Generation Bar (v2.0.33) ────────────────────── */

/* v2.0.35: Generating bar — clean minimal style (was dark gradient + heavy shadow) */
#sticky-gen-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--surface);
  color: var(--text);
  border-top: 2px solid var(--primary);
  display: none;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
#sticky-gen-bar.visible { display: block; }
.sticky-gen-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

/* ── Dashboard ────────────────────────────────────────────── */

.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.dashboard-header h1 {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.unit-card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.unit-card:hover {
  border-color: rgba(0,0,0,0.15);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.unit-card-code {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.unit-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.unit-card-industry {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-block;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.unit-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.unit-card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  opacity: 0.4;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unit-card:hover .unit-card-delete {
  opacity: 0.7;
}

.unit-card-delete:hover {
  color: var(--error);
  background: #FEE2E2;
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  margin-bottom: var(--space-lg);
}

/* ── Workspace ────────────────────────────────────────────── */

.workspace {
  max-width: 1400px;
  margin: 0 auto;
}

.workspace-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-bottom: 0.5px solid var(--border);
}

.workspace-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.workspace-back:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.workspace-unit-code {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}

.workspace-unit-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

/* ── Toast ────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 300ms ease;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success-tint);
  color: #065F46;
  border-left: 4px solid var(--success);
}

.toast.error {
  background: var(--error-tint);
  color: #991B1B;
  border-left: 4px solid var(--error);
}

.toast.info {
  background: var(--info-tint);
  color: #1E40AF;
  border-left: 4px solid var(--info);
}

.toast.warning {
  background: var(--warning-tint);
  color: #92400E;
  border-left: 4px solid var(--warning);
}

/* ── Create Unit Modal ────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: var(--space-lg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ── Two-Path Create Modal ───────────────────────────────── */

.create-path-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
}
.create-path-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.create-path-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.45;
}
.create-path-primary {
  border-color: var(--primary);
  background: var(--primary-surface);
}
.create-path-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
}

/* ── Requirements Table — Humanised Labels ────────────────── */

.req-id {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  opacity: 0.6;
}
.req-label-tooltip {
  cursor: help;
  border-bottom: 1px dashed var(--text-muted);
}
.req-label-tooltip::after {
  content: ' \24D8'; /* circled i */
  font-size: 11px;
  opacity: 0.5;
}
.req-section-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 12px;
  line-height: 1.45;
}

/* ── Workspace Progress Stepper ──────────────────────────── */

.workspace-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 12px 0;
  overflow-x: auto;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  min-width: 80px;
  flex-shrink: 0;
}
.stepper-step:hover .stepper-label {
  color: var(--primary);
}
.stepper-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 2px solid var(--border);
  transition: all 0.15s;
}
.stepper-step.done .stepper-circle {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.stepper-step.current .stepper-circle {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.stepper-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
  max-width: 90px;
  line-height: 1.3;
}
.stepper-step.done .stepper-label {
  color: var(--text-secondary);
}
.stepper-step.current .stepper-label {
  color: var(--primary);
  font-weight: 600;
}
.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  align-self: center;
  margin-top: 0;
  min-width: 16px;
  position: relative;
  top: 14px;
}
.stepper-line.done {
  background: var(--success);
}

@media (max-width: 640px) {
  .workspace-stepper {
    display: none;
  }
  .stepper-mobile {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
  }
  .stepper-mobile .stepper-mobile-step {
    font-weight: 600;
    color: var(--primary);
  }
}
.stepper-mobile {
  display: none;
}

/* ── Utilities ────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 13px;
}

.mt-md {
  margin-top: var(--space-md);
}

.mb-md {
  margin-bottom: var(--space-md);
}

/* ── Spinner ──────────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Import Status ────────────────────────────────────────── */

.import-status {
  font-size: 13px;
  padding: 6px 0;
  min-height: 24px;
  margin-bottom: 12px;
}

.import-status.importing {
  color: var(--primary);
}

.import-status.success {
  color: var(--success);
  font-weight: 500;
}

.import-status.partial {
  color: var(--warning);
  font-weight: 500;
}

.import-status.error {
  color: var(--error);
  font-weight: 500;
}

/* ── Learner Guide ────────────────────────────────────────── */

.guide-status {
  font-size: 13px;
  font-weight: 500;
}

.guide-status.generating {
  color: var(--primary);
}

.guide-status.complete {
  color: var(--success);
}

.guide-status.error {
  color: var(--error);
}

/* Guide styles — v1.9 booklet redesign */
.guide-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 20px 0 28px;
}
.guide-toc-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}
.guide-toc-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.guide-toc-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 80px;
}
.guide-toc-dot {
  flex: 1;
  border-bottom: 1px dotted var(--border);
  margin: 0 4px;
  min-width: 20px;
}
.guide-toc-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.guide-chapter-break {
  text-align: center;
  padding: 36px 16px 24px;
  margin: 28px 0 20px;
}
.guide-chapter-stripe {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 0 auto;
  max-width: 200px;
}
.guide-ch-num {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 14px 0 6px;
}
.guide-ch-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 10px;
}

.guide-section-head {
  font-size: 16px;
  font-weight: 500;
  margin: 22px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.guide-subsection-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px;
}

/* Callout boxes */
.guide-callout {
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 14px;
  line-height: 1.65;
}
.guide-callout-header {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.guide-callout-body { font-size: 14px; }

.guide-callout-scenario { background: var(--primary-surface); border: 1px solid #E8E0FF; border-left: 4px solid var(--primary); }
.guide-callout-scenario .guide-callout-header { color: var(--primary); }

.guide-callout-kc { background: var(--success-tint); border: 1px solid #A7F3D0; border-left: 4px solid var(--success); }
.guide-callout-kc .guide-callout-header { color: #059669; }
.guide-callout-kc ul { margin: 4px 0 0 18px; }
.guide-callout-kc li { margin-bottom: 4px; }

.guide-callout-fact { background: var(--warning-tint); border: 1px solid #FDE68A; border-left: 4px solid var(--warning); }
.guide-callout-fact .guide-callout-header { color: #B45309; }

.guide-callout-important { background: var(--error-tint); border: 1px solid #FECACA; border-left: 4px solid #EF4444; }
.guide-callout-important .guide-callout-header { color: #DC2626; }

.guide-callout-tip { background: #F0F9FF; border: 1px solid #BAE6FD; border-left: 4px solid #0EA5E9; }
.guide-callout-tip .guide-callout-header { color: #0284C7; }

.guide-callout-steps { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #6B7280; }
.guide-callout-steps .guide-callout-header { color: var(--text); }

.guide-callout-activity { background: #FDF4FF; border: 1px solid #F0ABFC; border-left: 4px solid #A855F7; }
.guide-callout-activity .guide-callout-header { color: #7E22CE; }
.guide-callout-activity .guide-callout-body { font-size: 14px; }

.guide-callout-objectives { background: #EFF6FF; border: 1px solid #93C5FD; border-left: 4px solid #3B82F6; }
.guide-callout-objectives .guide-callout-header { color: #1D4ED8; }
.guide-callout-objectives ul { margin: 4px 0 0 18px; }
.guide-callout-objectives li { margin-bottom: 4px; }

.guide-callout-reading { background: #F0FDF4; border: 1px solid #86EFAC; border-left: 4px solid #22C55E; }
.guide-callout-reading .guide-callout-header { color: #15803D; }
.guide-callout-reading ul { margin: 4px 0 0 18px; }
.guide-callout-reading li { margin-bottom: 4px; }

.guide-steps {
  margin: 4px 0 0 18px;
  font-size: 14px;
}
.guide-steps li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.guide-bullets {
  margin: 8px 0 12px 22px;
  font-size: 14px;
}
.guide-bullets li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.guide-numbered {
  padding-left: 8px;
  font-size: 14px;
  margin-bottom: 4px;
}

.guide-table-wrap {
  margin: 14px 0;
  overflow-x: auto;
}
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.guide-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}
.guide-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
}

.guide-blockquote {
  background: var(--surface);
  border-left: 3px solid var(--primary);
  padding: 10px 16px;
  margin: 10px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
  font-style: italic;
  color: var(--text-secondary);
}

#guide-preview-content p {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 8px;
}

#guide-preview-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 12px 0 6px;
}

/* ── AI Disclaimer Banner ─────────────────────────────────── */

/* v2.0.35: Subtler disclaimer — informational, not alarming */
.ai-disclaimer {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Assessment Styles ────────────────────────────────────── */

.assess-section {
  margin: 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.assess-section h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 12px;
}

.assess-marking {
  background: var(--primary-surface);
  padding: 16px;
  border-radius: var(--radius-lg);
}

.assess-subhead {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
}

.assess-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 16px;
  font-size: 14px;
}

.assess-option-letter {
  font-weight: 600;
  color: var(--primary);
}

.assess-answer {
  padding: 8px 12px;
  margin: 4px 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.assess-checklist-item {
  padding: 4px 0 4px 16px;
  font-size: 14px;
}

/* ── Case Study Styles ────────────────────────────────────── */

.cs-block {
  margin: 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cs-block h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 12px;
}

.cs-scenario-box {
  background: var(--primary-surface);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
  line-height: 1.6;
}

.cs-question {
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--surface-2);
}

.cs-answers-box {
  background: var(--error-tint);
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 12px 0;
}

.cs-answers-box h3 {
  color: var(--error);
  font-size: 14px;
  margin-bottom: 8px;
}

.cs-model-answer {
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #FECACA;
}

/* ── Compliance Report Styles ─────────────────────────────── */

.audit-summary h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.audit-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.audit-card-value {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
}

.audit-card-value.success { color: var(--success); }
.audit-card-value.warning { color: var(--warning); }
.audit-card-value.error { color: var(--error); }

.audit-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.audit-card-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 13px;
}

.audit-yes { color: var(--success); }
.audit-no { color: var(--text-muted); }

.audit-ke-map {
  margin-bottom: 24px;
}

.audit-ke-map h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.audit-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-2);
}

.audit-ke-text {
  max-width: 400px;
  line-height: 1.4;
}

.audit-gaps {
  margin-bottom: 24px;
}

.audit-gaps h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}

.audit-gap {
  background: var(--error-tint);
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.audit-gap-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-gap-item {
  font-size: 14px;
  font-weight: 500;
  margin: 4px 0;
}

.audit-gap-fix {
  font-size: 13px;
  color: var(--text-secondary);
}

.audit-no-gaps {
  background: var(--success-tint);
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.audit-no-gaps h3 { color: var(--success); }

/* ── Course Builder ───────────────────────────────────────── */

.cb-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cb-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  color: var(--text);
}

.cb-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.cb-section-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 16px;
  transition: all var(--transition);
}

.cb-section-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.cb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cb-card-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cb-card-actions {
  display: flex;
  gap: 4px;
}

.cb-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.cb-mechanic-group.hidden {
  display: none;
}

.cb-sme-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cb-sme-status select {
  padding: 4px 8px;
  font-size: 12px;
  width: auto;
}

/* ── Coverage Map ─────────────────────────────────────────── */

.cb-coverage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cb-coverage-header h3 {
  font-size: 16px;
  font-weight: 500;
}

.cb-coverage-section {
  margin-bottom: 16px;
}

.cb-coverage-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.cb-coverage-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-cov-item {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.cb-cov-missing {
  background: var(--error-tint);
  color: var(--error);
  border: 1px solid #FECACA;
}

.cb-cov-single {
  background: var(--warning-tint);
  color: #92400E;
  border: 1px solid #FDE68A;
}

.cb-cov-multi {
  background: var(--success-tint);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .app-nav {
    gap: 4px;
    flex-wrap: wrap;
  }

  .dashboard {
    padding: var(--space-md);
  }

  .unit-grid {
    grid-template-columns: 1fr;
  }

  .tab-row { padding: 0 var(--space-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: 10px 12px; font-size: 13px; white-space: nowrap; }

  /* Buttons stack on mobile */
  .btn { font-size: 14px; padding: 12px 20px; }

  /* Course builder button rows wrap */
  #cb-outline-view > div:nth-child(2),
  #cb-sections-view > div:nth-child(2) { flex-wrap: wrap; }
}

/* ── Session 5: Sections View ──────────────────────────────── */

.cb-section-overview-card.approved {
  border-color: var(--success) !important;
}

.cb-section-mode-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
}

.cb-edit-block .btn-sm {
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.btn-danger {
  background: var(--error);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════
   Student Portal
   ═══════════════════════════════════════════════════════════════ */

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.student-course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.student-course-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.1);
}

.student-course-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.student-course-code {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.student-course-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.student-course-progress {
  margin-bottom: 16px;
}

.student-progress-track {
  background: var(--surface-2);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}

.student-progress-fill {
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.student-progress-text {
  font-size: 13px;
  color: var(--text-muted);
}

.student-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
}

.student-badge-pass {
  background: #dcfce7;
  color: #166534;
}

.student-badge-fail {
  background: #fee2e2;
  color: #991b1b;
}

.student-badge-active {
  background: var(--primary-light);
  color: var(--primary);
}

.student-play-btn {
  margin-top: auto;
}

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

/* ─── Mobile polish (v2.0.28.3) ──────────────────────────── */

/* ── Mobile-first overhaul (< 640px) ─────────────────────── */
/* Think Uber / Amazon — big cards, huge touch targets, zero clutter */

@media (max-width: 640px) {
  /* Global spacing */
  body { font-size: 15px; line-height: 1.6; }

  /* Header — streamlined */
  .app-header { padding: 10px 14px; }
  .app-nav { gap: 4px; width: 100%; justify-content: center; }
  .nav-link { font-size: 13px; padding: 10px 12px; min-height: 44px; flex: 1; text-align: center; }
  .user-email { display: none; }
  .app-logo-sub { display: none; }

  /* Buttons — BIG, full width, easy to tap */
  .btn { font-size: 16px; padding: 14px 24px; min-height: 50px; border-radius: var(--radius-lg); width: 100%; }
  .btn-sm { font-size: 14px; padding: 10px 16px; min-height: 44px; width: auto; }
  .btn-secondary { width: 100%; }

  /* Dashboard — spacious */
  .dashboard { padding: 16px; }
  .dashboard-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .dashboard-header h2 { font-size: 20px; }

  /* Stat cards — horizontal layout */
  .dash-stats { grid-template-columns: 1fr; gap: 10px; }
  .dash-stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 16px; text-align: left; }
  .dash-stat-value { font-size: 24px; margin-bottom: 0; }
  .dash-stat-label { font-size: 14px; }

  /* Unit cards — BIG, spacious, easy to tap */
  .unit-grid { grid-template-columns: 1fr; gap: 16px; }
  .unit-card { padding: 20px 22px; min-height: 100px; border-radius: var(--radius-xl); border-width: 2px; }
  .unit-card-code { font-size: 14px; margin-bottom: 6px; }
  .unit-card-title { font-size: 18px; margin-bottom: 10px; line-height: 1.4; }
  .unit-card-industry { font-size: 13px; padding: 4px 10px; margin-bottom: 14px; }
  .unit-card-hint { font-size: 14px; padding: 10px 14px; margin: 10px 0; border-radius: var(--radius-md); }
  .unit-card-progress { height: 6px; border-radius: 3px; margin-bottom: 10px; }
  .unit-card-progress-bar { height: 6px; }
  .unit-card-meta { font-size: 14px; }
  .unit-card-delete { opacity: 0.5; font-size: 22px; padding: 10px; min-width: 44px; min-height: 44px; top: 10px; right: 10px; }

  /* Quick actions — stacked, bigger */
  .dash-actions-grid { grid-template-columns: 1fr; gap: 10px; }
  .dash-action-tile { padding: 18px 20px; min-height: 56px; border-radius: var(--radius-lg); }
  .dash-action-icon { font-size: 24px; }
  .dash-action-text { font-size: 16px; }

  /* Checklist — bigger items */
  .dash-check-item { padding: 16px 18px; font-size: 15px; border-radius: var(--radius-lg); min-height: 56px; }
  .dash-check-icon { font-size: 22px; }

  /* Tab bar — horizontal scroll, bigger targets */
  .tab-row { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tab-row::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 14px 14px; font-size: 14px; min-height: 48px; }
  .tab-row-label { display: none; }
  .tab-btn-cta { font-size: 14px; }

  /* Tab panels — more padding */
  .tab-panel { padding: 16px; }

  /* Workspace header */
  .workspace-header { padding: 14px 16px; }

  /* Explainer boxes — bigger text */
  .tab-explainer { padding: 18px; font-size: 15px; border-radius: var(--radius-xl); }
  .tab-explainer strong { font-size: 16px; }

  /* Course builder step progress */
  #cb-step-progress { flex-wrap: wrap; gap: 8px; padding: 14px; border-radius: var(--radius-xl); }
  .cb-step-line { display: none; }
  #cb-step-progress .cb-step-num { width: 32px !important; height: 32px !important; font-size: 14px !important; }
  #cb-step-progress .cb-step-label { font-size: 12px !important; }

  /* Course builder button rows — stack */
  #cb-outline-view > div:nth-child(2) { flex-direction: column; gap: 10px; }
  #cb-outline-view > div:nth-child(2) > div { width: 100%; display: flex; flex-direction: column; gap: 8px; }

  /* Section detail buttons — stack */
  #cb-section-detail > div:nth-child(2) { flex-direction: column; gap: 10px; }
  #cb-section-detail > div:nth-child(2) > div { width: 100%; display: flex; flex-direction: column; gap: 8px; }

  /* Export view */
  #cb-export-actions { flex-direction: column; gap: 10px; }

  /* Section cards — bigger */
  .cb-section-overview-card { padding: 18px !important; min-height: 70px; border-radius: var(--radius-lg) !important; }

  /* Forms — bigger inputs */
  input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
    font-size: 16px !important; /* prevents iOS zoom on focus */
    padding: 12px 14px !important;
    min-height: 48px;
    border-radius: var(--radius-md);
  }

  /* Student cards */
  .student-grid { grid-template-columns: 1fr; gap: 14px; }
  .student-course-card { padding: 20px; border-radius: var(--radius-xl); }
  .student-course-title { font-size: 17px; }

  /* Modal — full width on mobile */
  .modal { margin: 12px !important; max-width: none !important; border-radius: var(--radius-xl) !important; }
  .modal-overlay { align-items: flex-end; }

  /* Sticky gen bar */
  .sticky-gen-inner { padding: 14px 16px; font-size: 14px; }

  /* Guide callouts */
  .guide-callout { padding: 16px; margin: 14px 0; font-size: 14px; }
  .guide-chapter-break { padding: 32px 16px 24px; }
  .guide-ch-title { font-size: 20px; }

  /* ── ALL side-by-side grids → stack on mobile ──────────── */
  /* Editor/preview panels, form grids, publish modal grids */
  .guide-editor-panel,
  #cb-section-detail > div:last-child {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
  }

  /* Workspace header — stack title below back button on small screens */
  .workspace-header {
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 8px;
  }
  .workspace-back {
    font-size: 22px;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .workspace-unit-code { font-size: 13px; }
  .workspace-unit-title { font-size: 15px; width: 100%; }

  /* Workspace progress bar */
  #workspace-progress { padding: 0 16px; }
  #workspace-progress-steps { gap: 4px; }

  /* Editor panels — show preview tab or editor tab, not both */
  .guide-editor-panel textarea { min-height: 300px !important; font-size: 14px !important; }
  .guide-editor-panel iframe { min-height: 400px !important; }

  /* Post-publish success — stack the cards */
  #cb-publish-success > div:nth-child(3) { grid-template-columns: 1fr !important; }
  #cb-publish-success > div:nth-child(4) { grid-template-columns: 1fr !important; }

  /* Publish modal form grids */
  .modal div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  #cb-publish-modal div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Outline cards — more spacious */
  .cb-outline-card { padding: 16px !important; border-radius: var(--radius-lg) !important; }

  /* Coverage map — scroll horizontally */
  #cb-coverage-map { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #cb-coverage-map table { min-width: 500px; }

  /* Section overview cards — bigger tap targets */
  #cb-section-overview > div {
    min-height: 72px !important;
    padding: 16px 18px !important;
    margin-bottom: 10px !important;
    border-radius: var(--radius-lg) !important;
    font-size: 15px !important;
  }

  /* Approval status cards on export view */
  #cb-export-approval-status > div > div {
    padding: 14px 16px !important;
    font-size: 14px !important;
    min-height: 50px;
    border-radius: var(--radius-md) !important;
  }

  /* Compliance tab cards */
  .tab-row-compliance { gap: 0; }

  /* Hide the side-by-side section edit/preview and show stacked instead */
  #cb-section-detail > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  #cb-section-detail > div:last-child > div {
    min-height: 350px !important;
  }

  /* Textareas in workspace — bigger */
  .tab-panel textarea {
    font-size: 15px !important;
    line-height: 1.6 !important;
    padding: 14px !important;
    min-height: 200px;
  }

  /* Labels and form groups */
  .form-group label { font-size: 14px; margin-bottom: 6px; }
  .form-group { margin-bottom: 16px; }

  /* Preview iframe in section builder */
  #cb-section-preview-iframe { min-height: 400px !important; }

  /* Guide preview content */
  #guide-preview-content { font-size: 14px; padding: 16px; }
  #guide-preview-content h2 { font-size: 18px; }
  #guide-preview-content h3 { font-size: 16px; }
  #guide-preview-content h4 { font-size: 14px; }

  /* Assessment preview content */
  .assess-question-card { padding: 16px !important; }
  .assess-q-num { font-size: 15px !important; }
  .assess-q-body p { font-size: 14px !important; }
  .assess-option { padding: 12px !important; font-size: 14px !important; min-height: 48px; }
}

/* ── Very small phones (< 380px) ─────────────────────────── */
@media (max-width: 380px) {
  .app-header { padding: 8px 10px; }
  .nav-link { font-size: 12px; padding: 8px 8px; }
  .dashboard { padding: 10px; }
  .unit-card { padding: 16px; }
  .btn { font-size: 15px; padding: 12px 20px; min-height: 48px; }
  .tab-btn { font-size: 13px; padding: 12px 10px; }
  .tab-panel { padding: 12px; }
  .guide-editor-panel textarea { min-height: 250px !important; }
}

/* ─── Audit Readiness Report (v2.0.16) ────────────────────── */

.ar-document {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 980px;
  margin: 0 auto;
  font-family: -apple-system, system-ui, sans-serif;
  color: #1f2937;
  line-height: 1.55;
}

.ar-header {
  border-bottom: 3px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 28px;
}

.ar-header h1 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 28px;
  font-weight: 500;
}

.ar-meta {
  margin: 0 0 2px;
  font-size: 16px;
  color: #374151;
}

.ar-meta-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.ar-section {
  margin-bottom: 36px;
}

.ar-section h2 {
  font-size: 20px;
  color: var(--primary);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--surface-2);
}

.ar-section h3 {
  font-size: 15px;
  margin: 18px 0 8px;
  color: #1f2937;
}

.ar-section-intro {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px;
  font-style: italic;
}

.ar-traffic-light {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.ar-traffic-icon {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 6px;
}

.ar-traffic-light p {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.ar-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.ar-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
}

.ar-stat-num {
  font-size: 32px;
  font-weight: 500;
  color: var(--primary);
  line-height: 1;
}

.ar-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.ar-stat-label small {
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.ar-element-block {
  margin-bottom: 24px;
}

.ar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 16px;
}

.ar-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 12px;
}

.ar-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ar-row-covered td { background: #f0fdf4; }
.ar-row-partial td { background: #fffbeb; }
.ar-row-planned td { background: #f3f4f6; }
.ar-row-missing td { background: #fef2f2; }

.ar-status-cell {
  text-align: center;
  font-size: 18px;
}

.ar-status-cell small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.ar-no {
  color: #ef4444;
  font-style: italic;
}

.ar-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 6px;
}

.ar-ke-block {
  border-left: 4px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: var(--surface-2);
}

.ar-ke-block.ar-row-covered { border-left-color: #22c55e; background: #f0fdf4; }
.ar-ke-block.ar-row-partial { border-left-color: #f59e0b; background: #fffbeb; }
.ar-ke-block.ar-row-planned { border-left-color: #6b7280; background: #f3f4f6; }
.ar-ke-block.ar-row-missing { border-left-color: #ef4444; background: #fef2f2; }

.ar-ke-header {
  font-size: 14px;
  margin-bottom: 8px;
}

.ar-ke-text {
  margin-left: 8px;
  font-weight: 400;
  color: #374151;
}

.ar-ke-body {
  font-size: 12px;
  color: #4b5563;
}

.ar-ke-body > div {
  margin-bottom: 4px;
}

.ar-excerpt {
  margin: 6px 0 8px;
  padding: 8px 12px;
  background: white;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-style: italic;
  font-size: 12px;
  color: #374151;
}

.ar-no-gaps {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: #166534;
  font-weight: 500;
}

.ar-gap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: gap;
}

.ar-gap {
  counter-increment: gap;
  padding: 12px 14px 12px 50px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  position: relative;
}

.ar-gap::before {
  content: counter(gap);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  text-align: center;
  font-weight: 500;
  line-height: 26px;
  font-size: 13px;
}

.ar-gap-critical { background: #fef2f2; }
.ar-gap-critical::before { background: #ef4444; }
.ar-gap-high { background: #fffbeb; }
.ar-gap-high::before { background: #f59e0b; }
.ar-gap-medium { background: var(--surface-2); }

.ar-gap-header {
  font-size: 14px;
  margin-bottom: 4px;
}

.ar-severity {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  margin-right: 8px;
  color: white;
}

.ar-severity-critical { background: #ef4444; }
.ar-severity-high { background: #f59e0b; }
.ar-severity-medium { background: #6b7280; }

.ar-gap-why,
.ar-gap-fix {
  font-size: 12px;
  color: #4b5563;
  margin-top: 4px;
}

.ar-cert {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 20px;
}

.ar-cert-table {
  width: 100%;
  margin: 14px 0;
  font-size: 12px;
  border-collapse: collapse;
}

.ar-cert-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.ar-disclaimer {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  color: #92400e;
  margin-top: 16px;
}

@media print {
  .ar-document {
    border: none;
    padding: 0;
  }
  .ar-section {
    page-break-inside: avoid;
  }
}

@media (max-width: 720px) {
  .ar-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ar-document {
    padding: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   v2.0.23 — Editable Numbered Requirements Table
   (Unit Data tab, renders below the raw-text textareas)
   ═══════════════════════════════════════════════════════════════ */

.req-table-wrap {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle, #FAFAFA);
}

.req-table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.req-table-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.req-table-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 780px;
}

.req-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.req-banner-warning {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
}

.req-banner-success {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.req-banner-dirty {
  background: var(--info-tint);
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}

.req-section {
  margin-bottom: 22px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.req-section-head {
  padding: 10px 14px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.req-section-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.req-rows {
  padding: 0;
}

.req-row {
  display: grid;
  /* v2.0.23.1 hotfix: 4 columns for [drag-handle][id][textarea][actions].
     Original 3-column grid `70px 1fr 88px` caused the 4 children to
     overflow — textarea was squeezed into the 88px actions column and the
     ✕ delete button wrapped to a new row, rendering KE/PE text one char
     per line (gotcha to add: child-count MUST match column count). */
  grid-template-columns: 28px 62px 1fr 40px;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.12s;
}

.req-row:last-child {
  border-bottom: none;
}

.req-row:hover {
  background: #FAFAFA;
}

.req-row-pc {
  /* PC row has 4 children: [id][parent-select][textarea][actions] — no drag
     handle. Columns sized narrower than the base row so nested PCs read
     visually indented beneath their parent element. */
  grid-template-columns: 58px 62px 1fr 40px;
  padding-left: 34px;
  background: #FCFCFD;
}

.req-row.req-row-dragging {
  opacity: 0.4;
}

.req-row.req-row-drop-target {
  border-top: 2px solid var(--primary);
}

.req-id {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding-top: 9px;
}

.req-parent-select {
  font-size: 12px;
  padding: 6px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
}

.req-text-input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  resize: vertical;
  font-family: inherit;
}

.req-text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
}

.req-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-top: 4px;
}

.req-drag-handle {
  cursor: grab;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 16px;
  user-select: none;
  line-height: 1;
}

.req-drag-handle:active {
  cursor: grabbing;
}

.req-row-delete {
  background: transparent;
  border: 1px solid transparent;
  color: #B91C1C;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
}

.req-row-delete:hover {
  background: var(--error-tint);
  border-color: #FECACA;
}

.req-row-add {
  display: block;
  width: calc(100% - 28px);
  margin: 8px 14px;
  padding: 9px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.req-row-add:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #FAF9FF;
}

.req-table-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* History modal */
.req-history-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}

.req-history-modal-inner {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.req-history-entry {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.req-history-meta {
  font-size: 13px;
  color: var(--text);
}

.req-history-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

@media (max-width: 720px) {
  .req-row {
    grid-template-columns: 22px 52px 1fr 36px;
    gap: 6px;
    padding: 6px 10px;
  }
  .req-row-pc {
    grid-template-columns: 50px 54px 1fr 36px;
    padding-left: 20px;
  }
  .req-table-footer {
    flex-wrap: wrap;
  }
}

/* ── Dashboard Stats + Quick Actions + Checklist ─────────── */

.dash-greeting {
  margin-bottom: 20px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: border-color 0.15s ease;
}
.dash-stat-card:hover {
  border-color: var(--primary);
}
.dash-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.dash-stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-quick-actions {
  margin-top: 32px;
}
.dash-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dash-action-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dash-action-tile:hover {
  border-color: var(--primary);
  background: var(--surface);
  transform: translateY(-1px);
}
.dash-action-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.dash-action-text {
  font-size: 14px;
  font-weight: 600;
}

.dash-checklist {
  margin-top: 32px;
}
.dash-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
}
.dash-check-item.done {
  opacity: 0.6;
}
.dash-check-item.done .dash-check-text {
  text-decoration: line-through;
}
.dash-check-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.dash-check-text {
  flex: 1;
  font-weight: 500;
}

/* duplicate 640px block removed — consolidated into main mobile block above */

/* ── Student Preview Overlay (Level 1 + Level 2) ─────────── */

.cb-preview-overlay {
  position: fixed;
  inset: 0;
  background: #0f1117;
  z-index: 400;
  display: none;
  flex-direction: column;
}
.cb-preview-overlay.active {
  display: flex;
}

.cb-preview-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 410;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}
.cb-preview-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cb-preview-close-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.cb-preview-close-btn:hover {
  background: rgba(255,255,255,0.25);
}

.cb-preview-device-toggle {
  display: flex;
  gap: 4px;
  align-items: center;
}
.cb-device-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.cb-device-btn:hover {
  background: rgba(255,255,255,0.2);
}
.cb-device-btn.active {
  background: rgba(255,255,255,0.3);
  border-color: #fff;
}

.cb-preview-device-frame {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  margin-top: 48px;
  background: #1a1a2e;
  overflow: hidden;
}
.cb-preview-device-frame .cb-preview-iframe {
  width: 100%;
  max-width: 100%;
  height: 100%;
  border: none;
  transition: max-width 0.3s ease;
}
.cb-preview-device-frame.device-tablet .cb-preview-iframe {
  max-width: 768px;
  border-left: 2px solid #2a2a3e;
  border-right: 2px solid #2a2a3e;
}
.cb-preview-device-frame.device-mobile .cb-preview-iframe {
  max-width: 375px;
  border-left: 2px solid #2a2a3e;
  border-right: 2px solid #2a2a3e;
  border-radius: 20px;
}

#course-preview-container {
  transition: max-width 0.3s ease;
}
#view-course-preview.device-tablet #course-preview-container {
  max-width: 768px;
  margin: 0 auto;
  border-left: 2px solid #2a2a3e;
  border-right: 2px solid #2a2a3e;
}
#view-course-preview.device-mobile #course-preview-container {
  max-width: 375px;
  margin: 0 auto;
  border-left: 2px solid #2a2a3e;
  border-right: 2px solid #2a2a3e;
}

#view-course-preview {
  min-height: 100vh;
  background: #0f1117;
}
#view-course-preview .cb-preview-banner .btn-sm {
  font-size: 12px;
  padding: 5px 12px;
}
#view-course-preview .cb-preview-banner .btn-primary {
  background: #fff;
  color: #7c3aed;
  border: none;
}
#view-course-preview .cb-preview-banner .btn-primary:hover {
  background: #f0e6ff;
}
#view-course-preview .cb-preview-banner .btn-secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}
#view-course-preview .cb-preview-banner .btn-secondary:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Dashboard Card Hints (v2.0.32) ─────────────────────────── */
/* v2.0.35: Card hints — muted, not attention-grabbing */
.unit-card-hint {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--primary-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-light);
}

/* ── Tab Explainer Cards (v2.0.32) ──────────────────────────── */
/* v2.0.35: Per-tab explainers + disclaimers hidden — single workspace-level disclaimer replaces them */
.tab-panel .tab-explainer { display: none; }
.tab-panel > .ai-disclaimer { display: none; }

/* Keep course builder inline explainers visible (they serve a different purpose) */
.tab-explainer {
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.tab-explainer strong {
  color: var(--text);
  font-size: 15px;
}

/* ══════════════════════════════════════════════════════════════
   ADMIN PANEL (v2.0.32)
   ══════════════════════════════════════════════════════════════ */

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.admin-tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.admin-tab-btn:hover { color: var(--text); }
.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* Stat cards */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}
.admin-stat-number {
  font-size: 32px;
  font-weight: 500;
  color: var(--primary);
  font-family: var(--font-heading);
}
.admin-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-row { transition: background 0.1s; }
.admin-row:hover { background: #f9f8ff; }

/* Badges */
.admin-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.admin-badge-free { background: #f1f1f1; color: #666; }
.admin-badge-oneoff { background: #e8f5e9; color: #2e7d32; }
.admin-badge-starter { background: #e3f2fd; color: #1565c0; }
.admin-badge-growth { background: #e8f5e9; color: #2e7d32; }
.admin-badge-business { background: #fff3e0; color: #e65100; }
.admin-badge-enterprise { background: #f3e5f5; color: #7b1fa2; }
.admin-badge-active { background: #e8f5e9; color: #2e7d32; }
.admin-badge-archived { background: #f1f1f1; color: #666; }
.admin-badge-paid { background: #e8f5e9; color: #2e7d32; }
.admin-badge-invite_only { background: #fff3e0; color: #e65100; }

/* Detail panel grid */
.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.admin-detail-grid > div {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Activity log rows */
.admin-log-row {
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid #f5f5f5;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-detail-grid { grid-template-columns: 1fr; }
  #admin-detail-panel { width: 100vw !important; }
}
