:root {
  --bleu: #14365f; --bleu-clair: #e6edf6; --fond: #f1f3f6; --carte: #ffffff; --texte: #1c2430; --gris: #5b6675;
  --trait: #d5dbe3; --vert: #167a42; --vert-clair: #e2f4e9; --rouge: #b42318; --rouge-clair: #fde7e4;
  --orange: #8a4f06; --orange-clair: #fdf0d9;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--fond); color: var(--texte); font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.45; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; color: var(--bleu); }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; color: var(--bleu); }
p { margin: .4rem 0; }
.attente, .petit { color: var(--gris); }
.petit { font-size: .85rem; }

.barre { background: var(--bleu); color: #fff; padding: .7rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; }
.barre .titre { font-weight: 700; font-size: 1.05rem; }
.barre .qui { font-size: .85rem; opacity: .9; }
.barre button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.onglets { display: flex; flex-wrap: wrap; gap: .25rem; background: #fff; border-bottom: 1px solid var(--trait); padding: .4rem .75rem 0; }
.onglets a { padding: .6rem .9rem; text-decoration: none; color: var(--gris); font-weight: 600; border-bottom: 3px solid transparent; }
.onglets a.actif { color: var(--bleu); border-bottom-color: var(--bleu); }
main { max-width: 1150px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.centre { max-width: 460px; margin: 8vh auto; padding: 0 1rem; }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 1rem; margin-top: 1rem; }
.entete-page { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; }

button, .bouton { font: inherit; font-weight: 700; border-radius: 10px; padding: .6rem 1rem; border: 2px solid var(--bleu); background: #fff; color: var(--bleu); cursor: pointer; }
a.bouton { display: inline-block; text-decoration: none; }
button.plein, .bouton.plein { background: var(--bleu); color: #fff; }
button.leger { border-color: var(--trait); font-weight: 600; padding: .35rem .7rem; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #f0a020; outline-offset: 2px; }

label { display: block; font-weight: 600; margin-top: .8rem; }
label .aide { display: block; font-weight: 400; color: var(--gris); font-size: .85rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .65rem; margin-top: .25rem; border: 2px solid var(--trait); border-radius: 8px; background: #fff; color: var(--texte); }
textarea { min-height: 9rem; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.case { display: flex; gap: .5rem; align-items: center; font-weight: 600; margin-top: .8rem; }
.case input { width: 1.3rem; height: 1.3rem; margin: 0; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.defilement { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: top; }
th { background: var(--bleu-clair); color: var(--bleu); font-size: .85rem; white-space: nowrap; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
tr.entete-groupe td { background: #f7f9fc; font-weight: 700; color: var(--bleu); }

.pastille { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pastille.vert { background: var(--vert-clair); color: var(--vert); }
.pastille.orange { background: var(--orange-clair); color: var(--orange); }
.pastille.rouge { background: var(--rouge-clair); color: var(--rouge); }
.pastille.gris { background: #eceff3; color: var(--gris); }

.message { border-radius: 10px; padding: .6rem .8rem; margin-top: .8rem; }
.message.erreur { background: var(--rouge-clair); color: var(--rouge); }
.message.bon { background: var(--vert-clair); color: var(--vert); }
.message.info { background: var(--bleu-clair); color: var(--bleu); }
.message.attention { background: var(--orange-clair); color: var(--orange); }

.ligne-a-traiter { border: 1px solid var(--trait); border-radius: 10px; padding: .7rem .8rem; margin-top: .6rem; background: #fff; }
.resultat-jauge { font-size: 1.3rem; font-weight: 700; color: var(--bleu); }
details summary { cursor: pointer; font-weight: 600; color: var(--bleu); margin-top: 1rem; }
.lignes-tableau { max-height: 22rem; overflow: auto; border: 1px solid var(--trait); border-radius: 8px; margin-top: .5rem; }

/* Morceau 2 */
[hidden] { display: none !important; }
.actions-barre { display: flex; flex-wrap: wrap; gap: .5rem; }
.sans-marge { margin: 0; }
.sous-carte { border: 1px solid var(--trait); border-radius: 10px; padding: .2rem .8rem .8rem; margin-top: .8rem; background: #fafbfd; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.tuile { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: .8rem 1rem; }
.gros-chiffre { font-size: 1.9rem; font-weight: 700; color: var(--bleu); font-variant-numeric: tabular-nums; }

/* Morceau 3 : la fin de tour, sur téléphone */
.etapes { display: flex; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; flex-wrap: wrap; }
.etapes li { flex: 1 1 0; min-width: 5.5rem; text-align: center; padding: .4rem .3rem; border-radius: 8px; background: #e9edf3; color: var(--gris); font-size: .85rem; font-weight: 600; }
.etapes li.actif { background: var(--bleu); color: #fff; }
.etapes li.fait { background: var(--vert-clair); color: var(--vert); }
.ligne-chiffre { display: flex; justify-content: space-between; gap: .75rem; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.ligne-chiffre.total { border-top: 1px solid var(--trait); margin-top: .4rem; padding-top: .5rem; font-weight: 700; }
.pistolet { border-top: 1px solid var(--trait); padding: .6rem 0; }
.pistolet:first-of-type { border-top: 0; }
.pistolet label { margin-top: .2rem; }
.grand-bouton { display: block; width: 100%; text-align: center; padding: 1rem; font-size: 1.1rem; margin-top: .8rem; text-decoration: none; }
.chiffre-saisi { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.signature-zone { border: 2px dashed var(--trait); border-radius: 10px; background: #fff; display: block; width: 100%; max-width: 360px; height: 150px; touch-action: none; }
.signature-image { border: 1px solid var(--trait); border-radius: 10px; background: #fff; max-width: 100%; height: 110px; }
.resultat { border-radius: 10px; padding: .55rem .75rem; margin-top: .5rem; font-weight: 700; }
.resultat.vert { background: var(--vert-clair); color: var(--vert); }
.resultat.rouge { background: var(--rouge-clair); color: var(--rouge); }
.resultat.orange { background: var(--orange-clair); color: var(--orange); }
.prix-du-jour { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.prix-du-jour div { flex: 1 1 5rem; background: var(--bleu-clair); color: var(--bleu); border-radius: 10px; padding: .4rem .5rem; text-align: center; font-size: .8rem; }
.prix-du-jour b { display: block; font-size: 1.05rem; }
.element-liste { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; padding: .45rem 0; border-top: 1px solid var(--trait); }
.element-liste:first-child { border-top: 0; }

/* Sur un téléphone, la barre du haut prend moins de place. */
@media (max-width: 600px) {
  .barre { padding: .5rem .75rem; }
  .barre button { padding: .3rem .6rem; font-size: .8rem; font-weight: 600; border-width: 1px; }
  main { padding: .75rem .75rem 4rem; }
}

/* Photos (compteurs, reçus) */
.zone-photo { margin-top: .5rem; }
.photo-prise { display: block; max-width: 100%; max-height: 180px; border: 1px solid var(--trait); border-radius: 10px; margin-bottom: .4rem; }

/* Sur un petit écran, une longue pastille passe à la ligne au lieu de pousser le bouton hors de la carte. */
.element-liste > div { min-width: 0; }
.element-liste .pastille, .pistolet .pastille { white-space: normal; }

/* Base de répétition : un bandeau orange toujours visible, pour ne pas la confondre avec la vraie base. */
.bandeau-repetition { position: sticky; top: 0; z-index: 10; background: #c2410c; color: #fff; text-align: center; font-weight: 700; padding: .35rem .8rem; font-size: .9rem; }
