/* TRACKLOGICS live -- ecran de poste 1920x1080, theme sombre */
:root {
  --fond: #14171c; --panneau: #1c2027; --carte-fond: #0f1114; --bord: #2c323c;
  --texte: #e8e9eb; --texte2: #9aa3ad; --accent: #4da3ff; --ok: #3ddc84; --alerte: #ffb020; --rouge: #ff4d4f;
  --mono: Consolas, "Cascadia Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--texte); font: 15px/1.35 "Segoe UI", system-ui, sans-serif; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: #2a313c; border: 1px solid var(--bord); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { background: #343c48; }
button.actif { background: var(--accent); color: #041428; border-color: var(--accent); }
button.petit { padding: 3px 8px; font-size: 13px; }
label.bouton-fichier { display: inline-block; padding: 3px 8px; font-size: 13px; border-radius: 6px; background: #2a313c; border: 1px solid var(--bord); cursor: pointer; }
label.bouton-fichier:hover { background: #343c48; }
select, input[type=text], input[type=number], input[type=url], input[type=password] {
  background: #10131a; border: 1px solid var(--bord); border-radius: 6px; padding: 6px 8px; }
.mono { font-family: var(--mono); }

/* ---- bandeau ---- */
#bandeau { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--panneau); border-bottom: 1px solid var(--bord); }
#bandeau .titre { font-weight: 600; font-size: 17px; letter-spacing: .3px; display: flex; align-items: center; }
#bandeau .titre img { height: 30px; display: block; background: #fff; padding: 4px 8px; border-radius: 6px; }
/* filigrane du logo sur la carte, en bas a gauche pres de l'echelle : fond gris translucide, taille double */
#filigrane { position: absolute; left: 10px; bottom: 30px; width: 300px; max-width: 60%; opacity: .85; z-index: 450; pointer-events: none; background: rgba(60,64,72,.55); padding: 8px 10px; border-radius: 8px; }
#bandeau .onglets { display: flex; gap: 4px; margin-left: 10px; }
#bandeau .onglets button { border-radius: 6px; }
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; background: #2a313c; font-size: 14px; white-space: nowrap; }
.pastille.ok { background: #16402a; color: #7ff0b0; }
.pastille.alerte { background: #4a3410; color: #ffd27a; }
.pastille.rouge { background: #4d1a1a; color: #ff9b9b; }
.pastille.source { background: #172a45; color: #9ccbff; max-width: 640px; overflow: hidden; text-overflow: ellipsis; }
#bandeau .droite { margin-left: auto; display: flex; gap: 10px; align-items: center; }
#horloge { font-family: var(--mono); font-size: 16px; }

/* ---- disposition ---- */
/* largeur du panneau reglable a la souris (barre #separateur), bornee ; la carte prend le reste */
#principal { position: absolute; top: 52px; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: var(--panneau-w, 560px) 6px 1fr; }
#panneau { background: var(--panneau); overflow: auto; padding: 14px 16px; }
#separateur { background: var(--bord); cursor: col-resize; }
#separateur:hover, #separateur.actif { background: var(--accent); }
#carte { background: var(--carte-fond); position: relative; }
.leaflet-container { background: var(--carte-fond); font: inherit; }

/* ---- vue Une voiture ---- */
.p-tete, .p-reglage { display: grid; grid-template-columns: 34px 1fr 72px 72px 62px; gap: 6px; align-items: center; }
.p-tete { font-size: 12px; color: var(--texte2); margin: 4px 0 2px; }
.p-reglage { margin: 4px 0; }
.p-reglage input { width: 100%; box-sizing: border-box; }
.p-lbl { font: 13px var(--mono); color: var(--texte2); }
.curseur-info { font: 13px var(--mono); color: var(--texte); background: #10131a; border: 1px solid var(--bord); border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
#courbe { cursor: crosshair; }
.tours-onglets { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.tours-onglets .onglet-tour { font: 13px/1.2 var(--mono); padding: 3px 10px; border-radius: 6px; background: #2a313c; border: 1px solid var(--bord); cursor: pointer; }
.tours-onglets .onglet-tour:hover { background: #343c48; }
.tours-onglets .onglet-tour.actif { background: var(--accent); color: #041428; border-color: var(--accent); }
.autres { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.autres .puce { font: 13px/1.2 var(--mono); padding: 3px 8px; border-radius: 6px; background: #2a313c; border: 1px solid var(--bord); cursor: pointer; white-space: nowrap; }
.autres .puce:hover { background: #343c48; }
.autres .puce b { font-weight: 600; }
.autres .puce.perdue { background: #4d1a1a; color: #ff9b9b; border-color: #7a2a2a; }
.autres .puce.station { color: var(--texte2); }
.choix { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.choix select { flex: 1 1 220px; min-width: 0; font-size: 17px; padding: 8px 10px; font-family: var(--mono); }
.gros { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.gros .tuile { min-width: 0; overflow: hidden; }
.tuile.tour { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; align-items: baseline; }
.tuile.tour .etq { grid-column: 1 / -1; }
.tuile.tour .val { font-size: 44px; }
.tuile.tour .sous { font-size: 15px; }
.tuile .sous { font-size: 13px; color: var(--texte2); font-family: var(--mono); margin-top: 2px; }
.tuile { background: #10131a; border: 1px solid var(--bord); border-radius: 10px; padding: 10px 14px; }
.tuile .etq { font-size: 13px; color: var(--texte2); text-transform: uppercase; letter-spacing: .5px; }
.tuile .val { font-size: 56px; line-height: 1.05; font-weight: 600; font-family: var(--mono); }
.tuile .val small { font-size: 18px; color: var(--texte2); font-weight: 400; margin-left: 4px; }
.tuile.pleine { grid-column: 1 / -1; }
.tuile .val.moy { font-size: 30px; }
.tuile.rouge { border-color: var(--rouge); }
.tuile.rouge .val { color: var(--rouge); }
.params { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.param .etq { font-size: 13px; color: var(--texte2); }
.param .val { font-size: 26px; font-family: var(--mono); font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; }   /* v25 : tuiles plus basses, les graphes prennent la place */
.param .val small { font-size: 14px; color: var(--texte2); font-weight: 400; margin-left: 3px; }
.param .barre { height: 5px; background: #2a313c; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.param .barre i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s linear; }
.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; font-size: 15px; }
.grille .k { color: var(--texte2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.grille .v { font-family: var(--mono); font-size: 18px; }
.grille .v.rouge { color: var(--rouge); }
.grille .v.alerte { color: var(--alerte); }
/* v25 : cinq graphes empiles (vitesse, p1..p4), nom seul a gauche, meme axe de temps */
.graphes { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 4px 6px; align-items: stretch; }
.graphes canvas { width: 100%; height: 56px; display: block; background: #10131a; border: 1px solid var(--bord); border-radius: 8px; cursor: crosshair; }
.g-nom { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; text-align: right; font: 12px var(--mono); color: var(--texte2); background: none; border: none; border-right: 2px solid transparent; padding: 0 6px 0 0; cursor: pointer; align-self: stretch; min-width: 0; }
.g-nom .g-t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-nom .g-val { font-size: 13px; color: var(--texte); min-height: 15px; }   /* valeur au curseur, sans unite ni nom */
.g-nom:hover { color: var(--texte); }
.g-nom.actif { color: var(--texte); border-right-color: var(--accent); }
.g-axe { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--texte2); }
.titre-courbe .indice { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.section { margin-top: 12px; }
.section h3 { margin: 0 0 6px; font-size: 13px; color: var(--texte2); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.titre-courbe { display: flex; align-items: center; gap: 8px; }
.titre-courbe select { padding: 2px 6px; font-size: 13px; text-transform: none; }
.aide { color: var(--texte2); font-size: 13px; }

/* ---- vue Toutes ---- */
table.liste { width: 100%; border-collapse: collapse; font-size: 14px; }
table.liste th { text-align: left; color: var(--texte2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 6px 6px; border-bottom: 1px solid var(--bord); position: sticky; top: 0; background: var(--panneau); }
table.liste td { padding: 5px 6px; border-bottom: 1px solid #232831; white-space: nowrap; font-family: var(--mono); }
table.liste tr { cursor: pointer; }
table.liste tr:hover td { background: #232a35; }
table.liste tr.choisie td { background: #1b3358; }
table.liste tr.perdue td { color: #ff9b9b; background: #3a1616; }
table.liste tr.station td { color: var(--texte2); }
table.liste td.d { text-align: right; }

/* ---- vue Base ---- */
.base-grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.base-grille .tuile .val { font-size: 34px; }
table.relais { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.relais th, table.relais td { text-align: left; padding: 5px 6px; border-bottom: 1px solid #232831; font-family: var(--mono); }
table.relais th { color: var(--texte2); font-family: inherit; font-size: 12px; text-transform: uppercase; }

/* ---- marqueurs Leaflet ---- */
.ic-poste { width: 16px; height: 16px; background: #4da3ff; border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.etq-poste { background: rgba(0,0,0,.6); color: #fff; border: 0; box-shadow: none; font-size: 12px; padding: 1px 5px; }
.etq-poste::before { display: none; }
/* fluidite : le marqueur glisse entre deux echantillons (4 Hz) et la fleche tourne en douceur ;
   pas de transition pendant une animation de zoom de Leaflet */
/* la position et la fleche sont mises a jour a chaque image par la boucle d'animation (tampon 1 s) : pas de transition CSS, sinon elle traine */
.ic-voiture .fleche { transition: transform .12s linear; }
.legende-vit { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 8px; border-radius: 6px; font: 12px/1.2 var(--mono); }
.legende-vit .barre { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, hsl(240,90%,55%), hsl(180,90%,55%), hsl(120,90%,55%), hsl(60,90%,55%), hsl(0,90%,55%)); }
.legende-vit .unite { color: #cfd4da; }
.ic-voiture { position: relative; width: 0; height: 0; }
.ic-voiture .fleche { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px;
  clip-path: polygon(50% 0, 90% 100%, 50% 78%, 10% 100%); background: #ffb020; outline: 1px solid rgba(0,0,0,.4); }
.ic-voiture .point { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: #9aa3ad; border: 2px solid #fff; }
.ic-voiture .etq { position: absolute; left: 14px; top: -10px; background: rgba(0,0,0,.65); color: #fff; padding: 1px 5px; border-radius: 4px; font: 12px/1.2 var(--mono); white-space: nowrap; }
.ic-voiture .etq b { font-size: 14px; }
.ic-voiture.station .etq { color: #cfd4da; font-size: 11px; }
.ic-voiture.perdue .fleche { background: #ff4d4f; }
.ic-voiture.perdue .point { background: #ff4d4f; }
.ic-voiture.perdue .etq { background: rgba(120,0,0,.8); }
.ic-voiture.choisie .fleche { background: #4da3ff; outline: 2px solid #fff; width: 28px; height: 28px; left: -14px; top: -14px; }
.ic-voiture.choisie .etq { background: #1b3358; outline: 1px solid #4da3ff; font-size: 14px; }
.ic-voiture.choisie .point { background: #4da3ff; }
.leaflet-control-layers, .leaflet-bar a { background: #1c2027; color: #e8e9eb; border-color: #2c323c; }
.leaflet-bar a:hover { background: #2a313c; }
.leaflet-control-attribution { background: rgba(0,0,0,.5); color: #9aa3ad; font-size: 10px; }
.leaflet-control-attribution a { color: #9ccbff; }

/* ---- reglages ---- */
dialog { background: var(--panneau); color: var(--texte); border: 1px solid var(--bord); border-radius: 12px; padding: 18px 22px; width: 620px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
dialog fieldset { border: 1px solid var(--bord); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; }
dialog legend { color: var(--texte2); font-size: 13px; padding: 0 6px; }
dialog label { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
dialog label span:first-child { width: 150px; color: var(--texte2); }
dialog input[type=text], dialog input[type=url], dialog input[type=password], dialog select { flex: 1; }
dialog textarea { width: 100%; height: 90px; background: #10131a; color: var(--texte); border: 1px solid var(--bord); border-radius: 6px; font-family: var(--mono); font-size: 13px; }
dialog .boutons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; align-items: center; }
dialog .colonnes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 14px; margin-bottom: 10px; }
dialog .colonnes label { margin: 2px 0; gap: 8px; }
dialog .colonnes label span:first-child { width: auto; }
table.liste th.d { text-align: right; }
