/* Portail IA.KIP360 : feuille de style. Base KIP BackUp 360, recolorée aux couleurs du logo KIP (#002558 navy, #0069CC bleu) */
:root {
  --navy: #002558; --navy-2: #0a3a7a; --orange: #0069CC; --orange-soft: #e6f0fb;
  --bg: #f4f5f6; --card: #ffffff; --line: #d8dce0; --line-2: #eceef0;
  --text: #002558; --muted: #5a6472;
  --ok: #2f7d32; --ok-soft: #eaf3de;
  --warn: #8a5a00; --warn-soft: #fdf3e3;
  --err: #b3261e; --err-soft: #fbeaea;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--navy-2); }
h1 { font-size: 22px; margin: 2px 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: .95em; }
.ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); }

/* Barre haute */
.topbar { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 52px;
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; letter-spacing: 0; opacity: .7; }
.brand-mark { background: var(--orange); color: var(--navy); border-radius: 6px; padding: 2px 6px; font-size: 12px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #cfd8e2; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { background: var(--navy-2); color: #fff; }
.env { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 12px; }
.env .muted { color: #9fb0c2; }

.page { padding: 20px 24px 60px; max-width: 1280px; margin: 0 auto; }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h1, .card-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; align-items: center; }

/* Bandeau de synthèse */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; border-top: 3px solid var(--navy); }
.kpi.kpi-alerte { border-top-color: var(--err); }
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 22px; }

/* Statuts */
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-retard { background: var(--warn-soft); color: var(--warn); }
.st-alerte { background: var(--err-soft); color: var(--err); }

/* Blocs client */
.client-block { border-left: 4px solid var(--line); }
.client-block.bloc-ok { border-left-color: var(--ok); }
.client-block.bloc-retard { border-left-color: var(--warn); }
.client-block.bloc-alerte { border-left-color: var(--err); }
.client-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.client-title a { text-decoration: none; color: var(--text); font-weight: 600; font-size: 16px; }
.client-title a:hover { color: var(--navy-2); }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }

/* Barre de fraîcheur */
.fraicheur { width: 90px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.fraicheur > span { display: block; height: 100%; background: var(--ok); }
.fraicheur.st-retard > span { background: var(--warn); }
.fraicheur.st-alerte > span { background: var(--err); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form label.check { flex-direction: row; align-items: center; font-weight: 400; color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
input, select { font: inherit; font-weight: 400; color: var(--text); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid rgba(0,105,204,.35); border-color: var(--orange); }
input:disabled, select:disabled { background: #f4f5f6; color: var(--muted); }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.secret-state { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line-2); }
.secret-state.present { background: var(--ok-soft); color: var(--ok); }

/* Boutons */
.btn { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--navy-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-2); }
.btn-danger { color: var(--err); } .btn-danger:hover:not(:disabled) { border-color: var(--err); background: var(--err-soft); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Alertes / anomalies */
.alert-box { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.alert-box.warn { background: var(--warn-soft); color: var(--warn); }
.alert-box.err { background: var(--err-soft); color: var(--err); }
.alert-box.ok { background: var(--ok-soft); color: var(--ok); }
.anomalies { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--err); }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 6px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.2); max-width: 360px; }
.toast.err { background: var(--err); }

/* Panneau inline (formulaire d'ajout / édition affiché dans la page) */
.panel { background: #fafbfc; border: 1px dashed var(--line); border-radius: 6px; padding: 14px; margin-top: 12px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* --- v1.1 --------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.stack + .card, .card + .card { margin-top: 16px; }
.bandeau { padding: 8px 24px; font-size: 13px; }
.bandeau.warn { background: var(--warn-soft); color: var(--warn); }
.bandeau.info { background: #e3ecf5; color: var(--navy-2); }
.bandeau a { margin-left: 8px; font-weight: 600; }
.pied { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

details.client-block > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
details.client-block > summary::-webkit-details-marker { display: none; }
details.client-block[open] > summary { margin-bottom: 10px; }
details.client-block > summary .client-title::before { content: "▸"; color: var(--muted); margin-right: 2px; }
details.client-block[open] > summary .client-title::before { content: "▾"; }
.sous-bloc { border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 8px; }
.sous-bloc > summary { cursor: pointer; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.vide { text-align: center; padding: 32px; }
.reprise { border-left: 4px solid var(--orange); margin-bottom: 16px; }
.zone-danger { border-color: #efc9c6; }
.outils { margin-top: 16px; }

.form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form.inline label { flex-direction: row; align-items: center; gap: 8px; }
textarea { font: inherit; font-weight: 400; font-size: 13px; color: var(--text); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; width: 100%; }
textarea:focus { outline: 2px solid rgba(0,105,204,.35); border-color: var(--orange); }
fieldset { border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 12px 12px; margin: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.row-actions form, .actions form, .btn-row form { display: inline; margin: 0; }
tr.inactif td { color: var(--muted); }

.aide { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--line-2); color: var(--navy-2); font-size: 11px; font-weight: 700; cursor: help; vertical-align: middle; }
.aide:hover, .aide:focus { background: var(--orange-soft); outline: none; }
.champ-secret { display: flex; align-items: center; gap: 8px; }
.champ-secret input { flex: 1; }
.test-result:empty { display: none; }
.fiche-test .htmx-indicator { display: none; }
.fiche-test.htmx-request .htmx-indicator { display: inline; }

pre.apercu, pre.journal, pre.journal-direct { background: #fafbfc; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow: auto; margin: 8px 0; }
pre.journal { max-height: 70vh; }
pre.journal-direct { max-height: 55vh; min-height: 200px; }
pre .titre { color: var(--navy); font-weight: 700; }
pre .err { color: var(--err); } pre .warn { color: var(--warn); } pre .ok { color: var(--ok); font-weight: 600; }
.barre-activite { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.barre-activite span { display: block; width: 30%; height: 100%; background: var(--orange); animation: va-et-vient 1.4s ease-in-out infinite; }
@keyframes va-et-vient { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.liste li { margin-bottom: 6px; }

@media (max-width: 900px) {
  .grid-2, .row2, .row3, .row4, .kpis { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .env { display: none; }
  .page { padding: 16px; }
  .table { display: block; overflow-x: auto; }
}
.grid-2 > .card { margin-top: 0; }


/* --- Portail IA.KIP360 ----------------------------------------------------- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.app-carte { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.app-carte.etat-en_marche, .app-carte.etat-externe, .app-carte.etat-lien { border-top-color: var(--ok); }
.app-carte.etat-demarrage { border-top-color: var(--orange); }
.app-carte.etat-echec { border-top-color: var(--err); }
.app-tete { display: flex; align-items: center; gap: 12px; }
.app-titre { flex: 1; min-width: 0; }
.app-titre h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.app-logo { width: 48px; height: 48px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line-2); flex: none; }
.app-initiales { display: inline-flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; font-weight: 700; font-size: 16px; border: 0; }
.app-desc { margin: 0; color: var(--muted); flex: 1; min-height: 2.8em; }
.app-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-actions form { margin: 0; }
.app-port { margin-left: auto; }
.st-en_marche, .st-externe, .st-lien { background: var(--ok-soft); color: var(--ok); }
.st-demarrage { background: var(--orange-soft); color: var(--orange); }
.st-echec { background: var(--err-soft); color: var(--err); }
.st-arretee { background: var(--line-2); color: var(--muted); }
.logo-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.champ-port { width: 90px; }
.form.inline + .form.inline { margin-top: 10px; }
a.btn { text-decoration: none; display: inline-block; }

/* ===== Accueil « ville » (v1.1.0) : plan isométrique, un bâtiment par application ===== */
.bascule { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; background: #fff; overflow: hidden; }
.bascule a { padding: 6px 18px; text-decoration: none; color: var(--muted); font-weight: 600; }
.bascule a:hover { color: var(--navy); }
.bascule a.active { background: var(--navy); color: #fff; }

.ville-scene { background: linear-gradient(180deg, #dcebfa 0%, #f2f7fc 55%, #f9fbfd 100%);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.ville { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); min-height: 360px; user-select: none; }
.legende { margin: 10px 2px 0; }

/* Quartiers : une plaque par catégorie */
.q-route { fill: #c7d3e1; } .q-gauche { fill: #a5b5c9; } .q-droite { fill: #8ea1b8; }
.q-sol { fill: #eef4fa; }
.quartier-nom { font: 800 17px "Segoe UI", system-ui, sans-serif; letter-spacing: .1em; fill: var(--navy);
  paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-linejoin: round; stroke-opacity: .95;
  transform-box: fill-box; transform-origin: 50% 0; transform: scale(var(--k-quartier, 1)); }

/* Palettes de bâtiments, une par quartier */
.cat-0 { --haut: #5aa2e6; --gauche: #2f78c4; --droite: #1d5694; }
.cat-1 { --haut: #62c8c0; --gauche: #2f9a94; --droite: #1f726e; }
.cat-2 { --haut: #7a90d0; --gauche: #4a64a5; --droite: #324a7e; }
.cat-3 { --haut: #92d3f2; --gauche: #52a9d4; --droite: #3984ab; }
.cat-4 { --haut: #ab92da; --gauche: #7d63b6; --droite: #5c4892; }
.cat-5 { --haut: #a4b5c8; --gauche: #7189a1; --droite: #556d84; }
.f-haut { fill: var(--haut); } .f-gauche { fill: var(--gauche); } .f-droite { fill: var(--droite); }
.f-haut, .f-gauche, .f-droite { stroke: rgba(0, 37, 88, .25); stroke-width: .8; stroke-linejoin: round; }
.ombre { fill: #002558; fill-opacity: .12; }

/* Fenêtres : éteintes par défaut, allumées quand l'application tourne */
.fen { fill: #0b2a52; fill-opacity: .35; }
.etat-en_marche .fen.on, .etat-externe .fen.on, .etat-lien .fen.on { fill: #ffe08a; fill-opacity: 1; }
.etat-demarrage .fen.on { fill: #ffd27a; animation: clignote 1.2s ease-in-out infinite; }
.etat-echec .fen.on { fill: #ff9a93; fill-opacity: .9; }
@keyframes clignote { 50% { fill-opacity: .25; } }

/* Voyant au sommet */
.voyant { fill: #8a97a8; stroke: #fff; stroke-width: 1.2; }
.etat-en_marche .voyant, .etat-externe .voyant, .etat-lien .voyant { fill: var(--ok); }
.etat-demarrage .voyant { fill: #e08a00; animation: clignote 1.2s ease-in-out infinite; }
.etat-echec .voyant { fill: var(--err); }

/* Tableau de bord dressé sur le toit */
.fac-pied { fill: #1d2b3a; fill-opacity: .85; }
.fac-k { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(var(--k-fac, 1)); }

/* Interaction */
.bat { cursor: pointer; outline: none; }
.bat .corps { transition: transform .15s ease-out; }
.bat:hover .corps, .bat:focus-visible .corps { transform: translateY(-8px); }
.bat:focus-visible .f-haut { stroke: var(--navy); stroke-width: 2.4; }
.bat:hover .ombre, .bat:focus-visible .ombre { fill-opacity: .2; }

/* Étiquettes (toujours au premier plan) */
.etiquette { pointer-events: none; }
.etiquette { transform-box: fill-box; transform-origin: 50% 0; transform: scale(var(--k-app, 1)); }
.etiquette rect { fill: var(--navy); fill-opacity: .92; stroke: #fff; stroke-width: 1.5; }
.etiquette text { font: 600 17px "Segoe UI", system-ui, sans-serif; fill: #fff; }
.etiquette.etat-echec rect { stroke: var(--err); stroke-width: 3; }

/* Arbres */
.a-tronc { fill: #8b6b4a; } .a-gauche { fill: #52b788; } .a-droite { fill: #2d8a63; }

@media (prefers-reduced-motion: reduce) {
  .bat .corps { transition: none; }
  .fen, .voyant { animation: none !important; }
}

/* ===== Quartier (v1.2.0) : tableau de bord sur la façade ===== */
a.quartier { cursor: pointer; } a.quartier:hover .q-sol { fill: #e1edf9; }
.quartier-lien { cursor: pointer; } .quartier-lien:hover .quartier-nom { text-decoration: underline; }
.ville-quartier { max-height: calc(100vh - 260px); }
.fac-fond { fill: #07224a; fill-opacity: 1; stroke: rgba(255,255,255,.35); stroke-width: .8; }
.etat-arretee .fac-fond { fill: #3b4a5f; fill-opacity: 1; }
.etat-echec .fac-fond { fill: #5a1f1c; }
.fac-nom { font: 700 19px "Segoe UI", system-ui, sans-serif; fill: #fff; }
.fac-etat { font: 500 13px "Segoe UI", system-ui, sans-serif; fill: #9fc4ee; }
.fac-lib { font: 500 14px "Segoe UI", system-ui, sans-serif; fill: #b8cbe3; }
.fac-val { font: 700 30px "Segoe UI", system-ui, sans-serif; fill: #fff; }
.fac-val.niv-ok { fill: #7be0a0; } .fac-val.niv-warn { fill: #ffd27a; } .fac-val.niv-alerte { fill: #ff9a93; }
.fac-unite { font-size: 13px; font-weight: 500; fill: #b8cbe3; }
.fac-tend { font: 15px "Segoe UI", system-ui, sans-serif; fill: #b8cbe3; }
.fac-tend.tend-hausse { fill: #7be0a0; } .fac-tend.tend-baisse { fill: #ffb0a9; }
.fac-vide { font: 500 15px "Segoe UI", system-ui, sans-serif; fill: #b8cbe3; }
h3 + .grille, h3 + .card { margin-top: 0; }

/* ===== Villes (v1.3.0) : plaques de ville, plus basses que celles des quartiers ===== */
.ville-plaque:not(.perso) .v-route { fill: #b3c2d6; } .ville-plaque:not(.perso) .v-gauche { fill: #8a9cb5; }
.ville-plaque:not(.perso) .v-droite { fill: #6f839f; } .ville-plaque:not(.perso) .v-sol { fill: #dbe7f4; }
a.ville-plaque { cursor: pointer; } a.ville-plaque:not(.perso):hover .v-sol { fill: #cfe0f2; }
a.ville-plaque.perso:hover .v-sol { fill-opacity: .85; }
.ville-lien { cursor: pointer; }
.ville-nom { font-family: "Segoe UI", system-ui, sans-serif; font-weight: 800; letter-spacing: .14em; fill: var(--navy);
  paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 6px; stroke-linejoin: round; }
.ville-lien:hover .ville-nom { text-decoration: underline; }

/* ===== v1.4 : comptes, droits, journal d'accès ===== */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userbox form { margin: 0; }
.userbox .userlink { color: #cfd8e2; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.userbox .userlink:hover, .userbox .userlink.active { background: var(--navy-2); color: #fff; }
.carte-etroite { max-width: 460px; margin-left: auto; margin-right: auto; }
.cases { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cases legend { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; }
.ligne-refus td { background: var(--err-soft); }
.table select, .form select { min-width: 140px; }

/* ===== v1.5 : villes et quartiers ===== */
.org-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 8px; }
.org-tete h2 { margin: 0; margin-right: auto; }
.org-tete form { margin: 0; }
.bat-monde { cursor: pointer; }
.bat-monde:focus-visible { outline: none; }
.table form.inline { margin: 2px 0; }

/* ===== v1.5 : carte 3D zoomable (monde -> ville -> quartier -> bâtiment) ===== */
.carte-cadre { position: relative; }
.carte-scene { background: linear-gradient(180deg, #cfe3f8 0%, #e8f1fb 45%, #f7fafd 100%);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
svg.carte { display: block; width: 100%; height: clamp(440px, 74vh, 820px); cursor: grab; touch-action: none; user-select: none; }
svg.carte.glisse { cursor: grabbing; }
.carte-outils { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.carte-outils .btn { width: 36px; height: 36px; font-size: 18px; line-height: 1; padding: 0; }
.carte-info { position: absolute; left: 14px; bottom: 12px; background: rgba(255,255,255,.88); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--navy); }
.carte-info:empty { display: none; }
.fil { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; margin-top: 4px; }
.fil a { color: var(--navy-2); text-decoration: none; padding: 2px 8px; border-radius: 6px; background: #e9f0f8; }
.fil a:hover { background: #d8e5f3; }
.fil a[aria-current="page"] { background: var(--navy); color: #fff; }
.fil .sep { color: var(--muted); }

/* niveaux de zoom : ce qui est lisible à chaque distance */
svg.carte .fac-k, svg.carte .etiquette, svg.carte .quartier-lien { display: none; }
svg.carte.lvl-ville .etiquette, svg.carte.lvl-quartier .etiquette,
svg.carte.lvl-ville .quartier-lien, svg.carte.lvl-quartier .quartier-lien { display: inline; }
svg.carte.lvl-quartier .fac-k { display: inline; }
svg.carte.lvl-ville .ville-lien, svg.carte.lvl-quartier .ville-lien,
svg.carte.lvl-ville .cadenas, svg.carte.lvl-quartier .cadenas { display: none; }
svg.carte .hors-focus { opacity: .2; }
svg.carte .ville-plaque, svg.carte .quartier, svg.carte .bat-lien, svg.carte .bloc, svg.carte .etiquette,
svg.carte .ville-lien, svg.carte .quartier-lien { transition: opacity .45s ease; }
svg.carte .cadenas rect { fill: #8a94a3; } svg.carte .cadenas path { fill: none; stroke: #8a94a3; stroke-width: 5; }
.verrou .v-route { fill: #c9ced6; } .verrou .v-gauche { fill: #aab1bc; } .verrou .v-droite { fill: #8f98a6; } .verrou .v-sol { fill: #e6e9ee; }
.bloc-h { fill: #d5d9e0; } .bloc-g { fill: #b9bfca; } .bloc-d { fill: #a3abb8; }
.verrou { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { svg.carte * { transition: none !important; } }

/* Modèles de quartier (v1.5) : sol et bâtiments */
.quartier.mod-industriel .q-sol { fill: #e9e6df; } .quartier.mod-industriel .q-route { fill: #cfc8bb; }
.quartier.mod-commerce .q-sol { fill: #fbf0dc; } .quartier.mod-commerce .q-route { fill: #ecd6aa; }
.quartier.mod-tech .q-sol { fill: #e4ecf6; } .quartier.mod-tech .q-route { fill: #a9bbd6; }
.quartier.mod-tech .q-gauche { fill: #6f86ab; } .quartier.mod-tech .q-droite { fill: #587197; }
.bat.mod-industriel { --haut: #b8b1a4; --gauche: #8d8678; --droite: #6d675b; }
.bat.mod-commerce { --haut: #f2b968; --gauche: #d98f34; --droite: #aa6c1f; }
.bat.mod-tech { --haut: #6c7fa0; --gauche: #34445f; --droite: #232f47; }
.bat.mod-tech .fen { fill: #7de3ff; fill-opacity: .45; }
.d-chem .d-h { fill: #4a4640; } .d-chem .d-g { fill: #6d675b; } .d-chem .d-d { fill: #3f3b35; }
.d-cuve .d-h { fill: #d9d4c8; } .d-cuve .d-g { fill: #a9a293; } .d-cuve .d-d { fill: #858072; }
.d-enseigne .d-h { fill: #fff3d6; } .d-enseigne .d-g { fill: #e5484d; } .d-enseigne .d-d { fill: #b3292e; }
.d-bloc .d-h { fill: #9fb2d0; } .d-bloc .d-g { fill: #4a5e82; } .d-bloc .d-d { fill: #34456a; }
.d-antenne .d-h, .d-antenne .d-g, .d-antenne .d-d { fill: #2fd4ff; }
.d-chem polygon, .d-cuve polygon, .d-enseigne polygon, .d-bloc polygon, .d-antenne polygon { stroke: rgba(0, 37, 88, .25); stroke-width: .6; }

/* Icône d'un bâtiment (façade) */
.fac-icone { fill: #fff; fill-opacity: .95; }

/* Sécurité (v1.6) : double authentification, codes de secours, choix du client */
.qr { margin: 10px 0; }
.qr img { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.cle-2fa { font-size: 15px; letter-spacing: .06em; background: var(--bg, #f3f5f8); padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.code-2fa { font-size: 20px; letter-spacing: .3em; width: 9em; font-family: ui-monospace, Consolas, monospace; }
.etapes { padding-left: 20px; } .etapes li { margin-bottom: 10px; }
.codes-secours { width: 100%; font-size: 16px; line-height: 1.6; resize: none; }
.choix-villes { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.choix-villes .btn { width: 100%; justify-content: flex-start; }
.lien-manuel { width: 100%; font-size: 12px; }

/* 1.7.0 : routes, habillage des villes, fluidité, présentation, recherche */
.route-sol { fill: #a7b1bf; }
.route-ligne { fill: none; stroke: #f2d16b; stroke-width: 3; stroke-dasharray: 18 14; }
.rue-sol { fill: #b8c3d1; }
.rue-ligne { fill: none; stroke: #ffffff; stroke-width: 2; stroke-dasharray: 10 10; stroke-opacity: .85; }
svg.carte .rue { transition: opacity .45s ease; }
.ville-logo-fond { fill: #fff; stroke: var(--line); stroke-width: 1.5; }
svg.carte.lvl-ville .ville-logo, svg.carte.lvl-quartier .ville-logo,
svg.carte.lvl-ville .ville-logo-fond, svg.carte.lvl-quartier .ville-logo-fond { display: none; }

/* Pendant un mouvement de caméra : dessin allégé, aucune transition à recalculer */
svg.carte.en-mouvement { shape-rendering: optimizeSpeed; text-rendering: optimizeSpeed; }
svg.carte.en-mouvement .fen, svg.carte.en-mouvement .rue-ligne, svg.carte.en-mouvement .route-ligne,
svg.carte.en-mouvement .ombre { visibility: hidden; }
svg.carte.en-mouvement, svg.carte.en-mouvement * { transition: none !important; }
svg.carte.en-mouvement .bat:hover .corps { transform: none; }
.carte-scene { contain: layout paint; }

.bandeau-presentation { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: #fff4d6; color: #6b4e00; border-bottom: 1px solid #f0d58a; padding: 8px 16px; font-size: 13px; }
.bandeau-presentation form { margin: 0; }
.btn-presenter { width: auto !important; padding: 0 10px !important; font-size: 13px !important; }

.recherche-barre { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.recherche { flex: 1; max-width: 560px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.recherche:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.app-carte[hidden] { display: none; }
.app-lieux { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.badge.lieu { background: #e9f0f8; color: var(--navy-2); font-weight: 600; }
.apparence { margin: 4px 0 12px; } .apparence input[type=color] { width: 44px; height: 30px; padding: 0 2px; border-radius: 6px; }
svg.carte .rue, svg.carte .route { pointer-events: none; }   /* les routes ne captent pas les clics (la plaque dessous si) */

/* Mode création : panneau latéral sur la carte */
.panneau-edition { position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92%; overflow-y: auto;
  background: #fff; border-left: 1px solid var(--line); border-radius: 0 12px 12px 0; box-shadow: -6px 0 18px rgba(0, 37, 88, .08);
  padding: 12px 16px 20px; z-index: 5; }
.panneau-edition[hidden] { display: none; }
.carte-cadre.avec-panneau .carte-outils { right: 374px; }
.carte-cadre.avec-panneau svg.carte { width: calc(100% - 360px); }
.panneau-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--navy); }
.panneau-edition section { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.panneau-edition h3 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }
.panneau-edition .form { gap: 8px; }
.panneau-edition .form.inline input[type=text], .panneau-edition select { min-width: 0; flex: 1; }
.panneau-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.panneau-liste a { font-weight: 600; color: var(--navy-2); text-decoration: none; }
.panneau-liste a:hover { text-decoration: underline; }
.panneau-app { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.choix-modeles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modele-carte { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; gap: 6px; align-items: center; font-size: 13px; }
.modele-carte:has(input:checked) { border-color: var(--navy-2); background: #eef4fb; }
.modele-carte.mod-industriel span::before { content: "🏭 "; } .modele-carte.mod-commerce span::before { content: "🏬 "; }
.modele-carte.mod-affaires span::before { content: "🏢 "; } .modele-carte.mod-tech span::before { content: "📡 "; }
.btn-edition[aria-pressed="true"] { background: var(--navy); color: #fff; }
input[type=color] { width: 48px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.form label.modele-carte { flex-direction: row; align-items: center; font-weight: 600; color: var(--navy); }
.modele-carte input { margin: 0; }
.sans-telephone { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.sans-telephone summary { cursor: pointer; color: var(--navy-2); font-weight: 600; font-size: 13px; }
.sans-telephone ul { padding-left: 18px; } .sans-telephone li { margin: 8px 0; }
.mode-envoi { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.mode-envoi summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.mode-envoi[open] summary { margin-bottom: 8px; }
