/* Mes Finances — deux mondes : Business (cobalt) et Perso (jade). Mobile d'abord. */
:root {
  --bg: #EEF1F5; --surface: #FFFFFF; --surface-2: #F4F6F9; --fg: #121722; --muted: #5D6878; --line: #DDE2EA;
  --biz: #2346D0; --biz-soft: #E3E9FB; --biz-ink: #172F8F; --on-biz: #FFFFFF;
  --per: #0B7F62; --per-soft: #DDF2EA; --per-ink: #075640; --on-per: #FFFFFF;
  --pos: #0B7F55; --pos-soft: #DFF3EA; --neg: #C7372F; --neg-soft: #FBE5E3; --warn: #A86400; --warn-soft: #FCEFD9;
  --shadow: 0 1px 2px rgba(18,23,34,.05), 0 6px 20px rgba(18,23,34,.06);
  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1218; --surface: #171B23; --surface-2: #1F2430; --fg: #E7EAF0; --muted: #98A1B0; --line: #2A303C;
  --biz: #8AA2FF; --biz-soft: #1A2246; --biz-ink: #C3CFFF; --on-biz: #0E1430;
  --per: #52D1A6; --per-soft: #102B23; --per-ink: #A6EBD2; --on-per: #06231A;
  --pos: #4FD09A; --pos-soft: #12301F; --neg: #FF8078; --neg-soft: #3B1A18; --warn: #F2B64C; --warn-soft: #3A2C10;
  --shadow: none; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0F1218; --surface: #171B23; --surface-2: #1F2430; --fg: #E7EAF0; --muted: #98A1B0; --line: #2A303C;
  --biz: #8AA2FF; --biz-soft: #1A2246; --biz-ink: #C3CFFF; --on-biz: #0E1430;
  --per: #52D1A6; --per-soft: #102B23; --per-ink: #A6EBD2; --on-per: #06231A;
  --pos: #4FD09A; --pos-soft: #12301F; --neg: #FF8078; --neg-soft: #3B1A18; --warn: #F2B64C; --warn-soft: #3A2C10;
  --shadow: none; color-scheme: dark; }

body[data-world="business"] { --w: var(--biz); --w-soft: var(--biz-soft); --w-ink: var(--biz-ink); --on-w: var(--on-biz); }
body[data-world="perso"] { --w: var(--per); --w-soft: var(--per-soft); --w-ink: var(--per-ink); --on-w: var(--on-per); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-body); -webkit-tap-highlight-color: transparent; transition: background-color .35s, color .35s; min-height: 100vh; }
body.noscroll { overflow: hidden; }
a { color: var(--w); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--w); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.warn-txt { color: var(--warn); font-weight: 600; }

/* ---------- Coquille ---------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
#top { position: sticky; top: 0; z-index: 20; background: var(--w-soft); color: var(--w-ink); padding-top: env(safe-area-inset-top, 0px); transition: background-color .4s, color .4s; }
.hd { display: flex; align-items: center; gap: 6px; height: 58px; padding: 0 10px 0 16px; }
.hd h1 { font: 600 18px/1.2 var(--f-display); letter-spacing: -.01em; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd #hd-back + h1 { margin-left: -2px; }
.hd-actions { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover, .icon-btn:active { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.hd .icon-btn:first-child { margin-left: -8px; }

.sync-btn { position: relative; }
.sync-btn .sync-dot { position: absolute; right: 7px; bottom: 8px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--w-soft); background: var(--pos); transition: background-color .3s; }
.sync-btn.cloud-wait .sync-dot { background: var(--warn); }
.sync-btn.cloud-err .sync-dot { background: var(--neg); }
.sync-btn.cloud-busy .sync-dot { background: var(--w); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.auth-title { font: 600 17px var(--f-display); margin: 0 0 10px; }
.account { display: flex; flex-direction: column; gap: 10px; }
.account .kv { padding: 4px 0; }
.snap-row .row-s { white-space: normal; }

.world-seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 0 16px 14px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.world-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; background: var(--w); transition: transform .45s cubic-bezier(.3,1.4,.5,1), background-color .4s; }
.world-pill.right { transform: translateX(100%); }
.world-seg button { position: relative; z-index: 1; border: 0; background: transparent; font: 600 14px var(--f-body); padding: 9px 0; border-radius: 10px; cursor: pointer; color: var(--muted); transition: color .3s; }
.world-seg button.on { color: var(--on-w); }

main#view { padding: 16px 16px calc(104px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; outline: none; }
body.no-tabs main#view { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
body.no-tabs #tabs { display: none; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); transition: background-color .35s; }
.tabs { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: 66px; align-items: center; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; padding: 8px 0; }
.tab .ic { width: 22px; height: 22px; }
.tab.on { color: var(--w); }
.tab.on::after { content: ""; position: absolute; top: -1px; width: 20px; height: 3px; border-radius: 0 0 3px 3px; background: var(--w); }
.tab-fab { display: grid; place-items: center; }
.fab { width: 56px; height: 56px; border-radius: 18px; background: var(--w); color: var(--on-w); display: grid; place-items: center; margin-top: -26px; box-shadow: 0 8px 20px color-mix(in srgb, var(--w) 38%, transparent); transition: background-color .4s, transform .2s; }
.fab:active { transform: scale(.94); }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- Héros ---------- */
.hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); }
.hero > :not(.glow) { position: relative; }
.glow { position: absolute; right: -60px; top: -70px; width: 190px; height: 190px; border-radius: 50%; background: var(--w-soft); pointer-events: none; transition: background-color .4s; }
.hero-lbl { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero-amount { font: 600 clamp(26px, 8vw, 32px)/1.1 var(--f-display); letter-spacing: -.03em; margin: 6px 0 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hero-amount small { font-size: .42em; letter-spacing: 0; color: var(--muted); margin-left: 6px; font-weight: 600; }
.hero-usd { font: 600 14px var(--f-display); letter-spacing: -.02em; margin-bottom: 4px; }
.hero-sub { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.hero-sub .ic { width: 14px; height: 14px; vertical-align: -2px; }
.hero .track { margin: 10px 0 8px; }
.big-amount { font: 600 28px/1.1 var(--f-display); letter-spacing: -.03em; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }

/* ---------- Barres ---------- */
.track { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.track > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--w); transition: background-color .3s; }
.track.warn > i { background: var(--warn); }
.track.over > i { background: var(--neg); }
.track.full > i { background: var(--w); }
.track.paid > i { background: var(--pos); }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--fg); text-decoration: none; font-size: 13.5px; }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.alert.neg { background: var(--neg-soft); } .alert.neg .dot { background: var(--neg); }
.alert.info { background: var(--w-soft); } .alert.info .dot { background: var(--w); }
.alert-txt { flex: 1; min-width: 0; }
.alert b { font-weight: 600; }
.alert-go { color: var(--muted); width: 18px; height: 18px; }

/* ---------- Listes ---------- */
.sec { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 8px 4px -4px; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sec a { text-transform: none; letter-spacing: 0; font-size: 13px; text-decoration: none; }
.sec .num { text-transform: none; letter-spacing: 0; font-size: 12px; white-space: normal; text-align: right; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.list > .row:last-child, .list > :last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-v { font-weight: 600; text-align: right; }
.row-v small { font-weight: 500; color: var(--muted); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 600; vertical-align: 1px; }
.avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font: 600 13px var(--f-display); background: var(--w-soft); color: var(--w-ink); transition: background-color .4s, color .4s; }
.avatar.biz, .w-biz .avatar { background: var(--biz-soft); color: var(--biz-ink); }
.avatar.per, .w-per .avatar { background: var(--per-soft); color: var(--per-ink); }
.avatar.fund, .w-fund .avatar { background: var(--warn-soft); color: var(--warn); }
.mi { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.mi .ic { width: 18px; height: 18px; }
.mi.in { color: var(--pos); background: var(--pos-soft); }
.mi.out { color: var(--neg); background: var(--neg-soft); }
.mi.tr { color: var(--w); background: var(--w-soft); }
.note-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); font-size: 13.5px; }
.note-line .ic { color: var(--warn); width: 18px; height: 18px; margin-top: 1px; }
.note-line b { font-weight: 600; }
.mini-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: inherit; text-decoration: none; }
.mini-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--w-soft); color: var(--w-ink); flex: none; }
.mini-ic .ic { width: 19px; height: 19px; }

.acts { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; font-size: 13px; color: inherit; text-decoration: none; }
.act-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act .num { font-weight: 600; }
.act .num small { color: var(--muted); font-weight: 500; }
.act .track { grid-column: 1 / 3; height: 6px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 600; font-size: 13.5px; transition: transform .15s; }
.tile:active { transform: scale(.97); }
.tile .ic { color: var(--w); }

.empty { color: var(--muted); text-align: center; padding: 22px 12px; font-size: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 18px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty-card .ic { width: 28px; height: 28px; color: var(--w); }
.empty-card p { margin: 0 0 6px; color: var(--muted); font-size: 14px; max-width: 34ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.biz { background: var(--biz-soft); color: var(--biz-ink); } .badge.per { background: var(--per-soft); color: var(--per-ink); }
.flag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
.flag.warn { background: var(--warn-soft); color: var(--warn); } .flag.over { background: var(--neg-soft); color: var(--neg); } .flag.ok { background: var(--w-soft); color: var(--w-ink); }

.monthnav { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.monthnav b { font: 600 14px var(--f-display); letter-spacing: -.01em; }
.monthnav .icon-btn { color: var(--w); }

/* ---------- Budget ---------- */
.bud { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.bud-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.bud-top b { font-weight: 600; min-width: 0; }
.bud-top .num { color: var(--muted); }
.bud-note { font-size: 12px; color: var(--muted); }
.carry { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--w-soft); color: var(--w-ink); font-size: 13.5px; }
.carry .ic { width: 16px; height: 16px; vertical-align: -3px; }
.guide { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.guide-stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.guide-stack i { display: block; height: 100%; width: 0; transition: width .4s; }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 7px; background: var(--c); }
.legend b { color: var(--fg); } .legend em { font-style: normal; }
.edit-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.to-split { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--w-soft); color: var(--w-ink); }
.to-split b { font: 600 17px var(--f-display); letter-spacing: -.02em; }
.to-split.neg { background: var(--neg-soft); color: var(--neg); }
.to-split.zero { background: var(--pos-soft); color: var(--pos); }
.bud-edit { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: text; }
.bud-edit.first { background: color-mix(in srgb, var(--w-soft) 50%, transparent); }
.input.amount-sm { width: 132px; flex: none; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; padding: 10px 12px; }

/* ---------- Formulaires ---------- */
.addform { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; min-width: 0; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.field-2 > .field, .field-3 > .field { margin-bottom: 12px; }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.req { font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }
.input { width: 100%; font: inherit; font-size: 16px; padding: 12px 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); min-width: 0; }
.input:focus { outline: 2px solid var(--w); outline-offset: -1px; border-color: transparent; }
textarea.input { resize: vertical; min-height: 60px; }
select.input { appearance: auto; }
.amount-wrap { display: flex; align-items: baseline; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; transition: border-color .2s; }
.amount-wrap:focus-within { border-color: var(--w); box-shadow: 0 0 0 3px color-mix(in srgb, var(--w) 18%, transparent); }
.amount-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: 600 32px/1.1 var(--f-display); letter-spacing: -.03em; outline: none; font-variant-numeric: tabular-nums; }
.amount-input::placeholder { color: var(--line); }
.amount-cur { font-weight: 700; color: var(--muted); font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.hint .ic { width: 14px; height: 14px; vertical-align: -2px; color: var(--pos); }
.form-err { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--neg-soft); color: var(--neg); font-size: 13.5px; font-weight: 500; }
.save-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding-top: 6px; z-index: 5; }
body.no-tabs .save-bar { bottom: 12px; }
.lock-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.lock-note .ic { width: 16px; height: 16px; }

.btn { font: 600 15px var(--f-body); border-radius: 14px; padding: 13px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: background-color .3s, transform .12s; }
.btn:active { transform: scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--w); border-color: var(--w); color: var(--on-w); }
.btn.primary.done { background: var(--pos); border-color: var(--pos); color: var(--surface); }
.btn.danger { color: var(--neg); }
.btn.danger-solid { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.btn:disabled { opacity: .55; cursor: default; }
.row-btns { display: flex; gap: 10px; }
.row-btns > .btn { flex: 1; min-width: 0; }

.seg2, .seg3 { display: grid; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg2 { grid-template-columns: 1fr 1fr; } .seg3 { grid-template-columns: repeat(3, 1fr); }
.seg2 button, .seg3 button { border: 0; background: transparent; font: 600 14px var(--f-body); padding: 10px 4px; border-radius: 10px; color: var(--muted); cursor: pointer; transition: background-color .25s, color .25s; }
.seg2 button.on, .seg3 button.on { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.world-choice button.business.on { background: var(--biz); color: var(--on-biz); box-shadow: none; }
.world-choice button.perso.on { background: var(--per); color: var(--on-per); box-shadow: none; }

.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; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 14px; padding: 8px 13px; font: 500 14px var(--f-body); cursor: pointer; text-align: left; transition: background-color .2s, border-color .2s, color .2s; }
.chip small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--w); border-color: var(--w); color: var(--on-w); }
.chip.on small { color: inherit; opacity: .85; }
.chip.biz.on { background: var(--biz); border-color: var(--biz); color: var(--on-biz); }
.chip.per.on { background: var(--per); border-color: var(--per); color: var(--on-per); }

/* ---------- Panneau du bas ---------- */
#overlay { position: fixed; inset: 0; z-index: 50; display: none; }
#overlay.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8,10,16,.5); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 90vh; overflow-y: auto; overscroll-behavior: contain; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font: 600 18px/1.25 var(--f-display); letter-spacing: -.01em; margin: 0 0 10px; }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head h3 { margin: 0; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kvs { display: flex; flex-direction: column; margin-bottom: 12px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--muted); }
.kv > b { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv.total { border-top: 1px solid var(--line); border-bottom: 0; margin-top: 4px; }
.card.kvs { padding: 6px 16px; }
.hist { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.hist summary { cursor: pointer; display: flex; gap: 6px; align-items: center; }
.hist .ic { width: 16px; height: 16px; }
.hist ul { margin: 8px 0 0; padding-left: 20px; }
.confirm-msg { margin: 0 0 16px; font-size: 15px; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 12px; background: var(--per-soft); color: var(--per-ink); }
.success-mark .ic { width: 32px; height: 32px; stroke-width: 2.6; }
.add-line { display: flex; gap: 8px; margin-top: 12px; }
.add-line .input:first-child { flex: 1; }
.add-line select { width: 120px; flex: none; }
.add-line .btn { flex: none; }

/* ---------- Notifications ---------- */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 440px; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); text-align: center; }
.toast.warn { background: var(--warn); color: #1C1300; }
.toast.err { background: var(--neg); color: #fff; }

/* ---------- Verrou et premier lancement ---------- */
#lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; }
#lock h2 { font: 600 20px var(--f-display); margin: 6px 0 0; }
#lock p { margin: 0; }
.lock-mark { display: flex; gap: 6px; }
.lock-mark span { width: 22px; height: 34px; border-radius: 8px; background: var(--biz); }
.lock-mark span + span { background: var(--per); margin-top: 10px; }
.lock-mark.big span { width: 30px; height: 46px; border-radius: 10px; }
.pin-dots { display: flex; gap: 16px; margin: 10px 0 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.f { background: var(--fg); border-color: var(--fg); }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 14px; }
.keypad button { height: 74px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 600 26px var(--f-body); cursor: pointer; }
.lock-err { color: var(--neg); font-weight: 600; }
.pin-input { letter-spacing: .4em; font-weight: 700; }

#splash { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: grid; place-items: center; }

.welcome-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 8px 2px; }
.welcome-hero h2 { font: 600 clamp(24px, 7vw, 30px)/1.12 var(--f-display); letter-spacing: -.02em; margin: 8px 0 0; text-wrap: balance; }
.welcome-hero p { margin: 0; color: var(--muted); font-size: 15.5px; max-width: 44ch; }
.biz-txt { color: var(--biz); } .per-txt { color: var(--per); }
.steps { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; font-size: 14px; }
.steps > div { display: flex; gap: 12px; align-items: flex-start; }
.step-n { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--w-soft); color: var(--w-ink); font: 600 12px var(--f-display); }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row .row-t .ic { width: 16px; height: 16px; vertical-align: -3px; }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform .25s cubic-bezier(.3,1.4,.5,1); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch:checked { background: var(--w); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- Activités, abonnements ---------- */
.act-cards { display: flex; flex-direction: column; gap: 10px; }
.act-card { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer; }
.act-card-n { font-weight: 600; }
.act-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
.act-card-grid > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-card-grid em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.act-card-grid .num { white-space: normal; font-weight: 600; }

.recs { display: flex; flex-direction: column; gap: 10px; }
.rec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rec.due { border-color: color-mix(in srgb, var(--w) 45%, var(--line)); }
.rec-main { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rec-v { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rec-st { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.rec-st.due { color: var(--w); } .rec-st.done { color: var(--pos); }
.rec.done, .rec.skipped { opacity: .75; }
.rec-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 0 14px 12px; }

/* ---------- Salaire ---------- */
.bridge { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: var(--shadow); }
.node { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; }
.node.b { background: var(--biz-soft); color: var(--biz-ink); } .node.p { background: var(--per-soft); color: var(--per-ink); }
.node .avatar { background: var(--surface); color: inherit; }
.node-n { flex: 1; min-width: 0; font-weight: 600; display: flex; flex-direction: column; }
.node-n small { font-weight: 500; font-size: 11.5px; opacity: .8; }
.node b { font: 600 15px var(--f-display); letter-spacing: -.02em; }
.path-wrap { position: relative; height: 110px; }
.path-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.path-amt { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: 600 14px var(--f-display); letter-spacing: -.02em; }
.check-ok { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--pos-soft); color: var(--pos); font-weight: 600; font-size: 14px; }

/* ---------- Dettes ---------- */
.debts .debt { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.debt-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.debt-top b { font-weight: 600; margin-right: auto; }
.debt-top .flag { margin-left: 0; }
.debt-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.debt-meta b { color: var(--fg); }

/* ---------- Comptage ---------- */
.count-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.count-box { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); min-width: 0; font-size: 13px; color: var(--muted); }
.count-box b { font: 600 16px var(--f-display); letter-spacing: -.02em; color: var(--fg); white-space: normal; }
.count-box small { font-size: 11.5px; }
.count-box .input.amount-sm { width: 100%; text-align: left; }
.gap { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); }
.gap b { font: 600 20px var(--f-display); letter-spacing: -.02em; }
.gap.ok { background: var(--pos-soft); color: var(--pos); }
.gap.neg { background: var(--neg-soft); color: var(--neg); }
.gap.pos { background: var(--warn-soft); color: var(--warn); }

/* ---------- Menu, historique, réglages ---------- */
.menu-grid { display: flex; flex-direction: column; gap: 8px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.menu-item > .ic { width: 18px; height: 18px; }
details.archived summary { cursor: pointer; display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 4px; }
details.archived summary .ic { width: 18px; height: 18px; }
details.archived > .list, details.archived > .recs { margin-top: 6px; }
.audit { cursor: default; align-items: flex-start; }
.audit .row-s { white-space: normal; }
.audit-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--pos); }
.audit.update .audit-dot { background: var(--warn); } .audit.delete .audit-dot { background: var(--neg); }

/* ---------- Rapport ---------- */
.report-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.report-kpis > div { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.report-kpis span { font-size: 11.5px; color: var(--muted); }
.report-kpis b { font: 600 13px var(--f-display); letter-spacing: -.02em; }
.report-kpis .num { white-space: normal; }
.report-card h2 { font: 600 14px var(--f-display); letter-spacing: -.01em; margin: 0 0 8px; }
.sub-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r { text-align: right; padding-left: 12px; font-weight: 600; }
.print-head { display: none; }

@media (max-width: 360px) {
  .field-2, .count-grid { grid-template-columns: 1fr; }
  .keypad { grid-template-columns: repeat(3, 66px); } .keypad button { height: 66px; }
  .report-kpis { grid-template-columns: 1fr; }
}

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

/* ---------- Impression (rapport PDF) ---------- */
@media print {
  html:root:not(.x) { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --fg: #000; --muted: #555; --line: #ccc; --pos: #0a6b47; --neg: #b3261e; --w: #2346D0; color-scheme: light; }
  #top, #tabs, #toast, #overlay, #lock, .no-print { display: none !important; }
  body { background: #fff; }
  main#view { padding: 0; gap: 10px; }
  .print-head { display: block; }
  .print-head h1 { font: 600 20px var(--f-display); margin: 0; }
  .print-head p { margin: 2px 0 8px; color: #555; font-size: 12px; }
  .card, .report-kpis > div { break-inside: avoid; box-shadow: none; }
  .rise { opacity: 1 !important; transform: none !important; }
}
