/* ═══════════════════════════════════════════════════════════════
   ALPA CONNECT CRM v2 — Design System "ZINC"
   Inspiration : Linear / Vercel / Raycast
   ═══════════════════════════════════════════════════════════════ */

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

/* ─── Variables ─── */
:root {
  /* Zinc palette (Tailwind-style) */
  --zinc-50:  #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-600: #52525b;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  --white: #ffffff;

  /* Accents sémantiques */
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-700: #15803d;
  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --red-700:   #b91c1c;
  --orange-500:#f97316;
  --orange-100:#ffedd5;
  --orange-700:#c2410c;
  --blue-500:  #3b82f6;
  --blue-100:  #dbeafe;
  --blue-700:  #1d4ed8;
  --purple-500:#a855f7;
  --purple-100:#f3e8ff;
  --purple-700:#7e22ce;

  /* Sémantique clair (par défaut) */
  --bg:         var(--zinc-50);
  --bg-card:    var(--white);
  --bg-hover:   var(--zinc-100);
  --border:     var(--zinc-200);
  --border-strong: var(--zinc-300);
  --text:       var(--zinc-950);
  --text-muted: var(--zinc-500);
  --text-light: var(--zinc-400);

  /* Sidebar (toujours foncée) */
  --sb-bg:       var(--zinc-950);
  --sb-border:   var(--zinc-800);
  --sb-text:     var(--zinc-400);
  --sb-text-hover: var(--zinc-100);
  --sb-active-bg: var(--zinc-800);
  --sb-active-text: var(--white);
  --sb-muted:    var(--zinc-600);
  --sb-brand:    var(--white);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 56px;
  --topbar-h: 52px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows (minimales, comme Linear) */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.03);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Transitions */
  --tr: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-fast: 100ms ease-out;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  letter-spacing: -0.01em;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--zinc-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--zinc-400); }
/* Scrollbar dans la sidebar */
.sidebar ::-webkit-scrollbar-thumb { background: var(--zinc-800); }
.sidebar ::-webkit-scrollbar-thumb:hover { background: var(--zinc-700); }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — Rail extensible (Linear style)
   Repliée : 56px icônes seules. Au survol : 240px en OVERLAY
   (le contenu ne bouge pas, margin-left reste à 56px)
   ═══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w-collapsed);
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 180ms cubic-bezier(0.4, 0, 0.2, 1), transform var(--tr);
  border-right: 1px solid var(--sb-border);
  overflow: hidden;
  white-space: nowrap;
}
.sidebar:hover {
  width: var(--sidebar-w);
  box-shadow: 12px 0 32px rgba(0,0,0,.25);
}
/* Labels masqués quand replié, fondu à l'ouverture */
.sidebar .sb-date,
.sidebar .brand-meta,
.sidebar .brand-status,
.sidebar .nav-item span,
.sidebar .nav-badge,
.sidebar .nav-section,
.sidebar .user-meta,
.sidebar .btn-logout span {
  opacity: 0;
  transition: opacity 140ms ease-out 40ms;
  pointer-events: none;
}
.sidebar:hover .sb-date,
.sidebar:hover .brand-meta,
.sidebar:hover .brand-status,
.sidebar:hover .nav-item span,
.sidebar:hover .nav-badge,
.sidebar:hover .nav-section,
.sidebar:hover .user-meta,
.sidebar:hover .btn-logout span {
  opacity: 1;
  pointer-events: auto;
}
/* Séparateur fin à la place des titres de sections quand replié */
.sidebar .nav-section {
  position: relative;
  min-height: 25px;
}
.sidebar:not(:hover) .nav-section::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px;
  top: 50%;
  border-top: 1px solid var(--sb-border);
  opacity: 1;
}

/* Brand */
.sidebar-brand {
  padding: 14px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sb-border);
  height: 56px;
}
.brand-logo {
  width: 30px; height: 30px;
  background: var(--white);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--zinc-950);
  flex-shrink: 0;
}
.brand-meta { flex: 1; min-width: 0; overflow: hidden; }
/* Date du jour + n° de semaine dans la sidebar — discret, une ligne */
.sb-date {
  display: flex; align-items: center; gap: 7px;
  margin: 0 12px 6px 14px; padding: 0;
  white-space: nowrap; line-height: 1.3;
}
.sb-date-day { font-size: 12px; font-weight: 700; color: var(--zinc-400, #a1a1aa); overflow: hidden; text-overflow: ellipsis; }
.sb-date-week { font-size: 11px; font-weight: 900; color: #fff; background: #2563eb; padding: 1px 7px; border-radius: 6px; flex-shrink: 0; }
.brand-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  color: var(--zinc-500);
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.brand-status {
  width: 6px; height: 6px;
  background: var(--green-500);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-section {
  padding: 12px 12px 6px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-muted);
}
.nav-section:first-child { padding-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--tr-fast);
  position: relative;
  cursor: pointer;
  user-select: none;
}
.nav-item:hover {
  background: rgba(255,255,255,.04);
  color: var(--sb-text-hover);
}
.nav-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-active-text);
}
.nav-item i, .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.nav-item.active i, .nav-item.active svg { opacity: 1; }
.nav-item span { flex: 1; }
.nav-badge {
  background: var(--zinc-700);
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-badge {
  background: var(--white);
  color: var(--zinc-900);
}
.nav-shortcut {
  color: var(--sb-muted);
  font-size: 11px;
  font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

/* Footer sidebar */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius);
  transition: background var(--tr-fast);
  cursor: pointer;
}
.user-card:hover { background: rgba(255,255,255,.04); }
.user-avatar {
  width: 28px; height: 28px;
  background: var(--zinc-800);
  border: 1px solid var(--zinc-700);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; overflow: hidden; }
.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 10px;
  color: var(--sb-muted);
  margin-top: 1px;
  text-transform: capitalize;
}
.btn-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 13px;
  border-radius: var(--radius);
  color: var(--sb-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--tr-fast);
}
.btn-logout:hover { background: rgba(239,68,68,.08); color: #fca5a5; }
.btn-logout i, .btn-logout svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   TOPBAR MOBILE
   ═══════════════════════════════════════════════════════════════ */
.topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 95;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
}
.topbar-menu, .topbar-logout {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--zinc-700);
  transition: background var(--tr-fast);
}
.topbar-menu:hover, .topbar-logout:hover { background: var(--zinc-100); }
.topbar-title { font-weight: 600; color: var(--zinc-900); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w-collapsed);
  padding: 28px 36px;
  min-height: 100vh;
  min-width: 0;
  animation: fadeIn 200ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--zinc-950);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.page-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

h1, h2, h3, h4 { color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  transition: border-color var(--tr-fast);
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--tr-fast);
  position: relative;
}
.stat-card:hover { border-color: var(--border-strong); }
a.stat-link { text-decoration: none; color: inherit; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease; display: block; }
a.stat-link:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(0,0,0,.18); }
.stat-icon {
  width: 36px; height: 36px;
  background: var(--zinc-100);
  color: var(--zinc-700);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon i, .stat-icon svg { width: 18px; height: 18px; }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}
.stat-delta { font-size: 11px; margin-top: 6px; font-weight: 600; }
.stat-delta.up { color: var(--green-500); }
.stat-delta.down { color: var(--red-500); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--tr-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
  height: 32px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn i, .btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--zinc-900);
  color: var(--white);
  border-color: var(--zinc-900);
}
.btn-primary:hover:not(:disabled) { background: var(--zinc-800); border-color: var(--zinc-800); }

.btn-accent {
  background: var(--white);
  color: var(--zinc-950);
  border-color: var(--zinc-200);
  font-weight: 600;
}
.btn-accent:hover:not(:disabled) { border-color: var(--zinc-900); }

.btn-secondary {
  background: var(--white);
  color: var(--zinc-700);
  border-color: var(--zinc-200);
}
.btn-secondary:hover:not(:disabled) { background: var(--zinc-50); border-color: var(--zinc-300); }

.btn-danger {
  background: var(--red-500);
  color: var(--white);
  border-color: var(--red-500);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; border-color: #dc2626; }

.btn-ghost { color: var(--zinc-600); }
.btn-ghost:hover:not(:disabled) { background: var(--zinc-100); }

.btn-sm { padding: 4px 10px; font-size: 12px; height: 26px; }
.btn-sm i, .btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; height: 40px; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--zinc-700);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--zinc-900);
  box-shadow: 0 0 0 3px rgba(9,9,11,.06);
}
.form-input::placeholder { color: var(--zinc-400); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-input[type="date"], .form-input[type="time"] { min-height: 34px; }

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--white);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px;
  background: var(--zinc-50);
  color: var(--zinc-600);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--zinc-100);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: var(--zinc-50); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
}
.badge-navy   { background: var(--zinc-900); color: var(--white); }
.badge-green  { background: var(--green-100); color: var(--green-700); border-color: rgba(34,197,94,.2); }
.badge-red    { background: var(--red-100); color: var(--red-700); border-color: rgba(239,68,68,.2); }
.badge-orange { background: var(--orange-100); color: var(--orange-700); border-color: rgba(249,115,22,.2); }
.badge-purple { background: var(--purple-100); color: var(--purple-700); border-color: rgba(168,85,247,.2); }
.badge-gray   { background: var(--zinc-100); color: var(--zinc-700); border-color: var(--zinc-200); }

/* Toasts */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--zinc-950);
  color: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--zinc-800);
  min-width: 260px;
  max-width: 400px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--green-500); }
.toast.error { border-left: 3px solid var(--red-500); }
.toast.warning { border-left: 3px solid var(--orange-500); }
.toast.info { border-left: 3px solid var(--blue-500); }

/* Empty state */
.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i, .empty-state svg {
  width: 48px; height: 48px;
  color: var(--zinc-300);
  margin: 0 auto 16px;
}
.empty-state h3 { color: var(--zinc-800); font-size: 15px; margin-bottom: 6px; font-weight: 600; }
.empty-state p { font-size: 13px; max-width: 340px; margin: 0 auto; }

/* Loader */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--zinc-200);
  border-top-color: var(--zinc-900);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full {
  min-height: 50vh;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE — Zinc
   ═══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--zinc-50);
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}
.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: loginIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand-logo {
  width: 56px; height: 56px;
  background: var(--zinc-950);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--white);
}
.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--zinc-950);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-input-large { padding: 11px 14px; font-size: 14px; }
.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.login-alert.error { background: var(--red-100); color: var(--red-700); border-color: rgba(239,68,68,.15); }
.login-alert.success { background: var(--green-100); color: var(--green-700); border-color: rgba(34,197,94,.15); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 20px 0 40px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  /* Sur mobile : labels toujours visibles (pas de mode rail) */
  .sidebar .sb-date,
  .sidebar .brand-meta,
  .sidebar .brand-status,
  .sidebar .nav-item span,
  .sidebar .nav-badge,
  .sidebar .nav-section,
  .sidebar .user-meta,
  .sidebar .btn-logout span {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar:not(:hover) .nav-section::after { display: none; }
  .main-content { margin-left: 0; padding: 12px; padding-top: calc(var(--topbar-h) + 12px); }
  .topbar { display: flex; }
  /* Tableaux larges : scroll horizontal lisible au lieu d'écraser les colonnes */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap .table { min-width: 760px; }
  /* Filtres empilés proprement */
  .card .form-group { min-width: 0 !important; }
  .page-header { flex-direction: column; align-items: flex-start; margin-bottom: 16px; }
  .page-title { font-size: 22px; }
  .card { padding: 14px; }
  .table th, .table td { padding: 8px 10px; font-size: 12px; }
}

/* Overlay quand sidebar ouverte sur mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
  animation: fadeIn 200ms ease-out;
}
.sidebar.open + .sidebar-overlay { display: block; }
@media (min-width: 901px) { .sidebar-overlay { display: none !important; } }

/* Tactile : pas d'expansion de la sidebar au survol (le tap déclenche :hover et ça reste collé) */
@media (hover: none) {
  .sidebar:hover { width: var(--sidebar-w-collapsed); box-shadow: none; }
  .sidebar.open:hover { width: 260px; }
}
