/* Cinqtreize — interface monochrome : encre sur blanc, gris pour la hiérarchie.
   Les couleurs de statut (vert, ambre, rouge) ne servent qu'à dire « OK / à vérifier / erreur ». */
:root {
  --bg: #ffffff; --fg: #0a0a0a; --muted: #6b6b6b; --line: #e5e5e5; --card: #ffffff; --soft: #f5f5f5;
  --accent: #0a0a0a; --accent-fg: #ffffff; --ok: #166534; --warn: #92400e; --err: #b91c1c; --info: #404040;
  --radius: 8px;
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg); background: var(--bg); color-scheme: light dark;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a0a0a; --fg: #fafafa; --muted: #a3a3a3; --line: #262626; --card: #0a0a0a; --soft: #171717;
    --accent: #fafafa; --accent-fg: #0a0a0a; --ok: #4ade80; --warn: #fbbf24; --err: #f87171; --info: #d4d4d4; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.55; font-size: 15px; }
a { color: var(--fg); text-decoration-color: var(--line); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--fg); }
main { max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.5rem 3rem; }

/* — en-tête — */
.demo-banner { background: var(--soft); color: var(--muted); border-bottom: 1px solid var(--line); padding: .45rem 1.5rem; text-align: center; font-size: .85rem; }
.demo-banner strong { color: var(--fg); }
header.top { display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 1.25rem 1.5rem; }
.brand { display: inline-flex; gap: .6rem; align-items: center; font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--fg); letter-spacing: -.01em; }
.mark { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fg); color: var(--bg); border-radius: 6px; padding: .1rem .4rem; font-size: .8rem; font-weight: 600; }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
.dossier-bar nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dossier-bar nav::-webkit-scrollbar { display: none; }
.dossier-bar nav a { white-space: nowrap; }
nav a { text-decoration: none; color: var(--muted); font-size: .9rem; }
nav a[aria-current="page"] { color: var(--fg); }
nav a:hover, nav a:focus-visible { color: var(--fg); }
.who { color: var(--muted); font-size: .85rem; }
nav details.more { position: relative; }
nav details.more summary { list-style: none; cursor: pointer; color: var(--muted); font-size: .9rem; }
nav details.more summary::-webkit-details-marker { display: none; }
nav details.more summary::after { content: " ▾"; font-size: .7rem; }
nav details.more[open] summary, nav details.more summary:hover { color: var(--fg); }
nav details.more > div { position: absolute; z-index: 5; top: 1.8rem; left: -.75rem; min-width: 210px; display: grid; gap: .1rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
nav details.more > div a { padding: .4rem .6rem; border-radius: 6px; }
nav details.more > div a:hover { background: var(--soft); color: var(--fg); }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .92rem; padding: 0; }
.linkish:hover { color: var(--fg); }
.dossier-bar { display: flex; flex-wrap: wrap; gap: .5rem 2rem; overflow: hidden; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: .75rem 1.5rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dossier-title { font-weight: 600; display: flex; gap: .6rem; align-items: center; }
.dossier-title a { color: var(--fg); text-decoration: none; }

/* — typographie — */
h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 650; margin: 0 0 1.25rem; }
h2 { font-size: 1.15rem; letter-spacing: -.015em; font-weight: 600; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }
.hero p, .note, .lead-muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; word-break: break-all; }
p { max-width: 70ch; }

/* — boutons et champs — */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0; }
.btn { background: var(--accent); color: var(--accent-fg); border: 1px solid var(--accent); border-radius: var(--radius); padding: .55rem 1.05rem;
  font: inherit; font-weight: 550; font-size: .92rem; cursor: pointer; text-decoration: none; display: inline-block; transition: opacity .12s; }
.btn:hover { opacity: .85; }
.btn.secondary { background: transparent; color: var(--fg); border-color: var(--fg); }
.btn.small { padding: .25rem .65rem; font-size: .82rem; }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn:disabled, .btn.htmx-request { opacity: .5; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
form label { display: block; margin: .9rem 0; font-weight: 550; font-size: .92rem; }
form label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 400; margin-right: 1rem; }
input[type=text], input:not([type]), input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  width: 100%; max-width: 520px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); font: inherit; display: block; margin-top: .3rem; transition: border-color .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }
textarea { font-family: var(--mono, ui-monospace, monospace); font-size: .8rem; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--fg); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; padding: .6rem 1.1rem; min-width: 0; }
fieldset:has(> .table-wrap) { border: 0; padding: 0; margin: 0; }
input, select, textarea { font-weight: 400; }
td input, td select { max-width: 100%; min-width: 7rem; margin-top: 0; }
td input[size] { min-width: 5rem; width: 6rem; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.filters label { margin: 0; }

/* — chiffres — */
.stats { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.stat a { display: block; height: 100%; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--muted); font-size: .85rem; transition: border-color .12s; }
.stat a:hover { border-color: var(--fg); }
.stat .n { display: block; font-size: 2rem; font-weight: 600; letter-spacing: -.03em; color: var(--fg); font-variant-numeric: tabular-nums; margin-bottom: .1rem; }
.stat.warn .n { color: var(--warn); } .stat.err .n { color: var(--err); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.panel { margin-top: 1.25rem; }
.card h2, .panel h2, .card h3 { margin-top: 0; }
.card h3 { margin: 0 0 .25rem; }
dl { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: .9rem 0; }
dt { color: var(--muted); } dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* — tableaux — */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: transparent; margin: .5rem 0 1.5rem; font-size: .9rem; }
th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; white-space: nowrap; border-bottom-color: var(--fg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover td { background: var(--soft); }
tr.gas td { color: var(--muted); }
td:first-child { white-space: nowrap; }
tfoot th { border-top: 1px solid var(--fg); border-bottom: 0; color: var(--fg); font-weight: 600; }

/* — états — */
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); color: var(--muted); background: transparent; }
.tag.ok { color: var(--ok); border-color: currentColor; } .tag.warn { color: var(--warn); border-color: currentColor; }
.tag.err { color: var(--err); border-color: currentColor; } .tag.info, .tag.muted { color: var(--muted); }
.tag.score { white-space: nowrap; }
.alert, .notice, .methode-status, .a-valider { border-left: 2px solid var(--fg); background: var(--soft); padding: .75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; }
.alert { border-left-color: var(--err); }
.notice, .methode-status, .a-valider { border-left-color: var(--warn); }
.err-text { color: var(--err); } .ok-text { color: var(--ok); } .warn-text { color: var(--warn); }
.sync-result { margin-top: .75rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.bank { border-top: 1px solid var(--line); }
.narrow { max-width: 520px; }
.stack { display: grid; gap: .25rem; }
.anomalies { list-style: none; padding: 0; display: grid; gap: .5rem; }
.anomalies li { background: var(--soft); border-radius: var(--radius); padding: .7rem 1rem; border-left: 2px solid var(--line); }
.anomalies li.sev-critical { border-left-color: var(--err); }
.anomalies li.sev-warning { border-left-color: var(--warn); }
.recon-group { margin: 1.25rem 0; } .recon-group h3 { font-size: 1rem; }
.reasons { margin: 0; padding-left: 1rem; color: var(--muted); } .reasons li { margin: .1rem 0; }

/* — démarrage guidé — */
.onboarding-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; align-items: baseline; }
.onboarding-head h2 { margin: 0; }
.onboarding progress { width: 100%; height: 3px; accent-color: var(--fg); margin: .9rem 0 .4rem; }
.checklist { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: 0; }
.checklist li { display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.checklist li.next { font-weight: 550; }
.checklist li.done { color: var(--muted); }
.checklist .check { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  border: 1px solid var(--fg); color: var(--fg); font-size: .75rem; }
.checklist li.done .check { background: var(--fg); color: var(--bg); }
.checklist.big li { padding: 1rem 0; }
.tour-steps { display: block; margin-top: 1.5rem; }
.tour-steps ol { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; padding-left: 1.2rem; }

/* — documents, méthode, guides — */
.methode, .legal-doc, .guide-article, .guide-list { max-width: 72ch; }
.methode h2, .legal-doc h2 { margin-top: 2.5rem; }
.methode-toc { display: block; background: var(--soft); border-radius: var(--radius); padding: .5rem 1.25rem; }
.methode-toc ol { display: block; }
.legal-doc blockquote, .guide-article .legal-doc blockquote { margin: 1.25rem 0; border-left: 2px solid var(--fg); padding: .4rem 1rem; background: var(--soft); border-radius: 0 var(--radius) var(--radius) 0; }
.legal-doc td:first-child { white-space: normal; }
.guide-list { list-style: none; padding: 0; display: grid; gap: 0; }
.guide-list li { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.guide-list h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.guide-list p { margin: .25rem 0; color: var(--muted); }
.guide-article .lead { font-size: 1.15rem; color: var(--muted); }
.guide-article .legal-doc h2 { margin-top: 2rem; }
.guide-sources li { margin: .25rem 0; }
.tool-form { max-width: 720px; background: var(--soft); border-radius: var(--radius); padding: 1.25rem; }
.tool-form input[type=text] { max-width: 100%; font-family: ui-monospace, Menlo, monospace; background: var(--bg); }
.tool-form .btn { margin-top: .6rem; }
.tool-explain, .guide-next { margin-top: 2rem; }
.tool-report h2 { margin-top: 2rem; }
.tool-consent label.consent { display: flex; align-items: flex-start; gap: .6rem; font-weight: 400; margin: .9rem 0; color: var(--muted); }
.tool-consent label.consent input { margin-top: .25rem; flex: none; }

/* — pied de page — */
footer { max-width: 1120px; margin: 3rem auto 0; padding: 1.5rem; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
footer a { color: var(--muted); }
footer a:hover { color: var(--fg); }

@media (max-width: 640px) {
  h1 { font-size: 1.55rem; } main { padding: 1.5rem 1rem 2rem; }
  header.top, .dossier-bar { padding-left: 1rem; padding-right: 1rem; }
  .stat .n { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
