/* Commande Terrain — Innoflex SA. Mobile d'abord, gros boutons, une main. */
:root {
  --navy: #012060;
  --navy-2: #1b3a80;
  --accent: #1f7a6d;
  --accent-clair: #e1f2ee;
  --fond: #f3f5fa;
  --carte: #ffffff;
  --texte: #14203a;
  --gris: #5b6782;
  --trait: #dde3ee;
  --vert: #1f8a4c;
  --orange: #c27a0e;
  --rouge: #c23b2e;
  --vert-clair: #e3f4ea;
  --orange-clair: #fbf0dc;
  --rouge-clair: #f9e3e0;
  --rayon: 12px;
  --police: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.4 var(--police);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.ecran-chargement { padding: 40vh 16px 0; text-align: center; color: var(--gris); }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 10px; min-height: 56px;
}
.barre .titres { flex: 1; min-width: 0; }
.barre small { display: block; opacity: .75; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre strong { display: block; font-size: 19px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre .icone-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; font-size: 20px; flex: none; }
.barre .reseau { font-size: 12px; background: var(--orange); color: #fff; padding: 3px 8px; border-radius: 99px; }

.contenu { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 120px max(16px, env(safe-area-inset-left, 0px)); max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

/* Onglets du bas */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--carte);
  border-top: 1px solid var(--trait); display: flex;
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 6px) max(8px, env(safe-area-inset-left, 0px));
}
.onglets button { flex: 1; background: none; border: 0; padding: 8px 4px; font-size: 13px; color: var(--gris); border-radius: 10px; position: relative; }
.onglets button.actif { color: var(--navy); font-weight: 650; background: #e9eef8; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 12px; margin-left: 4px; }

/* Éléments */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.etiquette { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); font-weight: 600; }
.aide { font-size: 13px; color: var(--gris); }
.champ { display: flex; flex-direction: column; gap: 4px; }
.champ label { font-size: 13px; color: var(--gris); font-weight: 600; }
.champ input, .champ select, .champ textarea {
  border: 1px solid var(--trait); border-radius: 10px; padding: 12px; background: #fff; width: 100%; font-size: 16px;
}
.champ input:focus, .champ select:focus, .champ textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.champ textarea { min-height: 70px; resize: vertical; }
.ligne-champs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.requis::after { content: " *"; color: var(--rouge); }

.btn { border: 0; border-radius: 12px; padding: 14px 16px; font-weight: 650; font-size: 16px; text-align: center; }
.btn-principal { background: var(--accent); color: #fff; }
.btn-principal:disabled { opacity: .5; }
.btn-secondaire { background: #fff; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-discret { background: none; color: var(--gris); padding: 10px; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { background: #fff; color: var(--rouge); border: 1.5px solid var(--rouge); }
.btn-bloc { width: 100%; display: block; }
.pied {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--carte); border-top: 1px solid var(--trait);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 10px) max(16px, env(safe-area-inset-left, 0px));
  display: flex; gap: 10px; align-items: center;
}
.pied .total { flex: 1; min-width: 0; }
.pied .total small { display: block; color: var(--gris); font-size: 12px; }
.pied .total b { font-size: 19px; }
.pied .btn { flex: 1.3; }

.recherche { border: 1px solid var(--trait); border-radius: 12px; padding: 13px 14px; width: 100%; font-size: 16px; background: #fff; }

/* Listes */
.liste { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--trait); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t span { font-size: 13px; color: var(--gris); }
.item .droite { text-align: right; font-size: 13px; color: var(--gris); flex: none; }
.pastille { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.p-vert { background: var(--vert); } .p-orange { background: var(--orange); } .p-rouge { background: var(--rouge); }

.statut { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.s-envoyee, .s-attente { background: #e9eef8; color: var(--navy); }
.s-prise_en_charge { background: #e4ecfb; color: #2253b8; }
.s-a_corriger { background: var(--rouge-clair); color: var(--rouge); }
.s-confirmee { background: var(--vert-clair); color: var(--vert); }
.s-annulee { background: #eee; color: #777; }
.s-attente { background: var(--orange-clair); color: var(--orange); }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { border: 1.5px solid var(--trait); background: #fff; border-radius: 99px; padding: 9px 14px; font-size: 15px; }
.puce.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.puce.pointille { border-style: dashed; color: var(--gris); }

.gammes { display: flex; flex-direction: column; gap: 6px; }
.gamme { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--trait); border-radius: 12px; background: #fff; text-align: left; }
.gamme.on { border-color: var(--navy); background: #eef2fb; }
.gamme span { color: var(--gris); font-size: 13px; flex: none; }

.ligne-cmd { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--trait); }
.ligne-cmd:last-child { border-bottom: 0; }
.ligne-cmd .t { flex: 1; min-width: 0; }
.ligne-cmd .t b { display: block; font-weight: 600; }
.ligne-cmd .t .detail { font-size: 13px; color: var(--gris); font-family: var(--mono); }
.ligne-cmd .prix { text-align: right; font-family: var(--mono); font-size: 14px; flex: none; }
.ligne-cmd .prix small { display: block; color: var(--gris); font-size: 11px; font-family: var(--police); }
.tag { display: inline-block; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: #e9eef8; color: var(--navy); margin: 3px 4px 0 0; font-family: var(--police); }
.tag.alerte { background: var(--orange-clair); color: var(--orange); }

.prix-bandeau { background: var(--accent-clair); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.prix-bandeau b { font-family: var(--mono); color: var(--accent); font-size: 18px; }
.prix-bandeau span { font-size: 13px; color: var(--gris); }

.message { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.m-info { background: #e9eef8; color: var(--navy); }
.m-ok { background: var(--vert-clair); color: var(--vert); }
.m-alerte { background: var(--orange-clair); color: #8a5608; }
.m-erreur { background: var(--rouge-clair); color: var(--rouge); }

.pas { display: flex; align-items: center; gap: 0; border: 1px solid var(--trait); border-radius: 12px; overflow: hidden; background: #fff; width: fit-content; }
.pas button { width: 52px; height: 50px; border: 0; background: #f0f3f9; font-size: 22px; }
.pas input { width: 80px; border: 0; text-align: center; font-size: 20px; font-family: var(--mono); height: 50px; }

.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.interrupteur input { width: 24px; height: 24px; accent-color: var(--accent); }

.succes { text-align: center; padding: 40px 10px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.succes .rond { width: 74px; height: 74px; border-radius: 50%; background: var(--vert-clair); color: var(--vert); font-size: 38px; display: flex; align-items: center; justify-content: center; }
.succes h2 { margin: 0; font-size: 22px; }

.connexion { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 24px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px)); max-width: 440px; margin: 0 auto; gap: 18px; }
.marque { display: flex; flex-direction: column; gap: 4px; }
.marque b { font-size: 28px; color: var(--navy); letter-spacing: .01em; }
.marque span { color: var(--gris); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 86px); z-index: 20; background: var(--texte); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }

.vide { text-align: center; color: var(--gris); padding: 30px 10px; font-size: 15px; }
.photo-apercu { max-height: 140px; border-radius: 10px; border: 1px solid var(--trait); }

@media (prefers-reduced-motion: no-preference) {
  .puce, .gamme, .btn, .item { transition: background-color .12s, border-color .12s; }
}

.carte-liste { padding: 0; gap: 0; }
.carte-entete { padding: 12px 14px 8px; }
.vide-petit { padding: 16px; }
.ligne-champs.deux { grid-template-columns: 1fr 1fr; }
.ligne-champs.deux-un { grid-template-columns: 1fr 2fr; }
.motif-renvoi { display: block; color: var(--rouge); font-size: 13px; }
.texte-rouge { color: var(--rouge) !important; }
