/* ==========================================================================
   BABILIM COMPONENTS — INTERACTIVE DEMO, MODALS, & WIDGETS
   Authentic implementation of Babilim's core product features:
   1. Academic Dashboard (Today Schedule, Canteen, Deadlines, Weather)
   2. Degree Audit & Interactive What-If GPA Simulator
   3. Notes with LaTeX Rendering & Split-View Study Mode
   4. Courses & Offline Moodle Sync Hub
   5. Study Tools (Pomodoro Focus Engine & SM-2 Flashcards)
   ========================================================================== */

/* ==========================================================================
   INTERACTIVE APP DEMO STAGE
   ========================================================================== */
.demo-stage-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 640px;
}

/* App Shell Navigation Rail */
.demo-app-rail {
  background: var(--paper-sunken);
  border-right: 1px solid var(--rule);
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rail-brand-header {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding-bottom: var(--s-md);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-md);
}

.rail-brand-mark {
  width: 22px;
  height: 22px;
  color: var(--ink);
}

.rail-brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--ink);
}

.rail-brand-title span {
  color: var(--accent);
}

.rail-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rail-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
  transition: all var(--m-quick);
  text-align: left;
}

.rail-nav-btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.rail-nav-btn.active {
  background: var(--paper-raised);
  color: var(--ink);
  font-weight: 600;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-subtle);
}

.rail-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rail-footer-meta {
  padding-top: var(--s-md);
  border-top: 1px solid var(--rule);
  font-size: 0.6875rem;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Main Display Canvas */
.demo-main-canvas {
  padding: var(--s-xl);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  min-height: 580px;
}

/* ==========================================================================
   TAB 1: TODAY (ACADEMIC DASHBOARD)
   ========================================================================== */
.dashboard-grid-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
}

.dashboard-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
}

.dashboard-date-display {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}

.dashboard-schedule-summary {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Day Strip (Schedule occurrences) */
.day-strip-box {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  box-shadow: var(--shadow-subtle);
}

.section-label-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-md);
}

.section-label-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.events-timeline-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
}

.event-timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  transition: all var(--m-quick);
}

.event-timeline-item.completed {
  opacity: 0.55;
  text-decoration: line-through;
}

.event-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-check-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--rule-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-raised);
  transition: all var(--m-quick);
}

.event-timeline-item.completed .event-check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.event-course-swatch {
  width: 6px;
  height: 28px;
  border-radius: 2px;
}

.event-details {
  display: flex;
  flex-direction: column;
}

.event-title-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.event-loc-text {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.event-time-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--paper-sunken);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Dashboard Bottom Grid: Canteen + Deadlines + Weather */
.dashboard-tri-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.9fr;
  gap: var(--s-md);
}

.dash-card-unit {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dash-card-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: var(--s-sm);
}

.canteen-dish-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 6px;
}

.canteen-tags-row {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.6875rem;
}

.pill-diet {
  background: var(--success-soft);
  color: var(--success);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.canteen-price {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.deadline-item-mini {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.75rem;
}

.deadline-item-mini:last-child {
  border-bottom: none;
}

.deadline-due-tag {
  color: var(--warning);
  font-weight: 600;
}

.weather-temp-num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--ink);
}

.weather-sub-desc {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   TAB 2: DEGREE AUDIT & WHAT-IF GPA SIMULATOR
   ========================================================================== */
.audit-container {
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
}

.audit-stats-header {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-md);
}

.audit-stat-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-md);
  display: flex;
  flex-direction: column;
}

.audit-stat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.audit-stat-val {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
}

.audit-stat-delta {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
}

/* Progress bar */
.audit-progress-wrapper {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-md) var(--s-lg);
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--paper-sunken);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width var(--m-deliberate);
}

/* What-If GPA Simulator Panel */
.what-if-panel-card {
  background: var(--paper-raised);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  box-shadow: var(--shadow-raised);
}

.what-if-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-md);
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
}

.what-if-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
}

.what-if-simulator-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-md);
  margin-bottom: var(--s-lg);
}

.simulator-course-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.sim-course-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.sim-course-credits {
  font-size: 0.6875rem;
  color: var(--ink-muted);
}

.sim-select-grade {
  height: 32px;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 0 8px;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.8125rem;
  margin-top: 4px;
}

.projected-gpa-output {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.projected-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.projected-val-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.projected-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

/* ==========================================================================
   TAB 3: NOTES & LATEX SPLIT-VIEW
   ========================================================================== */
.notes-split-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-md);
  height: 100%;
  min-height: 480px;
}

.notes-editor-pane {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
}

.notes-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-md);
}

.notes-tree-crumb {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.notes-document-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--s-md);
}

.notes-editor-content {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  overflow-y: auto;
}

.latex-formula-block {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-family: 'KaTeX_Main', serif;
  font-size: 1.125rem;
  text-align: center;
  color: var(--ink);
}

.notes-slide-preview-pane {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.slide-top-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}

.slide-canvas-mock {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  padding: 24px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide-canvas-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
}

.slide-canvas-body {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* ==========================================================================
   TAB 4: STUDY TOOLS (FOCUS POMODORO & FLASHCARDS)
   ========================================================================== */
.study-tools-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-lg);
  align-items: start;
}

.pomodoro-card-stage {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pomodoro-timer-clock {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  margin: 12px 0;
}

.pomodoro-state-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.pomodoro-controls-row {
  display: flex;
  gap: var(--s-sm);
  margin-top: var(--s-md);
}

.pomodoro-stats-strip {
  display: flex;
  justify-content: space-around;
  width: 100%;
  border-top: 1px solid var(--rule);
  padding-top: var(--s-md);
  margin-top: var(--s-lg);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   COURSES & MOODLE SYNC
   ========================================================================== */
.course-hub-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.moodle-sync-status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--paper-sunken);
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
}

.course-directory-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
}

.course-card-expanded {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-md) var(--s-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--m-quick);
}

.course-card-expanded:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-subtle);
}

.course-meta-block {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.course-avatar-swatch {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.course-names-group {
  display: flex;
  flex-direction: column;
}

.course-code-h {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.course-instructor-p {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.course-actions-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
}

.sync-badge-pill {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink-muted);
}

/* ==========================================================================
   WAITLIST SUCCESS / REFERRAL CARD
   ========================================================================== */
.waitlist-success-card {
  display: none;
  flex-direction: column;
  gap: var(--s-lg);
  animation: fadeIn var(--m-deliberate) forwards;
}

.waitlist-success-card.active {
  display: flex;
}

.success-badge-row {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  color: var(--success);
  font-weight: 600;
  font-size: 0.9375rem;
}

.position-display-box {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  padding: var(--s-lg);
  text-align: center;
}

.position-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.position-number {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0;
}

.position-cohort-desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Unique Referral Code Highlight Box */
.referral-code-box {
  background: var(--paper-raised);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--s-md);
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
}

.referral-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.referral-count-pill {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
}

.referral-code-display-row {
  display: flex;
  gap: var(--s-sm);
  align-items: center;
}

.referral-code-tag {
  flex: 1;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-xs);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-align: center;
  user-select: all;
}

/* Referral Milestone Bar */
.referral-milestone-box {
  background: var(--paper-sunken);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.milestone-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.milestone-track {
  width: 100%;
  height: 6px;
  background: var(--paper);
  border-radius: var(--r-pill);
  overflow: hidden;
  border: 1px solid var(--rule);
}

.milestone-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.4s ease-out;
}

.referral-share-box {
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
}

.referral-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.referral-input-group {
  display: flex;
  gap: var(--s-xs);
}

.referral-input {
  flex: 1;
  height: 40px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-xs);
  padding: 0 var(--s-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
}

.share-buttons-row {
  display: flex;
  gap: var(--s-sm);
}

.btn-share {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--m-quick);
}

.btn-share:hover {
  background: var(--paper-sunken);
  border-color: var(--rule-strong);
}

/* ==========================================================================
   COMMAND PALETTE (⌘K) OVERLAY (Brandbook §7.14)
   ========================================================================== */
.cmd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

[data-theme="night"] .cmd-modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.cmd-modal-overlay.open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

.cmd-dialog {
  width: 100%;
  max-width: 600px;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  padding: var(--s-md) var(--s-lg);
  border-bottom: 1px solid var(--rule);
  gap: var(--s-md);
}

.cmd-search-icon {
  color: var(--ink-faint);
  font-size: 1.125rem;
}

.cmd-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
}

.cmd-results-list {
  max-height: 340px;
  overflow-y: auto;
  padding: var(--s-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  padding: 8px 12px 4px 12px;
}

.cmd-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink);
  font-size: 0.875rem;
  transition: background-color var(--m-quick);
}

.cmd-result-item:hover,
.cmd-result-item.selected {
  background: var(--paper-sunken);
}

.cmd-result-left {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.cmd-shortcut-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 2px 6px;
  border-radius: 3px;
}

.cmd-dialog-footer {
  padding: 8px var(--s-lg);
  background: var(--paper-sunken);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   TOAST NOTIFICATION (Brandbook §7.9)
   ========================================================================== */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-modal);
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s cubic-bezier(0, 0, 0.2, 1);
}

.toast-notice.show {
  display: inline-flex;
}

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

/* ==========================================================================
   TOP 10 INVITERS LEADERBOARD SECTION
   ========================================================================== */
.leaderboard-section {
  padding: var(--s-3xl) 0;
  background: var(--paper-sunken);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2xl);
  max-width: 1040px;
  margin: 0 auto;
}

/* Podium Grid (Top 3) */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-lg);
  align-items: end;
  margin-bottom: var(--s-xl);
}

@media (max-width: 768px) {
  .podium-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.podium-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform var(--m-normal), box-shadow var(--m-normal);
  box-shadow: var(--shadow-subtle);
}

.podium-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.podium-card.rank-1 {
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(191, 59, 27, 0.12);
  padding-top: var(--s-2xl);
  padding-bottom: var(--s-2xl);
  order: 2;
}

.podium-card.rank-2 {
  order: 1;
}

.podium-card.rank-3 {
  order: 3;
}

@media (max-width: 768px) {
  .podium-card.rank-1 { order: 1; }
  .podium-card.rank-2 { order: 2; }
  .podium-card.rank-3 { order: 3; }
}

.podium-medal {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--s-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.rank-1 .podium-medal {
  background: linear-gradient(135deg, #FFDF00, #E6AC00);
  width: 56px;
  height: 56px;
  font-size: 1.8rem;
}

.rank-2 .podium-medal {
  background: linear-gradient(135deg, #E6E8EA, #B0B3B8);
}

.rank-3 .podium-medal {
  background: linear-gradient(135deg, #E0A96D, #CD7F32);
}

.podium-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--s-xs);
}

.podium-uni-pill {
  font-size: 0.75rem;
  color: var(--ink-muted);
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: var(--s-md);
}

.podium-invites {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
}

.podium-invites span {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  font-weight: 400;
  font-family: var(--font-body);
}

.podium-reward {
  margin-top: var(--s-md);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
}

.rank-1 .podium-reward {
  background: var(--accent-soft);
  color: var(--accent);
}

.rank-2 .podium-reward,
.rank-3 .podium-reward {
  background: var(--success-soft);
  color: var(--success);
}

/* Leaderboard List (#4–#10) */
.leaderboard-list-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  padding: 12px 18px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  background: var(--paper-sunken);
  border-bottom: 1px solid var(--rule);
}

.leaderboard-table td {
  padding: 14px 18px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}

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

.leaderboard-table tr:hover {
  background: var(--paper);
}

.lb-rank-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-muted);
  width: 50px;
}

.lb-student-info {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.lb-name {
  font-weight: 600;
  color: var(--ink);
}

.lb-uni {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.lb-invites {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

.lb-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  color: var(--ink-muted);
  display: inline-block;
}

/* User Current Standing Box */
.user-standing-box {
  background: var(--paper-raised);
  border: 1.5px dashed var(--accent);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-lg);
}

@media (max-width: 768px) {
  .user-standing-box {
    flex-direction: column;
    gap: var(--s-md);
    text-align: center;
  }
}

.user-standing-left {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.user-standing-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.user-standing-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink);
}

.user-standing-sub {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   TAB: GEMINI AI COURSE STUDIO (RAG & CITATIONS)
   ========================================================================== */
.ai-studio-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  height: 100%;
}

.ai-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
}

.ai-model-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.ai-sparkle-icon {
  color: var(--accent);
}

.ai-prompt-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
  margin-bottom: var(--s-sm);
}

.ai-prompt-chip {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--m-quick);
}

.ai-prompt-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.ai-chat-thread {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
}

.ai-msg {
  padding: var(--s-md);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  line-height: 1.6;
}

.ai-msg.user {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  align-self: flex-end;
  max-width: 80%;
  color: var(--ink);
}

.ai-msg.assistant {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  align-self: flex-start;
  max-width: 95%;
  color: var(--ink);
}

.ai-citation-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity var(--m-quick);
}

.ai-citation-tag:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.ai-input-bar {
  display: flex;
  gap: var(--s-sm);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--rule);
}

.ai-input-field {
  flex: 1;
  padding: 10px 14px;
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--ink);
}

/* ==========================================================================
   TAB: UNIVERSITY MAIL & DEADLINE EXTRACTION
   ========================================================================== */
.mail-workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-md);
  min-height: 480px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
}

@media (max-width: 768px) {
  .mail-workspace {
    grid-template-columns: 1fr;
  }
}

.mail-sidebar-list {
  background: var(--paper-sunken);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}

.mail-list-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mail-item-preview {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--m-quick);
}

.mail-item-preview:hover {
  background: var(--paper);
}

.mail-item-preview.active {
  background: var(--paper-raised);
  border-left: 3px solid var(--accent);
}

.mail-item-sender {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
}

.mail-item-subject {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-item-snippet {
  font-size: 0.6875rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

.mail-reading-pane {
  padding: var(--s-lg);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.mail-detail-header {
  padding-bottom: var(--s-md);
  border-bottom: 1px solid var(--rule);
}

.mail-detail-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.mail-detail-meta {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.ai-deadline-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
}

@media (max-width: 600px) {
  .ai-deadline-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.ai-deadline-text {
  font-size: 0.8125rem;
  color: var(--ink);
}

.ai-deadline-text strong {
  color: var(--accent);
}

.btn-add-deadline {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--m-quick);
}

.btn-add-deadline:hover {
  opacity: 0.9;
}

.btn-add-deadline.added {
  background: var(--success);
}

.mail-body-content {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink);
}

/* ==========================================================================
   QUICK TOOLS FLOATING ACTION BUTTON (Brandbook §5.4)
   ========================================================================== */
.demo-quick-tools-fab {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(191, 59, 27, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform var(--m-quick);
}

.demo-quick-tools-fab:hover {
  transform: scale(1.08);
}

.quick-tools-menu {
  position: absolute;
  bottom: 72px;
  right: 20px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 11;
  min-width: 180px;
}

.quick-tools-menu.open {
  display: flex;
}

.quick-tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  color: var(--ink);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--m-quick);
}

.quick-tool-item:hover {
  background: var(--paper-sunken);
}

.rail-badge-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Split-View Mode Toggle */
.split-view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--m-quick);
}

.split-view-toggle-btn:hover,
.split-view-toggle-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Split-View Mode Multi-Column Canvas */
.demo-stage-card.split-active .demo-main-canvas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-lg);
  padding: var(--s-lg);
}

.demo-stage-card.split-active .demo-view {
  display: block !important;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: var(--s-md);
  background: var(--paper);
  box-shadow: var(--shadow-subtle);
  overflow-y: auto;
  max-height: 600px;
}

.demo-stage-card.split-active .demo-view:not(.active):not(.split-secondary) {
  display: none !important;
}

@media (max-width: 900px) {
  .demo-stage-card.split-active .demo-main-canvas {
    grid-template-columns: 1fr;
  }
}

/* Slide Inspection Modal */
.slide-inspection-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-lg);
}

.slide-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.slide-modal-sheet {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  max-width: 640px;
  width: 100%;
  padding: var(--s-xl);
  z-index: 10;
  animation: modalScale 0.2s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.slide-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-lg);
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
}

.btn-close-modal {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  color: var(--ink-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--m-quick);
}

.btn-close-modal:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}


