/* PAKTIK — Professional Design System v3.0 */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 {
  gap: var(--s2);
}

.gap-4 {
  gap: var(--s4);
}

.mb-4 {
  margin-bottom: var(--s4);
}

.mb-6 {
  margin-bottom: var(--s6);
}

.mb-8 {
  margin-bottom: var(--s8);
}

.mt-4 {
  margin-top: var(--s4);
}

.w-full {
  width: 100%;
}

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

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

.text-xs {
  font-size: 11px;
}

.text-2xl {
  font-size: 28px;
}

.font-extrabold {
  font-weight: 800;
}

.uppercase {
  text-transform: uppercase;
}

.tracking-widest {
  letter-spacing: 0.1em;
}

.ml-auto {
  margin-left: auto;
}

.badge-neutral {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}

.fade-in {
  animation: fadeIn 0.35s ease both;
}

.hidden-by-search {
  display: none !important;
}

.sticky {
  position: sticky;
  top: 0;
  z-index: 10;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ── 1. TOKENS ─────────────────────────────────────────────── */
:root {
  --primary: #e04e22;
  --primary-hover: #c43d18;
  --primary-light: rgba(224, 78, 34, 0.08);
  --primary-mid: rgba(224, 78, 34, 0.15);

  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.08);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.08);

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;

  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;

  --sidebar: 248px;
  --shadow: 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 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ── LIGHT THEME (Default) ─────────────────────────────────── */
:root,
html,
[data-theme="light"] {
  --bg: #ffffff;
  --bg2: #f9fafb;
  --bg3: #f3f4f6;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --surface3: #f3f4f6;
  --border: #e5e7eb;
  --border2: #d1d5db;
  --text: #111827;
  --text2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
}

/* ── DARK THEME ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg2: #1e293b;
  --bg3: #334155;
  --surface: #1e293b;
  --surface2: #273549;
  --surface3: #334155;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --text2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #475569;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ── 2. RESET ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--primary-hover);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg2);
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: var(--r-full);
}

/* ── 3. LAYOUT ─────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main-area {
  background: var(--bg2);
  min-height: 100vh;
  overflow-y: auto;
}

.page-body {
  padding: var(--s8);
  max-width: 1200px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-main {
  background: var(--bg2);
  min-height: 100vh;
}

.admin-body {
  padding: var(--s8);
}

/* ── 4. SIDEBAR NAV ────────────────────────────────────────── */
.sidebar-brand {
  padding: var(--s6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-pak {
  color: var(--text);
}

.brand-tik {
  color: var(--primary);
}

.nav-section {
  padding: var(--s4) var(--s3);
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  padding: 0 var(--s3) var(--s2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t-fast);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg2);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

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

.sidebar-footer {
  padding: var(--s4) var(--s3);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-md);
  background: var(--bg2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.user-plan {
  font-size: 11px;
  color: var(--muted);
}

/* ── 5. PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--s8);
  gap: var(--s4);
  flex-wrap: wrap;
}

.page-title {
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── 6. CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s6);
  box-shadow: var(--shadow);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

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

.card-sm {
  padding: var(--s4);
  border-radius: var(--r-md);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
}

@media (max-width: 768px) {
  .stat-card {
    padding: var(--s4);
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--s4);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s2);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-value.accent {
  color: var(--primary);
}

/* ── 7. BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 10px var(--s5);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(224, 78, 34, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text2);
}

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--bg3);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 6px var(--s3);
  font-size: 12px;
}

.btn-lg {
  padding: 12px var(--s8);
  font-size: 15px;
}

/* ── 8. FORMS ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--s5);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: var(--s2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px var(--s4);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--faint);
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--s1);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: var(--s1);
}

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

/* ── 9. BADGES & ALERTS ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-neutral {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}

.alert {
  padding: var(--s4);
  border-radius: var(--r-md);
  font-size: 14px;
  margin-bottom: var(--s4);
}

.alert-success {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-danger {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary);
}

/* ── 10. TABLES ────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg2);
}

.data-table th {
  text-align: left;
  padding: var(--s3) var(--s4);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: var(--s3) var(--s4);
  font-size: 13px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}

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

.data-table tbody tr:hover {
  background: var(--bg2);
}

/* ── 11. QUIZ COMPONENTS ───────────────────────────────────── */
.quiz-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.quiz-topbar {
  height: 56px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s6);
}

.quiz-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.quiz-main {
  flex: 1;
  overflow-y: auto;
  padding: var(--s10) var(--s12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quiz-main>* {
  width: 100%;
  max-width: 720px;
}

.quiz-panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.q-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--s3);
}

.q-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: var(--s8);
}

.option {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: var(--s3);
  text-align: left;
  width: 100%;
  font-family: var(--font);
  color: var(--text);
  font-size: 14px;
}

.option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.option.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option-letter {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--bg2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: all var(--t-fast);
}

.option.active .option-letter {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.progress-bar {
  height: 3px;
  background: var(--bg3);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s ease;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s2);
  padding: var(--s4);
}

.q-nav-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--muted);
}

.q-nav-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.q-nav-btn.current {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.q-nav-btn.done {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.q-nav-btn.flagged {
  border-color: var(--warning);
  color: var(--warning);
}

/* ── 12. PRICING CARDS ─────────────────────────────────────── */
.pricing-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s8);
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.price-amount {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.price-period {
  font-size: 14px;
  color: var(--muted);
}

/* ── 13. AUTH LAYOUT ───────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s10) var(--s8);
  box-shadow: var(--shadow-md);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--s8);
}

.auth-logo .logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-logo .tagline {
  font-size: 13px;
  color: var(--muted);
  margin-top: var(--s1);
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--s1);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--s6);
}

.auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  margin: var(--s5) 0;
}

/* ── 14. THEME TOGGLE ──────────────────────────────────────── */
.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}

.theme-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

/* ── 15. UTILITIES ─────────────────────────────────────────── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.flex-wrap {
  flex-wrap: wrap;
}

.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;
}

.grid {
  display: grid;
}

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

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

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.gap-1 {
  gap: var(--s1);
}

.gap-2 {
  gap: var(--s2);
}

.gap-3 {
  gap: var(--s3);
}

.gap-4 {
  gap: var(--s4);
}

.gap-6 {
  gap: var(--s6);
}

.gap-8 {
  gap: var(--s8);
}

.m-0 {
  margin: 0;
}

.mb-1 {
  margin-bottom: var(--s1);
}

.mb-2 {
  margin-bottom: var(--s2);
}

.mb-3 {
  margin-bottom: var(--s3);
}

.mb-4 {
  margin-bottom: var(--s4);
}

.mb-5 {
  margin-bottom: var(--s5);
}

.mb-6 {
  margin-bottom: var(--s6);
}

.mb-8 {
  margin-bottom: var(--s8);
}

.mb-10 {
  margin-bottom: var(--s10);
}

.mt-1 {
  margin-top: var(--s1);
}

.mt-2 {
  margin-top: var(--s2);
}

.mt-3 {
  margin-top: var(--s3);
}

.mt-4 {
  margin-top: var(--s4);
}

.mt-6 {
  margin-top: var(--s6);
}

.mt-8 {
  margin-top: var(--s8);
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.p-4 {
  padding: var(--s4);
}

.p-6 {
  padding: var(--s6);
}

.p-8 {
  padding: var(--s8);
}

.px-3 {
  padding-left: var(--s3);
  padding-right: var(--s3);
}

.px-4 {
  padding-left: var(--s4);
  padding-right: var(--s4);
}

.px-6 {
  padding-left: var(--s6);
  padding-right: var(--s6);
}

.py-2 {
  padding-top: var(--s2);
  padding-bottom: var(--s2);
}

.py-3 {
  padding-top: var(--s3);
  padding-bottom: var(--s3);
}

.py-4 {
  padding-top: var(--s4);
  padding-bottom: var(--s4);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.inset-0 {
  inset: 0;
}

.overflow-hidden {
  overflow: hidden;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.rounded {
  border-radius: var(--r-md);
}

.rounded-lg {
  border-radius: var(--r-lg);
}

.rounded-xl {
  border-radius: var(--r-xl);
}

.rounded-full {
  border-radius: var(--r-full);
}

.text-xs {
  font-size: 11px;
}

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

.text-base {
  font-size: 15px;
}

.text-lg {
  font-size: 18px;
}

.text-xl {
  font-size: clamp(18px, 3vw, 22px);
}

.text-2xl {
  font-size: clamp(24px, 4vw, 28px);
}

.text-3xl {
  font-size: clamp(28px, 5vw, 36px);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

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

.text-right {
  text-align: right;
}

.uppercase {
  text-transform: uppercase;
}

.tracking-wide {
  letter-spacing: 0.05em;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

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

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

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

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

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

.divider {
  height: 1px;
  background: var(--border);
}

.separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s6) 0;
}

/* ── 16. PAGE FADE-IN ──────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.35s ease both;
}

.fade-in-1 {
  animation: fadeIn 0.35s 0.05s ease both;
}

.fade-in-2 {
  animation: fadeIn 0.35s 0.10s ease both;
}

.fade-in-3 {
  animation: fadeIn 0.35s 0.15s ease both;
}

.fade-in-4 {
  animation: fadeIn 0.35s 0.20s ease both;
}

/* ── 17. RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 1024px) {

  .grid-4,
  .grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {

  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
    display: block; /* allow topbar to sit normally */
  }

  .sidebar,
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.drawer-open,
  .admin-sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 0 0 24px rgba(0,0,0,0.2);
  }

  .quiz-panel {
    display: none;
  }

  .quiz-main {
    padding: var(--s6);
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-6,
  .grid-5,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-body,
  .admin-body {
    padding: var(--s4);
  }
}

@media (max-width: 480px) {

  .grid-6,
  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile Navigation Utilities ────────────────────────── */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .paktik-mobile-nav-toggle {
    display: flex !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .desktop-only {
    display: none !important;
  }
}

/* ── Quiz Mobile Navigator Overlay ───────────────────────── */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-overlay.active {
  transform: translateX(0);
}

.mobile-nav-header {
  height: 56px;
  padding: 0 var(--s6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.mobile-nav-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--s6);
}

.mobile-nav-footer {
  padding: var(--s6);
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

/* ── Result Page Enhancements ──────────────────────────────── */
.result-header-card {
  text-align: center;
  padding: var(--s10) var(--s6);
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.result-score-large {
  font-size: 56px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin: var(--s4) 0 var(--s2);
}

.result-score-large span {
  font-size: 24px;
  color: var(--muted);
  font-weight: 600;
}

.result-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s4);
  margin-top: var(--s6);
}

.result-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s4);
  transition: transform var(--t-fast);
}

.result-stat-card:hover {
  transform: translateY(-2px);
}

.result-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-mapping-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-start;
  padding: var(--s6);
  background: var(--bg2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  max-height: 320px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.mapping-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}

.mapping-dot.hidden {
  display: none !important;
}

.mapping-dot.highlight {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px var(--primary);
  z-index: 5;
}

.mapping-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid transparent;
}

.mapping-dot.correct {
  background: var(--success);
}

.mapping-dot.wrong {
  background: var(--danger);
}

.mapping-dot.skipped {
  background: var(--muted);
  opacity: 0.5;
}

.analysis-container {
  max-height: 800px;
  overflow-y: auto;
  padding-right: var(--s4);
  margin-top: var(--s8);
}

.analysis-container::-webkit-scrollbar {
  width: 6px;
}

.analysis-container::-webkit-scrollbar-track {
  background: transparent;
}

.analysis-container::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 10px;
}

.analysis-container::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.analysis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s6);
  margin-bottom: var(--s6);
}

.analysis-option {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  margin-top: var(--s2);
  font-size: 13px;
  color: var(--text2);
}

.analysis-option.selected-wrong {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.analysis-option.correct-highlight {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.load-more-btn {
  width: 100%;
  margin: var(--s6) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
}

@media (max-width: 640px) {
  .result-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-score-large {
    font-size: 42px;
  }
}

/* ── 18. VERIFICATION CODE INPUTS ────────────────────────────── */
.verification-code-container {
  display: flex;
  gap: var(--s3);
  justify-content: center;
  margin: var(--s8) 0;
}

.verification-input {
  width: 50px;
  height: 64px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: all var(--t-fast);
  font-family: var(--mono);
}

.verification-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
  transform: translateY(-2px);
}

.verification-input.filled {
  border-color: var(--primary);
  background: var(--primary-light);
}

@media (max-width: 480px) {
  .verification-input {
    width: 42px;
    height: 56px;
    font-size: 20px;
  }

  .verification-code-container {
    gap: var(--s2);
  }
}
/* -- Mobile Navigation Component ----------------------- */
.mobile-topbar {
  display: none;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s4);
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.stat-grid-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s4);
}

@media (max-width: 768px) {
  .stat-grid-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -- Responsive Utilities ----------------------- */
.grid { display: grid; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (min-width: 769px) {
  .md\:flex-row { flex-direction: row; }
  .md\:items-center { align-items: center; }
  .md\:justify-start { justify-content: flex-start; }
  .md\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:grid-5 { grid-template-columns: repeat(5, 1fr); }
  .md\:grid-6 { grid-template-columns: repeat(6, 1fr); }
}

.gap-5 { gap: var(--s5); }

.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* ── 28. NOTIFICATIONS ─────────────────────────────────────── */
.notification-bell-wrapper {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

/* ── 28b. THEME TOGGLE BUTTON ───────────────────────────────── */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text2);
  border-radius: var(--r-md);
  transition: background 0.15s, color 0.15s;
}
.theme-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* ── 28c. STICKY SAVE BAR ───────────────────────────────────── */
.sticky-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  margin: 0 -1px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}
.sticky-save-bar .btn {
  min-width: 180px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sticky-save-bar .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.sticky-save-bar .btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: none; /* Hidden by default, shown via JS */
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.paktik-modal {
  border-radius: var(--r-xl) !important;
  border: 1px solid var(--border) !important;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── 29. VOICE NOTE — CHAT RECORDING UI ────────────────────── */

/* Recording toolbar state */
.chat-recording-ui {
  display: none;
  align-items: center;
  gap: var(--s3);
  flex: 1;
  padding: var(--s2) var(--s3);
  background: var(--danger-light);
  border: 1.5px solid var(--danger);
  border-radius: var(--r-md);
  min-height: 42px;
}
.chat-recording-ui.active {
  display: flex;
}

/* Pulsing mic indicator */
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--danger);
  flex-shrink: 0;
  animation: recPulse 1.2s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Paused state: no pulse */
.chat-recording-ui.paused .rec-dot {
  animation: none;
  opacity: 0.4;
}
.chat-recording-ui.paused .rec-timer {
  opacity: 0.5;
}

/* Waveform bars */
.rec-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
}
.rec-waveform span {
  display: block;
  width: 3px;
  border-radius: var(--r-full);
  background: var(--danger);
  animation: wave 0.8s ease-in-out infinite alternate;
}
.rec-waveform span:nth-child(1) { height: 6px;  animation-delay: 0.0s; }
.rec-waveform span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.rec-waveform span:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.rec-waveform span:nth-child(4) { height: 12px; animation-delay: 0.15s; }
.rec-waveform span:nth-child(5) { height: 18px; animation-delay: 0.05s; }
.rec-waveform span:nth-child(6) { height: 8px;  animation-delay: 0.25s; }
.rec-waveform span:nth-child(7) { height: 16px; animation-delay: 0.1s; }

@keyframes wave {
  from { transform: scaleY(0.5); opacity: 0.6; }
  to   { transform: scaleY(1);   opacity: 1;   }
}
.chat-recording-ui.paused .rec-waveform span {
  animation: none;
  opacity: 0.3;
  height: 6px !important;
}

/* Timer */
.rec-timer {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: auto;
}

/* Voice note bubble inside chat message */
.voice-note-player {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  min-width: 200px;
  max-width: 280px;
}
.voice-note-player audio {
  display: none; /* Hidden native audio, controlled via JS */
}
.voice-note-play-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
  background: rgba(255,255,255,0.25);
  color: inherit;
}
.voice-note-play-btn:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.05);
}
.voice-note-waveform-track {
  flex: 1;
  height: 28px;
  position: relative;
  cursor: pointer;
}
.voice-note-waveform-bg {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}
.voice-note-waveform-bg span {
  display: block;
  width: 3px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.35);
  transition: background var(--t-fast);
}
.voice-note-waveform-bg span.played {
  background: rgba(255,255,255,0.9);
}
.voice-note-duration {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0.75;
}

/* Incoming voice note (on var(--surface3) bubble) */
.message-bubble-container:not(.is-me) .voice-note-play-btn {
  background: var(--primary-light);
  color: var(--primary);
}
.message-bubble-container:not(.is-me) .voice-note-play-btn:hover {
  background: var(--primary-mid);
}
.message-bubble-container:not(.is-me) .voice-note-waveform-bg span {
  background: var(--border2);
}
.message-bubble-container:not(.is-me) .voice-note-waveform-bg span.played {
  background: var(--primary);
}
.message-bubble-container:not(.is-me) .voice-note-duration {
  color: var(--muted);
}

/* Mic button in toolbar */
.btn-mic {
  height: 42px;
  width: 42px;
  padding: 0;
  border-radius: var(--r-md);
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.btn-mic:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.btn-mic.recording {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

/* Responsive: stack toolbar on very small screens */
@media (max-width: 480px) {
  .chat-input-toolbar {
    flex-wrap: wrap;
    gap: var(--s2);
  }
  .chat-input-toolbar .form-textarea {
    min-width: 0;
  }
  .voice-note-player {
    min-width: 160px;
  }
}

/* ── 16. AUTH & SECURITY IMPROVEMENTS ───────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--s6);
  background: var(--bg2);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s8);
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin-bottom: var(--s2);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-bottom: var(--s8);
  line-height: 1.5;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--s8);
}

.auth-logo .logo {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-logo .tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-top: var(--s1);
}

.auth-divider {
  text-align: center;
  margin-top: var(--s8);
  font-size: 14px;
  color: var(--muted);
}

/* OTP Input Styles (Glassmorphism) */
.otp-container {
  display: flex;
  gap: var(--s4);
  justify-content: center;
  margin: var(--s8) 0;
}

.otp-input {
  width: 60px !important;
  height: 72px !important;
  text-align: center !important;
  font-size: 32px !important;
  font-weight: 800 !important;
  background: var(--bg) !important;
  border: 2px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  color: var(--text) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="dark"] .otp-input {
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(8px) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.otp-input:focus {
  border-color: var(--primary) !important;
  background: var(--surface) !important;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 20px 25px -5px rgba(224, 78, 34, 0.2), 0 10px 10px -6px rgba(224, 78, 34, 0.1) !important;
}

.otp-input:not(:placeholder-shown) {
  border-color: var(--primary);
  background: var(--primary-light) !important;
}

@media (max-width: 480px) {
  .otp-container {
    gap: var(--s2);
  }
  .otp-input {
    width: 50px !important;
    height: 62px !important;
    font-size: 24px !important;
  }
}

/* Password Strength Styles */
.strength-bar {
  background: var(--bg3);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.password-rules {
  background: var(--bg2);
  padding: var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.rule {
  transition: color var(--t-fast);
}

.rule-bullet {
  flex-shrink: 0;
}

/* Error States */
.form-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-light);
}


/* Animation utilities for auth entry */
.fade-in-1 { animation: fadeIn 0.4s ease both 0.1s; }
.fade-in-2 { animation: fadeIn 0.4s ease both 0.2s; }
.fade-in-3 { animation: fadeIn 0.4s ease both 0.3s; }
.fade-in-4 { animation: fadeIn 0.4s ease both 0.4s; }

/* Loader for buttons */
.btn-loader {
  margin-left: var(--s2);
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ═══════════════════════════════════════════════════════════
   SECTION 30 — RESPONSIVE OVERHAUL
   Mobile-first fixes for all admin + user panel pages
   ═══════════════════════════════════════════════════════════ */

/* ── 30a. GLOBAL OVERFLOW PREVENTION ───────────────────────── */
html, body {
  overflow-x: clip;
}
.main-area, .admin-main {
  overflow-x: clip; /* clip prevents horizontal scroll without breaking position: sticky */
}
.page-body {
  width: 100%;
  box-sizing: border-box;
}
.admin-body {
  width: 100%;
  box-sizing: border-box;
}

/* ── 30b. LARGE SCREEN (≥ 1440px) WIDE LAYOUT ──────────────── */
@media (min-width: 1440px) {
  .admin-body {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  .page-body {
    max-width: 1440px;
  }
  .grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* ── 30c. TABLE → CARD STACKING (≤ 640px) ──────────────────── */
/* Works by hiding thead and showing td with data-label pseudo-elements.
   Add data-label="Column Name" to each <td> in the view. */
@media (max-width: 640px) {

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

  .data-table {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .data-table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
  }

  .data-table tbody tr:hover {
    border-color: var(--primary-light);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    text-align: right;
    gap: 8px;
  }

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

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-align: left;
    flex-shrink: 0;
  }

  /* Rows without data-label fall back to normal block */
  .data-table td:not([data-label]) {
    display: block;
    text-align: left;
    border-bottom: none;
    padding: 2px 0;
  }

  .data-table td:not([data-label])::before {
    display: none;
  }
}

/* ── 30d. PAGE HEADER MOBILE ────────────────────────────────── */
@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header > *:last-child {
    width: 100%;
  }

  .page-title {
    font-size: 20px !important;
  }
}

/* ── 30e. FILTER BARS MOBILE ────────────────────────────────── */
@media (max-width: 640px) {
  /* Filter rows with buttons + search */
  .flex.gap-4.mb-6.flex-wrap,
  .flex.gap-3.flex-wrap.mb-5 {
    flex-direction: column;
    align-items: stretch;
  }

  .flex.gap-4.mb-6.flex-wrap > div,
  .flex.gap-4.mb-6.flex-wrap > form {
    width: 100%;
  }

  .flex.gap-4.mb-6.flex-wrap form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .flex.gap-4.mb-6.flex-wrap .form-input,
  .flex.gap-4.mb-6.flex-wrap form input[type="text"],
  .flex.gap-4.mb-6.flex-wrap form input[type="email"] {
    max-width: 100% !important;
    width: 100%;
    flex: 1;
  }

  /* Filter status tabs wrap */
  .flex.gap-2.flex-wrap {
    flex-wrap: wrap;
  }
}

/* ── 30f. STAT CARDS MOBILE ─────────────────────────────────── */
@media (max-width: 480px) {
  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 22px !important;
  }
}

/* ── 30g. CARD PADDING MOBILE ───────────────────────────────── */
@media (max-width: 640px) {
  .card {
    padding: 14px 14px;
  }

  .admin-body,
  .page-body {
    padding: 12px !important;
  }

  .sticky-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 10px 14px;
    margin: 0;
  }

  .sticky-save-bar .btn {
    min-width: 0;
    width: 100%;
  }
}

/* ── 30h. FORM GRIDS MOBILE ─────────────────────────────────── */
@media (max-width: 640px) {
  /* 2-column form grids collapse to 1 */
  .grid.grid-2 {
    grid-template-columns: 1fr !important;
  }
  /* admin settings sections */
  div[class*="grid-2"],
  div[class*="grid-3"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── 30i. LEADERBOARD FILTER COLLAPSE ───────────────────────── */
.lb-category-filters {
  display: block;
}

.lb-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.lb-filter-toggle:hover {
  border-color: var(--primary);
  background: var(--bg3);
}

.lb-filter-toggle svg {
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
  color: var(--muted);
}

.lb-filter-toggle.open svg {
  transform: rotate(180deg);
}

/* Category body: hidden by default on ALL screen sizes */
.lb-category-body {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  animation: fadeIn 0.2s ease both;
}

.lb-category-body.open {
  display: flex;
}

/* ── 30j. ADMIN PAYMENT SETTINGS MOBILE ────────────────────── */
@media (max-width: 640px) {
  /* Payment Accounts card */
  .payment-account-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .payment-account-card .btn-group {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  /* Payment mode flag grid */
  .payment-mode-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── 30k. HORIZONTAL SCROLL PREVENTION ─────────────────────── */
@media (max-width: 768px) {
  /* Stop inline styles with min-width from causing overflow */
  .table-wrap {
    max-width: 100%;
  }

  /* forms inside table-wraps */
  .data-table form {
    display: inline-flex;
    flex-wrap: wrap;
  }

  /* Flex rows that might overflow */
  .flex.items-center.gap-3 {
    flex-wrap: wrap;
  }

  /* Page header rank/level cards on leaderboard */
  .page-header .flex.items-center.gap-3 {
    flex-wrap: nowrap;
  }
}

/* ── 30l. TOPBAR HEIGHT CONSISTENCY ────────────────────────── */
@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 54px;
  }
}

