/* ═══════════════════════════════════════════════════════════════
   GestPlan — Enhance v5 (Phase 1 : densité + hiérarchie)
   Chargé APRÈS app.css — override ciblé, pas de rewrite
═══════════════════════════════════════════════════════════════ */

:root {
  /* Palette priorité (pour barres latérales) */
  --prio-urgent: #dc2626;
  --prio-high:   #f59e0b;
  --prio-normal: #64748b;
  --prio-low:    #94a3b8;

  /* Couleurs techniciens (10 slots) — exposées comme custom props
     pour cohérence CSS pure, sans passer par JS */
  --tech-0: #3b82f6; /* bleu */
  --tech-1: #10b981; /* vert */
  --tech-2: #f59e0b; /* ambre */
  --tech-3: #8b5cf6; /* violet */
  --tech-4: #ec4899; /* rose */
  --tech-5: #06b6d4; /* cyan */
  --tech-6: #84cc16; /* lime */
  --tech-7: #f97316; /* orange */
  --tech-8: #6366f1; /* indigo */
  --tech-9: #14b8a6; /* teal */

  /* Tokens densité réglables d'un coup */
  --density-pad-y: 8px;
  --density-pad-x: 14px;
  --density-gap:   10px;
}

/* ── Interventions : densité + hiérarchie par statut/priorité ── */
.inter-item {
  padding: var(--density-pad-y) var(--density-pad-x);
  gap: 12px;
  border-left-width: 4px;
  position: relative;
}
.inter-item.prio-urgent { border-left-color: var(--prio-urgent); }
.inter-item.prio-urgent::after {
  content: '●';
  position: absolute;
  top: 6px; right: 10px;
  color: var(--prio-urgent);
  font-size: 14px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.inter-item-title { font-size: 13px; line-height: 1.35; }
.inter-item-meta  { font-size: 11.5px; gap: 8px; }
.inter-item-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.inter-item-meta > span::before { opacity: 0.6; font-size: 11px; }

/* Groupes par statut (si on ajoute <div class="inter-group" data-status="..."> ) */
.inter-group { margin-bottom: 16px; }
.inter-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-bottom: 6px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.inter-group-header .count {
  margin-left: auto;
  background: var(--border);
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px;
}
.inter-group[data-status="pending"]   .inter-group-header { color: var(--blue);   border-bottom-color: var(--blue-light); }
.inter-group[data-status="reserved"]  .inter-group-header { color: var(--amber);  border-bottom-color: var(--amber-light); }
.inter-group[data-status="confirmed"] .inter-group-header { color: var(--green);  border-bottom-color: var(--green-light); }
.inter-group[data-status="done"]      .inter-group-header { color: var(--text-hint); }
.inter-group[data-status="cancelled"] .inter-group-header { color: var(--red);    border-bottom-color: var(--red-light); }

/* Tech avatar chips (cohérents partout) */
.tech-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--text);
}
.tech-chip-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--tech-color, var(--tech-0));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}
.tech-chip[data-tech="0"] { --tech-color: var(--tech-0); }
.tech-chip[data-tech="1"] { --tech-color: var(--tech-1); }
.tech-chip[data-tech="2"] { --tech-color: var(--tech-2); }
.tech-chip[data-tech="3"] { --tech-color: var(--tech-3); }
.tech-chip[data-tech="4"] { --tech-color: var(--tech-4); }
.tech-chip[data-tech="5"] { --tech-color: var(--tech-5); }
.tech-chip[data-tech="6"] { --tech-color: var(--tech-6); }
.tech-chip[data-tech="7"] { --tech-color: var(--tech-7); }
.tech-chip[data-tech="8"] { --tech-color: var(--tech-8); }
.tech-chip[data-tech="9"] { --tech-color: var(--tech-9); }

/* ── Dashboard hero KPIs (3 chiffres qui comptent) ── */
.stats-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: all .18s;
  position: relative;
  overflow: hidden;
}
.kpi-hero::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  opacity: 0.06;
  background: currentColor;
}
.kpi-hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-width: 6px;
}
.kpi-hero.kpi-ca     { border-left-color: var(--green); color: var(--green); }
.kpi-hero.kpi-alert  { border-left-color: var(--red);   color: var(--red); }
.kpi-hero.kpi-warn   { border-left-color: var(--amber); color: var(--amber); }
.kpi-label {
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 34px; font-weight: 800;
  line-height: 1.05;
  color: inherit;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
/* Valeur "0" = moins prononcée sur les KPI alerte/warn (plus rassurant) */
.kpi-alert .kpi-value:where([data-val="0"]),
.kpi-warn  .kpi-value:where([data-val="0"]) {
  color: var(--text-hint);
  opacity: 0.6;
}

/* ── Stats chips (secondaires compactes) ── */
.stats-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.stat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
}
.stat-chip:hover {
  background: var(--bg);
  border-color: var(--border-md);
}
.chip-label { color: var(--text-muted); font-weight: 500; }
.chip-value { font-weight: 700; font-size: 14px; color: var(--text); }
.chip-value[data-color="teal"]   { color: var(--teal); }
.chip-value[data-color="blue"]   { color: var(--blue); }
.chip-value[data-color="amber"]  { color: var(--amber); }
.chip-value[data-color="red"]    { color: var(--red); }
.chip-value[data-color="green"]  { color: var(--green); }
.chip-value[data-color="muted"]  { color: var(--text-hint); font-weight: 500; }
.stat-chip:has(.chip-value[data-val="0"]) { opacity: 0.55; }

@media (max-width: 900px) {
  .stats-hero { grid-template-columns: 1fr; gap: 10px; }
  .kpi-value { font-size: 28px; }
  .kpi-hero { padding: 14px; }
}

/* ── Cards / Stats densité ── */
.card { padding: 14px; border-radius: var(--radius); }
.card-header { margin-bottom: 10px; }
.stat-card { padding: 12px 14px; }
.stat-label { font-size: 11px; margin-bottom: 4px; }
.stat-value { font-size: 22px; }
.stat-card .trend {
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 100px;
  display: inline-block; margin-top: 4px;
}
.stat-card .trend.up   { color: var(--green); background: var(--green-light); }
.stat-card .trend.down { color: var(--red);   background: var(--red-light); }

/* ── Table densité ── */
th { padding: 8px 12px; font-size: 10.5px; }
td { padding: 8px 12px; font-size: 12.5px; }
tr:hover td { background: var(--blue-light); }

/* ── Boutons harmonisés ── */
.btn { padding: 6px 12px; font-size: 12.5px; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }

/* ── Focus states accessibles ── */
.btn:focus-visible,
.filter-chip:focus-visible,
.tab:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--blue-mid);
  outline-offset: 2px;
}

/* ── Week calendar events plus compacts + colorés par tech ── */
.wcal-event, .dcal-event {
  border-left: 3px solid var(--tech-color, var(--tech-0)) !important;
  padding: 4px 6px !important;
  font-size: 10.5px !important;
  line-height: 1.25 !important;
}
.wcal-event:hover, .dcal-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  transition: all 0.12s;
}
/* 2026-05-12 : tuile enrichie — OT du DO + client + ville visibles d'un coup */
.wcal-event .wcal-ev-ot {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: rgba(255,255,255,.55);
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10.5px;
}
.wcal-event .wcal-ev-client {
  font-size: 10.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  opacity: 0.95;
}
.wcal-event .wcal-ev-loc {
  font-size: 10px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ── Toolbar plus plate ── */
.calendar-toolbar { margin-bottom: 10px; }
.filter-bar { margin-bottom: 10px; }
.page-header { margin-bottom: 14px; }
.page-header-left h1 { font-size: 20px; }

/* ── Vue switcher : tabs plus compactes ── */
#planning-subtabs .tab,
.plan-view-switch .tab {
  padding: 6px 12px; font-size: 12px;
}

/* ── Timeline / Gantt view (Phase 2) ── */
.gantt-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.gantt-header {
  display: grid;
  grid-template-columns: 160px 1fr;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.gantt-header-tech {
  padding: 10px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.gantt-header-hours {
  display: grid;
  grid-template-columns: repeat(15, 1fr); /* 7h → 21h = 15 colonnes */
  position: relative;
}
.gantt-hour {
  padding: 8px 4px;
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  border-left: 1px solid var(--border);
}
.gantt-hour:first-child { border-left: none; }

.gantt-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: var(--blue-light); }
.gantt-tech-cell {
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky; left: 0; z-index: 5;
}
.gantt-tech-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--tech-color, var(--tech-0));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.gantt-tech-name { font-size: 12px; font-weight: 600; }
.gantt-tech-count { font-size: 10px; color: var(--text-muted); }

.gantt-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(100%/15 - 1px),
    var(--border) calc(100%/15 - 1px),
    var(--border) calc(100%/15)
  );
}
.gantt-event {
  position: absolute;
  top: 6px; bottom: 6px;
  background: var(--tech-color, var(--tech-0));
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  transition: all 0.15s;
  z-index: 2;
}
.gantt-event:hover {
  transform: scale(1.04);
  z-index: 5;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.gantt-event-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.gantt-event-sub   { font-size: 9.5px; opacity: .88; overflow: hidden; text-overflow: ellipsis; }
.gantt-event.status-done       { opacity: 0.55; }
.gantt-event.status-cancelled  { opacity: 0.35; text-decoration: line-through; }
.gantt-event.status-urgent::before {
  content: '';
  position: absolute;
  top: 2px; right: 2px;
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--red);
  animation: pulse 1.5s infinite;
}
.gantt-now-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--red);
  z-index: 3;
  pointer-events: none;
}
.gantt-now-line::before {
  content: '';
  position: absolute;
  top: -4px; left: -4px;
  width: 10px; height: 10px;
  background: var(--red);
  border-radius: 50%;
}

.gantt-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Matrice prix par type × donneur ── */
.price-matrix {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}
.price-matrix thead th {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.price-matrix thead tr:nth-child(2) th {
  top: 36px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.price-matrix thead th.col-do {
  border-left: 2px solid var(--border-md);
  text-align: center;
}
.price-matrix thead th.col-achat,
.price-matrix thead th.col-vente { text-align: center; }
.price-matrix thead th.col-achat { border-left: 2px solid var(--border-md); }
.price-matrix tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.price-matrix td.col-type {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  border-right: 2px solid var(--border-md);
  padding: 6px 10px;
  min-width: 200px;
  max-width: 240px;
}
.price-matrix td.col-duration {
  padding: 6px 10px;
  color: var(--text-muted);
  white-space: nowrap;
  border-right: 2px solid var(--border-md);
}
.price-matrix td.col-achat { border-left: 2px solid var(--border-md); }
.price-matrix td.col-achat input,
.price-matrix td.col-vente input {
  width: 72px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: right;
  background: var(--surface);
  transition: background .12s;
}
.price-matrix td.col-achat input:focus,
.price-matrix td.col-vente input:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 2px rgba(0,71,127,.12);
}
.price-matrix td.col-vente input { color: var(--green); font-weight: 600; }
.price-matrix td.col-achat input { color: var(--red); }
.price-matrix tbody tr:hover td { background: #f8fafc; }
.price-matrix tbody tr:hover td.col-type { background: var(--blue-light); }

/* ── Mobile : cartes swipeables jour ── */
@media (max-width: 900px) {
  .mobile-day-cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 4px 12px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-day-cards::-webkit-scrollbar { display: none; }
  .mobile-day-card {
    scroll-snap-align: center;
    flex: 0 0 calc(100vw - 56px);
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex; flex-direction: column;
    min-height: 340px;
  }
  .mobile-day-card-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 10px;
  }
  .mobile-day-card-date {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted);
  }
  .mobile-day-card-num {
    font-size: 28px; font-weight: 800; color: var(--blue);
    line-height: 1;
  }
  .mobile-day-card-count {
    background: var(--blue-light);
    color: var(--blue);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 11px; font-weight: 700;
  }
  .mobile-day-card .inter-item {
    padding: 8px 10px;
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
  }
  .mobile-day-card.is-today {
    border: 2px solid var(--blue);
  }

  /* Page indicator pour les swipe cards */
  .mobile-day-dots {
    display: flex; justify-content: center; gap: 6px;
    padding: 6px 0 10px;
  }
  .mobile-day-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border-md);
    transition: all .2s;
  }
  .mobile-day-dot.active {
    background: var(--blue);
    width: 20px; border-radius: 100px;
  }
}

/* ════════════════════════════════════════════════════════════
   MOBILE THUMB-FRIENDLY — iPhone 12 (390px) et similaires
   Transforme tableaux en cards, bouton gros pour le pouce,
   bottom-sheet pour modals, FAB bottom-right
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Tap targets confortables (min 44px = Apple HIG) */
  .btn, .btn-sm, .mobile-nav-item, .nav-item,
  .inter-item, .filter-chip, .tab, .card-header button {
    min-height: 44px;
  }
  .btn { padding: 12px 16px; font-size: 14px; }
  .btn-sm { padding: 10px 14px; font-size: 13px; }

  /* Topbar plus sobre */
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-title { font-size: 15px; font-weight: 700; }
  .topbar-search, .topbar-actions .btn:not(.btn-primary) { display: none; }

  /* Page content : retirer padding lateral = fullwidth */
  .page-content { padding: 10px 8px 84px 8px; } /* bottom padding pour bottom-nav */

  /* ── Tables → cards verticaux ── */
  .table-wrap,
  .table-container {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  .data-table,
  table.gr-table {
    display: block !important;
    border-collapse: collapse;
  }
  .data-table thead,
  table.gr-table thead {
    display: none !important;
  }
  .data-table tbody,
  table.gr-table tbody {
    display: block;
  }
  .data-table tbody tr,
  table.gr-table tbody tr {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-gap: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: 10px;
    padding: 12px !important;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }
  .data-table tbody td,
  table.gr-table tbody td {
    padding: 2px 0 !important;
    border: none !important;
    font-size: 13px !important;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: block;
  }
  /* Première cellule = header (date/heure ou N°) */
  .data-table tbody tr > td:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
    color: var(--blue);
    font-size: 14px !important;
    padding-bottom: 6px !important;
    border-bottom: 1px dashed var(--border) !important;
    margin-bottom: 4px;
  }
  /* Dernière cellule (statut/badge) flottante en haut à droite */
  .data-table tbody tr > td:last-child {
    position: absolute;
    top: 10px; right: 10px;
  }
  .data-table tbody tr {
    position: relative;
  }

  /* ── Inter list items : plus de place, plus de respiration ── */
  .inter-list { gap: 0; }
  .inter-item {
    padding: 14px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  .inter-item-title { font-size: 14px; line-height: 1.35; }
  .inter-item-meta { font-size: 12px; }
  .inter-item-right { position: static; }

  /* ── Modals → bottom sheet ── */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
    max-height: 92vh;
    display: flex; flex-direction: column;
    animation: slideUp .25s cubic-bezier(.34,1.56,.64,1);
  }
  .modal-header {
    position: sticky; top: 0;
    background: var(--surface); z-index: 2;
    padding-top: 16px !important;
  }
  .modal-header::before {
    content: '';
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px;
    background: var(--border-md);
    border-radius: 100px;
  }
  .modal-footer {
    position: sticky; bottom: 0;
    background: var(--surface);
    padding-bottom: max(14px, var(--safe-bottom));
    border-top: 1px solid var(--border);
    z-index: 2;
  }
  .modal-footer .btn {
    flex: 1;
  }

  /* ── Floating Action Button (création rapide) ── */
  .mobile-fab {
    display: flex !important;
    width: 56px; height: 56px;
    right: 16px;
    bottom: calc(78px + var(--safe-bottom)) !important;
    font-size: 24px;
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0,71,127,.35);
    z-index: 250;
    align-items: center; justify-content: center;
    border: none;
  }
  .mobile-fab:active { transform: scale(.93); }

  /* ── Filtres / chips : wrap sur 2 lignes ── */
  .filter-bar { gap: 6px; }
  .filter-chip {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Tabs (dans interventions, config...) scrollables horizontalement */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 16px; font-size: 13px; flex-shrink: 0; }

  /* Inputs plus gros pour doigt */
  .form-input, .form-select, .form-textarea {
    padding: 12px 14px;
    font-size: 15px; /* iOS ne zoom pas si >= 16px, mais 15 OK pour place */
    min-height: 44px;
  }
  .form-input[type="date"], .form-input[type="time"] { min-height: 44px; }

  /* Stats-hero en carte unique empilée */
  .stats-hero { grid-template-columns: 1fr !important; gap: 8px; margin-bottom: 10px; }
  .kpi-hero { padding: 12px 14px; }
  .kpi-value { font-size: 26px; }

  /* Stats-chips : scroll horizontal */
  .stats-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .stats-chips::-webkit-scrollbar { display: none; }
  .stat-chip { flex-shrink: 0; white-space: nowrap; }

  /* Cards stats (dashboard) pleine largeur empilées */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .stat-card { padding: 10px 12px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 22px; }

  /* Grid 2 colonnes → 1 sur mobile */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1.3fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .detail-panel { grid-template-columns: 1fr !important; }
  .form-row, .form-row-3 { grid-template-columns: 1fr !important; }

  /* Bottom nav ombre + taille */
  .mobile-bottom-nav {
    height: calc(64px + var(--safe-bottom)) !important;
    box-shadow: 0 -4px 16px rgba(0,0,0,.12);
  }
  .mobile-nav-item {
    font-size: 11px; font-weight: 700;
    min-height: 64px;
  }
  .mobile-nav-item svg { width: 24px; height: 24px; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE FORCE-HIDE SIDEBAR — override belt-and-braces
   Pour petits écrans (≤ 900px) : sidebar cachée quoi qu'il arrive,
   main-area full-width, content scrollable sans débordement latéral.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Drawer : sidebar glissable depuis le bord gauche */
  .sidebar {
    display: flex !important;
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 280px !important;
    max-width: 85vw;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
    height: 100vh !important;
    overflow-y: auto;
  }
  .sidebar.drawer-open { transform: translateX(0); }
  /* Overlay sombre quand drawer ouvert */
  .drawer-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
    animation: fadeIn .2s ease;
  }
  .drawer-overlay.visible { display: block; }
  /* Bouton burger dans la topbar */
  .drawer-burger {
    display: flex !important;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 20px;
    color: var(--text);
  }
  .drawer-burger:active { background: var(--bg); }

  .app-layout { flex-direction: column !important; }
  .main-area {
    width: 100% !important;
    max-width: 100vw !important;
    padding-bottom: calc(70px + var(--safe-bottom)) !important;
    margin-left: 0 !important;
  }
  .page-content {
    padding: 10px 10px calc(90px + var(--safe-bottom)) 10px !important;
    max-width: 100vw;
    overflow-x: hidden;
  }
  /* Topbar compacte */
  .topbar {
    flex-wrap: wrap;
    padding: 6px 10px !important;
    gap: 8px;
  }
  .topbar-title { font-size: 15px !important; flex: 1; }
  .topbar-search, .topbar > input[type="search"] { display: none !important; }
  .topbar-actions .btn-primary {
    padding: 8px 12px;
    font-size: 12px;
  }
  body, html { overflow-x: hidden; }
}
/* Burger + logout cachés en desktop */
.drawer-burger, .drawer-logout { display: none; }

/* Bouton logout mobile */
@media (max-width: 900px) {
  .drawer-logout {
    display: flex !important;
    align-items: center; justify-content: center;
    height: 40px;
    padding: 0 14px;
    background: #fff;
    border: 1.5px solid var(--red);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--red);
    margin-left: auto;
  }
  .drawer-logout:active { background: var(--red-light); }
}

/* ═══════════════════════════════════════════════════════════
   TABLEAU EXCEL — Style universel pour tous les data-table
   En-tête coloré, lignes alternées, bordures, filtre ▼
   ═══════════════════════════════════════════════════════════ */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border: 1px solid #c7d2e0;
}

/* En-tête bleu Bouygues + texte blanc */
table.data-table thead tr {
  background: #00477F;
  color: #fff;
}
table.data-table thead th {
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: #fff !important;
  border-right: 1px solid rgba(255,255,255,.18);
  border-bottom: none;
  white-space: nowrap;
}
table.data-table thead th:last-child { border-right: none; }

/* Bouton filtre ▾ visible sur fond sombre */
table.data-table thead th button {
  color: rgba(255,255,255,.65) !important;
  background: none !important;
}
table.data-table thead th button:hover {
  color: #fff !important;
  background: rgba(255,255,255,.15) !important;
}
/* Filtre actif */
table.data-table thead th button[style*=00477F],
table.data-table thead th button[innerHTML*=●] {
  color: #ffd700 !important;
}

/* Lignes alternées (zèbre) */
table.data-table tbody tr:nth-child(odd)  { background: #ffffff; }
table.data-table tbody tr:nth-child(even) { background: #eef4fb; }

/* Hover ligne */
table.data-table tbody tr:hover td { background: #d0e4f7 !important; }

/* Cellules */
table.data-table tbody td {
  padding: 5px 10px;
  font-size: 12px;
  border-right: 1px solid #d1dce9;
  border-bottom: 1px solid #d1dce9;
  vertical-align: middle;
}
table.data-table tbody td:last-child { border-right: none; }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* Checkbox colonne sélection */
table.data-table th.col-check,
table.data-table td.col-check {
  width: 32px;
  text-align: center;
  padding: 4px 6px;
  border-right: 1px solid rgba(255,255,255,.18);
}
table.data-table td.col-check { border-right: 1px solid #d1dce9; }

/* Flèches de tri dans l'en-tête */
table.data-table thead th span[style*=opacity] { color: #fff; }

