:root {
  --bg: #fbf8f2;
  --surface: #ffffff;
  --surface-2: #f4efe5;
  --ink: #1d2a24;
  --muted: #66736c;
  --line: #e6dfd2;
  --brand: #2f5d50;
  --brand-ink: #ffffff;
  --brand-soft: #e3eee9;
  --amber: #e39b2d;
  --amber-soft: #fbefd9;
  --good: #2e7d4f;
  --bad: #c2412d;
  --bad-soft: #fbe7e3;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(29 42 36 / .06), 0 6px 24px rgb(29 42 36 / .06);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 8px; font: 700 1.3rem var(--serif); color: var(--ink); text-decoration: none; }
.logo svg { width: 30px; height: 30px; }

/* Boutons & formulaires */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); padding: 10px 18px; border-radius: 999px; font: 600 .95rem var(--sans);
  cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; white-space: nowrap; }
.btn:hover { background: #244a40; }
.btn:active { transform: translateY(1px); }
.btn.amber { background: var(--amber); color: #2a1a00; }
.btn.amber:hover { background: #d18a1f; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: #efc5bd; }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.lg { padding: 14px 26px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }
.linkbtn.bad { color: var(--bad); }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
input, select { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 42px; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: auto; min-height: 0; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.grid-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.grid-form .wide { grid-column: span 2; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.25rem; }

/* Messages */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--amber-soft); color: #6b4300; }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
td input, td select { min-height: 36px; padding: 6px 10px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.revenu { background: #e2f1e7; color: var(--good); }
.pill.epargne { background: var(--amber-soft); color: #8a5a00; }
.pill.premium { background: var(--amber); color: #2a1a00; }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.over > span { background: var(--bad); }
.bar.gold > span { background: var(--amber); }

/* ---------- Site public ---------- */
.site-header { position: sticky; top: 0; z-index: 10; background: rgb(251 248 242 / .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.site-header nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.site-header nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
@media (max-width: 640px) { .site-header nav .hide-sm { display: none; } }

.hero { padding: 64px 0 40px; display: grid; gap: 40px; grid-template-columns: 1.1fr 1fr; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 10px; }
.eyebrow { display: inline-block; font-weight: 700; color: #8a5a00; background: var(--amber-soft); border-radius: 99px; padding: 4px 12px; font-size: .82rem; margin-bottom: 16px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 36px; } }

.mock { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 60px rgb(29 42 36 / .14); padding: 18px; }
.mock .kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.mock .kpi { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.mock .kpi b { display: block; font: 700 1.2rem var(--serif); }
.mock .line { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: .9rem; }

section.block { padding: 56px 0; }
section.alt { background: var(--surface-2); }
.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 28px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature .ico { font-size: 1.6rem; margin-bottom: 8px; }
.steps { counter-reset: s; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 24px; }
.steps > div { counter-increment: s; }
.steps > div::before { content: counter(s); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 10px; }

.pricing { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 28px; max-width: 820px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; position: relative; }
.plan.featured { border: 2px solid var(--brand); }
.plan .price { font: 700 2.2rem var(--serif); }
.plan ul { padding: 0; list-style: none; margin: 16px 0 22px; }
.plan li { padding: 5px 0 5px 26px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.plan li.no { color: var(--muted); }
.plan li.no::before { content: "–"; color: var(--muted); }
.plan .tag { position: absolute; top: -12px; right: 20px; }

details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
details.faq summary { font-weight: 600; cursor: pointer; }
details.faq p { margin: 10px 0 0; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--muted); }

.auth { max-width: 420px; margin: 48px auto; padding: 0 16px; }
.prose { max-width: 760px; padding: 40px 16px 60px; margin: 0 auto; }
.prose h2 { font-size: 1.3rem; margin-top: 1.6em; }

/* ---------- Application ---------- */
.app-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .logo { margin: 0 8px 18px; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.sidebar a.nav:hover { background: var(--surface-2); }
.sidebar a.nav.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sidebar .bottom { margin-top: auto; }
.main { padding: 28px clamp(16px, 3vw, 40px) 100px; min-width: 0; max-width: 1150px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.8rem; margin: 0; }
.monthnav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.monthnav a { text-decoration: none; padding: 4px 10px; border-radius: 99px; color: var(--ink); }
.monthnav a:hover { background: var(--surface-2); }
.monthnav strong { padding: 0 8px; text-transform: capitalize; min-width: 9em; text-align: center; }

.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi-card .label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .value { font: 700 1.55rem var(--serif); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-card.hl { background: var(--brand); color: #fff; border-color: var(--brand); }
.kpi-card.hl .label { color: #cfe3db; }
.two-col { display: grid; gap: 16px; grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1000px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .two-col { grid-template-columns: 1fr; } }

.trial-banner { background: var(--amber-soft); color: #6b4300; padding: 10px 16px; border-radius: 10px; margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.locked { text-align: center; padding: 40px 20px; }
.locked .ico { font-size: 2.4rem; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

.mobile-nav { display: none; }
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-top: 16px; }
  .mobile-top { display: flex !important; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav a { text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; padding: 4px 0; }
  .mobile-nav a span { display: block; font-size: 1.25rem; }
  .mobile-nav a.active { color: var(--brand); font-weight: 700; }
  .grid-form .wide { grid-column: auto; }
}
.mobile-top { display: none; }

/* ---------- Pages de contenu (v2) ---------- */
.center { text-align: center; }
.h3 { font-family: var(--serif); font-size: 1.15rem; line-height: 1.2; }
.warn { color: #9a5b00; }
.narrow { max-width: 860px; }
.page-hero { text-align: center; padding: 36px 0 28px; }
.page-hero.left { text-align: left; padding: 20px 0 20px; }
.page-hero .lead { font-size: 1.1rem; color: var(--muted); max-width: 40em; margin-left: auto; margin-right: auto; }
.page-hero.left .lead { margin-left: 0; }
.crumbs { font-size: .85rem; color: var(--muted); padding-top: 18px; }
.crumbs a { color: var(--muted); }

.footer-grid { display: grid; gap: 24px; grid-template-columns: 1.4fr repeat(4, 1fr); align-items: start; }
.footer-grid h4 { margin: 0 0 8px; color: var(--ink); font-size: .9rem; }
.footer-grid a { display: block; padding: 3px 0; text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

.mock .kpi.hl { background: var(--brand); color: #fff; }
.pains { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 24px; }
.pain { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.pain .quote { font: 600 1.15rem/1.3 var(--serif); margin-bottom: 8px; }
.turn { margin-top: 28px; font-size: 1.15rem; font-weight: 600; color: var(--brand); max-width: 40em; }
.steps .pill { margin-top: 4px; }

table.compare th, table.compare td { text-align: center; }
table.compare th:first-child, table.compare td:first-child { text-align: left; }
table.compare .us { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
table.compare thead .us { color: var(--brand); font-size: .85rem; }

a.link-card { color: inherit; text-decoration: none; transition: transform .1s, box-shadow .15s; }
a.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfdcd6; }

.billing-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-top: 10px; }
.billing-toggle button { border: 0; background: transparent; font: 600 .9rem var(--sans); padding: 8px 16px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.billing-toggle button.active { background: var(--brand); color: #fff; }

/* Calculateurs */
.tool { margin-bottom: 24px; }
.calc fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.calc legend { font-weight: 700; margin-bottom: 8px; color: var(--brand); }
.result { margin-top: 18px; padding: 18px; background: var(--surface-2); border-radius: 12px; }
.result-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.result-grid > div { background: var(--surface); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.result-grid .label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.result-grid b { font: 700 1.35rem var(--serif); font-variant-numeric: tabular-nums; }
.result-grid .big b { font-size: 1.7rem; }
.result-grid .big.good b { color: var(--good); }
.result-grid .big.bad b { color: var(--bad); }
.result-grid .big.warn b { color: #9a5b00; }
.stack-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin-bottom: 14px; background: var(--line); }
.stack-bar .seg0 { background: var(--brand); } .stack-bar .seg1 { background: var(--amber); } .stack-bar .seg2 { background: var(--good); }
.gain { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #e2f1e7; }

.cta-box { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--amber-soft);
  border: 1px solid #f1d9ad; border-radius: var(--radius); padding: 18px 20px; margin: 28px 0; }
.prose-content { font-size: 1.02rem; line-height: 1.7; }
.prose-content h2 { font-size: 1.45rem; margin-top: 1.8em; }
.prose-content li { margin-bottom: 6px; }
.related { padding: 32px 0 60px; }
.related h2 { font-size: 1.3rem; }

.download { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.download .dl-icon { font-size: 2.4rem; }
.download .btn { margin-left: auto; }
ul.checklist { list-style: none; padding: 0; margin: 18px 0 0; }
ul.checklist li { padding: 5px 0 5px 28px; position: relative; }
ul.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }

/* Prise en main (appli) */
.onboard { border: 2px solid var(--brand-soft); }
.onboard ol { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.onboard li { display: flex; gap: 10px; align-items: center; }
.onboard .tick { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; border: 2px solid var(--line); font-size: .75rem; flex: none; }
.onboard li.done .tick { background: var(--good); border-color: var(--good); color: #fff; }
.onboard li.done span.txt { color: var(--muted); text-decoration: line-through; }
.progress-txt { font-size: .85rem; color: var(--muted); }

/* Page Budget (saisie en direct) */
.save-status { font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.save-status.good { color: var(--good); font-weight: 600; }
.save-status.bad { color: var(--bad); font-weight: 600; }
.kpi-card.hl.over { background: var(--bad); border-color: var(--bad); }
.split-card { margin-bottom: 16px; }
.split-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.split-bar span { display: block; height: 100%; transition: width .25s ease; }
.split-bar .seg-dep { background: var(--brand); }
.split-bar .seg-ep { background: var(--amber); }
.split-bar .seg-left { background: #b9d3ca; }
.split-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.dep { background: var(--brand); } .dot.ep { background: var(--amber); } .dot.left { background: #b9d3ca; }
.budget-notice { margin: 12px 0 0; font-weight: 500; }
.budget-notice.bad { color: var(--bad); }
.budget-group { margin-bottom: 16px; }
.budget-table td:first-child { width: 42%; }
.money-input { text-align: right; max-width: 140px; margin-left: auto; display: block; }
input.invalid { border-color: var(--bad); background: var(--bad-soft); }
.actual-cell { color: var(--muted); white-space: nowrap; }
.actual-cell.bad { color: var(--bad); font-weight: 600; }
@media (max-width: 640px) { .hide-sm { display: none; } .budget-table td:first-child { width: auto; } }

/* ---------- Ajout rapide (v5) ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.qa { display: grid; gap: 14px; }
.qa-types { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 4px; }
.qa-types label { margin: 0; }
.qa-types input { position: absolute; opacity: 0; pointer-events: none; }
.qa-types span { display: block; text-align: center; padding: 8px 4px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.qa-types input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.qa-types input:focus-visible + span { outline: 2px solid var(--brand); }
.qa-amount { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid var(--line); margin: 0; }
.qa-amount:focus-within { border-color: var(--brand); }
.qa-amount input { border: 0; background: transparent; font: 700 2.2rem var(--serif); padding: 4px 0; min-height: 0; outline: none; font-variant-numeric: tabular-nums; }
.qa-amount span { font: 700 1.6rem var(--serif); color: var(--muted); }
.qa-cats { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; margin: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font: 500 .88rem var(--sans); color: var(--ink); cursor: pointer; text-decoration: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.chip[hidden] { display: none; }
.chip-link { color: var(--muted); border-style: dashed; }
.chip:hover { border-color: var(--brand); }
.qa-extra { display: grid; gap: 8px; grid-template-columns: 1fr auto; }
.qa-date { display: flex; gap: 6px; align-items: center; }
.qa-date input { width: auto; }
@media (max-width: 640px) { .qa-extra { grid-template-columns: 1fr; } .qa-date input { flex: 1; } }
.qa-error { margin: 0; color: var(--bad); font-weight: 600; }
.dash-top { margin-bottom: 16px; }

.add-btn { margin: 0 0 14px; }
.qa-modal { border: 0; border-radius: 18px; padding: 20px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgb(0 0 0 / .25); }
.qa-modal::backdrop { background: rgb(29 42 36 / .45); }
.qa-modal-head { margin-bottom: 12px; }
.mobile-nav .fab { display: none; }
@media (max-width: 820px) {
  .qa-modal { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .mobile-nav .fab { display: block; justify-self: center; width: 54px; height: 54px; margin-top: -22px; border-radius: 50%; border: 0; background: var(--brand);
    color: #fff; font-size: 1.7rem; line-height: 1; box-shadow: 0 6px 18px rgb(47 93 80 / .45); cursor: pointer; }
}

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 820px) { .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .2); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast span { flex: 1; }
.toast.leaving { opacity: 0; transition: opacity .4s; }
.toast-action { background: none; border: 0; color: var(--amber); font: 700 .9rem var(--sans); cursor: pointer; padding: 4px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.mobile-menu { position: relative; }
.mobile-menu summary { list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 8px; min-width: 210px; display: grid; }
.mobile-menu-panel a, .mobile-menu-panel .linkbtn { padding: 10px 12px; text-decoration: none; color: var(--ink); text-align: left; border-radius: 8px; }
.mobile-menu-panel a:hover { background: var(--surface-2); }

/* Liste des mouvements */
.tx-layout { display: grid; gap: 16px; grid-template-columns: minmax(300px, 420px) 1fr; align-items: start; }
.tx-layout > .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .tx-layout { grid-template-columns: 1fr; } }
.tx-totals { display: inline-flex; gap: 12px; }
.tx-day { font: 700 .8rem var(--sans); color: var(--muted); margin: 16px 0 4px; }
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; color: inherit; text-decoration: none; }
.tx-row:hover { background: var(--surface-2); }
.tx-main { flex: 1; display: grid; }

/* Assistant de démarrage */
.setup { max-width: 640px; margin: 0 auto; padding: 0 16px 60px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.setup-steps { list-style: none; padding: 0; margin: 8px 0 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.setup-steps li { display: grid; justify-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
.setup-steps .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.setup-steps .current { color: var(--ink); font-weight: 700; }
.setup-steps .current .n { border-color: var(--brand); color: var(--brand); }
.setup-steps .done .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px, 4vw, 32px); box-shadow: var(--shadow); }
.setup-card h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
.setup-card .lead { color: var(--muted); }
.setup-rows { display: grid; gap: 4px; margin: 18px 0; }
.setup-row { display: grid; grid-template-columns: 1fr 210px; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setup-row > label:first-child { margin: 0; font-size: 1rem; font-weight: 600; }
.setup-input { display: flex; align-items: center; gap: 8px; }
.setup-input input { text-align: right; font-weight: 600; font-size: 1.05rem; }
.setup-input span { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.setup-row .paid { grid-column: 1 / -1; justify-self: end; font-size: .85rem; margin: 0; color: var(--muted); }
@media (max-width: 520px) { .setup-row { grid-template-columns: 1fr; } .setup-row .paid { justify-self: start; } }
.setup-goal { border: 1px dashed var(--line); border-radius: 14px; padding: 14px 16px; margin: 18px 0 0; }
.setup-goal legend { font-weight: 700; padding: 0 6px; }
.setup-live { display: flex; justify-content: space-between; align-items: baseline; background: var(--brand-soft); color: var(--brand);
  border-radius: 12px; padding: 12px 16px; margin: 20px 0 0; font-weight: 600; }
.setup-live strong { font: 700 1.4rem var(--serif); }
.setup-live.over { background: var(--bad-soft); color: var(--bad); }
.setup-live.muted-live { opacity: .6; }
.setup-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.setup-actions.center { justify-content: center; }
.setup-owl { font-size: 3rem; }
.setup-summary { display: grid; margin: 20px auto; max-width: 360px; text-align: left; }
.setup-summary div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setup-summary dt { color: var(--muted); }
.setup-summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.setup-summary .total { border-bottom: 0; font-size: 1.1rem; }
.setup-summary .total dt { color: var(--ink); font-weight: 700; }
/* Radios masqués des pastilles : ils ne doivent pas hériter de la largeur des champs */
.chip, .qa-types label { position: relative; }
.chip input, .qa-types input { width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; border: 0; left: 0; top: 0; }
/* Mobile : les colonnes de grille ne doivent jamais dépasser l'écran */
.two-col > *, .tx-layout > *, .kpi-grid > * { min-width: 0; }
.qa-date { flex-wrap: wrap; }
.qa-date input { min-width: 0; flex: 1 1 140px; }

/* Champ piège anti-robots (invisible pour les humains, y compris lecteurs d'écran) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.verify-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--brand-soft); color: var(--brand);
  padding: 10px 16px; border-radius: 10px; margin-bottom: 12px; }
.verify-banner span { flex: 1 1 220px; }

/* Ajout rapide v2 */
.qa-repeat { margin: 0; font-size: .92rem; }
.qa-repeat input { width: 18px; height: 18px; }

.per-day { color: #cfe3db; margin-top: 2px; }
.insights { margin-bottom: 16px; }
.insights ul { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: baseline; }
.trend { font-weight: 800; width: 1.2em; text-align: center; }
.trend.up { color: var(--bad); }
.trend.down { color: var(--good); }
/* Récurrents & import */
.rec-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.rec-row:last-child { border-bottom: 0; }
.rec-row.paused { opacity: .6; }
.rec-main { display: grid; gap: 2px; min-width: 0; }
.rec-actions { grid-column: 1 / -1; }
.rec-actions[open] summary { margin-bottom: 10px; }
.rec-actions summary { list-style: none; width: max-content; }
.rec-actions summary::-webkit-details-marker { display: none; }
.rec-panel { background: var(--surface-2); border-radius: 12px; padding: 12px; }
@media (min-width: 700px) { .rec-actions { grid-column: auto; } .rec-actions[open] { grid-column: 1 / -1; } }
.file-drop { display: grid; place-items: center; border: 2px dashed var(--line); border-radius: 14px; padding: 22px 12px; margin: 10px 0 14px;
  cursor: pointer; text-align: center; font-weight: 600; color: var(--brand); }
.file-drop input { max-width: 100%; margin-top: 8px; }
.import-list { padding: 4px 12px; }
.imp-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.imp-row:last-child { border-bottom: 0; }
.imp-row.dup { opacity: .55; }
.imp-check input { width: 22px; height: 22px; margin-top: 2px; }
.imp-main { display: grid; gap: 4px; min-width: 0; }
.imp-main strong { overflow-wrap: anywhere; }
.imp-main select { min-height: 38px; padding: 6px 10px; }
.sticky-bar { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 820px) { .sticky-bar { bottom: calc(104px + env(safe-area-inset-bottom)); justify-content: stretch; }
  .sticky-bar .btn { flex: 1; } }
.tx-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tx-search { display: flex; gap: 6px; flex: 1 1 220px; }
.tx-search input { min-height: 40px; }
.rec-icon { font-size: .8rem; }

/* Import : mise en avant et étapes */
.import-cta { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; color: inherit; text-decoration: none;
  border: 2px dashed #b9d3ca; background: var(--brand-soft); }
.import-cta:hover { border-color: var(--brand); }
.import-cta .ico { font-size: 1.8rem; }
.import-cta > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
@media (max-width: 520px) { .import-cta .btn { display: none; } }
.import-steps { padding-left: 20px; margin: 14px 0 18px; display: grid; gap: 8px; }
.file-drop { gap: 4px; }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop { position: relative; }
.file-drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.imp-month { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 2px solid var(--line); margin: 0; }
.imp-month input { width: 22px; height: 22px; }
.import-list + .import-list { margin-top: 12px; }
.month-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sugg-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--line); margin: 0; font-weight: 400; cursor: pointer; }
.sugg-row input[type=checkbox] { width: 22px; height: 22px; }
.sugg-main { display: grid; gap: 2px; min-width: 0; }
