/* Relevé technique ATHP — même habillage que Formations ATHP. */
@font-face {
  font-family: 'Archivo';
  src: url('/polices/archivo-latin-wdth-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face { font-family: 'IBM Plex Mono'; src: url('/polices/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/polices/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --papier: #ffffff;
  --papier2: #f4f3f1;
  --encre: #1c1c1f;
  --texte: #34343a;
  --texte-doux: #63626a;
  --trait: #dad8d5;
  --trait-fort: #b3b0ab;
  --accent: #ec1b24;
  --accent-sombre: #b3262c;
  --accent-clair: #ffe9e6;
  --succes: #1f7a4d;
  --succes-clair: #e3f3ea;
  --alerte: #8a5206;
  --alerte-clair: #fdf1dc;
  --info: #2b5b8a;
  --info-clair: #e6eef6;
  --police: 'Archivo', Arial, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  --rayon: 8px;
  --ombre: 0 1px 0 rgba(28, 28, 31, 0.04), 0 10px 24px -16px rgba(28, 28, 31, 0.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--police); color: var(--texte); background: var(--papier2); }
#app { min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3.4vw, 32px); line-height: 1.15; font-weight: 700; font-stretch: 90%; color: var(--encre); letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--texte-doux); }
h3 { font-size: 17px; line-height: 1.3; font-weight: 650; color: var(--encre); }
a { color: var(--accent-sombre); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: 15px; background: var(--papier); border: 1px solid var(--trait); border-radius: 4px; padding: 3px 8px; user-select: all; }
.chargement, .vide { padding: 70px 20px; text-align: center; color: var(--texte-doux); display: grid; gap: 16px; justify-items: center; }
.sur-titre { font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--texte-doux); }

/* ------------------------------------------------------------------ cadre */
.entete { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px clamp(14px, 3vw, 28px); background: var(--encre); color: #fff; }
.marque { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 650; font-stretch: 90%; margin-right: auto; }
.marque img { height: 30px; width: auto; background: #fff; border-radius: 4px; padding: 3px 6px; }
.pastille { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.1); color: #cfe9da; }
.pastille.attente { background: var(--alerte-clair); color: var(--alerte); }
.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: 7px; cursor: pointer; padding: 6px 4px; font-size: 14px; }
.menu summary::-webkit-details-marker { display: none; }
.menu > div { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--papier); color: var(--texte); border-radius: var(--rayon); box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.45); padding: 8px; display: grid; }
.menu > div p { padding: 6px 10px 8px; font-size: 13px; color: var(--texte-doux); border-bottom: 1px solid var(--trait); margin-bottom: 6px; }
.menu > div a, .menu > div button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 5px; text-decoration: none; color: var(--texte); }
.menu > div a:hover, .menu > div button:hover { background: var(--papier2); }
.page { width: min(1320px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 28px) 80px; }
.page-seule { flex: 1; display: grid; place-items: center; padding: 24px 16px; }

.carte { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: var(--rayon); border: 1px solid var(--trait-fort); background: var(--papier); color: var(--encre); font-weight: 600; text-decoration: none; }
.bouton:hover { border-color: var(--encre); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: var(--accent-sombre); border-color: var(--accent-sombre); }
.bouton:disabled { background: var(--trait); border-color: var(--trait); color: var(--texte-doux); cursor: not-allowed; }
.bouton.large { width: 100%; }
.bouton.geant { min-height: 64px; font-size: 19px; padding: 14px 28px; width: min(420px, 100%); }
.bouton.geant svg { width: 24px; height: 24px; stroke-width: 2.4; }
.lien { background: none; border: 0; padding: 0; text-align: left; color: inherit; text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
.lien.discret { display: inline-flex; align-items: center; gap: 6px; color: var(--texte-doux); font-size: 14px; text-decoration: none; }
.lien.discret:hover { color: var(--accent-sombre); }
.retour { display: inline-flex; align-items: center; gap: 4px; color: var(--texte-doux); text-decoration: none; font-weight: 600; font-size: 14px; }
.retour:hover { color: var(--encre); }
.erreur-formulaire { background: var(--accent-clair); color: var(--accent-sombre); padding: 10px 12px; border-radius: var(--rayon); font-weight: 600; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--papier2); color: var(--texte-doux); border: 1px solid var(--trait); }
.badge.transmis { background: var(--info-clair); color: var(--info); border-color: transparent; }
.badge.a_reprendre { background: var(--alerte-clair); color: var(--alerte); border-color: transparent; }
.badge.valide { background: var(--succes-clair); color: var(--succes); border-color: transparent; }
.bandeau { display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--rayon); }
.bandeau svg { margin-top: 3px; }
.bandeau.reprendre { background: var(--alerte-clair); color: #5d3804; }
.bandeau.remis { background: var(--succes-clair); color: #134b30; }
.bandeau.remis p { font-size: 14px; margin-top: 6px; }

/* ------------------------------------------------------------------ champs */
.champ { display: grid; gap: 5px; align-content: start; }
.champ label { font-weight: 600; font-size: 14.5px; color: var(--encre); }
.requis { color: var(--accent); font-weight: 800; }
input[type='text'], input[type='password'], input[type='search'], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--trait-fort); border-radius: 6px; background: var(--papier);
}
textarea { resize: vertical; line-height: 1.45; }
input:disabled, select:disabled, textarea:disabled { background: var(--papier2); color: var(--texte); border-color: var(--trait); opacity: 1; -webkit-text-fill-color: var(--texte); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--encre); outline-offset: -1px; border-color: var(--encre); }
.avec-unite { position: relative; }
.avec-unite input { font-family: var(--mono); font-weight: 500; font-size: 17px; padding-right: 64px; }
.avec-unite span { position: absolute; right: 12px; top: 50%; translate: 0 -50%; font-size: 13px; color: var(--texte-doux); pointer-events: none; }
input.illisible { border-color: var(--accent); background: var(--accent-clair); }
.aide { font-size: 13px; line-height: 1.4; color: var(--texte-doux); }
.message { font-size: 13.5px; line-height: 1.4; font-weight: 600; padding: 7px 10px; border-radius: 5px; }
.champ[data-niveau='attention'] .message { background: var(--alerte-clair); color: #5d3804; }
.champ[data-niveau='bloquant'] .message { background: var(--accent-clair); color: var(--accent-sombre); }
.champ[data-niveau='attention'] :is(input, select) { border-color: #c98a1c; }
.champ[data-niveau='bloquant'] :is(input, select) { border-color: var(--accent); }
/* Valeur remplie par l'IA ou reprise d'une fourniture : à relire, la marque part dès que le champ est retouché. */
.champ[data-propose] > label::after { content: 'proposé, à vérifier'; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #e7eefc; color: #1f4a9c; font-size: 0.72rem; font-weight: 500; white-space: nowrap; }
.champ[data-propose] :is(input, select) { background: #f4f7fe; }
.reprise-fourniture:not(:empty) { margin-top: 12px; }
.completer-ia { margin: 8px 0 0; }
.segments { display: flex; flex-wrap: wrap; gap: 6px; }
.segments label { flex: 1 1 auto; position: relative; }
.segments input { position: absolute; opacity: 0; inset: 0; }
.segments span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px; padding: 8px 12px; border: 1px solid var(--trait-fort); border-radius: 6px; background: var(--papier); font-weight: 500; font-size: 14.5px; line-height: 1.25; cursor: pointer; }
.segments input:checked + span { background: var(--encre); border-color: var(--encre); color: #fff; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.segments input:disabled + span { cursor: default; opacity: 0.75; }

/* ------------------------------------------------------------------ connexion */
.connexion { width: min(420px, 100%); display: grid; gap: 16px; padding: 34px 32px 28px; }
.connexion.centree { margin: 30px auto; }
.connexion .logo { width: 150px; }
.connexion form { display: grid; gap: 14px; }

/* ------------------------------------------------------------------ accueil */
.accueil, .nouveau, .comptes { display: grid; gap: 26px; }
.accueil section { display: grid; gap: 12px; }
.accueil h2 { display: flex; align-items: center; gap: 8px; }
.compte { background: var(--encre); color: #fff; border-radius: 99px; padding: 1px 9px; font-size: 12px; letter-spacing: 0; }
.rien { color: var(--texte-doux); }
.liste { display: grid; gap: 8px; }
.releve { display: flex; justify-content: space-between; gap: 16px; padding: 14px 18px; text-decoration: none; color: inherit; transition: border-color 0.12s, translate 0.12s; }
.releve:hover { border-color: var(--encre); translate: 0 -1px; }
.releve .lieu, .compte .lieu { color: var(--texte-doux); font-size: 14.5px; }
.retour-charge { margin-top: 6px; font-size: 14.5px; color: #5d3804; background: var(--alerte-clair); padding: 6px 10px; border-radius: 5px; }
.etat { display: grid; justify-items: end; align-content: start; gap: 6px; flex: none; }
.date { font-size: 13px; color: var(--texte-doux); }
.a-envoyer { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--alerte); }
.a-envoyer svg { width: 15px; height: 15px; }
.recherche { max-width: 520px; }

.domaines { display: flex; flex-wrap: wrap; gap: 8px; }
.domaines a { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--trait-fort); background: var(--papier); color: var(--encre); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.domaines a:hover { border-color: var(--encre); }
.domaine { display: grid; gap: 12px; scroll-margin-top: 70px; }
.choix-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.type { display: grid; gap: 4px; padding: 0 18px 18px; text-align: left; overflow: hidden; transition: border-color 0.12s, translate 0.12s; }
.type:hover { border-color: var(--accent); translate: 0 -2px; }
.type img { width: calc(100% + 36px); margin: 0 -18px 10px; aspect-ratio: 3 / 2; object-fit: contain; background: linear-gradient(#fbfaf9, #eceae7); border-bottom: 1px solid var(--trait); }
.type p:last-child { color: var(--texte-doux); font-size: 14.5px; }

.compte { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
.compte > div { flex: 1 1 240px; }
.compte select { width: auto; }
.compte.inactif { opacity: 0.55; }
.ajout { padding: 20px; display: grid; gap: 14px; max-width: 520px; }
.ajout form { display: grid; gap: 14px; }

/* ------------------------------------------------------------------ fiche */
.fiche { display: grid; gap: 18px; }
.tete-fiche { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: start; }
.tete-fiche .retour { grid-column: 1 / -1; }
.identite { display: grid; gap: 4px; }
.colonnes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); gap: 22px; align-items: start; }
.saisie { display: grid; gap: 14px; }
.groupe { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px 20px 20px; display: grid; gap: 14px; }
.saisie > div:not([class]) { display: grid; gap: 14px; }
.grille-champs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 18px; }
.avancement { height: 5px; border-radius: 99px; background: var(--trait); overflow: hidden; }
.avancement i { display: block; height: 100%; background: var(--succes); transition: width 0.25s; }
.transmettre { justify-items: start; }
.transmettre .bouton { min-height: 54px; font-size: 17px; padding: 12px 24px; }
.raison { font-size: 14.5px; color: var(--texte-doux); }
.decision .boutons { display: flex; flex-wrap: wrap; gap: 10px; }
.renvoi { display: grid; gap: 10px; justify-items: start; }

.cote { position: sticky; top: 68px; display: grid; gap: 12px; }
.carte-3d { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.vue-3d { position: relative; height: clamp(260px, 38vh, 400px); background: radial-gradient(circle at 50% 35%, #ffffff, #e9e7e4); touch-action: none; }
.carte-3d { position: relative; }
/* Les commandes de la vue flottent sur le modèle ; entre elles, on fait toujours tourner la pièce. */
.barre-vue { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.barre-vue > * { pointer-events: auto; }
.actions-vue { display: flex; gap: 6px; }
.agrandir, .modes-vue { border: 1px solid var(--trait-fort); background: rgba(255, 255, 255, 0.92); border-radius: 6px; }
.agrandir { min-height: 40px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.agrandir:hover, .modes-vue:hover { border-color: var(--encre); }
.agrandir.cotes[aria-pressed='true'] { background: var(--encre); border-color: var(--encre); color: #fff; }
.modes-vue { display: inline-flex; overflow: hidden; }
.modes-vue button { min-height: 40px; min-width: 46px; padding: 0 12px; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--encre); }
.modes-vue button + button { border-left: 1px solid var(--trait); }
.modes-vue button[aria-pressed='true'] { background: var(--encre); color: #fff; }
.modes-vue button:focus-visible, .projections-vue button:focus-visible { outline-offset: -3px; }
.projections-vue { display: flex; align-items: center; }
.projections-vue button { min-height: 40px; padding: 0 9px; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--texte-doux); }
.projections-vue button + button::before { content: '·'; display: inline-block; margin: 0 9px 0 -9px; color: var(--trait-fort); }
.projections-vue button[aria-pressed='true'] { color: var(--encre); text-decoration: underline 2px; text-underline-offset: 5px; }
.carte-3d.agrandie { position: fixed; inset: 52px 0 0 0; z-index: 50; border-radius: 0; border: 0; display: flex; flex-direction: column; }
.carte-3d.agrandie .vue-3d { flex: 1; height: auto; min-height: 0; }
.vue-3d canvas { display: block; width: 100%; height: 100%; }
.legende-3d { padding: 9px 14px 11px; font-size: 12.5px; line-height: 1.45; color: var(--texte-doux); border-top: 1px solid var(--trait); }
.supposees { color: var(--alerte); font-weight: 600; }
.curseur { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 14px 0; font-size: 13px; font-weight: 600; }
.curseur input { flex: 1; accent-color: var(--accent); }
.controles { display: grid; gap: 8px; }
.bloc { border-radius: var(--rayon); padding: 12px 14px; display: grid; gap: 6px; }
.bloc h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; color: inherit; }
.bloc ul { margin: 0; padding-left: 26px; display: grid; gap: 4px; font-size: 14px; line-height: 1.4; }
.bloc li .lien { display: block; width: 100%; }
.bloc.bloquant { background: var(--accent-clair); color: var(--accent-sombre); }
.bloc.attention { background: var(--alerte-clair); color: #5d3804; }
.bloc.manquant { background: var(--papier); border: 1px solid var(--trait); color: var(--texte); }
.bloc.manquant .lien { text-decoration-color: var(--trait-fort); }
.bloc.bon { background: var(--succes-clair); color: var(--succes); }
.calculs { margin: 0; background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 14px; }
.calculs dd { margin: 0; font-family: var(--mono); font-weight: 500; color: var(--encre); text-align: right; }
.documents { display: flex; flex-wrap: wrap; gap: 8px; }
.documents .bouton { flex: 1 1 auto; font-size: 14.5px; padding: 8px 12px; }
.sauvegarde { font-size: 12.5px; color: var(--texte-doux); min-height: 18px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photos figure { margin: 0; position: relative; display: grid; gap: 6px; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--trait); background: var(--papier2); }
.photos input { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.retirer { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 99px; border: 0; background: rgba(28, 28, 31, 0.78); color: #fff; display: grid; place-items: center; }
.photos .changer-usage { justify-self: start; font-size: 12.5px; }
.ajouter-photo { display: grid; place-items: center; align-content: center; gap: 8px; aspect-ratio: 4 / 3; border: 2px dashed var(--trait-fort); border-radius: 6px; color: var(--texte-doux); font-weight: 600; cursor: pointer; text-align: center; padding: 10px; }
.ajouter-photo:hover { border-color: var(--accent); color: var(--accent-sombre); }
.ajouter-photo svg { width: 28px; height: 28px; }

@media (max-width: 940px) {
  .colonnes { grid-template-columns: 1fr; }
  /* La vue 3D reste sous les yeux pendant toute la saisie : elle devient un élément de la colonne. */
  .cote { display: contents; }
  .carte-3d { order: -2; position: sticky; top: 56px; z-index: 5; box-shadow: 0 12px 20px -16px rgba(0, 0, 0, 0.5); }
  .controles { order: -1; }
  .vue-3d { height: 30vh; min-height: 190px; }
  .marque span { display: none; }
  .releve { flex-direction: column; gap: 8px; }
  .etat { justify-items: start; grid-auto-flow: column; align-items: center; gap: 10px; }
}

.pastille { white-space: nowrap; }
@media (max-width: 520px) {
  .menu summary span { display: none; }
}

