/* ---------------------------------------------------------------
   ameli — espace de remboursement
   Système : aplats, échelle d'espacement unique, échelle
   typographique resserrée, deux colonnes institutionnelles,
   états explicites. Aucune ombre décorative.
--------------------------------------------------------------- */

:root {
  --blue-900: #04213e;
  --blue-800: #062f57;
  --blue: #0a4b8c;
  --blue-600: #0c5aa8;
  --blue-050: #f1f5f9;
  --blue-100: #dde8f2;
  --blue-200: #c4d7e8;

  --ink: #111a23;
  --ink-2: #29343f;
  --muted: #566573;
  --muted-2: #78868f;

  --line: #dde3ea;
  --line-2: #c9d2dc;
  --bg: #eef1f5;
  --white: #fff;

  --ok: #157347;
  --err: #b3261e;
  --err-bg: #fdf4f3;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 30px;
  --s7: 42px;
  --s8: 58px;

  --r-sm: 5px;
  --r: 7px;
  --r-lg: 11px;
  --ring: 0 0 0 3px rgba(12, 90, 168, .2);

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 25px;
  --fs-3xl: 30px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-base)/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--blue-600); }
img { max-width: 100%; display: block; }
b, strong { font-weight: 650; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* ---------- En-tête ---------- */

.masthead { background: var(--blue); color: #fff; }

.masthead__in {
  max-width: 1080px; margin: 0 auto; padding: 0 var(--s5);
  height: 62px; display: flex; align-items: center; gap: var(--s6);
}

.masthead__brand { display: flex; align-items: center; text-decoration: none; }
.masthead__logo { height: 27px; width: auto; filter: brightness(0) invert(1); }

.masthead__nav {
  display: flex; gap: var(--s5); margin-left: auto;
  font-size: var(--fs-sm); color: rgba(255, 255, 255, .74);
}
.masthead__nav .is-on { color: #fff; font-weight: 600; }
.masthead__nav .is-on::after {
  content: ""; display: block; height: 2px; background: #fff;
  margin-top: 3px; border-radius: 1px;
}

.masthead__right { display: flex; align-items: center; gap: var(--s2); }
.masthead__lock { width: 15px; height: 15px; color: rgba(255, 255, 255, .85); flex: none; }
.masthead__org { font-size: var(--fs-sm); font-weight: 600; line-height: 1.15; }
.masthead__org em {
  display: block; font-style: normal; font-weight: 400;
  font-size: var(--fs-xs); color: rgba(255, 255, 255, .62);
}

/* ---------- Fil d'Ariane ---------- */

.subbar { background: #fff; border-bottom: 1px solid var(--line); }
.subbar__in {
  max-width: 1080px; margin: 0 auto; padding: 0 var(--s5); min-height: 44px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}
.crumbs {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); color: var(--muted-2); flex-wrap: wrap;
}
.crumbs i { font-style: normal; opacity: .55; }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.subbar__ref { font-size: var(--fs-xs); color: var(--muted-2); white-space: nowrap; }
.subbar__ref span { color: var(--ink-2); font-weight: 600; }

/* ---------- Gabarit ---------- */

.page { padding: var(--s7) var(--s5) var(--s8); }
.shell {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 336px minmax(0, 1fr); gap: var(--s6);
  align-items: start;
}

/* ---------- Colonne bleue ---------- */

.aside { background: var(--blue); color: #fff; padding: var(--s6) var(--s5); border-radius: var(--r-lg); }

.aside__eyebrow {
  font-size: var(--fs-xs); letter-spacing: .07em; text-transform: uppercase;
  color: rgba(255, 255, 255, .62); font-weight: 600; margin-bottom: var(--s3);
}
.aside__title { font-size: var(--fs-xl); line-height: 1.28; font-weight: 650; letter-spacing: -.01em; }
.aside__title span { display: inline; }
.aside__intro { margin-top: var(--s3); font-size: var(--fs-sm); line-height: 1.6; color: rgba(255, 255, 255, .8); }

.dossier { margin-top: var(--s5); border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--r); background: rgba(0, 0, 0, .14); }
.dossier__head {
  padding: var(--s2) var(--s3); font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700; color: rgba(255, 255, 255, .72);
  border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.dossier dl { padding: var(--s3); display: grid; gap: var(--s3); }
.dossier dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.dossier dt { font-size: var(--fs-xs); color: rgba(255, 255, 255, .62); }
.dossier dd { font-size: var(--fs-sm); font-weight: 600; text-align: right; }
.dossier__amount { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.dossier__delay { color: #b9e4c9; }

.aside__list { margin-top: var(--s5); display: grid; gap: var(--s2); }
.aside__list li {
  display: flex; gap: var(--s2); align-items: flex-start;
  font-size: var(--fs-sm); color: rgba(255, 255, 255, .84); line-height: 1.45;
}
.aside__list svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: #8dd3a9; }

.aside__foot {
  margin-top: var(--s5); padding-top: var(--s3);
  border-top: 1px solid rgba(255, 255, 255, .16); font-size: 11px; color: rgba(255, 255, 255, .55);
}

/* ---------- Colonne formulaire ---------- */

.col {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5) var(--s6) var(--s6);
}

.col__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding-bottom: var(--s3); border-bottom: 1px solid var(--line);
}
.col__title { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); }
.col__esc { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ok); font-weight: 600; }
.col__esc svg { width: 13px; height: 13px; }

/* ---------- Barre d'étapes ---------- */

.stepper { display: grid; grid-template-columns: repeat(3, 1fr); margin: var(--s4) 0 var(--s5); gap: var(--s2); counter-reset: s; }
.stepper li {
  display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs);
  color: var(--muted-2); padding-bottom: var(--s3); border-bottom: 2px solid var(--line);
}
.stepper i {
  width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue-050); color: var(--muted); font-style: normal;
  font-size: 11px; font-weight: 700; border: 1px solid var(--line-2);
}
.stepper .is-current { color: var(--blue); font-weight: 650; border-color: var(--blue); }
.stepper .is-current i { background: var(--blue); color: #fff; border-color: var(--blue); }
.stepper .is-done { color: var(--ok); border-color: var(--ok); }
.stepper .is-done i { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- Écrans ---------- */

.screen { display: none; }
.screen.is-active { display: block; animation: in .26s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.screen h2 { font-size: var(--fs-2xl); line-height: 1.22; letter-spacing: -.02em; font-weight: 700; }
.intro { margin-top: var(--s2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }

form { margin-top: var(--s5); display: grid; gap: var(--s4); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.row--cp { grid-template-columns: 116px 1fr; }

/* ---------- Champs ---------- */

.field { display: grid; gap: 6px; align-content: start; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: var(--s2); }

.ctl { position: relative; }

.ctl input, .ctl select {
  width: 100%; height: 44px; padding: 0 var(--s3);
  font: inherit; font-size: var(--fs-base); color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--r);
  transition: border-color .14s, box-shadow .14s;
  appearance: none;
}
.ctl select { padding-right: var(--s6); cursor: pointer; }
.ctl__chev { position: absolute; right: var(--s3); top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }

.ctl input::placeholder { color: var(--muted-2); opacity: .75; }
.ctl input:hover, .ctl select:hover { border-color: var(--muted-2); }
.ctl input:focus, .ctl select:focus { outline: none; border-color: var(--blue-600); box-shadow: var(--ring); }
.ctl input:disabled { background: var(--blue-050); color: var(--muted); }

.hint { font-size: var(--fs-xs); color: var(--muted-2); }

.err {
  display: none; gap: 5px; align-items: flex-start;
  font-size: var(--fs-xs); color: var(--err); font-weight: 500;
}
.err svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.field.has-error .err { display: flex; }
.field.has-error .ctl input, .field.has-error .ctl select { border-color: var(--err); background: var(--err-bg); }
.field.has-error .ctl input:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, .16); }

.brand { display: none; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--blue); background: var(--blue-050); border: 1px solid var(--blue-100); padding: 1px 6px; border-radius: 3px; }
.brand.on { display: inline-block; }

/* ---------- Aperçu de carte ---------- */

.cardprev {
  margin-top: var(--s4); padding: var(--s3) var(--s4) var(--s4);
  border-radius: var(--r-lg); color: #fff; background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  display: grid; gap: var(--s4); max-width: 330px;
}
.cardprev__top { display: flex; align-items: center; justify-content: space-between; }
.cardprev__chip { width: 30px; height: 22px; border-radius: 4px; background: linear-gradient(150deg, #e7d5a3, #c9ae6b); }
.cardprev__net { font-size: 11px; font-weight: 700; letter-spacing: .09em; color: rgba(255, 255, 255, .85); }
.cardprev__num { font-size: var(--fs-lg); letter-spacing: .09em; font-variant-numeric: tabular-nums; }
.cardprev__bot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255, 255, 255, .82); }
.cardprev__name { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detect { margin-top: var(--s2); font-size: var(--fs-xs); color: var(--muted); min-height: 17px; }
.detect b { color: var(--blue-800); }

/* ---------- Boutons ---------- */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; height: 46px; padding: 0 var(--s4); border: 1px solid var(--blue);
  border-radius: var(--r); background: var(--blue); color: #fff;
  font: inherit; font-size: var(--fs-base); font-weight: 650; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.btn:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn:active { background: var(--blue-800); }
.btn:disabled { opacity: .72; cursor: progress; }

.btn--ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); width: auto; flex: 0 0 auto; padding: 0 var(--s5); }
.btn--ghost:hover { background: var(--blue-050); border-color: var(--muted-2); color: var(--ink); }

.btn-row { display: flex; gap: var(--s3); }
.btn-row .btn:not(.btn--ghost) { flex: 1; }

.spin {
  display: none; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: sp .62s linear infinite;
}
.btn.loading .spin { display: block; }
@keyframes sp { to { transform: rotate(1turn); } }

/* ---------- Encarts ---------- */

.note {
  display: flex; gap: var(--s2); align-items: flex-start;
  margin-top: var(--s5); padding-top: var(--s3); border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--muted); line-height: 1.5;
}
.note svg { width: 15px; height: 15px; flex: none; margins: 0; color: var(--muted-2); margin-top: 1px; }

.recap {
  display: flex; gap: var(--s3); align-items: center;
  margin-top: var(--s4); padding: var(--s3); border-radius: var(--r);
  background: var(--blue-050); border: 1px solid var(--blue-100);
  font-size: var(--fs-xs); color: var(--muted); line-height: 1.45;
}
.recap svg { width: 22px; height: 22px; flex: none; color: var(--blue); }
.recap strong { display: block; font-size: var(--fs-sm); color: var(--ink); }

/* ---------- Succès ---------- */

.done { text-align: center; padding-top: var(--s4); }
.done__mark {
  width: 52px; height: 52px; margin: 0 auto var(--s4); border-radius: 50%;
  background: var(--ok); display: grid; place-items: center;
  animation: pop .34s cubic-bezier(.3, 1.5, .6, 1);
}
.done__mark svg { width: 26px; height: 26px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.done h2 { font-size: var(--fs-2xl); }
.done p { margin-top: var(--s3); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.done p strong { color: var(--ink); }

.done__ref {
  margin: var(--s5) auto 0; max-width: 300px; padding: var(--s3);
  border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--blue-050);
  display: grid; gap: 3px;
}
.done__ref span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.done__ref strong { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--fs-sm); color: var(--ink); }

.bar { height: 4px; border-radius: 2px; background: var(--blue-100); margin: var(--s4) auto 0; max-width: 300px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); transform: scaleX(.12); transform-origin: left; transition: transform 2.2s cubic-bezier(.2, .7, .2, 1); }

.done__steps { font-size: 11px; color: var(--muted-2); }
.done__act { margin-top: var(--s4); }
.done__act a { font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Pied ---------- */

.foot { border-top: 1px solid var(--line); background: #fff; }
.foot__in {
  max-width: 1080px; margin: 0 auto; padding: var(--s4) var(--s5);
  display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--muted-2);
}

/* ---------- Adaptations ---------- */

@media (max-width: 900px) {
  .masthead__nav { display: none; }
  .masthead__in { gap: var(--s4); }
  .page { padding: var(--s5) var(--s4) var(--s7); }
  .shell { grid-template-columns: 1fr; gap: 0; }
  .aside { border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s4); }
  .aside__intro, .aside__list, .aside__foot { display: none; }
  .aside__title { font-size: var(--fs-lg); }
  .dossier { margin-top: var(--s3); }
  .dossier dl { grid-template-columns: 1fr 1fr; }
  .dossier dl > div { display: grid; gap: 1px; }
  .dossier dd { text-align: left; }
  .dossier__amount { font-size: var(--fs-base); }
  .col { border-radius: 0 0 var(--r-lg) var(--r-lg); border-top: 0; padding: var(--s4) var(--s4) var(--s5); }
  .screen h2, .done h2 { font-size: var(--fs-xl); }
  .stepper { margin: var(--s3) 0 var(--s4); }
  .stepper span { font-size: 11px; }
  .cardprev { max-width: none; }
  .subbar__ref { display: none; }
}

@media (max-width: 430px) {
  .row, .row--cp { grid-template-columns: 1fr; }
  .btn-row .btn--ghost { padding: 0 var(--s4); }
  .crumbs { font-size: 11px; }
  .masthead__org em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
