/* =========================================================
   FOYER — feuille de style
   ========================================================= */
:root {
  /* Thème clair — lilas */
  --bg: #F6F4FA;
  --bg-2: #EFEBF6;
  --surface: #FFFFFF;
  --surface-2: #F8F5FC;
  --ink: #2B1A3F;
  --ink-2: #776A8A;
  --ink-3: #ADA3BC;
  --line: rgba(60, 30, 90, .07);
  --track: rgba(120, 80, 170, .10);
  --accent: #B26AEB;
  --accent-2: #D88AF5;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(178, 106, 235, .13);
  --grad: linear-gradient(135deg, #DA8EF6 0%, #B26AEB 55%, #9358E0 100%);
  --hero-grad: linear-gradient(150deg, #D98DF6 0%, #B26AEB 60%, #9A5BE3 100%);
  --night: #2B1A3F;
  --pos: #22A876;
  --neg: #EC5A78;
  --warn: #E69A2E;
  --pos-soft: rgba(34, 168, 118, .12);
  --neg-soft: rgba(236, 90, 120, .11);
  --warn-soft: rgba(230, 154, 46, .13);
  --shadow: 0 1px 2px rgba(70, 30, 110, .04), 0 6px 20px -10px rgba(70, 30, 110, .16);
  --shadow-lg: 0 24px 60px -20px rgba(90, 40, 140, .38);
  --card-border: rgba(60, 30, 90, .04);
  --r: 22px;
  --r-s: 14px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, "Nunito", "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  /* Thème sombre — prune et rose */
  --bg: #150A12;
  --bg-2: #22111D;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --ink: #F7EEF4;
  --ink-2: #BBA8B6;
  --ink-3: #7D6977;
  --line: rgba(255, 220, 240, .08);
  --track: rgba(255, 220, 240, .09);
  --accent: #F28AC9;
  --accent-2: #C77BF2;
  --accent-ink: #1A0A15;
  --accent-soft: rgba(242, 138, 201, .14);
  --grad: linear-gradient(135deg, #F7A0D6 0%, #E57BC4 50%, #B76CEE 100%);
  --hero-grad: radial-gradient(120% 120% at 100% 0%, rgba(242, 138, 201, .30) 0%, rgba(242, 138, 201, 0) 55%), radial-gradient(100% 100% at 0% 100%, rgba(183, 108, 238, .28) 0%, rgba(183, 108, 238, 0) 60%), linear-gradient(160deg, #2E1427 0%, #1C0C18 100%);
  --night: #2E1427;
  --pos: #5ED6A4;
  --neg: #FF7D9A;
  --warn: #F5BE5C;
  --pos-soft: rgba(94, 214, 164, .13);
  --neg-soft: rgba(255, 125, 154, .13);
  --warn-soft: rgba(245, 190, 92, .13);
  --shadow: none;
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, .85);
  --card-border: rgba(255, 210, 235, .09);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -.01em; }
.ic { width: 22px; height: 22px; flex: none; display: block; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-xs { gap: 4px; } .gap-s { gap: 8px; } .gap-m { gap: 12px; } .gap-l { gap: 18px; }
.mt-s { margin-top: 8px; } .mt-m { margin-top: 14px; } .mt-l { margin-top: 22px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Structure ---------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }
.view {
  padding: calc(var(--safe-t) + 12px) 18px calc(var(--tab-h) + var(--safe-b) + 36px);
}
.view.no-tabs { padding-bottom: calc(var(--safe-b) + 32px); }
.view.enter > * { animation: rise .5s var(--ease) both; }
.view.enter > *:nth-child(2) { animation-delay: 40ms; }
.view.enter > *:nth-child(3) { animation-delay: 80ms; }
.view.enter > *:nth-child(4) { animation-delay: 120ms; }
.view.enter > *:nth-child(5) { animation-delay: 160ms; }
.view.enter > *:nth-child(n+6) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.topbar { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-bottom: 10px; }
.topbar h1 { font-size: 30px; line-height: 1.1; letter-spacing: -.03em; margin: 0; font-weight: 750; }
.topbar .sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.back-bar { display: flex; align-items: center; gap: 4px; min-height: 44px; margin: 0 -8px 4px; }
.back-bar .title { font-weight: 650; font-size: 17px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .15s var(--ease);
}
.icon-btn.flat { background: transparent; box-shadow: none; }
.icon-btn:active { transform: scale(.92); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c, var(--accent)); color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: .02em; flex: none;
}
.avatar.s { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--bg); }
.avatars .avatar + .avatar { margin-left: -10px; }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 2px 10px;
}
.section-title h2 { font-size: 19px; letter-spacing: -.02em; margin: 0; font-weight: 700; }
.section-title a, .section-title button { font-size: 14px; color: var(--accent); font-weight: 600; }

.card {
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 12px; }
.card.tight { padding: 6px 0; }
.card-title { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }

/* ---------- Carte héro (solde) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 22px 22px 20px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(140, 120, 255, .55) 0%, rgba(140, 120, 255, 0) 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(76, 61, 214, .55) 0%, rgba(76, 61, 214, 0) 60%),
    linear-gradient(150deg, #1B1745 0%, #0F0C2B 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 40%);
}
.hero-label { font-size: 13px; opacity: .72; font-weight: 500; letter-spacing: .02em; }
.hero-amount { font-size: 42px; font-weight: 750; letter-spacing: -.035em; margin: 4px 0 2px; line-height: 1.05; }
.hero-amount .cents { font-size: 24px; opacity: .65; font-weight: 650; }
.hero-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .8; }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.hero-tile { background: rgba(255,255,255,.09); border-radius: 16px; padding: 12px 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hero-tile .l { font-size: 12px; opacity: .7; display: flex; align-items: center; gap: 6px; }
.hero-tile .l .ic { width: 15px; height: 15px; }
.hero-tile .v { font-size: 19px; font-weight: 700; margin-top: 3px; letter-spacing: -.02em; }
.hero-tile .d { font-size: 11.5px; opacity: .65; margin-top: 2px; }
.chip-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: rgba(255,255,255,.12); }
.chip-live i { width: 6px; height: 6px; border-radius: 50%; background: #5BE3A8; box-shadow: 0 0 0 3px rgba(91,227,168,.25); }
.chip-live.off i { background: #F2B53A; box-shadow: 0 0 0 3px rgba(242,181,58,.25); }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kpi { background: var(--surface); border-radius: 18px; padding: 14px 15px; box-shadow: var(--shadow); text-align: left; }
.kpi .l { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.kpi .l .ic { width: 16px; height: 16px; color: var(--ink-3); }
.kpi .v { font-size: 20px; font-weight: 720; margin-top: 6px; letter-spacing: -.025em; }
.kpi .d { font-size: 12px; margin-top: 3px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 99px; }
.delta .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.up-bad, .delta.down-bad { color: var(--neg); background: var(--neg-soft); }
.delta.up-good, .delta.down-good { color: var(--pos); background: var(--pos-soft); }
.delta.flat { color: var(--ink-2); background: var(--track); }
.hero .delta { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- Raccourcis ---------- */
.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.shortcut { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 550; color: var(--ink-2); }
.shortcut span.ico {
  width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); color: var(--accent);
  transition: transform .15s var(--ease);
}
.shortcut:active span.ico { transform: scale(.92); }

/* ---------- Alertes ---------- */
.alert {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 16px; margin-top: 10px;
  background: var(--warn-soft); color: var(--ink); font-size: 14px; text-align: left; width: 100%;
}
.alert .ic { color: var(--warn); }
.alert.neg { background: var(--neg-soft); } .alert.neg .ic { color: var(--neg); }
.alert.info { background: var(--accent-soft); } .alert.info .ic { color: var(--accent); }
.alert b { font-weight: 650; }

/* ---------- Badges (icônes de catégorie) ---------- */
.badge {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
:root[data-theme="dark"] .badge { background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 70%, white); }
.badge .ic { width: 21px; height: 21px; }
.badge.s { width: 32px; height: 32px; border-radius: 10px; } .badge.s .ic { width: 17px; height: 17px; }
.badge.l { width: 52px; height: 52px; border-radius: 17px; } .badge.l .ic { width: 26px; height: 26px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }

/* ---------- Listes d'opérations ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; width: 100%; text-align: left;
  transition: background .15s;
}
.item:active { background: var(--surface-2); }
.item + .item { border-top: 1px solid var(--line); }
.item .t { font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; }
.item .s { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.item .s .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
.item .a { font-weight: 680; font-size: 16px; text-align: right; white-space: nowrap; }
.item .a small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
.item .chev { color: var(--ink-3); width: 18px; height: 18px; }
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 16px 4px 7px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--track); color: var(--ink-2); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neg { background: var(--neg-soft); color: var(--neg); }
.pill.pos { background: var(--pos-soft); color: var(--pos); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill .ic { width: 12px; height: 12px; }

.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty .ic { width: 38px; height: 38px; color: var(--ink-3); margin: 0 auto 10px; stroke-width: 1.4; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Graphiques ---------- */
.donut { position: relative; margin: 6px auto; }
.donut svg { display: block; overflow: visible; }
.donut-seg { animation: seg 1s var(--ease) both; transition: opacity .2s, stroke-width .2s; cursor: pointer; }
.donut-seg.dim { opacity: .25; }
@keyframes seg { from { stroke-dasharray: 0 2000; } }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; padding: 0 34px; }
.donut-top { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.donut-bottom { font-size: 24px; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; }
.legend { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 14.5px; }
.legend-row + .legend-row { border-top: 1px solid var(--line); }
.legend-row .pc { color: var(--ink-3); font-size: 13px; width: 42px; text-align: right; }
.legend-row .v { font-weight: 650; min-width: 84px; text-align: right; }

.bars { position: relative; height: calc(var(--h) + 28px); margin-top: 6px; }
.bars-grid { position: absolute; left: 0; right: 0; top: 0; height: var(--h); display: flex; flex-direction: column; justify-content: space-between; }
.grid-line { border-top: 1px dashed var(--line); position: relative; height: 0; }
.grid-line span { position: absolute; right: 0; top: -16px; font-size: 10.5px; color: var(--ink-3); }
.bars-cols { position: absolute; inset: 0; display: flex; gap: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-stack { height: var(--h); width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar {
  width: min(22px, 42%); border-radius: 7px 7px 3px 3px; background: var(--c);
  transform-origin: bottom; animation: grow .8s var(--ease) both; opacity: .9; transition: opacity .2s;
}
.bars-cols:has(.sel) .bar-col:not(.sel) .bar { opacity: .3; }
@keyframes grow { from { transform: scaleY(0); } }
.bar-label { font-size: 11px; color: var(--ink-3); margin-top: 8px; font-weight: 550; text-transform: capitalize; }
.bar-col.sel .bar-label { color: var(--ink); font-weight: 700; }
.chart-readout { display: flex; justify-content: space-between; align-items: flex-end; min-height: 46px; margin-bottom: 4px; }
.chart-readout .big { font-size: 22px; font-weight: 750; letter-spacing: -.03em; }
.chart-readout .l { font-size: 13px; color: var(--ink-2); }
.chart-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-val { animation: seg 1.1s var(--ease) both; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.progress { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px; background: var(--c); animation: grow-x .9s var(--ease) both; transform-origin: left; }
.progress.over span { background: var(--neg); }
@keyframes grow-x { from { transform: scaleX(0); } }

/* ---------- Segmented, sélecteur de mois ---------- */
.seg { display: flex; background: var(--bg-2); padding: 3px; border-radius: 13px; gap: 2px; }
:root[data-theme="dark"] .seg { background: var(--surface); }
.seg button { flex: 1; padding: 8px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: all .2s var(--ease); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-2); }
.month-nav { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 16px; padding: 5px; box-shadow: var(--shadow); }
.month-nav .lbl { font-weight: 680; font-size: 16px; letter-spacing: -.01em; }
.month-nav button { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.month-nav button:disabled { opacity: .25; }

/* ---------- Recherche / filtres ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow); height: 46px; }
.search .ic { color: var(--ink-3); width: 19px; height: 19px; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 16px; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 18px 4px; margin: 0 -18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 99px; white-space: nowrap;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.chip.on { background: var(--ink); color: var(--bg); }
.chip .ic { width: 15px; height: 15px; }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 6px 10px calc(var(--safe-b) + 6px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; height: var(--tab-h); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); padding-top: 4px; transition: color .2s; }
.tab .ic { width: 25px; height: 25px; }
.tab.on { color: var(--accent); }
.tab.on .ic { stroke-width: 2.1; }
.tab-add { display: grid; place-items: center; }
.tab-add span {
  width: 60px; height: 60px; border-radius: 22px; display: grid; place-items: center; margin-top: -26px;
  background: linear-gradient(145deg, #6A5BFF, #3B2DB8); color: #fff;
  box-shadow: 0 12px 26px -8px rgba(76, 61, 214, .65), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .18s var(--ease);
}
.tab-add span .ic { width: 28px; height: 28px; stroke-width: 2.3; }
.tab-add:active span { transform: scale(.9) rotate(90deg); }

/* ---------- Boutons, formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 20px; border-radius: 16px; font-weight: 650; font-size: 16.5px; width: 100%;
  transition: transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 24px -10px rgba(76,61,214,.7); }
:root[data-theme="dark"] .btn-primary { color: #0B0A12; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-ghost { background: var(--bg-2); color: var(--ink); }
:root[data-theme="dark"] .btn-ghost { background: var(--surface-2); }
.btn-danger { background: var(--neg-soft); color: var(--neg); }
.btn-s { height: 38px; font-size: 14px; border-radius: 12px; padding: 0 14px; width: auto; }
.btn .ic { width: 20px; height: 20px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-left: 2px; }
.input, select.input, textarea.input {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid transparent; padding: 0 14px;
  background: var(--bg-2); font-size: 16px; outline: none; transition: border-color .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
:root[data-theme="dark"] .input { background: var(--surface-2); }
.input:focus { border-color: var(--accent); background: var(--surface); }
textarea.input { height: 84px; padding: 12px 14px; resize: none; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%239A98AA' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 36px; }
input[type="date"].input { line-height: 50px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .field { margin-top: 14px; }

.amount-input { text-align: center; padding: 10px 0 4px; }
.amount-input input {
  border: 0; outline: 0; background: transparent; text-align: center; width: 100%;
  font-size: 54px; font-weight: 760; letter-spacing: -.04em; caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.amount-input input::placeholder { color: var(--ink-3); opacity: .5; }
.amount-input .cur { font-size: 14px; color: var(--ink-3); font-weight: 600; }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: 16px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); line-height: 1.15; text-align: center; border: 1.5px solid transparent; transition: all .15s; }
.cat-opt.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); color: var(--ink); }
.cat-opt .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }

.opt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  padding: 9px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid transparent;
}
:root[data-theme="dark"] .opt { background: var(--surface-2); }
.opt.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.opt .ic { width: 17px; height: 17px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--track); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--pos); }
.switch input:checked + span::after { transform: translateX(20px); }

.receipt-box { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--line); background: var(--bg-2); position: relative; }
:root[data-theme="dark"] .receipt-box { background: var(--surface-2); }
.receipt-box input[type=file] { position: absolute; inset: 0; opacity: 0; }
.receipt-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--track); display: grid; place-items: center; color: var(--ink-3); flex: none; }

.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; background: var(--c); border: 3px solid transparent; outline: 2px solid transparent; }
.swatch.on { border-color: var(--surface); outline-color: var(--c); }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.icon-opt { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); background: var(--bg-2); border: 1.5px solid transparent; }
:root[data-theme="dark"] .icon-opt { background: var(--surface-2); }
.icon-opt.on { color: var(--c, var(--accent)); border-color: var(--c, var(--accent)); background: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 11px; border-radius: 99px; background: var(--bg-2); font-size: 13.5px; font-weight: 550; }
:root[data-theme="dark"] .tag { background: var(--surface-2); }
.tag button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.tag button .ic { width: 13px; height: 13px; }

/* ---------- Feuilles modales ---------- */
#sheets { position: relative; z-index: 50; }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 6, 24, .42); opacity: 0; transition: opacity .3s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: calc(100dvh - var(--safe-t) - 18px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(102%); transition: transform .38s var(--ease);
  padding-bottom: calc(var(--safe-b) + 18px); overscroll-behavior: contain;
}
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-wrap.in .sheet { transform: translateY(0); }
.sheet-grip { position: sticky; top: 0; height: 22px; z-index: 2; background: var(--surface); }
.sheet-grip::after { content: ""; position: absolute; left: 50%; top: 8px; width: 38px; height: 5px; border-radius: 99px; background: var(--track); transform: translateX(-50%); }
.sheet-body { padding: 0 20px 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 4px 20px; }
.sheet-title { font-size: 20px; font-weight: 720; letter-spacing: -.02em; margin: 0; }
.sheet-foot { padding: 18px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.viewer img, .viewer iframe { width: 100%; border-radius: 16px; display: block; background: var(--bg-2); }
.viewer iframe { height: 70dvh; border: 0; }

/* ---------- Détails ---------- */
.detail-head { text-align: center; padding: 4px 0 14px; }
.detail-head .amt { font-size: 40px; font-weight: 760; letter-spacing: -.035em; margin-top: 10px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; font-size: 15px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; text-align: right; }
.note { font-size: 13px; color: var(--ink-2); background: var(--bg-2); padding: 11px 13px; border-radius: 12px; display: flex; gap: 8px; align-items: center; }
:root[data-theme="dark"] .note { background: var(--surface-2); }
.note .ic { width: 17px; height: 17px; color: var(--ink-3); }

/* ---------- Réglages ---------- */
.settings-group { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.settings-group + .settings-group { margin-top: 14px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%; text-align: left; min-height: 54px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row:active { background: var(--surface-2); }
.set-row .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--c, var(--accent)); color: #fff; flex: none; }
.set-row .ico .ic { width: 18px; height: 18px; }
.set-row .lbl { flex: 1; font-weight: 550; }
.set-row .val { color: var(--ink-3); font-size: 15px; }
.set-row .chev { color: var(--ink-3); width: 18px; height: 18px; }
.group-label { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 24px 6px 8px; text-transform: uppercase; letter-spacing: .06em; }
.invite-code { font-size: 32px; font-weight: 780; letter-spacing: .22em; text-align: center; padding: 14px 0 6px; font-variant-numeric: tabular-nums; }

/* ---------- Objectifs ---------- */
.goal { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; }
.goal + .goal { margin-top: 0; }
.goal-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: block; width: 100%; text-align: left; }
.goal-card + .goal-card { margin-top: 12px; }
.goal-card .t { font-weight: 680; font-size: 16.5px; letter-spacing: -.01em; }
.goal-card .s { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.goal-card .amts { display: flex; justify-content: space-between; font-size: 13.5px; margin: 12px 0 7px; }

/* ---------- Authentification ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 30px) 22px calc(var(--safe-b) + 24px); max-width: 460px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(150deg, #6A5BFF, #1B1745); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 24px -8px rgba(76,61,214,.6); }
.brand-mark .ic { width: 26px; height: 26px; stroke-width: 2; }
.brand-name { font-size: 22px; font-weight: 780; letter-spacing: -.03em; }
.auth h1 { font-size: 34px; letter-spacing: -.035em; line-height: 1.08; margin: 44px 0 10px; font-weight: 780; }
.auth .lead { color: var(--ink-2); font-size: 16.5px; margin: 0 0 18px; }
.auth form { margin-top: 10px; }
.auth .switch-link { text-align: center; margin-top: 18px; font-size: 15px; color: var(--ink-2); }
.auth .switch-link button { color: var(--accent); font-weight: 650; }
.choice { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); text-align: left; width: 100%; border: 1.5px solid transparent; }
.choice + .choice { margin-top: 12px; }
.choice.on { border-color: var(--accent); }
.choice .t { font-weight: 680; font-size: 16.5px; }
.choice .s { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }

.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash .brand-mark { width: 64px; height: 64px; border-radius: 20px; animation: pulse 1.6s ease-in-out infinite; }
.splash .brand-mark .ic { width: 34px; height: 34px; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); transform: translateY(-20px); opacity: 0; transition: all .3s var(--ease); max-width: 420px; text-align: center;
}
.toast.in { transform: none; opacity: 1; }
.toast-error { background: var(--neg); color: #fff; }
.toast-success { background: var(--pos); color: #fff; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--warn); color: #111; font-size: 12.5px; font-weight: 650; text-align: center; padding: calc(var(--safe-t) + 4px) 10px 4px; }

.skeleton { background: linear-gradient(90deg, var(--track), transparent, var(--track)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Impression (rapport) ---------- */
@media print {
  .tabbar, #toasts, #sheets { display: none !important; }
}

/* ---------- Compléments ---------- */
.ic.ic-xs { width: 14px; height: 14px; }
.avatar .ic { width: 60%; height: 60%; }
.status-btn {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--ink-3); color: transparent; transition: all .2s var(--ease);
}
.status-btn .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.status-btn.on { background: var(--pos); border-color: var(--pos); color: #fff; }
.status-btn:active { transform: scale(.88); }
.hero-tile { text-align: left; color: inherit; }
.kpi:active, .hero-tile:active { transform: scale(.98); }
.kpi, .hero-tile { transition: transform .15s var(--ease); }
.avatars[role="button"] { cursor: pointer; }
.kv { text-align: left; }
.item .s .sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); margin: 0 6px; vertical-align: middle; }
.bars-cols { right: 38px; }
.grid-line span { right: -38px; top: -7px; width: 34px; text-align: right; }
.auth .ic-xs, .faint .ic-xs { display: inline-block; vertical-align: -2px; }

/* ---------- Bilan intelligent ---------- */
.gauge { position: relative; margin: 0 auto; }
.gauge svg { display: block; overflow: visible; }
.gauge-val { animation: seg 1.2s var(--ease) both; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; }
.gauge-score { font-size: 44px; font-weight: 780; letter-spacing: -.04em; line-height: 1; }
.gauge-max { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.level-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 15px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.level-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.crit { padding: 11px 0; }
.crit + .crit { border-top: 1px solid var(--line); }
.crit .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.crit .pts { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crit .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.crit .rule { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.crit .progress { height: 5px; margin-top: 7px; }
.tip { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 20px; padding: 15px; box-shadow: var(--shadow); text-align: left; width: 100%; }
.tip + .tip { margin-top: 10px; }
.tip .badge { width: 38px; height: 38px; border-radius: 12px; }
.tip .t { font-weight: 680; font-size: 15.5px; letter-spacing: -.01em; }
.tip .x { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.tip .pill { margin-top: 8px; }
.det-group { font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; margin: 16px 4px 8px; }
.forecast-amt { font-size: 38px; font-weight: 780; letter-spacing: -.035em; line-height: 1.1; }
.fc-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; }
.fc-row + .fc-row { border-top: 1px solid var(--line); }
.fc-row .k { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.fc-row .k .pill { font-size: 10.5px; padding: 1px 6px; }
.pairbars .pb-row { display: block; width: 100%; text-align: left; padding: 8px 0; }
.pb-bar { height: 7px; border-radius: 99px; background: var(--track); margin-top: 6px; overflow: hidden; }
.pb-bar.prev { height: 4px; margin-top: 4px; }
.pb-bar span { display: block; height: 100%; border-radius: 99px; animation: grow-x .9s var(--ease) both; transform-origin: left; }
.pb-bar.prev span { background: var(--ink-3); opacity: .55; }
.divbars { position: relative; height: calc(var(--h) + 26px); }
.divbars-zero { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); height: 0; margin-top: 0; }
.divbars-cols { position: absolute; inset: 0 0 26px 0; display: flex; gap: 4px; }
.divbars { padding-bottom: 0; }
.divbar-col { flex: 1; position: relative; height: 100%; min-width: 0; }
.divbar { position: absolute; left: 50%; width: min(18px, 60%); transform: translateX(-50%); border-radius: 5px; animation: fadein .8s var(--ease) both; }
.divbar.up { background: var(--pos); }
.divbar.down { background: var(--neg); }
.divbar-col .bar-label { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; }
.divbars-cols:has(.sel) .divbar-col:not(.sel) .divbar { opacity: .3; }
.divbar-col.sel .bar-label { color: var(--ink); font-weight: 700; }
@keyframes fadein { from { opacity: 0; } }
.intel-entry { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-top: 12px; padding: 15px 16px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.intel-entry .mini-score { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-weight: 780; font-size: 18px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); flex: none; }
.report-sec { margin-top: 22px; }
.report-sec h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; margin: 0 0 10px; letter-spacing: -.01em; }
.report-sec h3 .n { width: 24px; height: 24px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12.5px; font-weight: 750; }
.report-list { margin: 0; padding: 0; list-style: none; }
.report-list li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; padding: 7px 0; color: var(--ink); }
.report-list li .ic { width: 18px; height: 18px; margin-top: 1px; }
.lead-text { font-size: 15.5px; line-height: 1.55; color: var(--ink); }
.chal { padding: 14px 0; }
.chal + .chal { border-top: 1px solid var(--line); }
details.method summary { cursor: pointer; list-style: none; font-weight: 650; font-size: 14.5px; display: flex; align-items: center; justify-content: space-between; }
details.method summary::-webkit-details-marker { display: none; }
details.method[open] summary .ic { transform: rotate(180deg); }
details.method ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.shortcuts { grid-template-columns: repeat(5, 1fr); }
.shortcut span.ico { width: 52px; height: 52px; }
#intel-donut .donut-bottom { font-size: 16px; } #intel-donut .donut-center { padding: 0 18px; }


/* =========================================================
   THÈME v2 — épuré, arrondi, lilas / prune-rose
   ========================================================= */
body { background: var(--bg); }
:root[data-theme="dark"] body {
  background:
    radial-gradient(90% 50% at 50% -10%, rgba(242, 138, 201, .16), transparent 70%),
    radial-gradient(70% 40% at 100% 0%, rgba(183, 108, 238, .12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background: linear-gradient(180deg, #EEDDFB 0, #F6F4FA 260px) no-repeat, var(--bg);
}
.topbar h1, .hero-amount, .kpi .v, .donut-bottom, .chart-readout .big, .sheet-title, .brand-name, .auth h1,
.section-title h2, .forecast-amt, .gauge-score, .detail-head .amt, .amount-input input, .invite-code, .item .a, .mini-score, .month-nav .lbl {
  font-family: var(--font-round);
}
.topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.section-title { margin: 28px 4px 12px; }
.section-title h2 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }

/* Cartes */
.card, .kpi, .settings-group, .goal-card, .tip, .choice, .intel-entry, .month-nav, .search, .chip, .icon-btn, .shortcut span.ico {
  border: 1px solid var(--card-border);
}
:root[data-theme="dark"] .card, :root[data-theme="dark"] .kpi, :root[data-theme="dark"] .settings-group,
:root[data-theme="dark"] .goal-card, :root[data-theme="dark"] .tip, :root[data-theme="dark"] .choice,
:root[data-theme="dark"] .intel-entry, :root[data-theme="dark"] .month-nav, :root[data-theme="dark"] .search,
:root[data-theme="dark"] .chip, :root[data-theme="dark"] .icon-btn {
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.card { border-radius: 24px; }
.icon-btn { width: 40px; height: 40px; }
.icon-btn.flat { border: 0; }

/* Carte principale */
.hero {
  background: var(--hero-grad); border-radius: 28px; padding: 22px;
  box-shadow: 0 20px 44px -22px rgba(150, 80, 220, .75);
}
:root[data-theme="dark"] .hero { border: 1px solid rgba(255, 190, 230, .16); box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 30px 60px -30px rgba(242, 138, 201, .35); }
.hero::after { background: linear-gradient(115deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 45%); }
.hero-amount { font-size: 44px; font-weight: 800; }
.hero-tile { background: rgba(255,255,255,.16); border-radius: 18px; }
:root[data-theme="dark"] .hero-tile { background: rgba(255,255,255,.06); }

/* Boutons */
.btn { border-radius: 18px; font-weight: 700; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 12px 26px -12px rgba(178, 106, 235, .85); }
:root[data-theme="dark"] .btn-primary { color: #1A0A15; box-shadow: 0 12px 30px -12px rgba(242, 138, 201, .6); }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .btn-ghost { background: rgba(255,255,255,.06); color: var(--ink); }

/* Barre d'onglets flottante */
.tabbar {
  left: 14px; right: 14px; bottom: calc(var(--safe-b) + 10px);
  padding: 0 6px; border-radius: 28px; border: 1px solid var(--card-border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 16px 40px -14px rgba(80, 30, 120, .30);
  max-width: 532px; margin: 0 auto;
}
:root[data-theme="dark"] .tabbar { background: rgba(34, 17, 29, .78); box-shadow: 0 20px 50px -10px rgba(0,0,0,.7); }
.tabbar-inner { height: var(--tab-h); }
.tab { font-size: 10.5px; gap: 3px; padding-top: 2px; }
.tab .ic { width: 23px; height: 23px; }
.tab-add span {
  width: 52px; height: 52px; border-radius: 50%; margin-top: 0;
  background: var(--grad); box-shadow: 0 10px 22px -8px rgba(178, 106, 235, .8);
}
:root[data-theme="dark"] .tab-add span { color: #1A0A15; box-shadow: 0 10px 26px -8px rgba(242, 138, 201, .7); }
.view { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 44px); }

/* Listes en cartes séparées (style « Tasks ») */
.list.cards { gap: 8px; }
.list.cards .item { background: var(--surface); border-radius: 20px; border: 1px solid var(--card-border); box-shadow: var(--shadow); padding: 12px 14px; }
.list.cards .item + .item { border-top: 1px solid var(--card-border); }
:root[data-theme="dark"] .list.cards .item { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.badge { border-radius: 14px; }

/* Segmented, chips */
.seg { background: var(--accent-soft); border-radius: 16px; }
:root[data-theme="dark"] .seg { background: rgba(255,255,255,.05); border: 1px solid var(--card-border); }
.seg button { border-radius: 12px; }
.seg button.on { background: var(--surface); color: var(--accent); }
:root[data-theme="dark"] .seg button.on { background: rgba(242, 138, 201, .16); color: var(--accent); box-shadow: none; }
.chip { box-shadow: none; }
.chip.on { background: var(--accent); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .chip.on { color: #1A0A15; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* Champs */
.input { background: var(--bg-2); border-radius: 16px; }
:root[data-theme="dark"] .input { background: rgba(255,255,255,.05); border-color: var(--card-border); }
.sheet { border-radius: 30px 30px 0 0; }
:root[data-theme="dark"] .sheet { background: #1E0F1A; border-top: 1px solid rgba(255, 190, 230, .14); }
:root[data-theme="dark"] .sheet-grip { background: #1E0F1A; }
.cat-opt.on { background: color-mix(in srgb, var(--c) 10%, transparent); }
.opt.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.switch input:checked + span { background: var(--accent); }

/* Sphère (assistant) */
.orb {
  --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 70% 75%, #5FD3F3 0, rgba(95,211,243,0) 45%),
    radial-gradient(circle at 25% 70%, #F06BC0 0, rgba(240,107,192,0) 55%),
    conic-gradient(from 210deg, #F59AD6, #B46BF0, #6A7BF5, #F59AD6);
  box-shadow: 0 0 calc(var(--s) * .45) rgba(242, 138, 201, .55), inset 0 -4px 10px rgba(40, 0, 50, .35);
  animation: orb 9s linear infinite;
}
.orb.l { --s: 76px; }
.orb.s { --s: 30px; }
@keyframes orb { to { filter: hue-rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

/* Accueil épuré */
.home-head { display: flex; align-items: center; gap: 12px; min-height: 56px; margin-bottom: 14px; }
.home-head .hello { font-size: 14px; color: var(--ink-2); font-weight: 550; }
.home-head .name { font-family: var(--font-round); font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.hero-line { display: flex; gap: 18px; margin-top: 16px; font-size: 14px; }
.hero-line > div { display: flex; flex-direction: column; gap: 2px; }
.hero-line .l { opacity: .78; font-size: 12.5px; display: flex; align-items: center; gap: 5px; }
.hero-line .l .ic { width: 14px; height: 14px; }
.hero-line .v { font-family: var(--font-round); font-weight: 750; font-size: 18px; }
.hero-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.22); margin-top: 16px; overflow: hidden; }
.hero-bar span { display: block; height: 100%; border-radius: 99px; background: #fff; animation: grow-x 1s var(--ease) both; transform-origin: left; }
:root[data-theme="dark"] .hero-bar span { background: var(--grad); }
.hero-foot { font-size: 12.5px; opacity: .8; margin-top: 7px; }
.assistant {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-top: 12px;
  padding: 14px 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow);
}
:root[data-theme="dark"] .assistant { background: linear-gradient(135deg, rgba(242,138,201,.10), rgba(183,108,238,.06)); border-color: rgba(255,190,230,.14); }
.assistant .t { font-weight: 700; font-size: 15.5px; }
.assistant .x { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.quick { display: flex; gap: 8px; overflow-x: auto; margin: 14px -18px 0; padding: 2px 18px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick a, .quick button {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 9px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--card-border); font-size: 13.5px; font-weight: 650; color: var(--ink);
}
.quick .ic { width: 17px; height: 17px; color: var(--accent); }
.slim-alert { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 10px; padding: 11px 14px; border-radius: 16px; font-size: 13.5px; background: var(--warn-soft); }
.slim-alert.neg { background: var(--neg-soft); }
.slim-alert .ic { width: 18px; height: 18px; color: var(--warn); }
.slim-alert.neg .ic { color: var(--neg); }

/* Sections repliables */
details.fold { margin-top: 12px; }
details.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--card-border);
  font-weight: 650; font-size: 15px; color: var(--ink);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .ic { width: 18px; height: 18px; color: var(--ink-3); transition: transform .25s var(--ease); }
details.fold[open] > summary .ic { transform: rotate(180deg); }
details.fold > summary .muted { font-weight: 500; font-size: 13px; }
details.fold > .fold-body { padding-top: 10px; animation: rise .35s var(--ease) both; }
.more-link { display: block; width: 100%; text-align: center; padding: 12px; font-size: 14px; font-weight: 650; color: var(--accent); }

/* Saisie express */
.cat-grid.compact { grid-template-columns: repeat(4, 1fr); }
.date-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.intel-hero { text-align: center; padding: 6px 0 4px; }
.intel-hero .orb { margin: 0 auto 12px; }
.intel-hero .lvl { font-family: var(--font-round); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.intel-hero .sc { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.intel-hero p { color: var(--ink-2); font-size: 14.5px; margin: 10px 10px 0; line-height: 1.45; }
/* Listes : chaque ligne devient une carte */
.card.tight { background: none; border: 0; box-shadow: none; padding: 0; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.card.tight .list { gap: 8px; }
.card.tight .item, .list.cards .item {
  background: var(--surface); border-radius: 20px; border: 1px solid var(--card-border) !important; box-shadow: var(--shadow); padding: 12px 14px;
}
:root[data-theme="dark"] .card.tight .item { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.card.tight > .empty { background: var(--surface); border-radius: 24px; border: 1px solid var(--card-border); }
.day-head { padding: 18px 6px 8px; }
.list.cards { display: flex; flex-direction: column; gap: 8px; }
.brand-mark { background: var(--grad); }
.splash .brand-mark, .brand-mark { box-shadow: 0 12px 28px -10px rgba(178,106,235,.7); }
:root[data-theme="dark"] .brand-mark { color: #1A0A15; }
.toast { border-radius: 18px; }
.empty b { font-family: var(--font-round); }

/* Dépenses par personne */
.who-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.who {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 20px; text-align: left; min-width: 0;
  background: var(--surface); border: 1.5px solid var(--card-border); box-shadow: var(--shadow); transition: transform .15s var(--ease), border-color .2s;
}
:root[data-theme="dark"] .who { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.who:active { transform: scale(.97); }
.who.on { border-color: var(--accent); background: var(--accent-soft); }
.who-n { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-v { font-family: var(--font-round); font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.who-bar { width: 100%; height: 5px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 2px; }
.who-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad); animation: grow-x .9s var(--ease) both; transform-origin: left; }

/* Avis */
.avis { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.avis-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 13px 14px; border-radius: 18px;
  background: var(--accent-soft); font-size: 14px; line-height: 1.45; color: var(--ink);
}
.avis-card.warn { background: var(--warn-soft); }
.avis-card.good { background: var(--pos-soft); }
.avis-emo { font-size: 20px; line-height: 1.2; flex: none; }
.avis-t { flex: 1; }

/* Carte « Reste ce mois-ci » : centrée et plus grande */
.hero-main { text-align: center; padding: 30px 22px 24px; }
.hero-main .chip-live { position: absolute; top: 14px; right: 14px; }
.hero-main .hero-label { font-size: 14.5px; font-weight: 600; opacity: .85; }
.hero-main .hero-amount { font-size: 58px; line-height: 1; margin: 10px 0 4px; letter-spacing: -.04em; }
.hero-main .hero-amount .cents { font-size: 30px; }
.hero-main .hero-line { justify-content: center; gap: 0; margin-top: 20px; }
.hero-main .hero-line > button { flex: 1; align-items: center; text-align: center !important; }
.hero-main .hero-line > button + button { border-left: 1px solid rgba(255,255,255,.25); }
.hero-main .hero-line .l { justify-content: center; }
.hero-main .hero-line .v { font-size: 20px; }
.hero-main .hero-bar { margin: 18px 6px 0; }
.hero-main .hero-foot { margin-top: 9px; }
@media (max-width: 360px) { .hero-main .hero-amount { font-size: 48px; } }

/* Opérations : liste encadrée, recherche en bas */
.ops-frame { border-radius: 26px; padding: 8px; background: var(--accent-soft); border: 1px solid var(--card-border); }
:root[data-theme="dark"] .ops-frame { background: rgba(255,255,255,.03); }
.ops-frame .day-head { padding: 12px 8px 6px; }
.ops-frame .day-head:first-child { padding-top: 6px; }
.ops-frame > .row.faint:first-child { padding: 6px 8px 0 !important; }
.more-link { display: flex; align-items: center; justify-content: center; gap: 6px; }
.flip { transform: rotate(180deg); }
.search-box { padding: 12px; border-radius: 24px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.search-box .search { box-shadow: none; background: var(--bg-2); border: 0; }
:root[data-theme="dark"] .search-box .search { background: rgba(255,255,255,.05); }
.search-box .chips { margin: 8px -12px 0; padding: 2px 12px 2px; }
.search-box .chip { background: var(--bg-2); border: 0; }
:root[data-theme="dark"] .search-box .chip { background: rgba(255,255,255,.06); }
.search-box .chip.on { background: var(--accent); }
#ops-list:not(:empty) { margin-top: 10px; }

/* Enveloppes */
.env-list { display: flex; flex-direction: column; gap: 8px; }
.env { display: block; width: 100%; text-align: left; padding: 13px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow); }
:root[data-theme="dark"] .env { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.env-t { font-weight: 680; font-size: 15px; }
.env-s { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.env-v { font-size: 14px; white-space: nowrap; }
.env-empty { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13.5px; line-height: 1.4; border-style: dashed; box-shadow: none; }
.env-empty .ic { color: var(--accent); width: 22px; height: 22px; flex: none; }

/* Bilan en préparation */
.ready-bar { height: 8px; border-radius: 99px; background: var(--track); margin: 16px 30px 0; overflow: hidden; }
.ready-bar span { display: block; height: 100%; border-radius: 99px; background: var(--grad); animation: grow-x 1s var(--ease) both; transform-origin: left; }
.step-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 0; font-size: 14.5px; }
.step-row + .step-row { border-top: 1px solid var(--line); }
.step-check { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.step-check .ic { width: 16px; height: 16px; }
.step-check.on { background: var(--pos); color: #fff; }

/* Favoris */
.fav-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 4px; scrollbar-width: none; }
.fav-row::-webkit-scrollbar { display: none; }
.fav-row.in-sheet { margin: 4px -20px 2px; padding: 2px 20px 6px; }
.fav {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 8px; border-radius: 16px; flex: none; text-align: left;
  background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow); transition: transform .12s var(--ease);
}
.sheet .fav { background: var(--bg-2); box-shadow: none; }
:root[data-theme="dark"] .fav { background: rgba(255,255,255,.06); }
.fav:active { transform: scale(.95); }
.fav span { display: flex; flex-direction: column; line-height: 1.2; }
.fav b { font-size: 13.5px; font-weight: 680; white-space: nowrap; }
.fav i { font-style: normal; font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* Import bancaire */
.imp-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.imp-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 16px; background: var(--bg-2); transition: opacity .2s; }
:root[data-theme="dark"] .imp-row { background: rgba(255,255,255,.05); }
.imp-row.off { opacity: .45; }
.imp-check { position: relative; width: 24px; height: 24px; flex: none; margin-top: 1px; }
.imp-check input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.imp-check span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--ink-3); color: transparent; }
.imp-check input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.imp-check .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.imp-cat { font-size: 12.5px; border: 0; border-radius: 8px; padding: 3px 6px; background: var(--surface); color: var(--ink-2); max-width: 170px; }

/* Siri, listes d'explications */
.steps { margin: 14px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.steps li { margin-bottom: 10px; }
.checklist { margin: 10px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; list-style: none; padding: 0; }
.copyline { display: flex; align-items: center; gap: 6px; background: var(--bg-2); border-radius: 12px; padding: 4px 4px 4px 12px; }
:root[data-theme="dark"] .copyline { background: rgba(255,255,255,.05); }
.copyline code { flex: 1; font-size: 12px; overflow-wrap: anywhere; color: var(--ink-2); }
.kvbox { margin-top: 8px; border-radius: 12px; background: var(--bg-2); padding: 6px 10px; font-size: 12.5px; }
:root[data-theme="dark"] .kvbox { background: rgba(255,255,255,.05); }
.kvbox div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.kvbox span { color: var(--ink-2); font-family: ui-monospace, monospace; }
.kvbox b { font-weight: 650; overflow-wrap: anywhere; text-align: right; }

/* Verrouillage Face ID */
.lock-screen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 30px;
  background: var(--bg); background-image: radial-gradient(80% 50% at 50% 20%, rgba(178,106,235,.25), transparent 70%); }
.lock-t { font-family: var(--font-round); font-size: 22px; font-weight: 800; }

/* Montants masqués */
body.privacy .num, body.privacy .hero-amount, body.privacy .forecast-amt, body.privacy .who-v,
body.privacy .env-v, body.privacy .donut-bottom, body.privacy .fav i, body.privacy .gauge-score {
  filter: blur(8px); transition: filter .2s;
}
.hero-carry { font-size: 13px; opacity: .85; margin-top: 2px; font-weight: 550; }
