/* Charte Sébastien Hommet – Dessinateur en architecture
   Bleu franc, noir, blanc, gris-bleu ; titres Montserrat en capitales,
   petit trait bleu au-dessus des titres de section (comme les flyers). */
:root {
  --bleu: #0174fc;
  --bleu-fonce: #0058c4;
  --bleu-pale: #e8f1ff;
  --noir: #0e0e0e;
  --texte: #1c2330;
  --gris: #5e6e85;
  --gris-clair: #8a97aa;
  --ligne: #d9e0ea;
  --fond: #f3f6fa;
  --blanc: #ffffff;
  --rouge: #d42a1f;
  --rouge-pale: #fdecea;
  --orange: #d97a06;
  --orange-pale: #fff4e5;
  --vert: #11845b;
  --vert-pale: #e6f5ee;
  --rayon: 10px;
  --titre: 'Montserrat', system-ui, sans-serif;
  --corps: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--corps);
  font-size: 16px;
  line-height: 1.45;
  color: var(--texte);
  background: var(--fond);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--bleu); }
[hidden] { display: none !important; }

/* ── En-tête ─────────────────────────────────────── */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--blanc);
  border-bottom: 1px solid var(--ligne);
}
.entete .logo { width: 38px; height: 38px; flex: none; }
.marque { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.marque b { font-family: var(--titre); font-weight: 800; font-size: 15px; letter-spacing: .02em; color: var(--noir); white-space: nowrap; }
.marque b span { color: var(--bleu); }
.marque small { font-family: var(--titre); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); }
.entete .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.etat-sauvegarde { font-size: 12px; color: var(--gris-clair); white-space: nowrap; }
@media (max-width: 480px) {
  .marque small { letter-spacing: .08em; font-size: 9.5px; white-space: nowrap; }
  .etat-sauvegarde { font-size: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--vert); }
  .etat-sauvegarde.encours { background: var(--orange); }
  .etat-sauvegarde.erreur { background: var(--rouge); }
}
.etat-sauvegarde.erreur { color: var(--rouge); }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(110px + var(--safe-b)); }

/* ── Titres façon flyer ──────────────────────────── */
h1, h2, h3 { font-family: var(--titre); color: var(--noir); margin: 0; }
h1 { font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
.titre-section { margin: 26px 0 12px; }
.titre-section::before { content: ''; display: block; width: 34px; height: 4px; background: var(--bleu); border-radius: 2px; margin-bottom: 7px; }
.titre-section h2 { font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.titre-section p { margin: 3px 0 0; color: var(--bleu); font-family: var(--titre); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* ── Boutons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1.5px solid var(--bleu); border-radius: var(--rayon);
  background: var(--blanc); color: var(--bleu);
  font-family: var(--titre); font-weight: 700; font-size: 14px; letter-spacing: .03em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.plein { background: var(--bleu); color: var(--blanc); }
.btn.plein:hover { background: var(--bleu-fonce); }
.btn.discret { border-color: var(--ligne); color: var(--gris); }
.btn.danger { border-color: var(--rouge); color: var(--rouge); }
.btn.petit { min-height: 36px; padding: 0 12px; font-size: 12px; }
.btn.icone { padding: 0; width: 44px; }
.btn svg { width: 18px; height: 18px; }

/* ── Cartes, champs ──────────────────────────────── */
.carte { background: var(--blanc); border: 1px solid var(--ligne); border-radius: 14px; padding: 16px; }
.carte + .carte { margin-top: 12px; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grille .large { grid-column: 1 / -1; }
@media (max-width: 560px) { .grille { grid-template-columns: 1fr; } }

.champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.champ > label, .champ > .lib { font-size: 13px; font-weight: 600; color: var(--gris); }
.champ .aide { font-size: 12.5px; color: var(--gris-clair); }
.auto { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--bleu-pale); color: var(--bleu); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px;
  border: 1.5px solid var(--ligne); border-radius: var(--rayon);
  background: var(--blanc); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235e6e85' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px var(--bleu-pale); }
.unite { position: relative; }
.unite input { padding-right: 44px; }
.unite::after { content: attr(data-unite); position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--gris-clair); font-size: 14px; pointer-events: none; }

/* Choix en pastilles (radio / case) */
.choix { display: flex; flex-wrap: wrap; gap: 8px; }
.choix label {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--ligne); border-radius: 99px; background: var(--blanc);
  font-size: 15px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label:has(input:checked) { border-color: var(--bleu); background: var(--bleu-pale); color: var(--bleu-fonce); font-weight: 600; }
.choix.colonne { flex-direction: column; }
.choix.colonne label { border-radius: var(--rayon); }

.bascule { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 0; border-bottom: 1px solid var(--fond); cursor: pointer; }
.bascule:last-child { border-bottom: 0; }
.bascule span { font-size: 15px; }
.bascule small { display: block; color: var(--gris-clair); font-size: 12.5px; }
.bascule input { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 99px; background: var(--ligne); position: relative; cursor: pointer; transition: background .15s; }
.bascule input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--blanc); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.bascule input:checked { background: var(--bleu); }
.bascule input:checked::after { left: 23px; }

/* ── Liste des fiches ────────────────────────────── */
.barre-liste { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.barre-liste input { flex: 1; }
.filtres { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filtres button { flex: none; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--ligne); background: var(--blanc); font-size: 13.5px; cursor: pointer; }
.filtres button.actif { border-color: var(--noir); background: var(--noir); color: var(--blanc); }
.fiche-ligne { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--blanc); border: 1px solid var(--ligne); border-radius: 14px; text-decoration: none; color: inherit; margin-bottom: 8px; }
.fiche-ligne:hover { border-color: var(--bleu); }
.fiche-ligne .infos { flex: 1; min-width: 0; }
.fiche-ligne b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fiche-ligne small { color: var(--gris); font-size: 13px; }
.vide { text-align: center; padding: 48px 16px; color: var(--gris); }
.vide img { width: 64px; opacity: .9; margin-bottom: 12px; }

/* Badges de verdict */
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 99px; font-family: var(--titre); font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.badge.DP { background: var(--vert-pale); color: var(--vert); }
.badge.PC { background: var(--bleu-pale); color: var(--bleu-fonce); }
.badge.aucune { background: #eef1f5; color: var(--gris); }
.badge.a_verifier, .badge.vide { background: var(--orange-pale); color: var(--orange); }
.badge.archi { background: var(--rouge); color: var(--blanc); }
.badge.grise { background: var(--orange); color: var(--blanc); }
.statut { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--fond); color: var(--gris); font-weight: 600; }

/* ── Étapes ──────────────────────────────────────── */
.etapes { position: sticky; top: 59px; z-index: 15; display: flex; gap: 4px; overflow-x: auto; margin: -16px -16px 0; padding: 10px 16px; background: rgba(243,246,250,.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); scrollbar-width: none; border-bottom: 1px solid var(--ligne); }
.etapes::-webkit-scrollbar { display: none; }
.etapes a { flex: none; display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 12px; border-radius: 99px; text-decoration: none; color: var(--gris); font-family: var(--titre); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.etapes a i { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 11px; }
.etapes a.actif { background: var(--noir); color: var(--blanc); }
.etapes a.actif i { border-color: var(--bleu); background: var(--bleu); }

/* Barre basse : verdict en direct + navigation */
.barre-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--blanc); border-top: 1px solid var(--ligne);
  padding: 10px 16px calc(10px + var(--safe-b));
  box-shadow: 0 -6px 18px rgba(14,14,14,.06);
}
.barre-bas .interieur { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.verdict-mini .lib-verdict { font-family: var(--titre); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; width: 100%; }
.verdict-mini { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; font-size: 13px; color: var(--gris); }

/* ── Adresse ─────────────────────────────────────── */
.recherche-adresse { position: relative; }
.suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); box-shadow: 0 10px 24px rgba(14,14,14,.12); overflow: hidden; }
.suggestions button { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--fond); background: none; cursor: pointer; }
.suggestions button:hover, .suggestions button:focus { background: var(--bleu-pale); }
.chargement { display: flex; align-items: center; gap: 10px; color: var(--gris); padding: 12px 0; }
.chargement::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--bleu-pale); border-top-color: var(--bleu); animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

.constats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.constat { padding: 12px; border-radius: var(--rayon); background: var(--fond); }
.constat small { display: block; font-family: var(--titre); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gris); margin-bottom: 3px; }
.constat b { font-size: 15px; }
.constat.alerte { background: var(--orange-pale); }
.liens { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.liste-puces { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.liste-puces li { margin: 2px 0; }

/* ── Verdict ─────────────────────────────────────── */
.verdict-grand { position: relative; overflow: hidden; border-radius: 16px; padding: 22px 20px; background: var(--noir); color: var(--blanc); }
.verdict-grand::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; background: url(../img/logo.svg) no-repeat center / contain; opacity: .12; }
.verdict-grand small { font-family: var(--titre); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #9fc7ff; }
.verdict-grand .formalite { font-family: var(--titre); font-weight: 800; font-size: 30px; line-height: 1.1; text-transform: uppercase; margin: 4px 0 10px; }
.verdict-grand .cerfa { font-size: 13px; color: #c9d3e0; }
.verdict-grand .archi { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,.1); font-weight: 600; }
.alerte-rouge { margin-top: 12px; padding: 16px; border-radius: 14px; background: var(--rouge); color: var(--blanc); font-family: var(--titre); font-weight: 800; font-size: 16px; letter-spacing: .02em; text-transform: uppercase; display: flex; gap: 12px; align-items: center; }
.alerte-rouge svg { flex: none; width: 28px; height: 28px; }
.message { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--rayon); font-size: 14.5px; margin-top: 8px; }
.message.orange { background: var(--orange-pale); border-left: 4px solid var(--orange); }
.message.info { background: var(--bleu-pale); border-left: 4px solid var(--bleu); }
.message.rouge { background: var(--rouge-pale); border-left: 4px solid var(--rouge); }
.motif { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--fond); font-size: 15px; }
.motif:last-child { border-bottom: 0; }
.motif .ref { flex: none; margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--bleu); background: var(--bleu-pale); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

/* Calculatrice SDP */
.calc-ligne { display: grid; grid-template-columns: 1fr 110px 1fr 40px; gap: 8px; margin-bottom: 8px; }
@media (max-width: 560px) { .calc-ligne { grid-template-columns: 1fr 96px; } .calc-ligne select { grid-column: 1; } }
.calc-total { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-weight: 700; flex-wrap: wrap; }

/* Parcelles */
.parc-entete, .parc-ligne { display: grid; grid-template-columns: 80px 1fr 1.3fr auto; gap: 8px; align-items: center; }
.parc-entete { font-size: 12px; font-weight: 600; color: var(--gris); margin-bottom: 4px; }
.parc-ligne { margin-bottom: 8px; }
.parc-ligne input { text-transform: uppercase; }
.parc-actions { display: flex; align-items: center; gap: 6px; }
@media (max-width: 560px) {
  .parc-entete, .parc-ligne { grid-template-columns: 64px 1fr 1.4fr; }
  .parc-entete span:last-child { display: none; }
  .parc-actions { grid-column: 1 / -1; justify-content: space-between; margin-top: -2px; }
  .parc-ligne { padding-bottom: 8px; border-bottom: 1px dashed var(--ligne); }
}
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--fond); color: var(--gris); white-space: nowrap; }
.tag.vert { background: var(--vert-pale); color: var(--vert); }
.tag.orange { background: var(--orange-pale); color: var(--orange); }
.tag.rouge { background: var(--rouge-pale); color: var(--rouge); }
.voisines { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.voisines .lib { width: 100%; font-size: 13px; font-weight: 600; color: var(--gris); }
.puce { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1.5px dashed var(--bleu); background: var(--blanc); color: var(--bleu-fonce); font-size: 13.5px; cursor: pointer; }
.puce svg { width: 14px; height: 14px; }
.aide { font-size: 12.5px; color: var(--gris-clair); }

/* Connexion */
.connexion { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.connexion img { width: 96px; margin-bottom: 16px; }
.connexion h1 { font-size: 24px; }
.connexion h1 span { color: var(--bleu); }
.connexion .sous { font-family: var(--titre); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gris); margin: 6px 0 28px; display: flex; align-items: center; gap: 10px; justify-content: center; }
.connexion .sous::before, .connexion .sous::after { content: ''; width: 28px; height: 1.5px; background: var(--gris-clair); }
.connexion form { display: flex; flex-direction: column; gap: 12px; }
.erreur { color: var(--rouge); font-size: 14px; min-height: 20px; }

.bandeau-local { background: var(--orange-pale); color: #8a4d00; font-size: 13px; padding: 8px 16px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--noir); color: var(--blanc); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ── Impression / PDF ────────────────────────────── */
#impression { display: none; }
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  body { background: #fff; font-size: 10.5pt; }
  body > *:not(#impression) { display: none !important; }
  #impression { display: block; color: #111; }
  .imp-entete { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2.5px solid var(--bleu); }
  .imp-entete img { width: 46px; height: 46px; }
  .imp-entete .nom { font-family: var(--titre); font-weight: 800; font-size: 16pt; letter-spacing: .01em; }
  .imp-entete .nom span { color: var(--bleu); }
  .imp-entete .metier { font-family: var(--titre); font-size: 8pt; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gris); }
  .imp-entete .doc { margin-left: auto; text-align: right; font-size: 9pt; color: var(--gris); }
  .imp-entete .doc b { display: block; font-family: var(--titre); font-size: 11pt; color: #111; text-transform: uppercase; }
  .imp-verdict { margin: 12px 0; padding: 12px 14px; background: #0e0e0e; color: #fff; border-radius: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .imp-verdict b { font-family: var(--titre); font-size: 15pt; text-transform: uppercase; }
  .imp-rouge { margin: 8px 0; padding: 8px 12px; background: var(--rouge); color: #fff; font-weight: 800; border-radius: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .imp-bloc { break-inside: avoid; margin-top: 12px; }
  .imp-bloc h3 { font-size: 9.5pt; text-transform: uppercase; letter-spacing: .06em; border-top: 3px solid var(--bleu); display: inline-block; padding-top: 3px; margin-bottom: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .imp-bloc table { width: 100%; border-collapse: collapse; }
  .imp-bloc td { padding: 3px 6px 3px 0; vertical-align: top; border-bottom: .5px solid #e3e7ee; }
  .imp-bloc td:first-child { width: 38%; color: var(--gris); }
  .imp-bloc ul { margin: 0; padding-left: 16px; }
  .imp-pied { margin-top: 16px; padding-top: 6px; border-top: 1px solid #ccd; font-size: 8pt; color: var(--gris); display: flex; justify-content: space-between; }
}
