/* Affichage TV — scène fixe 1920×1080, mise à l'échelle par affichage.js */
:root {
  --fond: #0B1220;
  --panneau: #111A2E;
  --panneau-2: #162238;
  --ligne: #22304A;
  --ligne-forte: #3A4C6E;
  --texte: #E8EEF7;
  --texte-2: #93A3BC;
  --texte-3: #5F6F89;
  --accent: #F5B301;
  --marque: #2C7BC8;
  --ok: #22C55E;
  --alerte: #F97316;
  --erreur: #EF4444;
  --rayon: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

#scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  display: flex;
  flex-direction: column;
  padding: 0 36px;
}

/* ---------- En-tête ---------- */
.entete {
  height: 118px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  background: #fff;
  border-radius: var(--rayon);
  padding: 6px 14px;
  height: 88px;
  display: flex;
  align-items: center;
}
.logo img { height: 76px; display: block; }
.titre { flex: 1; min-width: 0; }
.titre-agence {
  font-size: 20px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--texte-2);
}
.titre h1 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.05;
  white-space: nowrap;
}
.periode {
  font-size: 22px;
  color: var(--texte-2);
  text-align: right;
  line-height: 1.3;
}
.periode strong { color: var(--texte); font-weight: 600; }
.horloge {
  text-align: right;
  padding-left: 32px;
  border-left: 2px solid var(--ligne);
}
.heure {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.date {
  font-size: 21px;
  color: var(--texte-2);
  margin-top: 4px;
}

.progression {
  height: 5px;
  flex: none;
  background: var(--ligne);
  border-radius: 3px;
  overflow: hidden;
}
.progression-barre {
  height: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- Zone des écrans ---------- */
#ecrans {
  flex: 1;
  position: relative;
  margin: 18px 0 12px;
}
.chargement {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--texte-2);
}
.ecran {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  opacity: 0;
  transition: opacity .7s ease;
}
.ecran.visible { opacity: 1; }

/* ---------- Planning (étanchéité / couverture) ---------- */
.ecran-planning {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bloc {
  flex: 1;
  min-height: 0;
  display: grid;
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  overflow: hidden;
}
.coin {
  display: flex;
  align-items: flex-end;
  padding: 0 14px 8px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--texte-3);
  border-bottom: 2px solid var(--ligne-forte);
}
.jour {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ligne-forte);
  border-left: 1px solid var(--ligne);
}
.jour .nom-jour {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--texte-2);
}
.jour .num-jour {
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.jour .semaine {
  font-size: 13px;
  color: var(--texte-3);
  letter-spacing: .06em;
}
.jour.debut-semaine { border-left: 3px solid var(--ligne-forte); }
.jour.passe { opacity: .45; }
.jour.aujourdhui {
  background: var(--accent);
  color: #0B1220;
  opacity: 1;
}
.jour.aujourdhui .nom-jour,
.jour.aujourdhui .semaine { color: #0B1220; }

.equipe {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 14px;
  border-top: 1px solid var(--ligne);
  background: var(--panneau-2);
  min-width: 0;
}
.equipe .nom-equipe {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
}
.equipe .membres {
  font-size: 15px;
  color: var(--texte-2);
  margin-top: 2px;
}

.piste {
  display: grid;
  border-top: 1px solid var(--ligne);
  min-height: 0;
}
.case { border-left: 1px solid var(--ligne); }
.case.debut-semaine { border-left: 3px solid var(--ligne-forte); }
.case.passe { background: rgba(0, 0, 0, .28); }
.case.aujourdhui { background: rgba(245, 179, 1, .10); box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }

.barre {
  position: relative;
  margin: 3px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #334155;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.barre.passee { opacity: .5; }
.barre.coupe-gauche { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; border-left: 5px solid rgba(255, 255, 255, .55); }
.barre.coupe-droite { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; border-right: 5px solid rgba(255, 255, 255, .55); }
.barre .libelle {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.12;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
}
.piste.voies-2 .barre .libelle { font-size: 15px; }
.piste.voies-3 .barre .libelle { font-size: 14px; }
.barre .meta {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}
.piste.voies-3 .barre .meta { margin-top: 1px; font-size: 12px; }
.barre .mat { width: 18px; height: 18px; font-size: 12px; }
.barre .commande {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .28);
  padding: 0 6px;
  border-radius: 4px;
}
.barre .note { opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.mat {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #0B1220;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.type-vacances,
.type-absence {
  background: repeating-linear-gradient(135deg, #2B3649 0 12px, #232D3E 12px 24px);
  color: #CBD5E1;
}
.type-absence { background: repeating-linear-gradient(135deg, #4A2730 0 12px, #3A1F27 12px 24px); color: #FECACA; }
.type-formation { background: #6D28D9; }
.type-depot { background: #2A3446; border: 2px dashed #7C8BA5; color: #CBD5E1; }
.type-autre { background: #3F4A5C; }

.vide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 32px;
  color: var(--texte-2);
}

/* ---------- Camion benne ---------- */
.ecran-benne {
  display: flex;
  gap: 20px;
}
.calendrier {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  overflow: hidden;
}
.calendrier .entete-jour {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--texte-2);
  border-bottom: 2px solid var(--ligne-forte);
  border-left: 1px solid var(--ligne);
}
.calendrier .entete-jour:first-child { border-left: 0; }
.jour-benne {
  position: relative;
  border-left: 1px solid var(--ligne);
  border-top: 1px solid var(--ligne);
  padding: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.jour-benne:nth-child(5n + 6) { border-left: 0; }
.jour-benne .num {
  font-size: 22px;
  font-weight: 600;
  color: var(--texte-2);
  font-variant-numeric: tabular-nums;
}
.jour-benne.passe { background: rgba(0, 0, 0, .28); }
.jour-benne.passe > * { opacity: .45; }
.jour-benne.aujourdhui { box-shadow: inset 0 0 0 3px var(--accent); background: rgba(245, 179, 1, .08); }
.jour-benne.aujourdhui .num { color: var(--accent); }
.jour-benne .libre {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--texte-3);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.resa {
  flex: 1;
  margin-top: 4px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 2px 6px;
}
.resa .initiales { font-size: 50px; font-weight: 800; line-height: 1; letter-spacing: .04em; }
.resa .nom-cond { font-size: 17px; margin-top: 2px; opacity: .9; }
.resa .note { font-size: 15px; opacity: .85; text-align: center; }

.panneau-benne {
  width: 440px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.carte {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 18px 22px;
}
.carte h2 {
  font-size: 17px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--texte-2);
}
.carte .statut {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.carte .statut .grand {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
}
.carte .statut .pastille-cond {
  width: 74px;
  height: 74px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  flex: none;
}
.carte .statut .detail { font-size: 19px; color: var(--texte-2); }
.carte.libre .grand { color: var(--ok); }
.carte.prochaines { flex: 1; min-height: 0; overflow: hidden; }
.carte ul { list-style: none; margin-top: 10px; }
.carte li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--ligne);
  font-size: 21px;
}
.carte li:first-child { border-top: 0; }
.carte li .quand { flex: 1; }
.carte li .tag {
  min-width: 64px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 800;
}
.carte .aucune { margin-top: 12px; font-size: 20px; color: var(--texte-3); }

/* ---------- Pied de page ---------- */
.pied {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--ligne);
}
.legende {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  color: var(--texte-2);
  white-space: nowrap;
}
.legende .item { display: inline-flex; align-items: center; gap: 7px; }
.legende .carre { width: 18px; height: 18px; border-radius: 4px; flex: none; }
.legende .sep { width: 1px; height: 26px; background: var(--ligne-forte); }
.legende .mat { width: 20px; height: 20px; font-size: 12px; }
.pages { display: flex; gap: 10px; }
.pages .page {
  font-size: 16px;
  padding: 5px 12px;
  border-radius: 20px;
  color: var(--texte-3);
  border: 1px solid var(--ligne);
}
.pages .page.active { color: #0B1220; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.etat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--texte-2);
  white-space: nowrap;
}
.etat .pastille { width: 12px; height: 12px; border-radius: 50%; background: var(--texte-3); }
.etat.ok .pastille { background: var(--ok); }
.etat.retard .pastille { background: var(--alerte); }
.etat.retard { color: var(--alerte); }
.etat.erreur .pastille { background: var(--erreur); }
.etat.erreur { color: var(--erreur); }

/* Diagnostic de taille d'écran (?diag=1) */
.diagnostic {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 10;
  margin: 0;
  padding: 10px 14px;
  background: rgba(0, 0, 0, .85);
  color: #7CFC7C;
  font: 16px/1.4 Consolas, monospace;
  border: 2px solid #7CFC7C;
  border-radius: 6px;
}

/* ---------- Météo : ville à gauche, carte du département à droite ---------- */
.ecran-meteo {
  display: grid;
  grid-template-columns: 760px 1fr;
  gap: 20px;
}
.meteo-ville, .meteo-departement {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 20px 26px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.meteo-ville { border-top: 4px solid var(--accent); }
.titre-carte-meteo {
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
}
.meteo-departement .titre-carte-meteo { color: var(--texte-2); }
.meteo-haut { display: flex; align-items: center; gap: 22px; margin: 10px 0 14px; }
.icone-meteo { display: inline-block; flex: none; width: 56px; height: 56px; }
.icone-meteo.grande { width: 170px; height: 170px; }
.icone-meteo svg { display: block; width: 100%; height: 100%; }
.temp-actuelle { font-size: 112px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.temps-libelle { font-size: 30px; margin-top: 6px; }
.temps-minmax { font-size: 26px; color: var(--texte-2); margin-top: 4px; }
.meteo-chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.chiffre { background: var(--panneau-2); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.chiffre .libelle-meteo { font-size: 16px; color: var(--texte-2); }
.chiffre .valeur-meteo { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meteo-jours { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 0; }
.meteo-jour {
  display: grid;
  grid-template-columns: 170px 60px 1fr 110px 130px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-top: 1px solid var(--ligne);
  font-size: 24px;
}
.meteo-jour.weekend { opacity: .65; }
.nom-jour-meteo { font-weight: 600; }
.temps-jour { display: flex; align-items: baseline; gap: 10px; }
.temps-jour .tmax { font-size: 34px; font-weight: 800; }
.temps-jour .tmin { font-size: 24px; color: var(--texte-2); }
.pluie-jour, .rafales-jour { text-align: right; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.pluie-marquee, .pluie-marquee .valeur-meteo { color: #60A5FA !important; }
.seuil-orange, .seuil-orange .valeur-meteo { color: var(--alerte) !important; }
.seuil-rouge, .seuil-rouge .valeur-meteo { color: var(--erreur) !important; }
.legende .carre.seuil-orange { background: var(--alerte); }
.legende .carre.seuil-rouge { background: var(--erreur); }

.carte-departement { flex: 1; width: 100%; min-height: 0; margin-top: 8px; overflow: visible; }
.carte-departement .contour { fill: #1A2944; stroke: #4A6491; stroke-width: 2.5; stroke-linejoin: round; }
.commune circle { fill: var(--texte); stroke: var(--fond); stroke-width: 3; }
.commune.agence circle { fill: var(--accent); }
.nom-commune { fill: var(--texte); font-size: 25px; font-weight: 600; paint-order: stroke; stroke: var(--panneau); stroke-width: 6px; stroke-linejoin: round; }
.temp-commune { fill: var(--texte); font-size: 34px; font-weight: 800; paint-order: stroke; stroke: var(--panneau); stroke-width: 6px; }
.tmin-commune { fill: var(--texte-2); font-size: 26px; font-weight: 600; }
.detail-commune { fill: var(--texte-2); font-size: 21px; paint-order: stroke; stroke: var(--panneau); stroke-width: 6px; }
.detail-commune.seuil-orange { fill: var(--alerte); font-weight: 700; }
.detail-commune.seuil-rouge { fill: var(--erreur); font-weight: 700; }
.commune .rappel { stroke: var(--texte-2); stroke-width: 2; }

/* Jours fériés : colonne grisée et hachurée, aucune tâche */
.jour.ferie { background: #2A3446; opacity: 1; }
.jour.ferie .semaine { color: var(--accent); font-weight: 700; }
.jour.ferie .nom-jour, .jour.ferie .num-jour { color: var(--texte-3); }
.case.ferie { background: repeating-linear-gradient(135deg, rgba(148, 163, 184, .16) 0 10px, rgba(148, 163, 184, .06) 10px 20px); }
.jour-benne.ferie { background: repeating-linear-gradient(135deg, rgba(148, 163, 184, .16) 0 10px, rgba(148, 163, 184, .06) 10px 20px); }
.jour-benne.ferie .libre { color: var(--texte-2); text-transform: none; letter-spacing: 0; }
.legende .carre.ferie { background: repeating-linear-gradient(135deg, #64748B 0 4px, #334155 4px 8px); }
