/* Marine et or relevés sur la plaquette de l'offre (v2) */
:root {
  --marine: #142038;
  --marine-fonce: #081020;
  --or: #d8a040;
  --or-clair: #e0c080;
  --fond: #f8f8f4;
  --texte: #142038;
  --gris: #b0b4bc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--fond);
  color: var(--texte);
}
.bandeau {
  background: var(--or);
  color: var(--marine-fonce);
  text-align: center;
  font-weight: 700;
  padding: 8px 12px;
}
.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 20px;
  background: var(--marine);
  color: #fff;
}
.entete h1 { margin: 0; font-size: 1.5rem; flex: 1 1 200px; overflow-wrap: anywhere; }
.selecteur { display: flex; gap: 8px; }
button {
  touch-action: manipulation;
  min-height: 48px;
  min-width: 48px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  border: 2px solid var(--or);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.selecteur button[aria-pressed="true"] { background: var(--or); color: var(--marine-fonce); }
button.secondaire { border-color: var(--gris); }
main { padding: 20px; min-height: 50vh; }
[hidden] { display: none !important; }
.pied { padding: 12px 20px; font-size: .85rem; color: var(--marine); opacity: .7; }
@media (max-width: 800px) { .selecteur { flex-wrap: wrap; } }

/* Écran agent */
h2 { margin: 0 0 8px; font-size: 1.25rem; }
.agent-grille { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .agent-grille { grid-template-columns: 1fr; } }
.carte { background: #fff; border: 1px solid var(--gris); border-radius: 12px; padding: 16px; }
fieldset { border: 0; padding: 0; margin: 12px 0; }
legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.auto { margin: 0; opacity: .8; }
.touches { display: flex; flex-wrap: wrap; gap: 8px; }
.touche { min-height: 56px; border-color: var(--marine); }
.touche[aria-pressed="true"] { background: var(--marine); color: #fff; }
.pastille[aria-pressed="true"] { background: var(--or); border-color: var(--or); color: var(--marine-fonce); }
.pastille { border-radius: 28px; }
.plaque { display: block; font-weight: 700; margin: 12px 0; }
.plaque input { display: block; margin-top: 6px; min-height: 48px; width: 14em; max-width: 100%; padding: 0 12px; font: inherit; text-transform: uppercase; border: 2px solid var(--gris); border-radius: 10px; }
button.principal { background: var(--or); color: var(--marine-fonce); min-width: 200px; }
button:disabled { opacity: .4; cursor: not-allowed; }
.etat-envoi { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pastille-etat { padding: 8px 14px; border-radius: 24px; font-weight: 700; background: #dff0e0; color: #1d5a2a; }
.pastille-etat[data-etat="hors"] { background: #fbe3d0; color: #8a3a08; }
.pastille-etat[data-etat="envoi"] { background: #e6e9f2; color: var(--marine); }
.compteur { margin: 16px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.compteur span:first-child { font-size: 3rem; font-weight: 800; line-height: 1; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { padding: 8px 0; border-top: 1px solid #e4e4e0; }
.liste .heure { font-variant-numeric: tabular-nums; opacity: .7; }
.envoi { font-size: .85rem; padding: 2px 8px; border-radius: 12px; margin-left: 6px; }
.envoi.ok { background: #dff0e0; color: #1d5a2a; }
.envoi.attente { background: #fbe3d0; color: #8a3a08; }
.vide { opacity: .6; }

/* Bennes */
h3 { margin: 16px 0 6px; font-size: 1.05rem; }
.bennes { margin-top: 20px; }
.cartes-bennes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cartes-bennes .vide { padding: 4px 0; }
.benne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border: 1px solid var(--gris); border-radius: 10px; background: #fff; }
.benne[data-etat="signalee"] { border-color: var(--or); }
.benne[data-etat="demandee"] { background: #f4ecd8; border-color: var(--or); }
.badge { display: inline-block; min-width: 1.6em; padding: 0 8px; border-radius: 14px; background: var(--or); color: var(--marine-fonce); text-align: center; font-size: 1rem; }
.fond-modal { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 16, 32, .6); }
.modal { width: min(560px, 100%); max-height: 100%; overflow: auto; background: #fff; border-radius: 12px; padding: 20px; }
.modal p { margin: 6px 0; }
.modal pre { white-space: pre-wrap; font: inherit; background: var(--fond); border: 1px solid var(--gris); border-radius: 8px; padding: 12px; }
.mention { font-weight: 700; color: #8a3a08; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* Tableau de bord du siège */
.synthese { display: grid; gap: 20px; }
.tuiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tuile { background: var(--marine); color: #fff; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tuile strong { font-size: 2.2rem; line-height: 1.1; color: var(--or-clair); }
.tuile span { font-size: .95rem; }
.graphiques { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.barre { display: grid; grid-template-columns: 9.5em 1fr 2.5em; align-items: center; gap: 10px; padding: 4px 0; }
.barre .nom { overflow-wrap: anywhere; }
.barre .piste { background: #ecece6; border-radius: 6px; height: 22px; overflow: hidden; }
.barre .rempli { display: block; height: 100%; background: var(--or); border-radius: 6px; }
.barre .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.grille { display: grid; grid-template-columns: 3.2em repeat(10, 1fr); gap: 4px; }
.grille .entete-col, .grille .entete-lig { font-size: .85rem; opacity: .75; text-align: center; align-self: center; }
.case { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(20, 32, 56, calc(.06 + .94 * var(--i))); color: var(--marine); }
.case.fonce { color: #fff; }
.legende { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .85rem; }
.degrade { width: 160px; height: 14px; border-radius: 7px; background: linear-gradient(to right, rgba(20, 32, 56, .06), rgba(20, 32, 56, 1)); }
.fictif { margin: 10px 0 0; font-size: .8rem; opacity: .65; }
@media (max-width: 900px) {
  .tuiles { grid-template-columns: repeat(3, 1fr); }
  .graphiques { grid-template-columns: 1fr; }
}
#vue-siege > .bennes:first-child { margin-top: 0; }
#siege-synthese { margin-top: 20px; }

/* Aperçu de l'export : tableau défilant, jamais plus large que l'écran. */
.defile { overflow: auto; max-height: 50vh; }
.tableau { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tableau th, .tableau td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--gris); white-space: nowrap; }
#zone-export { display: flex; justify-content: flex-end; }
#apercu-export .modal { width: min(820px, 100%); }
.pret { margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: var(--or); color: var(--marine-fonce); font-weight: 600; }
