/* ==========================================================================
   SiapCPNS — Editorial Civic Design System
   Calm, high-readability aesthetic crafted for 100-minute CAT sessions
   ========================================================================== */

:root {
  /* Palette */
  --bg-canvas: #F6F7F5;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-muted: #E9EEF4;

  /* Brand & Semantic */
  --navy-950: #0B1F33;
  --navy-900: #102A43;
  --navy-800: #1D3E5E;
  --navy-700: #2A5278;
  --navy-100: #E6EFF7;
  --navy-50: #F2F7FB;

  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-100: #D1FAE5;
  --emerald-50: #ECFDF5;

  --amber-700: #B45309;
  --amber-600: #D97706;
  --amber-500: #F59E0B;
  --amber-100: #FEF3C7;
  --amber-50: #FFFBEB;

  --crimson-700: #B91C1C;
  --crimson-600: #DC2626;
  --crimson-100: #FEE2E2;
  --crimson-50: #FEF2F2;

  /* Text */
  --text-primary: #132234;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;

  /* Borders & Shadows */
  --border-light: #E2E8F0;
  --border-subtle: #EDF2F7;
  --border-strong: #CBD5E1;

  --shadow-xs: 0 1px 2px rgba(16, 42, 67, 0.04);
  --shadow-sm: 0 2px 6px rgba(16, 42, 67, 0.05), 0 1px 2px rgba(16, 42, 67, 0.03);
  --shadow-md: 0 8px 24px rgba(16, 42, 67, 0.07), 0 2px 6px rgba(16, 42, 67, 0.03);
  --shadow-lg: 0 20px 44px rgba(16, 42, 67, 0.12);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--navy-950);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

p { margin: 0; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.925rem;
  border: 1px solid transparent;
  transition: all 0.18s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--navy-900);
  color: var(--text-inverse);
  box-shadow: 0 2px 4px rgba(16, 42, 67, 0.16);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-800);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 42, 67, 0.18);
}

.btn-emerald {
  background: var(--emerald-600);
  color: var(--text-inverse);
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}
.btn-emerald:hover:not(:disabled) {
  background: var(--emerald-700);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--navy-900);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--navy-700);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--navy-900);
}

.btn-amber {
  background: var(--amber-100);
  color: var(--amber-700);
  border-color: #FCD34D;
}
.btn-amber:hover:not(:disabled) {
  background: #FDE68A;
}

.btn-amber-active {
  background: var(--amber-500);
  color: #FFFFFF;
  border-color: var(--amber-600);
}

.btn-danger {
  background: var(--crimson-600);
  color: #FFFFFF;
}
.btn-danger:hover:not(:disabled) {
  background: var(--crimson-700);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.84rem;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Badges & Pills
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-navy { background: var(--navy-100); color: var(--navy-900); }
.badge-emerald { background: var(--emerald-100); color: var(--emerald-700); }
.badge-amber { background: var(--amber-100); color: var(--amber-700); }
.badge-crimson { background: var(--crimson-100); color: var(--crimson-700); }
.badge-slate { background: var(--bg-subtle); color: var(--text-secondary); }

/* ==========================================================================
   Cards & Containers
   ========================================================================== */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: 24px;
}

.card-interactive {
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Auth Screen (Split Editorial Portal)
   ========================================================================== */

.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  background: var(--bg-canvas);
}

.auth-showcase {
  background: linear-gradient(155deg, var(--navy-950) 0%, var(--navy-900) 58%, #163B59 100%);
  color: #FFFFFF;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-showcase::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 70%);
  pointer-events: none;
}

.auth-showcase::after {
  content: '';
  position: absolute;
  bottom: -140px;
  left: -80px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0) 70%);
  pointer-events: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #10B981, #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
}

.brand-mark-navy {
  background: var(--navy-900);
  box-shadow: 0 4px 12px rgba(16, 42, 67, 0.2);
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.76rem;
  opacity: 0.78;
  font-weight: 500;
}

.auth-hero {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 36px 0;
}

.auth-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.8rem;
  font-weight: 600;
  color: #A7F3D0;
  margin-bottom: 20px;
}

.auth-hero h1 {
  color: #FFFFFF;
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.18;
  margin-bottom: 16px;
}

.auth-hero p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.02rem;
  line-height: 1.65;
  margin-bottom: 28px;
}

.auth-features {
  display: grid;
  gap: 14px;
}

.auth-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-feature-item strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.auth-feature-item span {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.auth-pg-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-pg-stat {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.auth-pg-stat small {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.65);
}

.auth-pg-stat strong {
  font-size: 1.15rem;
  color: #FFFFFF;
  font-weight: 800;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 36px 34px;
  box-shadow: var(--shadow-md);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.18s var(--ease);
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--navy-900);
  box-shadow: var(--shadow-xs);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.94rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--navy-800);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.1);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}

.alert-success {
  background: var(--emerald-50);
  border: 1px solid #A7F3D0;
  color: var(--emerald-700);
}

.alert-error {
  background: var(--crimson-50);
  border: 1px solid #FECACA;
  color: var(--crimson-700);
}

.alert-info {
  background: var(--navy-50);
  border: 1px solid #BFDBFE;
  color: var(--navy-900);
}

/* ==========================================================================
   App Shell (Navigation + Workspace)
   ========================================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s var(--ease);
}

.nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--navy-900);
}

.nav-btn.active {
  background: var(--navy-50);
  color: var(--navy-900);
}

.nav-count {
  background: var(--navy-100);
  color: var(--navy-900);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: border-color 0.15s;
}

.user-pill:hover {
  border-color: var(--border-strong);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-pill-info {
  text-align: left;
  line-height: 1.2;
}

.user-pill-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy-950);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill-major {
  font-size: 0.7rem;
  color: var(--text-muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 64px;
  flex: 1;
}

/* ==========================================================================
   Page Headers & Grids
   ========================================================================== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 800;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.95rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--navy-950);
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.grid-dashboard {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
}

/* ==========================================================================
   Section Titles & Progress Bars
   ========================================================================== */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 1.12rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.45s var(--ease);
}

.fill-navy { background: var(--navy-800); }
.fill-emerald { background: var(--emerald-600); }
.fill-amber { background: var(--amber-500); }
.fill-crimson { background: var(--crimson-600); }

/* ==========================================================================
   Exam Center Cards
   ========================================================================== */

.exam-hero-banner {
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 100%);
  color: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.exam-hero-banner h2 {
  color: #FFFFFF;
  font-size: 1.45rem;
  margin-bottom: 6px;
}

.exam-hero-banner p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.94rem;
  max-width: 620px;
}

.exam-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 0.84rem;
  color: #CBD5E1;
}

.exam-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.major-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  position: relative;
}

.major-card.recommended {
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.25), var(--shadow-sm);
}

.major-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 18px;
}

.topic-chip {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   CAT BKN Fullscreen Exam Room
   ========================================================================== */

.cat-shell {
  min-height: 100vh;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
}

.cat-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy-950);
  color: #FFFFFF;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(11, 31, 51, 0.2);
}

.cat-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}

.cat-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
}

.cat-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cat-timer.warning {
  background: rgba(245, 158, 11, 0.25);
  border-color: #FBBF24;
  color: #FEF3C7;
}

.cat-timer.danger {
  background: rgba(220, 38, 38, 0.35);
  border-color: #F87171;
  color: #FEE2E2;
  animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.cat-body {
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 24px;
  align-items: start;
  flex: 1;
}

.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 30px 34px;
  box-shadow: var(--shadow-sm);
}

.question-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.question-number {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-900);
}

.question-stem {
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--text-primary);
  margin-bottom: 24px;
  white-space: pre-line;
}

.question-figure {
  margin: 0 0 24px;
  padding: 20px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
}

.options-list {
  display: grid;
  gap: 11px;
  margin-bottom: 28px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  text-align: left;
  width: 100%;
  transition: all 0.15s var(--ease);
  color: var(--text-primary);
  line-height: 1.55;
}

.option-item:hover {
  border-color: var(--navy-700);
  background: var(--navy-50);
}

.option-item.selected {
  border-color: var(--navy-900);
  background: var(--navy-50);
  box-shadow: 0 0 0 1px var(--navy-900);
}

.option-letter {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--navy-900);
  font-weight: 800;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.option-item.selected .option-letter {
  background: var(--navy-900);
  color: #FFFFFF;
}

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.nav-panel {
  position: sticky;
  top: 86px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.nav-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  max-height: 390px;
  overflow-y: auto;
  padding: 2px;
}

.cat-cell {
  height: 36px;
  border-radius: 7px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.cat-cell:hover {
  border-color: var(--navy-700);
}

.cat-cell.answered {
  background: var(--emerald-600);
  border-color: var(--emerald-700);
  color: #FFFFFF;
}

.cat-cell.flagged {
  background: var(--amber-500);
  border-color: var(--amber-600);
  color: #FFFFFF;
}

.cat-cell.current {
  box-shadow: 0 0 0 2.5px var(--navy-900);
  border-color: var(--navy-900);
}

/* ==========================================================================
   Results & Easy-Method Solution Review
   ========================================================================== */

.result-hero {
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.result-hero.passed {
  background: linear-gradient(135deg, #064E3B 0%, #047857 100%);
}

.result-hero.failed {
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
}

.result-score-big {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.subtest-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.review-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 16px;
}

.review-option {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.93rem;
}

.review-option.is-correct {
  background: var(--emerald-50);
  border-color: #6EE7B7;
  color: #065F46;
  font-weight: 600;
}

.review-option.is-wrong {
  background: var(--crimson-50);
  border-color: #FCA5A5;
  color: #991B1B;
}

.review-option.is-user-tkp {
  border-color: var(--navy-800);
  box-shadow: 0 0 0 1px var(--navy-800);
}

.easy-method-box {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF9E7 100%);
  border: 1px solid #FDE68A;
  border-left: 4px solid var(--amber-600);
}

.easy-method-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--amber-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.explanation-box {
  margin-top: 12px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-light);
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ==========================================================================
   Tabs, Filters & Tables (Leaderboard & FR Hub)
   ========================================================================== */

.pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pill-tab {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.86rem;
  transition: all 0.15s;
}

.pill-tab:hover {
  border-color: var(--navy-700);
  color: var(--navy-900);
}

.pill-tab.active {
  background: var(--navy-900);
  color: #FFFFFF;
  border-color: var(--navy-900);
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.podium-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  position: relative;
}

.podium-card.rank-1 {
  border-color: #F59E0B;
  background: linear-gradient(180deg, #FFFDF5 0%, #FFFFFF 100%);
  box-shadow: var(--shadow-sm);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 13px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr.is-me {
  background: var(--emerald-50);
}

.rank-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--bg-subtle);
  color: var(--navy-900);
}

.rank-num.top-1 { background: #FEF3C7; color: #B45309; }
.rank-num.top-2 { background: #E2E8F0; color: #334155; }
.rank-num.top-3 { background: #FFEDD5; color: #C2410C; }

/* ==========================================================================
   Modal & Toast
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 51, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--navy-950);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.22s var(--ease);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1024px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-showcase { padding: 32px 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-dashboard, .grid-3, .subtest-gauges, .podium-grid { grid-template-columns: 1fr; }
  .cat-body { grid-template-columns: 1fr; }
  .nav-panel { position: static; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 0 14px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .nav-links { width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .question-card { padding: 20px 18px; }
  .auth-pg-strip { grid-template-columns: 1fr; }
}
