/* Horizon10 — interface de saisie (iPad en priorité) */
:root {
  /* Charte ETI-DIAG, relevée sur la couverture du modèle de rapport */
  --anthracite: #424242;
  --orange: #f08815;
  --vert: #98ac71;
  --beige: #f3e8d6;
  --fond: #f7f5f1;
  --carte: #ffffff;
  --trait: #dcd6cb;
  --texte: #2b2b2b;
  --doux: #6b6660;
  --rouge: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 Bahnschrift, "Segoe UI", system-ui, -apple-system, sans-serif;
}
h1 { font-size: 1.6rem; font-weight: 500; color: var(--anthracite); margin: 0 0 16px; }
h2 { font-size: 1.05rem; font-weight: 600; color: var(--anthracite); margin: 0 0 12px; }
h2 small { background: var(--vert); color: #fff; border-radius: 10px; padding: 1px 8px; font-weight: 500; }

.bandeau {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px 13px; background: var(--anthracite); color: #fff;
  border-bottom: 0; background-image: linear-gradient(to right, var(--orange) 0 33.3%, var(--vert) 33.3% 66.6%, #2b2b2b 66.6%);
  background-size: 100% 4px; background-repeat: no-repeat; background-position: bottom;
}
.marque { display: inline-flex; align-items: center; gap: 9px; font-size: 1.5rem; font-weight: 700; color: #fff; text-decoration: none; letter-spacing: -0.02em; }
.marque img { flex: none; border-radius: 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); }
.marque i { color: var(--orange); font-style: normal; font-weight: 700; }
.bandeau-titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etat-sauvegarde { font-size: 0.85rem; opacity: 0.85; text-align: right; }
/* Compte connecté, dans le bandeau */
.compte-menu { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; white-space: nowrap; }
.compte-menu form { margin: 0; }
.bandeau-bouton {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 19px;
  border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.08); color: #fff;
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.bandeau-bouton svg { width: 17px; height: 17px; flex-shrink: 0; }
.bandeau-bouton:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.5); }
.bandeau-bouton.sortie:hover { background: var(--orange); border-color: var(--orange); }
.compte-puce {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 4px; border-radius: 19px;
  color: #fff; text-decoration: none; transition: background 0.15s;
}
.compte-puce:hover { background: rgba(255, 255, 255, 0.12); }
.initiales {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange); color: #fff; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
}
@media (max-width: 900px) { .compte-nom, .bandeau-bouton span { display: none; } .bandeau-bouton { padding: 0 10px; } }

/* Connexion */
.connexion { max-width: 440px; margin: 0 auto; padding: 40px 16px; }
.connexion-icone { display: block; margin: 0 auto 14px; border-radius: 18px; }
.connexion-logo { display: block; width: 150px; margin: 0 auto 24px; }
.carte-connexion { padding: 28px 24px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06); }
.carte-connexion h1 { margin: 0; text-align: center; }
.carte-connexion > .aide { margin: -8px 0 4px; text-align: center; }
.centre { text-align: center; }
.bouton.accent {
  min-height: 50px; border: 0; background: var(--orange); color: #fff; font-size: 1.02rem; letter-spacing: 0.01em;
  box-shadow: 0 3px 10px rgba(240, 136, 21, 0.3); transition: background 0.15s, transform 0.1s;
}
.bouton.accent:hover { background: #d97706; }
.bouton.accent:active { transform: translateY(1px); }
.grille-formulaire { display: grid; gap: 14px; }
.liste-comptes { list-style: none; margin: 0; padding: 0; }
.liste-comptes li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--trait); }
.liste-comptes li:first-child { border-top: 0; }
.liste-comptes li.inactif { opacity: 0.6; }
.nouveau-mdp summary { list-style: none; }
.nouveau-mdp summary::-webkit-details-marker { display: none; }
.nouveau-mdp[open] summary { margin-bottom: 8px; }
.nouveau-mdp input { width: 220px; }

.editeur { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: start; }
.sections { position: sticky; top: 56px; display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; }
.sections a {
  padding: 12px; border-radius: 8px; color: var(--texte); text-decoration: none; border-left: 4px solid transparent;
}
.sections a[aria-current] { background: var(--carte); border-left-color: var(--orange); font-weight: 600; color: var(--anthracite); }
#contenu { padding: 20px 16px 80px; max-width: 980px; min-width: 0; }

@media (max-width: 760px) {
  .editeur { grid-template-columns: minmax(0, 1fr); }
  .sections { position: static; flex-direction: row; overflow-x: auto; padding: 8px; }
  .sections a { white-space: nowrap; border-left: 0; border-bottom: 4px solid transparent; }
  .sections a[aria-current] { border-bottom-color: var(--orange); }
}

.bloc { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.grille, .ouvrage { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.large { grid-column: 1 / -1; }
.ouvrage { padding: 12px 0; border-top: 1px solid var(--trait); }
.ouvrage:first-of-type { border-top: 0; padding-top: 0; }

.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ > span, .libelle { font-size: 0.82rem; color: var(--doux); }
.indication { display: block; margin-top: 2px; font-size: 0.78rem; font-style: italic; }
input[type="text"], input[type="date"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 10px; border: 1px solid var(--trait); border-radius: 8px;
  background: #fff; color: var(--texte); font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: var(--orange); }

.ligne {
  display: grid; grid-template-columns: minmax(0, 2fr) 150px minmax(0, 2fr); gap: 12px; align-items: end;
  padding: 10px 0; border-top: 1px solid var(--trait);
}
.ligne:first-of-type { border-top: 0; }
.ligne-titre { align-self: center; }
.ligne-titre small { display: block; color: var(--doux); font-size: 0.78rem; }
@media (max-width: 760px) { .ligne { grid-template-columns: minmax(0, 1fr); } }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--anthracite); border-radius: 8px; background: #fff; color: var(--anthracite);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.bouton.principal { background: var(--anthracite); color: #fff; }
.bouton.discret { border-color: var(--trait); font-weight: 400; }
.bouton.danger { border-color: transparent; color: var(--rouge); font-weight: 400; }
/* Boutons de fiches désordre préremplies : mis en avant (fond beige, filet orange, éclair). */
.bouton.fiche-type { background: var(--beige); border-color: var(--orange); color: var(--anthracite); }
.bouton.fiche-type::before { content: "⚡"; margin-right: 0.35em; color: var(--orange); }
.bouton.fiche-type:hover { background: #fde3c4; }
.bouton:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.aide, .vide { color: var(--doux); margin: 0 0 12px; }
.info { color: var(--doux); }
.erreur { color: var(--rouge); }
.apercu-signature { display: block; max-width: 220px; max-height: 70px; margin-top: 6px; background: #fff; border: 1px solid var(--trait); border-radius: 6px; padding: 4px; }
.avertissement { margin: 10px 0; padding: 10px 14px; border-left: 4px solid var(--orange); background: #fff4e6; border-radius: 6px; }
.estimation { margin: 0; padding: 10px 12px; background: var(--beige); border-radius: 8px; }

.vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.vignette { margin: 0; padding: 10px; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; display: grid; gap: 8px; }
.vignette img { width: 100%; height: 170px; object-fit: cover; border-radius: 8px; }

.fiche { border: 1px solid var(--trait); border-radius: 10px; margin-bottom: 10px; }
.fiche summary {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px; cursor: pointer; font-weight: 600; color: var(--anthracite);
}
.fiche[open] summary { border-bottom: 1px solid var(--trait); }
.fiche .resume { font-weight: 400; color: var(--doux); text-align: right; }
.fiche > .grille { padding: 14px; }
.photos-fiche { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 4px; }
.photo-fiche { display: grid; justify-items: center; }
.photo-fiche img { width: 150px; height: 150px; object-fit: cover; border-radius: 8px; }

.defilement { overflow-x: auto; }
.plan { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.plan th, .plan td { padding: 8px; border-bottom: 1px solid var(--trait); text-align: right; white-space: nowrap; }
.plan th:first-child, .plan td:first-child { text-align: left; white-space: normal; min-width: 220px; }
.plan thead th { background: var(--anthracite); color: #fff; font-weight: 500; }
.plan .rubrique th { background: var(--beige); color: var(--anthracite); text-align: left; }
.plan .total td { font-weight: 700; border-top: 2px solid var(--anthracite); }

.accueil { max-width: 820px; margin: 0 auto; padding: 24px 16px; }
.accueil-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.accueil-tete h1 { margin: 0; }
.liste-rapports { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.liste-rapports li {
  display: flex; align-items: center; gap: 12px; padding-right: 10px; background: var(--carte);
  border: 1px solid var(--trait); border-left: 5px solid var(--trait); border-radius: 12px; transition: background 0.15s;
}
.liste-rapports a { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 14px 16px; color: var(--texte); text-decoration: none; }
.liste-rapports a strong, .liste-rapports a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dossier-fin { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.menu-vide { width: 40px; }
/* Ligne entière colorée selon le statut */
.dossier-en_cours { border-left-color: var(--beige); }
.dossier-a_corriger { border-left-color: var(--orange); }
.dossier-terminee { background: #eef5e7; border-color: #cfe0c1; border-left-color: #5b8a3c; }
.dossier-terminee a strong { color: #3f6b26; }
.dossier-cloture { background: #efeeeb; border-color: #e0ddd8; border-left-color: #9a9792; }
.dossier-cloture a strong, .dossier-cloture a span { color: #9a9792; }

/* Statut d'avancement des rapports */
.statut {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; min-height: 32px; padding: 0 13px; border-radius: 16px;
  font-size: 0.82rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.statut .puce { width: 8px; height: 8px; background: currentColor; }
.statut-en_cours { background: #fff; color: #8a6d3b; border-color: #e6d6b8; }
.statut-terminee { background: #5b8a3c; color: #fff; }
.statut-a_corriger { background: #fff4e6; color: #c05f00; border-color: #f5c88f; }
.statut-cloture { background: #dcdad6; color: #6b6660; }
.compteurs-statuts .statut { min-height: 28px; }
.compteurs-statuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.menu-rapport { position: relative; flex-shrink: 0; }
.menu-rapport summary {
  list-style: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--trait); background: #fff; color: var(--anthracite); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.menu-rapport summary svg { width: 18px; height: 18px; fill: currentColor; }
.menu-rapport summary::-webkit-details-marker { display: none; }
.menu-rapport summary:hover { border-color: var(--anthracite); }
.menu-rapport[open] summary { background: var(--anthracite); border-color: var(--anthracite); color: #fff; }
.menu-rapport .menu {
  position: absolute; right: 0; top: 100%; z-index: 20; min-width: 260px; margin-top: 4px; padding: 6px 0;
  background: #fff; border: 1px solid var(--trait); border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.menu-rapport form { margin: 0; }
.menu-rapport button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 14px; border: 0;
  background: none; color: var(--texte); font: inherit; text-align: left; cursor: pointer;
}
.menu-rapport button:hover { background: var(--fond); }
.menu-rapport button.danger { color: var(--rouge); border-top: 1px solid var(--trait); }
.puce { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.menu .puce.statut-en_cours { background: #d9c39a; border: 0; }
.menu .puce.statut-terminee { background: #5b8a3c; }
.menu .puce.statut-a_corriger { background: var(--orange); }
.menu .puce.statut-cloture { background: #9a9792; }
/* Petit écran : le statut garde sa place en bout de ligne, en version compacte */
@media (max-width: 560px) {
  .liste-rapports a { padding: 12px; }
  .statut { padding: 0 9px; font-size: 0.74rem; }
}
.liste-rapports strong { color: var(--anthracite); }
.liste-rapports a span { color: var(--doux); font-size: 0.9rem; }

/* Adresse, données publiques et vue aérienne */
.adresse { position: relative; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; margin-top: 4px; background: #fff;
  border: 1px solid var(--trait); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); overflow: hidden;
}
.suggestions button {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-top: 1px solid var(--trait);
  background: #fff; color: var(--texte); font: inherit; text-align: left; cursor: pointer;
}
.suggestions button:first-child { border-top: 0; }
.suggestions button:hover, .suggestions button:focus { background: var(--beige); }
.infos-publiques { padding: 12px 14px; background: var(--beige); border-radius: 8px; }
.infos-publiques p { margin: 0 0 8px; }
.infos-publiques p:last-child { margin: 0; font-size: 0.82rem; }
.infos-publiques ul { list-style: none; margin: 0 0 10px; padding: 0; }
.infos-publiques li {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 10px; margin-bottom: 6px;
  background: #fff; border: 1px solid var(--trait); border-radius: 8px;
}
.infos-publiques li > div { min-width: 0; overflow-wrap: anywhere; }
.pastille { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--vert); color: #fff; font-size: 0.78rem; }
#carte { height: 420px; margin-bottom: 12px; border-radius: 8px; border: 1px solid var(--trait); }
.case { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.case input { width: 20px; height: 20px; }
.vue-retenue { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.vue-retenue img { width: 220px; max-width: 50%; border-radius: 8px; border: 1px solid var(--trait); }

/* État général : éléments photographiés par catégorie */
.element { padding: 14px 0; border-top: 1px solid var(--trait); display: grid; gap: 12px; }
.bloc > h2 + datalist + .element { border-top: 0; padding-top: 0; }
.compte { display: inline-block; min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--beige); font-size: 0.8rem; text-align: center; }
.etats { display: flex; flex-wrap: wrap; gap: 6px; }
.etat-choix {
  flex: 1 1 auto; min-height: 44px; padding: 6px 10px; border: 1px solid var(--trait); border-radius: 8px;
  background: #fff; color: var(--texte); font: inherit; cursor: pointer;
}
.etat-choix.actif { color: #fff; font-weight: 600; border-color: transparent; }
.etat-0.actif { background: #5b8a3c; }
.etat-1.actif { background: #d9860b; }
.etat-2.actif { background: #c0392b; }
.etat-3.actif { background: #7a7a7a; }
