/* =============================================
   WildixStats — Design System "Cockpit"
   Palette  : signal blue · emerald · rose · amber
   Type     : IBM Plex Sans (UI) · Space Grotesk (data)
   Style    : Clean · Light · Professional
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block');

/* ── Design Tokens ────────────────────────── */
:root {
  /* Legacy aliases — compatibilité templates existants */
  --font-mono:         'Space Grotesk', 'JetBrains Mono', monospace;
  --color-primary:     #2563eb;
  --color-primary-lt:  #3b82f6;
  --color-accent:      #2563eb;
  --color-success:     #0F9E6E;
  --color-warning:     #F59E0B;
  --color-danger:      #E5484D;
  --color-bg:          #E9EDF4;
  --color-white:       #FFFFFF;
  --color-border:      #E3E8F0;
  --color-text:        #1A2333;
  --color-muted:       #8A93A6;
  --color-sidebar:     #141C2E;
  --color-sidebar-txt: #AEB6C7;
  --shadow:            0 1px 3px rgba(20,28,46,.05);

  /* Structure */
  --sidebar-w:   240px;
  --topbar-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Surfaces */
  --bg:           #E9EDF4;
  --surface:      #FFFFFF;
  --surface-2:    #FAFBFD;
  --border:       #E3E8F0;
  --border-solid: #E3E8F0;
  --border-focus: #2563eb;

  /* Text */
  --text:   #1A2333;
  --text-2: #3B4658;
  --muted:  #8A93A6;

  /* Brand colors */
  --blue:       #2563eb;
  --blue-light: #3b82f6;
  --blue-dark:  #1d4ed8;
  --blue-dim:   rgba(37,99,235,.10);
  --indigo:     #4f46e5;
  --violet:     #7C3AED;
  --violet-dim: rgba(124,58,237,.10);

  /* Semantic */
  --green:      #0F9E6E;
  --green-dim:  rgba(15,158,110,.10);
  --red:        #E5484D;
  --red-dim:    rgba(229,72,77,.10);
  --amber:      #F59E0B;
  --amber-dim:  rgba(245,158,11,.10);
  --cyan:       #11B5B0;
  --cyan-dim:   rgba(17,181,176,.10);
  --purple:     #a855f7;
  --purple-dim: rgba(168,85,247,.10);

  /* Glass system (login only) */
  --glass-bg:     rgba(255,255,255,0.75);
  --glass-border: rgba(255,255,255,0.82);

  /* Shadows */
  --shadow-xs:         0 1px 3px rgba(20,28,46,.05);
  --shadow-sm:         0 1px 3px rgba(20,28,46,.05), 0 4px 12px rgba(20,28,46,.04);
  --shadow-md:         0 4px 20px rgba(20,28,46,.08), 0 1px 4px rgba(20,28,46,.04);
  --shadow-lg:         0 12px 40px rgba(20,28,46,.12), 0 4px 12px rgba(20,28,46,.06);
  --shadow-glow-blue:  0 0 0 3px rgba(37,99,235,.18);
  --shadow-glow-red:   0 0 0 3px rgba(229,72,77,.18);
}

/* ── Material Symbols ─────────────────────── */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  user-select: none;
}

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
a { color: inherit; }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C5CDDC; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #A8B4C8; }

/* ── Body ─────────────────────────────────── */
body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}

/* Numerals / tabular — Space Grotesk */
.num,
code, pre, kbd,
.mono, [data-mono],
th, td,
.badge,
.stat-card .value,
.stat-card .stat-value,
input[type="number"],
input[type="date"],
input[type="time"] {
  font-family: 'Space Grotesk', 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* ── Layout ───────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #141C2E 0%, #0F1626 100%);
  color: #AEB6C7;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  border-right: none;
  box-shadow: 2px 0 20px rgba(0,0,0,.25);
}

/* Brand */
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37,99,235,.4);
  flex-shrink: 0;
}

.sidebar-brand .brand-icon .material-symbols-outlined {
  font-size: 20px;
  color: #fff;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.015em;
  line-height: 1;
}

.sidebar-brand p {
  font-size: .68rem;
  color: #5A6478;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-left: 0;
  margin-top: 2px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 6px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.nav-section {
  padding: 14px 10px 7px;
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #5A6478;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  color: #AEB6C7;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-radius: 10px;
  border-left: none;
  margin: 2px 0;
  position: relative;
}

.sidebar-nav a .material-symbols-outlined {
  font-size: 17px;
  color: #6E788C;
  transition: color .15s;
  flex-shrink: 0;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.05);
  color: #E7EBF2;
}
.sidebar-nav a:hover .material-symbols-outlined {
  color: #AEB6C7;
}

.sidebar-nav a.active {
  background: rgba(37,99,235,.16);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active .material-symbols-outlined {
  color: var(--blue-light);
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

/* Client switch */
.sidebar-client-switch {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-client-switch label {
  display: block;
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #5A6478;
  margin-bottom: 7px;
  font-weight: 600;
}

.sidebar-client-switch select {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: #E7EBF2;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .875rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s;
}
.sidebar-client-switch select:focus {
  outline: none;
  border-color: var(--blue);
}
.sidebar-client-switch option { color: var(--text); background: #fff; }

/* Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  color: #AEB6C7;
  font-weight: 500;
}

.sidebar-footer a {
  color: #6E788C;
  text-decoration: none;
  font-size: .78rem;
  transition: color .15s;
  padding: .3rem .7rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.sidebar-footer a:hover {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(229,72,77,.25);
}

/* ── Main area ────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar ───────────────────────────────── */
.topbar {
  background: rgba(233,237,244,.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #D7DDE8;
  padding: 18px 32px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.topbar-title {
  flex: 1;
}

.topbar-breadcrumb {
  font-size: .75rem;
  color: #8A93A6;
  letter-spacing: .02em;
  line-height: 1;
  margin-bottom: 2px;
}

.topbar h2 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: #141C2E;
  line-height: 1.1;
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
}

/* ── Content ──────────────────────────────── */
.content {
  padding: 0 1.75rem 2.5rem;
  flex: 1;
}

/* ── Card ─────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.glass-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 1rem 1.375rem;
  border-bottom: 1px solid #EDF0F5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #FAFBFD;
}

.card-header h3 {
  font-size: .95rem;
  font-weight: 600;
  color: #1A2333;
  letter-spacing: -.01em;
  font-family: 'Space Grotesk', sans-serif;
}

.card-body {
  padding: 1.25rem;
}

/* ── KPI / Stat Cards ─────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Left color strip */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 3px 0 0 3px;
}

/* Variant left strips */
.stat-card.green::before  { background: var(--green); }
.stat-card.red::before    { background: var(--red); }
.stat-card.amber::before  { background: var(--amber); }
.stat-card.violet::before { background: var(--violet); }
.stat-card.indigo::before { background: var(--indigo); }
.stat-card.cyan::before   { background: var(--cyan); }
.stat-card.purple::before { background: var(--purple); }

/* KPI cliquable */
.stat-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.stat-card-link:hover .stat-card {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-card.kpi-active {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Stat header row */
.stat-card .stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
}

/* Stat icon badge */
.stat-card .stat-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(37,99,235,.08);
  color: var(--blue);
}
.stat-card.green  .stat-icon { background: var(--green-dim); color: var(--green); }
.stat-card.red    .stat-icon { background: var(--red-dim);   color: var(--red); }
.stat-card.amber  .stat-icon { background: var(--amber-dim); color: var(--amber); }
.stat-card.violet .stat-icon { background: var(--violet-dim); color: var(--violet); }
.stat-card.indigo .stat-icon { background: rgba(79,70,229,.10); color: var(--indigo); }
.stat-card.cyan   .stat-icon { background: var(--cyan-dim);  color: var(--cyan); }
.stat-card.purple .stat-icon { background: var(--purple-dim); color: var(--purple); }

.stat-card .stat-icon .material-symbols-outlined { font-size: 16px; }

/* Labels */
.stat-card .label,
.stat-card .stat-label {
  font-size: .7rem;
  font-weight: 500;
  color: #8A93A6;
  letter-spacing: .02em;
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.3;
}

/* Value */
.stat-card .value,
.stat-card .stat-value {
  font-size: 2.2rem;
  font-weight: 600;
  color: #141C2E;
  line-height: .95;
  letter-spacing: -.03em;
  margin-top: 8px;
  font-family: 'Space Grotesk', sans-serif;
}

/* Mini progress bar */
.stat-progress {
  height: 3px;
  background: #EEF1F6;
  border-radius: 99px;
  margin: .6rem 0 .35rem;
  overflow: hidden;
}
.stat-progress-bar {
  height: 100%;
  border-radius: 99px;
  background: var(--blue);
  transition: width .5s ease;
}
.stat-card.green  .stat-progress-bar { background: var(--green); }
.stat-card.red    .stat-progress-bar { background: var(--red); }
.stat-card.amber  .stat-progress-bar { background: var(--amber); }
.stat-card.violet .stat-progress-bar { background: var(--violet); }

.stat-card .sub {
  font-size: .73rem;
  color: #9AA4B5;
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.4;
  margin-top: 4px;
}

/* ── Tables ───────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .855rem;
}

th {
  text-align: left;
  padding: 11px 18px;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #9AA4B5;
  border-bottom: 1px solid #EDF0F5;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
  background: #FAFBFD;
}

td {
  padding: 12px 18px;
  border-bottom: 1px solid #F3F5F9;
  vertical-align: middle;
  color: var(--text-2);
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #FAFBFD; }

/* ── Badges ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .03em;
  font-family: 'Space Grotesk', sans-serif;
}

.badge-success { background: rgba(15,158,110,.10); color: #0F9E6E; }
.badge-danger  { background: rgba(229,72,77,.10);  color: #E5484D; }
.badge-warning { background: rgba(245,158,11,.10); color: #D97706; }
.badge-info    { background: rgba(37,99,235,.10);  color: #1d4ed8; }
.badge-muted   { background: #F1F4F9; color: #6B7689; border: 1px solid #E3E8F0; }

/* ── Filtres par colonne (Excel-like) — onglet Détail appels ─────────── */
th.th-filterable { position: relative; }
.th-cell { display: flex; align-items: center; justify-content: space-between; gap: .3rem; }
.th-cell-label { cursor: pointer; user-select: none; display: inline-flex; align-items: center; }
.th-cell-label:hover { color: #2563eb; }
.th-filter-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px; border: none;
  background: transparent; color: #B7BFCC; cursor: pointer; flex-shrink: 0;
  transition: background .12s, color .12s;
}
.th-filter-btn:hover { background: #EDF0F5; color: #2563eb; }
.th-filter-btn.active { color: #2563eb; background: rgba(37,99,235,.12); }
.th-filter-btn .material-symbols-outlined { font-size: .82rem; }

.colf-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 600;
  background: #fff; border: 1px solid #E3E8F0; border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15,23,42,.14); padding: .6rem;
  width: 240px; font-family: 'IBM Plex Sans', sans-serif; text-transform: none;
  letter-spacing: normal; font-weight: 400; color: var(--text-2); font-size: .82rem;
}
.colf-panel input[type="text"],
.colf-panel input[type="number"],
.colf-panel input[type="datetime-local"] {
  width: 100%; font-size: .82rem; padding: .3rem .5rem;
  border: 1px solid #E3E8F0; border-radius: 6px; box-sizing: border-box;
}
.colf-panel .colf-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.colf-panel .colf-list {
  max-height: 190px; overflow-y: auto; border: 1px solid #EDF0F5; border-radius: 6px;
  margin: .35rem 0; padding: .25rem;
}
.colf-panel .colf-item {
  display: flex; align-items: center; gap: .4rem; padding: .22rem .3rem;
  border-radius: 5px; cursor: pointer; font-size: .8rem;
}
.colf-panel .colf-item:hover { background: #FAFBFD; }
.colf-panel .colf-item span.colf-count { margin-left: auto; color: #9AA4B5; font-size: .7rem; font-family: 'Space Grotesk', sans-serif; }
.colf-panel .colf-actions { display: flex; gap: .35rem; margin-top: .45rem; }
.colf-panel .colf-actions button { flex: 1; font-size: .76rem; padding: .3rem .4rem; }
.colf-panel .colf-empty { color: #9AA4B5; font-size: .78rem; padding: .4rem .2rem; text-align: center; }
.colf-panel .colf-loading { color: #9AA4B5; font-size: .78rem; padding: .4rem .2rem; text-align: center; }
#appels-table-card.ap-loading { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* ── Colonnes déplaçables / redimensionnables — onglet Détail appels ─────── */
.th-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: grab; color: #C4CADA; flex-shrink: 0; margin-right: 1px;
}
.th-drag-handle:hover { color: #6B7689; }
.th-drag-handle:active { cursor: grabbing; }
.th-drag-handle .material-symbols-outlined { font-size: .95rem; }
.th-resize-handle {
  position: absolute; top: 0; right: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 2;
}
.th-resize-handle:hover { background: rgba(37,99,235,.25); }

/* Grille contenue : le tableau défile (vertical + horizontal) DANS le card, avec
   en-tête collant — la barre de défilement horizontale reste ainsi toujours à
   portée, sans avoir à descendre en bas d'une page de 50 lignes pour l'atteindre.
   Redimensionnable en largeur ET hauteur (poignée native du navigateur, coin bas-
   droit) : le .card parent doit laisser déborder le contenu (overflow visible) —
   il n'y a pas de marge libre à droite (.content occupe déjà 100% de la largeur
   dispo), donc élargir au-delà fait apparaître un défilement horizontal de page,
   toujours accessible en bas de la fenêtre (contrairement à l'ancien problème,
   qui venait d'une page trop haute, pas trop large). La sidebar reste fixe/au-
   dessus (position:fixed, z-index supérieur) pendant ce défilement. */
#appels-table-card { overflow: visible; }
#appels-table-card .table-wrap {
  background: #fff;
  overflow-x: auto;
  overflow-y: auto;
  width: min(100%, 1600px);
  height: min(64vh, 640px);
  min-width: 480px;
  min-height: 220px;
  max-height: 85vh;
  resize: both;
}
#appels-table-card thead th { position: sticky; top: 0; z-index: 3; }
th.th-filterable.ap-drag-over { background: rgba(37,99,235,.12); }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  letter-spacing: .01em;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: all .18s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) !important; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.25);
}
.btn-primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 6px 20px rgba(37,99,235,.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.2);
}
.btn-accent:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(229,72,77,.2);
}
.btn-danger:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.btn-outline {
  background: #fff;
  color: #5A6478;
  border: 1px solid #DCE2EC;
}
.btn-outline:hover {
  background: #F8FAFC;
  border-color: #C5CDDC;
}

.btn-sm {
  padding: .32rem .7rem;
  font-size: .8rem;
}

/* ── Forms ────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.form-group label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .01em;
}

.form-control {
  width: 100%;
  padding: .55rem .9rem;
  border: 1px solid #DCE2EC;
  border-radius: 9px;
  font-size: .875rem;
  background: #FBFCFE;
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: var(--shadow-glow-blue);
}

.form-control::placeholder { color: #B6BECC; }
select.form-control { cursor: pointer; }

/* ── Filters bar ── */
.filters-bar {
  margin-bottom: 1rem;
}

/* Compact one-line filter bar (Cockpit style) */
.filters {
  padding: 11px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.filter-group label,
.filter-actions label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #9AA4B5;
  margin-bottom: 0;
}

.filter-inputs-row {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.filter-inputs-row .separator {
  color: #B6BECC;
  font-size: .85rem;
}

.filter-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.filters-excl {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 14px 11px;
  border-top: 1px solid #EDF0F5;
  margin-top: 4px;
  padding-top: 11px;
}

.btn-link-small {
  background: none;
  border: none;
  color: var(--blue);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: opacity 0.2s;
  display: inline-block;
}
.btn-link-small:hover { opacity: 0.7; }

/* Jours row */
.filters-jours {
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 14px 11px;
}

.jour-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: #F1F4F9;
  border: none;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
  color: #B6BECC;
  font-family: 'IBM Plex Sans', sans-serif;
}
.jour-checkbox:hover { background: #E3E8F0; color: #6B7689; }
.jour-checkbox.active {
  background: var(--blue);
  color: #fff;
}
.jour-checkbox input[type="checkbox"] { display: none; }

/* Modern Switch */
.modern-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  background: #F1F4F9;
  border: none;
  border-radius: 8px;
  transition: all .15s;
}
.modern-switch-wrapper:hover { background: #E3E8F0; }
.modern-switch-wrapper.active {
  background: var(--blue-dim);
  color: var(--blue-dark);
}
.modern-switch-text {
  font-size: .75rem;
  font-weight: 600;
  color: #9AA4B5;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.modern-switch-wrapper.active .modern-switch-text { color: var(--blue-dark); }
.modern-switch {
  position: relative;
  width: 30px; height: 17px;
  background-color: #CBD5E1;
  border-radius: 20px;
  transition: background .25s cubic-bezier(.4,0,.2,1);
}
.modern-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  background: white;
  border-radius: 50%;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
input[type="checkbox"]:checked + .modern-switch { background: var(--blue); }
input[type="checkbox"]:checked + .modern-switch::after { transform: translateX(13px); }
.modern-switch-input { display: none; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.form-hint {
  font-size: .74rem;
  color: var(--muted);
  margin-top: .2rem;
}

/* ── Filters — panneau réductible ─────────── */
.filters-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 14px;
  gap: .75rem;
  border-bottom: 1px solid #EDF0F5;
}
.filters-bar-header-left {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex: 1;
}
.filter-active-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  min-width: 0;
}
.filter-summary-badge {
  display: inline-flex;
  align-items: center;
  background: var(--blue-dim);
  color: var(--blue-dark);
  border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--radius-full);
  padding: .2rem .7rem;
  font-size: .76rem;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 600px;
}
.filters-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

/* ── Export ───────────────────────────────── */
.export-section-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s, border-color .15s;
  background: #fff;
  user-select: none;
}
.export-section-check:hover { background: var(--blue-dim); border-color: rgba(37,99,235,.3); }
.export-section-check.checked { background: var(--blue-dim); border-color: var(--blue); color: var(--blue-dark); }
.export-section-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }

/* ── Charts ───────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 280px;
}

/* ── Alerts ───────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: 10px;
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-family: 'IBM Plex Sans', sans-serif;
}
.alert-success { background: rgba(15,158,110,.07); border-color: rgba(15,158,110,.2); color: #065F46; }
.alert-danger  { background: rgba(229,72,77,.07);  border-color: rgba(229,72,77,.2);  color: #9F1239; }
.alert-info    { background: rgba(37,99,235,.06);  border-color: rgba(37,99,235,.18); color: #1e40af; }
.alert-warning { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.2); color: #78350F; }

/* ── Dashboard Tabs ───────────────────────── */
.tabs {
  display: flex;
  gap: .1rem;
  border-bottom: 1px solid #D7DDE8;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(233,237,244,.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-left: -1.75rem;
  margin-right: -1.75rem;
  padding-left: 1.75rem;
  padding-right: 1.75rem;
  padding-top: .2rem;
  margin-bottom: 1.25rem;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 11px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .855rem;
  font-weight: 500;
  color: #7B8499;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  font-family: 'IBM Plex Sans', sans-serif;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tabs-spacer { flex: 1; min-width: .5rem; }

.tab-btn-export {
  display: inline-flex;
  align-items: center;
  border-left: 1px solid #D7DDE8;
  margin-left: .25rem;
  padding-left: 1rem;
  color: var(--blue);
  font-weight: 600;
}
.tab-btn-export:hover { color: var(--indigo); }
.tab-btn-export.active { border-bottom-color: var(--blue); }

/* ── Login page ───────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: #E9EDF4;
  background-image:
    radial-gradient(at 20% 30%, hsla(228,100%,74%,0.22) 0px, transparent 50%),
    radial-gradient(at 80% 10%, hsla(189,100%,56%,0.18) 0px, transparent 50%),
    radial-gradient(at 10% 70%, hsla(340,100%,76%,0.14) 0px, transparent 50%),
    radial-gradient(at 90% 70%, hsla(242,100%,70%,0.16) 0px, transparent 50%);
}

.login-box {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255,255,255,.82);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(37,99,235,.10), 0 8px 24px rgba(15,23,42,.06);
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-box .brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-box .brand .brand-logo {
  display: flex; align-items: center; justify-content: center;
  gap: .7rem; margin-bottom: .6rem;
}

.login-box .brand .brand-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(37,99,235,.35);
}

.login-box .brand .brand-icon .material-symbols-outlined {
  font-size: 22px; color: #fff;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.login-box .brand h1 {
  font-size: 1.6rem; font-weight: 700;
  color: var(--text); letter-spacing: -.03em;
  font-family: 'Space Grotesk', sans-serif;
}

.login-box .brand h1::before { display: none; }

.login-box .brand p {
  font-size: .83rem; color: var(--muted); margin-top: .35rem;
}

/* ── Pagination ───────────────────────────── */
.pagination {
  display: flex; align-items: center;
  gap: .35rem; flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: .3rem .65rem;
  border-radius: 8px;
  font-size: .8rem;
  font-family: 'Space Grotesk', monospace;
  text-decoration: none;
  color: #6B7689;
  border: 1px solid #DCE2EC;
  background: #fff;
  transition: all .15s;
}

.pagination a:hover {
  background: #F8FAFC;
  color: var(--blue);
  border-color: rgba(37,99,235,.3);
}

.pagination .current {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600;
}

/* ── Toast / Notifications ────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  background: rgba(255,255,255,.95);
  border: 1px solid #E3E8F0;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: .85rem 1.1rem;
  font-size: .875rem;
  color: var(--text);
  pointer-events: auto;
  display: flex; align-items: center;
  gap: .6rem;
  min-width: 280px; max-width: 380px;
  animation: toast-slide-in .25s ease;
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Utilities ────────────────────────────── */
.text-muted   { color: var(--muted) !important; }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-right   { text-align: right; }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex       { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.align-center { align-items: center; }
.gap-1        { gap: .5rem; }
.gap-2        { gap: 1rem; }
.flex-1       { flex: 1; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
  .topbar { padding: 12px 1rem 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Dataset toggles répartition ─────────── */
.rep-toggle {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: .77rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, filter .2s;
  font-family: 'IBM Plex Sans', sans-serif;
  border-width: 1.5px;
  border-style: solid;
  white-space: nowrap;
}
.rep-toggle:not(.active) {
  opacity: .28;
  filter: grayscale(.6);
}
.rep-toggle:hover {
  opacity: 1 !important;
  filter: none !important;
}

/* ── Reduced Motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
