/* ═══════════════════════════════════════════════════════════════════════════
   Insight CMS — Design System
   Supports: Light/Dark mode, RTL/LTR, Responsive
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables (Light Theme) ────────────────────────────────────────── */
:root {
  --primary:       #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-muted: rgba(99,102,241,0.12);
  --primary-rgb:   99,102,241;

  --bg:        #f0f4ff;
  --surface:   #ffffff;
  --surface-2: #f8faff;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;

  --text:   #000000;
  --text-2: #000000;
  --text-3: #000000;

  --heading: #1e3a5f;

  --success:       #10b981;
  --success-light: #d1fae5;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --warning:       #f59e0b;
  --warning-light: #fef3c7;
  --info:          #3b82f6;
  --info-light:    #dbeafe;

  --sidebar-w: 260px;
  --topbar-h:  64px;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 4px 12px rgba(15,23,42,0.10);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.14);

  --transition: 200ms ease;
  --font-ar:   'Cairo', sans-serif;
  --font-en:   'Inter', sans-serif;
}

/* ── Dark Theme ─────────────────────────────────────────────────────────── */
html.dark {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2130;
  --border:    #30363d;
  --border-2:  #3d4451;

  --text:   #FFFFFF;
  --text-2: #FFFFFF;
  --text-3: #FFFFFF;

  --heading: #00FFFF;

  --primary-light: #2d2f6e;
  --primary-muted: rgba(99,102,241,0.18);

  --success-light: rgba(16,185,129,0.15);
  --danger-light:  rgba(239,68,68,0.15);
  --warning-light: rgba(245,158,11,0.15);
  --info-light:    rgba(59,130,246,0.15);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="en"] body { font-family: var(--font-en); }

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── App Layout ─────────────────────────────────────────────────────────── */
.app-layout {
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.brand-text { display: flex; flex-direction: column; overflow: hidden; }
.brand-name { font-size: .9rem; font-weight: 700; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-ver  { font-size: .7rem; color: var(--text-3); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: .95rem;
  flex-shrink: 0;
}

.nav-item.active .nav-icon { background: var(--primary-muted); }

.sidebar-user {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-muted);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.user-meta { overflow: hidden; }
.user-name { display: block; font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-logout { font-size: .72rem; color: var(--text-3); transition: color var(--transition); }
.user-logout:hover { color: var(--danger); }

/* ── Main Wrapper ───────────────────────────────────────────────────────── */
.main-wrapper {
  margin-inline-start: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}


/* ── Top Bar ────────────────────────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: background var(--transition);
}

.hamburger:hover { background: var(--surface-2); }

.page-heading {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 500;
  transition: all var(--transition);
}

.action-btn:hover { background: var(--primary-muted); color: var(--primary); border-color: var(--primary); }

/* ── Page Body ──────────────────────────────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 28px 24px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--primary); }

.card-body { padding: 20px; }
.card-body.collapsed { max-height: 0; opacity: 0; padding: 0 !important; border-top: none; }
.card-body:not(.collapsed) { max-height: 5000px; opacity: 1; }
.card-arrow.rotated { transform: rotate(0deg) !important; }

/* ── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.primary   { background: var(--primary-muted); color: var(--primary); }
.stat-icon.success   { background: var(--success-light); color: var(--success); }
.stat-icon.warning   { background: var(--warning-light); color: var(--warning); }
.stat-icon.info      { background: var(--info-light);    color: var(--info); }
.stat-icon.danger    { background: var(--danger-light);  color: var(--danger); }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: .78rem; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--heading); line-height: 1; }
.stat-sub   { font-size: .78rem; color: var(--text-3); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Quick Actions ──────────────────────────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.quick-card {
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-weight: 600;
  font-size: .85rem;
  transition: all var(--transition);
  cursor: pointer;
}

.quick-card:hover { background: var(--primary-muted); color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }

.quick-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }

.btn-ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-muted); }

.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; border-radius: 8px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
}

.form-label .required { color: var(--danger); margin-inline-start: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
  background: var(--surface);
}

.form-textarea { resize: vertical; min-height: 90px; }

.form-input[readonly] { opacity: 0.7; cursor: default; }

.form-error { font-size: .76rem; color: var(--danger); display: none; }
.form-group.has-error .form-input { border-color: var(--danger); }
.form-group.has-error .form-error { display: block; }

.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-section-title::after { content:''; flex:1; height:1px; background:var(--border); }

/* ── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}

.table th {
  padding: 11px 14px;
  text-align: start;
  font-size: .76rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-muted); color: var(--heading); }
.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-info    { background: var(--info-light);    color: var(--info); }
.badge-ghost   { background: var(--surface-2);     color: var(--text-3); border: 1px solid var(--border); }

/* ── Search Bar ─────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 12px;
  display: flex;
  align-items: center;
  color: var(--text-3);
  pointer-events: none;
}

.search-input-wrap .form-input { padding-inline-start: 36px; }

.search-types {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.search-type-btn {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 500;
  transition: all var(--transition);
}

.search-type-btn.active,
.search-type-btn:hover {
  background: var(--primary-muted);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Sessions ───────────────────────────────────────────────────────────── */
.session-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 10px;
  transition: box-shadow var(--transition);
}

.session-card:hover { box-shadow: var(--shadow); }

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.session-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.session-actions { display: flex; gap: 6px; }

.session-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .session-body { grid-template-columns: 1fr; } }

.session-field .label { font-size: .74rem; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.session-field .value { font-size: .85rem; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.session-field .value.collapsed { max-height: 0; opacity: 0; margin: 0; }
.session-field .value:not(.collapsed) { max-height: 500px; opacity: 1; }
.session-field .notes-arrow.rotated { transform: rotate(0deg) !important; }

/* ── Pagination of sections (tabs) ───────────────────────────────────────── */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.detail-tab {
  padding: 10px 16px;
  font-size: .87rem;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-inline: none;
}

.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-tab:hover:not(.active) { color: var(--text-2); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info Grid ──────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.info-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.info-label { font-size: .73rem; color: var(--text-3); font-weight: 600; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.info-value { font-size: .92rem; color: var(--text); font-weight: 500; }
.info-value:empty::after { content: '—'; color: var(--text-3); }

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

html.dark .login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  margin: 0 auto 12px;
  box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}

.login-title  { font-size: 1.4rem; font-weight: 800; color: var(--heading); }
.login-sub    { font-size: .85rem; color: var(--text-3); margin-top: 4px; }

.login-alert {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .84rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 16px;
}

.login-theme-toggle {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 300ms ease forwards;
}

.toast.hiding { animation: toastOut 300ms ease forwards; }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: .85rem; font-weight: 700; color: var(--heading); }
.toast-msg   { font-size: .8rem; color: var(--text-3); }

.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--info); }
.toast.warning .toast-icon { color: var(--warning); }

@keyframes toastIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: popIn 250ms ease;
}

@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-icon { font-size: 2.5rem; margin-bottom: 14px; }
.modal-icon.danger  { color: var(--danger); }
.modal-icon.success { color: var(--success); }

.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--heading); margin-bottom: 8px; }
.modal-msg   { font-size: .88rem; color: var(--text-3); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Edit Modal ─────────────────────────────────────────────────────────── */
.big-modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 250ms ease;
}

.big-modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.big-modal-body { padding: 20px; }
.big-modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Logs ───────────────────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 18px;
}

.filter-row .form-group { min-width: 160px; }

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-text { font-size: .92rem; }

/* ── Loading ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sidebar Overlay (mobile) ───────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .main-wrapper { margin-inline-start: 0 !important; }

  .sidebar {
    transform: translateX(-100%);
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.visible { display: block; }
  .hamburger { display: flex; }
}

@media (max-width: 600px) {
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .info-grid  { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .top-bar    { padding: 0 14px; }
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-3); }
.font-bold    { font-weight: 700; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mb-4         { margin-bottom: 16px; }
.mb-6         { margin-bottom: 24px; }
.mt-4         { margin-top: 16px; }
