:root {
  --bg: #f5f0e6;
  --card: #ffffff;
  --line: #e6decf;
  --text: #1d2a25;
  --muted: #6e7c76;
  --emerald: #0b4535;
  --emerald-2: #0f6b4f;
  --gold: #d9ae4f;
  --danger: #c0532f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--emerald-2); }
header.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
             background: var(--emerald); color: #fff; padding: 14px 24px; }
header.top .brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
header.top nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
header.top nav a { color: #fff; text-decoration: none; opacity: .9; }
header.top nav a:hover { opacity: 1; text-decoration: underline; }
header.top .who { color: var(--gold); font-size: 14px; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 26px; margin: 0 0 12px; }
h2 { font-size: 19px; margin: 0 0 8px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card.narrow { max-width: 480px; margin: 24px auto; }
.card.empty { text-align: center; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 20px; }
.muted { color: var(--muted); }
.flash { background: #e7f3ec; border: 1px solid #b8dcc7; color: var(--emerald); padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.error { color: var(--danger); font-weight: 600; }
label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit;
                border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, select:focus { outline: 2px solid var(--emerald-2); border-color: transparent; }
input.code { font-size: 28px; letter-spacing: 6px; text-align: center; font-weight: 700; }
button, .btn { display: inline-block; background: var(--gold); color: var(--text); border: 0; border-radius: 999px;
               padding: 11px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { filter: brightness(.95); }
button.link { background: none; padding: 0; font-weight: 600; color: var(--emerald-2); }
button.link.danger { color: var(--danger); }
.device .dev-head { display: flex; align-items: center; gap: 10px; }
.device h2 { margin: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.on { background: #1e9e5a; box-shadow: 0 0 0 4px #1e9e5a22; }
.dot.off { background: #b9b2a5; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 14px 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; }
code { font-size: 13px; }
ol.steps { padding-left: 20px; color: var(--muted); }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list th { color: var(--muted); font-weight: 600; font-size: 14px; }
form.inline { display: inline; }
form.inline select { display: inline-block; width: auto; margin: 0; padding: 6px 10px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.settings .card { margin-bottom: 16px; }
.causes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
fieldset.cause { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 8px; }
fieldset.cause legend { font-weight: 700; color: var(--emerald-2); padding: 0 6px; }
.amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.amounts .pop { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); margin-top: 6px; }
.amounts .pop input { width: auto; display: inline; margin: 0; }
label.short { max-width: 200px; }
h2.space { margin-top: 28px; }
label.checkline { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
label.checkline input { width: auto; margin: 3px 0 0; flex: none; }
label.checkline.inline { display: inline-flex; margin: 0; font-weight: 400; }
details.campaign { margin: 6px 0 4px; }
details.campaign summary { font-size: 14px; }
main.donor { max-width: 560px; }
main.donor h1 { font-size: 24px; }
main.donor .big { margin: 4px 0; }
.inline-dot { display: inline-block; vertical-align: middle; margin-right: 4px; }
details summary { cursor: pointer; color: var(--emerald-2); font-weight: 600; margin: 4px 0 8px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { display: inline-block; width: auto; margin: 0; padding: 7px 10px; }
.stats { margin-bottom: 16px; }
.stats .card p { margin: 0; }
.big { font-size: 30px; font-weight: 800; color: var(--emerald); }
.small { font-size: 12px; }
table.list .status { font-size: 13px; font-weight: 600; }
tr.st-successful .status { color: #1e7a48; }
tr.st-pending .status { color: #8a6312; }
tr.st-failed .status, tr.st-cancelled .status, tr.st-error .status { color: var(--muted); }
tr.st-failed td, tr.st-cancelled td, tr.st-error td { color: var(--muted); }
section.card + table.list, .stats + table.list { margin-top: 16px; }
@media (max-width: 640px) { table.list { display: block; overflow-x: auto; } }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #fff4dc; color: #8a6312; }

/* --- 0.5 : navigation, statistiques, guide d'installation, diagnostic, pages légales --- */
header.top nav a.on, header.top nav summary.on { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
details.menu { position: relative; }
details.menu summary { color: #fff; opacity: .9; margin: 0; list-style: none; font-weight: 400; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::after { content: ' ▾'; font-size: 12px; }
details.menu > div { position: absolute; right: 0; top: 30px; z-index: 10; background: var(--emerald); border-radius: 12px; padding: 8px 0;
                     min-width: 190px; box-shadow: 0 8px 24px #0004; display: flex; flex-direction: column; }
details.menu > div a { padding: 8px 16px; }
footer.foot { text-align: center; padding: 8px 16px 32px; font-size: 13px; color: var(--muted); }
footer.foot a { color: var(--muted); }
button.secondary, .btn.secondary { background: #fff; border: 1px solid var(--line); color: var(--emerald); }
button:disabled { opacity: .5; cursor: not-allowed; }
textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.space { margin-top: 20px; }
.ok { color: #1e7a48; font-weight: 600; }
.nowrap { white-space: nowrap; }
td.actions { white-space: nowrap; font-size: 14px; }
.inline-select { display: inline-block; width: auto; margin: 0 4px; padding: 4px 8px; }
.chip { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text);
        text-decoration: none; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.delta { font-weight: 700; font-size: 14px; }
.delta.up { color: #1e7a48; }
.delta.down { color: var(--danger); }
.grid.charts { margin-top: 16px; }
.chart-card { margin-top: 16px; }
.grid.charts .chart-card { margin-top: 0; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 4px; overflow: visible; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { stroke: #cfc5b2; stroke-width: 1; }
svg.chart .mark { fill: var(--emerald-2); }
svg.chart .hit { fill: transparent; }
svg.chart .bar:hover .mark { fill: var(--emerald); }
svg.chart .bar:hover .hit { fill: #0f6b4f10; }
svg.chart text { font-size: 11px; fill: var(--muted); }
svg.chart text.val { fill: var(--text); font-weight: 700; }
table.list.compact th, table.list.compact td { padding: 7px 10px; font-size: 14px; }
th.w40 { width: 40%; }
.meter { display: inline-block; vertical-align: middle; width: calc(100% - 52px); max-width: 220px; height: 8px; border-radius: 4px; background: #efe9dc; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--emerald-2); border-radius: 4px; }
.setup-head { display: grid; gap: 10px; margin-bottom: 18px; }
.setup-head .big { margin: 0; }
.progress { height: 12px; border-radius: 6px; background: #efe9dc; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--emerald-2); border-radius: 6px; }
ol.setup { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
li.step { display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; }
li.step .step-mark { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
                     background: #efe9dc; color: var(--muted); }
li.step.done .step-mark { background: #1e9e5a; color: #fff; }
li.step.current { border: 2px solid var(--gold); }
li.step.current .step-mark { background: var(--gold); color: var(--text); }
li.step.done h2, li.step.done .muted { opacity: .75; }
li.step h2 { margin: 4px 0 2px; }
li.step p { margin: 4px 0; }
li.step .step-body { flex: 1; min-width: 0; }
.step-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px !important; }
.setup-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; border-color: var(--gold); }
.setup-banner p { margin: 0; }
.actions-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.actions-row form { margin: 0; }
pre.log { background: #1d2a25; color: #e6f0ea; border-radius: 12px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5;
          max-height: 340px; overflow: auto; white-space: pre-wrap; margin: 8px 0; }
main.legal { max-width: 820px; }
main.legal h2 { margin-top: 22px; }
@media print {
  header.top, footer.foot, .step-actions, details.menu { display: none !important; }
  details { display: block; } details > summary { display: none; } details > * { display: block; }
  li.step { break-inside: avoid; }
}
