@font-face { font-family: 'Raleway'; font-weight: 400; font-display: swap; src: url('../fonts/raleway-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Raleway'; font-weight: 500; font-display: swap; src: url('../fonts/raleway-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Raleway'; font-weight: 600; font-display: swap; src: url('../fonts/raleway-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Raleway'; font-weight: 700; font-display: swap; src: url('../fonts/raleway-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-weight: 400; font-display: swap; src: url('../fonts/crimson-text-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-weight: 600; font-display: swap; src: url('../fonts/crimson-text-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-weight: 700; font-display: swap; src: url('../fonts/crimson-text-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Abril Fatface'; font-weight: 400; font-display: swap; src: url('../fonts/abril-fatface-latin-400-normal.woff2') format('woff2'); }

:root {
  --ink: #2c2c2c;
  --aubergine: #34293a;
  --aubergine-2: #4a3d52;
  --beige: #f4f2ed;
  --beige-2: #e9e5dc;
  --line: #cfc8be;
  --muted: #6b6470;
  --wine: #8e1b3a;
  --red: #b5232f;
  --ok: #4e6b3a;
  --warn: #a8641c;
  --white: #fff;
  --serif-display: 'Abril Fatface', Georgia, serif;
  --serif: 'Crimson Text', Georgia, serif;
  --sans: 'Raleway', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--white); color: var(--ink); font: 400 16px/1.6 var(--sans); }
/* Pas de mot isolé sur la dernière ligne d'un paragraphe ; titres équilibrés sur leurs lignes */
p, li, dd, td, th, label, summary, figcaption, blockquote, .hint, .msg, .todo { text-wrap: pretty; }
h1, h2, h3, h4, .subhead, .sl-title, .kicker { text-wrap: balance; }
img { max-width: 100%; display: block; }
a { color: var(--aubergine); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- En-tête ---------- */
.site-header { border-bottom: 1px solid var(--beige-2); background: var(--white); position: sticky; top: 0; z-index: 20; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 10px; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--aubergine); line-height: 1; }
.brand-name { font-family: var(--serif); font-size: 34px; font-weight: 400; letter-spacing: -0.5px; }
.brand-sub { font-size: 10px; letter-spacing: 0.42em; text-transform: uppercase; margin-top: 6px; color: var(--aubergine); }
.local-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.local-badge svg { width: 16px; height: 16px; color: var(--ok); flex: none; }
.mainnav { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0 14px; overflow-x: auto; scrollbar-width: none; }
.mainnav a { text-decoration: none; text-transform: uppercase; font-weight: 600; font-size: 13.5px; letter-spacing: 0.02em; color: var(--ink); padding: 6px 2px; white-space: nowrap; border-bottom: 2px solid transparent; transition: border-color .2s, color .2s; }
.mainnav a:hover { color: var(--aubergine); border-color: var(--beige-2); }
.mainnav a[aria-current='page'] { color: var(--aubergine); border-color: var(--aubergine); }

/* ---------- Fil d'Ariane / volet ---------- */
.crumbs { font-size: 13px; color: var(--muted); padding: 22px 0 10px; }
.crumbs span + span::before { content: '»'; margin: 0 6px; }
.panel-toggle { background: var(--beige); margin: 0 0 8px; }
.panel-toggle summary { list-style: none; cursor: pointer; text-align: center; font-weight: 600; padding: 14px 16px; }
.panel-toggle summary::-webkit-details-marker { display: none; }
.panel-toggle summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform .2s; }
.panel-toggle[open] summary::before { transform: rotate(90deg); }
.panel-toggle .panel-body { padding: 4px 32px 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; font-size: 15px; }
.panel-body h3 { font-family: var(--serif); font-size: 18px; text-transform: uppercase; color: var(--aubergine); margin: 0 0 6px; letter-spacing: -0.2px; }
.panel-body p { margin: 0; }

/* ---------- Titres ---------- */
.page-title { text-align: center; padding: 34px 0 8px; }
.page-title h1 { font-family: var(--serif-display); font-weight: 400; font-size: clamp(28px, 4vw, 36px); line-height: 1.3; letter-spacing: -0.02em; margin: 0 auto 14px; max-width: 780px; color: var(--ink); text-wrap: balance; }
.page-title p { margin: 0 auto; max-width: 720px; color: var(--ink); text-wrap: pretty; }
h2.section { font-family: var(--serif); font-weight: 700; font-size: 22px; text-transform: uppercase; color: var(--aubergine); letter-spacing: -0.02em; margin: 0 0 14px; }
.rule { width: 40px; height: 2px; background: var(--aubergine); margin: 10px auto; border: 0; }

/* ---------- Carte « annonce » (image + cadre) ---------- */
.listing { display: grid; grid-template-columns: 1.15fr 1fr; background: var(--beige); margin: 30px 0; min-height: 420px; }
.listing-visual { position: relative; background: var(--aubergine) url('../img/vignes.svg') center/cover no-repeat; color: var(--white); }
.listing-body { padding: 30px; display: flex; }
.frame { position: relative; border: 1px solid var(--aubergine-2); padding: 46px 28px 30px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.frame-ref { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); background: var(--beige); border: 1px solid var(--aubergine-2); padding: 5px 16px; font-size: 14px; white-space: nowrap; }
.frame .kicker { text-transform: uppercase; font-size: 14px; line-height: 1.3; padding: 10px 0; position: relative; }
.frame .kicker::before, .frame .kicker::after { content: ''; display: block; width: 40px; height: 2px; background: var(--aubergine); margin: 0 auto 8px; }
.frame .kicker::after { margin: 8px auto 0; }
.frame .kicker b { display: block; font-weight: 700; }
.frame h3 { font-family: var(--serif); font-weight: 700; text-transform: uppercase; font-size: 24px; line-height: 1.2; color: var(--aubergine); margin: 18px 0 12px; letter-spacing: -0.01em; text-wrap: balance; }
.frame p { margin: 0 0 18px; max-width: 360px; text-wrap: pretty; }
.frame .figure { font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--aubergine); line-height: 1.1; }
.frame .figure small { display: block; font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--ink); margin-top: 2px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--aubergine); color: var(--white); border: 1px solid var(--aubergine); text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 0.02em; padding: 14px 34px; cursor: pointer; text-decoration: none; transition: background .2s, color .2s, transform .1s; }
.btn:hover { background: var(--aubergine-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--aubergine); }
.btn.ghost:hover { background: var(--white); }
.btn.small { padding: 9px 18px; font-size: 12px; }
.btn svg { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }

/* ---------- Zone de dépôt ---------- */
.drop { position: absolute; inset: 22px; border: 1px dashed rgba(255,255,255,.65); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; cursor: pointer; transition: background .2s, border-color .2s; background: rgba(52,41,58,.35); }
.drop:hover, .drop.over { background: rgba(52,41,58,.6); border-color: var(--white); border-style: solid; }
.drop svg { width: 46px; height: 46px; opacity: .9; }
.drop strong { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.drop span { font-size: 14px; opacity: .9; max-width: 340px; }

/* ---------- Blocs d'étapes ---------- */
.step { border: 1px solid var(--line); padding: 44px 32px 32px; position: relative; margin: 46px 0; background: var(--white); }
.step > .frame-ref { background: var(--white); border-color: var(--line); }
.step-head { text-align: center; margin-bottom: 26px; }
.step-head p { margin: 0 auto; max-width: 680px; color: var(--muted); }

.files { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 26px; padding: 0; list-style: none; }
.files li { display: inline-flex; align-items: center; gap: 10px; background: var(--beige); border: 1px solid var(--beige-2); padding: 7px 8px 7px 14px; font-size: 14px; }
.files li b { font-family: var(--serif); font-size: 17px; color: var(--aubergine); }
.files li.bad { background: #fbeaea; border-color: #e7c4c4; }
.files li button { border: 0; background: none; cursor: pointer; width: 26px; height: 26px; color: var(--muted); font-size: 18px; line-height: 1; }
.files li button:hover { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--white); padding: 10px 12px; font-size: 15px; color: var(--ink); border-radius: 0; width: 100%; }
.field textarea { min-height: 84px; resize: vertical; }
/* Création d'une NFSM vierge */
.nfsm-new { margin-top: 34px; border: 1px dashed var(--line); padding: 18px 22px; background: var(--white); }
.nfsm-new > summary { cursor: pointer; margin: 0; }
.nfsm-new[open] > summary { margin-bottom: 8px; }
.nfsm-new .hint { max-width: 760px; }
.nfsm-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0 6px; }
.nfsm-fields input[type="color"] { padding: 2px; height: 42px; cursor: pointer; }
.field.checks { border: 0; padding: 0; margin: 0; flex-direction: row; flex-wrap: wrap; gap: 8px 22px; }
.field.checks legend { width: 100%; padding: 0; margin-bottom: 6px; }
.field.checks label, .check-report span { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 14px; }
.field.checks input, .check-report input { width: auto; accent-color: var(--aubergine); }
.check-report { color: var(--ink); }
@media (max-width: 700px) { .nfsm-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .nfsm-fields { grid-template-columns: 1fr; } }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--aubergine); box-shadow: 0 0 0 3px rgba(52,41,58,.12); }
.subhead { font-family: var(--serif); font-weight: 700; font-size: 18px; text-transform: uppercase; color: var(--aubergine); margin: 0 0 12px; letter-spacing: -0.01em; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* Alertes */
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { display: grid; grid-template-columns: 92px 44px 1fr; gap: 10px; align-items: baseline; padding: 12px 14px; background: var(--beige); border-left: 3px solid var(--line); font-size: 14.5px; }
.alerts .body { min-width: 0; }
.alerts .msg { margin: 0; }
.alerts .todo { margin: 6px 0 0; font-size: 14px; color: #4b4450; }
.alerts .todo b { color: var(--aubergine); font-weight: 700; }
.alerts .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.abtn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--aubergine); background: var(--white); color: var(--aubergine); font-size: 12.5px; font-weight: 600; padding: 7px 12px; cursor: pointer; transition: background .15s, color .15s; }
.abtn:hover { background: var(--aubergine); color: var(--white); }
.abtn.solid { background: var(--aubergine); color: var(--white); }
.abtn.solid:hover { background: var(--aubergine-2); }
.abtn.danger { border-color: var(--red); color: var(--red); }
.abtn.danger:hover { background: var(--red); color: var(--white); }
.abtn svg { width: 14px; height: 14px; }
.fix { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.fix input, .fix select { border: 1px solid var(--line); background: var(--white); padding: 7px 9px; font-size: 14px; }
.fix input { min-width: 220px; }
.alerts-more { margin-top: 10px; }
.alerts-more summary { cursor: pointer; font-size: 14px; color: var(--aubergine); font-weight: 600; padding: 6px 0; }
.alerts-more .alerts { margin-top: 8px; }

/* Liste des déclarations */
.doclist { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.doclist li { display: flex; align-items: center; gap: 10px; background: var(--beige); padding: 6px 8px 6px 12px; font-size: 14px; }
.doclist li.bad { background: #fbeaea; }
.doclist b { font-family: var(--serif); font-size: 17px; color: var(--aubergine); min-width: 42px; }
.doclist .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doclist button.x { border: 0; background: none; cursor: pointer; width: 28px; height: 28px; color: var(--muted); font-size: 18px; }
.doclist button.x:hover { color: var(--red); }

/* Visionneuse PDF */
.viewer { width: min(1400px, 97vw); height: 92vh; max-height: 92vh; padding: 0; border: 0; background: var(--white); box-shadow: 0 20px 60px rgba(30, 20, 35, .35); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(40, 30, 45, .55); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; background: var(--aubergine); color: var(--white); flex: none; flex-wrap: wrap; }
.viewer-titles { display: flex; flex-direction: column; min-width: 0; }
.viewer-titles strong { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.viewer-titles span { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-tools { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.viewer-tools .sep { width: 1px; height: 22px; background: rgba(255,255,255,.3); margin: 0 4px; }
.vbtn { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.5); background: transparent; color: var(--white); font-size: 20px; line-height: 1; cursor: pointer; }
.vbtn:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.vbtn:disabled { opacity: .35; cursor: default; }
.viewer-tools .btn { border-color: var(--white); background: var(--white); color: var(--aubergine); margin-left: 6px; }
.viewer-main { flex: 1; display: flex; min-height: 0; }
.viewer-side { width: 420px; flex: none; overflow: auto; background: var(--beige); padding: 20px 20px 28px; border-left: 1px solid var(--line); }
.viewer-side .subhead { margin-bottom: 4px; }
.viewer-side .hint { margin: 0 0 14px; }
.manual-year { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 14px; }
.manual-year input { width: 90px; border: 1px solid var(--line); padding: 8px 10px; font-size: 16px; font-family: var(--serif); font-weight: 700; color: var(--aubergine); }
table.manual { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--white); }
table.manual th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--white); background: var(--aubergine); padding: 6px 7px; }
table.manual td { padding: 5px 6px; border-bottom: 1px solid var(--beige-2); vertical-align: middle; }
table.manual td.prod { font-weight: 600; color: var(--aubergine); line-height: 1.25; }
table.manual td.prod small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
table.manual input[type=text] { width: 100%; border: 1px solid var(--line); padding: 6px 7px; font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
table.manual input.lib { text-align: left; margin-bottom: 4px; }
table.manual select { width: 100%; border: 1px solid var(--line); padding: 4px; font-size: 12px; }
table.manual input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--aubergine); }
table.manual input.bad { border-color: var(--red); background: #fbefef; }
.manual-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.manual-msg { color: var(--red); font-size: 13.5px; margin: 10px 0 0; min-height: 1em; }
.alerts .ask { margin: 10px 0 0; font-weight: 600; color: var(--aubergine); }
.doclist .tagm.src { background: var(--aubergine-2); }
.doclist .tagm { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--white); background: var(--warn); padding: 2px 6px; }
.viewer-body { flex: 1; overflow: auto; background: #d9d4cc; padding: 12px; display: flex; justify-content: center; align-items: flex-start; }
.viewer-stage { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); flex: none; }
.viewer-stage canvas { display: block; }
.viewer-mark { position: absolute; border: 2px solid var(--red); background: rgba(255, 214, 102, .35); border-radius: 2px; pointer-events: none; animation: markpulse 1.6s ease-out 2; }
@keyframes markpulse { 0% { box-shadow: 0 0 0 0 rgba(181,35,47,.55); } 100% { box-shadow: 0 0 0 12px rgba(181,35,47,0); } }
.viewer-error { color: var(--red); padding: 30px; }
.alerts li.alerte { border-color: var(--red); background: #fbefef; }
.alerts li.attention { border-color: var(--warn); background: #fbf3e8; }
.alerts li.info { border-color: var(--aubergine-2); }
.alerts .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; white-space: nowrap; }
.alerts li.alerte .tag { color: var(--red); }
.alerts li.attention .tag { color: var(--warn); }
.alerts .yr { font-family: var(--serif); font-weight: 700; color: var(--aubergine); }
.summary-line { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.summary-line span b { font-family: var(--serif); font-size: 19px; color: var(--aubergine); margin-right: 4px; }

/* Comparaison avec l'ancien tableau */
.compare, .nfsm { margin-top: 34px; border: 1px dashed var(--line); padding: 20px 22px; background: var(--white); transition: background .2s, border-color .2s; }
.compare.over, .nfsm.over { background: var(--beige); border-color: var(--aubergine); }
.compare-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.compare-head .subhead { margin-bottom: 2px; }
.compare-head .hint { margin: 0; max-width: 640px; }
.compare-head .btn { flex: none; cursor: pointer; }
.subhead .opt { font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); padding: 2px 7px; margin-left: 8px; vertical-align: middle; }
#compare-result, #nfsm-result { margin-top: 18px; }
.compare-meta { font-size: 14px; color: var(--muted); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.compare-meta b { font-family: var(--serif); font-size: 19px; color: var(--aubergine); }
table.diffs td { white-space: normal; vertical-align: top; }
table.diffs td.num { white-space: nowrap; }
table.diffs .old { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
table.diffs .new { color: var(--ok); font-weight: 700; }
table.diffs .cause { color: var(--muted); font-style: italic; }
.compare-ok { background: #eef3e8; border-left: 3px solid var(--ok); padding: 10px 14px; font-size: 14px; }
.compare-notes { font-size: 14px; margin: 12px 0 0; padding-left: 18px; color: var(--muted); }

/* Tableaux */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); margin-top: 8px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--beige-2); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child, table.data td.l, table.data th.l { text-align: left; }
table.data thead th { background: var(--aubergine); color: var(--white); font-weight: 600; font-size: 12px; }
table.data thead tr:first-child th { font-family: var(--serif); font-size: 16px; font-weight: 700; border-left: 1px solid var(--aubergine-2); }
table.data thead th.moy { background: var(--beige-2); color: var(--aubergine); }
table.data td.moy { background: var(--beige); }
table.data tbody td:first-child { font-weight: 600; color: var(--aubergine); }
table.data tr.total td { background: var(--beige-2); font-weight: 700; color: var(--aubergine); border-top: 2px solid var(--aubergine); }
table.data tr.sub td { color: var(--muted); font-style: italic; }
table.data td.nr { background: #fbe9d7; }
table.data td.empty { color: var(--line); }
table.params td { text-align: left; }
table.params input, table.params select { border: 1px solid var(--line); padding: 6px 8px; font-size: 14px; background: var(--white); width: 100%; min-width: 150px; }
table.params tr.unknown td { background: #fbf3e8; }
table.params code { font-size: 13px; }

/* Téléchargements */
.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.dl { background: var(--beige); padding: 26px; display: flex; }
.dl .frame { padding-top: 40px; }
.dl .frame-ref { background: var(--beige); }
.dl ul { text-align: left; margin: 0 0 22px; padding-left: 18px; font-size: 14px; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; list-style: none; padding: 0; margin: 0 0 24px; }
.photo-grid li { background: var(--beige); padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.photo-grid img { aspect-ratio: 4/3; object-fit: cover; width: 100%; background: var(--beige-2); }
.photo-grid .status { display: flex; align-items: center; gap: 6px; }
.photo-grid .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.photo-grid .dot.warn { background: var(--warn); }
.photo-grid .name { font-weight: 600; color: var(--aubergine); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--aubergine); }

/* Chiffres clés & tableaux de synthèse */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi { background: var(--beige); padding: 16px 14px; text-align: center; }
.kpi b { display: block; font-family: var(--serif); font-size: 26px; color: var(--aubergine); line-height: 1.1; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 26px; }
.grid-3 h3 { margin-bottom: 8px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.bars .bar { grid-column: 1 / -1; height: 6px; background: var(--beige-2); position: relative; }
.bars .bar i { position: absolute; inset: 0 auto 0 0; background: var(--aubergine); }
.bars b { font-variant-numeric: tabular-nums; color: var(--aubergine); }

/* Filigrane */
.wm-bar { display: grid; grid-template-columns: 200px 1fr auto; gap: 24px; align-items: center; background: var(--beige); padding: 20px 22px; margin: 0 0 22px; }
.wm-logo { background: var(--aubergine-2) url('../img/vignes.svg') center/cover; padding: 18px; display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; }
.wm-logo img { width: 100%; filter: drop-shadow(0 0 3px rgba(0,0,0,.6)); opacity: .9; }
.wm-text .subhead { margin-bottom: 2px; }
.wm-text .hint { margin: 0 0 6px; }
.wm-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.photo-grid .badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--white); background: var(--aubergine); padding: 2px 7px; margin-left: 6px; }

/* Documents */
.doc-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 30px 0; }
.doc-cards .dl .frame p { max-width: 400px; }
.doc-editor { display: grid; grid-template-columns: 380px 1fr; gap: 30px; align-items: start; margin: 10px 0 50px; }
.doc-form { background: var(--beige); padding: 22px; position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow: auto; }
.doc-form .fields { grid-template-columns: 1fr; }
.doc-form h3 { margin-top: 18px; }
.doc-form h3:first-child { margin-top: 0; }
.paper { background: var(--white); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(52,41,58,.08); padding: 56px 60px; font-family: var(--serif); font-size: 16.5px; line-height: 1.55; color: #1f1a22; }
.paper h1 { font-family: var(--serif); font-weight: 700; text-transform: uppercase; text-align: center; font-size: 21px; letter-spacing: .01em; margin: 0 0 4px; color: var(--aubergine); }
.paper .sub { text-align: center; font-size: 14px; color: var(--muted); margin: 0 0 26px; }
.paper h2 { font-size: 16.5px; font-weight: 700; margin: 20px 0 4px; }
.paper p { margin: 0 0 9px; text-align: justify; hyphens: auto; }
.paper .party { background: #faf9f6; border-left: 2px solid var(--aubergine); padding: 10px 14px; margin: 10px 0; }
.paper .fill { background: #fff4d6; padding: 0 3px; border-bottom: 1px dotted var(--warn); }
.paper .fill.ok { background: none; border: 0; padding: 0; }
.paper .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 34px; }
.paper .sign div { border-top: 1px solid var(--ink); padding-top: 8px; font-size: 14.5px; min-height: 110px; }
.paper .sign.three { grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.paper .sign.one { grid-template-columns: minmax(0, 300px); justify-content: end; margin-top: 18px; }
.paper ul { margin: 0 0 9px; padding-left: 22px; }
.paper li { margin-bottom: 4px; text-align: justify; }
.paper .small { font-size: 13px; line-height: 1.45; }
.legal-note { background: #fbf3e8; border-left: 3px solid var(--warn); padding: 12px 16px; font-size: 14px; margin: 0 0 18px; }

/* Confidentialité */
.prose { max-width: 820px; margin: 0 auto 60px; }
.prose h2 { font-family: var(--serif); font-weight: 700; text-transform: uppercase; color: var(--aubergine); font-size: 22px; margin: 42px 0 10px; letter-spacing: -0.02em; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.callout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 26px 0; }
.callout div { background: var(--beige); padding: 20px; }
.callout b { display: block; font-family: var(--serif); text-transform: uppercase; color: var(--aubergine); font-size: 17px; margin-bottom: 4px; }

/* Pied de page */
.site-footer { background: var(--beige); margin-top: 60px; padding: 34px 0; font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer b { color: var(--aubergine); font-family: var(--serif); font-size: 18px; font-weight: 600; }

/* Etat vide / chargement */
.busy { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.busy::before { content: ''; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--aubergine); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--aubergine); color: var(--white); padding: 12px 22px; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media (max-width: 900px) {
  .listing, .grid-2, .downloads, .doc-cards, .doc-editor, .callout { grid-template-columns: 1fr; }
  .listing-visual { min-height: 300px; }
  .panel-toggle .panel-body { grid-template-columns: 1fr; padding: 4px 20px 22px; }
  .doc-form { position: static; max-height: none; }
  .paper { padding: 32px 22px; }
  .step { padding: 40px 18px 24px; }
  .mainnav { justify-content: flex-start; gap: 22px; }
  .compare-head { flex-direction: column; }
  .alerts li { grid-template-columns: 1fr; gap: 4px; }
  .wm-bar { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .viewer-main { flex-direction: column; }
  .pr-block > summary { flex-wrap: wrap; font-size: 16px; padding: 14px 14px; gap: 8px 12px; }
  .pr-block > summary em { margin-left: 0; }
  .pr-block > summary::after { display: none; }
  .pr-body { padding: 4px 14px 18px; }
  .viewer-side { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 50%; }
  .wm-logo { max-width: 260px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .fields { grid-template-columns: 1fr; }
  .local-badge span { display: none; }
  .brand-name { font-size: 28px; }
  .listing-body, .dl { padding: 18px; }
  .frame { padding: 40px 16px 24px; }
  .paper .sign, .paper .sign.three { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 16mm 16mm 18mm; }
  body { background: #fff; }
  body:not(.print-deck) .site-header, body:not(.print-deck) .site-footer, body:not(.print-deck) .crumbs, body:not(.print-deck) .page-title, .doc-cards, .doc-form, .legal-note, .no-print, body:not(.print-deck) main > section:not(.active) { display: none !important; }
  body.print-deck .site-header, body.print-deck .site-footer, body.print-deck .toast, body.print-deck .viewer { display: none !important; }
  .doc-editor { display: block; margin: 0; }
  .paper { border: 0; box-shadow: none; padding: 0; font-size: 12pt; }
  .paper .fill { background: none; border-bottom: 1px dotted #999; }
  .wrap { padding: 0; max-width: none; }
}

/* ===================== Dossier de présentation : saisie ===================== */
.checklist { list-style: none; padding: 0; margin: 8px 0 22px; display: grid; gap: 7px; text-align: left; font-size: 14.5px; width: 100%; max-width: 320px; }
.checklist li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.checklist li span { width: 22px; height: 22px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; background: var(--white); }
.checklist li.ok { color: var(--ink); font-weight: 600; }
.checklist li.ok span { background: var(--aubergine); color: var(--white); border-color: var(--aubergine); }
.src { font-size: 14px; margin: 6px 0; }
.src .ok, .src .ko { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; font-size: 12px; margin-right: 6px; color: var(--white); background: var(--ok); }
.src .ko { background: var(--warn); }
#pr-docs { margin-top: 10px; }
#pr-docs li { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
#pr-docs b { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.pr-form { margin: 26px 0; display: flex; flex-direction: column; gap: 12px; }
.pr-block { border: 1px solid var(--line); background: var(--white); }
.pr-block > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 14px; font-family: var(--serif); font-weight: 700; font-size: 19px; text-transform: uppercase; color: var(--aubergine); letter-spacing: -0.01em; }
.pr-block > summary::-webkit-details-marker { display: none; }
.pr-block > summary b { font-family: var(--sans); font-size: 12px; border: 1px solid var(--aubergine-2); padding: 3px 8px; letter-spacing: .05em; }
.pr-block > summary em { font-family: var(--sans); font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--white); background: var(--wine); padding: 2px 7px; margin-left: auto; }
.pr-block > summary::after { content: '+'; font-family: var(--sans); font-weight: 400; font-size: 22px; margin-left: 12px; }
.pr-block > summary:has(em)::after { margin-left: 12px; }
.pr-block:not(:has(em)) > summary::after { margin-left: auto; }
.pr-block[open] > summary::after { content: '–'; }
.pr-body { padding: 4px 20px 22px; }
.pr-sub { font-family: var(--serif); font-size: 16px; text-transform: uppercase; color: var(--aubergine); margin: 18px 0 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 22px; }
table.edit td { padding: 3px 4px; }
table.edit input { width: 100%; min-width: 90px; border: 1px solid var(--beige-2); padding: 6px 8px; font-size: 14px; background: var(--white); }
table.edit input:focus { outline: none; border-color: var(--aubergine); }
table.edit input[type=checkbox] { width: 17px; height: 17px; min-width: 0; accent-color: var(--aubergine); }
table.edit .x, .pr-photos .x { border: 0; background: none; cursor: pointer; width: 28px; height: 28px; color: var(--muted); font-size: 18px; }
table.edit .x:hover, .pr-photos .x:hover { color: var(--red); }
.edit-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.edit-actions .hint { margin: 0 0 0 auto; }
.paste { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.paste textarea { min-height: 110px; border: 1px dashed var(--aubergine-2); padding: 10px; font: 13px/1.4 ui-monospace, Menlo, monospace; background: var(--beige); }
.paste .btn { align-self: flex-start; }
.years { display: flex; gap: 8px; margin: 0 0 8px; flex-wrap: wrap; }
.years input { width: 90px; border: 1px solid var(--line); padding: 6px 8px; font-family: var(--serif); font-weight: 700; color: var(--aubergine); }
.pr-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.pr-photos figure { margin: 0; background: var(--beige); padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.pr-photos figure.cover { outline: 2px solid var(--aubergine); }
.pr-photos img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.pr-photos figure div { display: flex; justify-content: space-between; align-items: center; }
.pr-actions { position: sticky; bottom: 0; z-index: 10; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 14px 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pr-actions .sep { flex: 1; }

/* ===================== Diapositives (aperçu + PDF) ===================== */
.deck { --s: 1; display: flex; flex-direction: column; align-items: center; gap: calc(24px); margin: 20px 0 60px; overflow: hidden; }
.deck .sl { transform: scale(var(--s)); transform-origin: top center; margin-bottom: calc(720px * (var(--s) - 1)); box-shadow: 0 6px 24px rgba(52,41,58,.15); }
.sl { width: 1280px; height: 720px; position: relative; background: #fff; color: #2c2c2c; font-family: var(--sans); overflow: hidden; flex: none; display: flex; flex-direction: column; padding: 34px 58px 0; page: deck; break-after: page; }
.sl-head { margin-bottom: 22px; }
.sl-kicker { display: block; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.sl-kicker.light { color: rgba(255,255,255,.85); }
.sl-title { font-family: var(--serif); font-weight: 700; font-size: 34px; text-transform: uppercase; color: var(--aubergine); margin: 4px 0 10px; letter-spacing: -0.01em; line-height: 1.1; }
.sl-rule { display: block; width: 48px; height: 3px; background: var(--aubergine); }
.sl-body { flex: 1; min-height: 0; }
.sl-foot { height: 52px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 18px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.sl-logo { height: 26px; width: auto; }
.sl-page { margin-left: auto; }
.sl-cols { display: grid; gap: 34px; height: 100%; }
.sl-cols.two { grid-template-columns: 1.45fr 1fr; }
.sl-cols.two.wide-left { grid-template-columns: 1.6fr 1fr; }
.sl-text { font-size: 17px; line-height: 1.55; overflow: hidden; }
.sl-text.small { font-size: 15px; }
.sl-text p { margin: 0 0 12px; text-align: justify; hyphens: auto; }
.sl-text ul { margin: 0 0 12px; padding-left: 20px; }
.sl-fig { margin: 0; height: 100%; }
.sl-fig img { width: 100%; height: 100%; object-fit: cover; }
.sl-frame { position: relative; background: var(--beige); border: 1px solid var(--aubergine-2); padding: 46px 26px 24px; margin-top: 16px; text-align: center; font-size: 16px; align-self: start; }
.sl-frame p { margin: 0 0 8px; }
.sl-frame-ref { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--aubergine-2); padding: 5px 16px; font-size: 14px; white-space: nowrap; color: var(--aubergine); }
.sl-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.sl-kpi { background: var(--beige); border: 1px solid var(--aubergine-2); padding: 18px 14px; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.sl-kpi b { font-family: var(--serif); font-size: 26px; color: var(--aubergine); line-height: 1.1; }
.sl-kpi.big { min-height: 150px; }
.sl-kpi.big b { font-size: 34px; }
.sl-kpi span { font-size: 14px; }
.sl-kpi.small { padding: 10px; }
.sl-kpi.small b { font-size: 19px; }
.sl-kpi.small span { font-size: 12.5px; }
.sl-lead { text-align: center; font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--aubergine); margin-top: 28px; }
.sl-side { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.sl-side h3 { font-family: var(--serif); text-transform: uppercase; color: var(--aubergine); font-size: 17px; margin: 0 0 4px; }
.sl-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.sl-table th { background: var(--aubergine); color: #fff; text-align: left; padding: 8px 10px; font-weight: 600; font-size: 13.5px; }
.sl-table td { padding: 7px 10px; border-bottom: 1px solid var(--beige-2); }
.sl-table tbody tr:nth-child(even) td { background: var(--beige); }
.sl-table .r { text-align: right; }
.sl-table tr.tot td { background: var(--beige-2) !important; font-weight: 700; color: var(--aubergine); border-top: 2px solid var(--aubergine); }
.sl-table tr.hl td { font-weight: 700; color: var(--aubergine); background: var(--beige-2) !important; }
.sl-table.prix td { font-size: 17px; padding: 12px 12px; }
.sl-table.prix small { display: block; color: var(--muted); font-size: 13px; }
.sl-table.prix .r { font-family: var(--serif); font-weight: 700; color: var(--aubergine); white-space: nowrap; }
.sl-note { font-size: 13px; font-style: italic; color: var(--muted); margin: 10px 0 0; }
.sl-hbars { display: flex; flex-direction: column; gap: 12px; }
.hb { display: grid; grid-template-columns: 230px 1fr 120px; align-items: center; gap: 14px; font-size: 15px; }
.hb-bar { height: 22px; background: var(--beige); position: relative; }
.hb-bar i { position: absolute; inset: 0 auto 0 0; background: var(--aubergine); }
.hb b { text-align: right; color: var(--aubergine); font-variant-numeric: tabular-nums; }
.hb em { grid-column: 2 / -1; font-size: 12px; color: var(--warn); margin-top: -8px; }
.sl-chart { width: 100%; height: 440px; }
.sl-chart .v { font-size: 15px; font-weight: 700; fill: var(--aubergine); font-family: var(--sans); }
.sl-chart .l { font-size: 15px; fill: var(--ink); font-family: var(--sans); }
.sl-toc { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(6, auto); gap: 6px 60px; }
.sl-toc li { display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 20px; }
.sl-toc b { font-family: var(--serif); font-size: 32px; color: var(--aubergine); width: 50px; }
.sl-steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.sl-steps li { border: 1px solid var(--aubergine-2); padding: 46px 14px 18px; text-align: center; position: relative; min-height: 330px; }
.sl-steps li:nth-child(odd) { background: var(--beige); }
.sl-steps b { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); width: 44px; height: 44px; background: var(--aubergine); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 22px; }
.sl-steps h4 { font-family: var(--serif); text-transform: uppercase; color: var(--aubergine); font-size: 17px; margin: 0 0 10px; }
.sl-steps p { font-size: 15px; margin: 0; line-height: 1.45; }
.sl-photos { display: grid; gap: 14px; height: 100%; grid-template-columns: 1fr 1fr; }
.sl-photos.n1 { grid-template-columns: 1fr; }
.sl-photos img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.sl-photos.n3 img:first-child, .sl-photos.n4 img { max-height: 260px; }
.sl-cover, .sl-end { background: var(--aubergine) center/cover no-repeat; color: #fff; justify-content: center; align-items: center; padding: 0; }
.sl-cover-veil { position: absolute; inset: 0; background: rgba(52,41,58,.55); }
.sl-cover-logo { position: absolute; top: 42px; left: 58px; width: 250px; }
.sl-cover-logo.center { position: static; margin-bottom: 26px; }
.sl-cover-frame { position: relative; border: 1px solid rgba(255,255,255,.9); background: rgba(52,41,58,.45); padding: 56px 70px 44px; text-align: center; max-width: 820px; }
.sl-cover-frame h1 { font-family: var(--serif-display); font-weight: 400; font-size: 64px; line-height: 1.1; margin: 14px 0 12px; }
.sl-cover-frame p { font-size: 20px; margin: 0; }
.sl-cover-frame.center p { font-size: 19px; margin: 4px 0; }
.sl-cover-ref { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); background: var(--aubergine); border: 1px solid rgba(255,255,255,.9); padding: 6px 18px; font-size: 15px; white-space: nowrap; }
.sl-cover-agent { position: absolute; right: 58px; bottom: 40px; text-align: right; font-size: 16px; line-height: 1.5; }
.sl-end h2 { font-family: var(--serif); text-transform: uppercase; font-size: 40px; margin: 0 0 50px; position: relative; }
.sl-end { flex-direction: column; }

@page deck { size: 13.333in 7.5in; margin: 0; }
@media print {
  body.print-deck > *:not(main), body.print-deck main > section:not(#tab-presentation), body.print-deck #tab-presentation > *:not(#pr-preview), body.print-deck #pr-preview > *:not(.deck) { display: none !important; }
  body.print-deck #tab-presentation, body.print-deck #pr-preview { display: block !important; padding: 0; max-width: none; }
  body.print-deck .deck { display: block; margin: 0; gap: 0; }
  body.print-deck .deck .sl { transform: none; margin: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 900px) { #pr-docs li { grid-template-columns: 1fr; gap: 2px; } }
