/* Numexia · piste D (refonte visuelle, vague 1). Loaded after the older sheets; only theme-d-screens.css and v34-feedback.css come after it (order in index.html).
   Redefines the tokens (dark by default, light through the existing switch), the type (Outfit for text, Unbounded for big
   numbers and page titles, JetBrains Mono only for the number columns of tables), the shell (sidebar ≥ 1100 px, floating
   bottom bar below), the Accueil and Budget › Mois layouts, and the motion. No looping animation; all off under reduced motion. */

/* ---------- Fonts (self-hosted: the CSP allows fonts from 'self' only, and the app must work offline) ---------- */
@font-face { font-family: 'Outfit'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/outfit-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Outfit'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/outfit-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/fonts/unbounded-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/fonts/unbounded-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---------- Tokens: dark (default) ---------- */
:root {
  color-scheme: dark;
  --plane: #0A0912; --surface: #14121E; --surface-2: #1B1828; --surface-3: #242036;
  --ink-1: #F2F0FA; --ink-2: #9A95B3; --ink-3: #8E89A8;
  --grid: #221F2E; --axis: #34304A;
  --border: rgba(255, 255, 255, .07); --border-strong: rgba(255, 255, 255, .13);
  --accent: #A78BFA; --accent-strong: #7C5CFC; --accent-ink: #120A26; --accent-soft: rgba(167, 139, 250, .12); --accent-line: rgba(167, 139, 250, .35); --accent-text: #C4B5FD;
  --glow: 0 10px 30px rgba(124, 92, 252, .35);
  --st-good: #3DD9A4; --st-warning: #F6B64A; --st-serious: #FF8F6B; --st-critical: #FF6B81; --st-info: #8E89A8;
  --warn-ink: #F6B64A; --serious-ink: #FF8F6B;
  --pos: #3DD9A4; --neg: #FF6B81; --c-income: #3DD9A4;
  --track: rgba(255, 255, 255, .08); --inset: rgba(255, 255, 255, .04); --grid-line: rgba(255, 255, 255, .06);
  --hero-1: #1C1830; --hero-border: rgba(167, 139, 250, .3); --hero-shadow: 0 20px 60px rgba(124, 92, 252, .16);
  --page-glow: rgba(124, 92, 252, .26);
  --shadow: none; --shadow-pop: 0 18px 48px rgba(0, 0, 0, .55);
  --glass: rgba(20, 18, 30, .92);
  --radius: 20px;
  --font: 'Outfit', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
/* ---------- Tokens: light (same palette, AA contrast for text) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --plane: #F6F5FB; --surface: #FFFFFF; --surface-2: #F1EFF8; --surface-3: #E7E4F2;
  --ink-1: #15131F; --ink-2: #5E5A73; --ink-3: #6B6782;
  --grid: #ECEAF3; --axis: #D3CFE0;
  --border: rgba(21, 19, 31, .09); --border-strong: rgba(21, 19, 31, .16);
  --accent: #6D4AFF; --accent-strong: #5A35F0; --accent-ink: #FFFFFF; --accent-soft: rgba(109, 74, 255, .09); --accent-line: rgba(109, 74, 255, .32); --accent-text: #5A35F0;
  --glow: 0 8px 22px rgba(109, 74, 255, .28);
  --st-good: #0E9F6E; --st-warning: #B7791F; --st-serious: #C2410C; --st-critical: #D6334F; --st-info: #6B6782;
  --warn-ink: #8A5A12; --serious-ink: #B23A0B;
  --pos: #0B7F58; --neg: #C42847; --c-income: #0E9F6E;
  --track: rgba(21, 19, 31, .08); --inset: #F7F6FC; --grid-line: rgba(21, 19, 31, .07);
  --hero-1: #EFE9FF; --hero-border: rgba(109, 74, 255, .28); --hero-shadow: 0 16px 40px rgba(109, 74, 255, .12);
  --page-glow: rgba(109, 74, 255, .12);
  --shadow: 0 1px 2px rgba(21, 19, 31, .04), 0 8px 24px rgba(21, 19, 31, .05); --shadow-pop: 0 18px 48px rgba(21, 19, 31, .18);
  --glass: rgba(255, 255, 255, .9);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --plane: #F6F5FB; --surface: #FFFFFF; --surface-2: #F1EFF8; --surface-3: #E7E4F2;
    --ink-1: #15131F; --ink-2: #5E5A73; --ink-3: #6B6782;
    --grid: #ECEAF3; --axis: #D3CFE0;
    --border: rgba(21, 19, 31, .09); --border-strong: rgba(21, 19, 31, .16);
    --accent: #6D4AFF; --accent-strong: #5A35F0; --accent-ink: #FFFFFF; --accent-soft: rgba(109, 74, 255, .09); --accent-line: rgba(109, 74, 255, .32); --accent-text: #5A35F0;
    --glow: 0 8px 22px rgba(109, 74, 255, .28);
    --st-good: #0E9F6E; --st-warning: #B7791F; --st-serious: #C2410C; --st-critical: #D6334F; --st-info: #6B6782;
    --warn-ink: #8A5A12; --serious-ink: #B23A0B;
    --pos: #0B7F58; --neg: #C42847; --c-income: #0E9F6E;
    --track: rgba(21, 19, 31, .08); --inset: #F7F6FC; --grid-line: rgba(21, 19, 31, .07);
    --hero-1: #EFE9FF; --hero-border: rgba(109, 74, 255, .28); --hero-shadow: 0 16px 40px rgba(109, 74, 255, .12);
    --page-glow: rgba(109, 74, 255, .12);
    --shadow: 0 1px 2px rgba(21, 19, 31, .04), 0 8px 24px rgba(21, 19, 31, .05); --shadow-pop: 0 18px 48px rgba(21, 19, 31, .18);
    --glass: rgba(255, 255, 255, .9);
  }
}

/* Tones: --tone (fills, borders) and --tone-ink (text, AA). */
.tone-good { --tone: var(--st-good); --tone-ink: var(--pos); }
.tone-warning { --tone: var(--st-warning); --tone-ink: var(--warn-ink); }
.tone-serious { --tone: var(--st-serious); --tone-ink: var(--serious-ink); }
.tone-critical { --tone: var(--st-critical); --tone-ink: var(--neg); }
.tone-accent { --tone: var(--accent); --tone-ink: var(--accent-text); }
.tone-neutral, .tone-plain { --tone: var(--accent); --tone-ink: var(--ink-1); }
.tone-text-good { color: var(--pos); } .tone-text-warning { color: var(--warn-ink); } .tone-text-critical { color: var(--neg); } .tone-text-plain { color: var(--ink-1); }

/* ---------- Type ---------- */
body { font-family: var(--font); font-size: 15px; font-variant-numeric: tabular-nums; }
h1 { font-family: var(--font-display); font-weight: 500; font-size: 24px; letter-spacing: -0.02em; }
h2, h3, .card-head h2 { font-family: var(--font); font-weight: 600; letter-spacing: 0; }
h2 { font-size: 15.5px; }
.wordmark { font-family: var(--font-display); font-weight: 500; letter-spacing: .1em; font-size: 14px; }
.hero-num, .kpi strong, .nw-total strong, .goal-amt strong, .verdict-text, .amount-input, .amount-cur, .env-kpis strong, .pocket strong, .pocket-main strong, .acc-bal, .qc-status-word, .rp-kpis strong, .mlogo-letter, .friend-ava {
  font-family: var(--font-display); letter-spacing: -0.02em;
}
.kpi strong { font-size: 20px; font-weight: 500; }
.verdict-text { font-weight: 500; }
/* Labels are sentences in Outfit, normal case: no small mono capitals anywhere. */
.eyebrow, .label, .kpi > span:first-child, .table th, .field-label, .day-head, .legend, .chart .tick, .col-label, .col-val, .up-day, .hero-meta, .sync, .mchip,
.pivot-head th, .favs-label, .mpick-tag, .month-sum, button.month-sum, button.month-sum small, p.month-sum-planned small, .delta-line, .stat-chip .mono,
.split-rest, .audit-count, .cap-val, .env-caps .cap-val, .pq-chips .favs-label, .pocket-main .delta-line, .rp-kpis span, .badge-est, .sg-tick, .ledger th.col-bal, .tier-kind, .kind-badge, .virtual-badge {
  font-family: var(--font); text-transform: none; letter-spacing: 0;
}
.eyebrow, .label, .kpi > span:first-child, .field-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.table th { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.day-head { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.month-sum, button.month-sum { font-size: 12.5px; }
.kind-badge, .virtual-badge { font-size: 11px; font-weight: 600; }
/* JetBrains Mono: number columns of tables only (alignment). */
.table td.num, .table tfoot td.num, .table td.col-amt, .table td.col-bal, .bud-table td.num, .rp-table .num { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0; }
.hero-label, .card .hero-label { margin: 0; font: 500 13px/1.3 var(--font); color: var(--ink-2); text-transform: none; letter-spacing: 0; display: flex; align-items: center; gap: 4px; }

/* ---------- Surfaces & controls ---------- */
.card { border-radius: var(--radius); background-color: var(--surface); border-color: var(--border); }
.kpi { border-radius: 16px; }
.card-head h2 { font-size: 15.5px; }
.card-head .count { color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.btn { border-radius: 12px; font-weight: 600; }
.btn.small { border-radius: 10px; }
.btn.primary, .add-side { background: linear-gradient(135deg, var(--accent-strong), var(--accent)); color: var(--accent-ink); border-color: transparent; }
:root[data-theme="light"] .btn.primary, :root[data-theme="light"] .add-side { color: #fff; }
.chip, .stat-chip, .pill { border-radius: 999px; }
.track, .hbar-track { height: 6px; border-radius: 999px; background: var(--track); }
.track.small { height: 5px; }
.track .fill, .hbar-fill { border-radius: 999px; }
.hero::before { display: none; }
.link { color: var(--accent-text); }
.icon-btn { border-radius: 12px; }

/* Thin progress bar (D): <span class="d-bar"><i style="width:…"></i></span>, colour from --tone. */
.d-bar { position: relative; display: block; height: 6px; border-radius: 999px; background: var(--track); }
.d-bar.thin { height: 4px; }
.d-bar > i, .d-bar > span:not(.d-mark) { display: block; height: 100%; max-width: 100%; border-radius: 999px; background: var(--tone, var(--accent)); transform-origin: left; animation: grow-x .8s var(--ease) both; transition: width .5s var(--ease); }
.d-bar .d-mark { position: absolute; top: -3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--ink-1); }
.d-bar i.tone-good { background: var(--st-good); } .d-bar i.tone-warning { background: var(--st-warning); }

/* Pills (À placer, X € pour novembre) */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 12px; font: 600 12.5px/1.2 var(--font); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone-ink); white-space: nowrap; }
button.pill { cursor: pointer; transition: transform .15s var(--ease), background .2s; }
button.pill:hover { background: color-mix(in srgb, var(--tone) 22%, transparent); }
.pill.tone-plain { background: var(--surface-2); border-color: var(--border); color: var(--accent-text); }

/* ---------- Shell ---------- */
.shell { position: relative; isolation: isolate; overflow-x: clip; }
.shell::before { content: ''; position: absolute; left: -60px; top: -140px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(closest-side, var(--page-glow), transparent); pointer-events: none; z-index: -1; }
.topbar { gap: 6px; }
.topbar .brand { margin-right: 0; }
.topbar .top-rhythm { margin-right: auto; min-width: 0; display: flex; }
.topbar .icon-btn { min-width: 40px; height: 44px; display: inline-grid; place-items: center; padding: 0 6px; }
.topbar .sync { min-height: 32px; }
.tabbar { left: 14px; right: 14px; bottom: calc(12px + var(--safe-b)); height: 64px; padding: 0 4px; border-radius: 20px; background: var(--glass); border: 1px solid var(--border-strong); }
.tabbar a { min-height: 48px; justify-content: center; font-size: 11px; color: var(--ink-2); }
.tabbar a.on { color: var(--accent-text); font-weight: 700; }
.fab { width: 50px; height: 50px; border-radius: 16px; background: linear-gradient(135deg, #7C5CFC, #A78BFA); color: #120A26; box-shadow: 0 10px 30px rgba(124, 92, 252, .45); }
:root[data-theme="light"] .fab { color: #120A26; }
.fab::before { display: none; animation: none; }

/* Rhythm chip (top bar, < 1100 px) */
.rhythm-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent); background: color-mix(in srgb, var(--tone) 13%, transparent); color: var(--tone-ink); font: 600 12.5px/1 var(--font); white-space: nowrap; cursor: pointer; }
.rhythm-chip::before { content: ''; position: absolute; inset: -5px 0; }
.rhythm-chip strong { font-weight: 700; }
.rc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 8px var(--tone); }

/* Tablet (600 – 1099 px): bottom bar like the phone, more room. */
@media (min-width: 600px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .topbar { margin: 0 -24px; padding-left: 24px; padding-right: 20px; }
  .shell::before { left: 120px; top: -220px; width: 720px; height: 620px; }
}
@media (min-width: 900px) and (max-width: 1099.98px) {
  .shell { display: block; min-height: 0; }
  .sidebar { display: none; }
  .tabbar { display: grid; }
  .topbar { display: flex; }
  .main { padding: 0 24px calc(112px + var(--safe-b)); max-width: none; }
  .toasts { bottom: calc(92px + var(--safe-b)); }
  .bulk-bar { bottom: calc(84px + var(--safe-b)); }
  .chat-dock { bottom: calc(82px + var(--safe-b)); }
  .advisor { padding-bottom: 190px; }
}
/* Computer (≥ 1100 px): sidebar 232 px with the rhythm, the pots and « + Nouvelle dépense ». */
@media (min-width: 1100px) {
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .shell::before { left: 160px; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; top: 0; height: calc(100vh / var(--zoom)); padding: 22px 16px 16px; background: transparent; border-right: 1px solid var(--border); overflow-y: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand { padding: 6px 8px 16px; gap: 10px; }
  .sidebar .brand .wordmark { flex: 1; font-size: 14px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; }
  .sidebar nav a { gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
  .sidebar nav a:hover { background: var(--surface-2); color: var(--ink-1); }
  .sidebar nav a.on { background: rgba(167, 139, 250, .12); color: var(--ink-1); }
  :root[data-theme="light"] .sidebar nav a.on { background: var(--accent-soft); color: var(--accent-text); }
  .sidebar nav a.on::before { display: none; }
  .side-search { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 9px 12px; border-radius: 12px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none; border: 1px dashed var(--border-strong); }
  .side-search:hover, .side-search.on { color: var(--ink-1); background: var(--surface-2); }
  .side-search svg { width: 18px; height: 18px; }
  .side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .side-foot .sync { align-self: flex-start; }
  .add-side { min-height: 46px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(124, 92, 252, .35); }
  .main { max-width: 1480px; margin: 0; padding: 24px 28px 48px; }
  .tabbar, .topbar { display: none; }
}
@media (min-width: 1100px) and (max-height: 760px) { .rh-dial { max-height: 56px; } .pots-card .pc-text { display: none; } }

/* Sidebar · « Rythme du mois » */
.rhythm-card { display: block; width: 100%; padding: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; border-color: color-mix(in srgb, var(--tone) 35%, var(--border)); }
.rhythm-card:hover { border-color: color-mix(in srgb, var(--tone) 60%, var(--border)); }
.rh-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rh-title { font-size: 13px; font-weight: 600; color: var(--tone-ink); }
.rh-pct { font: 700 16px/1 var(--font-display); color: var(--tone-ink); letter-spacing: -.02em; }
.rh-dial { display: block; width: 100%; height: auto; max-height: 80px; margin: 8px 0 2px; overflow: visible; }
.rh-track { fill: none; stroke: var(--track); stroke-width: 7; stroke-linecap: round; }
.rh-fill { fill: none; stroke: var(--tone); stroke-width: 7; stroke-linecap: round; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tone) 55%, transparent)); animation: dash-in 1s var(--ease) both; }
.rh-tick { stroke: var(--ink-3); stroke-width: 1.4; stroke-linecap: round; }
.rh-needle { stroke: var(--ink-1); stroke-width: 2; stroke-linecap: round; }
.rh-hub { fill: var(--ink-1); }
.rh-zone { display: block; font-size: 13.5px; font-weight: 600; }
.rh-text { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--ink-2); }
@keyframes dash-in { from { stroke-dashoffset: var(--len); } }

/* Sidebar · « Gardé pour plus tard » */
.pots-card { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; --tone: var(--st-warning); }
.pc-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pc-amount { font: 500 20px/1.2 var(--font-display); letter-spacing: -.02em; }
.pc-text { font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.pots-card .d-bar { margin-top: 8px; }

/* ---------- Accueil ---------- */
.d-home { gap: 16px; }
.home-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 16px; margin: 4px 0 0; }
.hh-text { min-width: 0; }
.hh-date { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hh-hello { margin-top: 4px; font-size: 22px; }
.hh-pills { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 1100px) { .hh-hello { font-size: 24px; } }

.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.hg-hero, .hg-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hg-budgets { display: flex; flex-direction: column; min-width: 0; }
.hg-budgets > .card { flex: 1; }
@media (min-width: 600px) {
  .home-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .hg-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (min-width: 1360px) {
  .home-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.05fr) minmax(0, .85fr); align-items: stretch; }
  .hg-side { grid-column: auto; display: flex; }
  .hg-side > .money-actions { flex: 1; }
}

/* Hero + « Avant de dépenser » : two cards on a phone, one block from the tablet up. */
.d-hero, .hero-stack.is-merged { background: linear-gradient(160deg, var(--hero-1), var(--surface) 60%); border-color: var(--hero-border); box-shadow: var(--hero-shadow); }
.d-hero { padding: 20px; display: flex; flex-direction: column; gap: 0; }
@media (min-width: 600px) {
  .hero-stack { gap: 0; background: linear-gradient(160deg, var(--hero-1), var(--surface) 60%); border: 1px solid var(--hero-border); box-shadow: var(--hero-shadow); border-radius: var(--radius); }
  .hero-stack > .card { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  .hero-stack > .card + .card { padding-top: 4px; }
  .d-hero { padding: 22px 22px 14px; }
}
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 6px; }
.d-hero .hero-num { font: 700 clamp(44px, 12vw, 58px)/1 var(--font-display); letter-spacing: -.035em; }
@media (min-width: 1100px) { .d-hero .hero-num { font-size: clamp(46px, 4vw, 60px); } }
.hero-num .cur { font-size: .42em; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.d-hero.is-neg .hero-num { color: var(--neg); }
.hero-sub { margin-top: 12px; font-size: 15.5px; line-height: 1.5; color: var(--ink-1); }
.hero-sub2 { margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.use-bar { margin-top: 14px; }
.use-bar .d-bar.tone-good > i { background: linear-gradient(90deg, var(--st-good), var(--accent)); }
.use-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.d-hero .calc { margin-top: 10px; }
.d-hero .hero-keep { margin-top: 10px; }

/* « Aujourd'hui » */
.today-card { flex: 0 0 auto; width: 180px; margin-left: auto; padding: 12px 14px; border-radius: 16px; background: var(--inset); border: 1px solid var(--border); }
.tc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tc-title { font-size: 13px; font-weight: 600; }
.tc-limit { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tc-amount { display: block; margin-top: 2px; font: 500 24px/1.15 var(--font-display); letter-spacing: -.02em; color: var(--tone-ink, var(--ink-1)); }
.today-card.tone-neutral .tc-amount { color: var(--ink-1); }
.tc-bars { display: block; width: 100%; max-width: 168px; height: 44px; margin-top: 6px; overflow: visible; }
.tc-bar { fill: var(--tone); opacity: .6; transform-box: fill-box; transform-origin: bottom; animation: grow-y .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.tc-bar.is-today { opacity: 1; }
.tc-bar.tone-neutral { fill: var(--accent); }
.tc-limit-line { stroke: var(--accent); stroke-opacity: .8; stroke-width: 1; stroke-dasharray: 3 3; }
.tc-chart { width: 100%; max-width: 168px; margin-top: 6px; }
.tc-chart .tc-bars { margin-top: 0; max-width: none; }
.tc-days { display: flex; justify-content: space-between; margin-top: 4px; }
.tc-days span { text-align: center; font: 600 10.5px/1 var(--font); color: var(--ink-3); }
.tc-days span.is-today { color: var(--accent-text); }
.tc-bar.tc-zero { fill: var(--ink-3); opacity: .45; }
.tc-text { margin-top: 4px; font-size: 11.5px; line-height: 1.35; color: var(--ink-2); }
@media (max-width: 599.98px) {
  .today-card { width: 100%; margin-left: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 168px); grid-template-areas: 'head bars' 'amount bars' 'text text'; column-gap: 14px; align-items: center; }
  .tc-head { grid-area: head; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
  .tc-amount { grid-area: amount; }
  .tc-chart { grid-area: bars; margin: 0; }
  .tc-text { grid-area: text; margin-top: 6px; }
}

/* Cumul du mois vs rythme */
.pace-mini { margin-top: 18px; }
.pace-mini svg { display: block; width: 100%; height: 120px; margin-top: 8px; overflow: visible; animation: fade-in .7s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } }
.pm-grid { stroke: var(--grid-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pm-ideal { fill: none; stroke: var(--accent); stroke-opacity: .65; stroke-width: 1.3; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.pm-actual { fill: none; stroke: var(--st-good); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pm-proj { fill: none; stroke: var(--st-good); stroke-opacity: .8; stroke-width: 1.8; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.pm-proj.is-over { stroke: var(--st-warning); stroke-opacity: 1; }
.pm-dot { stroke: var(--st-good); stroke-width: 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pm-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.pm-legend strong { color: var(--ink-1); font-weight: 600; }
.sw-l { display: inline-block; width: 16px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2.5px solid var(--st-good); }
.sw-l.proj { border-top: 2px dotted var(--st-good); }
.sw-l.proj.is-over { border-top-color: var(--st-warning); }
.sw-l.ideal { border-top: 2px dashed var(--accent); }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* « Avant de dépenser » */
.quickcheck .card-head { margin-bottom: 10px; }
.quickcheck .qc-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; overflow: visible; margin: 0; padding: 0; }
.qc-chip { --qc: var(--st-good); --qc-ink: var(--pos); min-width: 0; max-width: none; min-height: 44px; gap: 3px; padding: 11px 12px; border-radius: 14px; background: var(--inset); border: 1px solid color-mix(in srgb, var(--qc) 38%, transparent); }
.qc-chip:hover { background: color-mix(in srgb, var(--qc) 8%, var(--inset)); }
.qc-chip.qc-attention { --qc: var(--st-warning); --qc-ink: var(--warn-ink); }
.qc-chip.qc-stop { --qc: var(--st-critical); --qc-ink: var(--neg); }
.qc-chip-name { max-width: 100%; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.qc-chip-val { font: 500 clamp(16px, 4.6vw, 19px)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--ink-1); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 600px) { .qc-chip-val { font-size: 19px; } }
.qc-chip.qc-attention .qc-chip-val { color: var(--ink-1); }
.qc-chip.qc-stop .qc-chip-val { color: var(--neg); }
.qc-chip-word { font-size: 11.5px; font-weight: 500; color: var(--ink-2); white-space: normal; }
.qc-chip-word b { color: var(--qc-ink); font-weight: 700; }

/* Budgets du mois : a table from 1100 px, compact lines below. */
.budgets-card { display: flex; flex-direction: column; }
.bud-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.bud-table thead th { padding: 0 0 6px 6px; font: 500 12px/1.2 var(--font); color: var(--ink-3); text-align: right; white-space: normal; vertical-align: bottom; width: 54px; }
.bud-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bud-table thead th:first-child { padding-left: 0; text-align: left; width: auto; }
.bud-table tbody th, .bud-table td { border-top: 1px solid var(--border); }
.bud-table th.bt-name { padding: 10px 8px 10px 0; text-align: left; font-weight: 500; vertical-align: top; }
.bt-label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bt-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-label .kind-badge { margin-left: 2px; flex: none; }
.bud-table th.bt-name .d-bar { margin-top: 6px; }
.bud-table td { padding: 10px 0 10px 6px; text-align: right; white-space: nowrap; vertical-align: top; }
.bud-table td.bt-sent { display: none; }
.bt-foot { margin-top: 10px; }
@media (max-width: 1099.98px) {
  .bud-table, .bud-table tbody { display: block; }
  .bud-table thead { display: none; }
  .bud-table tr.bt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name left' 'sent sent'; column-gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
  .bud-table tbody tr:first-child { border-top: 0; padding-top: 2px; }
  .bud-table tbody th, .bud-table td { border-top: 0; }
  .bud-table th.bt-name { grid-area: name; padding: 0; }
  .bud-table td { display: none; padding: 0; }
  .bud-table td.bt-left { display: block; grid-area: left; align-self: start; font: 600 15px/1.2 var(--font); }
  .bud-table td.bt-left::after { content: '\00a0€'; }
  .bud-table td.bt-left::before { content: 'Reste'; display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); text-align: right; }
  .bud-table td.bt-sent { display: block; grid-area: sent; margin-top: 5px; text-align: left; white-space: normal; font: 400 12.5px/1.4 var(--font); color: var(--ink-2); }
}
.bt-row { --tone: var(--st-good); }
.pay-mini { margin-top: auto; padding-top: 18px; }
.pay-mini .pay-bar { height: 10px; margin-top: 8px; border: 0; border-radius: 6px; }
.pay-words { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.pay-words .sw { width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.pay-fact { margin-top: 8px; color: var(--ink-2); line-height: 1.45; }

/* À faire */
.money-actions.is-compact .recs { gap: 14px; }
.money-actions .rec { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; padding: 0; background: transparent; border: 0; border-radius: 0; }
.money-actions .sicon { width: 36px; height: 36px; border-radius: 50%; }
.money-actions .rec-title strong { font-size: 14.5px; font-weight: 600; }
.money-actions .rec-body { gap: 2px; }
.money-actions .rec-body p { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.money-actions .rec-body .btn-row { margin: 6px 0 0; gap: 6px; }
.money-actions .rec-body .calc { margin: 2px 0 0; }
.d-home .money-actions { border-color: var(--border); }
.d-home .money-actions:has(.rec-critical) { border-color: color-mix(in srgb, var(--st-critical) 30%, var(--border)); }

/* Sur tes comptes */
.accounts-card { display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 20px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.accounts-card:hover { border-color: var(--accent-line); }
.as-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.as-total { font: 500 26px/1.2 var(--font-display); letter-spacing: -.02em; }
.as-text { font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.as-text .pos, .as-text .neg { font-weight: 600; }
.as-spark { flex: 0 1 160px; width: 40%; max-width: 160px; height: 56px; overflow: visible; }
.as-g0 { stop-color: var(--accent); stop-opacity: .45; } .as-g1 { stop-color: var(--accent); stop-opacity: 0; }
.as-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.as-spark { animation: fade-in .7s var(--ease) both; }

/* Other home cards */
.home-more { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .home-more { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }
.home-more:empty { display: none; }
.upcoming .up-day { font-family: var(--font); background: var(--surface-2); }
.onboard { border-color: var(--accent-line); }

/* The home screen assembles itself (first visit of the session). */
.d-home.assemble .home-head, .d-home.assemble .hg-hero, .d-home.assemble .hg-budgets, .d-home.assemble .hg-side > *, .d-home.assemble .home-more > * { animation: rise .5s var(--ease) both; }
.d-home.assemble .hg-hero { animation-delay: 40ms; }
.d-home.assemble .hg-budgets { animation-delay: 80ms; }
.d-home.assemble .hg-side > :nth-child(1) { animation-delay: 120ms; }
.d-home.assemble .hg-side > :nth-child(2) { animation-delay: 160ms; }
.d-home.assemble .home-more > :nth-child(1) { animation-delay: 200ms; }
.d-home.assemble .home-more > :nth-child(2) { animation-delay: 240ms; }
.d-home.assemble .home-more > :nth-child(n+3) { animation-delay: 280ms; }

/* ---------- Budget › Mois ---------- */
.d-env .env-layout { display: flex; flex-direction: column; gap: 14px; }
.d-env .env-main, .d-env .env-side { display: contents; }
.d-env .env-kpis { order: 1; } .d-env .env-side > .calc { order: 2; } .d-env .why-assign { order: 3; } .d-env .env-income { order: 4; }
.d-env .env-notes { order: 5; } .d-env .env-fill { order: 6; } .d-env .env-watch { order: 7; } .d-env .env-list { order: 8; } .d-env .env-fixes { order: 9; } .d-env .env-targets { order: 10; }
@media (min-width: 1100px) {
  .d-env .env-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; gap: 16px; }
  .d-env .env-main, .d-env .env-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .d-env .env-side .env-kpis { grid-template-columns: 1fr 1fr !important; }
}
.d-env .env-notes p { margin: 0; }
.d-env .env-fill { margin: 0; }
.d-env .env-watch { margin: 0; }
.d-env .env-side > .calc { margin-top: -6px; }
/* Head card: « Placé X sur Y » + spending / savings gauge */
.d-env .env-income { padding: 18px 20px; gap: 10px; background: linear-gradient(160deg, var(--hero-1), var(--surface) 60%); border-color: var(--hero-border); box-shadow: var(--hero-shadow); }
.d-env .env-income.over { border-color: color-mix(in srgb, var(--neg) 45%, var(--border)); }
.d-env .env-income-head { align-items: flex-end; gap: 8px 16px; }
.eih-main { min-width: 0; }
.eih-big { margin: 4px 0 2px; font: 500 28px/1.15 var(--font-display); letter-spacing: -.02em; }
.eih-big strong { font-weight: 700; }
.eih-of { font-size: .58em; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.eih-status { padding: 6px 12px; border-radius: 999px; font: 600 13px/1.2 var(--font); white-space: normal !important; background: color-mix(in srgb, currentColor 12%, transparent); }
.d-env .env-gauge { height: 8px; margin-top: 4px; border-radius: 999px; background: var(--track); }
.d-env .env-gauge i { animation: grow-x .8s var(--ease) both; transform-origin: left; }
.eih-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; }
/* Family list */
.d-env .env-list { padding: 4px 18px 14px; }
.env-group + .env-group { margin-top: 8px; }
.env-ghead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 14px 0 6px; }
.env-ghead h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.grp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.g-besoins { background: var(--g-besoins); } .g-envies { background: var(--g-envies); } .g-epargne { background: var(--g-epargne); }
.env-ghead .grp-target { font-size: 12.5px; color: var(--ink-2); }
.env-cols, .env-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 84px; column-gap: 10px; }
.env-cols { padding: 0 0 6px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--border); }
.env-cols span:not(:first-child) { text-align: right; }
.env-row { --tone: var(--st-good); align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); border-radius: 10px; }
.er-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.er-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.d-env .env-name { font-size: 14.5px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.d-env .env-name .cat-ico { flex: none; }
.d-env .kind-badge { margin-left: 0; }
.d-env .env-bar { max-width: 240px; margin-top: 2px; overflow: visible; background: var(--track); }
.er-meta { margin: 0; font-size: 12px; line-height: 1.35; color: var(--ink-2); }
.er-cover { align-self: flex-start; padding: 2px 0; }
.er-placed { display: flex; justify-content: flex-end; }
.d-env .env-input { width: 96px; max-width: 96px; min-height: 40px; padding: 6px 10px; text-align: right; font-family: var(--font-mono); font-size: 14px; border-radius: 10px; }
.er-left { padding-top: 9px; text-align: right; }
.d-env .env-avail { padding: 2px 8px; font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; background: transparent; }
.d-env .env-avail.pos { color: var(--pos); background: color-mix(in srgb, var(--st-good) 12%, transparent); }
.d-env .env-avail.neg { color: var(--neg); background: color-mix(in srgb, var(--st-critical) 14%, transparent); }
.d-env .env-row.is-pot .env-avail.pos { color: var(--warn-ink); background: color-mix(in srgb, var(--st-warning) 12%, transparent); }
.er-subtoggle { grid-column: 1 / -1; margin-top: 2px; }
.env-row.env-sub { padding: 6px 0 6px 24px; border-bottom-style: dashed; }
.env-row.env-sub .env-input { width: 86px; max-width: 86px; min-height: 38px; justify-self: end; }
.env-sub-name { font-size: 13.5px; }
.env-row.env-total { font-weight: 600; border-bottom: 0; }
.env-row.env-total .er-placed, .env-row.env-total .er-left, .env-row.env-grand .er-placed, .env-row.env-grand .er-left, .env-sub-rest .er-placed { padding-top: 2px; font-family: var(--font-mono); font-size: 13.5px; text-align: right; display: block; }
.env-row.env-grand { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border-strong); border-bottom: 0; font-weight: 700; }
.d-env .env-caps { margin-top: 4px; }
@media (max-width: 420px) {
  .env-cols, .env-row { grid-template-columns: minmax(0, 1fr) 80px 72px; column-gap: 8px; }
  .d-env .env-input { width: 80px; max-width: 80px; padding: 6px 8px; }
  .env-row.env-sub { padding-left: 14px; }
  .env-row.env-sub .env-input { width: 76px; max-width: 76px; }
  .d-env .env-list { padding: 2px 14px 12px; }
  .d-env .env-avail { padding: 2px 4px; font-size: 13px; }
}
/* Side column: À placer, fixes, 50/30/20 */
.d-env .env-kpis .kpi { padding: 14px 16px; }
.d-env .env-kpis .kpi-btn { border: 1px solid var(--accent-line); }
.d-env .env-targets { display: grid; gap: 6px; margin: 0; padding: 16px 18px; }
.d-env .env-targets p { margin: 0; }
.env-target-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin: 4px 0; }
.env-target-bar i { display: block; height: 100%; }
.env-target-bar i + i { box-shadow: inset 2px 0 0 var(--surface); }

/* Row that just changed: one short pulse. */
.is-pulsed { animation: row-pulse 1s var(--ease); }
@keyframes row-pulse { 0% { background-color: color-mix(in srgb, var(--accent) 24%, transparent); } 100% { background-color: transparent; } }

/* ---------- Sheets: side panel on a computer ---------- */
@media (min-width: 1100px) {
  .sheet-backdrop { align-items: stretch; justify-content: flex-end; }
  .sheet { width: 480px; max-width: 480px; height: calc(100dvh / var(--zoom)); max-height: none; border-radius: 22px 0 0 22px; border-right: 0; animation: sheet-side .32s var(--ease); }
  .sheet.wide { width: min(940px, calc(100vw - 260px)); max-width: min(940px, calc(100vw - 260px)); }
  .sheet-head { padding: 18px 20px 8px; }
  .sheet-body { padding: 8px 20px 24px; }
  .toasts { left: calc(50% + 116px); }
}
@keyframes sheet-side { from { transform: translateX(48px); opacity: 0; } }

/* ---------- Motion ---------- */
/* Page changes: View Transitions (fade + slight slide of the page only), else a CSS entrance on the new view. */
.view > * { animation: none; }
:root[data-vt="page"] .main > .view { view-transition-name: page; }
/* Only the page content moves: the shell (top bar, tab bar, sidebar) keeps its place and never cross-fades (no flicker). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
.tabbar { view-transition-name: app-tabbar; }
.topbar { view-transition-name: app-topbar; }
.sidebar { view-transition-name: app-sidebar; }
::view-transition-old(app-tabbar), ::view-transition-new(app-tabbar), ::view-transition-old(app-topbar), ::view-transition-new(app-topbar), ::view-transition-old(app-sidebar), ::view-transition-new(app-sidebar) { animation: none; }
::view-transition-old(app-tabbar), ::view-transition-old(app-topbar), ::view-transition-old(app-sidebar) { display: none; }
::view-transition-old(page) { animation: vt-out .16s var(--ease) both; }
::view-transition-new(page) { animation: vt-in .26s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@supports not (view-transition-name: none) { .main > .view { animation: vt-in .28s var(--ease) both; } }
/* Budget line → detail sheet (shared element). */
.vt-shared .sheet.vt-detail { view-transition-name: budget-detail; }
/* Opened through the shared transition: no second entrance once the transition ends. */
@supports (view-transition-name: none) { .sheet.vt-detail, .sheet-backdrop:has(> .vt-detail) { animation: none; } }
::view-transition-group(budget-detail) { animation-duration: .34s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
/* Confetti (À placer → 0, goal reached) */
.confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: 34%; border-radius: 2px; opacity: 0; animation: confetti var(--d) cubic-bezier(.2, .7, .4, 1) var(--delay) both; }
@keyframes confetti { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 30% { opacity: 1; transform: translate(calc(var(--x) * .45), -16vh) rotate(calc(var(--r) * .4)); } 100% { opacity: 0; transform: translate(var(--x), 48vh) rotate(var(--r)); } }

/* ---------- Touch targets (phones) ---------- */
@media (max-width: 599.98px), (pointer: coarse) {
  .d-home .btn.small, .d-env .btn.small, .money-actions .btn.small { min-height: 44px; }
  .d-home .link.small, .d-env .link.small, .d-home .calc-btn, .d-env .calc-btn, .budgets-card .link { min-height: 44px; display: inline-flex; align-items: center; }
  button.pill { min-height: 40px; }
  .qc-chip { min-height: 72px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .confetti { display: none; }
}

/* Brand tile (Piste D): the mark in dark on a violet gradient tile, sidebar and mobile top bar */
.logo.tile { border-radius: 30%; background: linear-gradient(135deg, #7C5CFC, #A78BFA); border: 0; box-shadow: 0 6px 18px rgba(124, 92, 252, .32), inset 0 1px 0 rgba(255, 255, 255, .25); }
.logo.tile .logo-stroke { stroke: #120A26; filter: none; }
.logo.tile .logo-coin { fill: #fff; }
