:root {
  color-scheme: light dark;
  --bg: light-dark(#f7f6f3, #0f1115);
  --surface: light-dark(#ffffff, #171a21);
  --surface-2: light-dark(#f1efe9, #1e222b);
  --text: light-dark(#1c2230, #e6e8ee);
  --muted: light-dark(#5d6575, #9aa3b2);
  --line: light-dark(#e3e0d8, #2a2f3a);
  --accent: light-dark(#1f4e46, #6fc2b0);
  --accent-ink: light-dark(#ffffff, #0f1115);
  --gold: light-dark(#a7792b, #d9b26a);
  --danger: light-dark(#b23b3b, #ef8a8a);
  --ok: light-dark(#2f7a4f, #7fd3a0);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
.serif { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 600; color: var(--gold); }
.wrap { max-width: 1180px; width: 100%; margin: 0 auto; padding: 0 clamp(14px, 3vw, 28px); }
[hidden] { display: none !important; }

/* Barre du haut */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-size: 13px; font-weight: 800; }
.brand-logo { width: 32px; height: 32px; display: block; flex: none; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none; border-radius: 999px; padding: 13px 24px; transition: transform .15s, box-shadow .15s, background .15s, opacity .15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.field { margin-bottom: 14px; }
.field label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field label small { color: var(--muted); font-weight: 400; }
.field input, .field select { width: 100%; font: inherit; font-size: 16px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.input-eur { position: relative; }
.input-eur input { padding-right: 36px; font-variant-numeric: tabular-nums; }
.input-eur::after { content: "€"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.check { display: flex; gap: 10px; font-size: 14px; color: var(--muted); margin: 12px 0; align-items: flex-start; }
.check input { margin-top: 4px; flex: none; width: 16px; height: 16px; }
.msg { font-size: 14px; min-height: 22px; margin-top: 10px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 28px); box-shadow: var(--shadow); }

/* Contenu des chapitres */
.reader h2 { font-size: clamp(24px, 3vw, 30px); }
.reader h3 { font-size: 19px; margin-top: 1.8em; }
.reader ul, .reader ol { padding-left: 22px; }
.reader li { margin: 4px 0; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.meta span { background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
.retenir { border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 9%, transparent); padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 22px 0; }
.retenir > strong:first-child, .action > strong:first-child { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.retenir > strong:first-child { color: var(--gold); }
.retenir ul { margin: 0; }
.action { border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 10px; padding: 14px 18px; margin: 22px 0; }
.action > strong:first-child { color: var(--accent); }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist li::before { content: "☐ "; color: var(--accent); }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ex-case { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin: 16px 0; }
.solution { display: none; border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 6px; }
.solution.open { display: block; }
.tip { background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 10px; padding: 12px 16px; font-size: 15px; margin-top: 14px; }
.tip b { color: var(--accent); }
.calc { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
