/* Page calculateur — s'appuie sur les tokens et composants de site.css */

/* ─── HERO ── */
.calc-hero { padding-block: 72px 40px; position: relative; }
.calc-hero-inner { max-width: 760px; display: flex; flex-direction: column; gap: 20px; }
.calc-hero .tag { align-self: flex-start; margin-bottom: 0; }
.calc-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
.calc-hero h1 em { font-style: normal; color: var(--accent); }
.calc-lede { font-size: 1.05rem; line-height: 1.7; max-width: 60ch; }
.calc-assurances { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0; margin-top: 4px; }
.calc-assurances li { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 500; color: var(--fg-mid); }
.calc-assurances li::before { content: '✓'; font-weight: 700; color: var(--accent); }

/* ─── LAYOUT ── */
.calc-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 56px; align-items: start;
  padding-bottom: 88px;
}

/* ─── PARCOURS ── */
#calc { scroll-margin-top: 80px; }
.wizard { display: flex; flex-direction: column; min-width: 0; }
.wz-progress { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.wz-count { font-size: .85rem; font-weight: 600; color: var(--fg-mid); }
.wz-dots { display: flex; gap: 6px; list-style: none; padding: 0; }
.wz-dots li {
  flex: 1; min-width: 0; padding-top: 10px; position: relative;
  font-size: .75rem; font-weight: 500; line-height: 1.3; color: var(--fg-mid);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wz-dots li::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 2px; background: var(--border); }
.wz-dots li.done::before { background: var(--green); }
.wz-dots li.current::before { background: var(--accent); }
.wz-dots li.current { color: var(--fg); font-weight: 600; }

.wz-step { display: flex; flex-direction: column; gap: 22px; min-width: 0; animation: wz-in .35s cubic-bezier(.25, 1, .5, 1); }
@keyframes wz-in { from { transform: translateY(10px); } }
.wz-title {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem); line-height: 1.25; outline: none; text-wrap: balance;
}
.wz-intro { max-width: 62ch; margin-top: -8px; font-size: .88rem; }

/* Encadré « nous comprenons » */
.insight {
  font-size: .92rem; line-height: 1.65; color: var(--fg); max-width: 62ch;
  padding: 14px 18px; border-radius: 10px; background: var(--green-light);
}
.live {
  font-size: .9rem; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums;
  padding: 12px 0 0; border-top: 1px solid var(--border);
}

/* Valeurs courantes */
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; max-width: 520px; }
.chips button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  padding: 10px 14px; border-radius: 10px; background: var(--surface); color: var(--fg);
  border: 1.5px solid var(--field-border); transition: border-color .15s, background .15s;
}
.chips button strong { font-family: 'Sora', sans-serif; font-size: 1rem; font-variant-numeric: tabular-nums; }
.chips button span { font-size: .78rem; color: var(--fg-mid); }
.chips button:hover { border-color: var(--green); }
.chips button[aria-pressed="true"] { border-color: var(--green); background: var(--green-light); box-shadow: inset 0 0 0 1px var(--green); }
.control-narrow { max-width: 340px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px 24px; }
.field-wide { grid-column: 1 / -1; }
.field .opt { font-weight: 400; color: var(--fg-mid); }

.wz-nav { display: flex; gap: 12px; align-items: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.wz-nav .btn-primary { margin-left: auto; padding-inline: 32px; }

/* Récapitulatif */
.recap { display: flex; flex-direction: column; gap: 24px; }
.recap-title { font-size: 1.3rem; }
.recap-list { list-style: none; padding: 0; border-top: 1px solid var(--border); }
.recap-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.recap-list strong { display: block; font-size: .92rem; color: var(--fg); }
.recap-list span { font-size: .85rem; line-height: 1.5; color: var(--fg-mid); }
.recap-list button {
  flex: none; background: none; border: 0; cursor: pointer; padding: 8px 0;
  font: 600 .85rem 'Inter', sans-serif; color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}

/* Deux populations : expédiés / retrait sur place */
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.group {
  display: flex; flex-direction: column; gap: 20px; min-width: 0; padding: 22px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
}
.group-head { display: flex; gap: 14px; align-items: flex-start; }
.group-head svg { width: 22px; height: 22px; flex: none; margin-top: 2px; stroke: var(--accent); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.group-head h3 { font-size: 1.05rem; color: var(--fg); margin-bottom: 4px; }
.group-head p { font-size: .83rem; line-height: 1.55; color: var(--fg-mid); }
.total-line {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 14px 18px; border-radius: 10px; background: var(--green-light);
}
.total-line p { font-size: .92rem; color: var(--fg-mid); }
.total-line strong { font-family: 'Sora', sans-serif; font-size: 1.2rem; color: var(--fg); font-variant-numeric: tabular-nums; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .84rem; color: var(--fg-mid); }
.presets button {
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  font: 600 .84rem 'Inter', sans-serif; color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}

/* Hypothèses */
.calc-assumptions { border-top: 1px solid var(--border); padding-top: 28px; display: flex; flex-direction: column; gap: 20px; }
.calc-assumptions summary {
  cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--fg); list-style: none;
  display: flex; align-items: center; gap: 10px; width: fit-content;
}
.calc-assumptions summary::-webkit-details-marker { display: none; }
.calc-assumptions summary::before {
  content: ''; width: 8px; height: 8px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg); transition: transform .2s;
}
.calc-assumptions[open] summary::before { transform: rotate(45deg); }
.calc-assumptions summary span { font-weight: 400; color: var(--fg-mid); }
.calc-assumptions[open] > * + * { margin-top: 18px; }
.calc-assumptions { border-top: 0; padding-top: 0; }
.reset-btn {
  align-self: flex-start; background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: 600 .85rem 'Inter', sans-serif; color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}

/* ─── RÉSULTAT ── */
.calc-result {
  position: sticky; top: 88px;
  background: var(--green); color: #fff; border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.res-label { font-family: 'Inter', sans-serif; font-size: .9rem; font-weight: 600; letter-spacing: 0; color: rgba(255,255,255,.9); line-height: 1.4; }
.res-figure {
  font-family: 'Sora', sans-serif; font-weight: 700; color: #fff; line-height: 1.05;
  font-size: clamp(2.3rem, 4vw, 3rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.res-figure small { font-size: 1rem; font-weight: 600; opacity: .9; }
.res-sub { color: rgba(255,255,255,.9); font-size: .92rem; line-height: 1.55; }
.res-rows { margin: 8px 0 4px; border-top: 1px solid rgba(255,255,255,.28); }
.res-rows > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.18); }
.res-rows dt { font-size: .85rem; color: rgba(255,255,255,.9); line-height: 1.4; }
.res-rows dd { font-size: .92rem; font-weight: 600; color: #fff; text-align: right; font-variant-numeric: tabular-nums; margin-left: auto; min-width: 0; overflow-wrap: anywhere; }
.res-plan { font-size: .72rem; font-weight: 600; padding: 2px 8px; margin-left: 4px; border-radius: 100px; background: rgba(0,0,0,.22); color: #fff; white-space: nowrap; }

.btn-white {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px;
  background: #fff; color: var(--green); font-weight: 600; font-size: .92rem;
  padding: 13px 24px; border-radius: 8px; transition: transform .15s, background .2s;
}
.btn-white:hover { background: var(--green-light); transform: translateY(-1px); }
.btn-white:focus-visible, .res-link:focus-visible, .res-note a:focus-visible { outline-color: #fff; }
.res-link {
  background: none; border: 0; cursor: pointer; padding: 6px 0; color: #fff;
  font: 600 .85rem 'Inter', sans-serif; text-decoration: underline; text-underline-offset: 3px; align-self: center;
}
.res-note { font-size: .78rem; line-height: 1.55; color: rgba(255,255,255,.88); text-align: center; }
.res-note a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

.calc-result.is-low .res-figure { font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.2; }

/* Facture en cours */
.bill-lines { list-style: none; padding: 0; margin: 6px 0 2px; border-top: 1px solid rgba(255,255,255,.28); }
.bill-lines li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.18); animation: bill-in .4s cubic-bezier(.25, 1, .5, 1); }
@keyframes bill-in { from { transform: translateY(6px); } }
.bl-name { display: flex; flex-direction: column; gap: 2px; font-size: .88rem; color: #fff; font-weight: 500; }
.bl-name small { font-size: .74rem; font-weight: 400; color: rgba(255,255,255,.88); }
.bl-amt { font-size: .92rem; font-weight: 600; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
#bill, #savings { display: flex; flex-direction: column; gap: 14px; }

/* ─── DÉTAIL POSTE PAR POSTE ── */
.calc-detail { padding-block: 80px; background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 40px; }
.detail-head h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
.legend { display: flex; gap: 20px; list-style: none; padding: 0; font-size: .85rem; font-weight: 500; color: var(--fg-mid); }
.legend li { display: flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-now { background: var(--fg-mid); }
.sw-with { background: var(--green); }

.cmp { display: flex; flex-direction: column; }
.cmp-row { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 32px; align-items: center; padding: 22px 0; border-top: 1px solid var(--border); }
.cmp-row:first-child { border-top: 0; }
.cmp-name { display: flex; flex-direction: column; gap: 4px; }
.cmp-name strong { font-size: .98rem; color: var(--fg); }
.cmp-name span { font-size: .82rem; line-height: 1.5; color: var(--fg-mid); }
.cmp-lines { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cmp-line { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 16px; align-items: center; }
.cmp-bar { height: 12px; border-radius: 6px; background: var(--green-light); overflow: hidden; }
.cmp-bar i { display: block; height: 100%; width: 100%; border-radius: 6px; transform-origin: left center; transform: scaleX(var(--w, 0)); transition: transform .55s cubic-bezier(.25, 1, .5, 1); }
.cmp-bar i.now { background: var(--fg-mid); }
.cmp-bar i.with { background: var(--green); }
.cmp-val { font-size: .88rem; font-weight: 600; color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere; }
.cmp-total {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 8px 40px;
  margin-top: 12px; padding-top: 24px; border-top: 2px solid var(--fg);
  font-size: .9rem; color: var(--fg-mid);
}
.cmp-total > span { margin-right: auto; font-weight: 600; color: var(--fg); }
.cmp-total strong { font-family: 'Sora', sans-serif; font-size: 1.25rem; color: var(--fg); font-variant-numeric: tabular-nums; }
.cmp-total strong:last-child { color: var(--accent); }
.cmp-total em { font-family: 'Inter', sans-serif; font-style: normal; font-weight: 500; font-size: .8rem; color: var(--fg-mid); }

/* ─── LEAD ── */
.calc-report { padding-block: 96px; }
.report-grid { display: grid; grid-template-columns: 1fr minmax(0, 480px); gap: 72px; align-items: start; }
.report-copy { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 112px; }
.report-copy h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.report-copy p { font-size: 1rem; line-height: 1.7; max-width: 46ch; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.report-card form { display: flex; flex-direction: column; gap: 18px; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: .82rem; line-height: 1.5; color: var(--fg-mid); cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--accent); cursor: pointer; }
.report-card .btn-primary { justify-content: center; }
.report-alt { font-size: .85rem; text-align: center; }
.report-alt a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.report-done { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; outline: none; }
.done-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.report-done h3 { font-size: 1.3rem; }
.report-done p { font-size: .95rem; line-height: 1.65; }
.report-done strong { color: var(--fg); overflow-wrap: anywhere; }

/* ─── MÉTHODE ── */
.calc-method { padding-block: 80px; background: var(--bg-alt); border-top: 1px solid var(--border); }
.calc-method h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); margin-bottom: 40px; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 40px; }
.method-grid h3 { font-size: 1rem; margin-bottom: 14px; }
.method-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.method-list li { font-size: .88rem; line-height: 1.65; color: var(--fg-mid); }
.method-list strong { color: var(--fg); font-weight: 600; }

/* ─── BARRE MOBILE ── */
.calc-bar {
  position: fixed; inset: auto 0 0 0; z-index: 90;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--green); color: #fff;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .3s cubic-bezier(.25, 1, .5, 1);
}
.calc-bar.is-visible { transform: none; }
.calc-bar .bar-label { display: block; font-size: .72rem; color: rgba(255,255,255,.9); }
.calc-bar strong { font-family: 'Sora', sans-serif; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.calc-bar .btn-white { margin-top: 0; padding: 10px 18px; }

/* ─── RESPONSIVE ── */
@media (max-width: 980px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-bottom: 64px; }
  .calc-result { position: static; }
  .calc-bar { display: flex; }
  #calc[data-mode="results"] .calc-result { order: -1; }
  .report-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .report-copy { position: static; }
  body { padding-bottom: 72px; }
}
@media (max-width: 640px) {
  .calc-hero { padding-block: 48px 24px; }
  .cmp-row { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px 0; }
  .cmp-line { grid-template-columns: minmax(0, 1fr) 112px; gap: 12px; }
  .report-card { padding: 24px 20px; }
  .calc-result { padding: 24px 20px; }
  .wz-dots li { font-size: 0; }
  .wz-nav .btn-primary { padding-inline: 24px; }
  .calc-report, .calc-detail, .calc-method { padding-block: 56px; }
  .cmp-total { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-bar i, .calc-bar, .calc-assumptions summary::before, .btn-white { transition: none; }
}

@media print {
  nav, .calc-bar, .calc-assumptions, .res-link, .btn-white, .calc-report, .cta-final, footer { display: none !important; }
  .calc-layout { grid-template-columns: 1fr; }
  .calc-result { position: static; background: none; color: #000; border: 1px solid #000; }
  .calc-result * { color: #000 !important; }
}

/* ─── RAPPORT PAR EMAIL ET RAPPEL ── */
.report-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.report-card-title { font-size: 1.15rem; margin-bottom: 14px; }
.report-card-intro { margin: -6px 0 18px; font-size: .88rem; }
.report-card #report-ready { display: flex; flex-direction: column; gap: 16px; }
.report-card #report-ready .hint { font-size: .9rem; line-height: 1.6; }
.report-card #report-ready strong { color: var(--fg); overflow-wrap: anywhere; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 600 .88rem 'Inter', sans-serif; color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.report-card .btn-ghost { align-self: flex-start; margin-top: 4px; }
.report-card .field-error { margin-top: 12px; }
#lead-known { font-size: .9rem; color: var(--fg); font-weight: 600; }
.field > .consent { font-weight: 400; font-size: .85rem; }

.res-rows dd small { display: block; margin-top: 2px; font-size: .72rem; font-weight: 500; color: rgba(255,255,255,.9); white-space: normal; }
