@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #0e0637;
  --ink-2: #4a5068;
  --ink-3: #8a90a6;
  --line: #eceef5;
  --line-strong: #d9dce8;
  --iris: #5654d4;
  --iris-dark: #3f3db8;
  --iris-fill: #5654d4;
  --iris-fill-hover: #3f3db8;
  --iris-soft: #ecebfb;
  --iris-mid: #c9c8f4;
  --night: #0e0637;
  --tomato: #ff6740;
  --tomato-soft: #ffece6;
  --tomato-hover: #ffdcd1;
  --green: #22a06b;
  --green-soft: #e2f5ec;
  --sky: #2e9ccf;
  --sky-soft: #e3f3fa;
  --sky-ink: #1d6a8f;
  --pos: #168a59;
  --neg: #d6452a;
  --warn: #a45a00;
  --warn-bg: #fff1dc;
  --warn-ink: #5d3500;
  --danger-line: #f3cfc6;
  --focus: #5654d4;
  --hatch: repeating-linear-gradient(135deg, #c8ccd9 0 3px, transparent 3px 7px);
  --hatch-a: #eceef5;
  --hatch-b: #c8ccd9;
  --shadow: 0 1px 2px rgba(14, 6, 55, 0.04), 0 8px 24px -14px rgba(14, 6, 55, 0.12);
  --scrim: rgba(14, 6, 55, 0.35);

  --font: 'Poppins', system-ui, sans-serif;
  --text-sm: 0.86rem;
  --text-xs: 0.76rem;
  --r-card: 22px;
  --r-mid: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* Mode sombre : réglage du système, sauf choix contraire dans Réglages */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
  color-scheme: dark;
  --bg: #0f0e1c;
  --surface: #1a1930;
  --ink: #eeedfa;
  --ink-2: #b7b8cd;
  --ink-3: #8b8ca6;
  --line: #2a2944;
  --line-strong: #3b3a5a;
  --iris: #9896ff;
  --iris-dark: #b4b3ff;
  --iris-fill: #5f5de0;
  --iris-fill-hover: #6f6dee;
  --iris-soft: #262452;
  --iris-mid: #403e86;
  --night: #07061a;
  --tomato: #ff8063;
  --tomato-soft: #3b2224;
  --tomato-hover: #4a2a2b;
  --green: #3cc98f;
  --green-soft: #15302a;
  --sky: #5abdea;
  --sky-soft: #142f40;
  --sky-ink: #8fd3f2;
  --pos: #4fd497;
  --neg: #ff7d62;
  --warn: #f2a948;
  --warn-bg: #3a2b14;
  --warn-ink: #f6cd94;
  --danger-line: #5a2d2a;
  --focus: #9896ff;
  --hatch: repeating-linear-gradient(135deg, #4a4968 0 3px, transparent 3px 7px);
  --hatch-a: #23223b;
  --hatch-b: #4a4968;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -14px rgba(0, 0, 0, 0.6);
  --scrim: rgba(4, 3, 14, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0e1c;
  --surface: #1a1930;
  --ink: #eeedfa;
  --ink-2: #b7b8cd;
  --ink-3: #8b8ca6;
  --line: #2a2944;
  --line-strong: #3b3a5a;
  --iris: #9896ff;
  --iris-dark: #b4b3ff;
  --iris-fill: #5f5de0;
  --iris-fill-hover: #6f6dee;
  --iris-soft: #262452;
  --iris-mid: #403e86;
  --night: #07061a;
  --tomato: #ff8063;
  --tomato-soft: #3b2224;
  --tomato-hover: #4a2a2b;
  --green: #3cc98f;
  --green-soft: #15302a;
  --sky: #5abdea;
  --sky-soft: #142f40;
  --sky-ink: #8fd3f2;
  --pos: #4fd497;
  --neg: #ff7d62;
  --warn: #f2a948;
  --warn-bg: #3a2b14;
  --warn-ink: #f6cd94;
  --danger-line: #5a2d2a;
  --focus: #9896ff;
  --hatch: repeating-linear-gradient(135deg, #4a4968 0 3px, transparent 3px 7px);
  --hatch-a: #23223b;
  --hatch-b: #4a4968;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -14px rgba(0, 0, 0, 0.6);
  --scrim: rgba(4, 3, 14, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 0.95rem/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.02rem; font-weight: 600; }
h3 { font-size: 0.92rem; font-weight: 600; }
a { color: inherit; text-underline-offset: 3px; }
b, strong { font-weight: 600; }
code { background: var(--iris-soft); padding: 0.1em 0.35em; border-radius: 6px; font-size: 0.88em; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: var(--text-sm); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 0.5rem; }
.boot { padding: 2rem; color: var(--ink-3); }

/* Logo */
.logo { display: block; width: 74px; height: 38px; background: var(--iris); flex: none; -webkit-mask: url('/img/charlie-logo.svg') left center / contain no-repeat; mask: url('/img/charlie-logo.svg') left center / contain no-repeat; }
.logo.big { width: 160px; height: 78px; }

/* Cadre */
.shell { max-width: 46rem; margin: 0 auto; padding: 0.9rem 1.1rem 7.5rem; }
.app-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 3.4rem; }
.head-left { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.hello { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.hello-sub { color: var(--ink-3); font-size: var(--text-xs); }
.page-title { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; gap: 0.5rem; align-items: center; flex: none; }
.round-btn { position: relative; width: 2.8rem; height: 2.8rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface); color: var(--ink); border: 1px solid var(--line); cursor: pointer; text-decoration: none; flex: none; transition: transform 120ms var(--ease); }
.round-btn:active { transform: scale(0.94); }
.round-btn.small { width: 2.1rem; height: 2.1rem; }

main { outline: none; display: grid; gap: 1rem; padding-top: 0.9rem; }
.enter-fade { animation: fade 220ms var(--ease) both; }
.enter-push { animation: push 280ms var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes push { from { opacity: 0; transform: translateX(24px); } }

/* Barre du bas */
.tabbar { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 40; width: min(46rem, 100%); display: grid; align-items: center; gap: 0.2rem; padding: 0.55rem 0.8rem calc(0.55rem + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 30px -18px rgba(14, 6, 55, 0.25); }
.tabbar a { display: grid; justify-items: center; gap: 0.15rem; padding: 0.4rem 0.2rem; border-radius: 14px; color: var(--ink-3); text-decoration: none; font-size: 0.68rem; font-weight: 500; min-width: 0; }
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a:hover { color: var(--ink-2); }
.tabbar a[aria-current='page'] { color: var(--iris); }
.tabbar a[aria-current='page'] svg { background: var(--iris-soft); border-radius: 12px; padding: 4px; width: 34px; height: 30px; }

/* Cartes */
.card { background: var(--surface); border-radius: var(--r-card); padding: 1.15rem 1.2rem; display: grid; gap: 0.9rem; align-content: start; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.card.error { box-shadow: 0 0 0 1px var(--neg); }
.card-head, .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.card-head .meta, .panel-head .meta { margin-top: 0.1rem; }
.link { font-size: var(--text-sm); font-weight: 500; text-decoration: none; color: var(--iris); }
.link:hover { text-decoration: underline; }
.stack, .page { display: grid; gap: 1rem; }
.stack > *, .page > *, .card > *, .grid > *, .form-grid > *, .goal-row > * { min-width: 0; }
.grid, .grid.even { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.page-head:empty { display: none; }
.page-head { display: grid; gap: 0.4rem; }
.meta { color: var(--ink-3); font-size: var(--text-sm); max-width: 62ch; }
.sub { display: grid; gap: 0.75rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.callout { background: var(--bg); border-radius: var(--r-mid); padding: 0.9rem 1rem; display: grid; gap: 0.5rem; font-size: var(--text-sm); }
.callout.warn { background: var(--warn-bg); color: var(--warn-ink); }
.callout ul, .card ul:not(.plain):not(.rows):not(.menu):not(.fams):not(.fam-etfs):not(.fam-legend):not(.buys):not(.pillar-accounts):not(.split-legend):not(.pa-fams):not(.wealth-list):not(.w-legend):not(.w-bars):not(.dh-ops):not(.dk-legend) { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
ul.cols { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.note { color: var(--ink-3); font-size: var(--text-sm); }
.note.warn, .warn-inline { color: var(--warn); }
.empty { color: var(--ink-3); font-size: var(--text-sm); }
.lead { font-size: 1rem; color: var(--ink-2); max-width: 54ch; }
.danger-zone { box-shadow: 0 0 0 1px var(--danger-line); }

/* Carte patrimoine */
.balance { border-radius: 26px; overflow: hidden; background: #5654d4; color: #fff; box-shadow: 0 18px 36px -20px rgba(86, 84, 212, 0.8); }
.bal-top { padding: 1.4rem 1.4rem 1.25rem; display: grid; gap: 0.45rem; justify-items: center; text-align: center; background: radial-gradient(120% 90% at 80% 0%, #6d6bea 0%, #5654d4 60%); }
.bal-label { font-size: var(--text-sm); opacity: 0.85; }
.bal-value { font-size: clamp(2.1rem, 1.6rem + 2.4vw, 2.8rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.bal-value.small { font-size: 1.5rem; }
.bal-value .big-money small { font-size: 0.55em; opacity: 0.7; margin-left: 0.05em; }
.bal-line { display: flex; gap: 0.5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.bal-pill { display: inline-flex; align-items: center; gap: 0.3rem; background: #fff; color: #3f3db8; border-radius: 999px; padding: 0.22rem 0.7rem; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.bal-pill.muted-pill { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 500; }
.balance .term summary { color: #fff; }
.bal-date { font-size: var(--text-xs); opacity: 0.75; }
.bal-actions { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--night); padding: 0.7rem 0.5rem; }
.bal-action { background: none; border: 0; color: #fff; font: 500 var(--text-xs) var(--font); display: grid; justify-items: center; gap: 0.3rem; padding: 0.4rem; cursor: pointer; border-radius: 14px; }
.bal-action > span { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); }
.bal-action:hover > span { background: rgba(255, 255, 255, 0.22); }
.bal-action:disabled { opacity: 0.6; }

/* Petites statistiques */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.stat { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 0.85rem 0.8rem; display: grid; gap: 0.15rem; justify-items: start; min-width: 0; }
.stat .stat-icon { margin-bottom: 0.35rem; }
.stat-icon { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.stat-icon.iris { background: var(--iris); }
.stat-icon.green { background: var(--green); }
.stat-icon.tomato { background: var(--tomato); }
.stat-icon.sky { background: var(--sky); }
.stat-label { font-size: 0.7rem; color: var(--ink-3); display: flex; align-items: center; gap: 0.25rem; }
.stat-value { font-weight: 600; font-size: 1.05rem; max-width: 100%; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* Choix de période */
@keyframes rise-bar { from { transform: scaleY(0); } }
.periods { display: flex; justify-content: center; gap: 0.4rem; }
.period { border: 0; background: none; font: 500 var(--text-xs) var(--font); color: var(--ink-3); padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer; }
.period.on { background: var(--iris-fill); color: #fff; }

/* Immobilier */


/* Listes */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 0.1rem; }
.row-main { display: grid; min-width: 0; }
.row-main strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--ink-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: grid; justify-items: end; gap: 0.15rem; font-variant-numeric: tabular-nums; }
.row-end.inline { display: flex; align-items: baseline; gap: 0.6rem; }
.row-end strong { font-weight: 600; }
.mono { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 0.7rem; color: #fff; flex: none; background: #6c7389; }
.mono.ibkr { background: #c8102e; }
.tx-icon { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--iris-soft); color: var(--iris); }
.tx-icon.in { background: var(--green-soft); color: var(--green); }
.tx-icon.out { background: var(--tomato-soft); color: var(--tomato); }
.tx-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* Menus et feuille d'ajout */
.menu { list-style: none; margin: 0; padding: 0.4rem 1rem; gap: 0; }
.menu li + li .menu-row { border-top: 1px solid var(--line); }
.menu-row, .sheet-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.85rem; align-items: center; padding: 0.8rem 0; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.menu-row > span:nth-child(2), .sheet-item > span:nth-child(2) { display: grid; min-width: 0; }
.menu-row small, .sheet-item small { color: var(--ink-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row > svg:last-child, .sheet-item > svg:last-child { color: var(--ink-3); }
.sheet-item { grid-template-columns: auto minmax(0, 1fr) auto; border-top: 1px solid var(--line); }
.sheet-item:first-of-type { border-top: 0; }
.sheet-icon { width: 2.5rem; height: 2.5rem; border-radius: 14px; display: grid; place-items: center; background: var(--iris-soft); color: var(--iris); flex: none; }
.sheet { display: grid; }

/* Infobulle d'explication */
.term { display: inline-block; position: relative; font-size: var(--text-sm); color: var(--ink-2); }
.term summary { list-style: none; cursor: pointer; width: 1.05rem; height: 1.05rem; border-radius: 50%; display: inline-grid; place-items: center; color: var(--ink-3); font-size: 0.62rem; font-weight: 700; box-shadow: 0 0 0 1.2px currentColor; }
.term summary::-webkit-details-marker { display: none; }
.term[open] summary { background: var(--night); color: #fff; box-shadow: none; }
.term > p { position: absolute; z-index: 30; left: 50%; transform: translateX(-50%); top: 1.5rem; width: min(17rem, 78vw); background: var(--night); color: #f1f1f8; padding: 0.7rem 0.85rem; border-radius: 14px; font-size: 0.78rem; line-height: 1.45; text-align: left; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.5); }
.card-head .term > p { left: auto; right: 0; transform: none; }



@keyframes grow { from { transform: scaleX(0); } }


.tip { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; background: var(--night); color: #f1f1f8; padding: 0.45rem 0.7rem; border-radius: 10px; font-size: 0.78rem; line-height: 1.45; box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.5); max-width: 18rem; }
.tip.in-chart { position: absolute; }
.tip .dot { margin-right: 0.4rem; vertical-align: 0.05em; }

/* Badges et pastilles */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 500; line-height: 1.4; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--bg); color: var(--ink-2); white-space: nowrap; vertical-align: 0.1em; }
.badge.ok { background: var(--green-soft); color: var(--pos); }
.badge.attention, .badge.erreur, .badge.expiree { background: var(--warn-bg); color: var(--warn); }
.badge.attention::before, .badge.erreur::before, .badge.expiree::before { content: '!'; font-weight: 800; }
.badge.broker { background: var(--iris-soft); color: var(--iris-dark); }
.badge.import { background: var(--sky-soft); color: var(--sky-ink); }
.pill { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 600; font-size: 0.8rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.pos { background: var(--green-soft); color: var(--pos); }
.pill.neg { background: var(--tomato-soft); color: var(--neg); }
.pill.small { font-size: 0.72rem; padding: 0.12rem 0.5rem; }

/* Boutons */
.btn {
  --bg: var(--surface); --fg: var(--ink); --bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: 500 var(--text-sm)/1.2 var(--font); padding: 0.68rem 1.15rem; min-height: 2.7rem;
  background: var(--bg); color: var(--fg); border: 1px solid var(--bd); border-radius: 14px;
  cursor: pointer; text-decoration: none; transition: background-color 150ms var(--ease), transform 100ms var(--ease);
}
.btn:hover { --bd: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { --bg: var(--iris-fill); --fg: #fff; --bd: var(--iris-fill); }
.btn.primary:hover { --bg: var(--iris-fill-hover); --bd: var(--iris-fill-hover); }
.btn.danger { --bg: var(--neg); --fg: #fff; --bd: var(--neg); }
.btn.danger-ghost { --fg: var(--neg); --bd: var(--danger-line); }
.btn.danger-ghost:hover { --bg: var(--tomato-soft); }
.btn.small { min-height: 2.25rem; padding: 0.42rem 0.9rem; }
.btn.tiny { min-height: 1.95rem; padding: 0.28rem 0.7rem; font-size: 0.76rem; border-radius: 10px; }
.btn.ghost { --bg: transparent; --bd: transparent; --fg: var(--ink-2); }
.btn.ghost:hover { --bg: var(--surface); }
.btn-row, .row-actions, .actions, .toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.actions { justify-content: flex-end; }
.row-actions { flex-wrap: nowrap; }
.toolbar { justify-content: space-between; }
.toolbar input[type=search] { flex: 1 1 14rem; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-2); padding: 0.2rem 0.5rem; border-radius: 12px; min-width: 2.5rem; min-height: 2.5rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Onglets internes */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-radius: 16px; padding: 0.3rem; box-shadow: var(--shadow); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; text-align: center; padding: 0.5rem 0.9rem; text-decoration: none; color: var(--ink-3); font-weight: 500; font-size: var(--text-sm); white-space: nowrap; border-radius: 12px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { background: var(--iris-fill); color: #fff; }

/* Formulaires */
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid transparent; border-radius: 14px; padding: 0.6rem 0.8rem; min-height: 2.75rem; width: 100%; }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--iris); outline: none; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--iris); flex: none; margin: 0.15rem 0 0; }
input[type=file] { padding: 0.4rem; }
.field { display: grid; gap: 0.3rem; align-content: start; }
.field > label, .field > span { font-size: var(--text-xs); font-weight: 500; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: var(--text-xs); }
.field.check { grid-template-columns: auto 1fr; gap: 0.2rem 0.6rem; align-items: start; }
.field.check small { grid-column: 2; }
.field.check label { font-weight: 400; color: var(--ink); font-size: var(--text-sm); }
.req { color: var(--neg); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 0.9rem 1rem; }
.form-grid .wide, .form-grid .form-errors, .form-grid .form-section { grid-column: 1 / -1; }
.form-section { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.form-errors { background: var(--tomato-soft); color: var(--neg); border-radius: 14px; padding: 0.7rem 0.9rem; display: grid; gap: 0.25rem; font-size: var(--text-sm); }
.inline-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline-form input { width: 6rem; text-transform: uppercase; }
.filters { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; }
.filter { display: grid; gap: 0.2rem; font-size: var(--text-xs); color: var(--ink-3); font-weight: 500; min-width: 8.5rem; flex: 0 0 auto; }
.filter.grow { flex: 1 0 12rem; }
.sum { font-weight: 600; font-size: var(--text-sm); }
.sum.ok { color: var(--pos); }
.sum.warn { color: var(--warn); }

/* Tableaux */
.table-wrap { overflow-x: auto; border-radius: var(--r-mid); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
th { text-align: left; font-weight: 500; font-size: var(--text-xs); color: var(--ink-3); background: var(--bg); padding: 0.65rem 0.75rem; white-space: nowrap; }
td { padding: 0.65rem 0.75rem; border-top: 1px solid var(--line); vertical-align: middle; }
td.warn { color: var(--warn); font-weight: 600; }

dl.kv { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem 1rem; margin: 0; font-size: var(--text-sm); }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
dl.kv.big dd { font-size: 1.15rem; font-weight: 600; }
.conn dl.kv { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
.conn dl.kv dd { text-align: left; margin-bottom: 0.4rem; }

.steps { display: grid; gap: 0.8rem; padding-left: 1.3rem; margin: 0; }
.steps.compact { gap: 0.3rem; font-size: var(--text-sm); }
.steps li::marker { font-weight: 600; color: var(--iris); }
.guide { border-top: 1px solid var(--line); padding-top: 0.9rem; font-size: var(--text-sm); }
.guide summary { cursor: pointer; font-weight: 600; color: var(--iris); }
.guide[open] { display: grid; gap: 0.75rem; }
.guide ol { display: grid; gap: 0.6rem; padding-left: 1.3rem; margin: 0; }
details.sub summary { cursor: pointer; font-weight: 500; font-size: var(--text-sm); }

/* Dialogues : feuille qui monte du bas */
dialog.modal { border: 0; padding: 0; width: min(36rem, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; border-radius: 26px 26px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -20px 50px -20px rgba(14, 6, 55, 0.4); }
dialog.modal.wide { width: min(46rem, 100vw); }
dialog.modal::backdrop { background: var(--scrim); }
dialog.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem 0.4rem; position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog.modal > header::before { content: ''; position: absolute; top: 0.45rem; left: 50%; width: 2.6rem; height: 4px; border-radius: 4px; background: var(--line-strong); transform: translateX(-50%); }
dialog.modal > header h2 { font-size: 1.1rem; }
dialog.modal > :not(header) { padding: 0.6rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); }
dialog[open] { animation: sheet 240ms var(--ease); }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.toasts { position: fixed; bottom: 6.5rem; right: 1rem; left: 1rem; display: grid; justify-items: center; gap: 0.5rem; z-index: 100; pointer-events: none; }
.toast { background: var(--night); color: #fff; padding: 0.65rem 1.05rem; border-radius: 14px; max-width: 28rem; animation: fade 200ms var(--ease); pointer-events: auto; font-size: var(--text-sm); }
.toast.error { background: var(--neg); }

/* Connexion */
#app.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(24rem, 100%); background: var(--surface); border-radius: 28px; padding: 2rem; display: grid; gap: 1.2rem; box-shadow: var(--shadow); }

@media (min-width: 900px) {
  dialog.modal, dialog.modal.wide { margin: auto; border-radius: 26px; }
  dialog.modal > header::before { display: none; }
}
@media (max-width: 520px) {
  .stats { gap: 0.45rem; }
  .stat { padding: 0.75rem 0.65rem; }
  .stat-value { font-size: 0.95rem; }
  .row-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Tableau de bord : zones de l'accueil et de l'immobilier */
.dash { display: grid; gap: 1rem; }
.dash > * { min-width: 0; }
.mono.small { width: 2.1rem; height: 2.1rem; font-size: 0.62rem; }
.columns { display: flex; gap: 0.5rem; align-items: stretch; height: 10rem; }
.col-item { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 0.35rem; min-width: 0; border-radius: 8px; }
.col-item > .col-bar { align-self: end; width: 100%; max-width: 2.4rem; justify-self: center; border-radius: 8px 8px 3px 3px; transform-origin: bottom; animation: rise-bar 520ms var(--ease) both; }
.col-label { font-size: 0.66rem; color: var(--ink-3); text-align: center; white-space: nowrap; overflow: hidden; }
.estate-balance { background: #22a06b; box-shadow: 0 18px 36px -20px rgba(34, 160, 107, 0.7); }
.estate-balance .bal-top { background: radial-gradient(120% 90% at 80% 0%, #39b981 0%, #22a06b 60%); }

/* Barre latérale : ordinateur seulement */
.sidebar { display: none; }
.workspace { min-width: 0; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .a-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .shell { max-width: none; margin: 0; padding: 0; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; }
  .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.4rem 1rem; background: var(--surface); border-right: 1px solid var(--line); }
  .side-logo { padding: 0 0.5rem; }
  .side-logo .logo { width: 92px; height: 46px; }
  .side-group { display: grid; gap: 2px; }
  .side-link { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
  .side-link:hover { background: var(--bg); color: var(--ink); }
  .side-link[aria-current='page'] { background: var(--iris-soft); color: var(--iris); }
  .side-link > span:nth-of-type(1) { flex: 1; }
  .side-foot { margin-top: auto; display: grid; gap: 0.2rem; }
  .side-foot .btn { justify-content: flex-start; }
  .workspace { padding: 1.4rem 2rem 3rem; max-width: 92rem; width: 100%; }
  .app-head { min-height: 3rem; }
  .app-head .logo { display: none; }
  .page-title { font-size: 1.6rem; }
  .toasts { bottom: 1.5rem; }

  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.1rem; align-items: start; }
  .dash > * { grid-column: span 12; }
  .stack:not(.dash) { max-width: 60rem; }
}

/* Immobilier : année et plateformes */
.year-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; background: var(--surface); border-radius: 16px; padding: 0.4rem 0.5rem 0.4rem 1rem; box-shadow: var(--shadow); }
.year-bar .periods { flex-wrap: wrap; justify-content: flex-end; }
.channel { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--iris-soft); color: var(--iris); font-weight: 600; font-size: 0.8rem; }
.channel.airbnb { background: #ff5a5f; }
.channel.booking { background: #003580; }
.ch-mask.airbnb { width: 1.2rem; height: 1.2rem; background: #fff; -webkit-mask: url('/img/airbnb.svg') center / contain no-repeat; mask: url('/img/airbnb.svg') center / contain no-repeat; }
.stays .row { grid-template-columns: auto minmax(0, 1fr) auto auto; }

main:focus, main:focus-visible { outline: none; }

/* Logo : plus grand, centré */
.logo { -webkit-mask-position: center; mask-position: center; }
.app-head .logo { width: 88px; height: 46px; }
.login-card .logo.big { width: 200px; height: 96px; justify-self: center; }
@media (min-width: 1100px) {
  .side-logo { display: flex; justify-content: center; padding: 0.4rem 0 0.6rem; }
  .side-logo .logo { width: 150px; height: 72px; }
}

.small-x { min-width: 2rem; min-height: 2rem; font-size: 1.2rem; color: var(--ink-3); }
[hidden] { display: none !important; }

/* Grilles des pages sur ordinateur */
@media (min-width: 1100px) {
  .dash > .a-balance { grid-column: span 4; align-self: stretch; }
  .dash > .a-stats { grid-column: span 8; grid-template-columns: repeat(2, minmax(0, 1fr)); align-self: stretch; }
  .dash > .a-stats .stat { padding: 1.1rem 1.2rem; align-content: center; }
  .dash > .a-stats .stat-value { font-size: 1.45rem; }
  .dash > .a-income, .dash > .a-positions { grid-column: span 8; }
  .dash > .a-alloc, .dash > .a-alerts { grid-column: span 4; }
}
.bal-total { display: inline-block; margin-top: 0.2rem; font-size: var(--text-xs); color: #fff; opacity: 0.9; text-decoration: underline; text-underline-offset: 3px; }

/* Statut d'un compte face à son allocation */
.status { flex: none; display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--text-xs); font-weight: 600; padding: 0.24rem 0.7rem; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.status::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--green-soft); color: var(--pos); }
.status.drift { background: var(--tomato-soft); color: var(--neg); }
.balance .status { background: #fff; }
.balance .status.todo { color: var(--iris-dark); }

/* Synchro dans la carte du total */
.bal-sync-row { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.3rem; }
.bal-sync { display: inline-flex; align-items: center; gap: 0.35rem; border: 0; cursor: pointer; font: 500 var(--text-xs) var(--font); color: #fff; background: rgba(255, 255, 255, 0.16); padding: 0.35rem 0.75rem; border-radius: 999px; }
.bal-sync:hover { background: rgba(255, 255, 255, 0.26); }
.bal-sync:disabled { opacity: 0.6; cursor: progress; }
.bal-actions.one { grid-template-columns: 1fr; }
.bal-action > span { font-weight: 700; font-size: 0.9rem; }


/* Cible et réel, deux barres alignées */
.twin { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.45rem 0.7rem; align-items: center; }
.twin-label { font-size: var(--text-xs); color: var(--ink-3); font-weight: 500; }
.twin-bar { display: flex; gap: 3px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.twin-bar > span { min-width: 3px; transform-origin: left; animation: grow 520ms var(--ease) both; }
.twin-bar > span.hatch, .fam-dot.hatch, .fam-legend i.hatch, .gauge-fill.hatch { background: var(--hatch); }
.fam-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: var(--text-sm); color: var(--ink-2); }
.fam-legend li { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; }
.fam-legend i { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none; align-self: center; }
.fam-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam-legend b { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.fam-legend b.off { color: var(--neg); }
.fam-legend small { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Familles de la page compte */
.fams { list-style: none; margin: 0; padding: 0; display: grid; }
.fam { display: grid; gap: 0.55rem; padding: 0.95rem 0; border-top: 1px solid var(--line); }
.fam:first-child { border-top: 0; padding-top: 0.2rem; }
.fam-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.7rem; align-items: center; }
.fam-head strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam-dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; flex: none; }
.fam-nums { display: grid; justify-items: end; line-height: 1.2; font-variant-numeric: tabular-nums; }
.fam-nums b { font-weight: 600; font-size: 1.05rem; }
.fam-nums small { font-size: 0.7rem; color: var(--ink-3); }
.gap { display: inline-flex; justify-content: center; min-width: 4.4rem; font-size: var(--text-xs); font-weight: 600; padding: 0.22rem 0.55rem; border-radius: 999px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gap.ok { background: var(--green-soft); color: var(--pos); }
.gap.drift { background: var(--tomato-soft); color: var(--neg); }
.gauge { position: relative; height: 10px; border-radius: 999px; background: var(--bg); }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; min-width: 3px; transform-origin: left; animation: grow 520ms var(--ease) both; }
.gauge-target { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.fam-etfs { list-style: none; margin: 0; padding: 0 0 0 1.5rem; display: grid; gap: 0.25rem; font-size: var(--text-sm); }
.fam-etfs li { display: flex; justify-content: space-between; gap: 0.8rem; min-width: 0; }
.fam-etfs li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fam-etfs b { font-weight: 600; }
.fam-etfs small { color: var(--ink-3); }
.fam.outside .fam-head strong { color: var(--ink-2); }
.empty-alloc .steps { font-size: var(--text-sm); }

/* J'investis */
.amount { display: flex; align-items: center; gap: 0.4rem; background: var(--bg); border-radius: 18px; padding: 0.3rem 1rem; }
.amount:focus-within { box-shadow: 0 0 0 2px var(--iris); background: var(--surface); }
.amount input { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; background: none; border: 0; padding: 0.3rem 0; min-height: 0; font-variant-numeric: tabular-nums; }
.amount input:focus { background: none; }
.amount-ccy { font-size: 1.4rem; font-weight: 600; color: var(--ink-3); }
.periods.left { justify-content: flex-start; flex-wrap: wrap; }
.periods.left .period { background: var(--bg); color: var(--ink-2); }
.periods.left .period:hover { background: var(--iris-soft); color: var(--iris); }
.buy-out { display: grid; gap: 0.7rem; }
.buys { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.buy { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.75rem 0.85rem; border-radius: 16px; background: var(--iris-soft); }
.buy-main, .buy-end { display: grid; min-width: 0; }
.buy-main strong { font-weight: 600; }
.buy-main small, .buy-end small { font-size: var(--text-xs); color: var(--ink-3); }
.buy-end { justify-items: end; font-variant-numeric: tabular-nums; }
.buy-end strong { font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.buy-after { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-2); }

.sheet-icon.green { background: var(--green-soft); color: var(--green); }

/* Éditeur d'allocation */
.editor { display: grid; gap: 1.1rem; }
.step { border: 0; margin: 0; padding: 1rem; border-radius: 18px; background: var(--bg); display: grid; gap: 0.75rem; min-width: 0; }
.step legend { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; padding: 0; float: left; width: 100%; }
.step legend + * { clear: both; }
.step-n { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--iris-fill); color: #fff; font-size: 0.78rem; }
.step input, .step select { background: var(--surface); }
.fam-edits, .etf-edits { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.fam-edit { display: grid; grid-template-columns: auto minmax(0, 1fr) 6.2rem auto; gap: 0.5rem; align-items: center; }
.pct-input { display: flex; align-items: center; gap: 0.35rem; font-size: var(--text-sm); color: var(--ink-3); }
.pct-input input { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pct-input.share input { width: 4.6rem; }
.suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-add { border: 1px dashed var(--line-strong); background: var(--surface); color: var(--ink-2); font: 500 var(--text-xs) var(--font); padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer; }
.chip-add:hover { border-color: var(--iris); color: var(--iris); }
.etf-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, 12rem); gap: 0.4rem 0.6rem; align-items: center; padding: 0.55rem 0.7rem; background: var(--surface); border-radius: 14px; }
.etf-edit .share { grid-column: 1 / -1; justify-content: flex-end; }
.etf-name { display: grid; min-width: 0; }
.etf-name small { color: var(--ink-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drift { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: var(--text-sm); }
.drift input { width: 5rem; text-align: right; font-weight: 600; }
@media (max-width: 520px) {
  .fam-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .fam-head .gap, .fam-head .btn { grid-column: 2 / -1; justify-self: start; }
  .etf-edit { grid-template-columns: minmax(0, 1fr); }
}
.amount input { -moz-appearance: textfield; appearance: textfield; }
.amount input::-webkit-inner-spin-button, .amount input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Courbes */
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: var(--text-xs); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i, .dot { display: inline-block; width: 0.62rem; height: 0.62rem; border-radius: 50%; flex: none; }
.legend .line-key { width: 1rem; height: 3px; border-radius: 2px; }
.chart-block { display: grid; gap: 0.6rem; }
.chart { margin: 0; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart .line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.1; }
.chart .grid { stroke: var(--line); }
.chart .tick { fill: var(--ink-3); font-size: 12px; font-family: var(--font); }
.chart .cross { stroke: var(--line-strong); }
.chart .cross-dot { stroke: var(--surface); stroke-width: 2; }
.data-table summary { cursor: pointer; font-size: var(--text-xs); color: var(--ink-3); width: fit-content; }
.data-table[open] { display: grid; gap: 0.5rem; }
.chart-empty { display: grid; gap: 0.3rem; place-content: center; text-align: center; min-height: 8rem; border-radius: var(--r-mid); background: var(--bg); color: var(--ink-2); font-size: var(--text-sm); padding: 1.2rem; }

/* Bourse */
.bourse .year-bar { flex-wrap: wrap; padding: 0.45rem 0.5rem; }
a.period { text-decoration: none; display: inline-flex; align-items: center; }
.b-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.b-stats .stat { padding: 1rem 1.1rem; gap: 0.3rem; }
.b-stats .stat-value { font-size: 1.35rem; }
.perf-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.perf-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.b-perf .periods { flex-wrap: wrap; }
.donuts { display: flex; justify-content: space-around; gap: 1rem; flex-wrap: wrap; }
.donut { margin: 0; display: grid; justify-items: center; gap: 0.5rem; }
.donut figcaption { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.donut-ring { position: relative; }
.donut-ring svg { display: block; }
.donut-arc { transition: stroke-width 150ms var(--ease); cursor: default; }
.donut-arc:hover, .donut-arc:focus-visible { stroke-width: 30; outline: none; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-center small { font-size: var(--text-xs); color: var(--ink-3); }
.donut-empty { width: 176px; height: 176px; border-radius: 50%; border: 24px solid var(--bg); display: grid; place-content: center; justify-items: center; gap: 0.4rem; color: var(--ink-3); font-size: var(--text-sm); }
.fam-filter { width: auto; min-width: 12rem; }
.lines th { padding: 0; }
.sort { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 0.35rem; width: 100%; padding: 0.65rem 0.75rem; cursor: pointer; }
.num .sort { justify-content: flex-end; }
.sort:hover, .sort.on { color: var(--ink); }
.sort:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.sort-arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.sort-arrow.desc { border-top: 5px solid currentColor; }
.sort-arrow.asc { border-bottom: 5px solid currentColor; }
.lines td { white-space: nowrap; }
.etf-cell { display: grid; min-width: 9rem; }
.etf-cell small { color: var(--ink-3); font-size: var(--text-xs); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.fam-tag { display: inline-flex; align-items: center; gap: 0.4rem; }
.fam-tag i { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none; }
.fam-tag i.hatch { background: var(--hatch); }
@media (max-width: 640px) {
  .b-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-stats .stat-value { font-size: 1.05rem; }
  .perf-value { font-size: 1.5rem; }
}
@media (min-width: 1100px) {
  .bourse > .b-perf { grid-column: span 8; }
  .bourse > .b-donut { grid-column: span 4; align-self: stretch; }
  .bourse > .b-alloc { grid-column: 1 / -1; }
}
.periods.left .period.on, .periods.left .period.on:hover { background: var(--iris-fill); color: #fff; }
.bal-warn { color: #fff; opacity: 1; font-weight: 600; background: rgba(255, 103, 64, 0.85); padding: 0.2rem 0.6rem; border-radius: 999px; text-decoration: none; }
.etf-edit.planned { box-shadow: inset 0 0 0 1px var(--iris-mid); }
.etf-edit .btn.tiny { grid-column: 1 / -1; justify-self: end; }
.add-etf { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.add-etf input { flex: 1 1 10rem; text-transform: uppercase; }
.freshness { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: var(--text-xs); color: var(--ink-3); margin: -0.4rem 0 0 0.3rem; }
.etf-cell b { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Accueil : patrimoine, puis bourse et Ti Paradis à égalité */
.home { display: grid; gap: 1rem; }
.home > * { min-width: 0; }
.split { display: flex; gap: 3px; width: min(26rem, 100%); height: 12px; margin: 0.35rem auto 0; border-radius: 999px; overflow: hidden; }
.split > span { min-width: 6px; transform-origin: left; animation: grow 520ms var(--ease) both; }
.split-stock, .split-legend .k-stock { background: #fff; }
.split-estate, .split-legend .k-estate { background: #86e3b8; }
.split-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.2rem; font-size: var(--text-sm); }
.split-legend li { display: inline-flex; align-items: center; gap: 0.4rem; opacity: 0.95; }
.split-legend i { width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.split-legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.pillar { gap: 1.1rem; }
.pillar-stock { box-shadow: inset 0 4px 0 var(--iris), var(--shadow); }
.pillar-estate { box-shadow: inset 0 4px 0 var(--green), var(--shadow); }
.pillar-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; text-decoration: none; color: inherit; border-radius: 14px; }
.pillar-head h2 { font-size: 1.15rem; }
.pillar-head > svg { color: var(--ink-3); transition: transform 160ms var(--ease); }
.pillar-head:hover > svg { transform: translateX(3px); color: var(--ink); }
.pillar-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.pf { display: grid; gap: 0.15rem; padding: 0.75rem 0.8rem; border-radius: 14px; background: var(--bg); min-width: 0; }
.pf span { font-size: 0.7rem; color: var(--ink-3); }
.pf b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf.pos b { color: var(--pos); }
.pf.neg b { color: var(--neg); }
.pf.cash { background: var(--sky-soft); }
.pf.cash b { color: var(--sky-ink); }
.pillar-accounts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.pillar-accounts a { display: grid; gap: 0.6rem; padding: 0.85rem 0.95rem; border-radius: 16px; border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
.pillar-accounts a:hover { border-color: var(--iris-mid); background: var(--iris-soft); }
.pa-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.pa-head strong { font-weight: 600; }
.pa-value { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.pillar-cta { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0.9rem; border-radius: 14px; background: var(--tomato-soft); color: var(--neg); font-weight: 600; font-size: var(--text-sm); text-decoration: none; }
.pillar-cta:hover { background: var(--tomato-hover); }
.estate-yield-big { display: grid; gap: 0.1rem; }
.estate-yield-big b { font-size: clamp(2.2rem, 1.8rem + 1.6vw, 2.8rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; color: var(--green); font-variant-numeric: tabular-nums; }
.estate-yield-big span { font-size: var(--text-sm); color: var(--ink-2); }
.estate-yield-big small { font-size: var(--text-xs); color: var(--ink-3); }
.pillar-chart .columns { height: 6.5rem; }
.pillar-next { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.75rem 0.9rem; border-radius: 14px; background: var(--green-soft); color: var(--ink-2); font-size: var(--text-sm); }
.pillar-next svg { flex: none; margin-top: 0.15rem; color: var(--green); }
.pillar-next b { color: var(--pos); font-weight: 600; }
@media (max-width: 520px) {
  .pf { padding: 0.6rem; }
  .pf b { font-size: 0.92rem; }
}
@media (min-width: 1100px) {
  .home { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; align-items: stretch; }
  .home > .home-hero { grid-column: 1 / -1; }
  .home-hero .bal-top { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'label split' 'value split' 'sync split'; justify-items: start; text-align: left; column-gap: 3rem; padding: 1.6rem 2rem; }
  .home-hero .bal-label { grid-area: label; }
  .home-hero .bal-value { grid-area: value; }
  .home-hero .bal-sync-row { grid-area: sync; justify-content: flex-start; }
  .home-hero .split { grid-area: split; align-self: center; width: 100%; height: 16px; margin: 0; }
  .home-hero .split-legend { grid-area: split; align-self: end; justify-content: flex-start; }
}
.stock-yield.up b { color: var(--iris); }
.stock-yield.down b { color: var(--neg); }

/* Assurance vie */
.life-balance { background: #2e9ccf; box-shadow: 0 18px 36px -20px rgba(46, 156, 207, 0.7); }
.life-balance .bal-top { background: radial-gradient(120% 90% at 80% 0%, #4fb3e0 0%, #2e9ccf 60%); }
.bal-actions.two { grid-template-columns: 1fr 1fr; }
.split-life, .split-legend .k-life { background: #8fd3f2; }
.pillar-life { box-shadow: inset 0 4px 0 var(--sky), var(--shadow); }
.sheet-icon.sky { background: var(--sky-soft); color: var(--sky); }
.life-yield.up b { color: var(--sky); }
.life-yield.down b { color: var(--neg); }
.life-next { background: var(--sky-soft); }
.life-next svg { color: var(--sky); }
.life-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.life-rows li { display: grid; grid-template-columns: minmax(0, 1fr) 9rem 6.5rem; gap: 0.5rem; align-items: center; }
.step .life-rows li { grid-template-columns: minmax(0, 1fr) 10rem auto; }
.life-name { display: grid; font-size: var(--text-sm); min-width: 0; }
.life-name small { color: var(--ink-3); font-size: var(--text-xs); }
.life-rows .pct-input input { text-align: right; }
@media (max-width: 640px) {
  .life-rows li, .step .life-rows li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .life-name { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .life > .l-hero { grid-column: span 7; }
  .life > .l-split { grid-column: span 5; align-self: stretch; }
  .life > .l-wide { grid-column: span 12; }
}

/* Mode sombre : réglages fins */
.theme-switch { justify-self: start; display: inline-flex; gap: 0.25rem; padding: 0.25rem; border-radius: 14px; background: var(--bg); }
.theme-switch button { border: 0; background: none; color: var(--ink-2); font: 500 var(--text-sm) var(--font); padding: 0.45rem 0.9rem; border-radius: 10px; cursor: pointer; }
.theme-switch button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Masquer les montants */
.home-hero { position: relative; }
.hero-tools { position: absolute; top: 0.9rem; right: 0.9rem; z-index: 2; display: flex; gap: 0.45rem; }
.mask-btn { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(255, 255, 255, 0.16); transition: background-color 150ms var(--ease); }
.mask-btn:hover { background: rgba(255, 255, 255, 0.28); }
.mask-btn[aria-pressed='true'] { background: #fff; color: #3f3db8; }
@media (max-width: 1099px) {
  .home-hero .bal-top { padding-top: 3.6rem; }
}
.pillar-alloc { display: grid; gap: 0.6rem; padding: 0.85rem 0.95rem; border-radius: 16px; border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
.pillar-alloc:hover { border-color: var(--iris-mid); background: var(--iris-soft); }
.pillar-alloc .pa-head { justify-content: space-between; }
