/* Charte ADHEX : fond blanc, orange #F55433 en touches, texte #1D1D1B, pas d'ombres ni de dégradés. */
:root { --orange:#F55433; --texte:#1D1D1B; --g1:#6E6E6E; --g2:#A0A0A0; --g3:#D0D0D0; --g4:#F2F2F2; --vert:#389836; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #fff; color: var(--texte); font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { margin: 0; font-size: 30px; font-weight: 700; }
h1.moyen { font-size: 26px; }
[hidden] { display: none !important; }

#coque { height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
#vue { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 22px; -webkit-overflow-scrolling: touch; }
#vue > * { flex: none; }
#pied { padding: 0 24px 12px; }
#pied:empty { display: none; }
#onglets { display: flex; border-top: 1px solid var(--g3); background: #fff; padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); }
#onglets a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--g1); font-size: 12px; }
#onglets a.actif { color: var(--orange); font-weight: 700; }

.surtitre { font-size: 13px; font-weight: 700; color: var(--orange); letter-spacing: .5px; }
.filet { height: 2px; width: 40px; background: var(--orange); margin-top: 8px; }
.etiquette { font-size: 11px; font-weight: 700; color: var(--g1); letter-spacing: 1px; text-transform: uppercase; }
.discret { font-size: 13px; color: var(--g1); }
.retour { font-size: 14px; color: var(--g1); display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.lien { background: none; border: 0; padding: 8px 0; font-size: 15px; font-weight: 700; color: var(--orange); text-align: left; }
.lien.gris { color: var(--g1); font-weight: 400; font-size: 14px; }
.lien.petit { font-size: 13px; padding: 4px 0; }

.stats { display: flex; gap: 12px; }
.stat { flex: 1; border: 1px solid var(--g3); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; }
.stat b.orange { color: var(--orange); }
.stat span { font-size: 12px; color: var(--g1); }

.rangee { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--g4); }
.rangee .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rangee .ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rangee .nom { font-size: 18px; font-weight: 700; }
.etat { font-size: 12px; font-weight: 700; color: var(--orange); white-space: nowrap; }
.etat.vert { color: var(--vert); }
.etat.gris { color: var(--g2); }
.rangee.eteinte { color: var(--g2); }
.barre { height: 4px; background: var(--g4); }
.barre > div { height: 4px; background: var(--orange); }
.barre.vert > div { background: var(--vert); }
.liste { display: flex; flex-direction: column; gap: 4px; }

.onglets-machine { display: flex; border-bottom: 1px solid var(--g3); }
.onglets-machine button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 0; font-size: 14px; color: var(--g1); }
.onglets-machine button.actif { border-bottom-color: var(--orange); font-weight: 700; color: var(--texte); }
.action-ligne { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--g4); }
.vignette { width: 64px; height: 64px; flex: none; background: var(--g4); display: grid; place-items: center; overflow: hidden; }
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.action-ligne .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.action-ligne .titre { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.pastilles { display: flex; gap: 4px; }
.pastille { font-size: 11px; font-weight: 700; padding: 2px 6px; background: var(--g4); color: var(--texte); }
.pastille.on { background: var(--texte); color: #fff; }

.grille-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.colonne-photo { display: flex; flex-direction: column; gap: 6px; }
.cadre-photo { aspect-ratio: 3 / 4; background: var(--g4); display: grid; place-items: center; overflow: hidden; border: 0; padding: 0; width: 100%; }
.cadre-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cadre-photo.pointille { background: #fff; border: 1px dashed var(--g2); color: var(--orange); font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.bande-vignettes { display: flex; gap: 6px; flex-wrap: wrap; }
.bande-vignettes button { width: 44px; height: 44px; padding: 0; border: 0; background: var(--g4); overflow: hidden; }
.bande-vignettes img { width: 100%; height: 100%; object-fit: cover; display: block; }

.grille-galerie { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.grille-galerie button { aspect-ratio: 1; padding: 0; border: 0; background: var(--g4); overflow: hidden; position: relative; }
.grille-galerie img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grille-galerie span { position: absolute; left: 0; bottom: 0; background: var(--texte); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 5px; }

.bloc { display: flex; flex-direction: column; gap: 6px; }
.texte { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.s-ligne { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--g4); padding: 12px 0; }
.case { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 16px; font-weight: 700; background: #fff; border: 1px solid var(--g2); padding: 0; margin-top: 1px; }
.case.on { background: var(--texte); color: #fff; border-color: var(--texte); }
.s-ligne .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.s-ligne .nom-s { font-size: 14px; font-weight: 700; }

.choix { display: flex; gap: 8px; flex-wrap: wrap; }
.choix button { display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: #fff; color: var(--texte); border: 1px solid var(--g3); font-size: 14px; }
.choix button.on { background: var(--texte); color: #fff; border-color: var(--texte); font-weight: 700; }
.choix .carre { width: 10px; height: 10px; display: inline-block; }

input[type=text], input[type=password], textarea.champ, select { width: 100%; border: 1px solid var(--g3); padding: 12px; font: inherit; font-size: 16px; border-radius: 0; background: #fff; color: var(--texte); }
textarea.champ { resize: vertical; line-height: 1.4; }
input[type=text]:focus, input[type=password]:focus, textarea.champ:focus, select:focus { outline: none; border-color: var(--orange); }
input[type=text].gras { font-weight: 700; }

.bouton { display: block; width: 100%; background: var(--orange); color: #fff; border: 0; text-align: center; padding: 15px; font-size: 15px; font-weight: 700; }
.bouton:disabled { background: var(--g3); }
.bouton.contour { background: #fff; color: var(--orange); border: 1px solid var(--orange); }
.bouton.neutre { background: #fff; color: var(--texte); border: 1px solid var(--g3); font-weight: 400; }
.bouton.fin { padding: 11px; font-size: 14px; }

.gros-photo { height: 200px; background: var(--g4); border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 15px; font-weight: 700; width: 100%; }
.gros-photo small { font-size: 12px; font-weight: 400; color: var(--g1); }
.dictee { display: flex; gap: 10px; align-items: stretch; }
.dictee textarea { flex: 1; }
.micro { flex: none; width: 52px; background: var(--g4); border: 0; display: grid; place-items: center; color: var(--orange); }
.micro.actif { background: var(--orange); color: #fff; }
.case-ia { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--g1); }
.case-ia input { width: 20px; height: 20px; accent-color: var(--orange); }
.carte-bloc { border-top: 2px solid var(--orange); padding-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.carte-bloc h2 { margin: 0; font-size: 16px; }
.ia-note { border-left: 2px solid var(--orange); padding: 2px 0 2px 12px; font-size: 13px; color: var(--g1); }

.apercu-zone { display: flex; gap: 16px; align-items: stretch; }
.apercu-zone .gros-photo { flex: 1; height: auto; min-height: 150px; font-size: 13px; gap: 8px; }
.apercu { flex: none; align-self: center; border: 3px solid var(--g3); background: #fff; padding: 5px; display: flex; flex-direction: column; gap: 4px; }
.apercu .t1 { font-size: 6px; font-weight: 700; line-height: 1.2; }
.apercu .t2 { font-size: 10px; font-weight: 700; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.apercu .t3 { font-size: 6px; font-weight: 700; color: var(--orange); }
.apercu .cadre { flex: 1; border: 1.5px solid var(--g3); margin: 0 8px; background-size: cover; background-position: center; }
.apercu.grand { margin: 0 auto; }
.apercu.grand .t1 { font-size: 9px; } .apercu.grand .t2 { font-size: 15px; } .apercu.grand .t3 { font-size: 9px; }

.rangee-fiche { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--g4); font-size: 14px; }
.rangee-fiche .nom { font-weight: 700; overflow-wrap: anywhere; }
.rangee-fiche .info { color: var(--g1); text-align: right; font-size: 13px; }
.vide { font-size: 14px; color: var(--g1); padding: 14px 0; }

#calque { position: fixed; inset: 0; background: rgba(29,29,27,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#calque.plein { background: #000; align-items: center; }
.feuille { max-height: 92dvh; overflow-y: auto; background: #fff; width: 100%; max-width: 520px; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.feuille h2 { margin: 0; font-size: 18px; }
.feuille .deux { display: flex; gap: 10px; }
.feuille .deux > * { flex: 1; }
.visionneuse { width: 100%; height: 100%; display: flex; flex-direction: column; }
.visionneuse img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.visionneuse .barre-haut { display: flex; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 18px 10px; }
.visionneuse button { background: none; border: 1px solid #fff; color: #fff; padding: 10px 14px; font-size: 14px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--texte); color: #fff; padding: 12px 16px; font-size: 14px; z-index: 30; max-width: 90vw; }
#toast.erreur { background: var(--orange); }
.attente { color: var(--g1); font-size: 14px; padding: 20px 0; }

/* Lecteur PDF plein écran (avec Retour) */
#calque.lecteur { background: #fff; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.lecteur-haut { display: flex; align-items: center; gap: 14px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid #D0D0D0; }
.lecteur-titre { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lecteur-pdf { flex: 1; min-height: 0; overflow: auto; background: #F2F2F2; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lecteur-image { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 0 0 1px #D0D0D0; }
.lecteur-bas { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #D0D0D0; }
.lecteur-bas > * { flex: 1; }

/* IA : liens, discussion, notes, échéance */
.retard { color: var(--orange); font-weight: 700; }
.lien-action { color: var(--orange); font-weight: 700; overflow-wrap: anywhere; font-size: 14px; }
.conseil { font-size: 14px; color: var(--texte); margin: 4px 0 0; }
.ligne-analyse { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.note { font-size: 14px; line-height: 1.4; padding: 6px 0; border-bottom: 1px solid var(--g4); overflow-wrap: anywhere; }
.petit-choix { align-items: center; }
.petit-choix button { padding: 5px 10px; font-size: 13px; }
.fil { display: flex; flex-direction: column; gap: 8px; }
.msg { font-size: 14px; line-height: 1.45; padding: 10px 12px; max-width: 88%; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.moi { align-self: flex-end; background: var(--g4); }
.msg.ia { align-self: flex-start; border-left: 2px solid var(--orange); padding-left: 12px; }
.msg.systeme { align-self: stretch; max-width: 100%; font-size: 13px; color: var(--g1); padding: 2px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg.reflechit { color: var(--g1); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* iPhone : un champ de moins de 16 px déclenche un zoom automatique au toucher. */
input, textarea, select { font-size: 16px; }
textarea.auto { overflow: hidden; resize: none; }
.s-ligne .nom-s { font-size: 14px; font-weight: 700; }
.idee-ligne { display: flex; gap: 8px; align-items: flex-start; }
.idee { flex: 1; min-width: 0; font-size: 16px; line-height: 1.45; color: #1D1D1B; white-space: pre-wrap; overflow-wrap: anywhere; padding: 4px 0; min-height: 28px; cursor: text; }
.idee.vide-idee { color: var(--g2); }
.crayon { flex: none; width: 44px; height: 44px; margin: -8px -10px 0 0; background: none; border: 0; color: var(--g1); display: grid; place-items: center; }
.idee-edition { min-height: 64px; }
.deux-petits { display: flex; gap: 10px; margin-top: 8px; }
.deux-petits > * { flex: 1; }
.qui { font-size: 11px; font-weight: 700; color: var(--g1); margin-bottom: 2px; }

/* Accès : connexion, inscription, premier administrateur */
.acces { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.acces h2 { margin: 0; font-size: 20px; }
.erreur-form { color: var(--orange); font-size: 14px; font-weight: 700; min-height: 0; }
.erreur-form:empty { display: none; }
body.deconnecte #onglets { display: none; }
.nom-compte { font-size: 20px; font-weight: 700; }
.code-invit { font-family: Consolas, 'Courier New', monospace; font-size: 28px; font-weight: 700; letter-spacing: 2px; text-align: center; padding: 18px 8px; border: 2px solid var(--orange); user-select: all; overflow-wrap: anywhere; }
.actions-user { display: flex; gap: 14px; flex-wrap: wrap; }
.ligne-user { border-bottom: 1px solid var(--g4); padding-bottom: 8px; }
.bande-edit { display: flex; gap: 8px; flex-wrap: wrap; }
.vign-edit { position: relative; width: 84px; height: 84px; background: var(--g4); }
.vign-edit img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vign-x { position: absolute; top: 0; right: 0; min-width: 32px; height: 32px; background: var(--texte); color: #fff; border: 0; font-size: 18px; line-height: 1; padding: 0 6px; }
.vign-x.arme { background: var(--orange); font-size: 12px; font-weight: 700; }
