/* Prospectus — interface légère (D20). Téléphone d'abord, sans dépendance. */

:root {
  --bleu: #17335f;
  --bleu-clair: #e8eef8;
  --gris: #f3f4f6;
  --gris-texte: #6b7280;
  --texte: #111827;
  --rouge: #b91c1c;
  --vert: #047857;
  --bord: #d1d5db;
  --rayon: 12px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--gris); color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; color: var(--bleu); }
h2 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
a { color: var(--bleu); }

.ecran-centre { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.carte { background: #fff; border-radius: var(--rayon); box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 1rem; }
.formulaire { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: .8rem; }
.formulaire label, .barre label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--gris-texte); }
input, select { font: inherit; padding: .6rem .7rem; border: 1px solid var(--bord); border-radius: 8px; background: #fff; color: var(--texte); min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--bleu); outline-offset: 1px; }
.sous-titre { margin: 0 0 .5rem; color: var(--gris-texte); font-size: .95rem; }
.erreur { color: var(--rouge); min-height: 1.2em; margin: 0; font-size: .95rem; }
.aide { color: var(--gris-texte); font-size: .9rem; margin: .5rem 0; }
.compte { color: var(--gris-texte); font-size: .9rem; margin: .5rem 0 .25rem; }

.bouton { font: inherit; padding: .65rem 1rem; border-radius: 8px; border: 1px solid var(--bleu); background: #fff; color: var(--bleu); cursor: pointer; }
.bouton.principal { background: var(--bleu); color: #fff; }
.bouton.discret { border-color: transparent; background: transparent; color: var(--gris-texte); }
.bouton.petit { padding: .35rem .7rem; font-size: .85rem; }
.bouton:disabled { opacity: .5; cursor: default; }

.entete { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--bleu); color: #fff; position: sticky; top: 0; z-index: 5; }
.entete .marque { font-weight: 700; font-size: 1.1rem; }
.entete .agent { flex: 1; font-size: .9rem; opacity: .9; }
.entete .bouton.discret { color: #fff; }

.onglets { display: flex; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--bord); position: sticky; top: 3rem; z-index: 4; }
.onglet { flex: 1 0 auto; padding: .7rem .9rem; border: 0; border-bottom: 3px solid transparent; background: transparent; font: inherit; font-size: .9rem; color: var(--gris-texte); white-space: nowrap; cursor: pointer; }
.onglet.actif { color: var(--bleu); border-bottom-color: var(--bleu); font-weight: 600; }
.sous-onglets { display: flex; gap: .25rem; margin: .5rem 0; flex-wrap: wrap; }
.sous-onglets button { font: inherit; font-size: .85rem; padding: .4rem .7rem; border-radius: 999px; border: 1px solid var(--bord); background: #fff; color: var(--gris-texte); cursor: pointer; }
.sous-onglets button.actif { background: var(--bleu-clair); color: var(--bleu); border-color: var(--bleu); }

main { padding: .75rem 1rem 3rem; max-width: 1100px; margin: 0 auto; }
.barre { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .5rem; }
.barre label { flex: 1 1 130px; }
.barre label.large { flex: 2 1 220px; }
.barre .bouton { flex: 0 0 auto; }

.liste { display: flex; flex-direction: column; gap: .6rem; }
.fiche { background: #fff; border-radius: var(--rayon); box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: .8rem .9rem; display: grid; grid-template-columns: auto 1fr auto; gap: .3rem .8rem; align-items: center; cursor: pointer; }
.fiche:active { background: var(--bleu-clair); }
.fiche .titre { grid-column: 2; font-weight: 600; }
.fiche .sous { grid-column: 2; color: var(--gris-texte); font-size: .88rem; }
.fiche .droite { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-size: .85rem; color: var(--gris-texte); }
.fiche .droite strong { display: block; font-size: 1rem; color: var(--texte); }
.classe { grid-row: 1 / span 2; width: 2.4rem; height: 2.4rem; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 1.1rem; }
.classe-A { background: #00a06d; } .classe-B { background: #52b153; } .classe-C { background: #a5cc74; color: #1f2937; }
.classe-D { background: #f4e70f; color: #1f2937; } .classe-E { background: #f0b40f; color: #1f2937; } .classe-F { background: #eb8235; } .classe-G { background: #d7221f; }
.classe-inconnue { background: var(--bord); color: var(--texte); }
.etiquette { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: var(--bleu-clair); color: var(--bleu); margin-right: .3rem; }
.etiquette.attention { background: #fef3c7; color: #92400e; }
.etiquette.exclu { background: #fee2e2; color: var(--rouge); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--rayon); overflow: hidden; font-size: .9rem; }
th, td { padding: .5rem .6rem; text-align: right; border-bottom: 1px solid var(--gris); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--bleu-clair); color: var(--bleu); font-weight: 600; }
.tableau-defilant { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--rayon); }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .8rem; margin: .5rem 0; font-size: .92rem; }
dl.details dt { color: var(--gris-texte); }
dl.details dd { margin: 0; }

.panneau { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.panneau-contenu { background: #fff; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; border-radius: var(--rayon) var(--rayon) 0 0; padding: 1rem 1rem 2rem; position: relative; }
.panneau .fermer { position: absolute; top: .4rem; right: .4rem; font-size: 1.1rem; }
@media (min-width: 720px) { .panneau { align-items: center; } .panneau-contenu { border-radius: var(--rayon); } }

.qr { display: flex; justify-content: center; min-height: 240px; }
.qr img { width: 240px; height: 240px; image-rendering: pixelated; }
.secret-totp { font-size: .85rem; color: var(--gris-texte); }
.secret-totp code { display: block; margin-top: .3rem; font-size: .9rem; }

.carte-conteneur { height: 62vh; min-height: 360px; border-radius: var(--rayon); overflow: hidden; background: #e5e7eb; }
.legende { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .5rem; font-size: .85rem; color: var(--gris-texte); }
.legende span::before { content: ""; display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; margin-right: .3rem; vertical-align: -2px; background: var(--c); }

.reglage { background: #fff; border-radius: var(--rayon); padding: .8rem .9rem; display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; }
.reglage .libelle { font-weight: 600; }
.reglage .description { grid-column: 1 / -1; color: var(--gris-texte); font-size: .85rem; }
.reglage .valeur { font-family: ui-monospace, Menlo, monospace; }
.reglage-categorie { margin: 1rem 0 .4rem; color: var(--bleu); font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--texte); color: #fff; padding: .6rem 1rem; border-radius: 999px; font-size: .9rem; z-index: 30; max-width: 90vw; }
.toast.erreur { background: var(--rouge); }

/* --- Présentation du POC : bandeau, blocs à quatre mailles, progressions --- */
.bandeau { background: #fff; border-radius: var(--rayon); padding: .7rem .9rem; margin-bottom: .5rem; border-left: 4px solid var(--bleu); }
.bandeau-titre { font-weight: 700; font-size: 1.05rem; color: var(--bleu); }
.bandeau-infos { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-top: .3rem; font-size: .88rem; color: var(--gris-texte); }
.bandeau-infos b { color: var(--texte); font-weight: 600; }
.bandeau-infos .discret { font-style: italic; }
.actions-onglet { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 .5rem; }
thead tr.groupes th { text-align: center; background: var(--bleu); color: #fff; font-weight: 600; border-left: 2px solid #fff; }
thead tr.groupes th.bloc-immeuble { background: #17335f; }
thead tr.groupes th.bloc-iris { background: #1d4ed8; }
thead tr.groupes th.bloc-quartier { background: #0f766e; }
thead tr.groupes th.bloc-cp { background: #6d28d9; }
tbody tr.annee-vendue td { background: #fffbeb; }
tbody tr.annee-vendue td:first-child { font-weight: 700; }
tbody tr.ligne-ecartee td { color: var(--gris-texte); }
.prog { display: inline-block; min-width: 4.2rem; text-align: right; padding: .1rem .35rem; border-radius: 6px; font-variant-numeric: tabular-nums; }
.prog.hausse { background: #d1fae5; color: #065f46; }
.prog.baisse { background: #fee2e2; color: #991b1b; }
.prog.neutre { color: var(--gris-texte); }
.sigma { font-weight: 700; }
.sigma.retenue { color: var(--vert); }
.sigma.ecartee { color: var(--rouge); }
.classe.compacte { display: inline-block; width: 1.6rem; height: 1.6rem; font-size: .9rem; border-radius: 6px; line-height: 1.6rem; text-align: center; }
td .classe.compacte { margin: 0 auto; }
table td, table th { font-size: .85rem; padding: .4rem .5rem; }
.tableau-defilant { max-width: 100%; }
tbody tr { cursor: default; }
#synthese-dpe-immeuble tbody tr, #dpe-liste tbody tr { cursor: pointer; }
#synthese-dpe-immeuble tbody tr:hover td, #dpe-liste tbody tr:hover td { background: var(--bleu-clair); }

/* --- Impression : la section active seule, tableaux complets --- */
@media print {
  .entete, .onglets, .barre, .actions-onglet, .sous-onglets, .toast, .panneau, #bouton-deconnexion, .aide { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .tableau-defilant { overflow: visible; }
  table { font-size: 9pt; }
  th, td { padding: .15rem .3rem; white-space: normal; }
  .sous[hidden] { display: none !important; }
}
