/*
 * AISAR Brand v1.0 — Qadah module
 * Navy + Teal on Cloud BG. Light only. Flat by default.
 * No gradients · No glassmorphism · No shadows on resting elements
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500&family=Inter:wght@400;500&display=swap');

:root {
  /* Surfaces — AISAR Cloud BG + white */
  --c-bg:           #F8FAFC;   /* page background — Cloud */
  --c-surface:      #FFFFFF;   /* cards */
  --c-surface-2:    #F1F5F9;   /* subtle alt surface */
  --c-surface-3:    #E2E8F0;   /* hover, input fill */

  /* Borders — AISAR */
  --c-border:       #E2E8F0;   /* default border, 0.5px */
  --c-border-2:     #CBD5E1;   /* hover/emphasis */
  --c-border-focus: #14B8A6;   /* focus ring (teal) */

  /* Ink — AISAR navy + slate */
  --c-ink:          #0F2A4A;   /* primary text — Navy */
  --c-ink-2:        #64748B;   /* secondary text */
  --c-ink-3:        #94A3B8;   /* tertiary, hints, meta */

  /* Brand — AISAR Teal accent (replaces coral) */
  --c-coral:        #14B8A6;   /* primary action accent */
  --c-coral-hover:  #0D9488;
  --c-coral-soft:   #CCFBF1;   /* teal 50 — soft backgrounds */
  --c-coral-text:   #0F766E;   /* on coral-soft */

  /* Navy primary — for primary CTAs and headings */
  --c-navy:         #0F2A4A;
  --c-navy-hover:   #1E4A7A;

  /* Teal aliases (alongside coral aliases for clarity) */
  --c-teal:         #14B8A6;
  --c-teal-hover:   #0D9488;
  --c-teal-soft:    #CCFBF1;

  /* Semantic — AISAR status colors */
  --c-success:      #10B981;
  --c-success-soft: #ECFDF5;
  --c-warning:      #F59E0B;
  --c-warning-soft: #FEF3C7;
  --c-danger:       #EF4444;
  --c-danger-soft:  #FEE2E2;
  --c-info:         #3B82F6;
  --c-info-soft:    #DBEAFE;

  /* Radii — AISAR */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  /* Borders */
  --bw: 0.5px;

  /* Shadows — flat by default; subtle on hover, only for focus and modals */
  --sh-focus: 0 0 0 3px rgba(20, 184, 166, 0.15);
  --sh-modal: 0 20px 40px rgba(15, 42, 74, 0.15);
  --sh-card:  0 2px 8px rgba(15, 42, 74, 0.06);

  /* Typography — AISAR uses single Sans family (no serif display) */
  --f-display: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
  --f-body:    'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, sans-serif;
  --f-arabic:  'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Spacing scale — AISAR */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --s-9: 96px; --s-10: 128px;

  /* Transitions — AISAR */
  --t-fast: 100ms ease;
  --t-base: 200ms ease;
  --t-slow: 300ms ease;
}

/* RTL: same font family (single Sans for both), mirror layout */
html[dir="rtl"] body { font-family: var(--f-arabic); }
html[dir="rtl"] .display { font-family: var(--f-arabic); }

/* ============================================================
   GLOBAL RESET + BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-feature-settings: 'ss01', 'cv11', 'tnum';  /* Inter optical features */
}

body {
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* No body background image, no gradient — just warm cream */

a {
  color: var(--c-ink);
  text-decoration: underline;
  text-decoration-color: var(--c-border-2);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--t-fast);
}
a:hover { text-decoration-color: var(--c-coral); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.display, h1.display {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--s-4) 0;
  color: var(--c-ink);
  letter-spacing: -0.01em;
  font-weight: 500;
}

h1 { font-family: var(--f-display); font-weight: 500; font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 24px; font-weight: 500; line-height: 1.3; }
h3 { font-size: 18px; font-weight: 500; line-height: 1.4; }
h4 { font-size: 16px; font-weight: 500; line-height: 1.5; }

p { margin: 0 0 var(--s-4) 0; color: var(--c-ink-2); line-height: 1.65; }

.lead { font-size: 18px; color: var(--c-ink-2); line-height: 1.55; max-width: 60ch; }

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-3);
}

.muted { color: var(--c-ink-2); }
.faint { color: var(--c-ink-3); }

small, .small { font-size: 13px; color: var(--c-ink-2); }

code, kbd, pre {
  font-family: var(--f-mono);
  font-size: 13px;
  background: var(--c-surface-2);
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

/* Containers fill the viewport — no centered narrow column.
   Text readability is preserved on individual elements (`.lead`, `<p>`) via
   max-width: 60ch where appropriate, not on the container itself. */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--s-7);
}
.container-narrow {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}
@media (max-width: 720px) {
  .container { padding: 0 var(--s-4); }
}

/* App shell — sidebar + main.
   With dir="rtl" on <html>, grid auto-flips column order, so the sidebar
   stays on the inline-start in both directions and renders at exactly 240px.
   Do NOT add an html[dir="rtl"] override here — that double-flip caused the
   Phase-10 RTL sidebar-width bug. */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}

.app-sidebar {
  background: var(--c-bg);
  border-inline-end: var(--bw) solid var(--c-border);
  padding: var(--s-5) var(--s-3);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.app-main {
  padding: var(--s-7) var(--s-7);
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.page-header {
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: var(--bw) solid var(--c-border);
}
.page-header h1 { margin: 0 0 var(--s-2) 0; }
.page-header .lead { margin: 0; }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-6);
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--c-ink);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand .mark {
  width: 22px;
  height: 22px;
  background: var(--c-coral);
  border-radius: var(--r-sm);
}
.sidebar-brand .brand-logo {
  height: 22px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}
.auth-form-side .auth-brand .brand-logo {
  height: 24px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.sidebar-section {
  margin-bottom: var(--s-5);
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-3);
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--c-ink-2);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-link:hover {
  background: var(--c-surface-3);
  color: var(--c-ink);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--c-surface-3);
  color: var(--c-ink);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: var(--bw) solid var(--c-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
}
.sidebar-user .avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--c-coral-soft);
  color: var(--c-coral-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.sidebar-user .name { font-size: 13px; color: var(--c-ink); font-weight: 500; }
.sidebar-user .role { font-size: 11px; color: var(--c-ink-3); }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--c-surface);
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.card-flat {
  background: var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

/* No glass class. No shadows on hover. Restraint. */

/* ============================================================
   BUTTONS
   ============================================================ */

/* Single soft button identity — green primary, no harsh borders, rounded.
   The same look applies to .btn / .aisar-btn / .dz-btn-* / .ais-btn-* */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 40px;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow 200ms ease, transform 120ms ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: normal;
  text-transform: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 110, 6, 0.18);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
.btn-accent {
  background: #006e06;
  color: #ffffff;
  border-color: #006e06;
  box-shadow: 0 1px 2px rgba(0, 110, 6, 0.10);
}
.btn-primary:hover,
.btn-accent:hover {
  background: #005303;
  border-color: #005303;
  color: #ffffff;
  box-shadow: 0 6px 18px -6px rgba(0, 110, 6, 0.35);
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: #006e06;
  border-color: rgba(0, 110, 6, 0.22);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: rgba(0, 110, 6, 0.06);
  border-color: #006e06;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--c-ink-2);
  border-color: rgba(0, 0, 0, 0.08);
}
.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--c-ink);
  border-color: rgba(0, 0, 0, 0.16);
  text-decoration: none;
}

.btn-danger {
  background: rgba(186, 26, 26, 0.08);
  color: #ba1a1a;
  border-color: rgba(186, 26, 26, 0.20);
}
.btn-danger:hover {
  background: rgba(186, 26, 26, 0.14);
  border-color: rgba(186, 26, 26, 0.40);
  color: #ba1a1a;
  text-decoration: none;
}

.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; min-height: 48px; font-size: 14px; border-radius: 12px; }

/* ============================================================
   FORMS
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--s-4);
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink);
}
.field .hint {
  font-size: 12px;
  color: var(--c-ink-3);
  margin-top: 2px;
}
.field .error {
  font-size: 12px;
  color: var(--c-danger);
  margin-top: 2px;
}

/* Excludes radio/checkbox via :not — without this, `.field input` blows
   them up to width:100% and breaks any tutor-card / option-card layouts. */
.input,
.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--c-ink);
  background: var(--c-surface);
  border: var(--bw) solid var(--c-border-2);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:hover,
.field input:not([type="radio"]):not([type="checkbox"]):hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--c-ink-3);
}
.input:focus,
.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--c-coral);
  box-shadow: var(--sh-focus);
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%239C9A92' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-inline-end: 36px;
}
html[dir="rtl"] .field select { background-position: left 12px center; }

.field input:disabled, .field textarea:disabled, .field select:disabled,
.input:disabled {
  background: var(--c-surface-3);
  color: var(--c-ink-3);
  cursor: not-allowed;
}
.field input.invalid, .field textarea.invalid, .field select.invalid {
  border-color: var(--c-danger);
}
.field textarea { font-family: var(--f-body); }

/* ============================================================
   FORM CONTROLS — Phase 10 polish
   Custom checkbox / radio / file upload, all RTL-safe.
   ============================================================ */

.checkbox-field, .radio-field {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.checkbox-field input[type="checkbox"],
.radio-field input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--c-border-2);
  background: var(--c-surface);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
  margin-top: 1px;
}
.checkbox-field input[type="checkbox"] { border-radius: 4px; }
.radio-field input[type="radio"] { border-radius: 50%; }
.checkbox-field input[type="checkbox"]:hover,
.radio-field input[type="radio"]:hover { border-color: var(--c-ink-3); }
.checkbox-field input[type="checkbox"]:focus-visible,
.radio-field input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus);
  border-color: var(--c-coral);
}
.checkbox-field input[type="checkbox"]:checked {
  background: var(--c-coral);
  border-color: var(--c-coral);
}
.checkbox-field input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  inset-inline-start: 5px;
  top: 1px;
  width: 5px; height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.radio-field input[type="radio"]:checked {
  background: radial-gradient(circle at center, var(--c-coral) 0 5px, var(--c-surface) 6px 100%);
  border-color: var(--c-coral);
}
.checkbox-field .label-content,
.radio-field .label-content {
  font-size: 14px;
  color: var(--c-ink);
  line-height: 1.5;
}
.checkbox-field .label-content .hint,
.radio-field .label-content .hint {
  display: block;
  font-size: 12px;
  color: var(--c-ink-2);
  margin-top: 2px;
}

/* File upload — drag-and-drop tile.
   Wraps a hidden <input type="file"> inside a <label class="file-field"> */
.file-field {
  display: block;
  cursor: pointer;
}
.file-field input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  border: 0;
}
.file-field-tile {
  border: 1.5px dashed var(--c-border-2);
  border-radius: var(--r-md);
  padding: 24px;
  text-align: center;
  background: var(--c-surface-2);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-field:hover .file-field-tile,
.file-field input[type="file"]:focus-visible + .file-field-tile {
  border-color: var(--c-coral);
  background: var(--c-coral-soft);
}
.file-field-tile .prompt { font-size: 14px; color: var(--c-ink-2); }
.file-field-tile .prompt strong { color: var(--c-coral); font-weight: 500; }
.file-field-tile .hint {
  display: block;
  font-size: 12px;
  color: var(--c-ink-3);
  margin-top: 4px;
}
.file-field-selected {
  margin-top: 8px;
  font-size: 13px;
  color: var(--c-coral);
  display: none;
}
.file-field-selected.has-file { display: block; }

/* Required asterisk */
.field label .required { color: var(--c-danger); margin-inline-start: 2px; }

/* Disabled / loading buttons */
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.is-loading {
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  width: 14px; height: 14px;
  margin-block-start: -7px;
  margin-inline-start: -7px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  color: var(--c-bg);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--r-full);
  border: var(--bw) solid transparent;
}
.badge-neutral  { background: var(--c-surface-3); color: var(--c-ink-2); }
.badge-coral    { background: var(--c-coral-soft); color: var(--c-coral-text); }
.badge-success  { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning  { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger   { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info     { background: var(--c-info-soft); color: var(--c-info); }

/* ============================================================
   STAT CARDS
   ============================================================ */

.stat-card {
  background: var(--c-surface);
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.stat-card .label {
  font-size: 12px;
  color: var(--c-ink-3);
  margin-bottom: var(--s-2);
}
.stat-card .value {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 400;
  color: var(--c-ink);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-card .delta {
  font-size: 12px;
  margin-top: var(--s-2);
}
.stat-card .delta.up { color: var(--c-success); }
.stat-card .delta.down { color: var(--c-danger); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
}

/* ============================================================
   ALERTS / FLASH
   ============================================================ */

.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.5;
  border: var(--bw) solid transparent;
  margin-bottom: var(--s-4);
}
.alert-success { background: var(--c-success-soft); color: var(--c-success); border-color: var(--c-success); border-color: rgba(74, 124, 89, 0.2); }
.alert-warning { background: var(--c-warning-soft); color: var(--c-warning); border-color: rgba(176, 123, 48, 0.2); }
.alert-danger  { background: var(--c-danger-soft); color: var(--c-danger); border-color: rgba(166, 61, 42, 0.2); }
.alert-info    { background: var(--c-info-soft); color: var(--c-info); border-color: rgba(91, 107, 124, 0.2); }

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--c-ink-2);
}
.empty-state h3 { color: var(--c-ink); margin-bottom: var(--s-2); font-family: var(--f-display); font-weight: 500; }
.empty-state p { color: var(--c-ink-2); max-width: 40ch; margin: 0 auto var(--s-5); }

/* Phase 10 Fix 8 — skeleton loaders (no gradient — solid pulse only). */
.skeleton {
  background: var(--c-surface-3);
  border-radius: var(--r-md);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}
.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-line.lg { height: 18px; }
.skeleton-line.short { width: 50%; }
.skeleton-block { height: 96px; }
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ============================================================
   AUTH SPLIT LAYOUT
   ============================================================ */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--c-bg);
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-shell .auth-aside { display: none; }
  .auth-form-side { padding: var(--s-6) var(--s-5); max-width: 520px; }
}

.auth-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-7) var(--s-7);
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.auth-form-side .auth-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--c-ink);
  letter-spacing: -0.02em;
  text-decoration: none;
  margin-bottom: var(--s-7);
}
.auth-form-side .auth-brand .mark {
  width: 24px; height: 24px;
  background: var(--c-coral);
  border-radius: var(--r-sm);
}

.auth-form-side h1 {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-2);
}
.auth-form-side .lead {
  font-size: 15px;
  margin-bottom: var(--s-6);
}

.auth-aside {
  background: var(--c-surface-2);
  border-inline-start: var(--bw) solid var(--c-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-8);
  position: relative;
}
.auth-aside-quote {
  max-width: 420px;
}
.auth-aside-quote blockquote {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--c-ink);
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-4) 0;
}
.auth-aside-quote cite {
  font-style: normal;
  font-size: 13px;
  color: var(--c-ink-3);
}

/* ============================================================
   PUBLIC NAV / FOOTER
   ============================================================ */

.public-nav {
  border-bottom: var(--bw) solid var(--c-border);
  background: var(--c-bg);
}
.public-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--s-4);
  padding-bottom: var(--s-4);
}
.public-nav .nav-links {
  display: flex;
  gap: var(--s-5);
  list-style: none;
  margin: 0;
  padding: 0;
}
.public-nav .nav-links a {
  font-size: 14px;
  color: var(--c-ink-2);
  text-decoration: none;
}
.public-nav .nav-links a:hover { color: var(--c-ink); }

.public-footer {
  margin-top: var(--s-9);
  padding: var(--s-7) 0;
  border-top: var(--bw) solid var(--c-border);
  background: var(--c-bg);
}
.public-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--c-ink-3);
}

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */

.lang-switch {
  display: inline-flex;
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
}
.lang-switch a {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-ink-3);
  text-decoration: none;
  transition: all var(--t-fast);
}
.lang-switch a.active {
  background: var(--c-ink);
  color: var(--c-bg);
}
.lang-switch a:not(.active):hover {
  background: var(--c-surface-3);
  color: var(--c-ink);
}

/* ============================================================
   UTILITIES
   ============================================================
   2026-05-09 — Removed flex / flex-col / items-center / justify-between /
   gap-N / mt-N / mb-N / text-center / w-full. They duplicated Tailwind
   class names but loaded *after* Tailwind in the cascade, so e.g. the
   admin shell's `.md\:flex-row` (in @media min-width:768px) was being
   overridden by this file's unscoped `.flex-col`, leaving the sidebar
   stacked above the content on desktop. Tailwind's content scanner
   already covers qadah-legacy/, so any class still referenced by those
   components is generated from Tailwind's utility set. */

.divider {
  height: var(--bw);
  background: var(--c-border);
  border: 0;
  margin: var(--s-5) 0;
}

/* Tabular figures everywhere numbers appear */
.tabular { font-variant-numeric: tabular-nums; }

/* Print + reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   RESPONSIVE — global scroll + breakpoints
   ============================================================ */

html, body { height: 100%; overflow-x: hidden; }
body { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Comfortable scrollbars across the app — visible but not heavy */
* { scrollbar-width: thin; scrollbar-color: var(--c-border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--c-ink-3); }

/* Tables: wrap any .qd-table OR a raw <table> inside a .card[style="padding:0…"]
   in a horizontal-scroll viewport so they never break the page layout. */
.card > table,
.qd-table-wrap {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Mobile menu state — managed by app.component */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 60;
  background: var(--c-surface-1);
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-md);
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.mobile-menu-toggle svg { width: 20px; height: 20px; color: var(--c-ink); }

.mobile-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 50;
}
.app-shell.is-mobile-open .mobile-backdrop { display: block; }

/* ───── Tablets and smaller (≤ 1024px) ───── */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .app-main { padding: var(--s-6) var(--s-5); }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important; }
  .display, h1.display { font-size: 36px; }
}

/* ───── Phones (≤ 720px) ───── */
@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
    /* Sidebar becomes off-canvas */
  }
  .app-sidebar {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 280px;
    max-width: 85vw;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 55;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  html[dir="rtl"] .app-sidebar { transform: translateX(100%); }
  .app-shell.is-mobile-open .app-sidebar { transform: translateX(0); }

  .mobile-menu-toggle { display: inline-flex; }

  .app-main {
    padding: 64px var(--s-4) var(--s-5);  /* top reserves room for the floating toggle */
  }

  .display, h1.display { font-size: 30px; }
  .lead { font-size: 16px; }
  .page-header { margin-bottom: var(--s-5); padding-bottom: var(--s-4); }

  /* Stack multi-column inline grids on mobile (regardless of class) */
  [style*="grid-template-columns:1.4fr"],
  [style*="grid-template-columns:1.2fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:1.4fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr 1fr"],
  [style*="grid-template-columns:1.4fr 1fr 1fr"],
  [style*="grid-template-columns:repeat(2,1fr)"],
  [style*="grid-template-columns:repeat(2, 1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(3, 1fr)"],
  [style*="grid-template-columns:200px 1fr"],
  [style*="grid-template-columns:160px 1fr"],
  [style*="grid-template-columns:160px 1fr auto"] {
    grid-template-columns: 1fr !important;
  }

  /* Stat grid: 2-up on phones, 1-up on tiny */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: var(--s-3) !important; }

  /* Cards: less padding */
  .card { padding: var(--s-4); }

  /* Tables: hide low-priority cells if data-mobile-hide attribute is used */
  [data-mobile-hide] { display: none; }

  /* Forms: full-width inputs */
  form input, form select, form textarea { width: 100%; box-sizing: border-box; }

  /* Buttons in a row stack to column */
  .flex.gap-3, .flex.gap-4, .flex.gap-5 {
    flex-wrap: wrap;
  }

  /* Definition lists with fixed label columns: stack on mobile */
  dl[style*="grid-template-columns:200px"],
  dl[style*="grid-template-columns:160px"] {
    grid-template-columns: 1fr !important;
    gap: var(--s-1) !important;
  }
  dl[style*="grid-template-columns:200px"] dt,
  dl[style*="grid-template-columns:160px"] dt {
    color: var(--c-ink-3);
    font-size: 12px;
    margin-top: var(--s-2);
  }
}

/* ───── Small phones (≤ 480px) ───── */
@media (max-width: 480px) {
  .app-main { padding: 60px var(--s-3) var(--s-4); }
  .display, h1.display { font-size: 26px; line-height: 1.15; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .stat-card { padding: var(--s-3); }
  .stat-card .value { font-size: 28px; }
  .card { padding: var(--s-3); border-radius: var(--r-md); }
  .btn { font-size: 14px; }
  .btn-lg { font-size: 15px; padding: 12px 20px; }
  .qd-table { font-size: 13px; }
  .qd-table th, .qd-table td { padding: 10px 12px; }
}

/* ───── Session player phone overrides ───── */
@media (max-width: 720px) {
  .session-top { padding: var(--s-3) var(--s-3); flex-wrap: wrap; gap: var(--s-2); }
  .session-top h3 { font-size: 13px; }
  .slide-stage { padding: var(--s-3); height: calc(100dvh - 60px - 80px); }
  .slide-frame, #slide-frame { aspect-ratio: 4/3; }
  .sara-tile { width: 140px; padding: var(--s-2); bottom: var(--s-2); inset-inline-end: var(--s-2); }
  .sara-tile video { aspect-ratio: 1/1; }
  .session-bottom { gap: var(--s-2); padding: var(--s-2) var(--s-3); }
  .secondary-action { width: 36px; height: 36px; font-size: 14px; }
  .mic-indicator { padding: 4px var(--s-2); font-size: 11px; }
  .mic-indicator-hint { display: none; }
  .text-input-bar { padding: var(--s-2) var(--s-3); }
  .transcript-drawer { max-height: 60dvh; }
}

/* ───── Auth shell: already collapses at 880px (existing rule) ───── */

/* ───── Print (course material PDF) ───── */
@media print {
  .app-sidebar, .mobile-menu-toggle, .mobile-backdrop, .session-top, .session-bottom, .sara-tile { display: none !important; }
  .app-shell { grid-template-columns: 1fr !important; }
  .app-main { padding: 0 !important; }
}
