:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5d6679;
  --line: #e2e5ee;
  --brand: #2b2366;      /* bleu nuit */
  --brand-ink: #ffffff;
  --brand-soft: #ecebf6;
  --gold: #dba94b;       /* or (accents) */
  --ok: #1b7a46;
  --ok-soft: #e4f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --err: #b42318;
  --err-soft: #fde8e6;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141b; --card: #1a1f2a; --ink: #e8ebf2; --muted: #9aa3b5; --line: #2c3342;
    --brand: #a59de8; --brand-ink: #14112b; --brand-soft: #26233f; --gold: #e3b860;
    --ok: #6fd39a; --ok-soft: #173326; --warn: #f2c25c; --warn-soft: #3a2f12; --err: #ff8a80; --err-soft: #3d1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.t1 { font-weight: 700; }
.t2 { color: var(--muted); font-size: 13px; }
main { padding-top: 20px; padding-bottom: 32px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 24px auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 0; }
.opt { font-weight: 400; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0 0; padding: 8px 12px 12px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.radio { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 8px; cursor: pointer; }
.radio input { width: auto; margin: 4px 0 0; }
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 10px 16px; border: 1px solid transparent; cursor: pointer; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--err); border-color: var(--line); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.err { color: var(--err); margin: 8px 0 0; min-height: 0; }
.ok { color: var(--ok); margin: 8px 0 0; }
.err:empty, .ok:empty { display: none; }
.banner { background: var(--brand-soft); border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.who { font-size: 20px; font-weight: 700; }
.pill { background: var(--brand-soft); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 600; font-size: 14px; background: none; border: 0; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--ink); font-size: 12px; }
.count:empty { display: none; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.tag { display: inline-block; border-radius: 6px; padding: 1px 8px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--ink); }
.st { border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.st-envoyee { background: var(--bg); color: var(--muted); }
.st-retenue, .st-evoquee { background: var(--brand-soft); color: var(--brand); }
.st-reponse { background: var(--ok-soft); color: var(--ok); }
.st-close { background: var(--line); color: var(--muted); }
.reply { margin-top: 12px; border-left: 3px solid var(--ok); background: var(--ok-soft); padding: 10px 12px; border-radius: 0 8px 8px 0; }
.reply .rh { font-size: 12.5px; font-weight: 700; color: var(--ok); margin-bottom: 4px; }
.item .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.cr h3 { margin: 0 0 4px; font-size: 16px; }
.cr .body { margin-top: 10px; white-space: normal; }
.cr.prive { border-left: 4px solid var(--brand); }
.foot { color: var(--muted); font-size: 12.5px; padding-bottom: 24px; text-align: center; }
.spinner { width: 28px; height: 28px; margin: 8px auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.intro p { margin: 4px 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .choices { grid-template-columns: 1fr; } }
.choice { text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.choice:hover, .choice:focus-visible { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.choice .ct { font-size: 18px; font-weight: 700; color: var(--brand); }
.choice .cd { color: var(--muted); font-size: 14px; }
.back { font: inherit; font-size: 14px; background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; margin-bottom: 12px; }
.sect { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 0; }
.intro { border-top: 4px solid var(--gold); }
.intro h1 { text-align: center; }
.choice { border-left: 4px solid var(--gold); }

/* ---------- formulaire en étapes, remontées multiples ---------- */
.page-title { margin: 0 0 12px; }
.step { padding: 22px 20px; }
.step-title { display: flex; align-items: center; gap: 10px; font-size: 18px; margin: 0 0 4px; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.step-lead { margin: 0 0 8px; }
.conseil-pill { display: inline-block; background: var(--brand-soft); border-radius: 999px; padding: 6px 14px; font-size: 14px; margin: 4px 0 4px; }
.rem-block { position: relative; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 14px 16px 16px; margin-top: 14px; background: var(--card); transition: border-color .15s, box-shadow .15s; }
.rem-block:focus-within { box-shadow: 0 0 0 3px var(--brand-soft); }
.rem-block.invalid { border-color: var(--err); border-left-color: var(--err); }
.rb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.rb-num { font-weight: 700; color: var(--brand); }
.link-btn { font: inherit; font-size: 13px; background: none; border: 0; color: var(--err); cursor: pointer; padding: 4px 0; }
.field { margin-top: 12px; }
.flabel { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .seg label { position: relative; margin: 0; font-weight: 400; cursor: pointer; }
.chip input, .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 14px; line-height: 1.3; transition: background .12s, border-color .12s; }
.chip:hover span { border-color: var(--brand); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.chip input:focus-visible + span, .seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg label + label { border-left: 1px solid var(--line); }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 9px 8px; font-size: 13.5px; line-height: 1.25; }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
@media (max-width: 600px) {
  .seg.seg3 { grid-template-columns: 1fr; }
  .seg.seg3 label + label { border-left: 0; border-top: 1px solid var(--line); }
}
.add-rem { display: block; width: 100%; margin-top: 14px; background: transparent; color: var(--brand); border: 2px dashed var(--line); padding: 12px; }
.add-rem:hover { border-color: var(--brand); background: var(--brand-soft); }
.submit-bar { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 4px 0 24px; }
.btn.big { padding: 14px 20px; font-size: 16px; }
@media (min-width: 601px) { .submit-bar { align-items: flex-end; } }
.radio.consent { margin-top: 14px; font-size: 14px; }
