/* Atelier EBZ — couleurs Electro Bike Zone (gris-bleu #3A4750, rouge #D63636) */
:root {
  --fond: #f3f4f6; --carte: #fff; --texte: #1f2933; --discret: #6b7280; --ligne: #e5e7eb;
  --marque: #3A4750; --marque-clair: #e8ebee; --accent: #D63636; --ok: #1f8a4c; --ok-clair: #e3f4ea;
  --alerte: #c2410c; --alerte-clair: #fdecdf; --info-clair: #e8f0fb;
  --rayon: 12px; --barre: 64px;
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #111418; --carte: #1b2026; --texte: #e6e8eb; --discret: #9aa3ad; --ligne: #2b323a;
    --marque-clair: #2a333c; --ok-clair: #16301f; --alerte-clair: #3a2216; --info-clair: #1c2a3b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 16px/1.4 var(--police); -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--barre) + env(safe-area-inset-bottom)); }
a { color: inherit; }
h1, h2, h3 { margin: 0; }

.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  background: var(--marque); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.entete h1 { flex: 1; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px;
  color: #fff; text-decoration: none; font-size: 28px; border-radius: 10px; }
.icone-btn:active { background: rgba(255,255,255,.15); }
.bandeau-essai { background: #fff4d6; color: #6b4e00; font-size: 13px; padding: 6px 12px; text-align: center; }
.message { background: var(--ok-clair); color: var(--ok); padding: 10px 14px; font-weight: 600; }
.contenu { max-width: 860px; margin: 0 auto; padding: 12px; }

.barre { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--carte);
  border-top: 1px solid var(--ligne); padding-bottom: env(safe-area-inset-bottom); }
.barre a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--barre); text-decoration: none; color: var(--discret); font-size: 11px; text-align: center; }
.barre a svg { width: 24px; height: 24px; }
.barre a.actif { color: var(--accent); font-weight: 600; }

.filtres { display: flex; gap: 8px; margin-bottom: 12px; }
.filtres input { flex: 1; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=date], input[type=password],
select, textarea { width: 100%; font: inherit; color: inherit; background: var(--carte); border: 1px solid var(--ligne);
  border-radius: 10px; padding: 11px 12px; min-height: 46px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marque); outline-offset: 0; }

.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  border: 0; border-radius: 10px; padding: 11px 16px; min-height: 46px; background: var(--marque); color: #fff;
  text-decoration: none; cursor: pointer; }
.bouton:active { filter: brightness(.9); }
.bouton.secondaire { background: var(--marque-clair); color: var(--texte); }
.bouton.petit { min-height: 46px; padding: 8px 14px; white-space: nowrap; }
.bouton.gros { width: 100%; min-height: 54px; font-size: 17px; }
.bouton.ok { background: var(--ok); }
.bouton.google { background: #fff; color: #1f2933; border: 1px solid var(--ligne); width: 100%; }

.titre-section { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin: 16px 4px 8px; }
.compte { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--marque-clair);
  color: var(--texte); font-size: 12px; text-align: center; text-transform: none; letter-spacing: 0; }

.liste { display: flex; flex-direction: column; gap: 6px; }
.ligne { display: flex; align-items: center; gap: 10px; background: var(--carte); border-radius: var(--rayon);
  padding: 10px 12px; text-decoration: none; border: 1px solid var(--ligne); width: 100%; text-align: left; font: inherit; color: inherit; }
button.ligne { cursor: pointer; }
.ligne:active { background: var(--marque-clair); }
.l-date { flex: 0 0 74px; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--discret); }
.retard .l-date { color: var(--accent); }
.l-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.l-principal > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-principal span { font-size: 14px; color: var(--discret); }
.l-rep { font-size: 13px !important; }
.l-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.collab { font-size: 12px; color: var(--discret); }
.marchandise { border-left: 4px solid #7c3aed; }
.bat-en-cours { border-left: 4px solid #0ea5e9; }
.liste.compacte .ligne { border: 0; border-bottom: 1px solid var(--ligne); border-radius: 0; padding: 8px 0; }
.vide { color: var(--discret); padding: 8px 4px; }

.puce { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--marque-clair); white-space: nowrap; }
.puce.ok { background: var(--ok-clair); color: var(--ok); }
.puce.alerte { background: var(--alerte-clair); color: var(--alerte); }
.stock-magasin { background: #e3f4ea; color: #1f6b3f; }
.stock-garage-11 { background: #e8f0fb; color: #1e4f8f; }
.stock-garage-tomate { background: #fdecdf; color: #9a3412; }
.wa-read, .wa-delivered { background: var(--ok-clair); color: var(--ok); }
.wa-sent, .wa-accepted, .wa-envoyé { background: #fff4d6; color: #6b4e00; }
.wa-failed { background: #fde2e2; color: #b91c1c; }

.carte { background: var(--carte); border-radius: var(--rayon); padding: 14px; margin-bottom: 12px; border: 1px solid var(--ligne); }
.carte h3 { font-size: 15px; margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.carte h3:not(:first-child) { margin-top: 16px; }
.entete-fiche.termine { border-left: 5px solid var(--ok); }
.ef-haut { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ef-client { font-size: 20px; font-weight: 700; }
.ef-client a { text-decoration: none; }
.ef-velo { color: var(--discret); }
.ef-etat { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.contact-rapide { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.contact-rapide .bouton { flex: 1; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.actions form { display: contents; }
.actions .bouton { width: 100%; }
.actions .bouton.gros { grid-column: 1 / -1; }
.choix { display: flex; flex-wrap: wrap; gap: 8px; }
.pastille { font: inherit; font-weight: 600; border: 1px solid var(--ligne); background: var(--carte); color: inherit;
  border-radius: 22px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
.pastille.choisie { background: var(--marque); color: #fff; border-color: var(--marque); }
.en-ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.en-ligne input { flex: 1; min-width: 140px; }
.en-ligne > span { flex: 1; }

.details { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 12px; margin: 0; }
.details dt { color: var(--discret); font-size: 14px; }
.details dd { margin: 0; }
.texte { white-space: pre-wrap; }
.discret { color: var(--discret); font-size: 14px; }
.lien-petit { font-size: 13px; color: var(--discret); margin-left: 6px; }
.note { padding: 8px 0; border-bottom: 1px solid var(--ligne); }
.note:last-child { border-bottom: 0; }
.note-meta { font-size: 13px; color: var(--discret); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.vignette { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1;
  background: var(--marque-clair); border-radius: 10px; text-decoration: none; font-size: 28px; overflow: hidden; text-align: center; }
.vignette img { width: 100%; height: 70%; object-fit: cover; }
.vignette span { font-size: 11px; padding: 0 4px; color: var(--discret); }
.repli summary { font-weight: 600; cursor: pointer; padding: 2px 0; }
.repli[open] summary { margin-bottom: 10px; }
.journal { margin: 0; padding-left: 18px; font-size: 14px; color: var(--discret); }
.archive dd { font-size: 13px; word-break: break-word; }

.formulaire { display: flex; flex-direction: column; gap: 14px; }
.formulaire label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--discret); }
.formulaire label > input, .formulaire label > select, .formulaire label > textarea { color: var(--texte); font-size: 16px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 14px; color: var(--discret); margin-bottom: 6px; }
.cases, .oui-non { display: flex; flex-wrap: wrap; gap: 8px; }
.case { flex-direction: row !important; align-items: center; }
.case input { position: absolute; opacity: 0; pointer-events: none; }
.case span { display: inline-block; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  border-radius: 22px; padding: 10px 14px; font-size: 15px; min-height: 44px; }
.case input:checked + span { background: var(--marque); border-color: var(--marque); color: #fff; }
.case input:focus-visible + span { outline: 2px solid var(--accent); }
.oui-non .case span { min-width: 90px; text-align: center; }
.interrupteur { flex-direction: row !important; align-items: center; gap: 10px !important; color: var(--texte) !important; font-size: 16px !important; }
.interrupteur input { width: 22px; height: 22px; }
.si-autre { margin-top: 8px; }
.barre-form { position: sticky; bottom: calc(var(--barre) + env(safe-area-inset-bottom) + 8px); }
.client-choisi { display: flex; flex-direction: column; }
.client-choisi span { color: var(--discret); font-size: 14px; }
.erreur { background: #fde2e2; color: #b91c1c; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.info { background: var(--info-clair); padding: 10px 12px; border-radius: 10px; }
.pages { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.deux-boutons { display: grid; gap: 8px; }
.fichier-btn input { display: none; }

.menu { display: flex; flex-direction: column; background: var(--carte); border-radius: var(--rayon); border: 1px solid var(--ligne); margin-bottom: 12px; overflow: hidden; }
.menu a { padding: 14px 16px; text-decoration: none; border-bottom: 1px solid var(--ligne); }
.menu a:last-child { border-bottom: 0; }
.menu a:active { background: var(--marque-clair); }

/* Connexion */
.page-connexion { background: var(--marque); padding-bottom: 0; }
.connexion { max-width: 420px; margin: 0 auto; padding: 48px 16px; display: flex; flex-direction: column; gap: 16px; color: #fff; }
.connexion .logo { font-size: 32px; text-align: center; letter-spacing: .02em; }
.connexion .logo b { color: var(--accent); }
.connexion h2 { font-size: 16px; font-weight: 600; text-align: center; }
.tuiles-collab { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tuile-collab { font: inherit; font-size: 18px; font-weight: 600; min-height: 72px; border-radius: 14px; border: 0;
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.tuile-collab.choisie { background: var(--accent); }
.pave-pin { background: var(--carte); color: var(--texte); border-radius: 16px; padding: 16px; }
.pin-pour { margin: 0 0 8px; text-align: center; }
.pin-champ { text-align: center; font-size: 28px; letter-spacing: .4em; margin-bottom: 12px; }
.touches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.touches button { font: inherit; font-size: 24px; min-height: 60px; border-radius: 12px; border: 1px solid var(--ligne);
  background: var(--marque-clair); color: var(--texte); cursor: pointer; }
.touches .ok { background: var(--ok); color: #fff; border: 0; font-size: 18px; font-weight: 700; }
.connexion .erreur { text-align: center; }
.connexion .discret { color: rgba(255,255,255,.75); text-align: center; }
.dev { color: #fff; } .dev .bouton { margin: 6px 0; width: 100%; }

@media (min-width: 720px) {
  .actions { grid-template-columns: repeat(4, 1fr); }
  .deux-boutons { grid-template-columns: 1fr 1fr; }
}

/* Batteries */
.ef-photo { flex: 0 0 72px; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--ligne); }
.ef-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ef-photo.sans-image { display: none; }
.ligne-avec-bouton { display: flex; gap: 6px; align-items: stretch; }
.ligne-avec-bouton > .ligne { flex: 1; min-width: 0; }
.ligne-avec-bouton > form { display: flex; }
.ligne-avec-bouton > form .bouton { white-space: nowrap; }
.deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trois-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trois-photos .fichier-btn.choisi { background: var(--ok-clair); color: var(--ok); }
.cases.colonne { flex-direction: column; }
.devis-oui { background: var(--ok-clair); color: var(--ok); }
.devis-non { background: #fde2e2; color: #b91c1c; }
.devis-en-attente-client, .devis-devis { background: #fff4d6; color: #6b4e00; }
.note.sav { border-left: 3px solid var(--ok); padding-left: 8px; }
.galerie.mini { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); margin-top: 6px; }
.pagination { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0; }
.l-photo { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: 0 0 52px; background: var(--ligne); }
.entete-fiche .ef-photo { flex-basis: 100%; width: 100%; height: auto; max-height: 340px; }
.entete-fiche .ef-photo img { max-height: 340px; object-fit: contain; background: #111; }
.note.test.en-cours { border-left: 3px solid var(--alerte); padding-left: 8px; }
.note.test .actions { margin-top: 8px; }
.photo-test { display: flex; flex-direction: column; gap: 6px; }
.photo-test img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.ligne-carte { display: flex; gap: 12px; align-items: flex-start; color: inherit; text-decoration: none; }
.ligne-carte img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: 0 0 96px; }
.details.compact { margin: 4px 0; }
.photo-large { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; background: #111; margin-bottom: 12px; }
.prix { font-weight: 700; color: var(--ok); }
