/* Style « SaaS » : fond lavande, cartes blanches arrondies et ombrées, accent indigo, barre latérale nuit. */
:root {
  --fond: #eef0fb; --carte: #fff; --texte: #1b1d3a; --doux: #6b6f8e; --bord: #e3e5f3;
  --accent: #3d3bd8; --accent-fonce: #2c2aa8; --accent-clair: #ecebff; --nuit: #23206b; --nuit-clair: #34308a;
  --ok: #138a5b; --ok-clair: #e2f6ec; --alerte: #a8650b; --alerte-clair: #fff3dc; --erreur: #e5484d; --erreur-clair: #ffeaeb;
  --ombre: 0 10px 30px rgba(49, 46, 129, .08); --rayon: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--texte); background: var(--fond);
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; min-height: 100vh; }
h1, h2, h3, .marque { letter-spacing: -.01em; }
button { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--bord); background: var(--carte); border-radius: 10px; padding: 8px 14px; color: var(--texte); transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover { border-color: var(--accent); color: var(--accent); }
button.principal { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px rgba(61, 59, 216, .25); }
button.principal:hover { background: var(--accent-fonce); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.lien { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; box-shadow: none; }
button.danger { color: var(--erreur); }
button.danger:hover { border-color: var(--erreur); }
a { color: var(--accent); }

/* Barre latérale */
#barre { background: var(--nuit); color: #e9e8ff; padding: 22px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marque { font-weight: 700; font-size: 18px; padding: 0 6px; display: flex; align-items: center; gap: 10px; }
.marque::before { content: ""; width: 30px; height: 30px; border-radius: 9px; flex: none; background: linear-gradient(135deg, #7c79ff, #3d3bd8); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
#barre #nouveau { background: #fff; color: var(--accent); border-color: #fff; padding: 11px 14px; }
#barre .secondaire { display: block; color: #e9e8ff; text-decoration: none; font-weight: 600; border: 1px solid var(--nuit-clair); border-radius: 10px; padding: 10px 14px; }
#barre .secondaire:hover, #barre .secondaire.actif { background: var(--nuit-clair); color: #fff; }
#liste { display: flex; flex-direction: column; gap: 4px; }
#liste a { color: inherit; text-decoration: none; padding: 10px 12px; border-radius: 12px; display: block; font-weight: 600; font-size: 13px; }
#liste a:hover { background: var(--nuit-clair); }
#liste a.actif { background: var(--accent); box-shadow: 0 6px 16px rgba(0, 0, 0, .2); }
#liste small { display: block; color: #b4b2e6; font-weight: 400; }
#liste a.actif small { color: #dcdbff; }
#liste small.echeance { color: #ffb3b5; font-weight: 600; }
.rappel { margin: 0 0 16px; }
.rappel code { font-size: 12px; }

/* Contenu */
#contenu { padding: 28px 32px 60px; min-width: 0; }
.accueil { max-width: 640px; margin-top: 10vh; background: var(--carte); border-radius: var(--rayon); padding: 28px; box-shadow: var(--ombre); }
.accueil h1 { margin-top: 0; }
.entete { background: var(--carte); border-radius: var(--rayon); padding: 18px 20px; box-shadow: var(--ombre); margin-bottom: 16px; display: flex; gap: 16px; align-items: center; }
.entete .textes { min-width: 0; flex: 1; }
.entete h1 { margin: 0 0 4px; font-size: 20px; }
.entete p { margin: 0; color: var(--doux); }
.etat-sauvegarde { font-size: 12px; color: var(--doux); }

/* Avatars à initiales */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  font-weight: 700; font-size: 13px; color: #fff; background: var(--teinte, var(--accent)); border: 2px solid #fff; }
.avatars { display: flex; flex: none; }
.avatars .avatar + .avatar { margin-left: -10px; }
.avatars .avatar { width: 44px; height: 44px; box-shadow: 0 4px 10px rgba(49, 46, 129, .18); }
.titre-personne { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Navigation des étapes : barre d'icônes */
.etapes { display: flex; gap: 4px; margin-bottom: 18px; background: var(--carte); padding: 6px; border-radius: var(--rayon); box-shadow: var(--ombre); overflow-x: auto; scrollbar-width: none; }
.etapes button { flex: 1 1 0; min-width: 76px; text-align: center; line-height: 1.25; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--doux); font-size: 12px; padding: 8px 10px; border-radius: 12px; position: relative; box-shadow: none; }
.etapes button svg { width: 20px; height: 20px; }
.etapes button:hover { background: var(--accent-clair); color: var(--accent); }
.etapes button.actif { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(61, 59, 216, .3); }
.pastille { font-size: 10px; line-height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--alerte); color: #fff; position: absolute; top: 4px; right: 8px; }
.pastille.ok { background: var(--ok); }
.actif .pastille { background: #fff; color: var(--accent); }

/* Cartes */
.groupe { background: var(--carte); border-radius: var(--rayon); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--ombre); }
.groupe > h2 { margin: 0 0 14px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.groupe > p { color: var(--doux); margin-top: 0; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.champ { display: flex; flex-direction: column; gap: 5px; }
.champ.large { grid-column: 1 / -1; }
.champ label { font-size: 12px; color: var(--doux); font-weight: 600; }
.champ.requis label::after { content: " *"; color: var(--erreur); }
.champ.manque input, .champ.manque select, .champ.manque textarea { border-color: #f0c062; background: #fffbf1; }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--bord); border-radius: 10px; background: #fbfbff; color: var(--texte); width: 100%; }
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-clair); border-color: var(--accent); background: #fff; }
.case { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.case input { width: auto; margin-top: 3px; accent-color: var(--accent); }

.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.piece { border: 1.5px dashed #cfd2ec; border-radius: 14px; padding: 12px; font-size: 13px; background: #fbfbff; }
.piece.faite { border-style: solid; border-color: #b6e3cc; background: #f4fbf7; }
.piece b { display: block; margin-bottom: 6px; }
.piece ul { margin: 0 0 6px; padding-left: 16px; }
.aide-inventaire { margin-bottom: 6px; color: var(--doux); font-size: 12px; }
.aide-inventaire summary { cursor: pointer; }
.piece input[type=file] { font-size: 12px; padding: 4px; background: none; border: 0; }

.depot { background: var(--accent-clair); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.depot .aide { color: var(--doux); margin-left: 8px; }
.depot.complete { background: var(--ok-clair); box-shadow: inset 0 0 0 1.5px #8fd3b2; }
#liste small.a-recuperer { color: #7ef0bd; font-weight: 600; }
#liste small.a-recuperer::before { content: "● "; }
.etapes button.a-recuperer::after { content: ""; position: absolute; top: 5px; left: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; }
.depot .actions { margin-top: 8px; }
.depot .actions input { flex: 1 1 320px; font-size: 12px; background: #fff; }
.ocr { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.ocr.encours { background: var(--accent-clair); }
.ocr.fiable { background: var(--ok-clair); }
.ocr.douteux { background: var(--alerte-clair); }
.ocr.echec { background: var(--erreur-clair); }
.ocr table { border-collapse: collapse; margin: 6px 0; }
.ocr td { padding: 2px 12px 2px 0; }
.ocr details { margin-top: 6px; color: var(--doux); }
.ocr pre { white-space: pre-wrap; font-size: 11px; }
.verif { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--fond); }

/* Panneau de droite : liste type « personnes à rencontrer » */
#panneau { background: var(--carte); padding: 24px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; box-shadow: -10px 0 30px rgba(49, 46, 129, .05); }
#panneau h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); margin: 20px 0 8px; }
#panneau h3:first-child { margin-top: 0; }
#panneau ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#panneau li { font-size: 13px; padding: 9px 12px 9px 26px; border-radius: 12px; position: relative; }
#panneau li::before { content: ""; position: absolute; left: 11px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .6; }
#panneau li.manque { background: var(--alerte-clair); color: #6d4708; cursor: pointer; }
#panneau li.manque:hover { box-shadow: inset 0 0 0 1px #f0c062; }
#panneau li.bloque { background: var(--erreur-clair); color: #b4232a; }
#panneau li.alerte { background: var(--fond); color: var(--doux); }
.pret { background: var(--ok-clair); color: var(--ok); padding: 12px 14px; border-radius: 12px; font-weight: 600; }

.reste { margin: 0 0 8px; padding-left: 18px; font-size: 13px; }
.reste li.bloque { color: var(--erreur); }
.chambre, .bail-coloc { border: 1px solid var(--bord); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fbfbff; }
.chambre h3, .bail-coloc h3 { margin: 0 0 8px; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aide { color: var(--doux); font-size: 12px; font-weight: normal; }
.resume td { padding: 4px 14px 4px 0; vertical-align: top; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.message { margin-top: 12px; padding: 11px 14px; border-radius: 12px; font-size: 13px; }
.message.ok { background: var(--ok-clair); color: var(--ok); }
.message.erreur { background: var(--erreur-clair); color: #b4232a; }
.message.info { background: var(--accent-clair); }

/* États des lieux : modèles et revue des photos */
.etape-modele { border: 1px solid var(--bord); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fbfbff; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; }
.etape-modele .numero { grid-row: span 3; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-clair); color: var(--accent); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.etape-modele .outils { display: flex; gap: 12px; flex-wrap: wrap; }
.liste-modeles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.carte-modele { text-align: left; padding: 14px; border-radius: 14px; background: #fbfbff; }
.carte-modele.actif { border-color: var(--accent); background: var(--accent-clair); }
.carte-modele small { display: block; color: var(--doux); font-weight: 400; }
.revue { border: 1px solid var(--bord); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.revue.valide { border-color: #b6e3cc; background: #f4fbf7; }
.revue.refaire { border-color: #f5b5b7; background: #fff6f6; }
.revue h3 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.comparaison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comparaison > div > b { font-size: 12px; color: var(--doux); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--accent-clair); color: var(--accent); }
.badge.ok { background: var(--ok-clair); color: var(--ok); }
.badge.ko { background: var(--erreur-clair); color: #b4232a; }

@media (max-width: 1100px) {
  body { grid-template-columns: 220px minmax(0, 1fr); }
  #panneau { grid-column: 2; position: static; height: auto; box-shadow: none; margin: 0 32px 32px; border-radius: var(--rayon); }
}
.basculer, .resume-mobile { display: none; }
.deconnexion { margin-top: auto; background: none; color: #b4b2e6; border-color: var(--nuit-clair); }

/* Page de connexion */
body.page-connexion { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #dcdaff 0, transparent 40%), var(--fond); }
.carte-connexion { background: var(--carte); border-radius: 20px; padding: 28px; width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--ombre); }
.carte-connexion h1 { font-size: 22px; margin: 0 0 8px; }
.carte-connexion label { font-size: 13px; color: var(--doux); margin-top: 6px; font-weight: 600; }
.carte-connexion button { margin-top: 12px; padding: 13px; background: var(--accent); color: #fff; border-color: var(--accent); }

/* Téléphone : barre compacte avec liste repliable, étapes qui défilent, panneau sous le contenu */
@media (max-width: 720px) {
  body { grid-template-columns: 1fr; font-size: 15px; }
  #barre { position: sticky; top: 0; z-index: 10; height: auto; padding: 10px 14px; gap: 8px; border-radius: 0 0 18px 18px; }
  .marque { justify-content: space-between; font-size: 16px; }
  .marque::before { width: 24px; height: 24px; }
  .basculer { display: inline-block; margin-left: auto; background: var(--nuit-clair); color: #fff; border-color: var(--nuit-clair); padding: 6px 12px; }
  #barre #liste, #barre .deconnexion, #barre .secondaire { display: none; }
  #barre.ouvert #liste, #barre.ouvert .deconnexion, #barre.ouvert .secondaire { display: flex; }
  #barre.ouvert #liste { max-height: 55vh; overflow-y: auto; }
  #barre:not(.ouvert) #nouveau { display: none; }
  #panneau { grid-column: 1; position: static; height: auto; margin: 0 12px 24px; box-shadow: var(--ombre); border-radius: var(--rayon); }
  #contenu { padding: 14px 12px 32px; }
  .entete { padding: 14px; }
  .entete h1 { font-size: 17px; }
  .avatars .avatar { width: 36px; height: 36px; }
  .resume-mobile { display: block; width: 100%; text-align: left; margin-bottom: 12px; background: var(--alerte-clair); border-color: #f0d9a8; color: var(--alerte); }
  .etapes { margin: 0 0 14px; }
  .etapes button { flex: 0 0 auto; padding: 8px 12px; }
  .grille, .pieces { grid-template-columns: 1fr; }
  .groupe { padding: 14px; }
  input, select, textarea { font-size: 16px; padding: 11px 12px; } /* 16 px : évite le zoom automatique d'iOS */
  button { padding: 10px 14px; }
  button.lien { padding: 4px 0; }
  .actions button { flex: 1 1 auto; }
  .depot .aide { display: block; margin: 6px 0 0; }
  .piece input[type=file] { font-size: 14px; }
  .comparaison { grid-template-columns: 1fr; }
}
