/* Atlas de Lons-le-Saunier — maquette « salle de contrôle » pour tamairie.fr.
   Charpente et habillage propres à cette maquette (aucun gabarit partagé). */
:root {
  --fond: #0a0c0f; --fond-2: #10141a; --fond-3: #161c23; --trait: #222a33; --trait-2: #2f3a45;
  --texte: #e9e4d8; --texte-2: #a3abb4; --texte-3: #8a95a0;
  --jaune: #e3b456;  /* vin jaune du Jura : sélection, accents */
  --cuivre: #e0583f; /* colonnes de données chaudes */
  --menthe: #5fd6a6; /* flux, « en direct » */
  --bleu: #6aa6ff;   /* transports */
  --sel: #f4efe3;    /* patrimoine */
  --ombre: 0 18px 50px rgba(0, 0, 0, .55);
  --ui: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "Roboto Mono", "Cascadia Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 14px/1.45 var(--ui); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--jaune); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .mono { font-family: var(--mono); }
.mono { font-size: 12px; letter-spacing: .01em; }
::selection { background: var(--jaune); color: #000; }

/* ---------- barre haute */
.barre { height: 52px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--trait); background: var(--fond-2); }
.marque { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.marque b { font-weight: 600; font-size: 15px; }
.marque small { color: var(--texte-3); }
.sceau { display: block; width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--jaune) 0 25%, var(--cuivre) 0 50%, var(--menthe) 0 75%, var(--sel) 0); box-shadow: inset 0 0 0 4px var(--fond-2); }
.sep { width: 1px; height: 18px; background: var(--trait-2); }
.marque a { color: inherit; text-decoration: none; }
.marque .maison { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--texte-2); }
.marque .maison:hover { color: var(--texte); }
.marque .retour-dossier { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--trait-2); background: var(--fond); font-size: 13px; font-weight: 600; color: var(--texte); transition: border-color .15s; }
.marque .retour-dossier:hover { border-color: var(--jaune); }
.marque .retour-dossier span { font-weight: 400; color: var(--texte-2); }
.vues { display: flex; gap: 2px; padding: 3px; background: var(--fond); border: 1px solid var(--trait); border-radius: 9px; justify-self: center; }
.vues button { padding: 5px 13px; border-radius: 6px; color: var(--texte-2); }
.vues button.on { background: var(--fond-3); color: var(--texte); box-shadow: inset 0 0 0 1px var(--trait-2); }
.droite { display: flex; align-items: center; gap: 14px; }
.note { color: var(--texte-3); font-size: 12px; white-space: nowrap; }
.recherche { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 32px; width: 300px; background: var(--fond); border: 1px solid var(--trait); border-radius: 8px; color: var(--texte-3); }
.recherche input { flex: 1; background: none; border: 0; color: var(--texte); font: inherit; outline: 0; min-width: 0; }
.recherche kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--trait-2); border-radius: 4px; }
.resultats { position: absolute; top: 48px; right: 16px; width: 420px; max-height: 60vh; overflow: auto; background: var(--fond-2); border: 1px solid var(--trait-2); border-radius: 10px; box-shadow: var(--ombre); z-index: 40; display: none; }
.resultats.on { display: block; }
.resultats button { display: grid; grid-template-columns: 74px 1fr; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--trait); }
.resultats button:hover { background: var(--fond-3); }
.resultats .k { color: var(--texte-3); font: 11px var(--mono); padding-top: 2px; }

/* ---------- structure */
main { height: calc(100% - 52px); display: grid; grid-template-columns: 64px 1fr; }
.rail { border-right: 1px solid var(--trait); background: var(--fond-2); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 6px; }
.rail button { width: 50px; padding: 8px 0 6px; border-radius: 8px; color: var(--texte-3); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; }
.rail button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.rail button.on { color: var(--texte); background: var(--fond-3); box-shadow: inset 0 0 0 1px var(--trait-2); }
.rail .bas { margin-top: auto; color: var(--texte-3); font: 10px var(--mono); text-align: center; line-height: 1.3; }
.rail .bas i { display: block; width: 7px; height: 7px; margin: 0 auto 6px; border-radius: 50%; background: var(--menthe); box-shadow: 0 0 10px var(--menthe); }
.vue { display: none; min-width: 0; min-height: 0; }
.vue.on { display: grid; }
.vue-carte.on { grid-template-columns: 1fr 380px; grid-template-rows: 1fr 132px; }
.scene { grid-column: 1; grid-row: 1; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #121820 0%, var(--fond) 70%); }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#surcouche { pointer-events: none; }
.panneau { background: rgba(16, 20, 26, .92); border: 1px solid var(--trait-2); border-radius: 12px; backdrop-filter: blur(10px); box-shadow: var(--ombre); }

/* ---------- panneau des couches */
.couches { position: absolute; top: 14px; left: 14px; width: 330px; max-height: calc(100% - 28px); overflow: hidden auto; padding: 12px 14px 14px; z-index: 5; }
.couches h2 { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.couches h2 small { margin-left: auto; }
.couches h2::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--texte-3); border-bottom: 1.5px solid var(--texte-3); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
.couches.replie h2::after { transform: rotate(-45deg) translate(-1px, 1px); }
.couches:not(.replie) h2 { margin-bottom: 6px; }
.couches.replie > :not(h2) { display: none; }
.couches.replie { padding-bottom: 12px; }
.couches h2 small { color: var(--texte-3); font-weight: 400; }
.couche { display: grid; grid-template-columns: 22px minmax(0, 1fr) 36px; gap: 10px; align-items: center; padding: 5px 0; border-top: 1px solid var(--trait); }
.couche > div { min-width: 0; }
.couche:first-of-type { border-top: 0; }
.couche .pic { width: 14px; height: 14px; justify-self: center; }
.couche b { display: block; font-weight: 500; font-size: 13px; line-height: 1.25; }
.couche small { display: block; color: var(--texte-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bascule { width: 34px; height: 20px; border-radius: 10px; background: var(--trait-2); position: relative; transition: background .2s; }
.bascule::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--texte-3); transition: transform .2s, background .2s; }
.bascule.on { background: var(--menthe); }
.bascule.on::after { transform: translateX(14px); background: #07130e; }
.colorer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--trait); }
.colorer label { display: block; color: var(--texte-3); font-size: 12px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 3px 8px; border-radius: 999px; border: 1px solid var(--trait-2); color: var(--texte-2); font-size: 11.5px; }
.chips button.on { border-color: var(--jaune); color: var(--jaune); }
.legende { margin-top: 8px; display: grid; gap: 3px; font-size: 11.5px; color: var(--texte-2); }
.legende i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.legende p { margin: 6px 0 0; color: var(--texte-3); font-size: 11.5px; line-height: 1.4; }

/* ---------- outils de la scène */
.outils { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 5; align-items: flex-end; }
.outils .groupe { display: flex; gap: 2px; padding: 3px; background: rgba(16, 20, 26, .92); border: 1px solid var(--trait-2); border-radius: 9px; }
.outils button { width: 34px; height: 30px; border-radius: 6px; color: var(--texte-2); font-family: var(--mono); font-size: 12px; display: grid; place-items: center; }
.outils button.on, .outils button:hover { background: var(--fond-3); color: var(--texte); }
.outils .groupe.col { flex-direction: column; }
.boussole { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--trait-2); background: rgba(16, 20, 26, .92); display: grid; place-items: center; transition: transform .5s; }
.boussole svg { width: 22px; height: 22px; }
.echelle { position: absolute; left: 14px; bottom: 12px; display: flex; align-items: center; gap: 12px; color: var(--texte-3); font: 11px var(--mono); z-index: 4; }
.echelle i { display: block; width: 60px; height: 8px; border: 1px solid var(--texte-3); border-top: 0; }
.etiquette { position: absolute; transform: translate(-50%, -100%); padding: 7px 10px; background: rgba(10, 12, 15, .9); border: 1px solid var(--trait-2); border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 3; }
.etiquette b { display: block; font-weight: 600; font-size: 13px; }
.etiquette small { color: var(--texte-2); font-size: 11px; }
.etiquette::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 1px; height: 9px; background: var(--trait-2); }
.etiquette.choix { border-color: var(--jaune); }
.etiquette.choix::after { background: var(--jaune); }
.infobulle { position: absolute; padding: 6px 9px; background: rgba(10, 12, 15, .95); border: 1px solid var(--trait-2); border-radius: 6px; font-size: 12px; pointer-events: none; z-index: 6; display: none; max-width: 260px; }
.infobulle b { font-weight: 600; }
.infobulle small { display: block; color: var(--texte-2); }

/* ---------- fiche de droite */
.fiche { border-radius: 0; border: 0; border-left: 1px solid var(--trait); background: var(--fond-2); backdrop-filter: none; box-shadow: none; overflow: auto; padding: 18px 20px 24px; grid-column: 2; grid-row: 1 / 3; }
.fiche h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.fiche .sous { color: var(--texte-2); margin: 0 0 14px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: 1px solid var(--trait-2); border-radius: 10px; background: var(--fond-3); margin-bottom: 14px; width: 100%; }
.badge i { width: 9px; height: 9px; border-radius: 2px; background: var(--jaune); flex: none; }
.badge span { color: var(--texte-2); font-size: 13px; }
.lignes { display: grid; gap: 0; margin: 0 0 16px; }
.lignes div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--trait); }
.lignes span { color: var(--texte-2); }
.lignes b { font-weight: 500; text-align: right; font-family: var(--mono); font-size: 12.5px; }
.fiche h3 { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--texte); }
.fiche h3 small { color: var(--texte-3); font-weight: 400; margin-left: 6px; }
.barres div { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 8px; font-size: 12.5px; margin: 4px 0; }
.barres i { display: block; height: 7px; border-radius: 2px; background: var(--cuivre); }
.barres span { color: var(--texte-2); }
.barres b { font-family: var(--mono); font-size: 12px; text-align: right; font-weight: 500; }
.actes { list-style: none; margin: 0; padding: 0; }
.actes li { padding: 7px 0; border-bottom: 1px solid var(--trait); font-size: 12.5px; }
.actes li small { display: block; color: var(--texte-3); font-size: 11px; margin-top: 2px; }
.actes li em { font-style: normal; color: var(--jaune); }
.carte-lien { display: grid; grid-template-columns: 1fr 16px; gap: 8px; align-items: center; padding: 12px; margin-top: 10px; border: 1px solid var(--trait-2); border-radius: 10px; background: var(--fond-3); cursor: pointer; }
.carte-lien b { display: block; font-weight: 600; margin-bottom: 2px; }
.carte-lien span { color: var(--texte-2); font-size: 12.5px; }
.carte-lien:hover { border-color: var(--jaune); }
.jauge { height: 4px; background: var(--trait); border-radius: 2px; overflow: hidden; margin: 8px 0 2px; }
.jauge i { display: block; height: 100%; background: var(--menthe); }
.vide { color: var(--texte-3); font-size: 12.5px; }

/* ---------- télémétrie (bas) */
.tele { grid-column: 1; grid-row: 2; border-top: 1px solid var(--trait); background: var(--fond-2); display: grid; grid-template-columns: 150px 1fr 180px; align-items: stretch; }
.tele .titre { padding: 14px 16px; border-right: 1px solid var(--trait); }
.tele .titre b { display: block; font-weight: 600; }
.tele .titre small { color: var(--texte-3); font-size: 11px; }
.tele .graphe { position: relative; min-width: 0; }
.tele .graphe canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tele .live { padding: 14px 16px; border-left: 1px solid var(--trait); text-align: right; }
.tele .live b { display: block; color: var(--menthe); font-weight: 600; }
.tele .live b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--menthe); margin-right: 7px; box-shadow: 0 0 8px var(--menthe); }
.tele .live small { color: var(--texte-2); font-size: 11.5px; display: block; margin-top: 4px; }
.tele .live em { font-style: normal; color: var(--texte-3); }

/* ---------- registre */
.vue-registre.on { grid-template-rows: auto 1fr; }
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--trait); background: var(--fond-2); }
.filtres select, .filtres input { background: var(--fond); border: 1px solid var(--trait-2); color: var(--texte); border-radius: 8px; padding: 6px 10px; font: inherit; }
.filtres .compte { margin-left: auto; color: var(--texte-2); font-family: var(--mono); font-size: 12px; }
.tableau { overflow: auto; padding: 0 20px 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--texte-3); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 12px 10px 8px; border-bottom: 1px solid var(--trait-2); position: sticky; top: 0; background: var(--fond); }
td { padding: 8px 10px; border-bottom: 1px solid var(--trait); vertical-align: top; }
td.mono { color: var(--texte-2); white-space: nowrap; }
.puce { display: inline-block; padding: 1px 7px; border-radius: 999px; font: 11px var(--mono); border: 1px solid var(--trait-2); color: var(--texte-2); }
.puce.deliberation { border-color: #4b5f78; color: #9fc0ea; } .puce.decision { border-color: #6a5a33; color: var(--jaune); } .puce.arrete { border-color: #3f6a57; color: var(--menthe); }
.plus { margin: 14px auto; display: block; padding: 8px 16px; border: 1px solid var(--trait-2); border-radius: 8px; color: var(--texte-2); }

/* ---------- fabrique (schéma signature) */
.vue-fabrique.on { grid-template-columns: 1fr; overflow: auto; }
.fabrique { max-width: 1180px; margin: 0 auto; padding: 36px 24px 60px; display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: start; }
.fabrique h2 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.fabrique h2 small { display: block; font-size: 16px; color: var(--texte-2); font-weight: 400; margin-top: 8px; font-family: var(--ui); }
.fabrique .svg { grid-column: 1; }
.fabrique svg { width: 100%; height: auto; display: block; }
.strates { display: grid; gap: 14px; position: sticky; top: 24px; }
.strate { padding: 12px 14px; border: 1px solid var(--trait); border-left: 2px solid var(--jaune); border-radius: 0 10px 10px 0; }
.strate b { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-3); margin-bottom: 4px; font-family: var(--mono); }
.strate span { font-size: 13px; color: var(--texte-2); }
.strate em { font-style: normal; color: var(--texte); font-family: var(--mono); font-size: 12.5px; }
@keyframes couler { to { stroke-dashoffset: -40; } }
.flux { stroke-dasharray: 6 8; animation: couler 2.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .flux { animation: none; } .boussole { transition: none; } }

/* ---------- chronologie */
.vue-chrono.on { grid-template-columns: 1fr; overflow: auto; }
.chrono { max-width: 900px; margin: 0 auto; padding: 36px 24px 60px; }
.chrono h2 { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.chrono .sous { color: var(--texte-2); margin: 0 0 24px; }
.frise { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--trait-2); }
.frise li { position: relative; padding: 10px 0 10px 26px; }
.frise li::before { content: ""; position: absolute; left: -5px; top: 17px; width: 9px; height: 9px; border-radius: 50%; background: var(--texte-3); }
.frise li.maire::before { background: var(--jaune); box-shadow: 0 0 0 3px rgba(227, 180, 86, .25); }
.frise li.finances::before { background: var(--cuivre); } .frise li.urbanisme::before { background: var(--bleu); } .frise li.environnement::before, .frise li.energie::before { background: var(--menthe); }
.frise .d { font: 12px var(--mono); color: var(--texte-3); }
.frise .ev { margin: 2px 0 0; }
.frise .cat { font: 11px var(--mono); color: var(--texte-3); margin-left: 8px; }

/* ---------- petits écrans */
@media (max-width: 1100px) {
  body { overflow: auto; }
  main { height: auto; min-height: calc(100% - 52px); }
  .vue-carte.on { grid-template-columns: 1fr; grid-template-rows: auto 132px auto; }
  .scene { height: 70vh; min-height: 480px; }
  .fiche { grid-row: 3; grid-column: 1; border-left: 0; border-top: 1px solid var(--trait); max-height: none; }
  .couches { width: 290px; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .barre { height: auto; grid-template-columns: 1fr; gap: 8px; padding: 10px 16px; }
  .marque small, .marque .retour-dossier span, .marque .sep:last-of-type { display: none; }
  .vues { justify-self: stretch; }
  .vues button { flex: 1; text-align: center; padding: 6px 2px; font-size: 13px; }
  .note, .recherche kbd { display: none; }
  .droite { display: block; }
  .recherche { width: 100%; }
  .etiquette:not(.choix) { display: none; }
  .resultats { left: 16px; right: 16px; width: auto; top: 100px; }
  main { height: auto; grid-template-columns: 1fr; }
  .rail { display: none; }
  .vue-carte.on { grid-template-rows: auto auto auto; }
  .scene { height: 64vh; min-height: 420px; }
  .couches { position: static; width: auto; max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .scene .couches { position: absolute; left: 12px; right: 12px; top: auto; bottom: 36px; width: auto; max-height: 56%; padding: 10px 12px; }
  .outils { top: 12px; right: 12px; flex-direction: row; align-items: center; gap: 6px; }
  .outils .groupe.col { flex-direction: row; }
  .boussole { display: none; }
  .echelle { bottom: 6px; left: 12px; right: 12px; font-size: 9.5px; line-height: 1.3; }
  .fiche { max-height: none; padding: 16px; }
  .tele { grid-template-columns: 1fr; grid-template-rows: auto 110px auto; }
  .tele .titre, .tele .live { border: 0; text-align: left; padding: 10px 16px; }
  .fabrique { grid-template-columns: 1fr; padding: 24px 16px 40px; }
  .strates { position: static; }
  .chrono { padding: 24px 16px 40px; }
  .tableau { padding: 0 8px 20px; }
}

/* ---------- v2 : projets */
.actes.projets li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start; cursor: pointer; }
.actes.projets li:hover { background: var(--fond-3); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.actes.projets i { display: block; width: 10px; height: 10px; border-radius: 2px; margin-top: 4px; }
.badge span b { color: var(--texte); font-weight: 600; }
.etiquette { max-width: 260px; white-space: normal; }
.etiquette b { font-size: 12.5px; line-height: 1.25; }

/* photo libre dans la fiche projet */
.fiche figure.photo { margin: -18px -20px 16px; position: relative; }
.fiche figure.photo img { display: block; width: 100%; height: 190px; object-fit: cover; filter: saturate(.8) brightness(.85); }
.fiche figure.photo figcaption { padding: 6px 20px 0; font: 11px/1.4 var(--mono); color: var(--texte-3); }
.fiche figure.photo figcaption a { color: var(--texte-2); }
