/* ============================================================
   GestionApp 212 — Styles v7.0 PREMIUM
   Design moderne 2025 : gradient sidebar, glassmorphism,
   micro-animations, topbar élégante, KPI cards premium
   ============================================================ */

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

/* ══════════════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Sidebar gradient premium ── */
  --sb-bg:          #0f172a;
  --sb-bg-2:        #1e293b;
  --sb-hover:       rgba(148,163,184,.08);
  --sb-active-bg:   rgba(99,179,237,.12);
  --sb-active-border: #3b82f6;
  --sb-text:        rgba(203,213,225,.85);
  --sb-muted:       rgba(148,163,184,.5);
  --sb-width:       240px;

  /* ── Accent / Brand ── */
  --accent:         #3b82f6;
  --accent-dark:    #1d4ed8;
  --accent-light:   #eff6ff;
  --accent-glow:    rgba(59,130,246,.25);

  /* ── Palette ── */
  --blue:           #3b82f6;
  --blue-light:     #eff6ff;
  --green:          #10b981;
  --green-light:    #ecfdf5;
  --orange:         #f59e0b;
  --orange-light:   #fffbeb;
  --red:            #ef4444;
  --red-light:      #fef2f2;
  --purple:         #8b5cf6;
  --purple-light:   #f5f3ff;
  --cyan:           #06b6d4;
  --cyan-light:     #ecfeff;
  --pink:           #ec4899;
  --pink-light:     #fdf2f8;
  --teal:           #14b8a6;

  /* ── Background ── */
  --bg-app:         #f1f5f9;
  --bg-card:        #ffffff;
  --bg-card-hover:  #fafbff;

  /* ── Topbar ── */
  --topbar-bg:      rgba(255,255,255,.95);
  --topbar-h:       62px;
  --topbar-blur:    saturate(180%) blur(12px);

  /* ── Textes ── */
  --text:           #0f172a;
  --text-2:         #334155;
  --text-3:         #64748b;
  --text-4:         #94a3b8;

  /* ── Bordures ── */
  --border:         #e2e8f0;
  --border-2:       #f1f5f9;

  /* ── Ombres premium ── */
  --shadow-xs:  0 1px 2px rgba(15,23,42,.04);
  --shadow-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:     0 4px 16px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.04);
  --shadow-md:  0 8px 28px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg:  0 20px 60px rgba(15,23,42,.14), 0 4px 12px rgba(15,23,42,.06);
  --shadow-blue: 0 4px 20px rgba(59,130,246,.28);

  /* ── Rayons ── */
  --r:     12px;
  --r-sm:   8px;
  --r-xs:   6px;
  --r-lg:  16px;
  --r-xl:  20px;

  --transition: .18s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-app);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body[dir="rtl"] { font-family: 'Cairo', sans-serif; }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes fadeIn    { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp   { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastIn   { from { opacity:0; transform:translateX(110%) scale(.95); } to { opacity:1; transform:translateX(0) scale(1); } }
@keyframes modalIn   { from { opacity:0; transform:scale(.96) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
@keyframes pulse     { 0%,100% { opacity:1; } 50% { opacity:.5; } }
@keyframes shimmer   { 0% { background-position:-200% 0; } 100% { background-position:200% 0; } }
@keyframes countUp   { from { transform:translateY(8px); opacity:0; } to { transform:translateY(0); opacity:1; } }

/* ══════════════════════════════════════════════════════════
   LOADERS
══════════════════════════════════════════════════════════ */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(59,130,246,.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
.loading-screen {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  min-height: 220px; color: var(--text-3); font-size: 13px;
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════ */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR PREMIUM
══════════════════════════════════════════════════════════ */
#sidebar {
  width: var(--sb-width);
  min-width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width .24s cubic-bezier(.4,0,.2,1),
              min-width .24s cubic-bezier(.4,0,.2,1);
  z-index: 100;
  flex-shrink: 0;
  position: relative;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  /* Subtle gradient */
  background-image: linear-gradient(180deg, #0f172a 0%, #1a2744 100%);
}

/* Collapsed */
#sidebar.collapsed { width: 62px; min-width: 62px; }
#sidebar.collapsed .brand-text,
#sidebar.collapsed .nav-section-title,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .badge-sa,
#sidebar.collapsed .user-info,
#sidebar.collapsed .logout-btn,
#sidebar.collapsed .sidebar-close-btn,
#sidebar.collapsed #company-selector,
#sidebar.collapsed #company-selector-display,
#sidebar.collapsed #favorites-bar       { display: none !important; }
#sidebar.collapsed .nav-item            { justify-content: center; padding: 11px 8px; }
#sidebar.collapsed .sidebar-brand       { justify-content: center; }
#sidebar.collapsed .sidebar-header      { justify-content: center; padding: 14px 8px; }
#sidebar.collapsed .user-card           { justify-content: center; }

/* ── Header sidebar ── */
.sidebar-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}
.brand-text  { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name  { color: #fff; font-size: 13.5px; font-weight: 700; letter-spacing: -.2px; }
.brand-version { color: var(--sb-muted); font-size: 10px; font-weight: 500; }
.sidebar-close-btn {
  background: none; border: none;
  color: var(--sb-muted); cursor: pointer;
  padding: 4px 6px; border-radius: 5px; font-size: 13px;
  transition: color var(--transition);
}
.sidebar-close-btn:hover { color: #fff; }

/* ── Bloc société ── */
.company-select-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 9px; cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  margin: 10px 12px;
}
.company-select-btn:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.12);
}
.company-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(59,130,246,.3);
}
.company-info { flex: 1; min-width: 0; }
.company-name { color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-role { color: var(--sb-muted); font-size: 10px; font-weight: 500; }
.company-chevron { color: var(--sb-muted); font-size: 9px; flex-shrink: 0; }

/* ── Nav sections ── */
.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.07) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.nav-section-title {
  padding: 14px 16px 4px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--sb-muted);
}

/* ── Nav items ── */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  color: var(--sb-text); cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 13px; font-weight: 450;
  text-decoration: none; user-select: none;
  border-radius: 8px; margin: 1px 8px;
  position: relative;
}
.nav-item i {
  width: 17px; text-align: center; font-size: 13px; flex-shrink: 0;
  color: var(--sb-muted); transition: color var(--transition);
}
.nav-item:hover {
  background: var(--sb-hover);
  color: #fff;
}
.nav-item:hover i { color: rgba(255,255,255,.75); }

.nav-item.active {
  background: rgba(59,130,246,.14);
  color: #60a5fa;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: linear-gradient(180deg, #3b82f6, #818cf8);
  border-radius: 0 3px 3px 0;
}
.nav-item.active i { color: #60a5fa; }
.nav-label { flex: 1; }

/* Badge SA */
.badge-sa {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff; font-size: 7.5px; font-weight: 800;
  padding: 2px 5px; border-radius: 4px; margin-left: 2px;
  letter-spacing: .3px;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 12px; flex-shrink: 0;
}
.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 6px; border-radius: 8px;
  cursor: pointer; transition: background var(--transition);
}
.user-card:hover { background: var(--sb-hover); }
.user-avatar {
  width: 33px; height: 33px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(245,158,11,.3);
}
.user-info { flex: 1; min-width: 0; }
.user-name  { color: #f1f5f9; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { color: var(--sb-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  background: none; border: none; color: var(--sb-muted);
  cursor: pointer; padding: 5px; border-radius: 6px; font-size: 13px;
  transition: color var(--transition), background var(--transition); flex-shrink: 0;
}
.logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,.12); }

/* Favoris */
.fav-bar-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--sb-muted); padding: 0 2px 5px;
}
.fav-item {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; background: rgba(255,255,255,.05);
  border-radius: 5px; cursor: pointer; color: rgba(203,213,225,.65);
  font-size: 10px; margin-bottom: 3px;
  transition: background var(--transition), color var(--transition);
}
.fav-item:hover { background: rgba(255,255,255,.10); color: #fff; }

/* ══════════════════════════════════════════════════════════
   TOPBAR PREMIUM
══════════════════════════════════════════════════════════ */
#main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

#topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  backdrop-filter: var(--topbar-blur);
  -webkit-backdrop-filter: var(--topbar-blur);
  border-bottom: 1px solid rgba(226,232,240,.8);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 2px 8px rgba(15,23,42,.04);
  z-index: 50;
  position: sticky; top: 0;
}
.topbar-left  { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.menu-btn {
  background: none; border: none; color: var(--text-3);
  font-size: 16px; cursor: pointer; padding: 7px 8px;
  border-radius: var(--r-sm);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}
.menu-btn:hover { background: var(--border-2); color: var(--text); }

/* Breadcrumb */
.breadcrumb-nav {
  font-size: 14px; color: var(--text-2); font-weight: 500;
}
.breadcrumb-nav i { color: var(--blue); margin-right: 5px; }

/* Boutons topbar */
.topbar-btn {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-3); font-size: 13px; cursor: pointer;
  padding: 6px 10px; border-radius: var(--r-sm);
  transition: all var(--transition); position: relative;
  line-height: 1; font-family: inherit;
}
.topbar-btn:hover { background: var(--border-2); color: var(--text); border-color: #cbd5e0; }

/* Notifications */
.notif-wrapper { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff;
  font-size: 8.5px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: pulse 2s ease infinite;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); z-index: 1000; overflow: hidden;
  animation: slideDown .18s cubic-bezier(.4,0,.2,1);
}
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
}
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 18px; border-bottom: 1px solid var(--border-2);
  cursor: pointer; transition: background var(--transition);
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f0f9ff; }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; }
.notif-text  { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.notif-time  { font-size: 10px; color: var(--text-4); margin-top: 3px; }

/* Société badge topbar */
.topbar-company {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  background: #fff;
  font-size: 13px; font-weight: 600;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.topbar-company:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-glow); }
.dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; box-shadow: 0 0 0 3px rgba(16,185,129,.2); }

/* User topbar */
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--transition);
}
.topbar-user:hover { background: var(--border-2); }
.topbar-avatar {
  width: 31px; height: 31px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(245,158,11,.3);
}
.topbar-username { font-size: 13px; font-weight: 600; color: var(--text); }

/* ══════════════════════════════════════════════════════════
   PAGE CONTENT
══════════════════════════════════════════════════════════ */
#page-content {
  flex: 1; overflow-y: auto; padding: 28px;
  background: var(--bg-app);
  animation: fadeIn .22s ease;
}

.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px; flex-wrap: wrap; gap: 12px;
}
.page-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -.4px;
}
.page-title i { color: var(--blue); font-size: 20px; }
.page-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 3px; font-weight: 400; }
.page-actions  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════
   BOUTONS PREMIUM
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border: none; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
  white-space: nowrap; font-family: inherit; line-height: 1.4;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,.08); }
.btn:active { transform: scale(.98); }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(59,130,246,.45); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn-success:hover { box-shadow: 0 4px 14px rgba(16,185,129,.4); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,.3);
}
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239,68,68,.4); transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.btn-warning:hover { box-shadow: 0 4px 14px rgba(245,158,11,.4); transform: translateY(-1px); }

.btn-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139,92,246,.3);
}
.btn-purple:hover { box-shadow: 0 4px 14px rgba(139,92,246,.4); transform: translateY(-1px); }

.btn-ghost {
  background: transparent; color: var(--text-3);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--border-2); color: var(--text); border-color: #cbd5e0; }

.btn-secondary {
  background: #f1f5f9; color: var(--text-2);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: #e2e8f0; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ══════════════════════════════════════════════════════════
   KPI CARDS PREMIUM
══════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px; margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid rgba(226,232,240,.7);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity var(--transition);
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(59,130,246,.2);
}
.kpi-card:hover::before { opacity: 1; }

/* Indicateur tendance */
.kpi-trend {
  position: absolute; top: 16px; right: 16px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; gap: 3px;
  padding: 3px 7px; border-radius: 20px;
}
.kpi-trend.up   { color: #059669; background: #ecfdf5; }
.kpi-trend.down { color: #dc2626; background: #fef2f2; }
.kpi-trend.warn { color: #d97706; background: #fffbeb; }

.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
  transition: transform var(--transition);
}
.kpi-card:hover .kpi-icon { transform: scale(1.08); }
.kpi-value {
  font-size: 26px; font-weight: 800; color: var(--text);
  line-height: 1.1; margin-bottom: 4px;
  letter-spacing: -.5px;
  animation: countUp .35s ease;
}
.kpi-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.kpi-sub   { font-size: 11px; color: var(--text-4); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════
   CARTES GÉNÉRALES PREMIUM
══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid rgba(226,232,240,.7);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.card-body   { padding: 20px; }
.card-footer {
  padding: 13px 20px; border-top: 1px solid var(--border);
  background: #fafbff;
}

/* ══════════════════════════════════════════════════════════
   TABLEAUX PREMIUM
══════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid rgba(226,232,240,.7);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: linear-gradient(180deg, #f8fafc, #f1f5f9); }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-2);
  transition: background var(--transition);
}
tbody tr:hover { background: #f8faff; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 16px; vertical-align: middle; }

/* ══════════════════════════════════════════════════════════
   BADGES PREMIUM
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-blue    { background: #eff6ff; color: #1d4ed8; }
.badge-green   { background: #ecfdf5; color: #065f46; }
.badge-red     { background: #fef2f2; color: #991b1b; }
.badge-orange  { background: #fffbeb; color: #92400e; }
.badge-purple  { background: #f5f3ff; color: #5b21b6; }
.badge-gray    { background: #f8fafc; color: #475569; }
.badge-cyan    { background: #ecfeff; color: #164e63; }
.badge-yellow  { background: #fefce8; color: #713f12; }
.badge-success  { background: #ecfdf5; color: #065f46; }
.badge-danger   { background: #fef2f2; color: #991b1b; }
.badge-warning  { background: #fffbeb; color: #92400e; }
.badge-info     { background: #eff6ff; color: #1d4ed8; }
.badge-primary  { background: #eff6ff; color: #1d4ed8; }
.badge-secondary{ background: #f8fafc; color: #475569; }

/* ══════════════════════════════════════════════════════════
   FORMULAIRES PREMIUM
══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
  letter-spacing: .1px;
}
.form-label.required::after { content: ' *'; color: var(--red); }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text); background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none; font-family: inherit;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: #fafcff;
}
.form-control:hover:not(:focus) { border-color: #cbd5e0; }
.form-control::placeholder { color: var(--text-4); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 85px; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* ══════════════════════════════════════════════════════════
   FILTRES
══════════════════════════════════════════════════════════ */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.search-box { position: relative; }
.search-box input {
  padding: 8.5px 13px 8.5px 35px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--r-sm); font-size: 13px; outline: none;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 240px; font-family: inherit;
}
.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.10);
}
.search-box i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); font-size: 12px; pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   MODALES PREMIUM
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-box {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px; max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid rgba(226,232,240,.5);
}
.modal-box.modal-sm  { max-width: 420px; }
.modal-box.modal-lg  { max-width: 840px; }
.modal-box.modal-xl  { max-width: 1080px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
}
.modal-close {
  background: none; border: none; color: var(--text-4);
  font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
  transition: all var(--transition);
}
.modal-close:hover { color: var(--red); background: var(--red-light); }
.modal-body   { padding: 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 22px; border-top: 1px solid var(--border);
  background: #fafbff;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ══════════════════════════════════════════════════════════
   ONGLETS PREMIUM
══════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 22px; overflow-x: auto; flex-wrap: nowrap;
  gap: 2px;
}
.tab,
.tab-btn {
  padding: 9px 18px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-3);
  cursor: pointer; border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap; font-family: inherit; flex-shrink: 0;
  border-radius: 6px 6px 0 0;
}
.tab:hover, .tab-btn:hover {
  color: var(--text);
  background: rgba(59,130,246,.05);
}
.tab.active, .tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
  background: rgba(59,130,246,.04);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn .18s ease;
}

/* Wrapper onglets Paramètres */
#param-tabs-wrapper .tabs {
  position: sticky; top: 0;
  background: var(--bg-app, #f1f5f9);
  z-index: 10; padding-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   PROGRESS PREMIUM
══════════════════════════════════════════════════════════ */
.progress-outer {
  background: #e2e8f0; border-radius: 6px; height: 7px; overflow: hidden;
}
.progress-inner {
  height: 100%; border-radius: 6px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  background: linear-gradient(90deg, var(--blue), var(--purple));
}

/* ══════════════════════════════════════════════════════════
   ÉTAT VIDE PREMIUM
══════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 70px 24px; }
.empty-state i {
  font-size: 48px; color: #cbd5e0; margin-bottom: 16px; display: block;
  opacity: .7;
}
.empty-state h3 { font-size: 16px; color: var(--text-2); margin-bottom: 7px; font-weight: 600; }
.empty-state p  { font-size: 13px; color: var(--text-4); }

/* ══════════════════════════════════════════════════════════
   PAGINATION PREMIUM
══════════════════════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
  min-width: 33px; height: 33px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: #fff; font-size: 12px; font-weight: 600;
  color: var(--text-3); cursor: pointer;
  transition: all var(--transition); font-family: inherit;
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.page-btn.active {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════
   ALERTES PREMIUM
══════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 18px;
  border-left: 3px solid;
}
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #10b981; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #3b82f6; }

/* ══════════════════════════════════════════════════════════
   TOASTS PREMIUM
══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 22px; right: 22px;
  z-index: 10000; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 18px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  min-width: 280px; max-width: 400px;
  animation: toastIn .28s cubic-bezier(.34,1.56,.64,1);
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.toast-success { background: #064e3b; color: #ecfdf5; border-left: 3px solid #10b981; }
.toast-error   { background: #7f1d1d; color: #fef2f2; border-left: 3px solid #ef4444; }
.toast-warning { background: #78350f; color: #fffbeb; border-left: 3px solid #f59e0b; }
.toast-info    { background: #1e3a5f; color: #eff6ff; border-left: 3px solid #3b82f6; }

/* ══════════════════════════════════════════════════════════
   KANBAN PREMIUM
══════════════════════════════════════════════════════════ */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col {
  min-width: 265px; max-width: 290px; flex-shrink: 0;
  background: #f8fafc;
  border-radius: var(--r-lg);
  border: 1px solid var(--border); display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 12px 15px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 3px solid;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kanban-card {
  background: var(--bg-card);
  border-radius: var(--r-sm);
  padding: 12px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ══════════════════════════════════════════════════════════
   GRILLES UTILITAIRES
══════════════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; }
@media (max-width: 960px)  { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════════════ */
body.dark-mode {
  --bg-app:    #0a0f1a;
  --bg-card:   #111827;
  --bg-card-hover: #1a2234;
  --bg-subtle: #0f1623;   /* fonds d'en-tête/tableaux (était clair par défaut) */
  --topbar-bg: rgba(17,24,39,.95);
  --border:    #1f2937;
  --border-2:  #161d2c;
  --line:      #1f2937;    /* bordures de lignes de tableaux */
  --text:      #f1f5f9;
  --text-2:    #94a3b8;
  --text-3:    #64748b;
  --text-4:    #475569;
  --text-muted:#94a3b8;   /* libellés (était sombre par défaut) */
  --text-primary: #f1f5f9;
  --accent-light: rgba(59,130,246,.16);
  --sb-bg:     #080e1a;
  background: var(--bg-app); color: var(--text);
}
body.dark-mode .form-control {
  background: #1a2234; color: var(--text);
  border-color: #1f2937;
}
body.dark-mode .form-control:focus {
  background: #1e2a40;
  border-color: var(--blue);
}
body.dark-mode thead           { background: #111827; }
body.dark-mode tbody tr:hover  { background: #1a2234; }
body.dark-mode .modal-box      { background: var(--bg-card); border-color: #1f2937; }
body.dark-mode .modal-footer,
body.dark-mode .card-footer    { background: #0f1623; }
body.dark-mode .kanban-col     { background: #0f1623; }
body.dark-mode .kanban-card    { background: var(--bg-card); }
body.dark-mode .btn-ghost      { border-color: #1f2937; color: var(--text-2); }
body.dark-mode .btn-ghost:hover{ background: #1f2937; }
body.dark-mode .topbar-btn     { border-color: #1f2937; }
body.dark-mode .topbar-company { background: var(--bg-card); border-color: #1f2937; }
body.dark-mode .search-box input { background: #1a2234; color: var(--text); border-color: #1f2937; }
body.dark-mode .kpi-card       { background: var(--bg-card); border-color: #1f2937; }
body.dark-mode .table-wrapper  { background: var(--bg-card); border-color: #1f2937; }
body.dark-mode .card           { background: var(--bg-card); border-color: #1f2937; }
body.dark-mode thead           { background: linear-gradient(180deg, #111827, #0f1623); }
body.dark-mode .notif-item:hover{ background: #1a2234; }
body.dark-mode .notif-item.unread{ background: #1a2640; }
body.dark-mode .modal-overlay  { background: rgba(0,0,0,.7); }
body.dark-mode .tabs           { border-color: #1f2937; }
body.dark-mode .tab:hover,
body.dark-mode .tab-btn:hover  { background: rgba(59,130,246,.07); }
body.dark-mode .progress-outer { background: #1f2937; }
body.dark-mode .empty-state i  { color: #334155; }
body.dark-mode .page-btn       { background: #111827; border-color: #1f2937; color: var(--text-2); }
body.dark-mode .card-footer    { background: #0f1623; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
  #page-content { padding: 20px; }
}
@media (max-width: 768px) {
  :root { --sb-width: 260px; }
  #sidebar {
    position: fixed; left: calc(-1 * var(--sb-width));
    top: 0; height: 100vh;
    transition: left .26s cubic-bezier(.4,0,.2,1);
    z-index: 200;
  }
  #sidebar.mobile-open { left: 0; box-shadow: var(--shadow-lg); }
  #main-wrapper { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  #page-content { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .kanban-board { flex-direction: column; }
  .kanban-col { min-width: 100%; max-width: 100%; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-box { margin: 8px; width: calc(100vw - 16px) !important; max-width: 100% !important; max-height: 92vh; overflow-y: auto; }
  .modal-overlay { align-items: flex-start; padding-top: 4px; }
  .modal-xl, .modal-lg { max-width: 100% !important; width: calc(100vw - 16px) !important; }
  #topbar { padding: 0 16px; }
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-bar .form-control { flex: 1 1 140px; }
  .stats-row { flex-wrap: wrap; }
  .stat-item { flex: 1 1 calc(50% - 8px); min-width: 120px; }
  .charts-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .topbar-username { display: none; }
  .modal-box { margin: 4px; width: calc(100vw - 8px) !important; border-radius: 16px; }
  .stat-item { flex: 1 1 100%; }
  .table th:nth-child(n+6):not(:last-child),
  .table td:nth-child(n+6):not(:last-child) { display: none; }
}

/* ══════════════════════════════════════════════════════════
   SCROLLBARS PREMIUM
══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #1f2937; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #374151; }

/* ══════════════════════════════════════════════════════════
   UTILITAIRES
══════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-4) !important; }
.text-success { color: var(--green)  !important; }
.text-danger  { color: var(--red)    !important; }
.text-warning { color: var(--orange) !important; }
.text-info    { color: var(--blue)   !important; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-bold      { font-weight: 700; }
.fw-semi      { font-weight: 600; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
.mb-24        { margin-bottom: 24px; }

/* ══════════════════════════════════════════════════════════
   COMPOSANTS SUPPLÉMENTAIRES PREMIUM
══════════════════════════════════════════════════════════ */

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Avatar stack */
.avatar-stack { display: flex; }
.avatar-stack .avatar { 
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; margin-left: -8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Stat cards (utilisées dans chantiers) */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* Section headers */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.section-title i { color: var(--blue); }

/* Chip/Tag */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  background: var(--border-2); color: var(--text-2);
  transition: background var(--transition);
  cursor: default;
}
.chip-blue   { background: #eff6ff; color: #1d4ed8; }
.chip-green  { background: #ecfdf5; color: #065f46; }
.chip-red    { background: #fef2f2; color: #991b1b; }
.chip-orange { background: #fffbeb; color: #92400e; }

/* Timeline */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before {
  content: ''; position: absolute; left: -17px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(59,130,246,.25);
}
.timeline-date { font-size: 10.5px; color: var(--text-4); margin-bottom: 3px; }
.timeline-content { font-size: 13px; color: var(--text-2); }

/* Switch toggle */
.toggle-switch {
  position: relative; width: 38px; height: 21px;
  display: inline-block; flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e0; border-radius: 21px;
  cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 17px; height: 17px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(17px); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE KPI CARDS très petits écrans
══════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  #page-content { padding: 12px; }
  .page-title { font-size: 18px; }
}

/* ══════════════════════════════════════════════════════════
   5 THÈMES 3D — GestionApp 212
   Appliqués via body.theme-XXXX
══════════════════════════════════════════════════════════ */

/* ── Variables communes aux 5 thèmes ── */
@keyframes theme3dFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

/* ────────────────────────────────────────
   THÈME 1 : OCEAN DEEP (bleu profond 3D)
──────────────────────────────────────── */
body.theme-ocean {
  --sb-bg:           #0a1628;
  --sb-bg-2:         #0e1e35;
  --sb-active-bg:    rgba(56,189,248,.15);
  --sb-active-border:#38bdf8;
  --sb-text:         rgba(186,230,253,.9);
  --accent:          #38bdf8;
  --accent-dark:     #0284c7;
  --bg-app:          #e0f2fe;
  --bg-card:         #ffffff;
  --text:            #0c4a6e;
  --text-2:          #075985;
  --border:          #bae6fd;
  --shadow:          0 4px 20px rgba(14,116,144,.15);
  --r:               14px;
}
body.theme-ocean .card {
  border: 1px solid #bae6fd;
  box-shadow: 0 4px 0 #7dd3fc, 0 6px 20px rgba(14,116,144,.12);
  transition: transform .2s, box-shadow .2s;
}
body.theme-ocean .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #38bdf8, 0 12px 30px rgba(14,116,144,.18);
}
body.theme-ocean .btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 4px 0 #0369a1;
}
body.theme-ocean .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #0369a1; }
body.theme-ocean .btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 0 #0369a1; }
body.theme-ocean #topbar { background: linear-gradient(180deg, #f0f9ff, #e0f2fe); border-bottom: 2px solid #bae6fd; }
body.theme-ocean #sidebar { background: linear-gradient(175deg, #0a1628, #0e2a4a); }

/* ────────────────────────────────────────
   THÈME 2 : EMERALD FOREST (vert forêt 3D)
──────────────────────────────────────── */
body.theme-forest {
  --sb-bg:           #0f1f14;
  --sb-bg-2:         #162a1b;
  --sb-active-bg:    rgba(52,211,153,.15);
  --sb-active-border:#34d399;
  --sb-text:         rgba(167,243,208,.9);
  --accent:          #10b981;
  --accent-dark:     #059669;
  --bg-app:          #ecfdf5;
  --bg-card:         #ffffff;
  --text:            #064e3b;
  --text-2:          #065f46;
  --border:          #a7f3d0;
  --shadow:          0 4px 20px rgba(6,78,59,.12);
}
body.theme-forest .card {
  border: 1px solid #bbf7d0;
  box-shadow: 0 4px 0 #6ee7b7, 0 6px 20px rgba(6,78,59,.1);
  transition: transform .2s, box-shadow .2s;
}
body.theme-forest .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #34d399, 0 12px 30px rgba(6,78,59,.15);
}
body.theme-forest .btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 0 #047857;
}
body.theme-forest .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #047857; }
body.theme-forest .btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 0 #047857; }
body.theme-forest #topbar { background: linear-gradient(180deg, #f0fdf4, #dcfce7); border-bottom: 2px solid #bbf7d0; }
body.theme-forest #sidebar { background: linear-gradient(175deg, #0f1f14, #1a3a22); }

/* ────────────────────────────────────────
   THÈME 3 : SUNSET FIRE (orange rouge 3D)
──────────────────────────────────────── */
body.theme-sunset {
  --sb-bg:           #1c0a00;
  --sb-bg-2:         #2d1200;
  --sb-active-bg:    rgba(251,146,60,.15);
  --sb-active-border:#fb923c;
  --sb-text:         rgba(254,215,170,.9);
  --accent:          #f97316;
  --accent-dark:     #ea580c;
  --bg-app:          #fff7ed;
  --bg-card:         #ffffff;
  --text:            #7c2d12;
  --text-2:          #9a3412;
  --border:          #fed7aa;
  --shadow:          0 4px 20px rgba(124,45,18,.12);
}
body.theme-sunset .card {
  border: 1px solid #fdba74;
  box-shadow: 0 4px 0 #fca06e, 0 6px 20px rgba(234,88,12,.1);
  transition: transform .2s, box-shadow .2s;
}
body.theme-sunset .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #fb923c, 0 12px 30px rgba(234,88,12,.15);
}
body.theme-sunset .btn-primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 4px 0 #c2410c;
}
body.theme-sunset .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #c2410c; }
body.theme-sunset .btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 0 #c2410c; }
body.theme-sunset #topbar { background: linear-gradient(180deg, #fff7ed, #ffedd5); border-bottom: 2px solid #fed7aa; }
body.theme-sunset #sidebar { background: linear-gradient(175deg, #1c0a00, #3d1a00); }

/* ────────────────────────────────────────
   THÈME 4 : MIDNIGHT CRYSTAL (violet 3D)
──────────────────────────────────────── */
body.theme-crystal {
  --sb-bg:           #0f0a1f;
  --sb-bg-2:         #1a1035;
  --sb-active-bg:    rgba(167,139,250,.15);
  --sb-active-border:#a78bfa;
  --sb-text:         rgba(233,213,255,.9);
  --accent:          #8b5cf6;
  --accent-dark:     #7c3aed;
  --bg-app:          #f5f3ff;
  --bg-card:         #ffffff;
  --text:            #2e1065;
  --text-2:          #3b0764;
  --border:          #ddd6fe;
  --shadow:          0 4px 20px rgba(46,16,101,.12);
}
body.theme-crystal .card {
  border: 1px solid #c4b5fd;
  box-shadow: 0 4px 0 #c4b5fd, 0 6px 20px rgba(139,92,246,.1);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
body.theme-crystal .card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #ec4899, #06b6d4);
  opacity: 0;
  transition: opacity .2s;
}
body.theme-crystal .card:hover::before { opacity: 1; }
body.theme-crystal .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #a78bfa, 0 12px 30px rgba(139,92,246,.18);
}
body.theme-crystal .btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 4px 0 #6d28d9;
}
body.theme-crystal .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #6d28d9; }
body.theme-crystal .btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 0 #6d28d9; }
body.theme-crystal #topbar { background: linear-gradient(180deg, #faf5ff, #f3e8ff); border-bottom: 2px solid #ddd6fe; }
body.theme-crystal #sidebar { background: linear-gradient(175deg, #0f0a1f, #221040); }

/* ────────────────────────────────────────
   THÈME 5 : GOLD PRESTIGE (or premium 3D)
──────────────────────────────────────── */
body.theme-gold {
  --sb-bg:           #1a1200;
  --sb-bg-2:         #2a1e00;
  --sb-active-bg:    rgba(234,179,8,.15);
  --sb-active-border:#eab308;
  --sb-text:         rgba(253,230,138,.9);
  --accent:          #d97706;
  --accent-dark:     #b45309;
  --bg-app:          #fffbeb;
  --bg-card:         #ffffff;
  --text:            #451a03;
  --text-2:          #78350f;
  --border:          #fde68a;
  --shadow:          0 4px 20px rgba(180,83,9,.12);
}
body.theme-gold .card {
  border: 1px solid #fde68a;
  box-shadow: 0 4px 0 #fcd34d, 0 6px 20px rgba(217,119,6,.1);
  transition: transform .2s, box-shadow .2s;
}
body.theme-gold .card:hover {
  transform: translateY(-3px) rotateX(1deg);
  box-shadow: 0 8px 0 #eab308, 0 12px 30px rgba(217,119,6,.2);
}
body.theme-gold .card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,215,0,.08), transparent);
  pointer-events: none;
  border-radius: inherit;
}
body.theme-gold .card { position: relative; overflow: hidden; }
body.theme-gold .btn-primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 0 #92400e;
}
body.theme-gold .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #92400e; }
body.theme-gold .btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 0 #92400e; }
body.theme-gold #topbar { background: linear-gradient(180deg, #fffbeb, #fef3c7); border-bottom: 2px solid #fde68a; }
body.theme-gold #sidebar { background: linear-gradient(175deg, #1a1200, #3d2e00); }

/* ── Sélecteur de thème (swatches dans la topbar) ── */
#theme-picker {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  position: relative;
}
.theme-swatch {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(255,255,255,.3);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
}
.theme-swatch:hover { transform: scale(1.25); border-color: rgba(255,255,255,.8); }
.theme-swatch.active {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}
.theme-swatch[data-theme="default"]  { background: linear-gradient(135deg, #0f172a, #3b82f6); }
.theme-swatch[data-theme="ocean"]    { background: linear-gradient(135deg, #0a1628, #38bdf8); }
.theme-swatch[data-theme="forest"]   { background: linear-gradient(135deg, #0f1f14, #10b981); }
.theme-swatch[data-theme="sunset"]   { background: linear-gradient(135deg, #1c0a00, #f97316); }
.theme-swatch[data-theme="crystal"]  { background: linear-gradient(135deg, #0f0a1f, #8b5cf6); }
.theme-swatch[data-theme="gold"]     { background: linear-gradient(135deg, #1a1200, #eab308); }

/* ══════════════════════════════════════════════════════════
   2 MODES D'AFFICHAGE : PC (défaut) & MOBILE (tablette/phone)
══════════════════════════════════════════════════════════ */

/* ── Mode Mobile activé manuellement via body.layout-mobile ── */
body.layout-mobile #sidebar {
  position: fixed;
  bottom: 0; left: 0; right: 0; top: auto;
  height: 64px;
  width: 100% !important;
  z-index: 200;
  border-top: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
  overflow: visible;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
body.layout-mobile .sidebar-header,
body.layout-mobile .sidebar-footer,
body.layout-mobile #company-selector-display,
body.layout-mobile #favorites-bar,
body.layout-mobile .nav-section-title,
body.layout-mobile #company-selector { display: none !important; }

/* Barre du bas : défilement horizontal, items lisibles (on glisse) */
body.layout-mobile .sidebar-nav {
  display: flex; flex-direction: row;
  align-items: stretch; justify-content: flex-start;
  width: 100%; height: 100%;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0; gap: 0;
  scrollbar-width: none;
}
body.layout-mobile .sidebar-nav::-webkit-scrollbar { display: none; }
body.layout-mobile .nav-item {
  flex: 0 0 auto; min-width: 66px;
  flex-direction: column;
  align-items: center; justify-content: center;
  height: 64px; padding: 8px 6px;
  border-radius: 0; border-left: none !important;
  border-top: 3px solid transparent;
}
body.layout-mobile .nav-item.active { border-top-color: var(--accent); background: rgba(59,130,246,.14); }
body.layout-mobile .nav-item i { font-size: 19px; margin-bottom: 3px; }
body.layout-mobile .nav-item .nav-label {
  font-size: 9.5px; line-height: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62px;
}

body.layout-mobile #main-wrapper {
  margin-left: 0 !important;
  padding-bottom: 68px; /* espace pour la nav bar fixe */
}
body.layout-mobile #topbar {
  position: sticky; top: 0; z-index: 100;
}

/* Cards en mode mobile : une colonne */
body.layout-mobile [style*="grid-template-columns:repeat(4,1fr)"],
body.layout-mobile [style*="grid-template-columns: repeat(4, 1fr)"] {
  grid-template-columns: repeat(2, 1fr) !important;
}
body.layout-mobile .modal-xl { max-width: 96vw; }
body.layout-mobile .grid-2 { grid-template-columns: 1fr !important; }
body.layout-mobile .page-actions { flex-wrap: wrap; gap: 6px; }

/* Bouton toggle layout dans la topbar */
#layout-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: none; cursor: pointer; font-size: 15px;
  background: transparent; color: var(--text-3);
  transition: background var(--transition), color var(--transition);
}
#layout-toggle-btn:hover { background: var(--border-2); color: var(--text); }
body.layout-mobile #layout-toggle-btn { color: var(--accent); background: var(--accent-light); }

/* ── Responsive automatique (sans toggle) ── */
@media (max-width: 768px) {
  #sidebar { --sb-width: 220px; }
  #page-content { padding: 14px; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-actions { flex-wrap: wrap; }
  .modal-xl { max-width: 96vw; }
  .grid-2 { grid-template-columns: 1fr !important; }
  table { font-size: 12px; }
  thead th { padding: 8px 10px; }
  tbody td { padding: 8px 10px; }
}
@media (max-width: 540px) {
  #topbar .topbar-company,
  #topbar .topbar-username { display: none; }
  #topbar { gap: 6px; }
  .page-title { font-size: 16px; }
  .btn-primary span { display: none; }
  [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2,1fr) !important; }
}

/* ── Recherche globale (barre du haut) ── */
.topbar-search { position: relative; display: flex; align-items: center; margin-left: 14px; }
.topbar-search > i { position: absolute; left: 11px; color: #94a3b8; font-size: 13px; pointer-events: none; }
.topbar-search input {
  width: 250px; max-width: 34vw;
  padding: 8px 12px 8px 31px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 9px;
  font-size: 13px; background: var(--bg-subtle, #f7fafc); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.topbar-search input:focus { background: #fff; border-color: var(--accent, #3b82f6); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 330px; max-width: 82vw; max-height: 380px; overflow: auto;
  background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
  box-shadow: 0 12px 34px rgba(15,23,42,.18); z-index: 500;
}
.search-dropdown:empty { display: none; }
body.dark-mode .search-dropdown { background: var(--bg-card, #111a2e); border-color: #1f2937; }
body.dark-mode .topbar-search input { background: #0f1623; border-color: #1f2937; color: #e2e8f0; }
@media (max-width: 820px) { .topbar-search input { width: 170px; } }
@media (max-width: 640px) { .topbar-search { display: none; } }

/* ── Références cliquables (accès rapide aux documents) ── */
.doc-link{color:var(--accent,#3b82f6);cursor:pointer;font-weight:600;text-decoration:none;border-bottom:1px dashed transparent;transition:border-color .15s}
.doc-link:hover{border-bottom-color:var(--accent,#3b82f6)}

/* ═══════════════════════════════════════════════════════════════
   COUCHE UX v6.1 — 3D subtil global · interactions fluides · tactile
   Ajoutée pour : profondeur cohérente sur toute l'interface,
   retours visuels au clic, meilleure prise en main mobile/tablette.
   Volontairement en fin de fichier + faible spécificité pour ne pas
   casser les thèmes existants (theme-ocean, -gold, dark-mode, …).
   ═══════════════════════════════════════════════════════════════ */

/* Profondeur 3D douce et uniforme sur tous les conteneurs interactifs */
.card,
.kpi-card,
.stat-card,
.table-wrapper,
.kanban-card,
.dropdown-menu,
.modal-content,
.modal-box,
.tile,
.widget {
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  will-change: transform;
}

/* Léger soulèvement au survol (souris) → sensation de relief, sans excès */
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .kpi-card:hover,
  .stat-card:hover,
  .table-wrapper:hover,
  .kanban-card:hover,
  .tile:hover,
  .widget:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }
}

/* Lignes de tableau : surbrillance + micro-relief au survol */
@media (hover: hover) and (pointer: fine) {
  tbody tr { transition: background var(--transition), box-shadow var(--transition); }
  tbody tr:hover {
    background: var(--accent-light, rgba(59,130,246,.06));
    box-shadow: inset 3px 0 0 var(--accent, #3b82f6);
  }
}

/* En-têtes de tableau collants → navigation plus claire dans les longues listes */
.table-responsive { position: relative; }
thead th {
  position: sticky; top: 0; z-index: 2;
}

/* Boutons : retour tactile « pressé » cohérent partout */
.btn, button.btn, .btn-icon, .nav-item, .tab, .chip {
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition), color var(--transition);
}
.btn:active, button.btn:active, .btn-icon:active,
.nav-item:active, .tab:active, .chip:active {
  transform: translateY(1px) scale(.985);
}

/* Focus visible harmonisé (accessibilité + clarté) */
.btn:focus-visible,
.nav-item:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

/* Modales : apparition douce + profondeur */
.modal-content, .modal-box {
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--transition-slow) both;
}

/* Défilement fluide global */
html { scroll-behavior: smooth; }
* { -webkit-tap-highlight-color: transparent; }

/* ── ERGONOMIE TACTILE (mobile / tablette / écrans tactiles) ──
   Cibles plus grandes, texte lisible, champs confortables.       */
@media (pointer: coarse), (max-width: 820px) {
  .btn, button.btn {
    min-height: 46px;
    padding: 12px 18px;
    font-size: 15px;
  }
  .btn-icon, .icon-btn {
    min-width: 44px; min-height: 44px;
  }
  input, select, textarea, .form-control {
    min-height: 46px;
    font-size: 16px; /* évite le zoom auto iOS */
  }
  .nav-item { padding-top: 12px; padding-bottom: 12px; }
  tbody td, thead th { padding: 12px 12px; }
  .card-body { padding: 16px; }
  /* Tableaux larges : défilement horizontal fluide au doigt */
  .table-responsive { -webkit-overflow-scrolling: touch; overflow-x: auto; }
}

/* Tablette : grilles KPI/contenus qui restent lisibles */
@media (min-width: 641px) and (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Barre de navigation basse (mode mobile) : relief + confort du pouce */
body.layout-mobile #sidebar {
  box-shadow: 0 -4px 20px rgba(15,23,42,.18);
}
body.layout-mobile .nav-item {
  min-height: 54px;
  transition: transform var(--transition), background var(--transition);
}
body.layout-mobile .nav-item:active { transform: scale(.94); }

/* Respecte les préférences « animations réduites » du système */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .card:hover, .kpi-card:hover, .table-wrapper:hover { transform: none; }
}

/* ═══════════════════════════════════════════════════════════════
   MODE SOMBRE + THÈMES 3D — surfaces sombres, texte clair, relief gardé
   (placé en fin de fichier pour passer devant les thèmes theme-XXX)
   ═══════════════════════════════════════════════════════════════ */
body.dark-mode .card,
body.dark-mode .kpi-card,
body.dark-mode .stat-card,
body.dark-mode .table-wrapper,
body.dark-mode .modal-box,
body.dark-mode .modal-content,
body.dark-mode .tile,
body.dark-mode .widget,
body.dark-mode .search-dropdown,
body.dark-mode .dropdown-menu,
body.dark-mode table.card-table tr {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
/* En-têtes, pieds et lignes de tableaux */
body.dark-mode .card-header,
body.dark-mode thead,
body.dark-mode thead th,
body.dark-mode .table-header,
body.dark-mode tfoot td,
body.dark-mode .card-footer,
body.dark-mode .modal-footer {
  background: #0f1623 !important;
  color: var(--text) !important;
}
body.dark-mode td,
body.dark-mode th { color: var(--text) !important; border-color: var(--border) !important; }
body.dark-mode tbody tr:nth-child(even) { background: rgba(255,255,255,.02) !important; }
body.dark-mode tbody tr:hover { background: rgba(59,130,246,.10) !important; }
body.dark-mode .card-table td::before { color: var(--text-muted) !important; }
/* Barre du haut : rester sombre même sous un thème coloré */
body.dark-mode #topbar { background: var(--topbar-bg) !important; border-bottom-color: var(--border) !important; }
/* Champs et zones claires diverses */
body.dark-mode input, body.dark-mode select, body.dark-mode textarea, body.dark-mode .form-control {
  background: #1a2234 !important; color: var(--text) !important; border-color: var(--border) !important;
}
body.dark-mode .topbar-search input { background: #1a2234 !important; }
/* Le relief 3D (ombres) reste actif : on ne touche qu'aux couleurs, pas aux box-shadow */

/* ═══════════════════════════════════════════════════════════════
   FINITIONS MOBILE — lisibilité & élégance sur petit écran
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Barre du haut : on retire les pastilles de thème (dispo dans Paramètres) */
  .theme-swatch { display: none !important; }
  #topbar { gap: 6px; padding: 0 12px; }
  .topbar-company { display: none; }           /* le nom société encombre */

  .page-title { font-size: 17px; }
  .page-subtitle { font-size: 12px; }
  #page-content { padding: 12px; }

  /* KPI : 2 colonnes lisibles */
  .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 11px; }
  .kpi-icon { width: 38px; height: 38px; font-size: 15px; }

  /* Tableaux : défilement horizontal fluide, colonnes gardent leur largeur */
  .table-wrapper, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive table { min-width: 640px; }
  thead th, tbody td { padding: 10px 10px; }

  /* Boutons d'en-tête de page : pleine largeur, empilés proprement */
  .page-header { gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ── Tables → cartes empilées sur mobile (.card-table) ── */
@media (max-width: 640px) {
  .table-responsive table.card-table { min-width: 0 !important; }
  table.card-table thead { display: none; }
  table.card-table, table.card-table tbody, table.card-table tr, table.card-table td { display: block; width: 100%; }
  table.card-table tr {
    background: var(--bg-card, #fff);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 12px; margin: 0 0 12px; padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
  }
  table.card-table tr:nth-child(even) { background: var(--bg-card, #fff); }
  table.card-table td {
    border: none !important; padding: 7px 0 !important;
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    text-align: right; min-height: 30px; border-bottom: 1px dashed #eef2f7 !important;
  }
  table.card-table td:last-child { border-bottom: none !important; }
  table.card-table td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-muted, #64748b);
    font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
    text-align: left; flex: 0 0 auto;
  }
  /* Cellule d'actions : boutons alignés à droite, sans étiquette */
  table.card-table td.actions-cell { justify-content: flex-end; border-bottom: none !important; padding-top: 10px !important; }
  table.card-table td.actions-cell::before { display: none; }
  table.card-table td.actions-cell .btn { flex: 1 1 auto; }
}

/* Barre de navigation basse (mode mobile) : espace suffisant sous le contenu */
body.layout-mobile #main-wrapper { padding-bottom: 74px; }
/* Indice visuel de défilement de la barre du bas (léger dégradé à droite) */
body.layout-mobile #sidebar::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 22px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.18));
  pointer-events: none;
}
