/* Version calme : tons neutres et chauds, une seule couleur d'accent, filets fins à la place des ombres */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --ink: #232321;
  --ink-2: #5c5a55;
  --ink-3: #8f8c85;
  --line: #ebe9e4;
  --line-strong: #dcd9d2;
  --iris: #4f5891;
  --iris-dark: #3d4575;
  --iris-fill: #2b2b29;
  --iris-fill-hover: #44443f;
  --iris-soft: #efeee9;
  --iris-mid: #d8d6cf;
  --night: #232321;
  --tomato: #c08a6c;
  --tomato-soft: #f6ebe5;
  --tomato-hover: #f0dfd6;
  --green: #6e8c63;
  --green-soft: #edf1e9;
  --sky: #6f9aa8;
  --sky-soft: #ebf1f3;
  --sky-ink: #3f6672;
  --pos: #3f6f45;
  --neg: #a3483b;
  --warn: #8a6116;
  --warn-bg: #f6efdc;
  --warn-ink: #5b4210;
  --danger-line: #ecd3cc;
  --focus: #4f5891;
  --hatch: repeating-linear-gradient(135deg, #cfccc4 0 3px, transparent 3px 7px);
  --hatch-a: #efede8;
  --hatch-b: #cfccc4;
  --shadow: none;
  --scrim: rgba(35, 35, 33, 0.35);
  --r-card: 14px;
  --r-mid: 10px;
  --k-stock: #6670a8;
  --k-life: #9bb5bd;
  --k-estate: #b9c8ae;
  --k-home: #c9b29a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161615;
    --surface: #1e1e1c;
    --ink: #ecebe7;
    --ink-2: #b5b2aa;
    --ink-3: #8a877f;
    --line: #2c2b29;
    --line-strong: #3a3936;
    --iris: #a9b0dc;
    --iris-dark: #c2c8ea;
    --iris-fill: #4b527f;
    --iris-fill-hover: #5a6292;
    --iris-soft: #262624;
    --iris-mid: #3a3936;
    --night: #0d0d0c;
    --tomato: #d49a7c;
    --tomato-soft: #2e2420;
    --tomato-hover: #3a2d27;
    --green: #94b088;
    --green-soft: #1f2a1d;
    --sky: #8fb7c4;
    --sky-soft: #1b2629;
    --sky-ink: #a9cbd6;
    --pos: #9cc49f;
    --neg: #e0907f;
    --warn: #d9b26a;
    --warn-bg: #2c2617;
    --warn-ink: #e8cf9c;
    --danger-line: #4a2d27;
    --focus: #a9b0dc;
    --hatch: repeating-linear-gradient(135deg, #4a4844 0 3px, transparent 3px 7px);
    --hatch-a: #262624;
    --hatch-b: #4a4844;
    --scrim: rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme='dark'] {
  --bg: #161615;
  --surface: #1e1e1c;
  --ink: #ecebe7;
  --ink-2: #b5b2aa;
  --ink-3: #8a877f;
  --line: #2c2b29;
  --line-strong: #3a3936;
  --iris: #a9b0dc;
  --iris-dark: #c2c8ea;
  --iris-fill: #4b527f;
  --iris-fill-hover: #5a6292;
  --iris-soft: #262624;
  --iris-mid: #3a3936;
  --night: #0d0d0c;
  --tomato: #d49a7c;
  --tomato-soft: #2e2420;
  --tomato-hover: #3a2d27;
  --green: #94b088;
  --green-soft: #1f2a1d;
  --sky: #8fb7c4;
  --sky-soft: #1b2629;
  --sky-ink: #a9cbd6;
  --pos: #9cc49f;
  --neg: #e0907f;
  --warn: #d9b26a;
  --warn-bg: #2c2617;
  --warn-ink: #e8cf9c;
  --danger-line: #4a2d27;
  --focus: #a9b0dc;
  --hatch: repeating-linear-gradient(135deg, #4a4844 0 3px, transparent 3px 7px);
  --hatch-a: #262624;
  --hatch-b: #4a4844;
  --scrim: rgba(0, 0, 0, 0.55);
}

.logo { background: var(--ink); }
.card, .stat, .year-bar, .tabs, .login-card { border: 1px solid var(--line); box-shadow: none; }
.tabbar { box-shadow: none; border-top: 1px solid var(--line); border-radius: 0; }
.tabbar a[aria-current='page'] { color: var(--ink); }
.tabbar a[aria-current='page'] svg { background: none; }
.side-link[aria-current='page'] { background: var(--bg); color: var(--ink); }
.period.on, .periods.left .period.on, .periods.left .period.on:hover { background: var(--iris-fill); color: #fff; }
.periods.left .period:hover { background: var(--iris-soft); color: var(--ink); }

/* Bandeaux de page : surface claire, plus de grand aplat coloré */
.balance, .estate-balance, .life-balance { background: var(--surface); color: var(--ink); box-shadow: none; border: 1px solid var(--line); border-radius: var(--r-card); }
.bal-top, .estate-balance .bal-top, .life-balance .bal-top { background: none; }
.bal-label, .bal-date { color: var(--ink-3); opacity: 1; }
.bal-pill, .bal-pill.muted-pill { background: var(--bg); color: var(--ink-2); }
.balance .term summary { color: var(--ink-3); }
.bal-actions { background: none; border-top: 1px solid var(--line); }
.bal-action { color: var(--ink-2); }
.bal-action > span, .bal-action:hover > span { background: var(--bg); }
.bal-total { color: var(--ink-2); }
.bal-sync { color: var(--ink-2); background: var(--bg); }
.bal-sync:hover { background: var(--iris-soft); }
.bal-warn { color: var(--neg); background: var(--tomato-soft); }
.balance .status { background: var(--bg); }
.mask-btn { color: var(--ink-2); background: none; border: 1px solid var(--line); }
.mask-btn:hover { background: var(--bg); }
.mask-btn[aria-pressed='true'] { background: var(--ink); color: var(--surface); }

/* Accueil : le total posé sur la page, puis des cartes au même gabarit */
.home { gap: 0.9rem; }
.home-hero { background: none; border: 0; }
.home-hero .bal-top { justify-items: start; text-align: left; padding: 0.4rem 0.2rem 0.8rem; }
.home-hero .bal-value { font-size: clamp(2.3rem, 1.7rem + 2.6vw, 3.2rem); font-weight: 500; letter-spacing: -0.03em; }
.home-hero .split { height: 6px; margin: 0.6rem 0 0.2rem; }
.home-hero .split-legend { justify-content: flex-start; color: var(--ink-2); }
.home-hero .bal-sync-row { justify-content: flex-start; }
.split-stock, .split-legend .k-stock { background: var(--k-stock); }
.split-life, .split-legend .k-life { background: var(--k-life); }
.split-estate, .split-legend .k-estate { background: var(--k-estate); }
.split-home, .split-legend .k-home { background: var(--k-home); }
.hero-tools { top: 0.2rem; right: 0.2rem; }
@media (max-width: 1099px) {
  .home-hero .bal-top { padding-top: 0.4rem; }
}
@media (min-width: 1100px) {
  .home-hero .bal-top { padding: 0.4rem 0.2rem 1rem; }
  .home-hero .split { height: 8px; }
}

.pillar { gap: 1rem; padding: 1.2rem 1.3rem; }
.pillar-head { grid-template-columns: auto minmax(0, 1fr) auto; }
.pillar-ico { width: 2.1rem; height: 2.1rem; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--ink-2); }
.pillar-head h2 { font-size: 1rem; font-weight: 600; }
.pillar-main { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; }
.pillar-value { font-size: clamp(1.7rem, 1.4rem + 1vw, 2.1rem); font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pillar-change { display: grid; justify-items: end; text-align: right; flex: none; }
.pillar-change b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pillar-change span { font-size: var(--text-xs); color: var(--ink-3); }
.pillar-change.pos b { color: var(--pos); }
.pillar-change.neg b { color: var(--neg); }
.pillar-facts { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin: 0; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.pillar-facts div { display: grid; gap: 0.1rem; }
.pillar-facts dt { font-size: var(--text-xs); color: var(--ink-3); }
.pillar-facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.pillar-facts dd.pos { color: var(--pos); }
.pillar-facts dd.neg { color: var(--neg); }
.pillar-facts dd.warn { color: var(--warn); }
.pillar-alloc { padding: 0; border: 0; border-radius: 0; gap: 0.5rem; }
.pillar-alloc:hover { background: none; }
.pillar-alloc .pa-head span:first-child { font-size: var(--text-xs); color: var(--ink-3); }
.pillar-alloc .twin-bar { height: 6px; }
.status, .status.ok, .status.drift { background: none; padding: 0; }

/* Icônes des familles d'investissement */
.fam-ico { width: 1.6rem; height: 1.6rem; border-radius: 8px; display: inline-grid; place-items: center; flex: none; background: color-mix(in srgb, currentColor 16%, transparent); }
.fam-ico svg { stroke-width: 2.1; }
.fam-ico.hatch { background: var(--hatch); }
.fam-legend .fam-ico, .fam-tag .fam-ico { width: 1.35rem; height: 1.35rem; border-radius: 6px; }
.pa-fams { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.pa-fams li { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--text-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Logo : le C découpé dans un bloc, une tête au-dessus */
.logo { background: var(--iris); }
.app-head .logo { width: 30px; height: 40px; }
.side-logo { display: flex; align-items: center; justify-content: flex-start; gap: 0.7rem; padding: 0.2rem 0.75rem 0.6rem; text-decoration: none; color: var(--ink); }
.side-logo .logo { width: 28px; height: 38px; }
.side-name { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; padding-top: 10px; }
.login-card .logo.big { width: 54px; height: 72px; }
@media (min-width: 1100px) {
  .side-logo { justify-content: flex-start; padding: 0.2rem 0.75rem 0.6rem; }
  .side-logo .logo { width: 28px; height: 38px; }
}

/* Crédit de la résidence : part déjà remboursée */
.loan-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.loan-bar span { display: block; height: 100%; background: var(--pos); border-radius: inherit; }


/* Outils */
.tool-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.6rem; }
.tool-tile { display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.tool-tile:hover { border-color: var(--line-strong); }
.tool-tile:active { transform: scale(0.98); }
.tool-tile.on { border-color: var(--iris); box-shadow: inset 0 0 0 1px var(--iris); }
.tool-ico { width: 2.3rem; height: 2.3rem; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bg); color: var(--ink-2); }
.tool-tile.on .tool-ico { background: var(--iris); color: var(--surface); }
.tool-txt { display: grid; gap: 0.1rem; min-width: 0; }
.tool-txt strong { font-weight: 600; font-size: 0.98rem; }
.tool-txt small { color: var(--ink-3); font-size: var(--text-xs); }
@media (max-width: 640px) {
  .tool-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .tool-tile { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.7rem; }
  .tool-txt strong { font-size: var(--text-sm); line-height: 1.25; }
  .tool-txt small { display: none; }
}

.tool { gap: 1.1rem; }
.sentence { margin: 0; font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem); line-height: 2.1; letter-spacing: -0.01em; color: var(--ink-2); }
.blank { font: inherit; font-weight: 600; color: var(--ink); background: var(--iris-soft); border: 0; border-bottom: 2px solid var(--iris); border-radius: 8px 8px 2px 2px; padding: 0 0.35ch; margin: 0 0.1ch; text-align: center; -moz-appearance: textfield; }
.blank::-webkit-inner-spin-button, .blank::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.blank::placeholder { color: var(--ink-3); font-weight: 400; font-size: 0.8em; }
.blank:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--focus); }

.tool-result { display: grid; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.tool-result .meta { margin: 0; }
.tool-big { font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3rem); font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); gap: 2px; }
.split-bar span { display: block; height: 100%; }
.sb-paid { background: #b3afa6; }
.sb-gain { background: var(--k-stock); }
.split-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; font-size: var(--text-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.split-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.split-legend i { width: 0.6rem; height: 0.6rem; border-radius: 3px; display: inline-block; }
.tool-verdict { margin: 0; padding: 0.8rem 1rem; border-radius: var(--r-mid); background: var(--bg); color: var(--ink-2); line-height: 1.5; }
.tool-verdict b { color: var(--ink); }
.tool-verdict.pos b, .tool-verdict.pos { color: var(--pos); }

.duel { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.8rem; }
.duel-side { display: grid; gap: 0.6rem; align-content: start; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--r-card); }
.duel-side.win { border-color: var(--pos); box-shadow: inset 0 0 0 1px var(--pos); }
.duel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.duel-head h3 { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.duel-value { font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem); font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.duel-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.duel-bar span { display: block; height: 100%; border-radius: inherit; background: var(--ink-3); transition: transform 0.3s; }
.duel-side.win .duel-bar span { background: var(--pos); }
.duel-side .pillar-facts { padding-top: 0.7rem; }
.tool-result .split-legend { justify-content: flex-start; }
.tool .legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }

