/* ilPay – mise en page inspirée des simulateurs du Code du travail numérique (DSFR) : fond clair, bleu Marianne, grands chiffres. */
:root {
  color-scheme: light;
  --page: #f6f6f6; --surface: #ffffff; --ink: #161616; --ink-2: #3a3a3a; --muted: #666666;
  --grid: #e5e5e5; --axis: #cecece; --border: #dddddd;
  --blue: #000091; --blue-ink: #ffffff; --blue-soft: #e3e3fd; --blue-hover: #1212ff;
  --s1: #000091; --s2: #e4794a; --s3: #009099; --s4: #c8aa39; --s5: #a558a0; --s6: #417dc4; --s7: #66a4a9; --s8: #ce614a; --s9: #7b7b7b;
  --good: #18753c; --warn: #b34000; --bad: #ce0500; --good-text: #18753c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #161616; --surface: #1e1e1e; --ink: #f0f0f0; --ink-2: #cecece; --muted: #929292;
    --grid: #2f2f2f; --axis: #3f3f3f; --border: #353535;
    --blue: #8585f6; --blue-ink: #161616; --blue-soft: #2a2a5e; --blue-hover: #b1b1f9;
    --s1: #8585f6; --s2: #e4794a; --s3: #34bab5; --s4: #c8aa39; --s5: #c48ac0; --s6: #6aa2e0; --s7: #66a4a9; --s8: #e0775f; --s9: #9a9a9a;
    --good-text: #27a658;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #161616; --surface: #1e1e1e; --ink: #f0f0f0; --ink-2: #cecece; --muted: #929292;
  --grid: #2f2f2f; --axis: #3f3f3f; --border: #353535;
  --blue: #8585f6; --blue-ink: #161616; --blue-soft: #2a2a5e; --blue-hover: #b1b1f9;
  --s1: #8585f6; --s2: #e4794a; --s3: #34bab5; --s4: #c8aa39; --s5: #c48ac0; --s6: #6aa2e0; --s7: #66a4a9; --s8: #e0775f; --s9: #9a9a9a;
  --good-text: #27a658;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.5 Marianne, system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; padding: 18px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 14px; height: 22px; background: var(--blue); border-radius: 2px; }
header h1 { font-size: 20px; margin: 0; font-weight: 700; }
.tagline { margin: 0; color: var(--muted); font-size: 15px; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 60px; }
.bloc { margin: 0 0 40px; }
h2 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; font-weight: 700; }
h3 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
.lead { color: var(--ink-2); margin: 0 0 16px; max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 20px 22px; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.help { border-left: 4px solid var(--blue-soft); padding: 6px 14px; color: var(--ink-2); font-size: 14px; margin: 14px 0 0; }
a { color: var(--blue); }

/* ---------- filtres */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.spacer { flex: 1; }
.seg-ctl { display: inline-flex; border: 1px solid var(--blue); border-radius: 4px; overflow: hidden; }
.seg-ctl button { background: var(--surface); border: 0; border-right: 1px solid var(--blue); color: var(--blue); padding: 8px 14px; font: inherit; font-size: 15px; cursor: pointer; }
.seg-ctl button:last-child { border-right: 0; }
.seg-ctl button:hover { background: var(--blue-soft); }
.seg-ctl button.active { background: var(--blue); color: var(--blue-ink); }
.perso[hidden] { display: none; }
.perso { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
input[type=month], input[type=number], select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; padding: 6px 10px; }

/* ---------- du brut au net */
.figures { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.figure { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c, var(--grid)); border-radius: 6px; padding: 14px 16px; }
.figure .label { color: var(--ink-2); font-size: 14px; }
.figure .value { font-size: 30px; font-weight: 700; margin: 2px 0 0; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.figure .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.figure.hero { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.figure.hero .label, .figure.hero .sub { color: var(--blue-ink); opacity: .85; }
.stack { display: flex; height: 26px; border-radius: 4px; overflow: hidden; margin: 6px 0 8px; }
.stack div { background: var(--c); min-width: 2px; }
.stack div + div { margin-left: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); margin: 6px 0 10px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.legend-total { margin-left: auto; }
.legend-total::before { display: none; }
.flow { color: var(--ink-2); font-size: 15px; margin: 0; }
.flow b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- graphiques */
svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font: 12px Marianne, system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg text.lbl { fill: var(--ink-2); }
svg text.total { fill: var(--ink-2); font-weight: 600; }
svg .grid line { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .seg.hover { filter: brightness(1.2); }
#tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 12px; border-radius: 4px; font-size: 13px; display: none; z-index: 10; white-space: nowrap; }
#tip .tr { display: grid; grid-template-columns: 12px auto 1fr; gap: 0 8px; align-items: center; margin-top: 3px; }
#tip .tr i { width: 12px; height: 2px; background: var(--c); border-radius: 1px; }
#tip .tr.total { grid-template-columns: auto 1fr; border-top: 1px solid rgba(128,128,128,.4); margin-top: 5px; padding-top: 4px; }
#tip .tr span { opacity: .8; }

/* camembert */
.donut-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 20px 32px; align-items: center; }
.donut-wrap svg { max-width: 260px; margin: 0 auto; }
.donut-center { font: 700 22px Marianne, system-ui, sans-serif; fill: var(--ink); }
.donut-center-sub { fill: var(--muted); font-size: 12px; }
.donut-list { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px 12px; align-items: center; font-size: 15px; }
.donut-list i { width: 12px; height: 12px; border-radius: 2px; background: var(--c); }
.donut-list .pct { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.donut-list .amt { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.donut-list .row.hover { background: var(--blue-soft); }
.donut-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.donut-head h3 { margin: 0; flex: 1; }
.arc.hover { filter: brightness(1.2); }

/* impôt */
.impot-ctl { display: flex; gap: 16px 24px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.impot-ctl label { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 15px; }
.impot-ctl input[type=number] { width: 70px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 20px; }
.step { background: var(--page); border-radius: 6px; padding: 10px 12px; position: relative; }
.step .k { color: var(--muted); font-size: 13px; }
.step .v { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.step .d { color: var(--muted); font-size: 12px; }
.tranches { display: grid; grid-template-columns: minmax(150px, max-content) 58px 1fr max-content max-content; gap: 10px 14px; align-items: center; font-size: 15px; }
.tranches .h { color: var(--muted); font-size: 13px; font-weight: 500; }
.tranches .lab { color: var(--ink-2); white-space: nowrap; }
.tranches .taux { display: inline-block; text-align: center; padding: 2px 0; border-radius: 4px; background: var(--page); font-weight: 700; font-variant-numeric: tabular-nums; }
.tranches .track { display: block; background: var(--grid); border-radius: 3px; height: 16px; position: relative; }
.tranches .bar { display: block; height: 16px; border-radius: 3px; background: var(--c, var(--s1)); min-width: 0; }
.tranches .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tranches .dim { color: var(--muted); }
.tranches .tmi .taux { background: var(--blue); color: var(--blue-ink); }
.tranches .tmi .lab { font-weight: 700; color: var(--ink); }
.result { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 22px 0 0; }
.result .figure .value { font-size: 26px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.badge.ok { background: #b8fec9; color: #18753c; } .badge.warn { background: #fee9e5; color: #ce0500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.ok { background: #1f4d2e; color: #7de39b; } :root:not([data-theme="light"]) .badge.warn { background: #5a1f1a; color: #ff9a8c; } }
.phrase { font-size: 17px; margin: 18px 0 0; }
.phrase b { font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  h2 { font-size: 21px; }
  .donut-wrap { grid-template-columns: 1fr; }
  .tranches { grid-template-columns: 1fr 48px auto auto; gap: 8px 8px; font-size: 14px; }
  .tranches .lab { white-space: normal; }
  .tranches .track, .tranches .h.track-h { display: none; }
  .figure .value { font-size: 26px; }
}

/* ---------- définitions */
button.info { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid currentColor; background: none; color: inherit; font: 700 11px/1 inherit; cursor: pointer; vertical-align: 2px; margin-left: 2px; opacity: .7; padding: 0; }
button.info:hover { opacity: 1; background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.figure.hero button.info:hover { background: rgba(255,255,255,.2); color: inherit; border-color: currentColor; }
.note button.info { width: auto; height: auto; border-radius: 4px; padding: 0 6px; font-size: 12px; font-weight: 500; }
.donut-list button.lien { all: unset; cursor: pointer; color: var(--blue); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; }
.donut-list button.lien:hover, .donut-list button.lien:focus-visible { text-decoration-color: currentColor; background: var(--blue-soft); }
.donut-list .q { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid currentColor; font-size: 11px; font-weight: 700; margin-left: 4px; vertical-align: 1px; opacity: .7; }
.arc { cursor: pointer; }
dialog#def { border: 0; border-radius: 8px; padding: 22px 26px; max-width: 560px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.25); font-size: 15px; }
dialog#def::backdrop { background: rgba(22,22,22,.55); }
dialog#def .def-head { display: flex; align-items: flex-start; gap: 12px; }
dialog#def h3 { flex: 1; font-size: 19px; margin: 0 0 10px; }
dialog#def .close { all: unset; cursor: pointer; font-size: 24px; line-height: 1; color: var(--muted); padding: 0 4px; }
dialog#def .close:hover { color: var(--ink); }
dialog#def p { margin: 0 0 10px; }
dialog#def .def-links { margin: 14px 0 4px; }
dialog#def ul { margin: 0; padding-left: 20px; }
dialog#def li { margin: 4px 0; }

/* ---------- menu, connexion, formulaires */
.menu { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.menu a, .lien-bouton { color: var(--blue); text-decoration: none; padding: 6px 10px; border-radius: 4px; font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; }
.menu a:hover, .lien-bouton:hover { background: var(--blue-soft); }
.menu a.actif { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(420px, calc(100% - 32px)); }
.form label { display: block; margin: 12px 0 0; color: var(--ink-2); font-size: 14px; }
.form input:not([type=checkbox]), .form textarea, .form select { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; padding: 8px 10px; }
.form textarea { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 260px; }
.primary, button.bouton { font: inherit; font-size: 15px; background: var(--blue); color: var(--blue-ink); border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; margin-top: 14px; }
.primary:hover, button.bouton:hover { background: var(--blue-hover); }
button.bouton.second { background: var(--surface); color: var(--blue); border: 1px solid var(--blue); }
button.bouton.second:hover { background: var(--blue-soft); }
button.bouton.danger { background: none; color: var(--bad); border: 1px solid var(--bad); padding: 3px 8px; font-size: 13px; margin: 0; }
button:disabled { opacity: .5; cursor: default; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 8px 0 0; }
.ok { color: var(--good-text); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.hidden { display: none; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--page); padding: 1px 4px; border-radius: 3px; }
.brand h1 { font-size: 20px; }

/* ---------- administration */
table.liste { width: 100%; border-collapse: collapse; font-size: 14px; }
.liste th, .liste td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.liste th { color: var(--muted); font-weight: 500; font-size: 13px; }
.liste td.num, .liste th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste tr.ko td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.liste td.mono, .mono { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.depot { border: 2px dashed var(--axis); border-radius: 6px; padding: 22px; text-align: center; color: var(--ink-2); cursor: pointer; }
.depot.survol { border-color: var(--blue); background: var(--blue-soft); }
.depot input { display: none; }
.progression { margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; }
.progression li { padding: 3px 0; border-bottom: 1px solid var(--grid); display: flex; gap: 10px; }
.progression li span:first-child { flex: 1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.actions .bouton { margin-top: 0; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .deux { grid-template-columns: 1fr; } }
.etat { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; }
.etat dt { color: var(--muted); } .etat dd { margin: 0; }
details.section { margin-top: 10px; } details.section summary { cursor: pointer; color: var(--ink-2); }
