/* Rose — feuille de style. Rose et blanc, doux, lisible. */

:root {
  color-scheme: light;
  --bg: #fff7fa;
  --card: #ffffff;
  --ink: #2a1b22;
  --ink-2: #5a4450;
  --muted: #8a6b79;
  --line: #f4dfe8;
  --line-2: #ecccd9;
  --rose: #e84a8a;          /* accents, barres, icônes */
  --rose-strong: #cf2f6e;   /* fonds de boutons avec texte blanc (AA) */
  --rose-deep: #a8235a;     /* texte rose sur fond clair (AA) */
  --rose-pale: #fde8f0;
  --rose-soft: #fbd3e3;
  --green: #1f8a5b;
  --green-pale: #e3f5ec;
  --warn: #c4213f;
  --warn-pale: #fde6ea;
  --violet: #7a4fc9;
  --violet-pale: #efe8fb;
  --shadow-sm: 0 1px 2px rgba(120, 30, 70, .06), 0 2px 8px rgba(120, 30, 70, .05);
  --shadow: 0 2px 6px rgba(120, 30, 70, .06), 0 10px 30px rgba(120, 30, 70, .08);
  --shadow-lg: 0 -8px 40px rgba(80, 10, 40, .18);
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 64px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --kb: 0px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.lock { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--rose-deep); }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(232, 74, 138, .45); outline-offset: 2px; }

/* ---------- Démarrage ---------- */
.splash {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 100;
}
.splash-logo { border-radius: 22px; box-shadow: var(--shadow); animation: pulse 1.6s var(--ease) infinite; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--sat)) calc(20px + var(--sar)) calc(24px + var(--sab)) calc(20px + var(--sal));
  background:
    radial-gradient(120% 60% at 50% -10%, #ffd9e8 0%, rgba(255, 217, 232, 0) 70%),
    var(--bg);
}
.login-inner { width: 100%; max-width: 400px; text-align: center; animation: rise .5s var(--ease) both; }
.login-logo { margin: 0 auto 14px; border-radius: 22px; box-shadow: var(--shadow); }
.login-title { font-size: 40px; font-weight: 800; letter-spacing: -.02em; color: var(--rose-deep); }
.login-sub { color: var(--muted); margin: 4px 0 24px; }
.login-card { text-align: left; padding: 22px 20px 20px; }

/* ---------- Coquille ---------- */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--sat)) calc(18px + var(--sar)) 10px calc(18px + var(--sal));
  background: rgba(255, 247, 250, .86);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}
.topbar.scrolled { box-shadow: 0 1px 0 var(--line); }
.topbar-text { min-width: 0; }
.topbar-kicker { font-size: 14px; color: var(--muted); font-weight: 600; }
.topbar-kicker::first-letter { text-transform: uppercase; }
.topbar-kicker:empty { display: none; }
.topbar-title {
  font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center; padding: 0;
  background: linear-gradient(145deg, #f78ab3, var(--rose-strong));
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 14px rgba(207, 47, 110, .3);
  transition: transform .15s var(--ease);
}
.avatar:active { transform: scale(.92); }
.avatar.active { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--rose); }

.view {
  padding: 6px calc(16px + var(--sar)) calc(var(--tabbar-h) + var(--sab) + 96px) calc(16px + var(--sal));
  outline: none;
}
.view.enter { animation: viewIn .32s var(--ease) both; }

/* Barre d'onglets */
.tabbar {
  position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal));
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; border-radius: 14px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700;
  transition: color .2s;
}
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.tab.active { color: var(--rose-strong); }
.tab.active svg { fill: var(--rose-soft); transform: translateY(-1px) scale(1.06); }
.tab:active svg { transform: scale(.9); }

/* Bouton flottant */
.fab {
  position: fixed; z-index: 25;
  right: max(calc(18px + var(--sar)), calc(50% - 260px + 18px));
  bottom: calc(var(--tabbar-h) + var(--sab) + 18px);
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: linear-gradient(145deg, #f2679f, var(--rose-strong));
  color: #fff;
  box-shadow: 0 10px 26px rgba(207, 47, 110, .42), 0 2px 6px rgba(207, 47, 110, .3);
  display: grid; place-items: center;
  transition: transform .2s var(--ease), opacity .2s;
  animation: popIn .35s var(--ease) both;
}
.fab svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.fab:active { transform: scale(.9); }

/* ---------- Composants ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid rgba(244, 223, 232, .7);
}
.card-pad { padding: 18px; }
.section { margin-top: 26px; }
.section:first-child { margin-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.section-link {
  border: 0; background: none; color: var(--rose-deep); font-weight: 700; font-size: 15px;
  min-height: 44px; padding: 0 4px; margin: -12px -4px;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 16px; border: 0;
  font-weight: 700; font-size: 17px; text-decoration: none;
  transition: transform .15s var(--ease), opacity .15s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--rose-strong); color: #fff; box-shadow: 0 6px 18px rgba(207, 47, 110, .28); }
.btn-soft { background: var(--rose-pale); color: var(--rose-deep); }
.btn-ghost { background: transparent; color: var(--rose-deep); }
.btn-danger { background: var(--warn-pale); color: var(--warn); }
.btn-danger.confirm { background: var(--warn); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; font-size: 15px; padding: 0 16px; border-radius: 14px; }
.btn-magic {
  width: 100%; min-height: 58px; font-size: 18px; color: #fff; border-radius: 18px;
  background: linear-gradient(120deg, #f06aa2 0%, var(--rose-strong) 55%, #a63ccf 120%);
  box-shadow: 0 10px 26px rgba(190, 50, 130, .32);
}
.btn .spin { width: 18px; height: 18px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  display: grid; place-items: center; background: var(--rose-pale); color: var(--rose-deep);
  transition: transform .15s var(--ease);
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.9); }
.icon-btn.plain { background: transparent; color: var(--muted); }

/* Champs */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px 4px; }
.field-hint { display: block; font-size: 13px; color: var(--muted); margin: 6px 0 0 4px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font-size: 17px; /* ≥ 16px : pas de zoom Safari */
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 14px;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--rose); box-shadow: 0 0 0 4px rgba(232, 74, 138, .14);
}
input::placeholder { color: #b89aa7; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error {
  background: var(--warn-pale); color: var(--warn); font-weight: 600; font-size: 15px;
  border-radius: 12px; padding: 10px 12px; margin: 0 0 14px;
}
.form-ok { background: var(--green-pale); color: var(--green); font-weight: 600; font-size: 15px; border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }

.amount-field {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  padding: 6px 0 2px; margin-bottom: 12px;
}
.amount-field input {
  width: 1.4ch; min-width: 1.4ch; max-width: 100%; border: 0; background: transparent; text-align: center;
  font-size: 48px; font-weight: 800; letter-spacing: -.02em; padding: 0; min-height: 64px;
  font-variant-numeric: tabular-nums; color: var(--ink); outline: none;
}
.amount-field input::placeholder { color: #e9c3d3; }
.amount-field .cur { font-size: 32px; font-weight: 800; color: var(--muted); }
.amount-line { height: 3px; border-radius: 3px; background: var(--rose-soft); margin: 0 auto 16px; width: 70%; }

/* Contrôle segmenté */
.segmented {
  display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 4px;
  background: var(--rose-pale); padding: 4px; border-radius: 16px; margin-bottom: 16px;
}
.segmented button {
  min-height: 44px; border: 0; border-radius: 12px; background: transparent;
  font-weight: 700; font-size: 15px; color: var(--ink-2); padding: 0 6px;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented button.on { background: #fff; color: var(--rose-deep); box-shadow: var(--shadow-sm); }
.segmented.t-depense button.on { color: var(--rose-deep); }
.segmented.t-revenu button.on { color: var(--green); }
.segmented.t-virement button.on { color: var(--violet); }

/* Puces */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px 6px; scroll-padding: 16px;
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .15s, border-color .15s, color .15s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--rose-strong); border-color: var(--rose-strong); color: #fff; }
.chip .e { font-size: 18px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.cat-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 72px; padding: 8px 4px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 700; line-height: 1.15; text-align: center;
  transition: transform .15s var(--ease), background-color .15s, border-color .15s;
}
.cat-btn .e { font-size: 26px; line-height: 1.1; }
.cat-btn:active { transform: scale(.95); }
.cat-btn.on { background: var(--rose-pale); border-color: var(--rose); color: var(--rose-deep); }

.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.emoji-row button {
  width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; font-size: 22px; padding: 0;
}
.emoji-row button.on { border-color: var(--rose); background: var(--rose-pale); }

/* Interrupteur */
.switch { position: relative; display: inline-flex; align-items: center; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  width: 51px; height: 31px; border-radius: 999px; background: #e6d3dc; position: relative;
  transition: background-color .2s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .18); transition: transform .22s var(--ease);
}
.switch input:checked + .switch-track { background: var(--rose-strong); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(232, 74, 138, .45); outline-offset: 2px; }

/* ---------- Accueil ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 20px 20px 18px; border-radius: 26px;
  background: linear-gradient(140deg, #e3508b 0%, #c42c68 60%, #a3215a 100%);
  box-shadow: 0 14px 34px rgba(196, 44, 104, .3);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); pointer-events: none;
}
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.hero::after { width: 140px; height: 140px; right: 40px; bottom: -80px; background: rgba(255, 255, 255, .07); }
.hero-label { font-size: 16px; font-weight: 700; opacity: .95; }
.hero-amount { margin: 2px 0 14px; }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.hero-mini { background: rgba(255, 255, 255, .16); border-radius: 16px; padding: 10px 12px; }
.hero-mini .lbl { font-size: 13px; font-weight: 700; opacity: .95; }
.hero-mini .val { font-size: 21px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.money { font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.money .m-int { font-size: 1em; }
.money .m-dec { font-size: .55em; font-weight: 700; opacity: .9; }
.money-xl { font-size: 50px; line-height: 1.05; }
.money-l { font-size: 30px; line-height: 1.1; }

.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #fff; border-radius: 18px; padding: 12px 10px; box-shadow: var(--shadow-sm); border: 1px solid rgba(244, 223, 232, .7); min-width: 0; }
.stat .lbl { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.stat .val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.in { background: var(--green); }
.dot.out { background: var(--rose); }
.dot.save { background: var(--violet); }

/* Barres de budget */
.bars { padding: 6px 16px; }
.bar-row { padding: 12px 0; }
.bar-row + .bar-row { border-top: 1px solid var(--line); }
.bar-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-emoji { font-size: 22px; width: 28px; text-align: center; flex: none; }
.bar-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-val { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.bar-val strong { color: var(--ink); }
.bar { height: 10px; border-radius: 10px; background: var(--rose-pale); overflow: hidden; }
.bar-fill {
  height: 100%; width: 100%; border-radius: 10px; background: linear-gradient(90deg, #f38bb4, var(--rose));
  transform-origin: left center; transform: scaleX(0); transition: transform .8s var(--ease);
}
.bar-row.warn .bar-fill { background: linear-gradient(90deg, #f0a24a, #e0782a); }
.bar-row.over .bar-fill { background: linear-gradient(90deg, #e8566e, var(--warn)); }
.bar-row.over .bar-val strong { color: var(--warn); }
.bar-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.bar-row.over .bar-note { color: var(--warn); font-weight: 700; }

/* Objectifs */
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.goal {
  padding: 16px 12px 14px; text-align: center; border: 0; width: 100%; font: inherit; color: inherit;
  transition: transform .15s var(--ease);
}
button.goal:active { transform: scale(.97); }
.ring { position: relative; width: 92px; height: 92px; margin: 0 auto 8px; }
.ring svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--rose-pale); stroke-width: 9; }
.ring .prog { fill: none; stroke: var(--rose); stroke-width: 9; stroke-linecap: round; }
.ring.done .prog { stroke: var(--green); }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
.goal-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-amt { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-pct { font-size: 13px; font-weight: 800; color: var(--rose-deep); margin-top: 2px; }
.ring.done + .goal-name + .goal-amt + .goal-pct { color: var(--green); }

/* Opérations */
.ops { padding: 4px 0; }
.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 18px 6px 8px; font-size: 15px; font-weight: 800; color: var(--ink-2);
}
.day-head:first-child { margin-top: 16px; }
.day-head span:first-letter { text-transform: uppercase; }
.day-head .num { color: var(--muted); font-weight: 700; font-size: 14px; }
.op {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 10px 16px; border: 0; background: transparent; text-align: left;
  transition: background-color .15s;
}
.op + .op { border-top: 1px solid var(--line); }
.op:active { background: var(--rose-pale); }
.op-ic {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 22px; background: var(--rose-pale);
}
.op-ic.in { background: var(--green-pale); }
.op-ic.save { background: var(--violet-pale); }
.op-main { flex: 1; min-width: 0; }
.op-title, .op-sub, .item-title, .item-sub { display: block; }
.op-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-amt { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.op-amt.in { color: var(--green); }
.op-amt.save { color: var(--violet); }
.badge-fixe {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
  color: var(--rose-deep); background: var(--rose-pale); padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px;
}

/* ---------- Budget ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 14px; }
.month-nav .lbl { font-size: 19px; font-weight: 800; text-align: center; flex: 1; }
.month-nav .icon-btn:disabled { opacity: .35; }
.sum-card { padding: 16px 18px; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.sum-grid .lbl { font-size: 13px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sum-grid .val { font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sum-foot .lbl { font-weight: 700; color: var(--ink-2); }
.sum-foot .val { font-size: 22px; font-weight: 800; color: var(--rose-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-foot .val.neg { color: var(--warn); }

.search {
  position: relative; margin: 14px 0 4px;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { padding-left: 44px; border-radius: 999px; background: #fff; }

.list { padding: 2px 0; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 10px 16px; border: 0; background: transparent; text-align: left;
}
.item + .item { border-top: 1px solid var(--line); }
button.item:active { background: var(--rose-pale); }
.item-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--rose-pale); flex: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.item-val small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.item.off { opacity: .5; }
.chev { width: 18px; height: 18px; fill: none; stroke: #d3b3c1; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.add-row {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; margin-top: 10px; border-radius: 18px;
  border: 2px dashed var(--line-2); background: transparent; color: var(--rose-deep); font-weight: 800; font-size: 16px;
}
.add-row:active { background: var(--rose-pale); }

/* ---------- Courses ---------- */
.quick-add { display: flex; gap: 8px; padding: 8px; align-items: center; }
.quick-add .input { border: 0; min-height: 48px; padding: 10px 12px; box-shadow: none; }
.quick-add .input:focus { box-shadow: none; }
.quick-add .qty { width: 92px; flex: none; background: var(--rose-pale); border-radius: 12px; }
.quick-add .nom { flex: 1; min-width: 0; }
.quick-add .icon-btn { width: 48px; height: 48px; background: var(--rose-strong); color: #fff; border-radius: 14px; }

.check-list { padding: 2px 0; }
.check-item { display: flex; align-items: center; gap: 4px; min-height: 60px; padding: 4px 6px 4px 4px; }
.check-item + .check-item { border-top: 1px solid var(--line); }
.check-item.enter { animation: rise .3s var(--ease) both; }
.check-btn {
  width: 56px; height: 56px; flex: none; border: 0; background: transparent; display: grid; place-items: center; padding: 0;
}
.check-circle {
  width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid #e2b3c7; background: #fff;
  display: grid; place-items: center; transition: transform .2s var(--ease), background-color .2s, border-color .2s;
}
.check-circle svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s var(--ease); }
.check-btn:active .check-circle { transform: scale(.88); }
.check-item.done .check-circle { background: var(--rose-strong); border-color: var(--rose-strong); }
.check-item.done .check-circle svg { opacity: 1; transform: scale(1); }
.check-text { flex: 1; min-width: 0; border: 0; background: none; text-align: left; min-height: 52px; padding: 4px 4px; display: flex; flex-direction: column; justify-content: center; }
.check-name { font-size: 18px; font-weight: 600; word-break: break-word; }
.check-qty { font-size: 14px; color: var(--muted); font-weight: 600; }
.check-item.done .check-name { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(138, 107, 121, .6); }

.ai-intro { display: flex; gap: 12px; align-items: flex-start; }
.ai-intro .big { font-size: 30px; line-height: 1; }

.ai-wait { padding: 26px 20px 22px; text-align: center; overflow: hidden; position: relative; }
.ai-orb { position: relative; width: 84px; height: 84px; margin: 0 auto 16px; }
.ai-orb .o1, .ai-orb .o2 {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, #f9a8c9, var(--rose), #b05ad6, #f9a8c9);
  animation: spin 2.4s linear infinite;
}
.ai-orb .o2 { inset: 7px; background: #fff; animation: none; }
.ai-orb .o3 { position: absolute; inset: 0; display: grid; place-items: center; font-size: 32px; animation: pulse 1.8s var(--ease) infinite; }
.ai-msg { font-weight: 800; font-size: 18px; min-height: 26px; transition: opacity .3s; }
.ai-msg.fade { opacity: 0; }
.ai-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.ai-track { height: 6px; border-radius: 6px; background: var(--rose-pale); overflow: hidden; margin: 16px auto 0; max-width: 240px; }
.ai-track span { display: block; height: 100%; width: 40%; border-radius: 6px; background: linear-gradient(90deg, transparent, var(--rose), transparent); animation: slide 1.4s var(--ease) infinite; }

.advice {
  padding: 20px 18px; color: #fff; border-radius: 24px;
  background: linear-gradient(140deg, #e3508b 0%, #c42c68 65%, #9e2a8f 120%);
  box-shadow: 0 14px 34px rgba(196, 44, 104, .28);
}
.advice-kicker { font-size: 14px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.advice-text { font-size: 18px; font-weight: 600; line-height: 1.45; margin-top: 6px; }
.advice-store { margin-top: 16px; background: rgba(255, 255, 255, .16); border-radius: 18px; padding: 14px; display: flex; gap: 14px; align-items: center; }
.advice-store .pct { position: relative; width: 64px; height: 64px; flex: none; }
.advice-store .pct svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.advice-store .pct .track { fill: none; stroke: rgba(255, 255, 255, .25); stroke-width: 7; }
.advice-store .pct .prog { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; }
.advice-store .pct b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.advice-store .name { font-size: 20px; font-weight: 800; }
.advice-store .addr { font-size: 14px; opacity: .92; }
.advice-store .why { font-size: 14px; opacity: .95; margin-top: 4px; }
.advice-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-weight: 700; }
.advice-total .money { font-size: 26px; }
.disclaimer {
  display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink-2);
  background: #fff4e5; border-radius: 14px; padding: 10px 12px; margin-top: 12px;
}

.art { padding: 14px 16px; }
.art + .art { border-top: 1px solid var(--line); }
.art-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.art-name { font-weight: 800; font-size: 17px; }
.art-price { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--rose-deep); }
.art-store { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.art-note { font-size: 14px; color: var(--muted); margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--rose-pale); color: var(--rose-deep); }
.badge.promo { background: #ffe9d6; color: #a34a00; }
.badge.halal { background: var(--green-pale); color: var(--green); }
.badge.end { background: #f1ecf9; color: #5b3aa0; }

.store-card { padding: 14px 16px; }
.store-card + .store-card { margin-top: 10px; }
.store-name { font-weight: 800; font-size: 17px; }
.store-addr { font-size: 14px; color: var(--muted); }
.store-why { font-size: 15px; margin-top: 6px; color: var(--ink-2); }

.sources { padding: 6px 16px; }
.source { display: flex; align-items: center; gap: 10px; min-height: 48px; text-decoration: none; color: var(--ink-2); font-size: 15px; font-weight: 600; }
.source + .source { border-top: 1px solid var(--line); }
.source span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source svg { width: 16px; height: 16px; fill: none; stroke: var(--rose-deep); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Bons plans ---------- */
.deals-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 4px 14px; }
.rubrique { overflow: hidden; }
.rubrique + .rubrique { margin-top: 16px; }
.rub-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px; }
.rub-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--rose-pale); flex: none; }
.rub-title { font-size: 18px; font-weight: 800; line-height: 1.2; }
.deal { padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.deal-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.deal-title { font-weight: 800; font-size: 16px; }
.deal-detail { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.deal-shop { font-size: 13px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.deal-price { text-align: right; flex: none; }
.deal-price .now { font-size: 20px; font-weight: 800; color: var(--rose-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal-price .was { font-size: 14px; color: var(--muted); text-decoration: line-through; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.deal-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; margin: -6px -4px -8px auto;
  border-radius: 999px; font-weight: 800; font-size: 15px; text-decoration: none; color: var(--rose-deep);
}
.deal-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.deal-link:active { background: var(--rose-pale); }
.rub-empty { padding: 4px 16px 16px; color: var(--muted); font-size: 15px; }

/* ---------- Réglages ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.me-card .avatar { width: 56px; height: 56px; font-size: 24px; pointer-events: none; }
.version { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }

/* ---------- États ---------- */
.empty { text-align: center; padding: 30px 20px 26px; }
.empty .art-e { font-size: 50px; line-height: 1; margin-bottom: 10px; display: inline-block; animation: float 3.2s ease-in-out infinite; }
.empty h3 { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 300px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.empty-inline { padding: 18px 16px; color: var(--muted); text-align: center; font-size: 15px; }

.error-card { padding: 22px 18px; text-align: center; }
.error-card .art-e { font-size: 40px; margin-bottom: 6px; }
.error-card h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.error-card p { color: var(--ink-2); margin-bottom: 14px; }

.skeleton { border-radius: var(--radius); background: #fbe9f0; position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
.sk-hero { height: 196px; border-radius: 26px; }
.sk-row { height: 76px; margin-top: 12px; }
.sk-block { height: 220px; margin-top: 18px; }

.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn-soft .spin, .btn-ghost .spin { border-color: var(--rose-soft); border-top-color: var(--rose-strong); }

/* ---------- Feuille du bas ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(60, 15, 35, .38); opacity: 0; transition: opacity .3s var(--ease); }
.sheet {
  position: absolute; left: 50%; bottom: var(--kb); width: 100%; max-width: 520px;
  max-height: calc(100% - var(--sat) - 24px - var(--kb));
  display: flex; flex-direction: column;
  background: #fff; border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 104%); transition: transform .38s var(--ease);
  padding-bottom: var(--sab);
}
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet-root.kb .sheet { padding-bottom: 0; }
.sheet-grip { width: 40px; height: 5px; border-radius: 5px; background: #ecd3de; margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 14px 6px 22px; flex: none; }
.sheet-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 20px 20px; flex: 1; }
.sheet-actions { display: grid; gap: 10px; margin-top: 8px; }
.sheet-actions.two { grid-template-columns: 1fr 1.6fr; }

/* Toast */
.toast {
  position: fixed; z-index: 80; left: 50%; top: calc(var(--sat) + 10px);
  max-width: min(480px, calc(100% - 32px)); width: max-content;
  padding: 12px 18px; border-radius: 16px; background: var(--ink); color: #fff;
  font-weight: 700; font-size: 15px; box-shadow: 0 10px 30px rgba(42, 27, 34, .3);
  transform: translate(-50%, -20px); opacity: 0; transition: transform .3s var(--ease), opacity .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { background: var(--warn); }
.toast.ok { background: #2b7d57; }

.noscript { padding: 40px 20px; text-align: center; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.stagger > * { animation: rise .4s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; }
.stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; }
.stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(n+6) { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0s !important; transition-duration: .001ms !important;
  }
  .ai-track span { width: 100%; transform: none; }
}

@media (min-width: 560px) {
  .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 22px 22px 0 0; }
}

/* ---------- Petits ajustements ---------- */
.hero-foot { position: relative; z-index: 1; margin-top: 10px; opacity: .92; font-weight: 600; }
.emoji-gap { height: 8px; }
.btn svg.ic, .add-row svg.ic-sm { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sum-foot.flat { margin-top: 0; padding-top: 0; border-top: 0; }
.intro { margin: 2px 4px 0; }
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch-row .field-label { margin-bottom: 0; }
.goal-sheet-progress { margin-bottom: 16px; background: var(--rose-pale); border: 0; box-shadow: none; }
.goal-sheet-progress .field-label { margin-left: 0; }
.goal-sheet-progress .bar { background: #fff; }
.progress-gap { margin-top: 12px; }
.section-gap { margin-top: 16px; }
.section-gap-b { margin-bottom: 16px; }
.bar-row.nobudget .bar-fill { background: linear-gradient(90deg, #f6c4d8, #efa3c2); }
.boot-err { max-width: 320px; padding: 24px; }
.boot-err h1 { margin: 6px 0; }
.boot-err .btn { margin-top: 18px; }
.chips.scroll + .month-nav, .chips.scroll + div { margin-top: 10px; }

.month-nav .lbl::first-letter { text-transform: uppercase; }
.app { overflow-x: clip; }

.sheet-actions.sticky {
  position: sticky; bottom: 0; z-index: 2; margin: 8px -20px -20px; padding: 18px 20px 20px;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff 16px);
}
.sheet-actions.sticky + .sheet-actions { margin-top: 28px; }
.segmented button { line-height: 1.15; }
.deal-title, .deal-detail, .art-name, .art-note, .advice-text, .store-why, .check-name, .rub-title, .store-name, .empty p, .error-card p { overflow-wrap: anywhere; }
.section, .ai-wait { scroll-margin-top: 96px; }
