/* Bloc « Votre bâtiment » (vue 3D encastrée). Adapté de prototypes/batiment-3d/style.css. */
.bat { --bat-action: #175cd3; --bat-action-clair: #e8f0fd; --bat-ok: #15803d; --bat-ok-clair: #e7f5ec; --bat-bad: #b91c1c; --bat-bad-clair: #fdecec;
  --bat-neutre-clair: #f1f3f6; --bat-texte: #182b46; --bat-texte-2: #4b5563; --bat-bord: #e2e6ec;
  --bat-ombre: 0 8px 28px rgba(17, 24, 39, .14), 0 1px 3px rgba(17, 24, 39, .08);
  border: 1px solid #dce2ec; border-radius: 13px; background: #fff; overflow: hidden; box-shadow: 0 16px 50px #182b4608; font-size: 13px; line-height: 1.45; color: var(--bat-texte); }
.bat button { font: inherit; color: inherit; cursor: pointer; }
.bat :focus-visible { outline: 3px solid var(--bat-action); outline-offset: 2px; }
.bat p { color: inherit; }

.bat-barre { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line, #dde5ef); }
.bat-titre { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; margin: 0; }
.bat-titre strong { font-weight: 650; }
.bat-nom { color: var(--bat-texte-2); }
.bat-fictif { background: #fff4d6; color: #6b4a00; border-radius: 4px; padding: 0 6px; font-size: 11.5px; }
.bat-outils { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bat-controles { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bat-controles[hidden] { display: none; }
.bat-onglets, .bat-segment { display: inline-flex; background: #f1f4f8; border-radius: 8px; padding: 3px; gap: 2px; }
.bat-onglets button, .bat-segment button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; color: #4b5563; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; min-height: 30px; }
.bat-onglets button[aria-pressed="true"], .bat-segment button[aria-checked="true"] { background: #fff; color: var(--bat-action); box-shadow: 0 1px 4px #182b4618; font-weight: 600; }
.bat-point { width: 8px; height: 8px; border-radius: 50%; background: var(--bat-ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, .18); }
.bat-bouton-vue { border: 1px solid var(--bat-bord); background: #fff; border-radius: 8px; padding: 5px 11px; display: inline-flex; gap: 7px; align-items: center; font-size: 12.5px; min-height: 36px; }
.bat-bouton-vue[aria-pressed="true"] { border-color: var(--bat-action); color: var(--bat-action); background: var(--bat-action-clair); }
.bat-icone-liste { width: 14px; height: 11px; background: linear-gradient(currentColor 0 0) top/100% 2px no-repeat, linear-gradient(currentColor 0 0) center/100% 2px no-repeat, linear-gradient(currentColor 0 0) bottom/100% 2px no-repeat; }

.bat-zone { position: relative; aspect-ratio: 16 / 9; min-height: 440px; overflow: hidden; background: linear-gradient(#eef3f9, #f7f4ee); }
.bat-affiche { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
.bat-pret .bat-affiche, .bat-pret .bat-statut { display: none; }
.bat-statut { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2; width: max-content; max-width: calc(100% - 24px); margin: 0;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--bat-bord); border-radius: 10px; padding: 8px 12px; box-shadow: var(--bat-ombre); text-align: center; font-size: 12.5px; color: var(--bat-texte-2); }
.bat-statut:empty { display: none; }
.bat-statut button { margin: 6px auto 0; display: block; border: 0; background: var(--bat-action); color: #fff; border-radius: 7px; padding: 8px 14px; font-weight: 600; min-height: 36px; }
.bat-legende-bas, .bat-aide { margin: 0; padding: 10px 16px; display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--bat-texte-2); border-top: 1px solid var(--line, #dde5ef); }
.bat-aide { border-top: 0; padding-top: 0; }

.bat-scene { position: absolute; inset: 0; z-index: 1; isolation: isolate; }
.bat-scene canvas { display: block; }
.bat-scene.survol canvas { cursor: pointer; }
/* le message de chargement est porté par .bat-statut (site.js) */
.bat-chargement { display: none; }

.bat-etiquettes { position: absolute; inset: 0; pointer-events: none; }
.bat-etiquette { pointer-events: auto; border: 1px solid var(--bat-bord); background: rgba(255, 255, 255, .95); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px !important; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 8px rgba(17, 24, 39, .12); color: var(--bat-texte) !important; }
.bat-etiquette:hover, .bat-etiquette.survol { box-shadow: 0 0 0 2px var(--bat-action), 0 4px 12px rgba(23, 92, 211, .25); }
.bat-etiquette.actif { background: var(--bat-action); color: #fff !important; border-color: var(--bat-action); }
.bat-etiquette.actif .bat-pastille { box-shadow: 0 0 0 2px #fff; }
.bat-etiquette.presente { background: #0f3f99; color: #fff !important; border-color: #0f3f99; }
.bat-etiquette .duree { font-weight: 500; white-space: pre; }
.bat-etiquette.compacte { padding: 4px; gap: 0; box-shadow: 0 1px 4px rgba(17, 24, 39, .18); z-index: 1 !important; }
.bat-etiquette:not(.compacte) { z-index: 2 !important; }
.bat-etiquette.actif, .bat-etiquette.survol, .bat-etiquette:focus-visible { z-index: 3 !important; }
.bat-etiquette.compacte .nom, .bat-etiquette.compacte .duree { display: none; }
.bat-etiquette-niveau { font-size: 10.5px; font-weight: 600; color: var(--bat-texte-2); background: rgba(255, 255, 255, .8); border-radius: 6px; padding: 2px 7px; white-space: nowrap; pointer-events: none; text-transform: uppercase; letter-spacing: .04em; }
.bat-marqueur { pointer-events: auto; border: 1.5px dashed var(--bat-action); color: var(--bat-action) !important; background: rgba(255, 255, 255, .94); border-radius: 8px; padding: 3px 9px; font-size: 12px !important; font-weight: 600; white-space: nowrap; }
.bat-marqueur:hover { background: var(--bat-action-clair); }
.bat-bulle { background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 12.5px; box-shadow: var(--bat-ombre); white-space: nowrap; border: 1px solid var(--bat-bord); pointer-events: none; }
.bat-bulle strong { color: var(--bat-action); letter-spacing: .04em; }
.bat-zone.mode-histoire .bat-etiquette:not(.vedette), .bat-zone.mode-histoire .bat-etiquette-niveau, .bat-zone.mode-histoire .bat-marqueur { opacity: .28; }

.bat-pastille { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bat-pastille.ok { background: var(--bat-ok); }
.bat-pastille.bad { background: var(--bat-bad); }
.bat-pastille.neutre { background: #a3aab5; }
.bat-pastille.pointille { background: transparent; border: 1.5px dashed #6b7280; }
.bat-pastille.action { background: var(--bat-action); }
.bat-pastille.blanc { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }

.bat-horloge { position: absolute; top: 10px; right: 10px; z-index: 3; background: rgba(255, 255, 255, .92); border: 1px solid var(--bat-bord); border-radius: 9px; padding: 4px 9px; display: flex; gap: 8px; align-items: baseline; font-size: 11px; color: var(--bat-texte-2); }
.bat-horloge strong { font-variant-numeric: tabular-nums; color: var(--bat-texte); font-size: 13px; }
.bat-fil { position: absolute; top: 10px; left: 10px; z-index: 3; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; max-width: 340px; }
.bat-fil li { background: rgba(255, 255, 255, .94); border: 1px solid var(--bat-bord); border-radius: 8px; padding: 3px 9px; font-size: 11.5px; color: var(--bat-texte-2); animation: bat-arrivee .35s ease-out; }
.bat-fil time { font-variant-numeric: tabular-nums; color: var(--bat-texte); font-weight: 600; margin-right: 6px; }
@keyframes bat-arrivee { from { opacity: 0; transform: translateY(-4px); } }
.bat-legende { position: absolute; left: 10px; bottom: 10px; z-index: 3; background: rgba(255, 255, 255, .94); border: 1px solid var(--bat-bord); border-radius: 9px; padding: 5px 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--bat-texte-2); }
.bat-legende span { display: inline-flex; align-items: center; gap: 5px; }
.bat-zone.mode-histoire .bat-fil, .bat-zone.mode-histoire .bat-horloge, .bat-zone.mode-histoire .bat-legende,
.bat-zone.vue-liste .bat-fil, .bat-zone.vue-liste .bat-legende, .bat-zone.vue-liste .bat-horloge { display: none; }

.bat-histoire { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(680px, calc(100% - 24px)); z-index: 4; background: #fff; border-radius: 13px; box-shadow: var(--bat-ombre); padding: 11px 14px; }
.bat-histoire[hidden] { display: none; }
.bat-histoire-etapes { display: flex; gap: 6px; margin-bottom: 8px; }
.bat-histoire-etapes span { flex: 1; height: 4px; border-radius: 2px; background: var(--bat-bord); }
.bat-histoire-etapes span.fait { background: var(--bat-action); }
.bat-histoire-texte { margin: 0 0 9px !important; font-size: 14px; min-height: 2.9em; color: var(--bat-texte) !important; }
.bat-histoire-texte b { color: var(--bat-action); }
.bat-histoire-boutons { display: flex; gap: 8px; justify-content: flex-end; }
.bat-histoire-boutons button { border: 1px solid var(--bat-bord); background: #fff; border-radius: 8px; padding: 6px 13px; min-height: 36px; }
.bat-histoire-boutons button:disabled { opacity: .45; cursor: default; }
.bat-histoire-boutons .primaire { background: var(--bat-action); color: #fff; border-color: var(--bat-action); }

.bat-panneau { position: absolute; top: 10px; right: 10px; bottom: 10px; width: 320px; z-index: 6; background: #fff; border-radius: 13px; box-shadow: var(--bat-ombre); padding: 16px 16px 14px; overflow: auto; }
.bat-panneau[hidden] { display: none; }
.bat-poignee { display: none; }
.bat-fermer { position: absolute; top: 9px; right: 9px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--bat-neutre-clair); font-size: 20px !important; line-height: 1; }
.bat-panneau-titre { margin: 0 40px 2px 0; font-size: 17px; letter-spacing: -.01em; }
.bat-panneau-titre:focus { outline: none; }
.bat-surtitre { color: var(--bat-texte-2) !important; font-size: 12px; margin: 0 0 10px !important; }
.bat-panneau dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0; }
.bat-panneau dt { color: var(--bat-texte-2); }
.bat-panneau dd { margin: 0; font-weight: 500; }
.bat-panneau h4, .bat-liste h4 { font-size: 11.5px; margin: 14px 0 6px; color: var(--bat-texte-2); text-transform: uppercase; letter-spacing: .05em; }
.bat-code { font-variant-numeric: tabular-nums; letter-spacing: .06em; font-weight: 700; }
.bat-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bat-badge.ok { background: var(--bat-ok-clair); color: var(--bat-ok); }
.bat-badge.bad { background: var(--bat-bad-clair); color: var(--bat-bad); }
.bat-badge.neutre { background: var(--bat-neutre-clair); color: #4b5563; }
.bat-badge.action { background: var(--bat-action-clair); color: var(--bat-action); }
.bat-ecrans-liste { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.bat-ecrans-liste button { width: 100%; text-align: left; border: 1px solid var(--bat-bord); background: #fff; border-radius: 10px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bat-ecrans-liste button:hover { border-color: var(--bat-action); }
.bat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bat-actions button { border: 1px solid var(--bat-bord); background: #fff; border-radius: 9px; padding: 8px 12px; font-weight: 600; min-height: 36px; }
.bat-actions .primaire { background: var(--bat-action); color: #fff; border-color: var(--bat-action); }
.bat-actions .danger { color: var(--bat-bad); border-color: #f3c2c2; }
.bat-que-faire { background: var(--bat-neutre-clair); border-radius: 10px; padding: 10px 12px 10px 30px; margin: 8px 0 0; }
.bat-que-faire li + li { margin-top: 4px; }
.bat-note { color: var(--bat-texte-2) !important; font-size: 12px; margin: 4px 0 0; }
.bat-simule { margin-top: 14px !important; }
.bat-lien-retour { border: 0; background: none; color: var(--bat-action) !important; padding: 0; margin-bottom: 8px; font-weight: 600; }

.bat-liste { position: absolute; inset: 0; z-index: 2; overflow: auto; padding: 16px 20px 40px; background: #f6f7f9; }
.bat-liste[hidden] { display: none; }
.bat-liste:focus { outline: none; }
.bat-liste-titre { margin: 0 0 8px; font-size: 16px; }
.bat-niveau { margin: 0 0 14px; }
.bat-salles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.bat-salle-carte { background: #fff; border: 1px solid var(--bat-bord); border-radius: 11px; padding: 10px 12px; }
.bat-salle-nom { border: 0; background: none; padding: 0; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; width: 100%; gap: 8px; text-align: left; }
.bat-salle-nom:hover { color: var(--bat-action) !important; }
.bat-salle-carte ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.bat-salle-carte li { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--bat-texte-2); }
.bat-vide { font-style: italic; }
.bat-vide .bat-lien-retour { margin: 0; font-style: normal; }

.bat-toast { position: absolute; left: 50%; top: 12px; transform: translate(-50%, -20px); opacity: 0; z-index: 8; pointer-events: none; background: #111827; color: #fff; border-radius: 10px; padding: 7px 13px; font-size: 12.5px; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); }
.bat-toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .bat-barre { padding: 10px 12px; }
  .bat-outils, .bat-controles { width: 100%; }
  .bat-onglets { width: 100%; justify-content: space-between; }
  .bat-onglets button { flex: 1; justify-content: center; }
  .bat-masque { display: none; }
  .bat-segment button { padding: 5px 9px; }
  .bat-zone { aspect-ratio: auto; height: 520px; min-height: 0; }
  .bat-affiche { object-fit: contain; }
  .bat-fil { display: none; }
  .bat-legende { left: 8px; right: 8px; bottom: 8px; gap: 8px; font-size: 10.5px; padding: 4px 8px; }
  .bat-horloge span { display: none; }
  .bat-panneau { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 64%; border-radius: 16px 16px 0 0; padding-top: 22px; box-shadow: 0 -8px 28px rgba(17, 24, 39, .18); }
  .bat-poignee { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #cfd5dd; }
  .bat-histoire { bottom: 8px; width: calc(100% - 16px); padding: 10px 12px; }
  .bat-histoire-texte { font-size: 13px; }
  .bat-liste { padding: 12px 12px 40px; }
  .bat-etiquette { font-size: 11px !important; padding: 2px 8px 2px 6px; }
  .bat-legende-bas, .bat-aide { padding: 9px 12px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .bat *, .bat *::before, .bat *::after { animation: none !important; transition: none !important; }
}
