/* ════════════════════════════════════════════════════════
   AcademIQ — Professional CGPA Calculator
   Design: Deep indigo sidebar + clean white workspace
   Signature: Marks-to-grade pill chips in course table
════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  --indigo-950: #1e1b4b;
  --indigo-900: #312e81;
  --indigo-800: #3730a3;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --indigo-100: #e0e7ff;
  --indigo-50:  #eef2ff;

  --violet-500: #8b5cf6;
  --violet-400: #a78bfa;

  --gold-400:    #fbbf24;
  --gold-300:    #fcd34d;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --blue-500:    #3b82f6;
  --blue-100:    #dbeafe;
  --cyan-500:    #06b6d4;
  --cyan-100:    #cffafe;
  --amber-500:   #f59e0b;
  --amber-100:   #fef3c7;
  --red-500:     #ef4444;
  --red-100:     #fee2e2;

  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --sidebar-w: 252px;
  --header-h:  60px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);

  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Syne', sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.18s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--indigo-950) 0%, #1a1744 100%);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  transition: transform var(--t) var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-logo svg { width: 48px; height: 48px; flex-shrink: 0; }

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-sub {
  display: block;
  font-size: 10px;
  color: var(--indigo-400);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 4px;
  line-height: 1.3;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t) var(--ease);
  text-align: left;
  width: 100%;
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: color var(--t);
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--indigo-600), var(--violet-500));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.sidebar-cgpa {
  margin: 0 12px;
  padding: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-lg);
  text-align: center;
}

.scgpa-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--indigo-400);
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.scgpa-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  display: block;
  line-height: 1;
}

.scgpa-standing {
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-400);
  display: block;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════
   MOBILE HEADER
══════════════════════════════════════════════════════ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--indigo-950);
  z-index: 150;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--t);
}

.mobile-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex: 1;
}

.mobile-cgpa {
  background: rgba(255,255,255,0.1);
  border-radius: 50px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 180;
}

/* ══════════════════════════════════════════════════════
   MAIN AREA
══════════════════════════════════════════════════════ */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px 40px 64px;
}

/* ── Page Panel ──────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Page Hero ───────────────────────────────────────── */
.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-hero-text h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.page-hero-text p {
  color: var(--text-secondary);
  font-size: 14px;
}

.gpa-live-badge {
  background: linear-gradient(135deg, var(--indigo-600), var(--violet-500));
  border-radius: var(--r-xl);
  padding: 14px 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
  min-width: 120px;
}

.glb-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  margin-bottom: 4px;
}

.glb-val {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

/* ── Semester Name Field ─────────────────────────────── */
.field-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.field-label svg { width: 16px; height: 16px; color: var(--indigo-500); }

.text-input {
  flex: 1;
  min-width: 260px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}

.text-input:focus {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Table Card ──────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.course-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 700px;
}

.course-tbl thead th {
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.th-num   { width: 44px; text-align: center; }
.th-cr    { width: 110px; }
.th-marks { width: 130px; }
.th-grade { width: 90px;  }
.th-gp    { width: 100px; }
.th-del   { width: 44px;  }

.course-tbl tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}

.course-tbl tbody tr:last-child { border-bottom: none; }
.course-tbl tbody tr:hover { background: var(--indigo-50); }

.course-tbl tbody td {
  padding: 9px 14px;
  vertical-align: middle;
}

.td-num {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Table inputs */
.course-tbl input[type="text"],
.course-tbl input[type="number"] {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}

.course-tbl input:focus {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Grade Pill (auto-assigned) */
.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 44px;
  transition: all var(--t);
}

.chip-A    { background: #fef9c3; color: #854d0e; border: 1.5px solid #fde047; }
.chip-Bplus{ background: var(--emerald-100); color: #065f46; border: 1.5px solid #6ee7b7; }
.chip-B    { background: var(--blue-100); color: #1e40af; border: 1.5px solid #93c5fd; }
.chip-Cplus{ background: var(--cyan-100); color: #164e63; border: 1.5px solid #67e8f9; }
.chip-C    { background: var(--amber-100); color: #92400e; border: 1.5px solid #fcd34d; }
.chip-F    { background: var(--red-100); color: #991b1b; border: 1.5px solid #fca5a5; }
.chip-na   { background: var(--surface-3); color: var(--text-muted); border: 1.5px solid var(--border); }

.gp-text {
  font-weight: 700;
  font-size: 13px;
  color: var(--indigo-600);
}

/* Delete button */
.del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 5px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t), background var(--t);
}

.del-btn:hover { color: var(--red-500); background: var(--red-100); }
.del-btn svg { width: 15px; height: 15px; }

/* Table Footer */
.table-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-3);
}

/* ── Results Strip ───────────────────────────────────── */
.results-strip {
  display: flex;
  align-items: center;
  gap: 0;
  background: linear-gradient(135deg, var(--indigo-950) 0%, var(--indigo-900) 100%);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 8px 28px rgba(49,46,129,0.35);
}

.rs-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 4px;
}

.rs-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--indigo-400);
  font-weight: 700;
}

.rs-val {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.rs-val.accent { color: var(--gold-300); }

.rs-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.12);
  align-self: center;
}

.rs-standing {
  font-size: 13px !important;
  font-family: var(--font) !important;
  font-weight: 600 !important;
  padding: 4px 12px;
  border-radius: 50px;
  background: rgba(255,255,255,0.1);
}

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--r-md);
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--indigo-600), var(--violet-500));
  color: #fff;
  padding: 10px 22px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-full { width: 100%; justify-content: center; padding: 12px 22px; }

.btn-save {
  background: linear-gradient(135deg, var(--gold-400), #f59e0b);
  color: var(--indigo-950);
  padding: 10px 20px;
  font-size: 13px;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(251,191,36,0.35);
}

.btn-save:hover { box-shadow: 0 6px 20px rgba(251,191,36,0.45); transform: translateY(-1px); }

.btn-ghost-add {
  background: var(--indigo-50);
  color: var(--indigo-600);
  border: 1.5px solid var(--indigo-100);
  padding: 8px 16px;
  font-size: 13px;
}

.btn-ghost-add:hover { background: var(--indigo-100); }

.btn-text-danger {
  background: none;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 8px 16px;
  font-size: 13px;
}

.btn-text-danger:hover { background: var(--red-100); color: var(--red-500); border-color: var(--red-500); }

.btn-del-sem {
  background: var(--red-100);
  color: var(--red-500);
  border: none;
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

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

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  animation: fadeSlide 0.2s ease;
}

.toast.success {
  background: var(--emerald-100);
  color: #065f46;
  border-left: 3px solid var(--emerald-500);
}

.toast.error {
  background: var(--red-100);
  color: #991b1b;
  border-left: 3px solid var(--red-500);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════
   HISTORY — STAT GRID
══════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card.stat-primary {
  background: linear-gradient(135deg, var(--indigo-600), var(--violet-500));
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(99,102,241,0.3);
}

.stat-card.stat-primary .stat-lbl  { color: rgba(255,255,255,0.7); }
.stat-card.stat-primary .stat-num  { color: #fff; }
.stat-card.stat-primary .stat-icon { background: rgba(255,255,255,0.15); color: #fff; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--indigo-50);
  color: var(--indigo-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-info { display: flex; flex-direction: column; gap: 2px; }

.stat-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.standing-val {
  font-size: 16px !important;
  font-family: var(--font) !important;
  font-weight: 700 !important;
}

/* ── Chart ───────────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.chart-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.chart-sub { font-size: 12px; color: var(--text-muted); }

.chart-body { height: 220px; position: relative; }

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 2px dashed var(--border-2);
}

.empty-icon { margin: 0 auto 20px; display: inline-block; }
.empty-icon svg { width: 80px; height: 80px; }

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 320px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ── Semester Cards ──────────────────────────────────── */
.sem-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow var(--t);
}

.sem-card:hover { box-shadow: var(--shadow-md); }

.sem-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--surface);
  flex-wrap: wrap;
}

.sem-card-head:hover { background: var(--indigo-50); }

.sem-left { flex: 1; min-width: 0; }

.sem-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.sem-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sem-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sem-gpa-pill {
  background: linear-gradient(135deg, var(--indigo-600), var(--violet-500));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.sem-cred-tag {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--surface-3);
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

.sem-chevron {
  width: 18px; height: 18px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sem-chevron.open { transform: rotate(180deg); }

.sem-body { display: none; border-top: 1px solid var(--border); }
.sem-body.open { display: block; }

.sem-mini-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sem-mini-tbl th {
  background: var(--surface-3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.sem-mini-tbl td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.sem-mini-tbl tr:last-child td { border-bottom: none; }

.sem-card-foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  background: var(--surface-3);
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════
   PREDICT / TARGET ADVISOR
══════════════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

.card-heading {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.predict-form-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.input-with-hint {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t);
  background: var(--surface);
}

.input-with-hint:focus-within {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.input-with-hint input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
}

.input-with-hint span {
  padding: 0 14px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
}

/* Predict Result */
.predict-result-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.pr-flow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.pr-node { text-align: center; }

.pr-node-lbl {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pr-node-val {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.pr-node-target .pr-node-val { color: var(--indigo-600); }

.pr-arrow {
  flex: 1;
  color: var(--border-2);
  min-width: 40px;
  max-width: 60px;
}

.pr-arrow svg { width: 100%; height: 16px; }

.pr-required-box {
  background: var(--surface-3);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  border-left: 4px solid var(--indigo-500);
}

.pr-req-lbl {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pr-req-val {
  display: block;
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--indigo-600);
  line-height: 1;
  margin-bottom: 10px;
}

.pr-req-msg { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.pr-required-box.status-impossible { border-left-color: var(--red-500); background: var(--red-100); }
.pr-required-box.status-impossible .pr-req-val { color: var(--red-500); }
.pr-required-box.status-achieved   { border-left-color: var(--emerald-500); background: var(--emerald-100); }
.pr-required-box.status-achieved   .pr-req-val { color: var(--emerald-500); }
.pr-required-box.status-hard       { border-left-color: var(--amber-500); background: var(--amber-100); }
.pr-required-box.status-hard       .pr-req-val { color: var(--amber-500); }

/* What-If */
.whatif-header { padding: 20px 20px 0; }
.whatif-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.whatif-header p { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.whatif-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.whatif-tbl th {
  background: var(--surface-3);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.whatif-tbl td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.whatif-tbl tr:last-child td { border-bottom: none; }
.whatif-tbl tr:hover td { background: var(--indigo-50); }

.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar  { height: 6px; border-radius: 3px; background: var(--surface-3); flex: 1; max-width: 120px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--indigo-500), var(--violet-500)); transition: width 0.4s var(--ease); }
.progress-pct  { font-size: 11px; color: var(--text-muted); font-weight: 600; }

.muted-msg { padding: 20px; color: var(--text-muted); font-size: 13px; }

/* ══════════════════════════════════════════════════════
   GRADE SCALE
══════════════════════════════════════════════════════ */
.two-col-scale {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) { .two-col-scale { grid-template-columns: 1fr; } }

.scale-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scale-tbl th {
  background: var(--surface-3);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.scale-tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.scale-tbl tr:last-child td { border-bottom: none; }

.sr-gold   td:last-child { color: #92400e; font-weight: 600; }
.sr-emerald td:last-child { color: #065f46; font-weight: 600; }
.sr-blue   td:last-child { color: #1e40af; font-weight: 600; }
.sr-cyan   td:last-child { color: #164e63; font-weight: 600; }
.sr-amber  td:last-child { color: #92400e; font-weight: 600; }
.sr-red    td:last-child { color: #991b1b; font-weight: 600; }

.range-badge {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

.grade-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 26px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.gp-a    { background: #fef9c3; color: #854d0e; border: 1.5px solid #fde047; }
.gp-bplus{ background: var(--emerald-100); color: #065f46; border: 1.5px solid #6ee7b7; }
.gp-b    { background: var(--blue-100); color: #1e40af; border: 1.5px solid #93c5fd; }
.gp-cplus{ background: var(--cyan-100); color: #164e63; border: 1.5px solid #67e8f9; }
.gp-c    { background: var(--amber-100); color: #92400e; border: 1.5px solid #fcd34d; }
.gp-f    { background: var(--red-100); color: #991b1b; border: 1.5px solid #fca5a5; }

/* Formula Card */
.formula-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.formula-display {
  background: var(--indigo-950);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.formula-fraction { text-align: center; }

.formula-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--indigo-400);
  margin-bottom: 8px;
  font-family: 'Courier New', monospace;
}

.formula-line {
  height: 1.5px;
  background: rgba(255,255,255,0.3);
  margin: 0 auto;
  width: 100%;
}

.formula-den {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-300);
  margin-top: 8px;
  font-family: 'Courier New', monospace;
}

.formula-note { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 4px; }

/* Standing Legend */
.standing-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.sl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
}

.sl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sl-label { flex: 1; font-weight: 600; }
.sl-range { font-size: 11px; font-weight: 700; opacity: 0.7; }

.sl-gold    { background: #fef9c3; } .sl-gold    .sl-dot { background: var(--gold-400); } .sl-gold    .sl-label { color: #854d0e; }
.sl-emerald { background: var(--emerald-100); } .sl-emerald .sl-dot { background: var(--emerald-500); } .sl-emerald .sl-label { color: #065f46; }
.sl-blue    { background: var(--blue-100); } .sl-blue    .sl-dot { background: var(--blue-500); } .sl-blue    .sl-label { color: #1e40af; }
.sl-cyan    { background: var(--cyan-100); } .sl-cyan    .sl-dot { background: var(--cyan-500); } .sl-cyan    .sl-label { color: #164e63; }
.sl-amber   { background: var(--amber-100); } .sl-amber   .sl-dot { background: var(--amber-500); } .sl-amber   .sl-label { color: #92400e; }
.sl-red     { background: var(--red-100); } .sl-red     .sl-dot { background: var(--red-500); } .sl-red     .sl-label { color: #991b1b; }

/* Standing colours for results strip */
.s-gold    { color: var(--gold-300) !important; }
.s-emerald { color: #6ee7b7 !important; }
.s-blue    { color: #93c5fd !important; }
.s-cyan    { color: #67e8f9 !important; }
.s-amber   { color: var(--gold-400) !important; }
.s-red     { color: #fca5a5 !important; }

/* ══════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .overlay.open { display: block; }
  .main-area {
    margin-left: 0;
    padding: 80px 16px 48px;
  }
  .results-strip {
    flex-direction: column;
    align-items: flex-start;
  }
  .rs-divider { display: none; }
  .btn-save { margin-left: 0; width: 100%; justify-content: center; }
  .page-hero { flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .gpa-live-badge { align-self: flex-start; }
}

@media (max-width: 500px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main-area { padding: 72px 12px 40px; }
}
/* ══════════════════════════════════════════════════════
   DARK THEME — token overrides
   (Higher specificity than :root alone, so these win
   automatically wherever the rest of the file uses var(...))
══════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
  --surface:   #161a2e;
  --surface-2: #0c0e1a;
  --surface-3: #1d2238;
  --border:    #2b3050;
  --border-2:  #3a4068;
  --text-primary:   #f1f3fb;
  --text-secondary: #c2c6dd;
  --text-muted:     #8489ab;

  --indigo-50:  rgba(99,102,241,0.14);
  --indigo-100: rgba(99,102,241,0.22);

  --emerald-100: rgba(16,185,129,0.16);
  --blue-100:    rgba(59,130,246,0.16);
  --cyan-100:    rgba(6,182,212,0.16);
  --amber-100:   rgba(245,158,11,0.16);
  --red-100:     rgba(239,68,68,0.16);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.55);
}

/* Pastel chip/pill/legend text was tuned for light backgrounds — give
   dark mode its own readable palette over the now-translucent fills. */
[data-theme="dark"] .chip-A, [data-theme="dark"] .gp-a { background: rgba(251,191,36,0.16); color: #fde68a; border-color: rgba(251,191,36,0.4); }
[data-theme="dark"] .chip-Bplus, [data-theme="dark"] .gp-bplus { color: #6ee7b7; border-color: rgba(16,185,129,0.4); }
[data-theme="dark"] .chip-B, [data-theme="dark"] .gp-b { color: #93c5fd; border-color: rgba(59,130,246,0.4); }
[data-theme="dark"] .chip-Cplus, [data-theme="dark"] .gp-cplus { color: #67e8f9; border-color: rgba(6,182,212,0.4); }
[data-theme="dark"] .chip-C, [data-theme="dark"] .gp-c { color: #fcd34d; border-color: rgba(245,158,11,0.4); }
[data-theme="dark"] .chip-F, [data-theme="dark"] .gp-f { color: #fca5a5; border-color: rgba(239,68,68,0.4); }

[data-theme="dark"] .sr-gold td:last-child,  [data-theme="dark"] .sl-gold .sl-label    { color: #fde68a; }
[data-theme="dark"] .sr-emerald td:last-child,[data-theme="dark"] .sl-emerald .sl-label{ color: #6ee7b7; }
[data-theme="dark"] .sr-blue td:last-child,   [data-theme="dark"] .sl-blue .sl-label   { color: #93c5fd; }
[data-theme="dark"] .sr-cyan td:last-child,   [data-theme="dark"] .sl-cyan .sl-label   { color: #67e8f9; }
[data-theme="dark"] .sr-amber td:last-child,  [data-theme="dark"] .sl-amber .sl-label  { color: #fcd34d; }
[data-theme="dark"] .sr-red td:last-child,    [data-theme="dark"] .sl-red .sl-label    { color: #fca5a5; }
[data-theme="dark"] .sl-gold, [data-theme="dark"] .sl-emerald, [data-theme="dark"] .sl-blue,
[data-theme="dark"] .sl-cyan, [data-theme="dark"] .sl-amber,  [data-theme="dark"] .sl-red { background: rgba(255,255,255,0.04); }

[data-theme="dark"] .toast.success { color: #6ee7b7; }
[data-theme="dark"] .toast.error   { color: #fca5a5; }
[data-theme="dark"] .range-badge   { background: var(--surface-3); }
[data-theme="dark"] .text-input,
[data-theme="dark"] .course-tbl input,
[data-theme="dark"] .auth-input,
[data-theme="dark"] .input-with-hint input { color-scheme: dark; }

/* ══════════════════════════════════════════════════════
   ICON BUTTON (theme toggle, settings, logout, modal close)
══════════════════════════════════════════════════════ */
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.icon-btn svg { width: 17px; height: 17px; }

.icon-btn-light {
  background: var(--surface-3);
  color: var(--text-secondary);
}
.icon-btn-light:hover { background: var(--border); color: var(--text-primary); }

/* Theme toggle: swap which icon shows based on the active theme */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.sidebar-brand { position: relative; padding-right: 56px; }
.sidebar-brand .theme-toggle { position: absolute; right: 16px; top: 22px; }

/* ══════════════════════════════════════════════════════
   SIDEBAR ACCOUNT ROW
══════════════════════════════════════════════════════ */
.sidebar-account {
  margin: 14px 12px 4px;
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-500), var(--violet-500));
  color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.account-info { flex: 1; min-width: 0; }
.account-email {
  display: block;
  font-size: 12.5px; font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   APP SHELL / AUTH SCREEN / BOOT LOADER — visibility states
   Driven entirely by body[data-auth-state="..."], set in app.js.
══════════════════════════════════════════════════════ */
.boot-loader, .auth-screen, .app-shell, .firebase-setup-wrap { display: none; }

body[data-auth-state="loading"] .boot-loader        { display: flex; }
body[data-auth-state="signed-out"] .auth-screen     { display: grid; }
body[data-auth-state="signed-in"] .app-shell        { display: contents; }
body[data-auth-state="config-missing"] .firebase-setup-wrap { display: flex; }

.boot-loader {
  position: fixed; inset: 0; z-index: 50;
  background: var(--surface-2);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-weight: 600; font-size: 13px;
}
.boot-spinner {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--indigo-500);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Firebase setup-required screen ─────────────────── */
.firebase-setup-wrap {
  position: fixed; inset: 0; z-index: 40;
  background: var(--surface-2);
  align-items: center; justify-content: center;
  padding: 24px;
}
.firebase-setup-card {
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 40px;
}
.firebase-setup-card h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.firebase-setup-intro { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin-bottom: 18px; }
.firebase-setup-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.firebase-setup-steps li { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; }
.firebase-setup-steps code, .firebase-setup-note code {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; font-size: 12px;
  font-family: 'Courier New', monospace; color: var(--indigo-600);
}
.firebase-setup-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

/* ══════════════════════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════════════════════ */
.auth-screen {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
}

.auth-brand-panel {
  background: linear-gradient(155deg, var(--indigo-950) 0%, #1a1744 55%, var(--indigo-900) 100%);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-brand-panel::after {
  content: "";
  position: absolute; right: -120px; top: -120px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.25), transparent 70%);
}
.auth-brand-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-top .brand-logo svg { width: 44px; height: 44px; }
.auth-brand-top .brand-name { font-size: 20px; }

.auth-brand-mid { position: relative; z-index: 1; }
.auth-brand-headline {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 800; line-height: 1.15;
  color: #fff; letter-spacing: -0.02em;
  margin: 40px 0 32px;
}
.auth-feature-list { display: flex; flex-direction: column; gap: 18px; }
.auth-feature-list li { display: flex; align-items: flex-start; gap: 12px; color: rgba(255,255,255,0.82); font-size: 14px; line-height: 1.5; }
.auth-feature-list svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: var(--violet-400); }
.auth-brand-foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255,255,255,0.45); }

.auth-form-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-card { width: 100%; max-width: 380px; }

.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-mobile-brand .brand-logo svg { width: 36px; height: 36px; }
.auth-mobile-brand-name { color: var(--text-primary) !important; font-size: 18px; }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab-btn {
  flex: 1; padding: 9px 0;
  border: none; background: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--text-muted); border-radius: var(--r-sm);
  transition: all var(--t);
}
.auth-tab-btn.active { background: var(--surface); color: var(--indigo-600); box-shadow: var(--shadow-xs); }

.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active { display: flex; }
.auth-form-intro { font-size: 13px; color: var(--text-secondary); margin-bottom: -4px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.auth-input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font); font-size: 14px;
  color: var(--text-primary); background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.auth-input:focus { border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

.auth-forgot-link, .auth-switch-link {
  font-size: 12.5px; font-weight: 600;
  color: var(--indigo-600); text-decoration: none;
  align-self: flex-end;
}
.auth-switch-link { align-self: center; margin-top: 4px; }
.auth-forgot-link:hover, .auth-switch-link:hover { text-decoration: underline; }

.auth-error {
  background: var(--red-100);
  color: #991b1b;
  border-left: 3px solid var(--red-500);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}
[data-theme="dark"] .auth-error { color: #fca5a5; }

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-mobile-brand { display: flex; }
}

/* ══════════════════════════════════════════════════════
   MODALS (settings / confirm / reauth)
══════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(8,10,20,0.6);
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  width: 100%; max-width: 440px;
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  animation: fadeSlide 0.18s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--text-primary); }
.confirm-modal-msg { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin: 14px 0 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-actions .btn.btn-full { width: auto; }

.settings-account-line { font-size: 13px; color: var(--text-secondary); margin: 10px 0 20px; }
.settings-account-line strong { color: var(--text-primary); }

.modal-section { padding: 16px 0; border-top: 1px solid var(--border); }
.modal-section:first-of-type { border-top: none; padding-top: 0; }
.modal-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px;
}
.theme-switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--text-primary); }

.danger-zone { display: flex; flex-direction: column; }
.btn-danger-solid { background: var(--red-500); color: #fff; padding: 10px 22px; font-size: 14px; }
.btn-danger-solid:hover { background: #dc2626; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-2); border-radius: 999px;
  transition: background var(--t);
}
.switch-knob {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform var(--t);
}
.switch input:checked + .switch-track { background: var(--indigo-500); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(18px); }

/* ══════════════════════════════════════════════════════
   GRADE SCALE — editable state
══════════════════════════════════════════════════════ */
.scale-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 16px; flex-wrap: wrap; }
.scale-card-header .card-heading { margin-bottom: 4px; }
.scale-status-note { font-size: 12px; color: var(--text-muted); }
.scale-edit-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-error {
  margin: 0 20px 14px;
  background: var(--red-100); color: #991b1b;
  border-left: 3px solid var(--red-500);
  border-radius: var(--r-sm); padding: 9px 14px;
  font-size: 13px; font-weight: 600;
}
[data-theme="dark"] .scale-error { color: #fca5a5; }
.scale-input {
  width: 100%; padding: 6px 9px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-family: var(--font); font-size: 13px;
  color: var(--text-primary); background: var(--surface);
  outline: none;
}
.scale-input:focus { border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.two-col-scale .table-card { padding-bottom: 4px; }

/* ══════════════════════════════════════════════════════
   TOAST STACK — fixed, multiple toasts can stack
══════════════════════════════════════════════════════ */
.toast-stack {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 700;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast-stack .toast { margin-top: 0; box-shadow: var(--shadow-md); transition: opacity 0.25s ease; }

@media (max-width: 900px) {
  .sidebar-brand { padding-right: 16px; }
  .sidebar-brand .theme-toggle { position: static; margin-left: auto; }
  .toast-stack { left: 12px; right: 12px; top: 72px; max-width: none; }
}
