/* Trace-Tôle — feuille de style.
   Parti pris : le plan d'atelier. Tôle bleuie au bleu de traçage, traits de pointe à tracer,
   jaune de craie pour les actions, coins chanfreinés comme une tôle cisaillée. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url('../fonts/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url('../fonts/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('../fonts/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url('../fonts/barlow-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url('../fonts/barlow-condensed-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url('../fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url('../fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }

:root {
  --texte: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --titre: 'Barlow Condensed', 'Arial Narrow', 'Barlow', sans-serif;
  /* clair : atelier en plein jour, tôle galvanisée */
  --fond: #e4e9ee;
  --panneau: #f8fafb;
  --creux: #ffffff;
  --encre: #0e2038;
  --encre-2: #45566e;
  --filet: #b9c4d0;
  --filet-fort: #7f8ea1;
  --bleu: #1b4b8f;
  --craie: #f5b700;
  --craie-encre: #1a1500;
  --minium: #b93a16;
  --minium-fond: #fbe9e3;
  --barre: #0e2038;
  --barre-encre: #f2f6fa;
  /* toile du développé */
  --toile: #fbfcfd;
  --g-fin: #e3e9ef;
  --g-fort: #c6d1dc;
  --t-contour: #0e2038;
  --t-gen: #2a66b8;
  --t-pli: #c2410c;
  --t-rep: #1c7c46;
  --t-cote: #5c6b80;
  --ombre: 0 1px 0 rgba(14, 32, 56, .08), 0 8px 24px -12px rgba(14, 32, 56, .28);
  --coin: 3px;
  --h-barre: 60px;
  --h-onglets: 0px;
}
[data-theme='sombre'] {
  --fond: #08111e;
  --panneau: #101e33;
  --creux: #0a1626;
  --encre: #e8eff7;
  --encre-2: #a3b4c8;
  --filet: #2a3d58;
  --filet-fort: #4d6587;
  --bleu: #8fbcff;
  --craie: #f5b700;
  --minium: #ff8a63;
  --minium-fond: #3a1a12;
  --barre: #050c16;
  --barre-encre: #e8eff7;
  /* tôle passée au bleu de traçage, traits rayés à la pointe */
  --toile: #123459;
  --g-fin: #17406c;
  --g-fort: #1f5088;
  --t-contour: #f3f8ff;
  --t-gen: #9cc9ff;
  --t-pli: #ffc233;
  --t-rep: #7ee2a8;
  --t-cote: #b9cde4;
  --ombre: 0 1px 0 rgba(0, 0, 0, .4), 0 10px 28px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--texte); font-size: 16px; line-height: 1.45; color: var(--encre); background: var(--fond); min-height: 100dvh; }
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--craie); outline-offset: 2px; }
[hidden] { display: none !important; }
.visuel-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { display: block; }

/* ---------- barre ---------- */
.barre { position: sticky; top: 0; z-index: 30; height: var(--h-barre); display: flex; align-items: center; gap: 16px; padding: 0 18px; background: var(--barre); color: var(--barre-encre); border-bottom: 3px solid var(--craie); }
.marque { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 38px; height: 38px; color: var(--craie); flex: none; }
.titres { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.nom { font-family: var(--titre); font-weight: 700; font-size: 27px; letter-spacing: .01em; }
.sous { font-size: 13px; color: #a9b9cc; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proto { font-size: 12.5px; color: #a9b9cc; border: 1px solid #33496a; padding: 3px 9px; border-radius: 2px; white-space: nowrap; }
.actions { margin-left: auto; display: flex; gap: 6px; }
.b-barre { height: 42px; padding: 0 14px; font-weight: 600; font-size: 15.5px; border-radius: var(--coin); color: var(--barre-encre); border: 1px solid transparent; }
.b-barre[data-action='enregistrer'] { background: var(--craie); color: var(--craie-encre); }
.b-theme, .b-menu { width: 42px; padding: 0; display: grid; place-items: center; }
.b-theme svg, .b-menu svg { width: 22px; height: 22px; }
.b-menu { display: none; margin-left: auto; }

/* ---------- structure ---------- */
main { display: grid; grid-template-columns: 404px minmax(0, 1fr); height: calc(100dvh - var(--h-barre)); }
.colonne { overflow-y: auto; padding: 16px 16px 40px; background: var(--panneau); border-right: 1px solid var(--filet); scrollbar-gutter: stable; }
#z-resultats { overflow-y: auto; padding: 16px 18px 40px; min-width: 0; }
.t-zone { font-family: var(--titre); font-weight: 600; font-size: 21px; margin: 22px 0 10px; padding-bottom: 5px; border-bottom: 2px solid var(--encre); }
.t-zone:first-child { margin-top: 0; }

/* ---------- pièces ---------- */
.selecteur { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tuile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; min-height: 76px; border: 1.5px solid var(--filet); background: var(--creux); border-radius: var(--coin); font-size: 12.5px; font-weight: 600; line-height: 1.1; text-align: center; color: var(--encre-2); }
.tuile svg { width: 40px; height: 40px; }
.tuile[aria-checked='true'] { background: var(--encre); border-color: var(--encre); color: var(--panneau); clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%); }
[data-theme='sombre'] .tuile[aria-checked='true'] { background: var(--craie); border-color: var(--craie); color: var(--craie-encre); }
.tuile.a-venir { opacity: .5; border-style: dashed; }
.tuile.a-venir em { font-style: normal; font-weight: 500; font-size: 11px; }

.carte-piece { margin-top: 14px; }
.entete-piece h1 { font-family: var(--titre); font-weight: 700; font-size: 30px; line-height: 1.05; }
.entete-piece p { color: var(--encre-2); margin-top: 3px; font-size: 15px; }
.schema-cadre { margin-top: 10px; height: 232px; background: var(--toile); border: 1px solid var(--filet); border-radius: var(--coin); padding: 6px; }
.schema-cadre svg { width: 100%; height: 100%; }
.schema-cadre.deux-vues { height: 340px; }

/* ---------- champs ---------- */
.champs { display: grid; gap: 13px; }
.champ { min-width: 0; }
.etiquette { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.lib { font-weight: 600; font-size: 15.5px; flex: 1; min-width: 0; }
.sym { display: inline-block; min-width: 26px; padding: 0 5px; margin-right: 8px; text-align: center; font-family: var(--titre); font-weight: 700; font-size: 16px; line-height: 22px; color: var(--panneau); background: var(--bleu); border-radius: 2px; }
.b-aide { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--filet-fort); font-weight: 700; font-size: 15px; color: var(--encre-2); }
.b-aide[aria-expanded='true'] { background: var(--encre); color: var(--panneau); border-color: var(--encre); }
.aide { margin-top: 6px; padding: 8px 10px; font-size: 14.5px; color: var(--encre-2); background: var(--creux); border-left: 3px solid var(--bleu); }
.saisie { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto 50px; align-items: stretch; height: 52px; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); background: var(--creux); overflow: hidden; }
.saisie:focus-within { border-color: var(--encre); box-shadow: 0 0 0 3px var(--craie); }
.saisie input { border: 0; background: none; min-width: 0; width: 100%; padding: 0 4px 0 12px; font-family: var(--titre); font-weight: 600; font-size: 25px; font-variant-numeric: tabular-nums; outline: none; }
.saisie .unite { align-self: center; padding: 0 10px 0 2px; color: var(--encre-2); font-size: 15px; }
.pas { font-size: 26px; font-weight: 500; line-height: 1; color: var(--encre-2); background: color-mix(in srgb, var(--filet) 35%, transparent); }
.pas:first-child { border-right: 1px solid var(--filet); }
.pas:last-child { border-left: 1px solid var(--filet); }
.champ.invalide .saisie, .champ.invalide select, .champ.invalide .segments { border-color: var(--minium); box-shadow: 0 0 0 2px var(--minium); }
.erreur { margin-top: 6px; padding: 7px 10px; font-size: 14.5px; font-weight: 500; color: var(--minium); background: var(--minium-fond); border-left: 3px solid var(--minium); }
select { width: 100%; height: 52px; padding: 0 38px 0 12px; font-weight: 500; font-size: 16px; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); background: var(--creux) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237f8ea1' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 13px center / 13px; appearance: none; -webkit-appearance: none; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); overflow: hidden; background: var(--creux); }
.segments button { min-height: 50px; padding: 4px 6px; font-weight: 600; font-size: 15px; line-height: 1.15; color: var(--encre-2); }
.segments button + button { border-left: 1px solid var(--filet); }
.segments button[aria-checked='true'] { background: var(--encre); color: var(--panneau); }
.ligne-oui { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.bascule { flex: none; width: 62px; height: 36px; border-radius: 18px; background: var(--filet-fort); position: relative; transition: background .15s; }
.bascule i { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform .15s; }
.bascule[aria-checked='true'] { background: var(--bleu); }
.bascule[aria-checked='true'] i { transform: translateX(26px); }
.avance { margin-top: 20px; border-top: 1px solid var(--filet); padding-top: 4px; }
.avance summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: 16px; }
.avance form { padding-bottom: 6px; }

/* ---------- résultats ---------- */
.alerte { margin-bottom: 12px; padding: 12px 14px; background: var(--minium-fond); color: var(--minium); border-left: 5px solid var(--minium); font-size: 16px; font-weight: 500; }
.alerte span { opacity: .8; }
.vues { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; height: min(60vh, 620px); min-height: 380px; }
.cadre { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panneau); border: 1px solid var(--filet); border-radius: var(--coin); box-shadow: var(--ombre); overflow: hidden; }
.cadre-titre { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 12px 7px; border-bottom: 1px solid var(--filet); }
.cadre-titre h2 { font-family: var(--titre); font-weight: 600; font-size: 20px; }
.echelle { font-size: 13.5px; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.toile { position: relative; flex: 1; min-height: 0; background: var(--toile); touch-action: none; cursor: grab; overflow: hidden; }
.toile.saisi { cursor: grabbing; }
.toile-3d { cursor: grab; background: radial-gradient(120% 90% at 50% 35%, color-mix(in srgb, var(--toile) 70%, #ffffff 30%), var(--toile) 75%); }
[data-theme='sombre'] .toile-3d { background: radial-gradient(120% 90% at 50% 35%, #1b4675, #0c2440 80%); }
.toile-3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.msg-3d { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--encre-2); }
.en-erreur .toile, .en-erreur #bilan, .en-erreur #z-tableau, .en-erreur .schema-cadre svg { opacity: .35; }

.dessin { position: absolute; inset: 0; width: 100%; height: 100%; }
.dessin path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.schema.dessin { position: static; }
.g-fin { stroke: var(--g-fin); stroke-width: 1; }
.g-fort { stroke: var(--g-fort); stroke-width: 1; }
.c-contour { stroke: var(--t-contour); stroke-width: 2.4; }
.c-contour.trou { stroke-width: 2.2; }
.c-generatrices { stroke: var(--t-gen); stroke-width: 1; }
.c-generatrices.limite { stroke-width: 1.7; }
.c-pliage { stroke: var(--t-pli); stroke-width: 2; stroke-dasharray: 10 5; }
.c-reperes { stroke: var(--t-rep); stroke-width: 1.3; stroke-dasharray: 4 4; }
.c-cotes { stroke: var(--t-cote); stroke-width: 1; }
.c-trait { stroke: var(--t-contour); stroke-width: 2.2; }
.c-fin { stroke: var(--t-gen); stroke-width: 1; }
.c-axe { stroke: var(--t-cote); stroke-width: 1; stroke-dasharray: 12 3 2 3; }
.t-texte { fill: var(--t-contour); font-family: var(--titre); font-weight: 600; }
.t-cote { fill: var(--t-cote); font-family: var(--titre); font-weight: 600; }
.schema .t-cote, .schema .t-texte { fill: var(--t-contour); }

.outils { position: absolute; right: 10px; top: 52px; display: grid; gap: 6px; }
.outils button, .b-carre { width: 46px; height: 46px; display: grid; place-items: center; background: var(--panneau); border: 1.5px solid var(--filet-fort); border-radius: var(--coin); box-shadow: var(--ombre); }
.outils svg, .b-carre svg { width: 22px; height: 22px; }
.legende { position: absolute; left: 10px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--t-cote); pointer-events: none; }
.legende li { display: flex; align-items: center; gap: 6px; }
.legende li::before { content: ''; width: 22px; border-top: 2.4px solid var(--t-contour); }
.legende .l-gen::before { border-top: 1.4px solid var(--t-gen); }
.legende .l-pli::before { border-top: 2px dashed var(--t-pli); }
.legende .l-rep::before { border-top: 1.6px dotted var(--t-rep); }
#z-plan.plein { position: fixed; inset: 0; z-index: 60; border-radius: 0; border: 0; }

.formage { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-top: 1px solid var(--filet); }
.b-former { flex: none; height: 46px; min-width: 96px; padding: 0 16px; font-family: var(--titre); font-weight: 700; font-size: 19px; background: var(--craie); color: var(--craie-encre); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.b-former:focus-visible, .b-export.principal:focus-visible { outline-offset: -5px; outline-color: var(--encre); }
.curseur { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--encre-2); min-width: 0; }
.curseur input { flex: 1; min-width: 40px; height: 34px; accent-color: var(--bleu); }
.b-carre { flex: none; box-shadow: none; }

/* bilan */
#z-bilan { margin-top: 14px; }
.bilan { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--filet); border-radius: var(--coin); background: var(--panneau); }
.bilan > div { padding: 9px 12px 10px; border-left: 1px solid var(--filet); min-width: 0; }
.bilan > div:first-child { border-left: 0; }
.bilan dt { font-size: 13.5px; color: var(--encre-2); }
.bilan dd { font-family: var(--titre); font-weight: 600; font-size: 25px; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bilan dd small { font-family: var(--texte); font-weight: 500; font-size: 14px; color: var(--encre-2); }
.exports { display: grid; grid-template-columns: 1.25fr 1.25fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.b-export { display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 100%; min-height: 62px; padding: 8px 14px; text-align: left; background: var(--panneau); border: 1.5px solid var(--encre); border-radius: var(--coin); }
.b-export b { font-family: var(--titre); font-weight: 700; font-size: 22px; line-height: 1; }
.b-export span { font-size: 13.5px; color: var(--encre-2); }
.b-export.principal { background: var(--craie); border-color: var(--craie); color: var(--craie-encre); clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%); }
.b-export.principal span { color: #4d3f00; }
.b-export:disabled { opacity: .4; }
.groupe-pdf { display: grid; grid-template-columns: minmax(0, 1fr) 78px; }
.groupe-pdf .b-export { border-radius: var(--coin) 0 0 var(--coin); }
.groupe-pdf select { height: 100%; min-height: 62px; border: 1.5px solid var(--encre); border-left: 0; border-radius: 0 var(--coin) var(--coin) 0; font-weight: 700; padding: 0 26px 0 10px; background-position: right 8px center; }
.prudence { margin-top: 12px; padding: 10px 12px; font-size: 14.5px; color: var(--encre-2); border-left: 4px solid var(--craie); background: var(--panneau); }
.prudence strong { color: var(--encre); }

/* tableau */
#z-tableau { margin-top: 18px; }
.deux { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.t-bloc { font-family: var(--titre); font-weight: 600; font-size: 21px; padding-bottom: 5px; border-bottom: 2px solid var(--encre); margin-bottom: 8px; }
.t-bloc-ligne { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--encre); margin-bottom: 8px; }
.t-bloc-ligne .t-bloc { border: 0; margin: 0; }
.b-petit { height: 38px; padding: 0 12px; margin-bottom: 5px; font-weight: 600; font-size: 14.5px; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); background: var(--panneau); }
.liste-cotes > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--filet); font-size: 15px; }
.liste-cotes dt { color: var(--encre-2); }
.liste-cotes dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.methode { margin-top: 10px; font-size: 14.5px; color: var(--encre-2); }
.tableau + .tableau { margin-top: 20px; }
.tableau h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.defile { overflow: auto; max-height: 460px; border: 1px solid var(--filet); border-radius: var(--coin); background: var(--panneau); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15.5px; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--encre); color: var(--panneau); font-weight: 600; font-size: 14px; line-height: 1.2; text-align: right; padding: 8px 12px; vertical-align: bottom; }
thead th:first-child, tbody th { text-align: left; }
tbody th, tbody td { padding: 6px 12px; border-bottom: 1px solid var(--filet); text-align: right; white-space: nowrap; }
tbody th { font-family: var(--titre); font-weight: 700; font-size: 17px; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--filet) 22%, transparent); }
.note { margin-top: 7px; font-size: 14px; color: var(--encre-2); max-width: 78ch; }

/* ---------- onglets (tablette, téléphone) ---------- */
.onglets { display: none; }

/* ---------- fenêtres ---------- */
dialog.fenetre { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-top: 4px solid var(--craie); border-radius: var(--coin); background: var(--panneau); color: var(--encre); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
dialog.fenetre.large { width: min(680px, calc(100vw - 24px)); }
dialog.fenetre[open] { display: flex; flex-direction: column; }
dialog.fenetre > form { display: flex; flex-direction: column; min-height: 0; }
dialog::backdrop { background: rgba(5, 12, 22, .62); }
.f-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.f-tete h2 { font-family: var(--titre); font-weight: 700; font-size: 26px; line-height: 1.1; }
.f-fermer { width: 44px; height: 44px; font-size: 30px; line-height: 1; border-radius: var(--coin); color: var(--encre-2); }
.f-corps { padding: 4px 16px 16px; overflow-y: auto; }
.f-corps label { display: block; font-weight: 600; margin-bottom: 6px; }
.f-corps input[type='text'], .f-corps textarea, .lp-edition { width: 100%; min-height: 52px; padding: 10px 12px; font-size: 17px; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); background: var(--creux); }
.f-corps textarea { resize: none; font-size: 14.5px; word-break: break-all; }
.f-note { margin-top: 10px; font-size: 14.5px; color: var(--encre-2); }
.f-pied { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px 16px; }
.b-principal, .b-secondaire, .b-danger { min-height: 50px; padding: 0 20px; font-weight: 700; font-size: 16.5px; border-radius: var(--coin); border: 1.5px solid var(--encre); }
.b-principal { background: var(--craie); border-color: var(--craie); color: var(--craie-encre); }
.b-danger { background: var(--minium); border-color: var(--minium); color: #fff; }
[data-theme='sombre'] .b-danger { color: #1c0700; }
.menu-liste { display: grid; gap: 8px; }
.menu-liste button { min-height: 56px; padding: 0 16px; text-align: left; font-weight: 600; font-size: 17px; border: 1.5px solid var(--filet-fort); border-radius: var(--coin); background: var(--creux); }
.liste-pieces { display: grid; gap: 10px; }
.liste-pieces li { border: 1.5px solid var(--filet); border-radius: var(--coin); background: var(--creux); }
.lp-ouvrir { display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; width: 100%; padding: 10px 12px 8px; text-align: left; align-items: center; }
.lp-ouvrir svg { grid-row: 1 / 3; width: 44px; height: 44px; color: var(--bleu); }
.lp-nom { font-weight: 700; font-size: 17.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-info { font-size: 14px; color: var(--encre-2); }
.lp-edition { margin: 10px 12px 8px; width: calc(100% - 24px); }
.lp-actions { display: flex; border-top: 1px solid var(--filet); }
.lp-actions button { flex: 1; min-height: 44px; font-weight: 600; font-size: 14.5px; color: var(--encre-2); }
.lp-actions button + button { border-left: 1px solid var(--filet); }
.lp-actions .danger { color: var(--minium); }
.lexique dt { font-family: var(--titre); font-weight: 700; font-size: 20px; margin-top: 14px; }
.lexique dt:first-child { margin-top: 0; }
.lexique dd { color: var(--encre-2); max-width: 64ch; }

.toast { position: fixed; left: 50%; bottom: calc(22px + var(--h-onglets)); z-index: 90; transform: translate(-50%, 30px); max-width: min(560px, calc(100vw - 24px)); padding: 13px 18px; background: var(--encre); color: var(--panneau); font-weight: 500; border-left: 5px solid var(--craie); border-radius: var(--coin); box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { border-left-color: var(--minium); }


/* ---------- survol : uniquement avec une souris (au doigt, le survol resterait collé) ---------- */
@media (hover: hover) and (pointer: fine) {
  .b-barre:hover { background: #1b3152; border-color: #33496a; }
  .b-barre[data-action='enregistrer']:hover { background: #ffc81f; border-color: transparent; }
  .tuile:hover:not(:disabled):not([aria-checked='true']) { border-color: var(--encre); color: var(--encre); }
  .b-aide:hover { background: var(--encre); color: var(--panneau); border-color: var(--encre); }
  .pas:hover { background: var(--encre); color: var(--panneau); }
  .outils button:hover, .b-carre:hover { background: var(--encre); color: var(--panneau); border-color: var(--encre); }
  .b-former:hover { background: #ffc81f; }
  .b-export:hover:not(:disabled) { background: var(--encre); color: var(--panneau); }
  .b-export:hover:not(:disabled) span { color: inherit; }
  .b-export.principal:hover:not(:disabled) { background: #ffc81f; color: var(--craie-encre); }
  .b-export.principal:hover:not(:disabled) span { color: #4d3f00; }
  .b-petit:hover { background: var(--encre); color: var(--panneau); border-color: var(--encre); }
  .f-fermer:hover { background: var(--encre); color: var(--panneau); }
  .b-principal:hover { background: #ffc81f; }
  .b-secondaire:hover { background: var(--encre); color: var(--panneau); }
  .lp-ouvrir:hover .lp-nom { text-decoration: underline; }
  .lp-actions button:hover { background: var(--encre); color: var(--panneau); }
}

/* ---------- écrans moyens ---------- */
@media (max-width: 1320px) {
  main { grid-template-columns: 372px minmax(0, 1fr); }
  .bilan { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bilan > div:nth-child(4) { border-left: 0; }
  .bilan > div:nth-child(n + 4) { border-top: 1px solid var(--filet); }
  .exports { grid-template-columns: 1fr 1fr; }
  .deux { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- tablette et téléphone : une section à la fois, onglets en bas ---------- */
@media (max-width: 1099px) {
  :root { --h-onglets: 68px; --h-barre: 56px; }
  main { display: block; height: auto; padding-bottom: calc(var(--h-onglets) + env(safe-area-inset-bottom)); }
  .colonne { border-right: 0; overflow: visible; padding: 14px 16px 28px; max-width: 760px; margin: 0 auto; }
  #z-resultats { overflow: visible; padding: 12px 12px 24px; }
  .actions { display: none; }
  .b-menu { display: grid; }
  .proto { margin-left: 4px; }
  .onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--h-onglets) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--barre); border-top: 3px solid var(--craie); }
  .onglets button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #a9b9cc; font-weight: 600; font-size: 14px; }
  .onglets svg { width: 26px; height: 26px; }
  .onglets button[aria-current='true'] { color: var(--craie-encre); background: var(--craie); }
  .onglets button:focus-visible { outline-offset: -4px; outline-color: #fff; }
  body:not([data-onglet='cotes']) #z-cotes { display: none; }
  body[data-onglet='cotes'] #z-resultats > :not(.alerte) { display: none; }
  body[data-onglet='plan'] #z-3d, body[data-onglet='plan'] #z-tableau { display: none; }
  body[data-onglet='3d'] #z-plan, body[data-onglet='3d'] #z-bilan, body[data-onglet='3d'] #z-tableau { display: none; }
  body[data-onglet='tableau'] .vues, body[data-onglet='tableau'] #z-bilan { display: none; }
  body[data-onglet='cotes'] #z-resultats { padding: 0 16px; max-width: 760px; margin: 0 auto; }
  body[data-onglet='cotes'] .alerte { position: sticky; bottom: calc(var(--h-onglets) + 8px); margin: 0 0 10px; z-index: 5; box-shadow: var(--ombre); }
  body[data-onglet='cotes'] main { display: flex; flex-direction: column; }
  .vues { display: block; height: auto; min-height: 0; }
  .cadre { height: calc(100dvh - var(--h-barre) - var(--h-onglets) - 24px - env(safe-area-inset-bottom)); min-height: 340px; }
  body[data-onglet='plan'] .cadre { height: min(62dvh, calc(100dvh - var(--h-barre) - var(--h-onglets) - 150px)); }
  #z-tableau { margin-top: 0; }
  .selecteur { grid-template-columns: repeat(5, 1fr); }
  .toast { bottom: calc(14px + var(--h-onglets) + env(safe-area-inset-bottom)); }
  body.plan-plein .onglets, body.plan-plein .barre { display: none; }
  #z-plan.plein { height: 100dvh; }
}
@media (max-width: 620px) {
  .sous { display: none; }
  .proto { font-size: 11px; padding: 2px 6px; white-space: normal; line-height: 1.15; max-width: 92px; text-align: center; }
  .nom { font-size: 24px; }
  .barre { padding: 0 10px 0 12px; gap: 10px; }
  .selecteur { grid-template-columns: repeat(4, 1fr); }
  .entete-piece h1 { font-size: 27px; }
  .schema-cadre { height: 210px; }
  .schema-cadre.deux-vues { height: 330px; }
  .bilan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bilan > div { border-left: 0; border-top: 1px solid var(--filet); }
  .bilan > div:nth-child(-n + 2) { border-top: 0; }
  .bilan > div:nth-child(even) { border-left: 1px solid var(--filet); }
  .bilan dd { font-size: 22px; }
  .exports { gap: 8px; }
  .b-export { padding: 8px 10px; }
  .b-export span { font-size: 12.5px; }
  .groupe-pdf { grid-template-columns: minmax(0, 1fr) 64px; }
  .curseur span { display: none; }
  table { font-size: 14.5px; }
  thead th, tbody th, tbody td { padding: 6px 8px; }
  .f-pied { flex-wrap: wrap; }
  .f-pied button { flex: 1; }
  .legende { font-size: 12px; gap: 2px 10px; right: 60px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .barre, .onglets, .colonne, .outils, .formage, .exports { display: none !important; } main { display: block; height: auto; } }

/* ---------- version d'essai : bandeau, fenêtre « réservé aux abonnés » ---------- */
:root { --h-essai: 0px; }
html[data-mode='essai'] { --h-essai: 38px; }
html[data-mode='complet'] [data-si='essai'], html[data-mode='essai'] [data-si='complet'] { display: none !important; }
.bande-essai { height: var(--h-essai); display: flex; align-items: center; gap: 14px; padding: 0 18px; background: #16304f; color: #dbe6f2; font-size: 14px; line-height: 1.15; }
.bande-essai a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; font-weight: 600; white-space: nowrap; border-radius: var(--coin); }
.be-retour { color: #dbe6f2; padding: 0 8px 0 4px; }
.be-retour svg { width: 16px; height: 16px; }
.be-titre { color: #a9b9cc; padding-left: 14px; border-left: 1px solid #33496a; }
.be-titre b { color: #fff; font-weight: 700; }
.be-obtenir { margin-left: auto; padding: 0 12px; background: var(--craie); color: var(--craie-encre); font-weight: 700; }
html[data-cadre] .be-retour { display: none; }
html[data-cadre] .be-titre { border-left: 0; padding-left: 0; }
html[data-mode='essai'] main { height: calc(100dvh - var(--h-barre) - var(--h-essai)); }
.liste-abo { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.liste-abo li { position: relative; padding-left: 20px; font-size: 15.5px; line-height: 1.4; }
.liste-abo li::before { content: ''; position: absolute; left: 0; top: .5em; width: 9px; height: 9px; background: var(--craie); }
.liste-abo b { font-weight: 700; }
#d-reserve .f-tete h2 { line-height: 1.12; }
#d-reserve .f-pied { flex-wrap: wrap; }
#d-reserve .f-pied > * { flex: 1 1 auto; }
a.b-principal { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.menu-obtenir { display: flex; align-items: center; justify-content: center; min-height: 52px; margin-bottom: 8px; padding: 0 16px; background: var(--craie); color: var(--craie-encre); font-weight: 700; font-size: 17px; border-radius: var(--coin); text-decoration: none; }
@media (hover: hover) {
  .be-retour:hover { background: #20426b; }
  .be-obtenir:hover, a.b-principal:hover, .menu-obtenir:hover { background: #ffc81f; }
}
@media (max-width: 1099px) {
  html[data-mode='essai'] main { height: auto; }
  html[data-mode='essai'] .cadre { height: calc(100dvh - var(--h-barre) - var(--h-essai) - var(--h-onglets) - 24px - env(safe-area-inset-bottom)); }
  html[data-mode='essai'] body[data-onglet='plan'] .cadre { height: min(62dvh, calc(100dvh - var(--h-barre) - var(--h-essai) - var(--h-onglets) - 150px)); }
}
@media (max-width: 620px) {
  html[data-mode='essai'] { --h-essai: 44px; }
  .bande-essai { padding: 0 10px; gap: 8px; font-size: 12.5px; }
  .be-retour span { display: none; }
  .be-retour { padding: 0 6px; }
  .be-titre { padding-left: 8px; }
  .be-obtenir { padding: 0 10px; font-size: 13px; height: 30px; }
}
@media print { .bande-essai { display: none !important; } }
