/* =============================================
   CABINET MÉDICAL PRO - Main Stylesheet
   ============================================= */

:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --primary-light: #e8f0fe;
  --secondary: #00b4d8;
  --accent: #00c896;
  --danger: #e53935;
  --danger-light: #ffebee;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --success: #10b981;
  --success-light: #ecfdf5;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg: #f1f5f9;
  --bg-white: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 6px rgba(0,0,0,.07);
  --shadow-md: 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --sidebar-w: 260px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ar: 'Segoe UI', 'Noto Sans Arabic', Tahoma, sans-serif;
  --transition: 0.2s ease;
}

/* ---- DARK MODE ---- */
body.dark-mode {
  --bg: #0f172a;
  --bg-white: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --border-strong: #475569;
  --primary-light: #1e3a5f;
  --danger-light: #3b1212;
  --warning-light: #2d1f00;
  --success-light: #0d2b1f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow: 0 4px 6px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}
body.dark-mode .topbar { background: #1a2744; border-bottom-color: #334155; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
body.dark-mode .topbar-title { color: #e2e8f0; }
body.dark-mode .topbar-cabinet-name { color: #e2e8f0; }
body.dark-mode .topbar-cabinet-spec { color: #94a3b8; }
body.dark-mode .topbar-menu-btn { color: #94a3b8; }
body.dark-mode #gs-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }
body.dark-mode .btn-icon { border-color: #334155; color: #94a3b8; }
body.dark-mode .btn-icon:hover { background: #334155; }
body.dark-mode .btn-secondary { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark-mode .btn-secondary:hover { background: #334155; }
body.dark-mode .dev-footer-bar { background: #1a2744; border-top-color: #334155; color: #64748b; }
body.dark-mode .dev-footer-tel { color: #60a5fa; }
body.dark-mode thead tr { background: #0f172a; }
body.dark-mode tbody tr:hover { background: rgba(26,115,232,.12); }
body.dark-mode .dash-proverbe-card { background: linear-gradient(135deg, #1e293b, #1e3552); border-color: #334155; }
body.dark-mode .dash-aya-card { background: linear-gradient(135deg, #0d2b1f, #0f3323); border-color: #166534; }
body.dark-mode .dash-arabic-card { background: linear-gradient(135deg, #2d1f00, #3b2900); border-color: #78350f; }
body.dark-mode .modal { background: #1e293b; }
body.dark-mode .modal-header { border-bottom-color: #334155; }
body.dark-mode .modal-footer { border-top-color: #334155; background: #0f172a; }
body.dark-mode .zoom-widget { background: #1e293b; border-color: #334155; }
body.dark-mode .zoom-level-btn { color: #e2e8f0; }
body.dark-mode .zoom-btn { color: #94a3b8; }

/* ---- SKELETON LOADING ---- */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
.skeleton-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.sm { height: 10px; width: 60%; }
.skeleton-line.lg { height: 20px; width: 80%; margin-bottom: 14px; }
.skeleton-circle { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.skeleton-table-row { display: flex; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.skeleton-table-row .skeleton-line { margin: 0; flex: 1; }

/* ---- PATIENT AVATAR INITIALES ---- */
.patient-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff;
  flex-shrink: 0;
  letter-spacing: .5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* ---- TV MODE - Salle d'attente écran TV ---- */
.tv-overlay {
  position: fixed; inset: 0;
  background: #f8fafc;
  z-index: 9000;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
}
.tv-header {
  background: #fff;
  padding: 16px 40px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  flex-shrink: 0;
}
.tv-logo-area { display: flex; align-items: center; gap: 16px; }
.tv-title { font-size: 22px; font-weight: 800; color: #1e293b; }
.tv-subtitle { font-size: 13px; color: #64748b; margin-top: 2px; }
.tv-clock { font-size: 44px; font-weight: 200; color: #1a73e8; font-variant-numeric: tabular-nums; line-height: 1; }
.tv-clock-date { font-size: 13px; color: #94a3b8; text-align: right; margin-top: 3px; }

/* layout 2 colonnes */
.tv-content {
  flex: 1; display: flex; gap: 0; overflow: hidden;
}
.tv-col {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.tv-col-waiting { background: #f8fafc; border-right: 2px solid #e2e8f0; }
.tv-col-consult { background: #eff6ff; }
.tv-col-header {
  padding: 16px 28px 14px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tv-col-title { font-size: 26px; font-weight: 800; color: #1e293b; }
.tv-col-count {
  background: #e2e8f0; color: #475569;
  font-size: 13px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
}
.tv-col-consult .tv-col-header { background: #dbeafe; border-bottom-color: #bfdbfe; }
.tv-col-consult .tv-col-count { background: #1a73e8; color: #fff; }
.tv-col-list { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }

/* cartes patients */
.tv-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px; padding: 18px 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: box-shadow .3s;
}
.tv-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.tv-card.tv-priority { background: #fff5f5; border-color: #fca5a5; }
.tv-card.tv-called {
  background: #eff6ff; border-color: #93c5fd;
  animation: tv-pulse 2.5s ease-in-out infinite;
}
@keyframes tv-pulse {
  0%,100% { box-shadow: 0 2px 8px rgba(26,115,232,.1); }
  50%      { box-shadow: 0 4px 24px rgba(26,115,232,.25); }
}
.tv-num {
  font-size: 48px; font-weight: 900;
  color: #94a3b8; min-width: 66px;
  text-align: center; line-height: 1;
  flex-shrink: 0;
}
.tv-card.tv-priority .tv-num { color: #ef4444; }
.tv-card.tv-called .tv-num { color: #1a73e8; font-size: 38px; }
.tv-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff; flex-shrink: 0;
}
.tv-info-block { flex: 1; min-width: 0; }
.tv-name { font-size: 26px; font-weight: 800; color: #1e293b; line-height: 1.25; word-break: break-word; }
.tv-meta { font-size: 15px; color: #64748b; margin-top: 5px; }
.tv-wait { font-size: 13px; color: #94a3b8; margin-top: 5px; }
.tv-status-badge {
  display: inline-block; padding: 4px 14px;
  border-radius: 20px; font-size: 12px; font-weight: 700; margin-top: 8px;
}
.tv-status-badge.urgent { background: #fee2e2; color: #dc2626; }
.tv-status-badge.appele { background: #dbeafe; color: #1d4ed8; }
.tv-col-empty {
  color: #cbd5e1; font-size: 16px; text-align: center;
  padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.tv-col-empty-icon { font-size: 56px; opacity: .4; }

.tv-footer {
  background: #fff; padding: 10px 40px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tv-footer-info { font-size: 13px; color: #94a3b8; }
.tv-footer-brand { font-size: 12px; color: #cbd5e1; }
.tv-close-btn {
  position: fixed; top: 14px; right: 14px; z-index: 9001;
  background: rgba(0,0,0,.06); border: 1px solid #e2e8f0;
  color: #94a3b8; width: 40px; height: 40px;
  border-radius: 50%; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.tv-close-btn:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
body[dir="rtl"] { font-family: var(--font-ar); }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #dde3ee; border-radius: 8px; }
::-webkit-scrollbar-thumb { background: #7a94c1; border-radius: 8px; border: 2px solid #dde3ee; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: #7a94c1 #dde3ee; }

/* ---- TYPOGRAPHY ---- */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ---- LAYOUT ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(160deg, #0d1b2a 0%, #1a2744 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow: hidden;
}
body[dir="rtl"] .sidebar { left: auto; right: 0; }

.sidebar-header {
  padding: clamp(10px, 1.8vh, 20px) 20px clamp(8px, 1.4vh, 16px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-logo { width: 36px; height: 36px; }
.sidebar-title { font-size: clamp(13px, 1.5vh, 15px); font-weight: 700; color: #fff; }
.sidebar-subtitle { font-size: clamp(10px, 1.1vh, 11px); color: rgba(255,255,255,.5); }

.sidebar-nav { padding: 6px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: rgba(255,255,255,.05); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
.sidebar-section { padding: clamp(3px, 0.6vh, 8px) 16px clamp(2px, 0.4vh, 4px); font-size: clamp(9px, 0.95vh, 10px); text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.35); font-weight: 600; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(5px, 1vh, 10px) 20px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: clamp(12px, 1.35vh, 14px);
  font-weight: 500;
  position: relative;
}
body[dir="rtl"] .nav-item { border-left: none; border-right: 3px solid transparent; }

.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(26,115,232,.25); border-left-color: var(--primary); }
body[dir="rtl"] .nav-item.active { border-left-color: transparent; border-right-color: var(--primary); }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: clamp(13px, 1.5vh, 16px); }

/* Auto-compact: applied by JS when items still overflow after clamp */
.sidebar-xs .sidebar-header   { padding: 8px 20px !important; }
.sidebar-xs .nav-item          { padding: 4px 20px !important; font-size: 11px !important; }
.sidebar-xs .nav-item .nav-icon{ font-size: 13px !important; }
.sidebar-xs .sidebar-section   { padding: 3px 16px 1px !important; font-size: 8.5px !important; }
.sidebar-xs .sidebar-footer    { padding: 6px 20px !important; }
.sidebar-xs .separator         { margin: 3px 16px !important; }

.sidebar-xxs .sidebar-header   { padding: 6px 20px !important; }
.sidebar-xxs .nav-item         { padding: 3px 20px !important; font-size: 10.5px !important; }
.sidebar-xxs .nav-item .nav-icon{ font-size: 12px !important; }
.sidebar-xxs .sidebar-section  { padding: 2px 16px 1px !important; font-size: 8px !important; }
.sidebar-xxs .sidebar-footer   { padding: 5px 20px !important; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
body[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }

.sidebar-footer {
  padding: clamp(8px, 1.4vh, 16px) 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: clamp(10px, 1.1vh, 12px);
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
}
.sidebar-header-profile { cursor: pointer; transition: background var(--transition); }
.sidebar-header-profile:hover { background: rgba(255,255,255,.06); }

/* ---- SIDEBAR RESIZER ---- */
.sidebar-resizer {
  position: absolute;
  top: 0; right: 0;
  width: 6px; height: 100%;
  cursor: col-resize;
  z-index: 200;
  background: transparent;
  transition: background 0.2s;
}
.sidebar-resizer:hover { background: rgba(255,255,255,.15); }
.sidebar-resizer.dragging { background: rgba(26,115,232,.5); }
body[dir="rtl"] .sidebar-resizer { right: auto; left: 0; }
/* ---- SIDEBAR GROUPS ---- */
.nav-group { margin: 1px 0; }

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: clamp(7px,.9vh,10px) 14px clamp(7px,.9vh,10px) 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
  border-radius: 8px;
  margin: 2px 6px;
}
.nav-group-header:hover { background: rgba(255,255,255,.06); }

.nav-group-icon { font-size: clamp(13px,1.4vh,15px); flex-shrink: 0; }
.nav-group-label {
  flex: 1;
  font-size: clamp(9px,.95vh,10.5px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: rgba(255,255,255,.45);
}
.nav-group-chevron {
  font-size: 10px;
  color: rgba(255,255,255,.25);
  transition: transform .22s ease;
  line-height: 1;
}
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }

.nav-group-items {
  max-height: 800px;
  overflow: hidden;
  transition: max-height .28s ease;
  margin-left: 14px;
  border-left: 1px solid rgba(255,255,255,.07);
}
.nav-group.collapsed .nav-group-items { max-height: 0; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: clamp(6px,.85vh,9px) 14px clamp(6px,.85vh,9px) 20px;
  color: rgba(255,255,255,.58);
  cursor: pointer;
  transition: all .15s;
  font-size: clamp(11.5px,1.25vh,13px);
  font-weight: 500;
  border-left: 2px solid transparent;
  margin-left: -1px;
  position: relative;
}
.nav-sub-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  transform: translateY(-50%);
  transition: background .15s;
}
.nav-sub-item:hover { color: #fff; background: rgba(255,255,255,.06); border-left-color: rgba(255,255,255,.15); }
.nav-sub-item:hover::before { background: rgba(255,255,255,.5); }
.nav-sub-item.active { color: #fff; background: rgba(26,115,232,.22); border-left-color: var(--primary); }
.nav-sub-item.active::before { background: var(--primary); box-shadow: 0 0 6px rgba(26,115,232,.6); }
.nav-sub-item .nav-icon { font-size: clamp(12px,1.3vh,14px); width: 16px; text-align: center; flex-shrink: 0; }

body[dir="rtl"] .nav-group-items { margin-left: 0; margin-right: 14px; border-left: none; border-right: 1px solid rgba(255,255,255,.07); }
body[dir="rtl"] .nav-sub-item { border-left: none; border-right: 2px solid transparent; margin-left: 0; margin-right: -1px; padding-left: 14px; padding-right: 20px; }
body[dir="rtl"] .nav-sub-item::before { left: auto; right: 6px; }
body[dir="rtl"] .nav-sub-item.active { border-right-color: var(--primary); }

/* Sidebar xs compact pour les sous-items */
.sidebar-xs .nav-sub-item { padding: 5px 10px 5px 16px !important; font-size: 11px !important; }
.sidebar-xs .nav-group-header { padding: 5px 10px !important; }
.sidebar-xxs .nav-sub-item { padding: 4px 8px 4px 14px !important; font-size: 10.5px !important; }
.sidebar-xxs .nav-group-header { padding: 4px 8px !important; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.45); }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.dev-footer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 10px;
  color: #3b82f6;
  padding: 5px 16px;
  border-top: 1px solid #bfdbfe;
  background: #dbeafe;
  flex-shrink: 0;
}
.dev-footer-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  opacity: .88;
}
.dev-footer-bar strong { color: #1e40af; font-weight: 600; }
.dev-footer-tel { color: #3b82f6; text-decoration: none; }
.dev-footer-tel:hover { color: #1e40af; }
body[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-w); }

/* ---- TOPBAR ---- */
.topbar {
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(59,130,246,.12);
}
.topbar-menu-btn { display: none; background: none; border: none; cursor: pointer; color: #1e40af; font-size: 20px; padding: 4px; }
.topbar-title { font-size: 18px; font-weight: 700; color: #1e40af; flex: 1; }
.topbar-cabinet-info {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  line-height: 1.25;
  pointer-events: all;
  cursor: grab;
  user-select: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.topbar-cabinet-info:hover { background: rgba(59,130,246,.08); }
.topbar-cabinet-info:hover::after {
  content: '⠿';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #93c5fd;
  line-height: 1;
}
.topbar-cabinet-info.dragging { cursor: grabbing; background: rgba(59,130,246,.12); opacity: .9; }
.topbar-cabinet-name { font-size: 20px; font-weight: 800; color: #1e3a8a; white-space: nowrap; }
.topbar-cabinet-spec { font-size: 12px; color: #3b82f6; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 16px;
  position: relative;
}
.btn-icon:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }

/* ---- ZOOM WIDGET ---- */
.zoom-widget {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 6px;
  height: 34px;
}
.zoom-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  line-height: 1;
  padding: 0;
}
.zoom-btn:hover:not(:disabled) { background: var(--primary-light, #dbeafe); color: var(--primary); }
.zoom-btn:disabled { opacity: .35; cursor: default; }
.zoom-auto-btn { font-size: 13px; }
.zoom-level-btn {
  min-width: 42px;
  height: 26px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  border-radius: 4px;
  padding: 0 4px;
  transition: background .15s;
}
.zoom-level-btn:hover { background: var(--primary-light, #dbeafe); color: var(--primary); }
.zoom-level-btn.zoom-small   { color: #dc2626; }
.zoom-level-btn.zoom-optimal { color: #16a34a; }
.zoom-level-btn.zoom-large   { color: #d97706; }

/* Toast zoom */
.zoom-toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(30,40,80,.92);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}
.zoom-toast.zoom-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media print { .zoom-widget { display: none !important; } }

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ── Proverbe du Jour ── */
.dash-daily-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
@media (max-width: 1100px) {
  .dash-daily-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .dash-daily-row { grid-template-columns: 1fr; }
}
.dash-proverbe-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
  border: 1px solid #c3ddf4;
  border-radius: var(--radius);
  padding: 16px 20px;
}
.dash-aya-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #86efac;
}
.dash-proverbe-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.dash-proverbe-body { flex: 1; }
.dash-proverbe-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #4a90d9;
  margin-bottom: 6px;
}
.dash-proverbe-text {
  margin: 0 0 6px 0;
  padding: 0;
  border: none;
  font-size: 16px;
  font-style: italic;
  color: var(--text-main, #1e293b);
  line-height: 1.6;
}
.dash-proverbe-auteur {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.dash-aya-label { color: #16a34a; }
.dash-aya-text  { font-family: 'Amiri', 'Scheherazade New', serif; font-size: 18px; line-height: 1.9; }
.dash-aya-cat   { color: #15803d; }
.dash-arabic-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fcd34d;
}
.dash-arabic-label { color: #b45309; }
.dash-arabic-text  { font-family: 'Amiri', 'Scheherazade New', serif; font-size: 17px; line-height: 1.8; }
.dash-arabic-source { color: #92400e; }

/* ── Dashboard drag-and-drop edit mode ── */
.dash-drag-handle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  border-radius: 6px;
  flex-shrink: 0;
  user-select: none;
  transition: background .15s, color .15s;
}
.dash-drag-handle:hover { background: var(--border); color: var(--text); }
.dash-drag-handle:active { cursor: grabbing; }

/* Poignée visible uniquement en mode édition */
.dash-edit-active .dash-drag-handle { display: flex; }

/* Widget en mode édition : outline dashed */
.dash-edit-active .dash-widget {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius);
  transition: outline-color .2s;
}
.dash-edit-active .dash-widget:hover { outline-color: #f59e0b; }

/* KPI card draggable */
.dash-edit-active .stat-card {
  cursor: grab;
  outline: 1px dashed var(--border);
}
.dash-edit-active .stat-card:active { cursor: grabbing; }

/* Ghost (placeholder pendant le drag) */
.dash-ghost { opacity: .35; background: var(--bg-secondary) !important; }
.dash-ghost-kpi { opacity: .35; background: var(--bg-secondary) !important; outline: 2px dashed var(--primary) !important; }

/* Animation drop */
.dash-chosen { box-shadow: 0 8px 32px rgba(0,0,0,.18) !important; z-index: 999; }

/* Bouton mode édition actif */
.btn-dash-edit-active {
  background: #f59e0b !important;
  color: #fff !important;
  border-color: #f59e0b !important;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.teal { background: #e0f7fa; color: #00838f; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 11px; color: var(--success); font-weight: 600; margin-top: 4px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #128C7E; color: #fff; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
.form-control.error { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---- SEARCH BAR ---- */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.search-bar input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 13px;
  background: var(--bg);
  transition: all var(--transition);
}
.search-bar input:focus { background: var(--bg-white); border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }
body[dir="rtl"] .search-bar input { padding: 9px 38px 9px 12px; }
body[dir="rtl"] .search-bar .search-icon { left: auto; right: 12px; }

/* ---- TABLES ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--bg); }
thead th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; border-bottom: 1px solid var(--border); }
body[dir="rtl"] thead th { text-align: right; }
tbody tr { transition: background var(--transition); border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--primary-light); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 14px; color: var(--text); vertical-align: middle; }
body[dir="rtl"] tbody td { text-align: right; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: var(--success-light); color: #059669; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: #d97706; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--bg); color: var(--text-muted); }
.badge-teal { background: #e0f7fa; color: #00838f; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 900px; }
.modal-sm { max-width: 420px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); transition: color var(--transition); padding: 0 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: #059669; border-left: 4px solid var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #d97706; border-left: 4px solid var(--warning); }
.alert-info { background: var(--primary-light); color: var(--primary); border-left: 4px solid var(--primary); }

/* ---- TOAST ---- */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
body[dir="rtl"] .toast-container { right: auto; left: 20px; }
.toast {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  border-left: 4px solid var(--success);
  animation: slideIn 0.3s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }
.toast-icon { font-size: 18px; }
.toast-msg { flex: 1; }
.toast-close { cursor: pointer; color: var(--text-muted); font-size: 16px; }

/* ---- WAITING ROOM ---- */
.waiting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.waiting-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 16px;
  border: 2px solid var(--border);
  transition: all var(--transition);
  position: relative;
}
.waiting-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.waiting-card.priority { border-color: var(--danger); }
.waiting-card .patient-num {
  position: absolute;
  top: -10px; left: 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.waiting-card.priority .patient-num { background: var(--danger); }
.waiting-name { font-size: 15px; font-weight: 700; margin-top: 8px; }
.waiting-info { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.waiting-time { font-size: 11px; color: var(--text-light); margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.waiting-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }

/* ---- CALENDAR EVENTS ---- */
.fc-event { border-radius: 6px !important; padding: 2px 4px !important; font-size: 12px !important; }
.fc-toolbar-title { font-size: 16px !important; font-weight: 700 !important; }

/* ---- PATIENT FILE COLORS ---- */
.consultation-row.normal { background: var(--success-light); }
.consultation-row.normal:hover { background: #d1fae5; }
.consultation-row.critical { background: var(--danger-light); }
.consultation-row.critical:hover { background: #fee2e2; }

/* ---- CHARTS ---- */
.chart-wrapper { position: relative; height: 280px; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* ---- LOADING ---- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.9);
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading-text { font-size: 14px; color: var(--text-muted); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.page-btn { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); transition: all var(--transition); }
.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- LANG SELECTOR ---- */
.lang-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- LANG SELECT DROPDOWN ---- */
.lang-select {
  padding: 7px 32px 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-width: 150px;
}
.lang-select:hover { border-color: var(--primary); }
.lang-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }

.lang-select-topbar {
  min-width: 140px;
  font-size: 12.5px;
  padding: 5px 28px 5px 10px;
  border-radius: 8px;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2744 50%, #0d47a1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(26,115,232,.15);
  top: -150px; right: -150px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  border-radius: 50%;
  background: rgba(0,180,216,.1);
  bottom: -100px; left: -100px;
}
.login-box {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 52px; }
.login-title { font-size: 22px; font-weight: 800; text-align: center; color: var(--text); margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-brand-top { text-align: center; margin-bottom: 10px; }
.login-logo-abn { width: 230px; max-width: 78%; object-fit: contain; mix-blend-mode: multiply; }
.login-tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}
.login-lang { display: flex; justify-content: center; margin-bottom: 24px; }
.login-lang .lang-select { min-width: 200px; font-size: 14px; padding: 9px 36px 9px 14px; }
.login-footer-text {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.login-abn-logo {
  width: 110px;
  object-fit: contain;
  opacity: .85;
  margin-bottom: 2px;
}
.login-abn-logo-full {
  width: 200px;
  max-width: 70%;
  object-fit: contain;
  margin-bottom: 4px;
}
.login-abn-tel {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: .3px;
}
.login-abn-tel:hover { color: var(--primary); }

/* ── ABN brand – sidebar footer ─────────────────────────────────────────── */
.abn-oneliner {
  font-size: 9px;
  color: rgba(255,255,255,.38);
  text-align: center;
  padding: 6px 8px 0;
  border-top: 1px solid rgba(255,255,255,.07);
  line-height: 1.6;
}
.abn-oneliner strong { color: rgba(255,255,255,.58); font-weight: 600; }
.abn-oneliner-tel {
  color: rgba(255,255,255,.38);
  text-decoration: none;
}
.abn-oneliner-tel:hover { color: rgba(255,255,255,.7); }

/* ---- ORDONNANCE PRINT ---- */
@media print {
  .sidebar, .topbar, .btn, .modal-footer, .no-print { display: none !important; }
  .main-content { margin: 0 !important; }
  .ordonnance-print { font-family: Arial, sans-serif; font-size: 12px; }
  .print-header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; }
  .page-content { padding: 0 !important; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.animate-pulse { animation: pulse 2s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#refresh-btn { font-size: 18px; font-weight: 300; transition: transform .1s; }
#refresh-btn.spinning { animation: spin .6s linear; pointer-events: none; }

/* ---- RESPONSIVE ---- */

/* Grands écrans (> 1280px) — layout par défaut avec sidebar 260px */

/* Écrans moyens : 1100px – 1280px */
@media (max-width: 1280px) {
  :root { --sidebar-w: 230px; }
  .topbar-cabinet-name { font-size: 17px; }
}

/* Écrans compacts : 960px – 1100px */
@media (max-width: 1100px) {
  :root { --sidebar-w: 210px; }
  .topbar-cabinet-info { display: none; }
  .topbar-title { font-size: 15px; }
  #gs-input { width: 200px !important; }
}

/* Petits PC / Electron fenêtre étroite : 768px – 960px */
@media (max-width: 960px) {
  :root { --sidebar-w: 190px; }
  .topbar { padding: 0 14px; gap: 10px; height: 56px; }
  .topbar-title { font-size: 14px; }
  #gs-input { width: 160px !important; }
  #logout-text { display: none; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* Tablettes / très petits PC */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  body[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; margin-right: 0 !important; }
  .topbar-menu-btn { display: flex; }
  .topbar-cabinet-info { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .waiting-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 22px; }
}

/* ---- MISC UTILITIES ---- */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); } .text-danger { color: var(--danger); } .text-success { color: var(--success); }
.fw-bold { font-weight: 700; } .fw-semibold { font-weight: 600; }
.text-center { text-align: center; } .text-end { text-align: right; }
.w-100 { width: 100%; } .h-100 { height: 100%; }
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.position-relative { position: relative; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.separator { height: 1px; background: var(--border); margin: 16px 0; }
.highlight { background: yellow; border-radius: 2px; padding: 0 2px; }
