:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --ink: #18201d;
  --muted: #5d6763;
  --line: #e1e5e2;
  --brand: #0f5c4d;
  --brand-2: #e7f1ee;
  --accent: #b4462d;
  --warn-bg: #fff5e5;
  --warn: #8a5300;
  --bad-bg: #fdecea;
  --bad: #a3271b;
  --ok: #1d7a46;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111614; --card: #19201d; --ink: #e8ece9; --muted: #9aa5a0; --line: #2b3531;
    --brand: #5cc0a6; --brand-2: #1d2e29; --accent: #e07a5f; --warn-bg: #2e2412; --warn: #f0b860;
    --bad-bg: #321a17; --bad: #f08a7c; --ok: #6fd19a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111614; --card: #19201d; --ink: #e8ece9; --muted: #9aa5a0; --line: #2b3531;
  --brand: #5cc0a6; --brand-2: #1d2e29; --accent: #e07a5f; --warn-bg: #2e2412; --warn: #f0b860;
  --bad-bg: #321a17; --bad: #f08a7c; --ok: #6fd19a; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 Inter, system-ui, -apple-system, Segoe UI, sans-serif; }
a { color: var(--brand); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 58px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo-mark { background: var(--brand); color: #fff; border-radius: 7px; width: 28px; height: 28px; display: inline-grid; place-items: center; font-size: 15px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; }
nav a.actif, nav a:hover { color: var(--brand); background: var(--brand-2); }
.bandeau { background: var(--brand-2); color: var(--muted); font-size: 12.5px; padding: 6px 0; }
main.wrap { padding: 24px 16px 40px; min-height: 60vh; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 28px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.sous { color: var(--muted); margin: 0 0 22px; max-width: 720px; }
.carte { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.carte + .carte { margin-top: 14px; }
.recherche { display: flex; gap: 8px; }
.recherche input { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 10px 16px; cursor: pointer; background: var(--brand); color: #fff; white-space: nowrap; }
.btn.sec { background: var(--brand-2); color: var(--brand); }
.btn:disabled { opacity: .55; cursor: wait; }
.astuce { font-size: 13px; color: var(--muted); margin-top: 8px; }
.exemples { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.exemples button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 99px; padding: 4px 11px; cursor: pointer; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { border-bottom: 1px solid var(--line); }
.liste li:last-child { border-bottom: 0; }
.liste a { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; overflow-wrap: anywhere; gap: 12px; padding: 11px 4px; text-decoration: none; color: var(--ink); align-items: baseline; }
.liste a:hover { background: var(--brand-2); }
.code { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: var(--brand); font-weight: 600; letter-spacing: .02em; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--brand-2); color: var(--brand); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ok { color: var(--ok); }
.choix { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; display: block; text-decoration: none; color: var(--ink); }
.choix:hover { border-color: var(--brand); }
.choix .raison { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.question { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
label.champ { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label.champ input, label.champ select { margin-top: 4px; font-weight: 400; }
.deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; font-size: 15px; }
.formule { font-size: 12px; color: var(--muted); }
.gros { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--brand); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.alerte { border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.alerte.warn { background: var(--warn-bg); color: var(--warn); }
.alerte.bad { background: var(--bad-bg); color: var(--bad); }
.alerte.info { background: var(--brand-2); color: var(--ink); }
.docs li { margin: 6px 0; }
.drop { display: block; margin-bottom: 16px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px 16px; text-align: center; cursor: pointer; background: var(--card); }
.drop.sur { border-color: var(--brand); background: var(--brand-2); }
.drop .astuce { display: block; }
.drop strong { display: block; font-size: 17px; margin-bottom: 4px; }
.attente { display: flex; gap: 12px; align-items: center; color: var(--muted); padding: 18px 0; }
.rond { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: t 0.8s linear infinite; flex: none; }
@keyframes t { to { transform: rotate(360deg); } }
.tab-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lignes td { font-size: 13.5px; }
.lignes input, .lignes select { padding: 6px 8px; font-size: 13.5px; }
.lignes .desc { min-width: 220px; }
.lignes .orig { color: var(--muted); font-size: 12px; }
details summary { cursor: pointer; color: var(--brand); font-size: 13px; font-weight: 600; }
.sections details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.sections summary { color: var(--ink); font-size: 15px; }
.sections .chap { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; padding: 6px 4px; text-decoration: none; color: var(--ink); }
.sections .chap:hover { background: var(--brand-2); }
.fil { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.vide { color: var(--muted); padding: 14px 0; }
.pied { color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 30px; }
.methode p, .methode li { max-width: 760px; }
@media (max-width: 760px) {
  h1 { font-size: 23px; }
  .deux { grid-template-columns: 1fr; }
  .liste a { grid-template-columns: minmax(0, 1fr) auto; }
  .liste a .code { grid-column: 1 / -1; }
  .top-in { gap: 6px; padding: 8px 0; }
  nav a { padding: 4px 8px; font-size: 14px; }
  .recherche { flex-direction: column; }
  .carte { padding: 14px; }
  .kpi .v { font-size: 19px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lignes thead { display: none; }
  .lignes, .lignes tbody, .lignes tr, .lignes td { display: block; width: 100%; }
  .lignes tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .lignes td { border: 0; padding: 5px 0; text-align: left; display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; }
  .lignes td::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 600; }
  .lignes td.desc { display: block; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .lignes td.desc::before { content: none; }
  .lignes td.tx { align-items: start; }
  .lignes input, .lignes select { width: 100% !important; min-width: 0 !important; text-align: left !important; }
  .lignes .desc { min-width: 0; }
  .tab-scroll { overflow: visible; }
  .lignes td.n { white-space: normal; }
  .grille { grid-template-columns: 1fr 1fr; }
  .grille .champ[style] { grid-column: 1 / -1 !important; }
}
@media (max-width: 380px) {
  .grille, .kpis { grid-template-columns: 1fr; }
}
@media print {
  .top, .bandeau, .pied, .no-print, nav { display: none !important; }
  body { background: #fff; color: #000; }
  .carte, .kpi { border-color: #ccc; }
}
