body { font-family: Segoe UI, Roboto, Arial, sans-serif; margin:0; background:#f7f9fb; }

/* ══ Dropzones ════════════════════════════════════════════════════════════════ */
.dz-wrap {
  cursor:pointer; transition:border-color .15s, background .15s;
  position:relative; user-select:none;
}
/* Grande zone */
.dz-full {
  border:2px dashed #cbd5e1; border-radius:10px; padding:22px 18px;
  background:#f8fafc; text-align:center;
}
.dz-full:hover, .dz-full.dz-over { border-color:#3b82f6; background:#eff6ff; }
.dz-full.dz-ok  { border-color:#10b981; background:#f0fdf4; }
.dz-full.dz-err { border-color:#ef4444; background:#fef2f2; }
.dz-icon-big   { font-size:2em; margin-bottom:6px; }
.dz-label      { font-weight:700; font-size:.9em; color:#374151; margin-bottom:4px; }
.dz-existing   { font-size:.82em; margin-bottom:4px; }
.dz-hint       { font-size:.78em; color:#9ca3af; }
.dz-formats    { font-size:.72em; color:#d1d5db; margin-top:4px; letter-spacing:.05em; }
.dz-status     { font-size:.8em; margin-top:8px; min-height:1.2em; font-weight:600; }
.dz-file-link  { color:#3b82f6; font-weight:600; text-decoration:none; }
.dz-file-link:hover { text-decoration:underline; }

/* Version compacte */
.dz-compact {
  display:inline-flex; align-items:center; gap:8px;
  border:1.5px dashed #cbd5e1; border-radius:8px;
  padding:6px 12px; background:#f8fafc; font-size:.82em;
}
.dz-compact:hover, .dz-compact.dz-over { border-color:#3b82f6; background:#eff6ff; }
.dz-compact.dz-ok  { border-color:#10b981; background:#f0fdf4; }
.dz-compact.dz-err { border-color:#ef4444; background:#fef2f2; }
.dz-compact .dz-icon  { font-size:1.1em; }
.dz-compact .dz-text  { color:#374151; }
.dz-compact .dz-replace { color:#9ca3af; }
.dz-compact .dz-status { min-width:60px; font-weight:600; }
.dz-btn {
  display:inline-block; margin-top:10px; padding:5px 16px;
  background:#fff; border:1.5px solid #cbd5e1; border-radius:6px;
  font-size:.8em; font-weight:600; color:#374151; cursor:pointer;
  pointer-events:all; transition:border-color .12s, background .12s;
}
.dz-full:hover .dz-btn, .dz-full.dz-over .dz-btn { border-color:#3b82f6; color:#1e40af; }
/* ═════════════════════════════════════════════════════════════════════════════ */
.topbar { display:flex; flex-wrap:wrap; row-gap:6px; justify-content:flex-start; align-items:center; padding:10px 16px; background:#1b4b8c; color:#fff; position:sticky; top:0; z-index:99999; box-shadow:0 2px 8px rgba(0,0,0,.18); }
.topbar .brand { font-weight:800; color:#fff; font-size:1.05em; letter-spacing:.04em; }
/* Nav : sur une seule ligne à droite quand il y a la place (format d'avant),
   poussée à droite par margin-left:auto. Quand l'écran manque de place, les
   onglets s'enroulent proprement sur une 2e ligne (logo + recherche restent
   groupés à gauche, le champ de recherche ne se retrouve jamais isolé). */
.nav { display:flex; flex-wrap:wrap; align-items:center; row-gap:4px; margin-left:auto; }
.nav a { color:#cfe3ff; margin-left:12px; text-decoration:none; }
/* Le panneau de résultats de recherche est masqué par défaut ; son affichage est
   piloté en JS (toggle selon la présence de résultats) — voir layout.html.
   On évite :has()/:empty (incompatibles vieux navigateurs / retour à la ligne)
   et le !important (qui empêcherait le toggle JS). */
#search-dropdown { display:none; }
.nav a.active { color:#fff; font-weight:600; }
/* Menus déroulants du bandeau (groupes Finances / Pilotage) */
.nav-group { position:relative; display:inline-block; }
.nav-group .nav-trigger { color:#cfe3ff; margin-left:12px; text-decoration:none; cursor:pointer; user-select:none; white-space:nowrap; }
.nav-group.active .nav-trigger, .nav-group:hover .nav-trigger { color:#fff; font-weight:600; }
.nav-sub { display:none; position:absolute; top:100%; left:12px; margin-top:4px; background:#1b4b8c; min-width:185px; border-radius:8px; box-shadow:0 10px 28px rgba(0,0,0,.28); padding:6px 0; z-index:100000; }
.nav-group:hover .nav-sub, .nav-group.open .nav-sub { display:block; }
.nav-sub a { display:block; margin:0 !important; padding:9px 16px; white-space:nowrap; color:#cfe3ff; }
.nav-sub a:hover { background:rgba(255,255,255,.12); color:#fff; }
.nav-sub a.active { color:#fff; font-weight:700; }
/* Espace éditeur FB&IB : déclutter (masque le métier archi) + bascule debug */
.editor-only { display:none; }
body[data-editeur] .editor-only { display:inline-flex; }
body[data-editeur]:not(.hub-full) .editor-hide { display:none !important; }
/* En vue "Hub complet" (debug), on masque aussi les alertes éditeur (cloche, bannière) */
body.hub-full .editor-alert { display:none !important; }
.container{
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 32px;
  box-sizing: border-box;
}
.container-fluid{
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
  box-sizing: border-box;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr; /* largeur gauche/droite */
  gap: 16px;
  height: calc(100vh - 100px); /* pleine hauteur, en retirant la topbar */
  overflow: hidden;
}

/* Colonne gauche : liste + filtres */
.left {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 12px;
  overflow-y: auto;      /* ✅ scroll indépendant */
  scroll-behavior: smooth;
}

/* Colonne droite : détail */
.right {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 12px;
  overflow-y: auto;      /* ✅ scroll indépendant */
  scroll-behavior: smooth;
  position: relative;
}

/* Ajuste les sections pour bien remplir la hauteur */
.left, .right {
  height: 100%;
}

.filters .grid3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:8px; }
.filters .grid2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }
.w100 { width:100%; padding:8px; }
.table-wrap { margin-top:10px; }
.table { width:100%; border-collapse:collapse; }
.table th, .table td { padding:8px; border-bottom:1px solid #eee; }
.table th { background:#f0f4ff; text-align:left; }
.table td.num, .totals .num { text-align:right; font-variant-numeric: tabular-nums; }
.table tfoot tr.total { background:#f9fbff; font-weight:600; }
.card { border:1px solid #eee; border-radius:10px; overflow:hidden; }
.card-header { display:flex; justify-content:space-between; align-items:center; padding:12px; background:#f8fbff; }
.card-header .title { font-weight:700; }
.card-header .subtitle { color:#666; font-size:13px; }
.card-body { padding:12px; }
.card-body.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.btn.danger { background: #d33; color: #fff; }
.btn.danger:hover { filter: brightness(0.95); }
.btn { padding:8px 12px; background:#e8eefc; border:1px solid #bcd; border-radius:6px; text-decoration:none; color:#123; }
.btn.success { background:#d8f1dd; border-color:#9ccb9e; }
.muted { color:#888; }
/* --- surlignage ligne sélectionnée --- */
.table tr.selected {
  background-color: #cde3ff !important; /* bleu clair */
}

/* Pour les listes (gauche) on garde pointer */
.left .table tr:hover {
    background-color: #eef5ff;
    cursor: pointer;
}

/* Pour la table d'édition des lignes d'un devis : PAS DE CURSEUR POINTEUR */
#edit-lignes-devis table tr:hover {
    background-color: #eef5ff;
    cursor: default !important;
}
#edit-lignes-devis .btn {
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 999999 !important;
}


.summary-bar {
  padding: 6px 10px;
  background: #f5f8ff;
  border: 1px solid #d8e3f7;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #123;
}
.summary-bar b {
  color: #1b4b8c;
}
.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #f5f8ff;
  border: 1px solid #d8e3f7;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #123;
}

.summary-bar b {
  color: #1b4b8c;
}

.summary-actions .btn.export {
  background-color: #d8f1dd;
  border-color: #9ccb9e;
  color: #093;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.summary-actions .btn.export:hover {
  background-color: #bce4c2;
}
.table-wrap {
  max-height: calc(100vh - 260px); /* garde les filtres visibles */
  overflow-y: auto;
}

.detail {
  position: relative;
  min-height: 300px;
}
/* Sticky uniquement dans les pages qui utilisent le layout split */
.split .right {
  position: sticky;
  top: 0;
}

/* Par défaut, .right n'est PAS sticky */
.right {
  position: relative;
}

/* === Effet de transition du panneau de droite === */

/* Animation du fondu + slide */
@keyframes slideInFade {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Classe appliquée automatiquement par HTMX quand le contenu change */
.htmx-added {
  animation: slideInFade 0.25s ease-out;
}

tr.paid { background-color: #e5fbe5; }
tr.issued { background-color: #fff6d3; }
tr.partial { background-color: #fef3c7; }
tr.draft { background-color: #f0f0f0; color: #666; }
.restant-badge { color: #b45309; font-weight: 600; font-size: 0.82em; }
tr.selected { outline: 2px solid #0066cc; }

/* --- Statuts devis --- */
tr.draft {
  background-color: #f0f0f0;   /* brouillon = gris clair */
  color: #666;
}
tr.sent {
  background-color: #fff7cc;   /* envoyé = jaune clair */
}
tr.validated {
  background-color: #dff6e0;   /* validé = vert clair */
}
tr.rejected {
  background-color: #ffd9d9;   /* refusé = rouge clair */
}

/* --- Surlignage de la ligne sélectionnée --- */
.table tr.selected {
  outline: 2px solid #0066cc;
  outline-offset: -2px;
}

/* --- transition douce --- */
.table tr {
  transition: background-color 0.3s ease;
}

/* --- Animation flash lorsqu'une facture vient d'être ouverte --- */

.flash-highlight {
  animation: flash-bg 1s ease-out;
}

@keyframes flash-bg {
  0%   { background-color: #fff3a3; }   /* jaune clair */
  100% { background-color: transparent; }
}
.extra-badge {
  display: inline-block;
  padding: 2px 6px;
  margin-left: 6px;
  background: #1b4b8c;
  color: white;
  font-size: 12px;
  border-radius: 10px;
  font-weight: 600;
}
/* --- Lignes ajoutées lors de la facturation --- */
.extra-line {
  background-color: #f3f3f3 !important; /* gris clair agréable */
  font-style: italic;
}

.extra-tag {
  background: #1b4b8c;
  color: white;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 11px;
  margin-left: 6px;
}
/* ==== ALIGNEMENT COLONNES NUMÉRIQUES ==== */

/* Colonnes NON numériques = alignées à gauche */
.table th,
.table td {
    text-align: left;
}

/* Colonnes numériques = alignées à droite */
.table th.num,
.table td.num {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    padding-right: 12px;
}
.test-border {
    border: 5px solid red !important;
}
.table input[type="number"] {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.table input {
    padding: 4px 6px;
}
/* Alignement pro des inputs numériques */
.table input[type="number"] {
    text-align: right !important;
    padding-right: 6px;
    font-variant-numeric: tabular-nums;
}
/* Colonnes du tableau d'édition de devis — RETIRÉ le 06/08/2026.
   Ce bloc forçait 90px sur les colonnes 3 à 6 et entrait en conflit avec le
   <colgroup> généré par routers/devis.py (_lignes_html) : selon le contexte
   l'un ou l'autre l'emportait, d'où des colonnes Qté/PU/TVA imprévisibles.
   Les largeurs sont désormais définies à un seul endroit, dans devis.py
   (bloc <style> de .devis-lines-wrap). Ne pas réintroduire ici. */

/* Forcer les boutons à être vraiment cliquables */
.table td {
    position: relative;
}

.btn {
    position: relative;
    z-index: 10 !important;
}
/* Désactive le wrapper fantôme <Buttons> */

/* Et réactive les vrais boutons */
.btn {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 999 !important;
}

.btn {
    position: relative !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
}


/* =========================================================
   ACTION BAR (DEVIS) : GRID PROPRE, PAS DE BOUTON ORPHELIN
   ========================================================= */

.action-bar{
  margin-top: 15px;
  display: grid;
  gap: 10px;

  /* ✅ tuiles compactes : 190px de large, sinon elles vont devenir énormes */
  grid-template-columns: repeat(auto-fill, 190px);

  /* ✅ centre la grille dans l'espace dispo */
  justify-content: center;   /* mets "center" si tu veux centré */
}


/* Tuiles : prennent toute la cellule */
.btn-tile{
  width: 100%;
  height: 72px;               /* hauteur stable et plus compacte */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  padding: 10px 12px;
  gap: 8px;

  white-space: nowrap;        /* évite un bouton sur 2 lignes */
  line-height: 1;
  font-weight: 500;
}

/* Autorise le retour à la ligne UNIQUEMENT pour "Transformer en facture" */
.btn-tile.wrap{
  white-space: normal;
  line-height: 1.15;
}

/* Harmonise <a> et <button> */
.action-bar a.btn-tile,
.action-bar button.btn-tile{
  text-decoration: none;
  cursor: pointer;
}
/* Bouton désactivé (état validé) */
.btn[disabled]{
  opacity: 0.6;
  cursor: default;
  filter: grayscale(0.2);
}
/* ===== FIX ABSOLU : mêmes dimensions pour <a> et <button> dans action-bar ===== */
.action-bar a.btn,
.action-bar button.btn{
  box-sizing: border-box !important;
  height: 52px !important;
  padding: 0 10px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  line-height: 1 !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
   /* 🔒 POLICE UNIFIÉE */
  font-size: 14px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
}


/* "Transformer en facture" peut wrap */
.action-bar .btn.wrap{
  white-space: normal !important;
  line-height: 1.15 !important;
}
/* ===== Header facture : actions horizontales ===== */
.facture-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* Zone des actions à droite */
.facture-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}


/* Les boutons restent compacts et alignés */
.facture-actions .btn{
  height: 52px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}
/* Conteneur modales HTMX */
#modals { position: relative; z-index: 9999; }

/* Overlay modal */
.modal-bg{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal{
  background:#fff;
  padding:20px;
  width:80%;
  max-width:520px;
  border-radius:10px;
}
.pay-form{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.pay-form input[type="date"]{
  padding:8px 10px;
  border:1px solid #ddd;
  border-radius:10px;
}
/* ===== TOAST (message non bloquant) ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;

  background: #e6f7ea;
  border: 1px solid #6ac48a;
  color: #145c2c;

  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);

  z-index: 20000;
  font-weight: 600;

  animation: slideInFade 0.25s ease-out;
}

.toast.success {
  background: #e6f7ea;
}
/* Empêche le "toast" PEPPOL de flotter au-dessus des boutons */
#peppol-status .toast {
  position: static !important;
  z-index: auto !important;
  width: 100%;
  margin-top: 10px;
}
/* ====== TEMPLATE EDIT ====== */

.template-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.template-header h1 {
  font-size: 1.6rem;
  margin: 0;
}

.template-subnav {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.template-subnav a {
  font-size: 0.9rem;
  color: #4b6cb7;
  text-decoration: none;
}

.template-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.template-lines th {
  background: #f3f6fb;
  font-weight: 600;
  font-size: 0.85rem;
}

.template-lines td {
  vertical-align: top;
}

.template-lines input,
.template-lines textarea {
  border: 1px solid #ccd3e0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.template-lines textarea {
  line-height: 1.35;
}

.template-lines .num {
  text-align: right;
}

.template-lines .actions button {
  margin-right: 4px;
}
/* =========================
   KPI CARDS : SUCCESS / DANGER
   ========================= */

.card.success {
  border-left: 6px solid #16a34a;          /* vert */
  background-color: #f0fdf4;               /* vert très clair */
}

.card.success .muted {
  color: #166534;
}

.card.danger {
  border-left: 6px solid #dc2626;           /* rouge */
  background-color: #fef2f2;               /* rouge très clair */
}

.card.danger .muted {
  color: #7f1d1d;
}
/* =========================
   VACANCES (scoppé)
   ========================= */

#vacances-page .vac-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:14px;
  flex-wrap:wrap;
}

#vacances-page .vac-controls{
  display:flex;
  gap:10px;
  align-items:flex-end;
  flex-wrap:wrap;
}

#vacances-page .vac-h1{ margin:0; }

#vacances-page .vac-table-wrap{
  padding-right: 42px;
}

#vacances-page .vac-month{
  padding: 10px;
  overflow:auto;
  margin-bottom: 12px;
}

#vacances-page .vac-month-title{
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: capitalize;
}

#vacances-page table.vac-grid{
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;     /* OK */
  width: max-content;      /* IMPORTANT : la table prend la largeur des colonnes */
  min-width: 100%;         /* et remplit au moins l’écran */
}


#vacances-page .vac-emp-col{
  width: 115px;
  min-width: 115px;
  max-width: 115px;
}

#vacances-page .stat-col{
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  padding: 6px 6px !important;
  background:#fff;
}

#vacances-page .stat-col.neg{ color:#b91c1c; font-weight:800; }

#vacances-page .total-col{
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  text-align:right !important;
  font-variant-numeric: tabular-nums;
  font-weight:700;
  padding-right:10px !important;
}



/* sticky colonne employé */
#vacances-page .sticky-col{
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 3;
}

/* header */
#vacances-page table.vac-grid thead th{
  background:#f0f4ff;
}

/* week-ends */
#vacances-page th.we{ background:#e9eef9; }
#vacances-page td.we{ background:#f3f6fb !important; }
#vacances-page td.we .vac-cell,
#vacances-page td.we .vac-half{ background:transparent !important; }

/* séparateur semaine (lundi) */
#vacances-page .ws{
  border-left: 1px dashed #d7dee8 !important;
}

/* cellule demi-journées */
#vacances-page .vac-td{
  padding: 6px 2px !important;
  text-align:center !important;
}

#vacances-page .vac-cell{
  width: 30px;
  height: 22px;
  display: inline-flex;
  border: 1px solid #d6dbe6;
  border-radius: 6px;
  overflow: hidden;
  background:#fff;
}

#vacances-page .vac-half{
  width:50%;
  height:100%;
  border:0;
  margin:0;
  padding:0;
  cursor:pointer;
  font-size:11px;
  line-height:22px;
  background:transparent;
  color:#fff;
}

#vacances-page .vac-half.left{ border-right: 1px solid rgba(255,255,255,.25); }

/* types */
#vacances-page .t-CP  { background:#1f2937 !important; }
#vacances-page .t-MAL { background:#b91c1c !important; }
#vacances-page .t-CSS { background:#6b7280 !important; }
#vacances-page .t-TT  { background:#0d9488 !important; }
#vacances-page .t-AUT { background:#0ea5e9 !important; }

/* hover */
#vacances-page .vac-half:hover{
  outline:2px solid #3b82f6;
  outline-offset:-2px;
}

/* ligne total */
#vacances-page tr.month-total-row td{
  background:#f8fbff;
  font-weight:700;
}
/* Inputs compacts (Droits/Report) */
#vacances-page table input[type="number"]{
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  padding: 3px 6px !important;
  height: 26px !important;
  font-variant-numeric: tabular-nums;
}

/* Bouton OK plus compact */
#vacances-page table button.btn{
  padding: 4px 8px !important;
  height: 26px !important;
}

/* En-têtes plus propres et centrés */
#vacances-page table.vac-summary th,
#vacances-page table.vac-grid th{
  white-space: nowrap;
}

/* Colonne action (OK) stable */
#vacances-page .ok-col{
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  text-align: left;
}
#vacances-page .vac-half:disabled{
  cursor: not-allowed;
  opacity: 0.35;
  outline: none;
}
#vacances-page td.we .vac-cell{
  border-style: dashed;
}
/* LuxEeB – Select parois */
.luxeeb-select{
  width:100%;
  min-height: 48px;      /* + haut */
  padding: 12px 14px;    /* + confortable */
  font-size: 14.5px;
  line-height: 1.2;
  border-radius: 10px;   /* plus moderne */
}

/* Optionnel : meilleur focus */
.luxeeb-select:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
.luxeeb-select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-size: 15px;
}
.luxeeb-select option {
  font-size: 14px;
}
/* Force plein écran (planning + luxeeb) */
.eco-wide{
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}
/* === FORCE WIDE (LuxEeB / Planning) === */
body { max-width: none !important; }

main.eco-wide,
main.eco-wide.container,
main.eco-wide.container-fluid {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  box-sizing: border-box !important;
}

/* Si une règle "container" écrase tout, on neutralise */
.eco-wide.container,
.eco-wide .container {
  max-width: none !important;
  width: 100% !important;
}
#vacances-page td.hol{
  background: #fff4e6 !important; /* léger orangé */
}
#vacances-page .vac-half:disabled{
  cursor: not-allowed;
  opacity: 0.35;
}
/* Cases bloquées (WE + fériés) => vert doux */
#vacances-page td.blocked{
  background: #e9f7ef !important; /* vert doux */
}

/* Rendu disabled clair */
#vacances-page .vac-half:disabled{
  cursor: not-allowed;
  opacity: 0.25;
  outline: none;
}

/* Option : bordure pointillée pour rappeler blocage */
#vacances-page td.blocked .vac-cell{
  border-style: dashed;
}
/* Bloqué (WE + férié) : vert visible jusqu'à l'intérieur */
#vacances-page td.blocked{
  background: #e9f7ef !important;
}

#vacances-page td.blocked .vac-cell{
  background: transparent !important;
}

#vacances-page td.blocked .vac-half{
  background: transparent !important;
}
#vacances-page .vac-cell{ width:28px; height:20px; }
#vacances-page .vac-half{ line-height:20px; font-size:10px; }


#vacances-page .vac-year-cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap:12px;
}

#vacances-page .vac-month-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

#vacances-page .vac-month-card-title{
  font-weight:800;
  margin-bottom:8px;
  text-transform:capitalize;
}

#vacances-page .vac-month-grid-head{
  display:grid;
  grid-template-columns: 110px repeat(7, 1fr);
  gap:6px;
  font-weight:700;
  color:#64748b;
  margin-bottom:6px;
}

#vacances-page .vac-row{
  display:grid;
  grid-template-columns: 110px 1fr;
  gap:6px;
  align-items:start;
  margin-bottom:8px;
}

#vacances-page .vac-row-name{
  font-weight:700;
  padding-top:6px;
}

#vacances-page .vac-row-weeks{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:6px;
}

#vacances-page .vac-day{
  border:1px solid #dbe3ee;
  border-radius:10px;
  padding:6px;
  background:#fff;
  min-height:54px;
}

#vacances-page .vac-day.blocked{
  background:#e9f7ef;
}

#vacances-page .vac-day-num{
  font-size:11px;
  color:#64748b;
  margin-bottom:4px;
  text-align:right;
}

#vacances-page .vac-cell{
  width:100%;
  height:22px;
  display:flex;
  border:1px solid #d6dbe6;
  border-radius:8px;
  overflow:hidden;
  background:rgba(255,255,255,.65);
}

#vacances-page .vac-half{
  width:50%;
  height:100%;
  border:0;
  margin:0;
  padding:0;
  cursor:pointer;
  font-size:11px;
  line-height:22px;
  background:transparent;
  color:#fff;
}

#vacances-page .vac-half:disabled{
  cursor:not-allowed;
  opacity:.25;
}

/* jours hors mois */
#vacances-page .vac-cell-empty{
  height:54px;
  border-radius:10px;
  background:transparent;
}

/* couleurs types */
#vacances-page .t-CP  { background:#1f2937 !important; }
#vacances-page .t-MAL { background:#b91c1c !important; }
#vacances-page .t-CSS { background:#6b7280 !important; }
#vacances-page .t-TT  { background:#0d9488 !important; }
#vacances-page .t-AUT { background:#0ea5e9 !important; }
#vacances-page .vac-month-chip{
  display:block;
  padding:6px 8px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  text-decoration:none;
  color:inherit;
  background:#fff;
}
#vacances-page .vac-month-chip:hover{
  border-color:#3b82f6;
}
#vacances-page .vac-mini{
  font-variant-numeric: tabular-nums;
  font-size:12px;
  line-height:1.2;
}

#vacances-page .day-col, #vacances-page .vac-td { padding: 6px 2px !important; }


#vacances-page .vac-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
  position: relative;
}


#vacances-page .sticky-col{
  position: sticky;
  left: 0;
  z-index: 10;
  background: #fff;
}
#vacances-page th.sticky-col{
  z-index: 11;
  background: #f0f4ff;
}
#vacances-page .sticky-col{
  box-shadow: 10px 0 0 #fff;  /* masque la grille derrière */
}
#vacances-page .vac-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
  position:relative;
}

#vacances-page table.vac-grid{
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

#vacances-page .sticky-col{
  position: sticky;
  left: 0;
  z-index: 10;
  background: #fff;
  box-shadow: 10px 0 0 #fff;
}
#vacances-page th.sticky-col{
  z-index: 11;
  background:#f0f4ff;
}
/* === VACANCES: verrouillage largeur tables (anti reflow après HTMX) === */
#vacances-page .vac-table-wrap{
  overflow-x:auto !important;
  overflow-y:hidden !important;
  position:relative !important;
}

#vacances-page table.vac-grid{
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;  /* CRITIQUE */
  min-width: 100% !important;
}

#vacances-page .sticky-col{
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  background: #fff !important;
  box-shadow: 10px 0 0 #fff !important;
}

#vacances-page th.sticky-col{
  z-index: 11 !important;
  background: #f0f4ff !important;
}
/* === VACANCES: verrouillage alignement tables === */
#vacances-page table.vac-grid th,
#vacances-page table.vac-grid td{
  box-sizing: border-box;
  padding: 6px 2px !important;
}

/* Largeurs UNIQUES (source de vérité) */
#vacances-page .vac-emp-col { width: 120px !important; min-width:120px !important; max-width:120px !important; }
#vacances-page .day-col, 
#vacances-page .vac-td      { width: 30px !important; min-width:30px !important; max-width:30px !important; }

/* Table doit prendre sa vraie largeur + scroll */
#vacances-page .vac-table-wrap{ overflow-x:auto !important; overflow-y:hidden !important; }
#vacances-page table.vac-grid{
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: 100% !important;
}

/* Sticky colonne employé */
#vacances-page .sticky-col{
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  background: #fff !important;
  box-shadow: 10px 0 0 #fff !important;
}
#vacances-page th.sticky-col{
  z-index: 11 !important;
  background: #f0f4ff !important;
}
#vacances-page td.empty{
  background: transparent;
  border-bottom: 1px solid #eee;
}
/* Header à 2 lignes : plus compact */
#vacances-page table.vac-grid thead th{
  padding: 4px 2px !important;
  text-align: center;
}

/* Ligne 1 (dow) : plus petit */
#vacances-page table.vac-grid thead tr:first-child th.day-col{
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

/* Ligne 2 (numéro) : un peu plus grand */
#vacances-page table.vac-grid thead tr:nth-child(2) th.day-col{
  font-size: 13px;
  font-weight: 800;
  color: #111827;
}

/* Pour que le "01" soit parfaitement centré au-dessus des 2 demi-cases */
#vacances-page th.day-col{
  text-align: center !important;
  vertical-align: middle;
}
/* Colonnes inexistantes (29-31 en février) : pas de bande bleue */
#vacances-page th.empty-head{
  background: transparent !important;
}
#vacances-page td.empty{
  background: transparent !important;
  border-bottom: 1px solid #eee;
}
.vac-multi{
  display:grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  align-items:start;
}
.vac-mini-donut{
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
}
@media (max-width: 1100px){
  .vac-multi{ grid-template-columns: 1fr; }
}
/* 3 donuts sur une ligne */
.vac-multi{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  flex-wrap: nowrap;         /* reste sur 1 ligne */
  overflow-x:auto;           /* au cas où écran trop étroit */
  padding-bottom: 4px;
}

.vac-mini-donut{
  flex: 0 0 190px;           /* largeur fixe par donut */
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
}
.vac-summary-multi{
  display:flex;
  gap: 12px;
  flex-wrap: nowrap;
  overflow-x:auto;
  padding-bottom: 4px;
}

.vac-summary-box{
  flex: 0 0 340px;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.vac-summary-name{
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 8px;
}

/* un peu moins tassé que ton grid actuel */
.vac-summary-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
/* compacte la table droits/report */
table.vac-summary th, table.vac-summary td{
  padding: 6px 8px !important;
  font-size: 13px;
}

table.vac-summary input[type="number"]{
  padding: 4px 6px;
  font-size: 13px;
  height: 30px;
  border-radius: 8px;
}

/* réduit l'entête et l'interligne */
.vac-card__meta, .muted{
  line-height: 1.2;
}
/* =========================
   PARAMÈTRES (Droits/Report) COMPACT
   ========================= */
.vac-params{
  padding: 8px 10px !important;   /* moins de hauteur */
}

.vac-params .muted{
  font-size: 12px;
  line-height: 1.1;
  opacity: .75;
}

.vac-params .vac-table-wrap{
  margin-top: 6px !important;     /* réduit l'espace au-dessus de la table */
}

/* Table compacte */
.vac-summary--tight{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;            /* évite les colonnes qui s'étirent */
}

/* Réduit fort la hauteur des lignes */
.vac-summary--tight th,
.vac-summary--tight td{
  padding: 5px 8px !important;
  font-size: 13px;
  line-height: 1.1;
  vertical-align: middle;
}

/* En-tête discret */
.vac-summary--tight thead th{
  font-size: 12px;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  opacity: .85;
}

/* Colonne Employé plus compacte */
.vac-summary--tight .vac-emp-col{
  width: 160px !important;
  white-space: nowrap;
}

/* Colonnes chiffres plus petites */
.vac-summary--tight .stat-col{
  width: 90px !important;
  text-align: right;
}

/* Inputs minus : on neutralise le w100 trop “gras” */
.vac-summary--tight input[type="number"].w100{
  width: 72px !important;
  min-width: 72px !important;
  padding: 3px 6px !important;
  height: 28px !important;
  font-size: 13px !important;
  border-radius: 8px;
  text-align: right;
}

/* Optionnel : réduit encore la hauteur des lignes */
.vac-summary--tight .bal-row{
  height: 34px;
}
/* =========================================================
   VACANCES – PARAMÈTRES ANNÉE (COMPACTION FORCÉE)
   ========================================================= */

/* On neutralise les styles génériques de table */
#vacances-page .vac-params-table{
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

/* LIGNES BEAUCOUP PLUS BASSES */
#vacances-page .vac-params-table th,
#vacances-page .vac-params-table td{
  padding: 3px 6px !important;
  font-size: 12.5px !important;
  line-height: 1.1 !important;
  height: 28px !important;
  vertical-align: middle !important;
}

/* En-tête discret (1 vraie ligne) */
#vacances-page .vac-params-table thead th{
  padding: 3px 6px !important;
  font-size: 12px !important;
  background: #f3f6fb !important;
}

/* Colonne Employé PLUS ÉTROITE */
#vacances-page .vac-params-table .vac-emp-col{
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
}

/* Colonnes Droits / Report : on annule stat-col */
#vacances-page .vac-params-table .stat-col{
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  padding: 2px 4px !important;
}

/* INPUTS ULTRA COMPACTS */
#vacances-page .vac-params-table input[type="number"]{
  width: 64px !important;
  min-width: 64px !important;
  height: 24px !important;
  padding: 1px 4px !important;
  font-size: 12.5px !important;
  border-radius: 6px !important;
}

/* Supprime toute hauteur fantôme */
#vacances-page .vac-params-table tr{
  height: 28px !important;
}

/* Réduit l’espace sous le titre "Paramètres 2026" */
#vacances-page .vac-params{
  padding: 6px 8px !important;
}
#vacances-page .vac-params .muted{
  font-size: 12px !important;
  line-height: 1.1 !important;
}
#vacances-page .vac-title-line{
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#vacances-page .vac-help{
  font-size: 14px;
  color: #6b7280;
  white-space: nowrap;
}
/* Résumé annuel : lignes en 2 colonnes (libellé / valeur) */
#vacances-page .vac-summary-lines{
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 6px;
}

#vacances-page .vac-line{
  display: grid;
  grid-template-columns: 1fr auto; /* label gauche, valeur alignée droite */
  gap: 12px;
  align-items: baseline;
  font-size: 14px;
}

#vacances-page .vac-line .k{
  color: #111827;
  white-space: nowrap;
}

#vacances-page .vac-line .v{
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
}

#vacances-page .vac-line.total .k{
  opacity: .85;
}
#vacances-page .vac-line.total .v{
  font-weight: 800;
}
/* === Résumé annuel avec donut intégré === */

#vacances-page .vac-summary-multi{
  display: flex;
  gap: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
}

#vacances-page .vac-summary-emp{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;

  min-width: 420px;
  padding: 12px 14px;

  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
}

#vacances-page .vac-summary-right{
  display: flex;
  align-items: center;
  justify-content: center;
}

/* taille du “gros” donut (ajuste si tu veux) */
#vacances-page .vac-summary-right svg{
  width: 170px;
  height: 170px;
}
#vacances-page .vac-summary-right svg{
  width: 120px !important;
  height: 120px !important;
}
/* Vacances – liserai discret autour du bloc Paramètres */
#vacances-page .vac-params-frame{
  border: 1px solid #d7dee8 !important;
  border-radius: 12px !important;
  background: #fff !important;
  padding: 10px 14px 12px 14px !important;
}
/* Aligner "PARAMÈTRES 2026" au niveau des prénoms */
#vacances-page .vac-params-header{
  align-items: flex-end;
}
#vacances-page .vac-params-title{
  margin-bottom: 2px;
}
/* Décalage fin du bouton Export compta */
#vacances-page .vac-export-btn{
  margin-left: 10px;
}
/* Vacances: décoller le bouton Export du bord droit */
#vacances-page .vac-controls .vac-export-btn{
  margin-left: 0 !important;     /* neutralise un éventuel auto */
  margin-right: 14px !important; /* décale depuis le bord */
}
#vacances-page .vac-controls{
  padding-right: 14px !important;
}
#vacances-page .vac-top{
  padding-right: 16px;   /* ← le “poil” que tu veux */
}
/* VACANCES: respirer le bord droit de TOUTE la page */
#vacances-page{
  padding-right: 18px !important;
  box-sizing: border-box !important;
}

/* ============================================================
   NAVIGATION MOBILE (hamburger)
   ============================================================ */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  /* Topbar : une seule rangée — logo + search réductible + burger */
  .topbar {
    padding: 8px 12px;
    gap: 6px;
  }

  /* Brand : peut rétrécir sur petit écran, texte tronqué */
  .topbar > a:first-child {
    flex: 0 1 auto;
    min-width: 60px;
    overflow: hidden;
  }
  .topbar .brand {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Search : prend l'espace restant */
  .topbar > div[style*="position:relative"] {
    flex: 1;
    min-width: 60px;
  }
  .topbar > div[style*="position:relative"] input {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Hamburger visible */
  .nav-toggle {
    display: flex;
    align-items: center;
  }

  /* Nav masquée par défaut, plein-largeur quand ouverte */
  .nav {
    display: none;
    flex-direction: column;
    align-items: stretch;       /* annule le align-items:center du desktop → liens pleine largeur */
    justify-content: flex-start;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 4px;
    padding: 4px 0;
    max-height: 70vh;
    overflow-y: auto;
  }
  .nav.open {
    display: flex;
  }
  .nav a {
    margin: 0;
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 15px;
  }
  .nav a:last-child {
    border-bottom: none;
  }
  /* Groupes déroulants : déployés en accordéon dans le tiroir mobile */
  .nav-group { display:block; width:100%; }
  .nav-group .nav-trigger { display:block; margin:0; padding:9px 14px;
    border-bottom:1px solid rgba(255,255,255,0.08); font-size:15px; }
  .nav-sub { display:block; position:static; box-shadow:none; margin:0;
    background:rgba(0,0,0,0.14); border-radius:0; padding:0; }
  .nav-sub a { padding-left:30px; font-size:14px; }

}

/* ============================================================
   RESPONSIVE MOBILE — CONTENU (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* Content : pas de padding excessif (mobile uniquement) */
  .container, .container-fluid {
    padding: 10px 8px;
  }

  /* ── Tables : scroll horizontal au lieu d'être coupées ── */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table thead, table tbody, table tfoot, table tr { display: table; width: 100%; }
  table td, table th { white-space: normal; min-width: 80px; }

  /* ── Grilles multi-colonnes → colonne unique ── */
  .presence-grid           { grid-template-columns: 1fr 70px 75px 85px !important; }
  .card-body.grid2         { grid-template-columns: 1fr !important; }
  .info-grid               { grid-template-columns: 1fr !important; }
  .montant-boxes           { grid-template-columns: 1fr 1fr !important; }
  .sign-grid               { grid-template-columns: 1fr !important; }
  .edit-grid               { grid-template-columns: 1fr !important; }
  .fiche-grid              { grid-template-columns: 1fr 1fr !important; }
  .stats-row               { flex-wrap: wrap; }
  .stats-row .stat-box     { min-width: 80px; }

  /* ── Layouts en grille inline (max 2 col sur mobile) ── */
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns: 1fr 300px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:2fr 120px 100px"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Cards : supprime overflow:hidden qui coupe le contenu ── */
  .card { overflow: visible; }

  /* ── Formulaires : taille min pour éviter le zoom iOS ── */
  input, select, textarea, .form-control, .input {
    font-size: 16px !important;
  }

  /* ── Boutons : cibles tactiles correctes ── */
  .btn, button[type=submit], button[type=button] {
    min-height: 40px;
    font-size: 14px;
  }
  .btn-primary   { padding: 10px 16px; }
  .btn-secondary { padding: 10px 14px; }

  /* ── Nav breadcrumb phases : scroll horizontal ── */
  div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Lot-row DCE : empile verticalement ── */
  .lot-row {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  /* ── RC : grille points → bloc ── */
  .pt-row {
    grid-template-columns: 1fr !important;
  }
  .pt-row > div {
    border-left: none !important;
    padding: 6px 10px !important;
  }

  /* ── Texte trop petit ── */
  body { font-size: 15px; }
  .muted, .subtitle { font-size: 13px; }

  /* ── Marges des cards ── */
  .card { margin-bottom: 12px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
}

/* ============================================================
   RESPONSIVE MOBILE — complément écran chantier RC (≤ 768px)
   Replie TOUS les formulaires en grille inline de l'écran RC
   (ex. "2fr 1fr 1fr auto", "1fr auto auto") non couverts plus haut.
   Scopé à #rc-page → aucun effet ailleurs.
   ============================================================ */
@media (max-width: 768px) {
  #rc-page [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  #rc-page [style*="grid-column"] {
    grid-column: auto !important;
  }
  #rc-page .rc-header { padding: 14px 16px; }
  #rc-page .rc-header .rc-num { font-size: 1.5em; }
  #rc-page .rc-actions { width: 100%; }
}

/* ============================================================
   ZONE DE SÉCURITÉ BAS — téléphones sans bouton home
   La barre de gestes mange ~20-34px en bas de l'écran. On remonte
   les éléments flottants au-dessus, et on ajoute de l'air en bas de
   chaque page pour que les derniers boutons ne soient jamais collés
   au bord (un petit scroll suffit à les atteindre).
   env(safe-area-inset-bottom) = 0 sur desktop → aucun effet là-bas.
   Nécessite viewport-fit=cover (posé dans layout.html).
   ============================================================ */

/* Boutons flottants globaux : toujours au-dessus de la barre de gestes */
#capture-fab {
  bottom: calc(28px + env(safe-area-inset-bottom)) !important;
}
#capture-chrono-bar {
  bottom: calc(92px + env(safe-area-inset-bottom)) !important;
}
#btn-back-to-top {
  bottom: calc(84px + env(safe-area-inset-bottom)) !important;
}

/* Modales/feuilles ancrées en bas : padding interne pour la barre de gestes */
#interrupt-box,
.sheet-bottom,
.modal-sheet {
  padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
}

@media (max-width: 768px) {
  /* Air en bas de chaque page : les derniers boutons ne touchent jamais
     le bord. + de place que le FAB pour ne pas le chevaucher. */
  .container, .container-fluid {
    padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
  }

  /* Barres d'action collantes en bas → décollées de la barre de gestes */
  .action-bar-sticky,
  .form-actions-sticky,
  [style*="position:fixed"][style*="bottom:0"],
  [style*="position: fixed"][style*="bottom: 0"],
  [style*="position:sticky"][style*="bottom:0"],
  [style*="position: sticky"][style*="bottom: 0"] {
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
}

/* ============================================================
   MOBILE — scroll horizontal maîtrisé
   Principe : html/body ne scrollent pas en X.
   Les tables ont un wrapper .tbl-scroll en HTML direct (pas JS)
   qui leur permet de scroller indépendamment.
   ============================================================ */
@media (max-width: 768px) {

  /* overflow-x:clip — différent de hidden :
     - clip NE crée PAS de scroll container → les enfants .tbl-scroll peuvent toujours scroller
     - clip empêche la page de scroller horizontalement
     Supporté iOS 16+, Chrome 90+, Firefox 81+ */
  html, body {
    overflow-x: clip;
  }

  /* Wrapper table scrollable */
  .tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  /* La table doit dépasser le wrapper pour que le scroll existe.
     width:max-content override le width:100% inline — sinon table = wrapper = pas de scroll */
  .tbl-scroll > table {
    width: max-content !important;
    min-width: 100%;
  }

  /* Grilles 2/3 colonnes → 1 colonne */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Largeurs fixes qui débordent → pleine largeur */
  [style*="min-width:860px"], [style*="min-width: 860px"],
  [style*="width:860px"],    [style*="width: 860px"] {
    min-width: unset !important;
    width: 100% !important;
  }

  /* Éléments flex inline → passent à la ligne */
  [style*="display:flex"]:not(.topbar):not(#main-nav):not(#hub-offline-banner) {
    flex-wrap: wrap;
  }
  [style*="display: flex"]:not(.topbar):not(#main-nav):not(#hub-offline-banner) {
    flex-wrap: wrap;
  }

  /* Topbar : barre de recherche peut rétrécir (pas de wrap) */
  .topbar > div[style*="position:relative"] {
    flex-shrink: 1 !important;
    min-width: 0 !important;
    max-width: calc(100vw - 140px);
  }
  .topbar > div[style*="position:relative"] input {
    width: 100% !important;
    box-sizing: border-box;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   COINS ARRONDIS UNIFORMES SUR TOUS LES CHAMPS — demande FB 2026-06-16
   Tous les champs du Hub adoptent le MÊME rayon (8px), identique au style
   .form-control de la photo « Qualification du lead ». Le !important force
   l'uniformité même là où des classes plus spécifiques (.cf-field 7px,
   .luxeeb-select 10px, .table input 6px…) imposaient un autre rayon.
   Exclus : cases à cocher, boutons radio, curseurs, sélecteurs de couleur.
   ══════════════════════════════════════════════════════════════════════════════ */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
select,
textarea {
  border-radius: 8px !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   .form-control GLOBAL — design unifié « Note de qualification » — FB 2026-06-16
   Avant, ce style n'existait QUE dans prospection_detail.html : ailleurs (aps_detail,
   etc.) la classe ne faisait rien et les champs restaient petits. Définie ici, elle
   donne à TOUS les champs .form-control du Hub : pleine largeur + bordure + arrondi.
   ══════════════════════════════════════════════════════════════════════════════ */
.form-control {
  width:100%; height:38px; padding:0 10px; font-size:.88em;
  font-family:inherit; color:#374151; background:#fff;
  border:1.5px solid #e5e7eb; border-radius:8px;
  box-sizing:border-box; transition:border-color .15s; appearance:auto;
}
.form-control:focus {
  outline:none; border-color:#1e3a5f; box-shadow:0 0 0 3px rgba(30,58,95,.08);
}
textarea.form-control {
  height:auto; padding:8px 10px; resize:vertical; line-height:1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT 09/08/2026 — classes utilisées dans les gabarits mais JAMAIS définies.
   Elles ne cassaient rien visiblement : elles ne faisaient simplement RIEN,
   ce qui est pire — l'interface paraissait cohérente tout en ne l'étant pas.
   ═══════════════════════════════════════════════════════════════════════════ */

/* `.error` était renvoyée par 37 fragments HTMX (routers/devis.py ×17,
   factures.py ×8, situations.py ×6, clients, contacts, chantiers, projets).
   Sans règle, un message d'erreur serveur s'affichait en texte noir ordinaire
   au milieu du formulaire — indistinguable du reste. */
.error {
  background:#fef2f2; border:1px solid #fecaca; color:#b91c1c;
  padding:10px 12px; border-radius:9px; font-size:.9em; margin:6px 0;
}
.ok {
  background:#f0fdf4; border:1px solid #bbf7d0; color:#166534;
  padding:10px 12px; border-radius:9px; font-size:.9em; margin:6px 0;
}

/* `.btn-danger` (12 usages) et `.btn-secondary` (194 usages) n'existaient pas :
   seul `.btn.danger` (minuscule) était rouge. Résultat, « ✕ Supprimer » d'une
   réserve rendait en bleu clair, exactement comme « Enregistrer ». */
.btn-danger {
  background:#fee2e2; border:1px solid #fca5a5; color:#b91c1c;
}
.btn-danger:hover { background:#fecaca; }
.btn-secondary {
  background:#f8fafc; border:1px solid #e2e8f0; color:#374151;
}
.btn-secondary:hover { background:#f1f5f9; }

/* `.btn-xs` (53 usages) n'était défini que dans dce_lot_detail.html et
   dce_templates.html : ailleurs (marches, dce_ccap, dce_envoi, dce_lots,
   aide_questions…) les boutons censés être minuscules rendaient en taille
   normale et cassaient l'alignement des lignes de tableau. */
.btn-xs { padding:3px 7px; font-size:.78em; line-height:1.35; }

/* Le bandeau est en z-index:99999 (ligne 46) alors que le voile de modale est
   en 10000 : le voile couvrait la page mais PAS la barre de navigation, qui
   restait nette et cliquable par-dessus la modale. Visible sur « Préparer la
   facture » et « Dupliquer le devis », c'est-à-dire sur le chemin
   devis → facture, celui qu'on montre en démo. */
.modal-bg { z-index:100001 !important; }
.hub-menu  { z-index:100002 !important; }

/* Aucune règle .htmx-request n'existait, et seuls 3 gabarits sur 225 posaient
   un hx-indicator. Sur /devis et /factures, le tableau se charge via
   hx-trigger="load" dans un div vide : l'écran restait blanc, sans le moindre
   signal, pendant toute la requête. */
.htmx-request { opacity:.55; pointer-events:none; transition:opacity .12s ease; }
.htmx-indicator { display:none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display:inline-block; }

/* Focus clavier : `outline:none` + une ombre à 8 % d'opacité sur les 388
   champs .form-control revenait à supprimer l'indicateur de focus. */
.form-control:focus-visible,
.btn:focus-visible,
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline:2px solid #1e3a5f; outline-offset:2px;
}
