:root {
  --ink: #1b2430;
  --muted: #5b6675;
  --line: #dde3ea;
  --bg: #ffffff;
  --soft: #f4f7fa;
  --brand: #1f4e79;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0f8;
  --accent: #b4540a;
  --ok: #1e6b3a;
  --ok-soft: #e9f6ee;
  --warn: #8a5a00;
  --warn-soft: #fff6e0;
  --bad: #a1271b;
  --bad-soft: #fdecea;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.65; font-size: 17px; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: #163a5a; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* En-tête */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--ink); padding: 6px 10px; border-radius: 8px; font-size: 0.95rem; }
.main-nav a:hover, .main-nav a[aria-current] { background: var(--brand-soft); color: var(--brand); }

/* Fil d'Ariane */
.crumbs ol { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--muted); }

/* Contenu */
.content { max-width: 760px; margin: 0 auto 64px; }
.kind-home .content, .kind-hub .content { max-width: 1100px; }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 28px 0 4px; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.35rem); line-height: 1.2; margin: 8px 0 8px; letter-spacing: -0.01em; }
.kicker + h1 { margin-top: 0; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.2em 0 .6em; scroll-margin-top: 16px; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .4em; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: .3em; }
.updated { color: var(--muted); font-size: .88rem; margin-top: 0; }
.lead { font-size: 1.15rem; color: #2c3644; }
.muted { color: var(--muted); font-size: .9rem; }
strong { font-weight: 650; }

/* Encadrés */
.callout { border-radius: var(--radius); padding: 14px 16px; margin: 1.4em 0; border: 1px solid var(--line); background: var(--soft); }
.callout > :last-child { margin-bottom: 0; }
.callout-info { background: var(--brand-soft); border-color: #c9dbee; }
.callout-ok { background: var(--ok-soft); border-color: #bfe3cc; }
.callout-warn { background: var(--warn-soft); border-color: #f0dca6; }
.callout-bad { background: var(--bad-soft); border-color: #f2c4bf; }
.callout ol, .callout ul { margin-bottom: .6em; }
.pub { display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; background: #eef1f4; color: var(--muted); border-radius: 4px; padding: 0 5px; vertical-align: middle; }

/* Sommaire */
.toc { background: var(--soft); border-radius: var(--radius); padding: 12px 16px; margin: 1.4em 0; }
.toc-title { font-weight: 700; margin: 0 0 4px; }
.toc ol { margin: 0; padding-left: 1.3em; }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; min-width: 520px; }
caption { text-align: left; padding: 10px 12px; font-weight: 600; color: var(--muted); }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-top: 1px solid var(--line); }
thead th { background: var(--soft); border-top: 0; font-weight: 650; }
tbody th { font-weight: 600; }

/* Boutons */
.btn, button.btn { display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none; border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.3; }
.btn:hover { background: #163a5a; color: #fff; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }

/* Encadré partenaires */
.partner-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 1.6em 0; }
.partner-title { font-weight: 700; margin: 0 0 8px; }
.partner-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.partner-box li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }

/* FAQ */
.faq details { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details > div { margin-top: 8px; }

/* Étapes */
ol.steps { counter-reset: s; list-style: none; padding: 0; }
ol.steps > li { counter-increment: s; position: relative; padding-left: 42px; margin-bottom: 14px; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }

/* Cartes */
.cards { list-style: none; padding: 0; margin: 1em 0 2em; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { margin: 0; }
.card a { display: flex; flex-direction: column; gap: 4px; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); background: #fff; }
.card a:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(31, 78, 121, .08); }
.card-title { font-weight: 650; color: var(--brand); }
.card-text { font-size: .92rem; color: var(--muted); }

/* Accueil */
.hero { padding: 8px 0 8px; max-width: 760px; }
.hero .lead { margin-bottom: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.situations { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.situations li { margin: 0; }
.situations a { display: block; padding: 10px 14px; border-radius: 8px; background: var(--soft); text-decoration: none; }
.situations a:hover { background: var(--brand-soft); }

/* Outils */
.tool { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 1.4em 0; background: #fff; }
.tool fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.tool legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: .93rem; }
.field .hint { font-size: .83rem; color: var(--muted); }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], select, textarea {
  font: inherit; font-size: 1rem; padding: 9px 10px; border: 1px solid #b9c3cf; border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9cc3e8; outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; }
.check input { margin-top: 5px; }
.result { background: var(--soft); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; }
.result .big { font-size: 1.6rem; font-weight: 750; color: var(--brand); }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 8px 0 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi span { display: block; font-size: .82rem; color: var(--muted); }
.kpi strong { font-size: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.alert { padding: 10px 12px; border-radius: 8px; margin: 8px 0; font-size: .93rem; }
.alert-warn { background: var(--warn-soft); }
.alert-bad { background: var(--bad-soft); }
.alert-ok { background: var(--ok-soft); }

/* Document généré (aperçu et impression) */
.doc-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-top: 16px; background: #fff; font-size: .95rem; }
.doc-preview h2 { margin-top: 0; text-align: center; }
.doc-preview table { min-width: 0; }
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }
.sign-box { border-top: 1px solid var(--ink); padding-top: 6px; min-height: 80px; font-size: .88rem; }

/* Sources et avertissement */
.sources { margin-top: 3em; font-size: .9rem; }
.sources h2 { font-size: 1.1rem; }
.sources ul { padding-left: 1.2em; }
.disclaimer { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2em; }

/* Pied de page */
.site-footer { background: var(--soft); border-top: 1px solid var(--line); padding: 32px 0 16px; font-size: .9rem; }
.foot-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.foot-title { font-weight: 700; margin: 0 0 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 5px; }
.site-footer a { color: var(--ink); }
.foot-legal { color: var(--muted); font-size: .82rem; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .doc-preview { padding: 16px; }
  .sign-grid { grid-template-columns: 1fr; }
  .header-inner { padding-top: 8px; padding-bottom: 8px; }
}

@media print {
  .site-header, .site-footer, .crumbs, .no-print, .partner-box, .toc { display: none !important; }
  body { font-size: 11pt; }
  .content { max-width: none; margin: 0; }
  a { color: inherit; }
}

.doc-preview:empty { display: none; }
.doc-preview .page-break { border-top: 2px dashed var(--line); margin-top: 28px; padding-top: 24px; }
.doc-preview .sig-cell { height: 40px; min-width: 64px; }
.doc-preview { overflow-x: auto; }
.doc-preview th, .doc-preview td { padding: 6px 8px; }
.alert-info { background: var(--brand-soft); }
.result table { min-width: 0; }

.kind-home h1 { margin-top: 36px; }
