/* Mon Capital — identité noire et dorée, pensée d'abord pour l'iPhone.
   Mise en page : colonne unique sur téléphone (barre d'onglets en bas), barre latérale sur grand écran. */
:root {
  --bg: #0B0B0C; --surface: #141416; --surface-2: #1B1B1E; --surface-3: #232327; --line: #2A2A2F; --line-2: #36363C;
  --text: #F2EFE8; --muted: #9D998F; --faint: #6E6B65;
  --gold: #D4AF5A; --gold-2: #E8C979; --gold-soft: rgba(212, 175, 90, .13); --gold-line: rgba(212, 175, 90, .38);
  --pos: #6CC59A; --neg: #EC8478; --warn: #E7B85C; --info: #8FB0E3;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-d: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 16px; --r-s: 10px;
  --tab-h: 62px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body { margin: 0; font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body.sheet-open { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-d); font-weight: 650; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 24px; } h2 { font-size: 16px; } h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 8px; }
p { margin: 0 0 8px; } small, .small { font-size: 12.5px; } .muted { color: var(--muted); }
b, strong { font-weight: 620; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.big, .hero-amount, .kv b, .tbl td, .li b, .loan-n b, .pocket b, .delta b { font-variant-numeric: tabular-nums; }

/* ---------- Structure ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 88px); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 30; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 8px; height: 54px; background: rgba(11, 11, 12, .9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
  padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.top-t { flex: 1; font-weight: 620; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 22px; }
.icon:hover { color: var(--text); background: var(--surface-2); }
.view { display: flex; flex-direction: column; gap: 16px; max-width: 1240px; margin: 0 auto; padding-block: 18px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#banner:empty { display: none; }
.banner { margin: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); padding: 10px 14px; border-radius: var(--r-s); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.err { background: rgba(236, 132, 120, .12); border: 1px solid rgba(236, 132, 120, .4); }
.banner.info { background: var(--gold-soft); border: 1px solid var(--gold-line); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; background: rgba(16, 16, 18, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  padding: 4px max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px)); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; background: none; border: 0; color: var(--faint); font-size: 11px; cursor: pointer; min-width: 0; }
.tabbar button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar button.on { color: var(--gold); }
.fab { position: fixed; right: max(16px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 24; height: 52px; padding: 0 20px 0 16px; border-radius: 26px; border: 0; background: var(--gold); color: #141414; display: inline-flex; align-items: center; gap: 6px; font-weight: 680; font-size: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); cursor: pointer; }
.fab .ico { width: 22px; height: 22px; stroke-width: 2.4; }
.menu-btn { display: inline-grid; }
@media (min-width: 1000px) {
  .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 18px 12px; background: #0E0E10; }
  .side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
  .nav-i { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; background: none; border: 0; color: var(--muted); text-align: left; cursor: pointer; font-size: 14px; }
  .nav-i:hover { background: var(--surface-2); color: var(--text); }
  .nav-i.on { background: var(--gold-soft); color: var(--gold-2); }
  .tabbar, .menu-btn { display: none; }
  .main { padding-bottom: 40px; }
  .fab { bottom: 28px; }
  .view { padding-block: 26px; padding-left: 32px; padding-right: 32px; }
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-family: var(--font-d); font-size: 17px; letter-spacing: .01em; }
.brand span { font-size: 12px; color: var(--faint); }
.logo { width: 40px; height: 40px; flex: none; }

/* ---------- En-têtes et panneaux ---------- */
.view-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.view-h > div:first-child { min-width: 0; }
.view-h p { margin: 4px 0 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel-h, .card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-h h2 small { font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.grid2 > * { min-width: 0; }
.big { font-family: var(--font-d); font-size: 30px; font-weight: 650; letter-spacing: -.02em; margin: 2px 0 6px; }
.empty { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); }
.empty p { max-width: 60ch; margin: 0 auto 12px; }
.empty .row-actions { justify-content: center; }
.note { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 10px 12px; font-size: 13.5px; margin: 8px 0; }
.note.warn { border-color: rgba(231, 184, 92, .45); background: rgba(231, 184, 92, .08); }
.note.err { border-color: rgba(236, 132, 120, .45); background: rgba(236, 132, 120, .08); }
.danger-zone { border-color: rgba(236, 132, 120, .35); }

/* ---------- Bannière principale ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; padding: 22px; border-radius: 20px; border: 1px solid var(--gold-line);
  background: radial-gradient(120% 140% at 0% 0%, rgba(212, 175, 90, .16), transparent 55%), linear-gradient(160deg, #19181A, #0F0F11 70%); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(115deg, rgba(212, 175, 90, .035) 0 1px, transparent 1px 9px); }
.hero > * { position: relative; z-index: 1; min-width: 0; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); font-weight: 600; }
.hero-amount { font-family: var(--font-d); font-size: clamp(34px, 7vw, 52px); font-weight: 680; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 8px; color: #FBF7EC; overflow-wrap: anywhere; }
.hero-p { color: var(--muted); max-width: 52ch; }
.deltas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; }
.delta { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.delta span { display: block; font-size: 11.5px; color: var(--muted); }
.delta b { display: block; font-size: 16px; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta small { color: var(--faint); font-size: 11px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.goal-top b { font-family: var(--font-d); font-size: 26px; color: var(--gold-2); }
.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 12px 0 8px; }
.welcome { grid-template-columns: 1fr; }
.welcome h1 { font-size: 26px; margin: 6px 0 8px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.steps li::before { content: counter(s); font-family: var(--font-d); color: var(--gold); font-weight: 700; font-size: 18px; }
.steps span { color: var(--muted); font-size: 13px; flex: 1; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding: 18px; } .deltas { grid-template-columns: 1fr 1fr 1fr; gap: 6px; } .delta { padding: 7px 8px; } .delta b { font-size: 14px; } }
@media (max-width: 420px) { .deltas { grid-template-columns: 1fr; gap: 6px; } .delta { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 10px; } .delta small { grid-column: 1 / -1; } .goal-grid { grid-template-columns: 1fr; } }

/* ---------- Valeurs ---------- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); min-width: 0; }
.kv span { flex: 1 1 auto; }
.kv b { font-weight: 560; text-align: right; overflow-wrap: break-word; flex: 0 1 auto; }
.kv.strong span { color: var(--text); } .kv.strong b { font-weight: 680; color: #FBF7EC; }
.kv.sub span { padding-left: 12px; font-size: 13px; } .kv.sub b { font-size: 13px; color: var(--muted); }
.sum.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0 22px; }
.sum.cols .kv:last-child { border-bottom: 1px solid var(--line); }
.list { display: flex; flex-direction: column; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; width: 100%; min-width: 0; }
.li:last-child { border-bottom: 0; }
.li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.li small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.li:hover { background: rgba(255, 255, 255, .025); }
.li.archived { opacity: .55; }
.li.tx.prevue b { opacity: .7; } .li.tx.annulee { opacity: .45; text-decoration: line-through; }
.tx-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.sum + .sum, .list + .sum { margin-top: 10px; }
.bar { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--muted); border-radius: 8px; }
.bar.gold span { background: linear-gradient(90deg, #B98F3E, var(--gold-2)); }
.bar.warn span { background: var(--warn); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 560; background: var(--surface-3); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.pill.ok { background: rgba(108, 197, 154, .14); color: var(--pos); } .pill.warn { background: rgba(231, 184, 92, .15); color: var(--warn); }
.pill.err { background: rgba(236, 132, 120, .15); color: var(--neg); } .pill.info { background: rgba(143, 176, 227, .14); color: var(--info); }
.pill.gold { background: var(--gold-soft); color: var(--gold-2); } .pill.muted { background: var(--surface-3); color: var(--faint); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.alerts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-align: left; }
.alert.warn { border-color: rgba(231, 184, 92, .45); } .alert.err { border-color: rgba(236, 132, 120, .5); color: #F6B0A7; } .alert.info { border-color: var(--line-2); color: var(--muted); }
.pockets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.pocket { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pocket:hover, .loan-c:hover { border-color: var(--gold-line); }
.pocket b { font-family: var(--font-d); font-size: 22px; font-weight: 650; margin: 2px 0 4px; }
.pocket small { color: var(--muted); }
.loan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 12px; }
.loan-c { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.loan-t { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.loan-t b { font-size: 15.5px; margin-right: 4px; }
.loan-c > small { color: var(--muted); }
.loan-n { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; }
.loan-n span { color: var(--muted); font-size: 13px; } .loan-n b { font-size: 18px; font-weight: 650; }
.spark-w { margin-top: 8px; } .spark { width: 100%; height: 34px; display: block; }
.rank { margin: 0; padding-left: 20px; } .rank li { margin: 4px 0; }
.recovery { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 18px; letter-spacing: .06em; text-align: center; padding: 16px; border: 1px dashed var(--gold-line); border-radius: 12px; margin: 12px 0; color: var(--gold-2); user-select: all; overflow-wrap: anywhere; }

/* ---------- Boutons et puces ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 560; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--gold-line); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #151413; }
.btn.primary:hover { background: var(--gold-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(236, 132, 120, .14); border-color: rgba(236, 132, 120, .5); color: #F6B0A7; }
.btn.danger-t { color: #F0A49A; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.menu-i { flex-direction: column; justify-content: center; white-space: normal; text-align: center; min-height: 64px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-2); }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.menu-i { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; text-align: left; font-size: 13.5px; }
.menu-i .ico { color: var(--gold); }

/* ---------- Filtres et tableaux ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); min-width: 130px; flex: 1 1 130px; }
.filter.grow { flex: 2 1 200px; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 6px 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 560; color: var(--faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td .btn { margin: 1px 2px; }
.tbl tr.row-warn td { background: rgba(231, 184, 92, .05); }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: rgba(255, 255, 255, .025); }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .axis.gold { fill: var(--gold); }
.chart .goal { stroke: var(--gold); stroke-dasharray: 4 4; stroke-width: 1.2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i, .splitlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.splitbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; gap: 2px; margin: 4px 0 12px; background: var(--surface-3); }
.splitbar span { display: block; height: 100%; min-width: 3px; }
.splitlegend { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 2px 18px; }
.sl { display: grid; grid-template-columns: auto 1fr auto 44px; align-items: center; gap: 6px; padding: 6px 0; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; font-size: 13.5px; min-width: 0; }
.sl span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl em { font-style: normal; color: var(--faint); text-align: right; font-size: 12px; }
.slider { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.slider input { width: 100%; accent-color: var(--gold); }
.slider output { font-weight: 620; color: var(--gold-2); }

/* ---------- Formulaires et feuilles ---------- */
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: #0F0F11; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-line); outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 90, .14); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); flex: none; padding: 0; }
input[type=color] { height: 42px; padding: 4px; }
input[type=range] { padding: 0; border: 0; background: none; box-shadow: none; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sheet.wide .fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
.field.full, .field-info, .field-sec { grid-column: 1 / -1; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
.field small { color: var(--faint); font-size: 12px; }
.field-sec { margin: 6px 0 -2px; color: var(--gold); font-size: 12px; }
.field[hidden], .field-info[hidden], .field-sec[hidden] { display: none !important; }
.suffix { position: relative; }
.suffix input { padding-right: 34px; }
.suffix i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--faint); pointer-events: none; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.form-err { color: var(--neg); font-size: 13.5px; min-height: 0; margin: 8px 0 0; }
.form-err:empty { display: none; }
.live:empty { display: none; }
#sheet { display: none; }
#sheet.open { display: block; position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 18px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); animation: up .2s ease-out; }
.sheet > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 17px; }
.sheet-b { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
.sheet-f { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); }
.grow { flex: 1; }
@keyframes up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 48px)); max-height: calc(100vh - 64px); border-radius: 18px; border-bottom: 1px solid var(--line-2); animation: none; }
  .sheet.wide { width: min(820px, calc(100vw - 48px)); }
  .sheet-f { padding-bottom: 12px; }
}
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 86px); transform: translateX(-50%) translateY(10px); z-index: 60; max-width: min(92vw, 520px); background: #232327; border: 1px solid var(--line-2); color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: rgba(236, 132, 120, .6); }
@media (min-width: 1000px) { .toast { bottom: 28px; } }

/* ---------- Écrans de sécurité ---------- */
.lock { min-height: 100vh; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: radial-gradient(90% 60% at 50% 0%, rgba(212, 175, 90, .12), transparent 60%), var(--bg); }
.lock-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.lock-card h1 { font-size: 22px; margin-top: 8px; }
.lock-card form { display: flex; flex-direction: column; gap: 12px; }
.sep { text-align: center; color: var(--faint); font-size: 13px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.more form { margin-top: 10px; }

/* ---------- Vue d'ensemble (mêmes couleurs, polices et boutons) ---------- */
.ov-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.ov-stats > div { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.ov-stats span { display: block; font-size: 11.5px; color: var(--muted); }
.ov-stats b { display: block; font-size: 17px; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.expl { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; margin-top: 1px; }
.ov-goal h3 { margin-top: 14px; }
.ms { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.ms-i { border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ms-i.done { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-2); }
.ms-i.next { border-color: var(--gold); color: var(--text); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .ov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.fold { border-top: 1px solid var(--line); }
.fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; cursor: pointer; min-height: 50px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "›"; color: var(--gold); font-size: 22px; line-height: 1; transition: transform .15s; flex: none; width: 12px; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold-t { flex: 1; min-width: 0; overflow-wrap: break-word; }
.fold-t small { display: block; color: var(--muted); font-size: 12px; }
.fold > summary > b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.fold-b { padding: 0 0 12px 22px; }
.fold.acc > summary { min-height: 46px; padding: 9px 2px; }
.bankrow > summary > b { font-size: 16px; }
.ov-hero .fold { margin-top: 12px; }
.ov-alerts { padding-block: 2px; border-top: 1px solid var(--line); }
.ov-alerts > summary { color: var(--warn); font-weight: 560; }
.calc { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.calc-l { min-width: 0; }
.calc-l > span { font-size: 14px; }
.calc > b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 560; }
.calc.tot > b, .calc.tot .calc-l > span { font-weight: 680; color: #FBF7EC; }
.calc.big-line { border-bottom: 0; padding-top: 14px; }
.calc.big-line > b { font-family: var(--font-d); font-size: 26px; color: var(--gold-2); }
.calc.big-line .calc-l > span { font-weight: 650; font-size: 15px; }
.switch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin: 10px 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); cursor: pointer; min-height: 52px; }
.switch input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--surface-3); border-radius: 999px; position: relative; border: 1px solid var(--line-2); flex: none; cursor: pointer; padding: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.switch input:checked { background: var(--gold-soft); border-color: var(--gold-line); }
.switch input:checked::after { left: 21px; background: var(--gold); }
.switch span { flex: 1; font-size: 14.5px; }
.switch em { font-style: normal; color: var(--muted); font-size: 12.5px; flex-basis: 100%; padding-left: 58px; }
.goal-top b { white-space: nowrap; }
.goal-top span { min-width: 0; }
.re { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.re-i { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.re-i:hover { border-color: var(--gold-line); }
.re-n { font-weight: 620; font-size: 15px; }
.re-r { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.re-r span { color: var(--muted); }
.re-r b { font-variant-numeric: tabular-nums; font-weight: 560; text-align: right; }
.re-r.strong b { color: #FBF7EC; font-weight: 680; }
.re-i small { color: var(--muted); }
.warn-t { color: var(--warn); }
.choice { margin: 12px 0; }
.choice .expl { margin-top: 5px; text-align: center; }
@media (max-width: 760px) {
  .ov-hero { grid-template-columns: minmax(0, 1fr); }
  .fold-b .btn.small, .panel-h .btn.small, .ov-goal .btn.small { padding: 9px 13px; font-size: 14px; }
  .fold-b { padding-left: 14px; }
}

/* ---------- Interface simple (5 écrans) ---------- */
.shero { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.shero h1 { font-size: 26px; margin: 6px 0; }
.eq { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.eq span { color: var(--faint); }
.slist { padding: 4px 16px; }
.srow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 0; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.srow:last-child { border-bottom: 0; }
.srow-l { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 560; overflow-wrap: break-word; }
.srow-l small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.srow > b { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 620; white-space: nowrap; }
.srow .chev { font-style: normal; color: var(--faint); font-size: 22px; line-height: 1; }
.srow:hover .chev { color: var(--gold); }
.bank-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0 8px; border-bottom: 1px solid var(--line-2); font-weight: 650; flex-wrap: wrap; }
.bank-h b { font-variant-numeric: tabular-nums; }
.pad { padding: 10px 0; }
.bigbtns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.bigbtns.grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
@media (min-width: 760px) { .bigbtns.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bigbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.bigbtn b { font-size: 16px; font-weight: 640; }
.bigbtn small { color: var(--muted); font-size: 12.5px; }
.bigbtn.primary { background: var(--gold); border-color: var(--gold); color: #151413; }
.bigbtn.primary small { color: rgba(21, 20, 19, .7); }
.bigbtn:hover { border-color: var(--gold-line); }
.wide-alert { width: 100%; border-radius: 12px; padding: 10px 14px; }
.stmt { display: flex; flex-direction: column; }
.stmt-r { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; grid-template-areas: "d l a" "d l s"; column-gap: 10px; align-items: baseline; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; width: 100%; }
.stmt-r.first { cursor: default; }
.stmt-d { grid-area: d; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.stmt-l { grid-area: l; min-width: 0; overflow-wrap: break-word; font-size: 14px; }
.stmt-r > b { grid-area: a; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.stmt-r > em { grid-area: s; text-align: right; font-style: normal; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-sep { display: block; margin: 14px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .side, .tabbar, .fab, .top, .row-actions, .btn { display: none !important; } body { background: #fff; color: #000; } .panel, .card, .hero { border-color: #ccc; background: #fff; } }

/* ---------- Direction artistique : Héritage, 5.2.0 ---------- */
:root {
  --bg:#0C0C0C; --surface:#171717; --surface-2:#20201F; --surface-3:#2A2926;
  --line:#33312D; --line-2:#49453D; --text:#F5F1E8; --muted:#B5AFA4; --faint:#938D83;
  --gold:#C9A66B; --gold-2:#E5C78F; --gold-soft:rgba(201,166,107,.10); --gold-line:rgba(201,166,107,.32);
  --pos:#80CBA1; --neg:#F09287; --r:18px; --r-s:12px;
  --heritage: Georgia, "Times New Roman", serif;
}
.brand b { font-family:var(--heritage); font-size:21px; font-weight:500; letter-spacing:.015em; }
.logo { width:48px; height:48px; }
.top { background:rgba(12,12,12,.96); }
.top-t { font-family:var(--heritage); font-size:21px; font-weight:500; }
.hero { background:linear-gradient(145deg,#211E19 0%,#171717 45%,#121212 100%); border:1px solid var(--gold-line); border-radius:22px; box-shadow:none; }
.hero::after { background:none; }
.hero-amount { font-family:var(--heritage); font-weight:400; letter-spacing:-.035em; color:var(--text); font-size:clamp(34px,9vw,56px); }
.eyebrow { letter-spacing:.14em; color:var(--gold-2); }
.goal-top { margin-top:8px; }
.goal-top b { font-family:var(--heritage); font-weight:400; font-size:23px; }
.bar { height:5px; }
.bar.gold span { background:var(--gold); }
.panel,.card,.bigbtn { background:var(--surface); box-shadow:none; }
.bigbtn.primary,.fab { background:var(--gold); color:#15130F; box-shadow:none; }
.bigbtn.primary small { color:#393022; }
.tabbar { background:rgba(16,16,16,.97); }
.tabbar button.on { color:var(--gold-2); }
.tabbar button.on .ico { stroke-width:2; }
.ico { stroke-width:1.55; }
.home-tiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:0; border:0; background:none; }
.home-tiles .srow { position:relative; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:7px; min-height:142px; padding:14px; border:1px solid var(--line); border-radius:18px; background:linear-gradient(145deg,#201E1A,#151515 70%); }
.home-tiles .srow:last-child { grid-column:1/-1; min-height:110px; }
.home-tiles .srow-l { flex:0 0 auto; display:block; width:100%; font-size:14px; font-weight:550; padding-right:12px; }
.home-tiles .srow-l .ico { display:block; color:var(--gold); width:23px; height:23px; margin-bottom:9px; }
.home-tiles .srow-l small { font-size:11px; line-height:1.35; margin-top:4px; }
.home-tiles .srow > b { font-family:var(--heritage); font-weight:400; font-size:clamp(19px,5.5vw,29px); white-space:normal; overflow-wrap:anywhere; line-height:1.15; }
.home-tiles .chev { position:absolute; top:15px; right:13px; color:var(--gold); }
.home-tiles .srow:hover { border-color:var(--gold-line); }
.home-tiles .srow:active { background:var(--surface-2); }
@media(min-width:760px) { .home-tiles { grid-template-columns:repeat(3,minmax(0,1fr)); } .home-tiles .srow:last-child { grid-column:auto; min-height:142px; } }
@media(max-width:360px) { .home-tiles .srow { padding:11px; } .home-tiles .srow-l { font-size:13px; } }
@media print { .hero,.home-tiles .srow { background:#fff; color:#000; } .hero-amount { color:#000; } }
/* Héritage II — système de présentation commun, mobile-first. */
:root{--surface:#171717;--surface-2:#20201F;--line:#34312B;--pos:#C9A66B;--neg:#E49A94;--r:18px;--r-s:12px;--font-d:Georgia,'Times New Roman',serif}
body{background:var(--bg);color:var(--text)}
.view{gap:18px;max-width:1100px}.top{height:60px}.icon{width:44px;height:44px;flex:none}.top-t{letter-spacing:.025em}.panel,.card,.hero{box-shadow:none;background:var(--surface);border-color:var(--line)}
.heritage-hero{padding:22px;gap:12px;border-color:var(--gold-line);background:#151513}.heritage-hero .hero-amount{font-size:clamp(30px,8vw,58px);line-height:1.12;margin:0;overflow-wrap:anywhere}.heritage-change{display:grid;gap:4px;font-size:15px}.heritage-change small{color:var(--muted)}.heritage-up{color:var(--gold-2)}
.heritage-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px;flex-wrap:wrap}.heritage-heading h2{margin:0;font-family:var(--heritage);font-size:23px;font-weight:400}.heritage-heading span{font-size:12px;color:var(--muted)}
.heritage-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.heritage-tile{display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:8px;min-width:0;min-height:145px;padding:15px;border:1px solid var(--line);border-radius:18px;background:var(--surface);cursor:pointer;transition:border-color .18s,background .18s}.heritage-tile:hover,.heritage-tile:focus-visible{border-color:var(--gold)}.tile-top{display:flex;width:100%;justify-content:space-between;align-items:center;color:var(--gold);font-size:22px}.tile-top .ico{width:23px;height:23px}.tile-label{font-size:14px;color:var(--text)}.heritage-tile strong{font-family:var(--heritage);font-weight:400;font-size:clamp(18px,4.8vw,28px);line-height:1.15;max-width:100%;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.heritage-tile small{font-size:11.5px;color:var(--muted);line-height:1.35}.heritage-month .panel-h{margin-bottom:15px}.heritage-flows{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.heritage-flows>div{display:grid;gap:6px;min-width:0}.heritage-flows small{color:var(--muted)}.heritage-flows b{font-size:clamp(13px,3.5vw,19px);overflow-wrap:anywhere}.heritage-month>p{margin:12px 0 0}.heritage-detail{border-top:1px solid var(--line);padding-top:10px}.heritage-detail summary,details>summary{cursor:pointer;min-height:44px;align-content:center}.heritage-history{min-width:0}.heritage-periods{display:flex;gap:4px;flex-wrap:wrap;margin:8px 0}.heritage-periods button{flex:1;min-width:44px;min-height:44px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--muted);font-size:12px;cursor:pointer}.heritage-periods button[aria-pressed=true]{border-color:var(--gold-line);background:var(--gold-soft);color:var(--gold-2)}.heritage-chart{width:100%;height:auto;max-height:180px;display:block;overflow:visible}.heritage-chart circle[role=button]{cursor:pointer}.heritage-point{margin:4px 0}.heritage-history label{display:grid;gap:6px}.heritage-history select{max-width:100%}
.btn,.bigbtn,.tabbar button{min-height:44px}.row-actions>*{max-width:100%}.view-h,.panel-h,.card-h,.kv,.calc,.srow,.li,.stmt-r,.goal-top{min-width:0}.kv b,.calc b,.srow>b,.li b,.stmt-r>b,.stmt-r>em,.goal-top b,.delta b,.ov-stats b{white-space:normal;overflow-wrap:anywhere;max-width:100%;text-overflow:clip}.srow-l,.li>span,.kv>span,.calc-l{min-width:0;overflow-wrap:anywhere}.chart{max-width:100%;height:auto}.tbl-wrap,.table-wrap{max-width:100%;overflow-x:auto}input,select,textarea{max-width:100%;min-width:0;font-size:16px}.sheet,.sheet-body{max-width:100%}.fab{box-shadow:none}.tabbar{padding-top:6px}.tabbar button{font-size:11px}.goal-top{flex-wrap:wrap}.goal-top b{font-size:21px}
@media(max-width:390px){.view{padding-left:12px;padding-right:12px;gap:14px}.heritage-hero{padding:16px}.heritage-tile{padding:12px;min-height:136px}.heritage-grid{gap:9px}.panel,.card{padding:13px}.srow{flex-wrap:wrap}.srow-l{flex-basis:45%}.stmt-r{grid-template-columns:48px minmax(0,1fr) minmax(0,1fr);column-gap:6px}.deltas{grid-template-columns:1fr}.hero-amount{font-size:clamp(28px,8vw,40px)}}
@media(min-width:760px){.heritage-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.heritage-hero{padding:28px}.heritage-tile{min-height:160px}.heritage-flows{gap:20px}}
@media(prefers-reduced-motion:reduce){.heritage-tile{transition:none}}
/* Héritage 3 — accueil conforme à la référence validée. */
.heritage-home .view{max-width:680px;gap:16px;padding:16px max(16px,env(safe-area-inset-right)) 24px max(16px,env(safe-area-inset-left))}
.heritage-home .top{height:76px;background:#0c0c0c;border-bottom:0;gap:4px}
.heritage-home .top .menu-btn{width:36px}.heritage-home .top-t{overflow:visible;min-width:0}
.heritage-brand{display:flex;align-items:center;gap:8px;white-space:nowrap}.heritage-brand .logo{width:44px;height:44px;flex:none}.heritage-brand>span{display:grid;gap:2px}.heritage-brand b{font:400 23px/1.1 Georgia,serif;color:#F5F1E8;letter-spacing:-.03em}.heritage-brand small{font:500 9px/1.2 var(--font);letter-spacing:.24em;color:#C9A66B}
.heritage-home .heritage-hero{background:#151513;border:1px solid #514431;border-radius:22px;padding:20px;gap:8px;display:flex;flex-direction:column}.heritage-hero .eyebrow{color:#aaa49a;text-transform:none;letter-spacing:0;font-size:14px}.heritage-home .hero-amount{font:400 clamp(32px,9vw,52px)/1.1 Georgia,serif;letter-spacing:-.035em;color:#F5F1E8}.heritage-change{gap:3px}.heritage-change>span{font-size:15px}.heritage-change small{font-size:11px}.heritage-up{color:#C9A66B}.heritage-history{margin-top:4px}.heritage-chart{max-height:120px}.heritage-point{font-size:10px;text-align:right;min-height:14px}.heritage-periods{margin:2px 0;gap:2px;flex-wrap:nowrap}.heritage-periods button{min-width:0;min-height:44px;padding:0 3px;font-size:11px}.heritage-periods button[aria-pressed=true]{background:#332b20;border-color:transparent;color:#C9A66B}.heritage-empty-chart{min-height:85px;display:grid;place-items:center;text-align:center;color:var(--muted);font-size:12px}.heritage-goal{border-top:1px solid #34312c;padding-top:10px}.heritage-goal .goal-top{margin:0 0 8px;font-size:13px}.heritage-goal .goal-top b{font:500 14px var(--font);color:#C9A66B}.heritage-goal .bar{height:5px;background:#34312c}.heritage-goal .bar span{background:#C9A66B}
.heritage-heading{align-items:center}.heritage-heading h2{font:400 22px Georgia,serif}.heritage-link{border:0;background:transparent;color:#aaa49a;font-size:12px;min-height:44px;padding:0 2px;cursor:pointer}.heritage-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.heritage-tile{background:#171717;border:1px solid #33302b;border-radius:16px;padding:14px;min-height:130px;gap:7px}.tile-top{color:#C9A66B}.tile-top>span{color:#817a6d;font-size:20px;line-height:1}.tile-label{color:#b5b0a6;font-size:13px}.heritage-tile strong{font:400 clamp(20px,5.8vw,29px)/1.15 Georgia,serif;color:#F5F1E8;overflow-wrap:normal;white-space:normal}.heritage-tile small{font-size:11px;color:#aaa49a}.heritage-month{background:#171717;border:1px solid #33302b;border-radius:16px;padding:14px}.heritage-month .panel-h{margin:0 0 8px}.heritage-month h2{font:400 19px Georgia,serif}.heritage-flows{gap:8px}.heritage-flows b{font-size:clamp(13px,3.8vw,17px);font-weight:500}.heritage-extra{background:transparent;border-color:#33302b}.heritage-home .fab{position:static;justify-self:end;display:none}.heritage-home .main{padding-bottom:calc(var(--tab-h) + env(safe-area-inset-bottom,0px) + 20px)}.heritage-home .tabbar{background:#101010}.heritage-home .tabbar button{min-height:52px}.heritage-home .tabbar button.on{color:#C9A66B}
@media(max-width:360px){.heritage-home .view{padding-inline:12px}.heritage-brand b{font-size:20px}.heritage-brand .logo{width:36px;height:36px}.heritage-home .top .icon{width:38px}.heritage-tile{padding:11px}.heritage-tile strong{font-size:20px}.heritage-home .heritage-hero{padding:16px}}
@media(min-width:1000px){.heritage-home .view{max-width:720px}.heritage-home .top{padding-inline:24px}.heritage-home .heritage-tile{min-height:140px}.heritage-home .fab{display:none}}
@media print{.heritage-home .view{max-width:100%;padding:0}.heritage-home .heritage-hero,.heritage-tile,.heritage-month{break-inside:avoid;print-color-adjust:exact;-webkit-print-color-adjust:exact}.heritage-home .heritage-extra{display:none}}
/* Héritage 4 — carte patrimoine, graphique et paliers. */
.heritage-home .heritage-hero{gap:12px;padding:22px 18px 20px;background:#151513;border-color:#65543a}
.heritage-home .heritage-net-label{display:flex;justify-content:center;align-items:center;gap:8px;text-transform:uppercase;letter-spacing:.16em;font-size:12px;color:#d5c8ad;font-weight:600}
.heritage-net-label .ico{width:19px;height:19px;color:#C9A66B}
.heritage-home .hero-amount{text-align:center;font-size:clamp(36px,10.5vw,70px);line-height:1.12;margin:4px 0;letter-spacing:-.045em;font-variant-numeric:lining-nums tabular-nums}
.heritage-home .heritage-change{text-align:center;justify-items:center;min-height:24px}.heritage-home .heritage-change>span{font-size:16px}.heritage-home .heritage-change small{font-size:11px;color:#aaa49a}
.heritage-home .heritage-chart{max-height:none;aspect-ratio:320/132}.heritage-home .heritage-point{text-align:right;font-size:11px;margin:5px 0 8px}.heritage-home .heritage-periods{gap:3px}.heritage-home .heritage-periods button{border:1px solid #34312b;border-radius:10px}.heritage-home .heritage-periods button[aria-pressed=true]{border-color:#65543a;background:#332b20}
.heritage-home .heritage-goal{padding-top:16px}.heritage-home .heritage-goal .goal-top{font-size:14px;margin-bottom:16px}.heritage-home .heritage-goal .goal-top b{font-size:16px}
.milestone-track{height:8px;border-radius:8px;background:#34312c;position:relative;margin:0 5px 13px}.milestone-track>span{display:block;height:100%;border-radius:8px;background:#C9A66B}.milestone-track>i{position:absolute;top:50%;width:9px;height:9px;border:1px solid #9a8055;border-radius:50%;background:#151513;transform:translate(-50%,-50%)}.milestone-track>i.reached{background:#C9A66B}.milestone-labels{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;text-align:center}.milestone-labels>div{min-width:0;display:grid;gap:4px;color:#aaa49a}.milestone-labels b{font-size:11px;font-weight:500}.milestone-labels small{font-size:10px;line-height:1.2;overflow-wrap:anywhere}.milestone-labels .reached{color:#C9A66B}
@media(max-width:360px){.heritage-home .heritage-hero{padding:18px 12px}.milestone-labels small{font-size:9px}.heritage-home .hero-amount{font-size:clamp(32px,10vw,48px)}}

/* Héritage 6.1 : six cartes identiques, comptes compacts. */
.heritage-grid{grid-auto-rows:190px}.heritage-grid .heritage-tile{height:100%;min-height:0;overflow:hidden;gap:5px;padding:11px}.heritage-grid .heritage-tile strong{font-size:clamp(17px,4.8vw,25px)}.account-mini-list{display:flex;flex-direction:column;width:100%;gap:3px;min-width:0}.account-mini-row{display:grid;grid-template-columns:minmax(0,1fr) auto 10px;gap:3px;align-items:center;font-size:10px;line-height:1.25;width:100%;color:var(--muted)}.account-mini-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-mini-value{font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--text)}.account-mini-mark{text-align:right}.account-mini-mark.up{color:#B69AF4}.account-mini-mark.down{color:#E99ABB}.account-mini-mark.flat{color:var(--muted)}.account-mini-more{font-size:9px;color:var(--muted)}.heritage-gross{display:flex;justify-content:center;align-items:baseline;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--muted)}.heritage-gross b{color:var(--text);font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.heritage-home .hero-amount{text-align:center}.heritage-home .heritage-change{text-align:center}

.account-mini-caption{font-size:9px;color:var(--muted);line-height:1.1}.account-mini-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;touch-action:pan-y}.account-mini-row{flex-shrink:0}.heritage-grid .tile-top{flex-shrink:0}.heritage-grid .tile-label{flex-shrink:0}.heritage-grid .heritage-tile strong{flex-shrink:0}.heritage-grid .heritage-tile{min-width:0}.heritage-grid .account-mini-value{max-width:90px;overflow:hidden;text-overflow:ellipsis}

/* Héritage 6.2 — mobile : contenu dans le flux, zones sûres et montants lisibles. */
@media (max-width: 759px) {
  .shell { padding-top: env(safe-area-inset-top, 0px); min-height:100dvh; }
  .view, .heritage-home .view { width:100%; min-width:0; padding-inline:max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px)); gap:14px; }
  .view > *, .panel > *, .card > *, .hero > *, .sheet-b > * { min-width:0; max-width:100%; }
  .top, .heritage-home .top { height:64px; gap:4px; padding-inline:max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); }
  .top .icon, .heritage-home .top .icon, .heritage-home .top .menu-btn { width:44px; height:44px; flex:0 0 44px; }
  .top-t, .heritage-home .top-t { min-width:0; overflow:hidden; }
  .heritage-brand { min-width:0; gap:5px; white-space:normal; }
  .heritage-brand .logo { width:32px; height:32px; }
  .heritage-brand > span { min-width:0; }
  .heritage-brand b { font-size:clamp(15px,4.6vw,22px); line-height:1.05; }
  .heritage-brand small { font-size:8px; letter-spacing:.12em; }
  .tabbar { min-height:calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); align-items:stretch; }
  .tabbar button { flex:1 1 0; min-width:0; min-height:48px; font-size:10px; }
  .main, .heritage-home .main { padding-bottom:calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px); }
  .fab { position:static; margin:0 12px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px) auto; display:flex; width:max-content; max-width:calc(100% - 24px); }
  .heritage-home .fab { display:none; }
  .heritage-grid { grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:190px; gap:8px; }
  .heritage-grid .heritage-tile { padding:10px; gap:5px; }
  .heritage-grid .heritage-tile strong { font-size:clamp(17px,4.6vw,25px); overflow-wrap:anywhere; line-height:1.15; }
  .account-mini-row { grid-template-columns:minmax(0,1fr) minmax(0,auto) 9px; gap:3px; font-size:10px; }
  .heritage-grid .account-mini-value { max-width:100%; white-space:normal; overflow-wrap:anywhere; text-align:right; }
  .heritage-home .hero-amount { font-size:clamp(30px,9vw,52px); overflow-wrap:anywhere; }
  .heritage-periods { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
  .heritage-home .heritage-periods button { min-width:0; padding:0 1px; font-size:10px; }
  .heritage-flows { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .heritage-flows b { overflow-wrap:anywhere; white-space:normal; }
  .panel,.card { padding:12px; }
  .view-h,.panel-h,.card-h,.row-actions { align-items:flex-start; }
  .btn,.chip,.menu-i { white-space:normal; overflow-wrap:anywhere; max-width:100%; min-height:44px; }
  .row-actions { width:100%; }
  .row-actions > .btn { flex:1 1 auto; }
  .kv,.calc,.loan-n,.re-r,.fold > summary,.srow,.li { gap:8px; }
  .kv > b,.calc > b,.loan-n > b,.re-r > b,.fold > summary > b,.srow > b,.li > b,.tx-r { min-width:0; max-width:55%; white-space:normal; overflow-wrap:anywhere; text-align:right; }
  .fold-t,.srow-l,.calc-l,.loan-n > span,.re-r > span { min-width:0; overflow-wrap:anywhere; }
  .stmt-r { grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-areas:'d a' 'l s'; gap:4px 8px; }
  .stmt-r > b,.stmt-r > em { min-width:0; overflow-wrap:anywhere; }
  .sl { grid-template-columns:auto minmax(0,1fr) minmax(0,auto) 38px; }
  .sl b { min-width:0; overflow-wrap:anywhere; }
  .scroll { width:100%; max-width:100%; overflow-x:auto; }
  .fields,.sheet.wide .fields { grid-template-columns:minmax(0,1fr); }
  .sheet { max-height:calc(100dvh - env(safe-area-inset-top,0px) - 8px); }
  .sheet-h,.sheet-f { flex-shrink:0; }
  .sheet-h h2 { min-width:0; overflow-wrap:anywhere; }
  .sheet-b { min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; }
  .sheet-f .btn { flex:1 1 auto; }
  .sheet-f .grow { display:none; }
  .field input:not([type=checkbox]):not([type=range]),.field select,.field textarea { font-size:16px; min-height:44px; }
  .pill { white-space:normal; overflow-wrap:anywhere; }
}
@media (max-width: 359px) {
  .heritage-brand .logo { display:none; }
  .heritage-home .heritage-hero { padding:16px 10px; }
  .heritage-grid .heritage-tile { padding:8px; }
  .account-mini-row { font-size:9px; }
  .milestone-labels b { font-size:10px; }
}

/* ====================================================================== */
/* 8.0 — accueil simplifié, budget, calendrier, avenir patrimonial         */
/* ====================================================================== */
.home-checks .home-check { display:flex; width:100%; justify-content:space-between; align-items:center; gap:10px; min-height:44px; padding:8px 0; border:0; border-top:1px solid var(--line); background:none; color:var(--text); text-align:left; cursor:pointer; font:inherit; }
.home-checks .home-check span { min-width:0; overflow-wrap:anywhere; font-size:14px; }
.home-checks .home-check.err span { color:var(--neg); }
.home-checks details summary { cursor:pointer; color:var(--muted); min-height:44px; display:flex; align-items:center; font-size:13px; }
.home-checks.ok p { display:flex; gap:8px; align-items:center; color:var(--muted); margin:0; }
.home-checks .pill { margin-left:auto; }
.home-line { display:flex; width:100%; align-items:center; justify-content:space-between; gap:10px; min-height:48px; padding:10px 16px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); color:var(--text); font:inherit; cursor:pointer; }
.home-line span { min-width:0; overflow-wrap:anywhere; text-align:left; color:var(--muted); font-size:14px; }
.home-month-note { margin:8px 0 0; }
.hours-card .panel-h h2 { display:flex; align-items:center; gap:8px; }
.hours-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:6px 0 10px; }
.hours-grid > div { min-width:0; padding:10px; border:1px solid var(--line); border-radius:12px; }
.hours-grid small, .hours-grid em { display:block; color:var(--muted); font-size:11px; font-style:normal; }
.hours-grid b { display:block; font-size:18px; margin:4px 0; overflow-wrap:anywhere; }
.hours-acts span { display:inline-block; margin:0 10px 4px 0; color:var(--muted); }
.hours-more summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:var(--gold); }
/* Indicateurs */
.kpis { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.kpis.small .kpi b { font-size:16px; }
.kpi { min-width:0; padding:12px; border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.kpi small { display:block; color:var(--muted); font-size:12px; }
.kpi b { display:block; font-size:20px; margin-top:4px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.kpi em { display:block; font-style:normal; color:var(--faint); font-size:11px; margin-top:2px; }
.kpi.up b, .up { color:#80CBA1; } .kpi.down b, .down { color:#E99ABB; }
@media (min-width:760px) { .kpis { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (min-width:1100px) { .kpis { grid-template-columns:repeat(6,minmax(0,1fr)); } .kpis.small { grid-template-columns:repeat(6,minmax(0,1fr)); } }
/* Ordinateur : le bouton flottant « Ajouter » est remplacé par le bouton + de la barre du haut (il chevauchait les graphiques). */
.top-add { display:none; }
@media (min-width:1000px) { .fab { display:none !important; } .top-add { display:inline-flex; } }
/* Sélecteurs */
.seg { display:flex; flex-wrap:wrap; gap:6px; }
.seg::-webkit-scrollbar { display:none; }
.seg button { flex:0 0 auto; min-height:40px; padding:0 14px; border:1px solid var(--line); border-radius:999px; background:transparent; color:var(--muted); font:inherit; font-size:13px; cursor:pointer; }
.seg button[aria-pressed="true"] { background:var(--gold-soft); border-color:var(--gold-line); color:var(--gold); }
.bud-nav, .cal-nav { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bud-nav b, .cal-nav b { flex:1 1 auto; text-align:center; text-transform:capitalize; min-width:120px; }
.bud-period { display:flex; flex-direction:column; gap:10px; }
.bud-custom { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.bud-custom input, .bud-filter input, .bud-filter select { min-height:44px; padding:0 10px; border:1px solid var(--line); border-radius:10px; background:#101012; color:var(--text); font:inherit; max-width:100%; }
.bud-filter { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin-bottom:10px; }
@media (min-width:760px) { .bud-filter { grid-template-columns:minmax(0,2fr) minmax(0,1fr); } }
.bud-cols { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
@media (min-width:1000px) { .bud-cols { grid-template-columns:minmax(0,1fr) minmax(0,1fr); } }
.lim { padding:10px 0; border-top:1px solid var(--line); }
.lim-h { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.lim-h b { min-width:0; overflow-wrap:anywhere; }
.mc-prog { height:8px; border-radius:99px; background:#26252a; overflow:hidden; margin:8px 0 4px; }
.mc-prog span { display:block; height:100%; border-radius:99px; background:var(--gold); transition:width .3s; }
.mc-prog.warn span { background:#E7B85C; } .mc-prog.over span { background:#E99ABB; }
.cat-g { padding:10px 0; border-top:1px solid var(--line); }
.cat-gh { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.cat-gh i { width:12px; height:12px; border-radius:50%; flex:none; }
.cat-gh .row-actions { margin-left:auto; }
.cat-s { display:flex; justify-content:space-between; gap:8px; padding:6px 0 6px 20px; flex-wrap:wrap; align-items:center; }
.cat-s span:first-child { min-width:0; overflow-wrap:anywhere; }
.cat-s small { display:block; color:var(--faint); font-size:11px; }
/* Graphiques */
.mc-chart { position:relative; margin:8px 0 0; padding-left:0; touch-action:pan-y; outline:none; }
.mc-chart .mc-svg { display:block; width:100%; height:var(--h,220px); }
.mc-grid { stroke:#2c2a26; stroke-width:1; stroke-dasharray:3 5; vector-effect:non-scaling-stroke; }
.mc-zero { stroke:#4a463e; stroke-width:1; vector-effect:non-scaling-stroke; }
.mc-cross { stroke:#C9A66B; stroke-width:1; opacity:0; }
.mc-band { opacity:.14; }
.mc-axis { position:absolute; top:0; right:0; height:var(--h,220px); display:flex; flex-direction:column; justify-content:space-between; pointer-events:none; font-size:10px; color:var(--faint); text-align:right; }
.mc-x { display:flex; justify-content:space-between; font-size:11px; color:var(--faint); margin-top:4px; }
.mc-legend { display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:8px; font-size:12px; color:var(--muted); }
.mc-legend i, .mc-tip i, .mc-leg i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:-1px; }
.mc-legend em { font-style:normal; color:var(--faint); }
.mc-tip { position:absolute; top:4px; z-index:3; max-width:min(280px,90%); padding:8px 10px; border:1px solid var(--gold-line); border-radius:10px; background:rgba(14,14,16,.96); font-size:12px; pointer-events:none; }
.mc-tip b, .mc-tip span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mc-donut { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; align-items:center; }
.mc-donut-c { position:relative; width:min(220px,70vw); margin:0 auto; }
.mc-donut-svg { display:block; width:100%; height:auto; }
.mc-donut-svg circle[data-act] { cursor:pointer; transition:stroke-width .15s; }
.mc-donut-svg circle[data-act]:hover, .mc-donut-svg circle[data-act]:focus { stroke-width:22; outline:none; }
.mc-donut-t { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; pointer-events:none; }
.mc-donut-t b { font-family:var(--font-d); font-size:18px; } .mc-donut-t small { color:var(--muted); font-size:11px; }
.mc-donut-l { display:grid; gap:4px; }
.mc-leg { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; gap:8px; align-items:center; min-height:40px; padding:4px 6px; border:0; border-radius:8px; background:none; color:var(--text); font:inherit; font-size:13px; text-align:left; cursor:pointer; }
.mc-leg:hover { background:var(--gold-soft); } .mc-leg span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .mc-leg small { color:var(--muted); }
@media (min-width:560px) { .mc-donut { grid-template-columns:200px minmax(0,1fr); } }
/* Calendrier */
.cal-layout { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; align-items:start; }
@media (min-width:1100px) { .cal-layout { grid-template-columns:minmax(0,2fr) minmax(0,1fr); } }
.cal-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; }
.cal-head span { text-align:center; font-size:11px; color:var(--faint); padding:4px 0; }
.cal-day { position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:1px; min-width:0; min-height:58px; padding:5px; border:1px solid var(--line); border-radius:10px; background:#121214; color:var(--text); font:inherit; cursor:pointer; overflow:hidden; }
.cal-day.out { opacity:.4; } .cal-day.today { border-color:var(--gold-line); } .cal-day.sel { background:var(--gold-soft); border-color:var(--gold); }
.cal-day.late::after { content:''; position:absolute; top:6px; right:6px; width:6px; height:6px; border-radius:50%; background:#E7B85C; }
.cal-n { font-size:13px; font-weight:600; }
.cal-day small { font-size:9.5px; line-height:1.15; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cal-dot { position:absolute; bottom:4px; right:5px; font-style:normal; font-size:9px; min-width:15px; height:15px; line-height:15px; text-align:center; border-radius:8px; background:#2b2833; color:#B69AF4; }
@media (min-width:760px) { .cal-day { min-height:84px; padding:7px; } .cal-day small { font-size:11px; } }
.cal-week { display:grid; grid-template-columns:minmax(0,1fr); gap:10px; }
@media (min-width:1280px) { .cal-week { grid-template-columns:repeat(2,minmax(0,1fr)); } }
.cal-ev { display:grid; grid-template-columns:auto minmax(0,1fr); gap:4px 8px; align-items:center; padding:6px 0; border-top:1px solid var(--line); }
.cal-ev .li { border:0; padding:4px 0; min-width:0; }
.cal-ev .cal-st { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.cal-ev:not(.tache) { grid-template-columns:minmax(0,1fr); }
.cal-ev.high .li span { color:#E7B85C; }
.cal-check { width:28px; height:28px; border:1.5px solid var(--gold-line); border-radius:8px; background:none; color:var(--gold); font:inherit; cursor:pointer; }
.cal-check.on { background:var(--gold-soft); }
.cal-tot .kpi b { font-size:15px; }
/* Avenir patrimonial */
.sim-bar { display:flex; flex-direction:column; gap:8px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
.chip { min-height:36px; padding:0 12px; border:1px solid var(--line); border-radius:999px; background:transparent; color:var(--muted); font:inherit; font-size:12.5px; cursor:pointer; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chip.on { border-color:var(--gold-line); color:var(--gold); background:var(--gold-soft); }
.sim-item { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--line); }
.sim-item span { min-width:0; overflow-wrap:anywhere; }
.sim-item small { display:block; color:var(--muted); font-size:12px; margin-top:3px; }
.sim-item .btn { flex:none; }
.sim-tbl td, .sim-tbl th { white-space:nowrap; font-variant-numeric:tabular-nums; }
.inline-check { display:inline-flex; gap:6px; align-items:center; cursor:pointer; }
.inline-check input { width:18px; height:18px; }
@media (max-width:430px) { .sim-item { flex-wrap:wrap; } .hours-grid b { font-size:15px; } .kpi b { font-size:17px; } }
.cal-dot { top:4px; right:4px; bottom:auto; }
.cal-day.late { border-color:rgba(231,184,92,.55); } .cal-day.late::after { display:none; }
.list .li > b.neg, .list .li > b.up, .list .li > b.down, .cal-ev .li > b { white-space:nowrap; max-width:none; }
