/* Pile à quai, page de statistiques. Habillage : celui de l'application (bleu nuit, ambre, faïence).
   Données : une seule teinte pour les grandeurs, une paire bleu / rouge pour l'avance et le retard,
   vert et rouge d'état pour « attrapé » et « raté », toujours accompagnés d'un signe et d'un mot. */
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url('/polices/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url('/polices/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('/polices/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url('/polices/barlow-semi-condensed-latin-600-normal.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --fond: #f6f8f7; --carte: #ffffff; --texte: #18203a; --texte-2: #5b6780; --filet: #dfe4e2; --piste: #e9edf1;
  --email: #152a5e; --email-fonce: #0c1838; --voyant: #ffb300;
  --serie: #2a78d6; --retard: #e34948; --neutre: #aeb7c6; --bon: #0ca30c; --critique: #d03b3b;
  --titre: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif; --corps: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond: #0c1838; --carte: #14234f; --texte: #eef1f8; --texte-2: #b3bfdc; --filet: #2b3c72; --piste: #22326a;
    --serie: #3987e5; --retard: #e66767; --neutre: #7483ad; --bon: #2fbf2f; --critique: #f07a7a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 400 16px/1.4 var(--corps); }
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--voyant); outline-offset: 2px; }
.cache-visuel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.bandeau { background: var(--email); color: #fff; padding: 14px max(20px, calc((100vw - 1180px) / 2)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.marque { display: flex; align-items: center; gap: 12px; }
.marque img { border-radius: 9px; flex: none; }
.marque .nom { font: 600 15px/1.1 var(--titre); letter-spacing: .02em; color: var(--voyant); }
.marque h1 { font: 600 23px/1.15 var(--titre); }
.outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.outils[hidden] { display: none; }
.periode { display: flex; background: rgba(255, 255, 255, .12); border-radius: 10px; padding: 3px; }
.periode button { border: 0; background: none; color: #fff; padding: 7px 12px; border-radius: 8px; font-weight: 500; font-size: 15px; min-height: 36px; }
.periode button[aria-pressed="true"] { background: #fff; color: var(--email); }
.outils a, .outils .lien { color: #fff; font-weight: 500; font-size: 15px; background: none; border: 0; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; }

main { max-width: 1220px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.attente { color: var(--texte-2); padding: 40px 0; text-align: center; }
.rang { display: grid; gap: 16px; }
.rang.quatre { grid-template-columns: repeat(4, 1fr); }
.rang.large-etroit { grid-template-columns: 2fr 1fr; }
.rang.deux { grid-template-columns: 1fr 1fr; }
@media (max-width: 980px) { .rang.quatre { grid-template-columns: 1fr 1fr; } .rang.large-etroit, .rang.deux { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .rang.quatre { grid-template-columns: 1fr; } main { padding: 14px; } }
.carte { background: var(--carte); border-radius: 14px; padding: 16px 18px 18px; box-shadow: 0 1px 2px rgba(12, 24, 56, .06), 0 0 0 1px var(--filet); min-width: 0; }
.carte h2 { font: 600 18px/1.2 var(--titre); margin-bottom: 4px; }
.carte .sous { color: var(--texte-2); font-size: 14px; margin-bottom: 12px; }

.tuile .etiquette { color: var(--texte-2); font-size: 14.5px; font-weight: 500; }
.tuile .valeur { font: 600 40px/1.1 var(--titre); font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.tuile .valeur small { font-size: 20px; font-weight: 600; }
.tuile .note { color: var(--texte-2); font-size: 14px; }
.jauge { height: 8px; border-radius: 4px; background: var(--piste); margin: 8px 0 6px; overflow: hidden; }
.jauge span { display: block; height: 100%; border-radius: 4px; background: var(--serie); }

/* Trajets par jour */
.graphe { position: relative; }
.graphe svg { display: block; width: 100%; height: auto; overflow: visible; }
.graphe .grille { stroke: var(--filet); stroke-width: 1; }
.graphe text { font: 400 11.5px var(--corps); fill: var(--texte-2); }
.graphe .colonne { fill: var(--serie); }
.graphe .zone { fill: transparent; }
.graphe .zone:hover + .colonne, .graphe .colonne.vue { filter: brightness(1.15); }
.info { position: absolute; pointer-events: none; background: var(--email-fonce); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 13.5px; line-height: 1.3; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: 0 4px 14px rgba(12, 24, 56, .3); z-index: 2; }
.info b { display: block; font-weight: 600; }
details { margin-top: 10px; }
summary { color: var(--texte-2); font-size: 14px; cursor: pointer; width: fit-content; padding: 4px 0; }

/* Issue des trajets : une barre fine en segments, les chiffres dans la liste à côté */
.segments { display: flex; gap: 2px; height: 12px; margin: 6px 0 14px; }
.segments span { display: block; height: 100%; min-width: 3px; border-radius: 3px; }
.issue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.issue li { display: flex; align-items: center; gap: 9px; font-size: 15.5px; }
.issue li b { margin-left: auto; font: 600 18px/1 var(--titre); font-variant-numeric: tabular-nums; }
.issue li small { color: var(--texte-2); font-size: 13.5px; min-width: 3.2em; text-align: right; }
.signe { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.signe svg { width: 12px; height: 12px; }
.c-gagne { background: var(--bon); } .c-perdu { background: var(--critique); } .c-autre { background: var(--neutre); }

/* Lignes à barre : un nom, une barre, un chiffre au bout */
.barres { display: grid; grid-template-columns: max-content 1fr max-content; gap: 9px 12px; align-items: center; }
.barres .nom { font-size: 15px; }
.barres .nom small { display: block; color: var(--texte-2); font-size: 13px; }
.barres .piste { height: 14px; display: flex; align-items: center; }
.barres .piste span { display: block; height: 14px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--serie); }
.barres .piste span.retard { background: var(--retard); }
.barres .piste span.vide { background: var(--piste); min-width: 2px; width: 2px; }
.barres .chiffre { font: 600 16px/1 var(--titre); font-variant-numeric: tabular-nums; text-align: right; }
.barres .chiffre small { color: var(--texte-2); font: 400 13px var(--corps); margin-left: 6px; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; color: var(--texte-2); font-size: 13.5px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; background: var(--serie); }
.legende i.retard { background: var(--retard); }

@media (max-width: 620px) {
  /* Écran étroit : le nom au-dessus, puis la barre et son chiffre sur toute la largeur. */
  .barres { grid-template-columns: 1fr max-content; gap: 4px 12px; }
  .barres .nom { grid-column: 1 / -1; margin-top: 8px; }
  .barres .nom:first-child { margin-top: 0; }
}
.suite { margin-top: 12px; height: 42px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--neutre); background: none; font-weight: 500; font-size: 15px; }

/* Tableaux */
.defile { overflow-x: auto; margin: 0 -18px -6px; padding: 0 18px 6px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th { text-align: left; font-weight: 500; color: var(--texte-2); font-size: 13.5px; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--filet); white-space: nowrap; }
td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--filet); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; font-variant-numeric: tabular-nums; }
td.fort { font-weight: 500; white-space: normal; min-width: 9em; }
td .mini { display: inline-block; vertical-align: middle; height: 8px; border-radius: 0 3px 3px 0; background: var(--serie); margin-right: 8px; min-width: 2px; }
td small { color: var(--texte-2); }
td small.dessous { display: block; font-size: 12.5px; line-height: 1.2; }
.etat { display: inline-flex; align-items: center; gap: 7px; }
.etat .signe { width: 18px; height: 18px; } .etat .signe svg { width: 10px; height: 10px; }
.vide { color: var(--texte-2); padding: 8px 0 2px; }
.pied { color: var(--texte-2); font-size: 13.5px; line-height: 1.45; padding: 4px 2px 20px; }

/* Connexion */
.porte { max-width: 400px; width: 100%; margin: 6vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.porte h2 { font: 600 24px/1.15 var(--titre); margin: 0; }
.porte p { color: var(--texte-2); font-size: 15px; }
.porte label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 15px; }
.porte input { height: 46px; border-radius: 10px; border: 1.5px solid var(--neutre); background: var(--carte); padding: 0 12px; font-size: 17px; }
.porte button { height: 48px; border-radius: 11px; border: 0; background: var(--email); color: #fff; font-weight: 600; font-size: 17px; }
@media (prefers-color-scheme: dark) { .porte button { background: var(--voyant); color: var(--email-fonce); } }
.porte button[disabled] { opacity: .6; cursor: default; }
.porte .erreur { color: var(--texte); background: color-mix(in srgb, var(--critique) 14%, var(--carte)); border-radius: 10px; padding: 10px 12px; font-size: 15px; display: flex; gap: 9px; align-items: center; }
.porte .erreur[hidden] { display: none; }
.porte code { font: 500 13.5px/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; background: var(--piste); border-radius: 8px; padding: 9px 11px; display: block; overflow-x: auto; white-space: nowrap; color: var(--texte); }
@media (prefers-reduced-motion: no-preference) { .jauge span, .barres .piste span { transition: width .3s ease; } }
