/* ============================================================
   LONAB MUTRALO — CSS Responsive Mobile-First
   Optimisé : Android (320px+), iPhone (375px+), Tablettes (768px+)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --primary-green: #28a745;
  --light-green: #C9FDD5;
  --accent-red: #ff4d4d;
  --green-dark: #1e7e34;
  --green-hover: #218838;
  --red-dark: #cc0000;
  --red-light: #ffe5e5;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #6c757d;
  --text-muted: #95a5a6;
  --text-white: #ffffff;
  --border-color: #e9ecef;
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.12);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --navbar-height: 56px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* Touch targets minimum 44px (Apple/Google guidelines) */
  --touch-min: 44px;
}

/* ── Reset Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; height: auto; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }

/* ── Scrollbar personnalisée ───────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

/* ============================================================
   LAYOUT DASHBOARD — Mobile First
   ============================================================ */

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
  position: relative;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  z-index: 1100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
  transition: transform var(--transition-normal), width var(--transition-normal);
  overflow: hidden;
}

/* Mobile : sidebar cachée par défaut */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  /* Overlay sombre derrière la sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1090;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }
}

/* Desktop : sidebar visible */
@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-collapsed-width); }
  .sidebar-overlay { display: none !important; }
  .mobile-menu-toggle { display: none !important; }
}

/* Logo sidebar */
.sidebar-logo {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--navbar-height);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary-green), var(--green-dark));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-logo-text { overflow: hidden; transition: opacity var(--transition-normal), width var(--transition-normal); }
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.2; display: block; }
.brand-subtitle { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; display: block; }

/* Navigation */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }

.nav-section { margin-bottom: 18px; }
.nav-section-title {
  padding: 0 16px; margin-bottom: 6px;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  transition: opacity var(--transition-normal);
  white-space: nowrap;
}
.sidebar.collapsed .nav-section-title { opacity: 0; height: 0; margin: 0; overflow: hidden; }

.nav-menu { list-style: none; }
.nav-item { margin-bottom: 1px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  min-height: var(--touch-min);
  white-space: nowrap;
}
.nav-link i {
  width: 20px; font-size: 15px;
  flex-shrink: 0;
  text-align: center;
}
.nav-link-text { flex: 1; overflow: hidden; transition: opacity var(--transition-normal), width var(--transition-normal); }
.sidebar.collapsed .nav-link-text { opacity: 0; width: 0; }
.nav-link:hover { background: var(--light-green); color: var(--primary-green); border-radius: 8px; margin: 0 8px; padding: 11px 8px; }
.nav-link.active { background: var(--light-green); color: var(--primary-green); font-weight: 600; border-radius: 8px; margin: 0 8px; padding: 11px 8px; }
.nav-link.active::before { content:''; position:absolute; left:-8px; top:50%; transform:translateY(-50%); width:3px; height:60%; background:var(--primary-green); border-radius:0 3px 3px 0; }

/* Sidebar footer */
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); flex-shrink: 0; }
.sidebar-toggle {
  width: 100%; padding: 10px;
  background: var(--bg-secondary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-secondary); font-size: 12px;
  transition: all var(--transition-fast);
  min-height: var(--touch-min);
}
.sidebar-toggle:hover { background: var(--light-green); color: var(--primary-green); }
.sidebar-toggle i { font-size: 13px; transition: transform var(--transition-normal); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar-toggle-text { transition: opacity var(--transition-normal); }
.sidebar.collapsed .sidebar-toggle-text { opacity: 0; width: 0; overflow: hidden; }

/* ── BOUTON MENU MOBILE ──────────────────────────────────── */
.mobile-menu-toggle {
  position: fixed;
  top: 8px; left: 10px;
  z-index: 1200;
  width: 40px; height: 40px;
  background: var(--primary-green);
  color: white;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(40,167,69,0.4);
  transition: all var(--transition-fast);
}
.mobile-menu-toggle:hover { background: var(--green-hover); transform: scale(1.05); }

@media (min-width: 992px) { .mobile-menu-toggle { display: none; } }

/* ── CONTENU PRINCIPAL ───────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

@media (min-width: 992px) {
  .main-content { margin-left: var(--sidebar-width); }
  .sidebar.collapsed + .main-content { margin-left: var(--sidebar-collapsed-width); }
}

@media (max-width: 991px) {
  .main-content { margin-left: 0; }
}

/* ── NAVBAR ──────────────────────────────────────────────── */
.navbar {
  height: var(--navbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 999;
}

/* Décalage à gauche sur mobile pour le bouton hamburger */
@media (max-width: 991px) {
  .navbar { padding-left: 58px; }
}

.navbar-search {
  flex: 1;
  max-width: 340px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  transition: all var(--transition-fast);
  min-height: 36px;
}
.navbar-search input:focus { background: white; border-color: var(--primary-green); box-shadow: 0 0 0 3px rgba(40,167,69,0.1); }
.navbar-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }

@media (max-width: 480px) { .navbar-search { display: none; } }

.navbar-right { display: flex; align-items: center; gap: 6px; }

.navbar-icon {
  width: var(--touch-min); height: var(--touch-min);
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.navbar-icon:hover { background: var(--light-green); color: var(--primary-green); }
.navbar-icon i { font-size: 18px; }

.notification-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  background: var(--accent-red);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: white;
  border: 2px solid white;
  padding: 0 3px;
}

.navbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: var(--touch-min);
}
.navbar-user:hover { background: var(--bg-secondary); }
.navbar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-green), var(--green-dark));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.navbar-user-info { display: flex; flex-direction: column; line-height: 1.3; }
.navbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.navbar-user-role { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 600px) { .navbar-user-info { display: none; } }

/* ── PAGE CONTENT ───────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 16px;
}
@media (min-width: 768px) { .page-content { padding: 20px; } }
@media (min-width: 1200px) { .page-content { padding: 24px; } }

/* ── FOOTER ─────────────────────────────────────────────── */
.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.footer-links { display: flex; gap: 14px; }
.footer-link { color: var(--text-muted); transition: color var(--transition-fast); }
.footer-link:hover { color: var(--primary-green); }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  min-height: var(--touch-min);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.btn i { font-size: 12px; }
.btn-primary { background: linear-gradient(135deg, var(--primary-green), #20c997); color: white; box-shadow: 0 2px 8px rgba(40,167,69,0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(40,167,69,0.35); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border-color); }
.btn-secondary:hover { background: #e9ecef; }
.btn-outline { background: white; color: var(--text-secondary); border: 1.5px solid var(--border-color); }
.btn-outline:hover { background: var(--bg-secondary); border-color: #adb5bd; }
.btn-danger { background: linear-gradient(135deg, #dc3545, #c82333); color: white; box-shadow: 0 2px 8px rgba(220,53,69,0.25); }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220,53,69,0.35); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12px; }

/* Export buttons */
.export-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px; font-weight: 600;
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border-color);
  background: white; color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer; white-space: nowrap;
}
.export-btn-pdf { color: #dc3545; }
.export-btn-pdf:hover { background: #dc3545; border-color: #dc3545; color: white; }
.export-btn-excel { color: #28a745; }
.export-btn-excel:hover { background: #28a745; border-color: #28a745; color: white; }

/* Boutons d'action (tableau) */
.action-btn {
  width: var(--touch-min); height: var(--touch-min);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
  background: none;
}
.action-btn i { font-size: 13px; }
.action-btn-view { color: #17a2b8; background: rgba(23,162,184,0.1); }
.action-btn-view:hover { background: #17a2b8; color: white; }
.action-btn-edit { color: #28a745; background: rgba(40,167,69,0.1); }
.action-btn-edit:hover { background: #28a745; color: white; }
.action-btn-delete { color: #dc3545; background: rgba(220,53,69,0.1); }
.action-btn-delete:hover { background: #dc3545; color: white; }

/* ============================================================
   GRILLES DASHBOARD — Mobile First
   ============================================================ */
.db-grid-4,
.db-grid-3,
.db-grid-2,
.db-grid-22,
.db-grid-3k {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .db-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .db-grid-3k { grid-template-columns: repeat(2, 1fr); }
  .db-grid-22 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .db-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .db-grid-3  { grid-template-columns: 2fr 1fr; }
  .db-grid-2  { grid-template-columns: repeat(2, 1fr); }
  .db-grid-22 { grid-template-columns: repeat(2, 1fr); }
  .db-grid-3k { grid-template-columns: repeat(3, 1fr); }
  .db-grid-4  { gap: 14px; }
}

@media (min-width: 1200px) {
  .db-grid-4  { grid-template-columns: repeat(4, 1fr); }
  .db-grid-2  { grid-template-columns: repeat(2, 1fr); }
  .db-grid-3  { grid-template-columns: 2fr 1fr; }
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.as-card, .sc, .kpi, .stat-card {
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  border-left: 4px solid;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: transform .2s, box-shadow .2s;
}
.as-card:hover, .sc:hover, .kpi:hover, .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0,0,0,.11);
}

.as-label, .sc-lbl, .kpi-lbl {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 3px;
}
.as-value, .sc-val, .kpi-val {
  font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text-primary);
}
@media (min-width: 768px) {
  .as-value, .sc-val, .kpi-val { font-size: 26px; }
}
.as-sub, .sc-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.as-icon, .sc-icon, .kpi-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

/* Couleurs stat cards */
.as-green, .sc-green { border-color: #28a745; }
.as-green .as-icon, .sc-green .sc-icon { background: rgba(40,167,69,.12); color: #28a745; }
.as-purple, .sc-purple { border-color: #6f42c1; }
.as-purple .as-icon, .sc-purple .sc-icon { background: rgba(111,66,193,.12); color: #6f42c1; }
.as-blue, .sc-blue { border-color: #17a2b8; }
.as-blue .as-icon, .sc-blue .sc-icon { background: rgba(23,162,184,.12); color: #17a2b8; }
.as-yellow, .sc-yellow { border-color: #ffc107; }
.as-yellow .as-icon, .sc-yellow .sc-icon { background: rgba(255,193,7,.15); color: #e0a800; }
.as-red, .sc-red { border-color: #dc3545; }
.as-red .as-icon, .sc-red .sc-icon { background: rgba(220,53,69,.12); color: #dc3545; }
.as-teal { border-color: #20c997; }
.as-teal .as-icon { background: rgba(32,201,151,.12); color: #20c997; }

/* ============================================================
   EN-TÊTE DES PAGES
   ============================================================ */
.db-header, .db-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.db-header h1, .db-hdr h1 {
  font-size: 18px; font-weight: 800; color: var(--text-primary); margin: 0 0 3px;
}
.db-header p, .db-hdr p { font-size: 12px; color: var(--text-muted); margin: 0; }
@media (min-width: 768px) {
  .db-header h1, .db-hdr h1 { font-size: 22px; }
}
.db-header-right, .db-hdr-r { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   CARTE GRAPHIQUE
   ============================================================ */
.chart-card, .cc {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  overflow: hidden;
}
.chart-card-header, .cc-head {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 6px;
}
.chart-card-title, .cc-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 7px;
}
.chart-card-title i, .cc-title i { color: var(--primary-green); }
.chart-card-body, .cc-body { padding: 14px; }

/* ============================================================
   TABLEAUX — Scroll horizontal sur mobile
   ============================================================ */
.table-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table, .mini-table, .mt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table thead tr, .mini-table thead, .mt thead tr { background: var(--bg-secondary); border-bottom: 2px solid var(--border-color); }
.data-table th, .mini-table thead th, .mt thead th {
  padding: 10px 12px; text-align: left;
  font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.data-table td, .mini-table tbody td, .mt tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
  color: var(--text-secondary);
  vertical-align: middle;
  font-size: 12px;
}
.data-table tbody tr:hover, .mt tbody tr:hover { background: #f8fff8; }
.data-table .col-actions { width: 1%; white-space: nowrap; text-align: center; }

/* Colonnes masquées selon breakpoint */
@media (max-width: 600px) {
  .hide-mobile { display: none !important; }
}
@media (max-width: 900px) {
  .hide-tablet { display: none !important; }
}

/* ============================================================
   PILLS / STATS RAPIDES
   ============================================================ */
.pills-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.stat-pill {
  background: white; border: 2px solid transparent; border-radius: 22px;
  padding: 7px 13px;
  box-shadow: 0 1px 5px rgba(0,0,0,.07);
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: border-color .18s, box-shadow .18s, transform .12s;
  white-space: nowrap;
  min-height: 34px;
}
.stat-pill:hover { box-shadow: 0 3px 10px rgba(0,0,0,.13); transform: translateY(-1px); }
.stat-pill.pill-active { box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pill-lbl { color: var(--text-muted); }

/* ============================================================
   FILTRES
   ============================================================ */
.filter-card {
  background: white; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px; align-items: flex-end;
}
@media (min-width: 480px) { .filter-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px) { .filter-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

.ff label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 4px; letter-spacing: .4px; }
.ff input, .ff select {
  width: 100%; box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--border-color);
  border-radius: 7px; font-size: 13px;
  min-height: var(--touch-min);
}
.ff .ii { position: relative; }
.ff .ii i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; pointer-events: none; }
.ff .ii input { padding-left: 30px; }

.fbtns { display: flex; gap: 8px; align-items: flex-end; }
.fbtns .btn { flex: 1; }

/* ============================================================
   MODAL — Mobile optimisé
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  backdrop-filter: blur(3px);
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.active {
  display: flex; align-items: flex-start; justify-content: center;
}
.modal {
  background: white; border-radius: 12px;
  width: 100%; max-width: 760px;
  margin: 20px auto;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: zoomIn .2s ease;
}
.modal-large { max-width: 920px; }
.modal-small { max-width: 480px; }
@keyframes zoomIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header {
  background: linear-gradient(135deg, #28a745, #20c997);
  padding: 14px 18px;
  border-radius: 12px 12px 0 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 14px; font-weight: 700; color: white; display: flex; align-items: center; gap: 10px; }
.modal-title i { font-size: 14px; background: rgba(255,255,255,.2); color: white; width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3);
  color: white; font-size: 14px;
  min-width: var(--touch-min); min-height: var(--touch-min);
}
.modal-close:hover { background: white; color: #dc3545; }

.modal-body {
  padding: 16px; overflow-y: auto;
  max-height: calc(100dvh - 200px);
  background: #f8f9fa;
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  padding: 12px 16px; background: white;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 12px 12px;
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0; flex-wrap: wrap;
}

@media (max-width: 576px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { margin: 0; border-radius: 16px 16px 0 0; max-height: 90dvh; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* Grille formulaire dans modal */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 576px) { .form-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.form-grid-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 11.5px; font-weight: 600; color: #495057; display: flex; align-items: center; gap: 3px; }
.form-label span { color: #dc3545; }
.form-control {
  width: 100%; padding: 9px 11px;
  font-size: 14px; border: 1.5px solid #dee2e6;
  border-radius: 8px; transition: border-color .2s, box-shadow .2s;
  background: white; color: var(--text-primary);
  min-height: var(--touch-min); box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: #28a745; box-shadow: 0 0 0 3px rgba(40,167,69,.1); }
.form-control::placeholder { color: #adb5bd; font-size: 13px; }
select.form-control { appearance: none; -webkit-appearance: none; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-wrapper {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.pagination-info { font-size: 12px; color: var(--text-muted); }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-btn {
  min-width: var(--touch-min); min-height: var(--touch-min);
  padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-color); border-radius: 6px;
  font-size: 13px; cursor: pointer; transition: all .15s; background: white;
}
.pagination-btn:hover:not(.active):not(:disabled) { background: rgba(40,167,69,.1); border-color: #28a745; color: #28a745; }
.pagination-btn.active { background: #28a745; border-color: #28a745; color: white; }
.pagination-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   TOAST — Position mobile adaptée
   ============================================================ */
#toast-container {
  position: fixed;
  z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  /* Mobile : bas de l'écran centré */
  bottom: 20px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 360px;
  top: auto; right: auto;
}
@media (min-width: 768px) {
  #toast-container {
    top: 18px; right: 18px;
    bottom: auto; left: auto;
    transform: none;
    width: auto; max-width: 340px;
  }
}

/* ============================================================
   PAGE TOPBAR (pages liste)
   ============================================================ */
.page-wrapper { max-width: 1600px; margin: 0 auto; width: 100%; }
.page-topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.page-topbar h1 { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; }
@media (min-width: 768px) { .page-topbar h1 { font-size: 20px; } }
.page-topbar p { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

/* ============================================================
   QR CODE widget (client uniquement)
   ============================================================ */
.qr-wrap {
  background: linear-gradient(135deg, #1a472a 0%, #2d6a4f 100%);
  border-radius: 14px; padding: 20px;
  color: white; text-align: center;
}
.qr-frame {
  width: 160px; height: 160px;
  background: white; border-radius: 12px;
  margin: 12px auto; padding: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
@media (min-width: 480px) { .qr-frame { width: 180px; height: 180px; } }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.timer-display {
  font-size: 28px; font-weight: 900; letter-spacing: 2px;
  margin: 6px 0; font-variant-numeric: tabular-nums;
}
.btn-regen {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.15); color: white;
  border: 1px solid rgba(255,255,255,.4); cursor: pointer; transition: .2s; margin-top: 10px;
  min-height: var(--touch-min);
}
.btn-regen:hover { background: rgba(255,255,255,.28); }
.btn-regen:disabled { opacity: .6; cursor: not-allowed; }

/* ============================================================
   BADGES
   ============================================================ */
.bp, .st-badge, .sb, .rv-st {
  display: inline-block; padding: 3px 10px;
  border-radius: 12px; font-size: 10px; font-weight: 700;
  white-space: nowrap;
}
.bp-actif, .bp-active, .sb-ok, .st-ok, .rv-conf { background: #e8f5e9; color: #28a745; }
.bp-inactif, .bp-inactive, .sb-err, .st-err { background: #ffebee; color: #c62828; }
.sb-warn, .st-warn, .rv-wait { background: #fff3cd; color: #856404; }
.st-info, .rv-done { background: #d1ecf1; color: #0c5460; }

/* Code tag */
.code-tag { font-family: monospace; font-size: 11px; background: var(--light-green); color: var(--primary-green); padding: 2px 7px; border-radius: 4px; }

/* Numéro badge */
.num-badge { font-weight: 700; color: var(--primary-green); }

/* ============================================================
   DROPDOWN NAVBAR
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: white; border: 1px solid #e5e7eb;
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.14);
  min-width: 200px; z-index: 9999; overflow: hidden;
  animation: dropdownIn .15s ease;
}
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; color: #374151;
  text-decoration: none; cursor: pointer; transition: background .12s;
  white-space: nowrap; min-height: var(--touch-min);
}
.dropdown-item:hover { background: #f3f4f6; }
.dropdown-divider { height: 1px; background: #e5e7eb; margin: 4px 0; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.prog-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prog-label { font-size: 12px; color: #495057; min-width: 110px; font-weight: 500; }
.prog-bar { flex: 1; height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.prog-val { font-size: 11px; font-weight: 700; color: var(--text-primary); min-width: 32px; text-align: right; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-st { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.empty-st i { font-size: 32px; opacity: .2; display: block; margin-bottom: 10px; }

/* ============================================================
   RATE CIRCLE (admin)
   ============================================================ */
.rate-circle {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 76px; height: 76px; border-radius: 50%;
  border: 6px solid #28a745;
  font-size: 17px; font-weight: 800; color: #28a745; background: white;
}
.rate-circle small { font-size: 9px; font-weight: 600; color: var(--text-muted); margin-top: 0; }

/* ============================================================
   ACTIVITY ITEMS
   ============================================================ */
.act-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.act-item:last-child { border-bottom: none; }
.act-text { flex: 1; font-size: 12px; color: #495057; line-height: 1.4; min-width: 0; }
.act-time { font-size: 10px; color: #adb5bd; white-space: nowrap; }

/* ============================================================
   AVATAR
   ============================================================ */
.av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--light-green);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary-green); font-size: 11px;
  flex-shrink: 0; overflow: hidden;
}
.av img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   LOGIN — Mobile First
   ============================================================ */
.auth-wrapper {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at top left, #e8f5ee 0%, #f0f4f1 50%, #e8f0ea 100%);
}
.auth-container {
  width: 100%; max-width: 900px;
  background: white; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.12);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .auth-container { grid-template-columns: 1fr 1fr; }
}
.auth-illustration {
  background: linear-gradient(160deg, #1a3a2a 0%, #1e5c3a 50%, #2d7a50 100%);
  padding: 40px 36px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
/* Masquer l'illustration sur mobile petit */
@media (max-width: 767px) { .auth-illustration { display: none; } }

.auth-form-container {
  padding: 32px 28px;
  display: flex; flex-direction: column; justify-content: center;
}
@media (min-width: 480px) { .auth-form-container { padding: 40px 36px; } }
@media (min-width: 768px) { .auth-form-container { padding: 48px 44px; } }

/* Input login touch-friendly */
.auth-form-container .form-control {
  padding: 12px 14px; padding-left: 40px;
  border: 2px solid #e5e7eb; border-radius: 10px;
  font-size: 15px; min-height: 48px;
}
.auth-form-container .form-control:focus { border-color: #2d7a50; box-shadow: 0 0 0 4px rgba(45,122,80,.12); }

.auth-submit {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #1e5c3a, #3a9e6a);
  color: white; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all .3s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(30,92,58,.3);
  min-height: 52px;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(30,92,58,.4); }
.auth-submit:disabled { opacity: .7; cursor: not-allowed; transform: none; }

/* ============================================================
   PROFIL PAGE — Responsive
   ============================================================ */
.profile-header {
  background: linear-gradient(135deg, #28a745, #1e7e34);
  padding: 16px 18px; border-radius: 10px; color: white; margin-bottom: 14px;
}
.profile-header-content { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%; background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #28a745;
  border: 3px solid rgba(255,255,255,.3); flex-shrink: 0;
}
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 768px) { .profile-grid { grid-template-columns: 2fr 1fr; } }
.profile-section {
  background: white; border-radius: 8px;
  padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.profile-field { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid #f0f0f0; gap: 2px; }
@media (min-width: 480px) { .profile-field { flex-direction: row; align-items: center; } }
.profile-field:last-child { border-bottom: none; }
.profile-field-label { min-width: 130px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.profile-field-value { flex: 1; font-size: 13px; color: var(--text-primary); }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.88);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.loading-overlay.active { display: flex; }
.loader { text-align: center; }
.loader .spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(40,167,69,.2);
  border-top-color: #28a745;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { margin-top: 10px; color: var(--text-muted); font-size: 13px; }

/* ============================================================
   UTILITAIRES RESPONSIVE
   ============================================================ */
.w-full { width: 100%; }
.text-center { text-align: center; }
.flex-wrap { flex-wrap: wrap; }

/* Liens rapides (dashboard admin) */
.quick-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick-link {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 12px;
  background: var(--bg-secondary); border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-decoration: none; transition: background .15s;
  min-height: var(--touch-min);
}
.quick-link:hover { background: var(--light-green); color: var(--primary-green); }

/* Top client row */
.tc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.tc-row:last-child { border-bottom: none; }
.tc-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #28a745, #20c997);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 12px; flex-shrink: 0;
}

/* Menu row (gestionnaire) */
.menu-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f5f5f5; }
.menu-row:last-child { border-bottom: none; }
.menu-icon { width: 36px; height: 36px; border-radius: 8px; background: #e8f5e9; display: flex; align-items: center; justify-content: center; color: #28a745; font-size: 15px; flex-shrink: 0; }

/* Scan row */
.scan-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid #f5f5f5; }
.scan-row:last-child { border-bottom: none; }
.scan-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #17a2b8, #6f42c1);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 800; flex-shrink: 0;
}

/* Réservation row */
.rv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f5f5f5; transition: background .15s; }
.rv-row:last-child { border-bottom: none; }
.rv-row:hover { background: #f8fff8; }
.rv-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #28a745, #20c997);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 12px; flex-shrink: 0;
}

/* ============================================================
   SECTION RESTO BADGE
   ============================================================ */
.resto-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: #e8f5e9; border-radius: 20px;
  font-size: 12px; font-weight: 700; color: #155724; border: 1px solid #c3e6cb;
}

/* ============================================================
   DONUT / CLIENT STATS
   ============================================================ */
.client-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 480px) {
  .client-stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .client-stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   PAGE-SPECIFIC : Suppression colonne QR du caissier
   ============================================================ */
/* Le QR code ne s'affiche que dans .client-qr-section */
.caissier-no-qr { display: none !important; }