/* Gestion LMD — feuille de style unique. Dense, lisible au comptoir. */
:root {
  --fond: #f5f3ef; --surface: #ffffff; --encre: #14161a; --attenue: #5c636e;
  --bordure: #ddd9d1; --bordure-claire: #f0ede7; --accent: #b4442a; --accent-sombre: #8e3421;
  --vert: #175840; --vert-fond: #e6f1ec; --bleu: #24394a; --bleu-fond: #e9eef1;
  --ambre-fond: #fdf4e3; --ambre: #7a5a12;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre);
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", system-ui, sans-serif; font-size: 14px; }
a { color: var(--accent); } a:hover { color: var(--accent-sombre); }
h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
h2 { font-size: 11px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; color: var(--attenue); margin: 0 0 10px; }
.mono, td.num, input.num { font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace; }

/* Barre de navigation */
.nav { background: var(--encre); color: #f5f3ef; height: 54px; display: flex; align-items: center;
  gap: 24px; padding: 0 20px; position: sticky; top: 0; z-index: 30; }
.nav .marque { font-weight: 700; font-size: 17px; letter-spacing: -.2px; }
.nav .marque span { color: var(--accent); }
.nav a, .nav .inactif { padding: 7px 12px; border-radius: 6px; text-decoration: none; font-weight: 500; }
.nav a { color: #b9b4aa; } .nav a.actif { background: #2a2d33; color: #fff; font-weight: 600; }
.nav .inactif { color: #4e4a44; display: inline-flex; align-items: center; gap: 6px; cursor: not-allowed; }
.nav .grandir { flex-grow: 1; } .nav .qui { color: #b9b4aa; font-size: 13px; }
.jalon { font-size: 10px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; border: 1px solid currentColor; }

.page { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }
.entete { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.entete .grandir { flex-grow: 1; }
.sous-titre { color: var(--attenue); font-size: 13px; margin-top: 4px; }

/* Blocs */
.carte { background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 14px 16px; }
.carte + .carte { margin-top: 14px; }
.grille2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .grille2 { grid-template-columns: minmax(0, 1fr); } }

/* Formulaires */
label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: var(--attenue); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid #c9c4ba; border-radius: 7px;
  background: #fff; font-size: 14px; font-family: inherit; color: inherit; }
textarea { height: auto; padding: 9px 11px; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input.num { text-align: right; }
.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.champs .large { grid-column: span 2; }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: 8px; border: 1px solid var(--bordure); background: #fff; color: var(--encre);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn:hover { background: #faf9f6; color: var(--encre); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.principal:hover { background: var(--accent-sombre); border-color: var(--accent-sombre); color: #fff; }
.btn.sombre { background: var(--encre); border-color: var(--encre); color: #fff; font-weight: 600; }
.btn.sombre:hover { background: #2a2d33; color: #fff; }
.btn.petit { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled], .btn.indispo { opacity: .55; cursor: not-allowed; background: #fff; }
.btn.danger { border-color: #e4cdc6; color: var(--accent-sombre); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 54px; z-index: 10; background: #faf9f6; border-bottom: 1px solid #e8e4dc;
  font-size: 10px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--attenue);
  text-align: left; padding: 9px 10px; }
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--bordure-claire); vertical-align: top; }
tbody tr:hover { background: #fcfbf9; }
td.num, th.num { text-align: right; }

/* overflow: CLIP et non HIDDEN. « hidden » fait de ce bloc un conteneur
   de défilement : l'en-tête collant du tableau se cale alors à 54 px du
   haut DU BLOC au lieu du haut de la fenêtre, et vient se poser sur la
   première ligne de données — d'où les intitulés « NomTypeTéléphone… »
   empilés sur le premier client. « clip » rogne pareil, respecte les
   coins arrondis, mais ne crée pas de conteneur de défilement : le
   collant retrouve la fenêtre comme référence. */
.tableau { background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; overflow: clip; }

/* Étiquettes */
.etiq { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.etiq.gris { background: var(--bordure-claire); color: #57504a; }
.etiq.rouge { background: #fbede9; color: var(--accent-sombre); }
.etiq.bleu { background: var(--bleu-fond); color: var(--bleu); }
.etiq.vert { background: var(--vert-fond); color: var(--vert); }
.etiq.ambre { background: var(--ambre-fond); color: var(--ambre); }

/* Messages */
.message { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.message.succes { background: var(--vert-fond); border-color: #bfdccf; color: var(--vert); }
.message.erreur { background: #fbede9; border-color: #efcabf; color: var(--accent-sombre); }
.message.avertissement { background: var(--ambre-fond); border-color: #e8d6a8; color: var(--ambre); }
.message.info { background: var(--bleu-fond); border-color: #c8d7e0; color: var(--bleu); }

/* Bandeau d'environnement */
.bandeau-test { background: var(--ambre-fond); color: var(--ambre); border-bottom: 1px solid #e8d6a8;
  padding: 6px 20px; font-size: 12px; font-weight: 600; text-align: center; }

/* Onglets */
.onglets { display: flex; border-bottom: 1px solid #e8e4dc; background: #faf9f6; margin: -14px -16px 12px;
  border-radius: 10px 10px 0 0; overflow-x: auto; }
.onglets a { padding: 11px 15px; text-decoration: none; font-size: 13px; font-weight: 500;
  color: var(--attenue); border-bottom: 2px solid transparent; white-space: nowrap; }
.onglets a.actif { background: #fff; color: var(--encre); font-weight: 600; border-bottom-color: var(--accent); }

/* Barre d'actions collante du devis */
.actions-collantes { position: sticky; top: 54px; z-index: 20; background: var(--fond);
  padding: 10px 0; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  border-bottom: 1px solid var(--bordure); }
.devis-table thead th { top: 108px; }

/* Totaux */
.totaux { background: var(--encre); color: #f5f3ef; border-radius: 10px; padding: 14px 18px; }
.totaux .ligne { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 0; }
.totaux .ligne span:first-child { color: #b9b4aa; font-size: 13px; }
.totaux .barre { height: 1px; background: #3a3d44; margin: 9px 0; }
.totaux .ttc { font-size: 28px; font-weight: 600; letter-spacing: -.5px; color: #fff; }
.pave { background: var(--bleu-fond); color: var(--bleu); border-radius: 8px; padding: 9px 12px; flex-grow: 1; }
.pave.mo { background: var(--vert-fond); color: var(--vert); }
.pave .valeur { font-size: 18px; font-weight: 600; margin-top: 2px; }

.vide { color: var(--attenue); font-style: italic; padding: 14px; text-align: center; }
.aide { color: var(--attenue); font-size: 12px; margin-top: 4px; }
.rangee { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* =====================================================================
   Listes : colonnes, recherche, pagination
   ===================================================================== */

/* Largeurs stables : sans table-layout fixe, une adresse longue élargit
   sa colonne et décale toutes les autres d'une ligne à l'autre. */
.tableau table { table-layout: fixed; }
.tableau td, .tableau th { overflow-wrap: anywhere; }
.tableau tbody td { vertical-align: top; }

/* Repli en fenêtre étroite : plutôt qu'un défilement horizontal — qui
   casserait de nouveau l'en-tête collant — les colonnes secondaires
   disparaissent et leur contenu remonte sous le nom. */
.repli { display: none; font-size: 12px; color: var(--attenue); margin-top: 3px; }
@media (max-width: 1080px) {
  .col-adresse, .col-type { display: none; }
  .repli { display: block; }
}
@media (max-width: 760px) {
  .col-second { display: none; }
}

/* Champ de recherche et sa croix d'effacement. La croix est un vrai
   lien vers la liste sans critère : elle fonctionne sans JavaScript,
   et le petit script ne fait que la masquer quand le champ est vide. */
.champ-recherche { position: relative; }
.champ-recherche input { padding-right: 38px; }
.champ-recherche input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.croix { position: absolute; right: 1px; bottom: 1px; width: 34px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--attenue); font-size: 19px; line-height: 1;
  text-decoration: none; cursor: pointer; border-radius: 0 7px 7px 0; }
.croix:hover { background: #f1eee8; color: var(--encre); }
/* [hidden] vient de la feuille du navigateur, avec display:none — mais
   .croix pose display:inline-flex, plus spécifique, et la croix restait
   visible sur un champ vide. On le dit explicitement. */
.croix[hidden] { display: none; }

.pagination { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pagination .compte { color: var(--attenue); font-size: 13px; flex-grow: 1; }
.pagination .btn.indispo { pointer-events: none; }

/* =====================================================================
   Fiches en lecture
   ===================================================================== */
.donnees { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 3px 14px; align-items: baseline; }
.donnees dt { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: var(--attenue); padding-top: 4px; }
.donnees dd { margin: 0; padding-top: 3px; }
.donnees dd.absent { color: #9a958c; font-style: italic; }

.bloc-vehicule { border: 1px solid var(--bordure); border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.bloc-vehicule .tete { background: #faf9f6; border-bottom: 1px solid #e8e4dc; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bloc-vehicule .corps { padding: 10px 12px; display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 13px; color: var(--attenue); }
.bloc-vehicule .immat { font-size: 15px; font-weight: 600; letter-spacing: .5px; }

/* Choix de version quand un modèle existe en plusieurs cylindrées. */
.choix-version { margin-top: 8px; padding: 9px 11px; border-radius: 8px;
  background: var(--ambre-fond); border: 1px solid #e8d6a8; color: var(--ambre); font-size: 13px; }
.choix-version select { margin-top: 6px; max-width: 320px; background: #fff; }
.propositions { margin-top: 4px; font-size: 12px; color: var(--attenue); }
.propositions b { color: var(--encre); font-weight: 600; }
