/* Espace client — charte de la maquette validée le 14/10/2026 :
   fond blanc, en-tête « MENUISERIE SANCHEZ » + filet doré, Archivo (titres) / Source Sans 3 (texte), cibles ≥ 44 px. */
:root {
  --encre: #1E1E1C;
  --texte: #3D3A34;
  --discret: #5C5850;
  --trait: #D8D4CC;
  --trait-clair: #EDEAE3;
  --fond-doux: #F4F2EE;
  --or: #B08D3C;
  --vert: #1F5229;
  --vert-fond: #E3F0E5;
  --rouge: #A3281E;
  --rouge-fond: #FBE9E7;
  --titre: Archivo, system-ui, sans-serif;
  --corps: 'Source Sans 3', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* sinon un display: flex de classe l'emporte sur l'attribut */
html, body { margin: 0; background: #FFFFFF; color: var(--encre); font-family: var(--corps); font-size: 16px; line-height: 1.45; }
body { -webkit-text-size-adjust: 100%; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--titre); margin: 0; line-height: 1.15; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: #7A5C1E; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
.chargement { padding: 40px 24px; color: var(--discret); }

/* En-tête */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 10px 20px; border-bottom: 2px solid var(--or); background: #FFFFFF; position: sticky; top: 0; z-index: 2; }
.marque { font-family: var(--titre); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; }
.entete-retour { display: flex; align-items: center; gap: 4px; min-width: 0; }
.entete-retour h1 { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-rond { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--trait); background: #FFFFFF; font-family: var(--titre); font-weight: 600; font-size: 14px; flex: none; }
.bouton-retour { width: 44px; height: 44px; border: 0; background: none; font-size: 26px; line-height: 1; flex: none; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--encre); }
.menu { position: absolute; right: 12px; top: 60px; background: #FFFFFF; border: 1px solid var(--trait); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.12); display: flex; flex-direction: column; min-width: 220px; overflow: hidden; }
.menu button, .menu a { min-height: 48px; padding: 0 16px; border: 0; background: none; text-align: left; font-size: 16px; color: var(--encre); text-decoration: none; display: flex; align-items: center; }
.menu > * + * { border-top: 1px solid var(--trait-clair); }

/* Corps */
.page { flex: 1; padding: 0 20px 28px; }
.section { margin-top: 22px; }
.section > h2 { margin-bottom: 10px; }
.sur-titre { font-size: 13px; color: var(--discret); text-transform: uppercase; letter-spacing: 0.06em; }
.discret { color: var(--discret); font-size: 15px; }
.petit { font-size: 13px; color: var(--discret); }

/* Connexion */
.connexion { padding: 52px 28px 28px; flex: 1; display: flex; flex-direction: column; }
.connexion .marque { font-size: 18px; }
.filet { width: 64px; height: 2px; background: var(--or); margin-top: 10px; }
.connexion h1 { margin-top: 56px; font-size: 28px; }
.connexion .intro { margin-top: 10px; color: var(--texte); }
.champ { display: flex; flex-direction: column; margin-top: 22px; }
.champ label { font-size: 14px; font-weight: 600; }
.champ input { margin-top: 8px; height: 56px; border: 1px solid #A9A499; border-radius: 10px; font-size: 26px; letter-spacing: 0.5em; text-align: center; font-family: var(--titre); padding: 0 0 0 0.5em; width: 100%; }
.champ input.texte { font-size: 18px; letter-spacing: 0; text-align: left; padding: 0 14px; font-family: var(--corps); }
.erreur { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--rouge-fond); color: var(--rouge); font-weight: 600; }
.bas-de-page { margin-top: auto; padding-top: 28px; font-size: 13px; color: var(--discret); }

/* Boutons */
.bouton { min-height: 52px; width: 100%; border-radius: 10px; border: 0; background: var(--encre); color: #FFFFFF; font-weight: 600; font-size: 17px; display: flex; align-items: center; justify-content: center; text-decoration: none; padding: 0 16px; text-align: center; }
.bouton[disabled] { opacity: 0.5; cursor: default; }
.bouton.secondaire { background: #FFFFFF; color: var(--encre); border: 1px solid var(--encre); min-height: 48px; font-size: 16px; }
.connexion .bouton { margin-top: 26px; }

/* Accueil */
.titre-projet { padding-top: 18px; }
.titre-projet h1 { margin-top: 4px; }
.image-bouton { display: block; width: 100%; margin-top: 12px; padding: 0; border: 0; background: none; }
.image-principale { width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; background: var(--trait-clair); object-fit: cover; display: block; border: 0; padding: 0; }
.vide { border-radius: 10px; background: var(--fond-doux); color: var(--discret); padding: 18px; text-align: center; font-size: 15px; }
.tuile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 10px; text-decoration: none; min-height: 56px; border: 1px solid var(--trait); color: var(--encre); }
.tuile + .tuile { margin-top: 8px; }
.tuile.forte { background: var(--encre); color: #FFFFFF; border-color: var(--encre); }
.tuile .l1 { font-weight: 600; font-size: 16px; display: block; }
.tuile .l2 { font-size: 13px; display: block; color: var(--discret); white-space: pre-line; }
.tuile.forte .l2 { color: #D8D4CC; }
.chevron { font-size: 22px; flex: none; }
.etapes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.etapes .barre { height: 6px; border-radius: 3px; background: var(--trait); }
.etapes .barre.faite { background: var(--or); }
.etapes .nom { font-size: 12px; color: var(--discret); margin-top: 6px; }
.etapes .nom.active { color: var(--encre); font-weight: 600; }
.liste a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait-clair); color: var(--encre); text-decoration: none; min-height: 52px; }
.liste a .nom { font-size: 16px; }

/* Statuts */
.statut { font-size: 13px; font-weight: 600; color: var(--discret); white-space: nowrap; }
.statut.valide { color: #2F6B3A; }
.statut.travail { color: var(--rouge); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 14px; font-size: 13px; font-weight: 600; background: var(--fond-doux); color: var(--discret); }
.badge.valide { background: var(--vert-fond); color: var(--vert); }
.badge.travail { background: var(--rouge-fond); color: var(--rouge); }

/* Version de travail */
.bandeau-travail { margin: 14px -20px 0; padding: 14px 20px; background: var(--rouge); color: #FFFFFF; }
.bandeau-travail strong { display: block; font-family: var(--titre); font-size: 16px; letter-spacing: 0.02em; }
/* Proposition de l'atelier : neutre (or / gris clair), jamais rouge — décision de Rémi du 15/10 */
.bandeau-proposition { margin: 14px -20px 0; padding: 12px 20px; background: #F6F1E4; border-top: 2px solid var(--or); border-bottom: 1px solid #E6DCC3; color: var(--encre); }
.bandeau-proposition strong { font-family: var(--titre); font-size: 15px; font-weight: 600; }
.badge.proposition { background: #F6F1E4; color: #6B5320; }
.statut.proposition { color: #7A5C1E; }
.bandeau-3d.neutre { background: #F6F1E4; color: #6B5320; border-bottom: 2px solid var(--or); }
.mention-travail { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--rouge); border-radius: 10px; color: var(--rouge); font-size: 14px; }

/* Ouvrage */
.ligne-statut { padding-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.versions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.versions button { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--trait); background: #FFFFFF; font-size: 15px; }
.versions button[aria-pressed="true"] { background: var(--encre); color: #FFFFFF; border-color: var(--encre); }
.onglets { margin-top: 14px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; }
.onglets button { min-height: 44px; border: 0; background: #FFFFFF; font-size: 15px; }
.onglets button + button { border-left: 1px solid var(--trait); }
.onglets button[aria-selected="true"] { background: var(--encre); color: #FFFFFF; font-weight: 600; }
.vues { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.vue { display: block; width: 100%; padding: 0; border: 1px solid var(--trait-clair); border-radius: 10px; background: var(--fond-doux); overflow: hidden; }
.vue img { display: block; width: 100%; height: auto; min-height: 120px; background: var(--fond-doux); }
.legende { font-size: 13px; color: var(--discret); margin-top: 4px; }
.cotes { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; column-gap: 16px; font-size: 15px; }
.cotes .lib { color: var(--discret); }
.cotes .val { text-align: right; font-variant-numeric: tabular-nums; }
.a-confirmer { color: var(--rouge); font-weight: 600; }
.materiaux { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.materiaux div { display: flex; align-items: center; gap: 10px; }
.pastille { width: 22px; height: 22px; border-radius: 11px; border: 1px solid #A9A499; flex: none; }
.encadre { padding: 12px 14px; border-radius: 10px; background: var(--fond-doux); font-size: 15px; }
.accord-donne { padding: 12px 14px; border-radius: 10px; background: var(--vert-fond); color: var(--vert); font-weight: 600; font-size: 15px; }
.fichier { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1px solid var(--trait); border-radius: 10px; background: #FFFFFF; width: 100%; text-align: left; font-size: 16px; }
.fichier + .fichier { margin-top: 8px; }
.fichier .type { font-size: 12px; font-weight: 600; color: var(--discret); text-transform: uppercase; }

/* 3D (lot 2) */
.cadre-3d { display: flex; flex-direction: column; }
.scene-3d { position: relative; height: 62vh; min-height: 300px; max-height: 560px; border-radius: 12px; overflow: hidden; background: #EFECE6; }
.canvas-3d { display: block; width: 100%; height: 100%; touch-action: none; }
.aide-3d { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 16px; background: #FFFFFF; color: var(--discret); font-size: 13px; border: 1px solid var(--trait); white-space: nowrap; pointer-events: none; }
.bandeau-3d { position: absolute; left: 0; right: 0; top: 0; padding: 8px 12px; background: var(--rouge); color: #FFFFFF; font-weight: 600; font-size: 13px; text-align: center; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandeau-3d ~ .aide-3d { top: 44px; }
.outils-3d { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.outil-3d { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--trait); background: #FFFFFF; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.charge-3d { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--discret); background: #EFECE6; }
.charge-3d.echec { color: var(--texte); }
.charge-3d.echec .progression { display: none; }
.progression { width: 70%; max-width: 260px; height: 6px; border-radius: 3px; background: var(--trait); overflow: hidden; }
.progression span { display: block; height: 100%; width: 0; background: var(--or); transition: width 0.2s; }
.progression.indeterminee span { width: 40%; animation: va-et-vient 1.2s ease-in-out infinite alternate; }
@keyframes va-et-vient { from { transform: translateX(-10%); } to { transform: translateX(160%); } }
.vues-3d { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 4px; }
.vue-3d { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--trait); background: #FFFFFF; white-space: nowrap; flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.vue-3d[aria-pressed="true"] { border-color: var(--or); box-shadow: inset 0 0 0 1px var(--or); font-weight: 600; }
.cadre-3d.plein-ecran { position: fixed; inset: 0; z-index: 50; background: #FFFFFF; padding: env(safe-area-inset-top) 8px calc(8px + env(safe-area-inset-bottom)); }
.cadre-3d.plein-ecran .scene-3d { flex: 1; height: auto; max-height: none; border-radius: 0; }
.galerie { position: fixed; inset: 0; z-index: 60; background: #111111; color: #FFFFFF; }
.galerie-piste { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.galerie-piste::-webkit-scrollbar { display: none; }
.galerie-piste figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; padding: calc(56px + env(safe-area-inset-top)) 0 calc(56px + env(safe-area-inset-bottom)); }
.galerie-piste img { max-width: 100%; max-height: 100%; object-fit: contain; }
.galerie-fermer { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,0.15); color: #FFFFFF; font-size: 20px; }
.galerie-fleche { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 8px; background: rgba(255,255,255,0.12); color: #FFFFFF; font-size: 32px; line-height: 1; display: none; }
.galerie-fleche.precedente { left: 8px; } .galerie-fleche.suivante { right: 8px; }
@media (hover: hover) and (pointer: fine) { .galerie-fleche { display: block; } }
.galerie-pied { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.galerie-titre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.galerie-compteur { flex: none; opacity: 0.8; }
body.galerie-ouverte { overflow: hidden; }

/* Échanges */
.fil { padding: 14px 0; border-bottom: 1px solid var(--trait-clair); }
.message { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--fond-doux); font-size: 15px; white-space: pre-line; }
.message.atelier { background: #FFFFFF; border: 1px solid var(--trait); }
.message .qui { font-size: 12px; font-weight: 600; color: var(--discret); display: block; margin-bottom: 2px; }
.fil-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.message .vignette { display: block; margin-top: 8px; padding: 0; border: 1px solid var(--trait); border-radius: 8px; overflow: hidden; background: #FFFFFF; max-width: 220px; }
.message .vignette img { display: block; width: 100%; height: auto; min-height: 60px; }
.choix { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.bouton-choix { min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--encre); background: #FFFFFF; color: var(--encre); font-size: 16px; text-align: left; }
.bouton-choix[aria-pressed="true"] { background: var(--encre); color: #FFFFFF; }
.bouton-choix[disabled]:not([aria-pressed="true"]) { opacity: 0.45; }
.fil > .bouton.secondaire { margin-top: 10px; }
.repondre { margin-top: 10px; }
.zone-message { display: flex; flex-direction: column; gap: 10px; }
.zone-message .etiquette { font-weight: 600; font-size: 16px; }
.zone-message textarea { width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--trait); border-radius: 10px; font: inherit; font-size: 16px; resize: vertical; }
.zone-message textarea:focus { outline: 2px solid var(--or); outline-offset: 1px; }
.cache-fichier { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.apercu-photo { display: flex; align-items: center; gap: 12px; }
.apercu-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--trait); }
.lien-retirer { border: 0; background: none; color: var(--encre); text-decoration: underline; font-size: 15px; min-height: 44px; }
.erreur { margin: 0; color: var(--rouge); font-size: 15px; }
.actions-echanges { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.actions-ouvrage { display: flex; flex-direction: column; gap: 10px; }
.actions-ouvrage h2 { margin-bottom: 0; }

/* Barre du bas */
.barre-bas { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--trait); background: #FFFFFF; padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
.barre-bas a { min-height: 48px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--discret); text-decoration: none; }
.barre-bas a[aria-current="page"] { color: var(--encre); font-weight: 600; }

/* Texte long (Vos données) */
.texte-long h2 { margin-top: 22px; }
.texte-long p { margin-top: 8px; color: var(--texte); }

/* Bon pour accord et version de travail (lot 4) */
.accord { display: flex; flex-direction: column; gap: 12px; }
.accord h2 { margin-bottom: 0; }
.case { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--trait); border-radius: 10px; font-size: 15px; line-height: 1.4; }
.case input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--encre); }
.accord input[type="text"] { min-height: 48px; padding: 0 12px; border: 1px solid var(--trait); border-radius: 10px; font: inherit; font-size: 16px; }
.accord input[type="text"]:focus { outline: 2px solid var(--or); outline-offset: 1px; }
.accord-donne { display: flex; flex-direction: column; gap: 4px; }
.changements { border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; font-size: 15px; }
.changements .ligne { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--trait-clair); }
.changements .ligne.tete { border-top: 0; background: var(--fond-doux); font-size: 13px; font-weight: 600; color: var(--discret); }
.changements .ligne span:last-child { font-weight: 600; color: var(--rouge); }
.changements .ligne.tete span:last-child { color: var(--rouge); }

/* Fichiers : ouvrir ou télécharger (nom lisible) */
.ligne-fichier { display: flex; gap: 8px; align-items: stretch; }
.ligne-fichier + .ligne-fichier { margin-top: 8px; }
.ligne-fichier .fichier { flex: 1; min-width: 0; margin: 0; }
.telecharger { flex: none; width: 52px; border: 1px solid var(--trait); border-radius: 10px; background: #FFFFFF; font-size: 20px; color: var(--encre); }
