/* public/css/app.css - Rich, Posh, Minimalist Mobile-First Design System */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Noto+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Raleway:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Rich & Posh Dynamic Palette */
  --primary: #1e40af;
  --primary-hover: #172554;
  --primary-glow: rgba(30, 64, 175, 0.2);
  --primary-light: rgba(30, 64, 175, 0.06);
  --primary-border: rgba(30, 64, 175, 0.22);
  
  --secondary: #0f766e;
  --secondary-hover: #134e4a;
  --secondary-light: rgba(15, 118, 110, 0.07);
  
  --accent: #f59e0b;
  --accent-light: rgba(245, 158, 11, 0.1);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.09);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.09);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.09);
  --info: #06b6d4;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-input: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #3b82f6;

  /* Typography */
  --font-bengali: 'SolaimanLipi', 'Hind Siliguri', 'Kalpurush', sans-serif;
  --font-english: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-main: var(--font-english);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 0 20px -2px var(--primary-glow);
}

html[lang="bn"] {
  font-family: var(--font-bengali), var(--font-english);
}

html[lang="en"] {
  font-family: var(--font-english), var(--font-bengali);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  background-image: radial-gradient(at 0% 0%, rgba(30, 64, 175, 0.03) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(15, 118, 110, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Typography & Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  line-height: 1.25;
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 0.95rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; letter-spacing: -0.02em; }
.text-2xl { font-size: 1.6rem; letter-spacing: -0.03em; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1 1 0%; }

/* Buttons with Tactile Depth & Touch Area */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  line-height: 1.25;
  min-height: 42px;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
  background-color: #fff;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-muted);
  border-color: #cbd5e1;
}

.btn-success { background-color: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background-color: #059669; }

.btn-danger { background-color: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background-color: #dc2626; }

.btn-warning { background-color: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background-color: #d97706; }

.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary-border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-xs { padding: 3px 8px; font-size: 0.75rem; min-height: 28px; height: 28px; border-radius: var(--radius-xs); line-height: 1; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; min-height: 36px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 24px; font-size: 1.02rem; min-height: 48px; border-radius: var(--radius-md); }
.btn-block { width: 100%; display: flex; }

/* Custom Google Button */
.btn-google {
  background: #ffffff;
  color: #1f2937;
  border: 1.5px solid #e5e7eb;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: var(--shadow-md);
}

/* Forms & High-Precision Inputs */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px; /* Prevents auto-zoom on iOS */
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: all 0.18s ease;
  font-family: inherit;
  min-height: 44px;
}
@media (min-width: 768px) {
  .form-control { font-size: 0.92rem; }
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-light);
}
textarea.form-control { min-height: 84px; resize: vertical; }

/* Symmetrical & Compact Table Filter System */
.filter-bar-card {
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.filter-bar-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-search-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 200px;
  min-width: 180px;
}

.filter-search-input {
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-input, #fff);
  color: var(--text-main);
  transition: all 0.18s ease;
}

.filter-select {
  height: 36px;
  min-height: 36px;
  padding: 4px 28px 4px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-input, #fff);
  color: var(--text-main);
  cursor: pointer;
  max-width: 175px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex: 0 0 auto;
}

.filter-select:focus,
.filter-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-btn-apply {
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

/* Mobile Filter Grid Optimization (Compact, Symmetrical 2-Column Grid) */
@media (max-width: 768px) {
  .filter-bar-card {
    padding: 10px;
    margin-bottom: 12px;
  }
  .filter-bar-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
  }
  .filter-search-wrapper {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }
  .filter-search-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    min-height: 34px;
    font-size: 0.8rem;
    padding: 4px 10px;
  }
  .filter-select {
    width: 100% !important;
    max-width: 100% !important;
    height: 34px;
    min-height: 34px;
    font-size: 0.78rem;
    padding: 2px 22px 2px 8px;
    border-radius: var(--radius-xs);
  }
  .filter-btn-apply {
    height: 34px;
    min-height: 34px;
    min-width: 34px;
    width: 34px;
  }
}

@media (max-width: 480px) {
  .filter-bar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }
  .filter-select {
    font-size: 0.74rem;
    padding: 2px 18px 2px 6px;
  }
}

/* Result Scorecard Metrics (4-column on Desktop, 2x2 Grid on Mobile) */
.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}

.result-metric-card {
  padding: 12px 10px;
  margin-bottom: 0 !important;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
}

.result-metric-card.is-correct {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.result-metric-card.is-wrong {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.result-metric-card.is-skipped {
  background: #f8fafc !important;
  border-color: var(--border-color) !important;
}

.result-metric-card.is-violations {
  background: #f8fafc !important;
  border-color: var(--border-color) !important;
}

@media (max-width: 768px) {
  .result-metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .result-metric-card {
    padding: 10px 8px !important;
  }
}

/* Student Dashboard Center-Aligned Nav Tabs */
.exam-tabs-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0 20px;
  width: 100%;
}

.exam-tabs-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-muted, #f1f5f9);
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

.exam-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.exam-tab-btn:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.65);
}

.exam-tab-btn.active {
  color: var(--primary);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.exam-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.exam-tab-btn.active .exam-tab-badge {
  background: var(--primary-light, #e0e7ff);
  color: var(--primary);
}

.exam-tab-btn.tab-live.active .exam-tab-badge {
  background: #dcfce7;
  color: #15803d;
}

.live-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse-live 1.8s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (max-width: 600px) {
  .exam-tabs-container {
    width: 100%;
    border-radius: var(--radius-md);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
  }
  .exam-tab-btn {
    padding: 7px 4px;
    font-size: 0.76rem;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
}

/* Taxonomies: subjects with their chapters nested inside */
.tax-subject { border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; background: #fff; }
.tax-subject[open] { border-color: var(--primary-border); }
.tax-subject-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer; list-style: none; user-select: none;
  min-height: 44px;
}
.tax-subject-head::-webkit-details-marker { display: none; }
.tax-subject-head:hover { background: var(--bg-muted); border-radius: var(--radius-sm); }
.tax-subject-caret { display: flex; flex-shrink: 0; color: var(--text-muted); transition: transform .15s ease; }
.tax-subject[open] > .tax-subject-head .tax-subject-caret { transform: rotate(90deg); }
.tax-chapter-list { padding: 2px 12px 10px 34px; border-top: 1px dashed var(--border-color); }
.tax-chapter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border-color);
}
.tax-chapter-row:last-child { border-bottom: none; }

/* Math fallback rendering (public/js/math.js) — used when KaTeX isn't loaded, and for bare
   undelimited LaTeX that KaTeX doesn't touch. */
.math-inline { font-family: 'Times New Roman', Times, serif; font-style: italic; padding: 0 1px; }
.math-display { display: block; margin: 8px 0; text-align: center; font-family: 'Times New Roman', Times, serif; font-style: italic; }
.mfrac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .9em; padding: 0 3px; }
.mfrac-n { border-bottom: 1px solid currentColor; padding: 0 3px; }
.mfrac-d { padding: 0 3px; }
.msqrt { white-space: nowrap; }
.msqrt-r { border-top: 1px solid currentColor; padding: 0 2px; }
/* KaTeX display blocks can be wider than a phone; let them scroll rather than stretch the page. */
.katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; }

/* Lightweight rich text editor (public/js/rich-editor.js) */
.rich-editor { border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-input); }
.rich-editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; background: var(--bg-muted); border-bottom: 1px solid var(--border-color); }
.rich-editor-btn { min-width: 32px; min-height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; color: var(--text-main); font-size: 0.8rem; font-family: inherit; cursor: pointer; }
.rich-editor-btn:hover { background: var(--bg-card); border-color: var(--border-color); }
.rich-editor-body { min-height: 84px; max-height: 320px; overflow-y: auto; border: none; border-radius: 0; outline: none; line-height: 1.6; }
.rich-editor-body:empty:before { content: attr(data-placeholder); color: var(--text-muted); }
.rich-editor-body:focus { box-shadow: none; }

/* Refined Cards & Containers */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.card-title { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.02em; }

/* Frosted Glass Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.badge-primary { background-color: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-secondary { background-color: var(--bg-muted); color: var(--text-muted); }

/* Header Navigation Bar */
.app-header {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0);
}
.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 8px;
}
.app-logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 12px;
  width: 100%;
  flex: 1;
}
@media (min-width: 768px) {
  .main-container {
    padding: 24px 20px;
  }
}

/* Admin Responsive Sliding Drawer Navigation */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  position: relative;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

.admin-sidebar {
  width: 250px;
  background-color: #fff;
  border-right: 1px solid var(--border-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.admin-sidebar-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  min-height: 46px;
  touch-action: manipulation;
}
.admin-nav-item:hover { background-color: var(--bg-muted); color: var(--text-main); }
.admin-nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}

.admin-content {
  flex: 1;
  padding: 20px 24px;
  overflow-x: hidden;
  max-width: 100%;
  padding-bottom: 100px !important;
}

/* Mobile Navigation Drawer & Hamburger Toggle */
#mobile-menu-btn,
.mobile-menu-btn {
  display: none !important;
}

@media (max-width: 768px) {
  #mobile-menu-btn,
  .mobile-menu-btn {
    display: inline-flex !important;
  }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 285px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-sidebar-header {
    display: flex;
  }
  .admin-content {
    padding: 14px 10px;
    padding-bottom: 100px !important;
  }
}

/* KPI Metrics Cards Responsive Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
  }
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* Line Clamping & Text Truncation Utilities */
.line-clamp-1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Responsive Table & Card-Style Switcher */
.table-container, .responsive-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

table.data-table, table.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8125rem;
}
table.data-table th, table.table th {
  background-color: #fafbfc;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
table.data-table th:not([data-no-sort]), table.table th:not([data-no-sort]) {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
table.data-table th:not([data-no-sort]):hover, table.table th:not([data-no-sort]):hover {
  background-color: var(--bg-muted);
  color: var(--primary);
}
.table-sort-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}
table.data-table td, table.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 0.8125rem;
}
table.data-table tr:last-child td, table.table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td, table.table tr:hover td { background-color: #f8fafc; }

/* Table Cell Stack Utility: Ensures multi-field items stack vertically on their own lines */
.table-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.table-cell-stack > * {
  display: block;
  max-width: 100%;
}

@media (max-width: 768px) {
  .responsive-table table.data-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table th,
  .responsive-table td,
  .responsive-table tr {
    display: block;
  }
  .responsive-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .responsive-table tr {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .responsive-table td {
    border: none;
    border-bottom: 1px solid var(--bg-muted, #f1f5f9);
    padding: 7px 0;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-align: right;
    font-size: 0.84rem;
    gap: 12px;
  }
  .responsive-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 2px;
    min-width: 75px;
  }
  .responsive-table td:not([data-label])::before,
  .responsive-table td[data-label=""]::before {
    display: none;
  }
  .table-cell-stack {
    align-items: flex-end;
    text-align: right;
    width: 100%;
  }
  .table-cell-stack > * {
    display: block;
    width: 100%;
    text-align: right;
  }
}

/* Modals (Responsive Bottom-Sheet on Mobile) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 12px;
}
.modal-content {
  background-color: #fff;
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  /* A flex item defaults to min-width:auto, so a single wide child (a long formula, an
     unbreakable token) can force the dialog wider than the viewport and push the header's
     close button off-screen. min-width:0 lets it shrink to the viewport instead. */
  min-width: 0;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fafbfc;
  flex-shrink: 0;
}
.modal-header h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The close control must never be squeezed away by a long title. */
#modal-close-btn { flex-shrink: 0; }
.modal-body {
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}
/* Wide, genuinely non-wrappable content (tables, long formulas) scrolls inside its own box
   rather than stretching the dialog. */
.modal-body .responsive-table,
.modal-body pre,
.modal-body .katex-display { max-width: 100%; overflow-x: auto; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background-color: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    max-height: 88dvh;
    max-width: 100%;
  }
}

/* Fullscreen Examination Guard Overlay */
#exam-fullscreen-guard {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.exam-guard-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Responsive Form Grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Toasts (Mobile Responsive) */
#toast-container {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: 16px;
  left: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
@media (min-width: 640px) {
  #toast-container {
    left: auto;
    width: 380px;
    right: 20px;
  }
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast-info { background-color: var(--primary); }
.toast-success { background-color: var(--success); }
.toast-error { background-color: var(--danger); }
.toast-warning { background-color: var(--warning); }

/* Option Cards for Exams (Mobile Touch Optimized) */
.option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
  background-color: #fff;
  min-height: 52px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.option-card:hover { border-color: var(--primary-border); background-color: #fafbfc; }
.option-card:active { transform: scale(0.985); }
.option-card.selected { border-color: var(--primary); background-color: var(--primary-light); box-shadow: 0 0 0 1px var(--primary); }
.option-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  background-color: var(--bg-muted);
  color: var(--text-main);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.option-card.selected .option-badge {
  background-color: var(--primary);
  color: #fff;
}

/* Examination experience — calm, focused, and optimized for touch */
/* Examination experience — calm, focused, and optimized for touch */
.exam-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 0%, var(--primary-light), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}
.exam-header {
  position: relative;
  flex-shrink: 0;
  z-index: 40;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(226, 232, 240, .86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.exam-header-inner, .exam-main-inner, .exam-footer-inner { width: 100%; max-width: 780px; margin: 0 auto; }
.exam-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.exam-title-wrap { min-width: 0; flex: 1; }
.exam-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; font-weight: 750; letter-spacing: -.015em; }
.exam-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--text-muted); font-size: .76rem; font-weight: 650; }
.exam-progress-track { height: 3px; max-width: 780px; margin: 9px auto 0; overflow: hidden; border-radius: 99px; background: var(--bg-muted); }
.exam-progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6366f1); transition: width .25s ease; }
.exam-tools { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.exam-sync { padding: 5px 8px; }
.exam-timer { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border-radius: 10px; background: #f8fafc; color: var(--text-main); font-size: .8rem; font-weight: 800; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.exam-timer.is-urgent { color: var(--danger); background: var(--danger-light); }
.exam-palette-trigger { width: 44px; min-width: 44px; height: 44px; padding: 0; }
.exam-lang-toggle { min-width: 44px; height: 44px; padding: 0 8px; font-weight: 800; font-size: .8rem; }
.exam-main {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 14px 24px;
}
.exam-questions-feed {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.exam-question-card {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 4vw, 30px);
  margin: 0;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 22px;
  box-shadow: 0 14px 35px -24px rgba(15, 23, 42, .32);
  scroll-margin-top: 85px;
}
.exam-question-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--primary), #818cf8); }
.exam-question-label { display: inline-flex; align-items: center; gap: 7px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.exam-question-label::after { content: ''; width: 26px; height: 1px; background: currentColor; opacity: .35; }
.exam-question-text { font-size: clamp(1.05rem, 2vw, 1.22rem); font-weight: 650; line-height: 1.65; overflow-wrap: anywhere; }
.exam-question-image { display: block; max-width: 100%; max-height: 300px; margin: 22px auto 4px; border: 1px solid var(--border-color); border-radius: 14px; }
.exam-options { display: grid; gap: 10px; margin-top: 24px; }
.exam-options .option-card { margin: 0; padding: 13px 15px; border-radius: 14px; min-height: 58px; box-shadow: 0 1px 1px rgba(15, 23, 42, .02); }
.exam-options .option-card:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.exam-options .option-card.selected { box-shadow: 0 8px 18px -14px var(--primary); }
.exam-footer {
  position: relative;
  flex-shrink: 0;
  z-index: 40;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom, 12px));
  background: rgba(255, 255, 255, .95);
  border-top: 1px solid rgba(226, 232, 240, .9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}
.exam-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}
.exam-footer .btn { min-height: 44px; }
.exam-submit { box-shadow: 0 6px 14px -10px var(--danger); }
.exam-palette-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.exam-palette-stat { padding: 10px 8px; border: 1px solid var(--border-color); border-radius: 12px; text-align: center; background: #fff; }
.exam-palette-stat strong { display: block; font-size: 1.05rem; line-height: 1.1; }
.exam-palette-stat span { display: block; margin-top: 3px; color: var(--text-muted); font-size: .72rem; font-weight: 650; }
.exam-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 9px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.palette-q-btn { position: relative; min-height: 44px; padding: 4px; border: 1.5px solid var(--border-color); border-radius: 12px; background: #fff; color: var(--text-main); font-weight: 700; }
.palette-q-btn.is-current { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.palette-q-btn.is-answered { border-color: var(--success); color: var(--success); background: var(--success-light); }
.palette-q-btn.is-answered::before { content: ''; position: absolute; bottom: 5px; left: 5px; width: 5px; height: 5px; border-radius: 1px; background: currentColor; }
.palette-q-btn.is-review { border-color: var(--warning); color: #b45309; background: var(--warning-light); }
.palette-q-btn.is-review::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
@media (max-width: 640px) {
  .exam-header { padding-right: 12px; padding-left: 12px; }
  .exam-sync { padding: 5px 7px; font-size: 0; }
  .exam-sync svg { display: block; }
  .exam-main { padding: 14px 10px 18px; }
  .exam-question-card { border-radius: 17px; }
  .exam-footer { padding-right: 10px; padding-left: 10px; }
  .exam-footer .btn { padding-right: 10px; padding-left: 10px; }
}

/* Color Picker Chips */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.color-chip {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-chip:hover { transform: scale(1.1); }
.color-chip.active { box-shadow: 0 0 0 2.5px var(--text-main); }

/* Math Container Auto-Scroll for long equations on Mobile */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}

/* Sticky Floating Action Button (FAB) */
.sticky-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary, #f97316);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.15s ease;
  text-decoration: none;
}
.sticky-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32), 0 4px 10px rgba(0, 0, 0, 0.2);
  background: var(--primary-hover, #ea580c);
  color: #ffffff !important;
}
.sticky-fab:active {
  transform: scale(0.95);
}
@media (max-width: 640px) {
  .sticky-fab {
    bottom: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
  }
}

/* User Profile Dropdown */
.user-dropdown-wrapper {
  position: relative;
}
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  z-index: 100;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease-out;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.8125rem;
  color: var(--text-main);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dropdown-item:hover {
  background-color: var(--bg-muted, #f1f5f9);
}
.dropdown-item.text-danger:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

/* Sticky Info Icon Button (Bottom Left) */
.sticky-info-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--text-muted);
  border: 1.5px solid var(--border-color);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticky-info-btn:hover {
  transform: scale(1.12) translateY(-2px);
  color: var(--primary, #f97316);
  border-color: var(--primary, #f97316);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}
.sticky-info-btn:active {
  transform: scale(0.95);
}
@media (max-width: 640px) {
  .sticky-info-btn {
    bottom: 18px;
    left: 18px;
    width: 38px;
    height: 38px;
  }
}

/* Locked / Immutable Option Cards during Exam */
.option-card.locked {
  cursor: default !important;
  opacity: 0.92;
}
.option-card.locked:not(.selected) {
  opacity: 0.65;
  background: #fafafa;
}
.option-card.locked.selected {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 2px var(--primary-glow) !important;
  opacity: 1 !important;
}

/* Square Icon-Only Buttons */
.btn-icon {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-md) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}
.btn-icon-sm {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}
.btn-icon-xs {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-xs) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}
.btn-icon svg,
.btn-icon-sm svg,
.btn-icon-xs svg {
  display: block !important;
  flex-shrink: 0 !important;
  margin: auto !important;
}

/* Table Pagination Bar with Clearance for Floating Elements */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 12px;
  padding-right: 76px;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 640px) {
  .table-pagination {
    padding-right: 68px;
  }
}

/* Utilities */
@media (max-width: 640px) {
  .hidden-mobile { display: none !important; }
}
@media (min-width: 641px) {
  .hidden-desktop { display: none !important; }
}

/* Respect the OS-level reduced-motion preference across every animation/transition in the
   system, rather than relying on individual components to opt out. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* App Footer Styling */
.app-footer {
  margin-top: auto;
  padding: 24px 16px 28px;
  background: var(--bg-card, #ffffff);
  border-top: 1px solid var(--border-color);
  text-align: center;
  width: 100%;
}

.app-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-copyright {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.footer-developer {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.85;
  letter-spacing: 0.02em;
}

.footer-developer a,
.footer-developer .developer-link {
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.footer-developer a:hover,
.footer-developer .developer-link:hover {
  color: var(--primary);
  text-decoration: underline;
  opacity: 1;
}

