/* VAULT : thème sombre, glassmorphism sobre (MolediSolutions : navy #0B2A6F, ciel #0284C7, orange #F97316) */
:root {
  --bg: #0b1226; --bg2: #0F172A; --card: rgba(30, 41, 59, .62); --card-solid: #1E293B; --input: rgba(51, 65, 85, .55);
  --edge: rgba(255, 255, 255, .10); --edge-hi: rgba(255, 255, 255, .22);
  --text: #F8FAFC; --muted: #94A3B8; --accent: #F97316; --gold: #F59E0B; --navy: #0B2A6F; --sky: #0284C7;
  --inc: #22C55E; --exp: #EF4444; --warn: #EAB308;
  --r: 20px; --ease: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body.locked #app, body.locked #fab, body.locked #tabbar { filter: blur(18px); pointer-events: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none; }
.muted { color: var(--muted); } .center { text-align: center; } .grow { flex: 1; }
.pos { color: var(--inc); } .neg { color: var(--exp); } .warnc { color: var(--warn); }

/* Fond aurore */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% -10%, #11204a 0%, var(--bg) 60%); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.aurora .b1 { width: 340px; height: 340px; background: var(--sky); top: -90px; left: -80px; animation: drift1 24s ease-in-out infinite alternate; }
.aurora .b2 { width: 300px; height: 300px; background: var(--accent); opacity: .28; bottom: 60px; right: -90px; animation: drift2 28s ease-in-out infinite alternate; }
.aurora .b3 { width: 280px; height: 280px; background: #6366F1; opacity: .26; top: 38%; left: 30%; animation: drift1 32s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(90px, 70px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-80px, -60px) scale(1.1); } }

.glass, .card { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%); box-shadow: 0 8px 28px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .08); }
.pad { padding: 14px 16px; }
#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 14px calc(96px + var(--safe-b)); min-height: 100vh; }
.view { animation: none; }
.view.in-f { animation: fadeUp .45s var(--ease); }
.view.in-r { animation: slideR .38s var(--ease); }
.view.in-l { animation: slideL .38s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(34px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-34px); } }
header.top h1 { font-size: 28px; margin: 8px 4px 10px; letter-spacing: -.02em; }
.lbl { font-size: 12px; letter-spacing: .09em; color: var(--muted); margin: 18px 6px 8px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lbl small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Hero / tuiles */
.hero { padding: 16px 18px; margin-bottom: 12px; }
.hero small { display: block; color: var(--muted); }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 4px; animation: pop .5s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.tile { padding: 12px 14px; animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.tile small { color: var(--muted); display: block; font-size: 12px; } .tile b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* Puces */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 10px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip { padding: 9px 15px; border-radius: 999px; background: var(--input); border: 1px solid var(--edge); white-space: nowrap; transition: transform .2s var(--ease), background .2s; display: inline-flex; align-items: center; gap: 6px; }
.chip:active { transform: scale(.95); }
.chip.on { background: #fff; color: #0B1226; border-color: #fff; font-weight: 600; }
.chip.sm { padding: 5px 10px; font-size: 13px; } .chip.cat .e { font-size: 18px; } .chip.cal { position: relative; overflow: hidden; } .chip.cal input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.chip.more { color: var(--muted); }
.tiles-wrap, .tile-row { display: flex; gap: 8px; }
.cat-chips.tiles { display: flex; gap: 8px; overflow-x: auto; }
.tile.on, button.tile.on { background: rgba(249, 115, 22, .22); border-color: var(--accent); }
button.tile { flex: 0 0 auto; min-width: 84px; padding: 12px 8px; border-radius: 16px; background: var(--input); border: 1px solid var(--edge); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; transition: transform .2s var(--ease); }
button.tile .e { font-size: 24px; } button.tile:active { transform: scale(.95); }
.seg { display: flex; background: var(--input); border-radius: 14px; padding: 3px; margin: 6px 0 12px; border: 1px solid var(--edge); }
.seg button { flex: 1; padding: 9px; border-radius: 11px; color: var(--muted); transition: background .25s, color .25s; }
.seg button.on { background: #fff; color: #0B1226; font-weight: 600; }

/* Listes */
.day { margin-top: 14px; } .day-h { display: flex; justify-content: space-between; padding: 0 6px 8px; font-weight: 600; text-transform: lowercase; }
.day-h .muted { font-weight: 500; font-variant-numeric: tabular-nums; }
.swipe { position: relative; margin-bottom: 8px; border-radius: var(--r); overflow: hidden; animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.swipe-act { position: absolute; inset: 0 0 0 auto; width: 150px; display: flex; }
.swipe-act button { flex: 1; font-weight: 600; background: var(--sky); } .swipe-act .d { background: var(--exp); }
.item { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); touch-action: pan-y; transition: transform .28s var(--ease); background: rgba(30, 41, 59, .92); border: 1px solid var(--edge); }
.item.drag { transition: none; } .swipe.open .item { transform: translateX(-150px); }
.ico { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .07); font-size: 18px; flex: none; }
.ico.big { width: 46px; height: 46px; font-size: 22px; }
.mid { flex: 1; min-width: 0; } .mid b { display: block; overflow: hidden; text-overflow: ellipsis; } .mid small { color: var(--muted); }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); } .empty .e { font-size: 42px; margin-bottom: 6px; }
.badge { display: inline-block; font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-weight: 600; }
.badge.warn { background: rgba(234, 179, 8, .2); color: #FDE047; } .badge.bad { background: rgba(239, 68, 68, .22); color: #FCA5A5; } .badge.ok { background: rgba(34, 197, 94, .2); color: #86EFAC; } .badge.info { background: rgba(56, 189, 248, .2); color: #7DD3FC; }
.banner { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; margin: 6px 0; border-radius: 16px; background: rgba(234, 179, 8, .15); border: 1px solid rgba(234, 179, 8, .4); text-align: left; }
.banner span:nth-child(2) { flex: 1; } .banner.over, .banner.bad { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .45); }
.recv { margin-top: -2px; width: calc(100% - 28px); margin: 0 14px 10px; }

/* Budget */
.qnav { display: flex; align-items: center; justify-content: space-between; text-align: center; margin: 4px 0 10px; } .qnav small { display: block; }
.bucket { padding: 12px 14px; margin-bottom: 8px; border-radius: var(--r); background: var(--card); border: 1px solid var(--edge); animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.bh { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-bottom: 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #22C55E, #4ADE80); animation: grow .8s var(--ease) both; }
@keyframes grow { from { width: 0 !important; } }
.bucket.warn .bar i { background: linear-gradient(90deg, #EAB308, #FACC15); } .bucket.over .bar i { background: linear-gradient(90deg, #EF4444, #F87171); }
.bucket.over { border-color: rgba(239, 68, 68, .5); } .bucket.warn { border-color: rgba(234, 179, 8, .4); }
.row-a { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; width: 100%; text-align: left; } .row-a b { display: block; } .row-a small { display: block; }
.btns { display: flex; gap: 6px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; font-variant-numeric: tabular-nums; } .kv.warn b { color: var(--warn); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; } .tbl th { color: var(--muted); font-weight: 500; text-align: right; } .tbl td { text-align: right; padding: 5px 0; } .tbl td:first-child, .tbl th:first-child { text-align: left; }
.cause { margin-top: 8px; font-size: 13px; } .big-e { font-size: 44px; }

/* Graphiques */
.chart { padding: 10px 8px 4px; } .chart canvas { width: 100%; height: 190px; display: block; }
.donut { display: flex; align-items: center; gap: 14px; } .donut canvas { width: 150px; height: 150px; flex: none; }
.legend-list { flex: 1; font-size: 13px; } .legend-list div { display: flex; align-items: center; gap: 6px; padding: 2px 0; } .legend-list b { margin-left: auto; }
.d { display: inline-block; width: 9px; height: 9px; border-radius: 50%; } .d.inc { background: #38BDF8; } .d.exp { background: #94A3B8; } .legend { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; display: flex; gap: 6px; align-items: center; }

/* Boutons / champs */
.btn { padding: 12px 18px; border-radius: 14px; background: var(--input); border: 1px solid var(--edge); font-weight: 600; transition: transform .2s var(--ease); text-align: center; }
.btn:active { transform: scale(.97); } .btn.wide { display: block; width: 100%; margin-top: 10px; } .btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn.gold { background: linear-gradient(135deg, #FBBF24, var(--accent)); color: #1a1205; border: 0; } .btn.danger { background: rgba(239, 68, 68, .2); color: #FCA5A5; border-color: rgba(239, 68, 68, .5); } .btn.ghost { background: rgba(255, 255, 255, .06); }
.link { color: #7DD3FC; margin: 8px 0; }
.field { width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--input); border: 1px solid var(--edge); outline: 0; } .field:focus { border-color: var(--accent); }
.field.sm { width: auto; padding: 7px 10px; } .btn-field { display: flex; justify-content: space-between; text-align: left; }
select.field option { color: #000; }
textarea.field { resize: none; margin-top: 8px; }
.row, .row2 { display: flex; gap: 10px; margin: 10px 0; } .row > .btn { flex: 1; } .row2 { display: grid; grid-template-columns: 1fr 1fr; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 4px; color: var(--muted); }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .08); display: inline-grid; place-items: center; flex: none; }
.pill { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--edge); background: var(--input); } .pill.gold { color: var(--gold); border-color: rgba(245, 158, 11, .4); font-weight: 700; }

/* FAB + onglets */
.fab { position: fixed; right: max(18px, calc(50% - 262px)); bottom: calc(92px + var(--safe-b)); width: 58px; height: 58px; border-radius: 50%; font-size: 32px; display: grid; place-items: center; background: linear-gradient(135deg, #FBBF24, var(--accent)); color: #1a1205; box-shadow: 0 10px 28px rgba(249, 115, 22, .45), inset 0 1px 0 rgba(255, 255, 255, .5); z-index: 20; transition: transform .25s var(--ease); line-height: 1; }
.fab:active { transform: scale(.9) rotate(90deg); }
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: min(540px, calc(100% - 24px)); display: flex; padding: 6px; border-radius: 28px; z-index: 30; background: rgba(15, 23, 42, .72); }
.tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 22px; font-size: 11px; color: var(--muted); transition: background .3s var(--ease), color .3s; }
.tab.on { background: rgba(255, 255, 255, .12); color: var(--gold); } .tab svg { transition: transform .3s var(--ease); } .tab.on svg { transform: translateY(-1px) scale(1.1); }
.bdg { position: absolute; top: 3px; right: calc(50% - 24px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--exp); color: #fff; font-size: 10px; font-style: normal; display: grid; place-items: center; font-weight: 700; }

/* Feuilles */
#sheets { position: relative; z-index: 50; }
.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .3s; z-index: 50; }
.overlay.in { background: rgba(2, 6, 23, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: rgba(15, 23, 42, .96); border: 1px solid var(--edge-hi); border-radius: 28px 28px 0 0; padding: 16px 16px calc(18px + var(--safe-b)); transform: translateY(100%); transition: transform .4s var(--ease); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); }
.overlay.in .sheet { transform: none; } .sheet.tall { min-height: 62vh; }
.sheet.full { height: 100dvh; max-height: 100dvh; border-radius: 0; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.sheet.dialog { max-width: 400px; border-radius: 26px; margin: auto; transform: scale(.92); opacity: 0; transition: transform .3s var(--ease), opacity .3s; align-self: center; }
.overlay.in .sheet.dialog { transform: none; opacity: 1; } .overlay:has(.dialog) { align-items: center; padding: 16px; }
.sh-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .sh-bar h3 { margin: 0; font-size: 22px; }
.sh-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 12px) 14px 10px; flex: none; } .sh-head h2 { font-size: 17px; margin: 0; }
.sh-scroll { flex: 1; overflow-y: auto; padding: 0 16px 20px; }
.amount-box { margin: 4px 14px 6px; padding: 18px 20px; border-radius: 22px; background: var(--input); border: 1px solid var(--edge); display: flex; align-items: center; justify-content: space-between; flex: none; }
.amount-box .amt { flex: 1; text-align: center; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; } .amount-box .amt.zero { color: rgba(255, 255, 255, .3); } .amount-box .cur { color: var(--muted); font-size: 20px; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 10px 8px calc(10px + var(--safe-b)); background: rgba(30, 41, 59, .7); border-radius: 22px 22px 0 0; flex: none; }
.key { padding: 12px 0; border-radius: 12px; background: rgba(255, 255, 255, .1); font-size: 24px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; transition: transform .1s, background .15s; }
.key:active { transform: scale(.94); background: rgba(255, 255, 255, .2); } .key small { font-size: 9px; letter-spacing: .15em; color: var(--muted); }
.entry.typing .keypad { display: none; }
.dlg h3 { margin: 4px 0 8px; font-size: 20px; } .dlg p { color: var(--muted); margin: 0 0 14px; } .dlg .row { margin-bottom: 0; }
.dsp-head { margin-bottom: 10px; } .dsp-head b { font-size: 26px; display: block; } .dsp-head span { color: var(--muted); }
.dsp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; } .dsp-row .nm { display: flex; gap: 10px; align-items: center; } .dsp-row small { display: block; color: var(--muted); font-size: 12px; } .dsp-row.over small { color: #FCA5A5; }
.amt-in { width: 110px; text-align: right; flex: none; } .dsp-total { display: flex; justify-content: space-between; margin: 8px 4px; color: var(--muted); } .dsp-total .bad { color: var(--exp); }
.alloc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; } .alloc-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .alloc-row .n { width: 18px; color: var(--muted); font-size: 12px; } .alloc-row .amt-in { width: 90px; } .pc { color: var(--muted); }
.cat-list { max-height: 50vh; overflow-y: auto; margin: 10px 0; border-radius: 16px; background: rgba(255, 255, 255, .04); }
.cat-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-bottom: 1px solid var(--edge); text-align: left; } .cat-row.sel { background: rgba(249, 115, 22, .15); }

/* Compte */
.list { padding: 4px 0; margin-bottom: 12px; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--edge); } .set-row:last-child { border-bottom: 0; }
.set-row .chev { margin-left: auto; color: var(--muted); } .set-row .badge + .chev { margin-left: 8px; } .set-row > span:nth-child(2) { flex: 1; } .set-row.danger { color: #FCA5A5; }
.set-row.cat .grow { flex: 1; min-width: 0; } .set-row.cat.arch { opacity: .45; } .set-row.log { justify-content: space-between; align-items: flex-start; }
.tg { cursor: pointer; justify-content: space-between; } .tg input { display: none; } .sw { width: 46px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, .18); position: relative; transition: background .25s; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); } .tg input:checked + .sw { background: var(--accent); } .tg input:checked + .sw::after { transform: translateX(18px); }
.foot { margin: 20px 0; font-size: 12px; } .an { margin-bottom: 8px; } .an p { margin: 0 0 8px; }

/* Verrouillage */
#lock { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: rgba(8, 13, 30, .82); -webkit-backdrop-filter: blur(26px); backdrop-filter: blur(26px); }
#lock.on { display: flex; animation: fadeUp .4s var(--ease); }
.lock-in { width: min(340px, 90vw); text-align: center; } .lock-in .keypad { background: transparent; padding: 8px 0; gap: 12px; margin-top: 8px; } .lock-in .key { border-radius: 50%; width: 72px; height: 72px; margin: auto; padding: 0; justify-content: center; font-size: 28px; background: rgba(255, 255, 255, .09); border: 1px solid var(--edge); }
.lock-in h2 { margin: 10px 0 4px; } .lk-msg { min-height: 20px; margin: 0 0 14px; }
.dots { display: flex; justify-content: center; gap: 16px; margin: 8px 0 14px; } .dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); transition: background .15s, transform .15s; } .dots i.f { background: var(--gold); border-color: var(--gold); transform: scale(1.15); }
.dots.shake { animation: shake .4s; } @keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.logo-v { width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 8px; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--navy), var(--sky)); box-shadow: 0 10px 30px rgba(2, 132, 199, .45), inset 0 1px 0 rgba(255, 255, 255, .4); }
#splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); transition: opacity .5s; } #splash.gone { opacity: 0; pointer-events: none; }
#splash .logo-v { animation: pop .7s var(--ease); }

/* Toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 150; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; display: flex; gap: 14px; align-items: center; max-width: 520px; padding: 12px 16px; border-radius: 16px; background: rgba(30, 41, 59, .96); border: 1px solid var(--edge-hi); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(14px); transition: all .35s var(--ease); font-size: 14px; }
.toast.in { opacity: 1; transform: none; } .toast button { color: var(--gold); font-weight: 700; } .toast.warn { border-color: rgba(234, 179, 8, .6); } .toast.over { border-color: rgba(239, 68, 68, .6); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { .sheet { border-radius: 28px; margin-bottom: 20px; } .sheet.full { border-radius: 0; margin: 0; } }

.sh-head h2 { white-space: nowrap; font-size: 16px; } .sh-head .pill { padding: 8px 13px; font-size: 14px; }
@media (max-height: 760px) { .key { padding: 8px 0; font-size: 21px; } .key small { display: none; } .amount-box { padding: 10px 16px; } .amount-box .amt { font-size: 32px; } .keypad { gap: 5px; padding-top: 6px; } }
