:root {
  --noir: #121212;
  --carte: #1e1e1e;
  --carte2: #262626;
  --ligne: #333;
  --texte: #f2f2f2;
  --doux: #a8a8a8;
  --rouge: #d7282f;
  --rouge-fonce: #a91d23;
  --vert: #2fa866;
  --jaune: #e9b500;
  --rayon: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--noir); color: var(--texte); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- haut */
.haut {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--noir); border-bottom: 3px solid var(--rouge);
}
.haut h1 { font-size: 19px; margin: 0; flex: 1; font-style: italic; font-weight: 900; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.retour { background: none; border: 0; font-size: 34px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
.hors-ligne { font-size: 12px; background: var(--carte2); color: var(--doux); padding: 3px 8px; border-radius: 99px; }

main { padding: 14px 16px 24px; max-width: 640px; margin: 0 auto; }

/* ---------- onglets du bas */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0b0b0b; border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom);
}
.onglets button {
  background: none; border: 0; padding: 8px 2px 10px; font-size: 11.5px; color: var(--doux);
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; min-height: 62px;
}
.onglets .ic { font-size: 21px; line-height: 1.2; }
.onglets button.actif { color: #fff; }
.onglets button.actif .ic { color: var(--rouge); }

/* ---------- blocs */
.bloc { background: var(--carte); border-radius: var(--rayon); padding: 14px; margin-bottom: 14px; }
.bloc > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--doux); margin: 0 0 10px; font-weight: 700; }
.bloc.rouge { background: var(--rouge); }
.intro { color: var(--doux); margin: 0 0 14px; }
.petit { font-size: 13px; color: var(--doux); }
.vide { text-align: center; color: var(--doux); padding: 28px 10px; }

label.champ { display: block; margin-bottom: 10px; }
label.champ > span { display: block; font-size: 13px; color: var(--doux); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=email], select, textarea {
  width: 100%; background: var(--carte2); border: 1px solid var(--ligne); border-radius: 10px;
  padding: 12px; min-height: 48px; font-size: 16px; color: var(--texte);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rouge); outline-offset: 0; border-color: transparent; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.deux > label.champ { margin-bottom: 10px; }

.case { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.case input { width: 24px; height: 24px; accent-color: var(--rouge); flex: none; }
.case b { font-weight: 600; }

/* ---------- boutons */
/* comme sur le PC : couleur seulement pour l'action principale, le reste sobre, avec une icône */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--rouge); color: #fff; border: 1px solid transparent; border-radius: 12px;
  padding: 12px 16px; min-height: 50px; font-weight: 650; font-size: 16px; line-height: 1.2; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 8px rgba(0,0,0,.28);
  transition: transform .08s ease, filter .15s ease, background-color .15s ease;
}
.btn .ic { width: 19px; height: 19px; flex: none; }
.btn:active { transform: scale(.98); filter: brightness(.88); }
.btn.gris { background: #2a2a2e; border-color: #3b3b42; color: var(--texte); box-shadow: none; }
.btn.gris .ic { color: #c9c9d1; }
.btn.contour { background: transparent; border: 1px solid #4a4a52; color: var(--texte); box-shadow: none; }
.btn.vert { background: #23955a; }
.btn.noir { background: #f4f4f6; color: #141416; box-shadow: 0 2px 8px rgba(0,0,0,.28); }
.btn.lien { background: none; border: 0; color: var(--doux); text-decoration: underline; font-weight: 400; box-shadow: none; }
.btn.plein { width: 100%; }
.btn.danger { background: transparent; border: 1px solid #5a2326; color: #ff8a8f; box-shadow: none; }
.btn[disabled] { opacity: .5; }
.rangee { display: flex; gap: 10px; flex-wrap: wrap; }
.rangee > .btn { flex: 1 1 0; min-width: 0; }
.rangee.trois > .btn { padding-left: 8px; padding-right: 8px; gap: 6px; font-size: 15px; }

.puces { display: flex; gap: 8px; flex-wrap: wrap; }
.puce {
  background: var(--carte2); border: 1px solid var(--ligne); border-radius: 99px;
  padding: 9px 15px; min-height: 42px; cursor: pointer; font-weight: 600;
}
.puce.actif { background: var(--rouge); border-color: var(--rouge); }

/* ---------- lignes de travaux */
.travail { border-top: 1px solid var(--ligne); padding: 12px 0; }
.travail:first-of-type { border-top: 0; padding-top: 0; }
.travail .nom { font-weight: 700; display: flex; gap: 8px; align-items: flex-start; }
.travail .nom span { flex: 1; }
.travail .x { background: none; border: 0; color: var(--doux); font-size: 22px; line-height: 1; padding: 0 2px 0 8px; cursor: pointer; }
.travail .champs { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; margin-top: 8px; align-items: end; }
.travail .champs label > span { display: block; font-size: 12px; color: var(--doux); margin-bottom: 3px; }
.travail .champs input { min-height: 44px; padding: 9px; }
.qte { display: flex; align-items: center; background: var(--carte2); border: 1px solid var(--ligne); border-radius: 10px; height: 44px; }
.qte button { background: none; border: 0; width: 36px; height: 100%; font-size: 20px; cursor: pointer; }
.qte b { flex: 1; text-align: center; }
.depl-ligne { color: var(--doux); font-size: 14px; }

/* ---------- totaux */
.totaux { width: 100%; border-collapse: collapse; }
.totaux td { padding: 5px 0; }
.totaux td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totaux tr.total td { font-size: 22px; font-weight: 800; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.35); }
.totaux tr.moins td { color: #ffd2d4; }
.bloc.rouge .totaux td { color: #fff; }

.moi { border: 1px dashed #555; background: transparent; }
.jauge { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-weight: 700; }
.jauge.ok { background: rgba(47,168,102,.15); color: #6fe0a2; }
.jauge.moyen { background: rgba(233,181,0,.15); color: #ffd54a; }
.jauge.bas { background: rgba(215,40,47,.18); color: #ff8a8f; }

/* ---------- listes */
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--carte); border: 0; border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; cursor: pointer;
}
.item .gauche { flex: 1; min-width: 0; }
.item .gauche b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .gauche small { color: var(--doux); display: block; }
.item .droite { text-align: right; font-weight: 700; white-space: nowrap; }
.etiq { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--carte2); color: var(--doux); margin-top: 3px; }
.etiq.vert { background: rgba(47,168,102,.18); color: #6fe0a2; }
.etiq.jaune { background: rgba(233,181,0,.18); color: #ffd54a; }
.etiq.rouge { background: rgba(215,40,47,.2); color: #ff8a8f; }

.prix-ligne { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--ligne); }
.prix-ligne:first-of-type { border-top: 0; }
.prix-ligne .gauche { flex: 1; }
.prix-ligne .gauche small { color: var(--doux); }
.prix-ligne .montant { font-weight: 800; font-size: 17px; white-space: nowrap; }
.ajout { background: var(--rouge); color: #fff; border: 0; border-radius: 10px; width: 44px; height: 44px; font-size: 24px; cursor: pointer; flex: none; }

.villes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.villes span { background: var(--carte2); border-radius: 99px; padding: 4px 10px; font-size: 13.5px; }

.onglets-doc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--carte); padding: 5px; border-radius: 12px; margin-bottom: 14px; }
.onglets-doc button { background: none; border: 0; border-radius: 9px; padding: 11px; font-weight: 700; color: var(--doux); cursor: pointer; }
.onglets-doc button.actif { background: var(--rouge); color: #fff; }

.resultat { font-size: 15px; }
.resultat .gros { font-size: 30px; font-weight: 800; }
.avis { background: rgba(233,181,0,.12); border-left: 4px solid var(--jaune); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14.5px; }
.avis.rouge { background: rgba(215,40,47,.14); border-color: var(--rouge); }

/* ---------- tiroir (liste des services) */
.voile { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; }
.tiroir {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 86vh; overflow: auto;
  background: var(--noir); border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto; border-top: 3px solid var(--rouge);
}
.tiroir h2 { margin: 0 0 12px; font-size: 18px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 30;
  background: #fff; color: #111; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: 90vw; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}

.apercu img { width: 100%; border-radius: 10px; display: block; }

/* ---------- agenda */
.semaine-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.semaine-nav b { flex: 1; text-align: center; text-transform: capitalize; }
.semaine-nav button { background: var(--carte); border: 0; border-radius: 10px; width: 46px; height: 42px; font-size: 20px; cursor: pointer; }
.jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.jour { background: var(--carte); border: 0; border-radius: 10px; padding: 7px 0 6px; cursor: pointer; text-align: center; min-height: 62px; }
.jour small { display: block; font-size: 11px; color: var(--doux); text-transform: uppercase; }
.jour b { display: block; font-size: 18px; }
.jour i { display: flex; justify-content: center; gap: 3px; height: 7px; margin-top: 3px; font-style: normal; }
.jour i span { width: 6px; height: 6px; border-radius: 50%; }
.jour.auj b { color: var(--rouge); }
.jour.choisi { background: var(--rouge); }
.jour.choisi b, .jour.choisi small { color: #fff; }
.jour.choisi i span { box-shadow: 0 0 0 1.5px #fff; }
/* carte de rendez-vous : fond teinté de la couleur du service + barre de couleur à gauche (comme le PC) */
.rdv {
  --c: #80838D;
  display: flex; gap: 12px; width: 100%; text-align: left; border-radius: 12px;
  background: var(--carte2); border: 1px solid var(--ligne);
  background: color-mix(in srgb, var(--c) 15%, var(--carte));
  border-color: color-mix(in srgb, var(--c) 35%, transparent);
  padding: 12px 14px 12px 0; margin-bottom: 8px; cursor: pointer; overflow: hidden;
}
.rdv .barre { width: 5px; border-radius: 0 4px 4px 0; flex: none; background: var(--c); }
.rdv .corps small:first-of-type { color: #e6e6ea; color: color-mix(in srgb, var(--c) 40%, #ffffff); font-weight: 600; }
.rdv .heure { width: 58px; flex: none; font-weight: 800; font-size: 15px; }
.rdv .heure small { display: block; font-weight: 400; color: var(--doux); font-size: 12px; }
.rdv .corps { flex: 1; min-width: 0; }
.rdv .corps b { display: block; }
.rdv .corps small { display: block; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rdv.fait { opacity: .55; }

/* ---------- listes à cocher (bon de travail) */
.coche { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-top: 1px solid var(--ligne); cursor: pointer; }
.coche:first-of-type { border-top: 0; }
.coche input { width: 26px; height: 26px; accent-color: var(--vert); flex: none; margin: 0; }
.coche.ok span { text-decoration: line-through; color: var(--doux); }
.alerte-bon { background: #fff; color: #111; border-radius: 10px; padding: 10px 12px; font-weight: 700; margin-bottom: 8px; }
.alerte-bon.rouge { background: var(--rouge); color: #fff; }
.coche span { flex: 1; }
.coche .temps { flex: none; color: #fff; white-space: nowrap; }
.carte { display: block; width: 100%; height: 220px; border: 0; border-radius: 10px; margin-top: 10px; background: var(--carte2); }
.piece { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--ligne); }
.piece:first-of-type { border-top: 0; }
.piece .coche { border-top: 0; padding: 6px 0; }
.piece .no-piece { width: 118px; flex: none; padding: 8px; font-size: 14px; }
.piece .x { background: none; border: 0; color: #a8a8a8; font-size: 22px; padding: 0 2px; }
/* signature au doigt */
.pad-signature { width: 100%; height: auto; aspect-ratio: 600 / 220; background: #fff; border-radius: 10px; touch-action: none; display: block; }
.sig-faite { display: flex; align-items: center; gap: 10px; background: var(--carte2); border-radius: 10px; padding: 8px; }
.sig-faite img { width: 120px; background: #fff; border-radius: 6px; flex: none; }
/* liste d'achat, ordre des arrêts */
.achat-bloc { background: var(--carte2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.achat-bloc > b { display: block; }
.achat-bloc > small { display: block; color: var(--doux); margin-bottom: 4px; }
.achat-bloc .coche { padding: 8px 0; }
/* tableau de bord */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.kpi { background: var(--carte); border-radius: 12px; padding: 10px 12px; }
.kpi small { display: block; color: var(--doux); font-size: 12px; }
.kpi b { display: block; font-size: 19px; margin-top: 2px; }
.kpi.grand b { font-size: 23px; }
.kpi.alerte b { color: #ff8a8a; }
.ecart { font-size: 12px; font-weight: 700; }
.ecart.haut { color: #5fd38d; } .ecart.bas { color: #ff8a8a; }
.barres { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.barre-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.barre-v { width: 100%; background: var(--rouge); border-radius: 4px 4px 0 0; min-height: 2px; }
.barre-col small { color: var(--doux); font-size: 10px; margin-top: 4px; }
/* lien ouvert par le client : seulement son document */
body.vue-client .haut, body.vue-client .onglets { display: none !important; }
body.vue-client main { padding-top: 12px; max-width: 900px; }
.doc-client img { width: 100%; display: block; border-radius: 6px; background: #fff; }
.carte-veh { border: 1px solid var(--ligne); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.carte-veh .titre-veh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.carte-veh .x { background: none; border: 0; color: #a8a8a8; font-size: 14px; text-decoration: underline; padding: 4px; }
.ajout-piece { display: grid; grid-template-columns: 1fr 118px; gap: 8px; margin-top: 10px; }
.ajout-piece .btn { grid-column: 1 / -1; }

.fiche-client { display: flex; align-items: center; gap: 10px; background: var(--carte2); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.fiche-client .gauche { flex: 1; min-width: 0; }
.fiche-client small { color: var(--doux); display: block; }
.vehicule { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--ligne); }
.vehicule:first-of-type { border-top: 0; }
.vehicule .gauche { flex: 1; min-width: 0; }
.vehicule small { color: var(--doux); display: block; }
.mini { background: var(--carte2); border: 1px solid var(--ligne); border-radius: 9px; padding: 8px 12px; min-height: 40px; font-weight: 600; cursor: pointer; }
.gros-boutons { display: grid; gap: 10px; }
.gros-boutons .btn { justify-content: flex-start; min-height: 62px; font-size: 17px; }

/* 3.11 : menu comme sur le PC, pages Argent, Calculateur, Prix des pièces, prix modifiables */
.menu-titre { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--doux); margin: 18px 2px 8px; font-weight: 700; }
.gros-boutons .btn { min-height: 54px; }
.menu-ic { display: inline-block; width: 30px; text-align: center; flex: none; }
button.ligne-bouton { width: 100%; background: none; border: 0; border-top: 1px solid var(--ligne); color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.ligne-bouton:first-of-type { border-top: 0; }
button.lien-svc { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.lien-svc::after { content: ' ✎'; color: var(--doux); font-size: 13px; }
.recu-img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 4px 0; background: #fff; }
.carte-prix .bande { color: #fff; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; text-align: center; padding: 8px; border-radius: 9px; }
.carte-prix.c0 .bande { background: #5C677D; }
.carte-prix.c1 .bande { background: var(--rouge); }
.carte-prix.c2 .bande { background: #000; border: 1px solid var(--ligne); }
.carte-prix .total-prix { font-size: 28px; font-weight: 800; margin: 2px 0 4px; }
.carte-prix .total-prix small { font-size: 13px; font-weight: 400; color: var(--doux); }
.carte-prix.c1 .total-prix { color: #ff6b70; }
.tiroir h2 + h2, .tiroir label + h2, .tiroir div + h2 { margin-top: 18px; }
/* 3.14 : durées et rappels */
.ligne-svc, .rappel-ligne { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--ligne); }
.ligne-svc select, .rappel-ligne select { width: auto; flex: none; max-width: 52%; }
.bloc.rappels { border: 1px solid var(--jaune); }
/* 3.15 : signature du client à distance */
.signer-client { border: 2px solid var(--rouge); }
.bloc.paiement.paye { border: 2px solid var(--vert); }
.bloc.paiement.apayer { border: 2px solid var(--rouge); }
.etat-paiement { margin: 6px 0 0; font-size: 14.5px; }
.bloc.paiement.paye .etat-paiement { color: #7ee2a8; }
.bloc.paiement.apayer .etat-paiement { color: #ff8a8a; }
body.vue-client .tiroir { max-width: 700px; margin: 0 auto; }

#impression { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  body > *:not(#impression) { display: none !important; }
  #impression { display: block !important; }
  #impression .page { break-after: page; page-break-after: always; text-align: center; }
  #impression .page:last-child { break-after: auto; page-break-after: auto; }
  #impression img { width: 100%; max-height: 10.3in; object-fit: contain; }
}
