/* FinanceApp — feuille de style principale */
:root {
  --bg: #f2f4f0;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --ink: #0e1712;
  --ink-2: #3a4540;
  --muted: #6c7772;
  --line: #e6eae3;
  --green: #16c784;
  --green-strong: #0ea567;
  --green-ink: #087a4b;
  --green-soft: #e5f8ee;
  --lime: #c8f135;
  --violet: #7c5cff;
  --blue: #2f80ed;
  --orange: #f2994a;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #f5a524;
  --amber-soft: #fff4e0;
  --blue-soft: #e8f1fe;
  --shadow: 0 1px 2px rgba(14, 23, 18, .04), 0 8px 24px rgba(14, 23, 18, .06);
  --shadow-lg: 0 24px 60px rgba(14, 23, 18, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 264px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b100d; --surface: #131a16; --surface-2: #19211c; --ink: #eef3ef; --ink-2: #c5cec8; --muted: #8b9790;
    --line: #232d27; --green-soft: #12301f; --red-soft: #3a1717; --amber-soft: #3a2a10; --blue-soft: #132338;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b100d; --surface: #131a16; --surface-2: #19211c; --ink: #eef3ef; --ink-2: #c5cec8; --muted: #8b9790;
  --line: #232d27; --green-soft: #12301f; --red-soft: #3a1717; --amber-soft: #3a2a10; --blue-soft: #132338;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: currentColor; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--green-ink); }
:root[data-theme="dark"] .pos { color: var(--green); }
.neg { color: var(--red); }
.hidden { display: none !important; }

/* ------------------------------------------------------------ boot / auth */
.boot { min-height: 100vh; display: grid; place-items: center; }
.logo-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--green); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 18px rgba(22,199,132,.35); }
.logo-mark.big { width: 56px; height: 56px; border-radius: 16px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; background: #07120c; color: #eafff3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero::before { content: ''; position: absolute; inset: -30% -20% auto auto; width: 120%; height: 90%; background: radial-gradient(closest-side, rgba(22,199,132,.75), transparent 70%), radial-gradient(closest-side at 70% 60%, rgba(200,241,53,.55), transparent 70%); filter: blur(30px); }
.auth-hero > * { position: relative; }
.auth-hero h1 { font-size: 42px; line-height: 1.08; margin: 0 0 16px; letter-spacing: -.02em; }
.auth-hero p { color: #b7d3c3; max-width: 460px; font-size: 16px; }
.auth-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; }
.auth-feats div { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 13px; }
.auth-feats svg { color: var(--lime); }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin: 0 0 6px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); }
.auth-switch a { color: var(--green-ink); font-weight: 700; cursor: pointer; }

/* ------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.nav-title { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--green-soft); color: var(--green-ink); }
:root[data-theme="dark"] .nav a.active { color: var(--green); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--lime)); color: #06331d; display: grid; place-items: center; font-weight: 800; flex: none; }
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.topbar .crumb { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; min-width: 0; }
.topbar .crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn.burger { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .15s, background .15s; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(22,199,132,.3); }
.btn.primary:hover { background: var(--green-strong); }
.btn.dark { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.sm { padding: 6px 10px; border-radius: 10px; font-size: 13px; }
.btn.icon { padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 2; }
.field.half { grid-column: span 1; }
.field label { font-weight: 650; font-size: 13px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,199,132,.18); }
textarea.input { min-height: 74px; resize: vertical; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.dd { position: relative; }
.dd-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; min-height: 42px; }
button.dd-trigger { background: var(--surface); }
.dd-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-chev, .dd-caret { color: var(--muted); display: grid; place-items: center; transition: transform .15s ease; }
.dd.open .dd-chev, .dd.open .dd-caret { transform: rotate(180deg); color: var(--green-ink); }
.dd.open .dd-trigger { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,199,132,.18); }
.dd.creatable .input { padding-right: 42px; }
.dd-caret { position: absolute; right: 6px; top: 50%; margin-top: -15px; width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
.dd.open .dd-caret { transform: rotate(180deg); }
.dd-caret:hover { background: var(--surface-2); }
.dd-pop { position: fixed; z-index: 90; display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; overflow-y: auto; overscroll-behavior: contain; animation: fade .12s ease; }
.dd-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 9px; cursor: pointer; font-weight: 550; color: var(--ink); }
.dd-opt span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-opt.active { background: var(--surface-2); }
.dd-opt.sel { color: var(--green-ink); font-weight: 700; }
:root[data-theme="dark"] .dd-opt.sel { color: var(--green); }
.dd-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 11px 4px; }
.dd-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.dd-search { position: sticky; top: -6px; z-index: 1; background: var(--surface); margin: -6px -6px 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dd-search input { flex: 1; border: 0; outline: none; background: transparent; padding: 4px 0; color: var(--ink); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%236c7772'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.err { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 9px; font-weight: 650; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
input[type=range] { accent-color: var(--green); width: 100%; }

/* ------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.tiles { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.mt { margin-top: 16px; }

/* Bandeau lumineux (inspiré de la maquette) */
.glow { position: relative; border-radius: 26px; padding: 14px; isolation: isolate; }
.glow::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: radial-gradient(60% 120% at 10% 50%, rgba(22,199,132,.55), transparent 70%), radial-gradient(60% 140% at 75% 40%, rgba(200,241,53,.7), transparent 70%), radial-gradient(40% 100% at 100% 80%, rgba(22,199,132,.45), transparent 70%); filter: blur(18px); opacity: .9; }
.kpi { position: relative; background: var(--surface); border-radius: 16px; padding: 16px 16px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .t { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink-2); font-size: 13.5px; }
.kpi .v { font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { color: var(--muted); font-size: 12.5px; }
.kpi .f { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.kpi .f b { color: var(--green-ink); }
:root[data-theme="dark"] .kpi .f b { color: var(--green); }
.kpi .f b.neg { color: var(--red); }

.insight { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.insight .orb { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, var(--lime), var(--green)); color: #063a20; box-shadow: 0 6px 18px rgba(22,199,132,.35); }
.insight .ttl { color: var(--green-ink); font-weight: 750; font-size: 15px; }
:root[data-theme="dark"] .insight .ttl { color: var(--green); }
.insight .msg { color: var(--ink-2); }
.insight .grow { flex: 1; min-width: 0; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .6s ease; }
.goal-row { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; padding: 10px 0; }
.goal-row + .goal-row { border-top: 1px dashed var(--line); }
.goal-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.goal-row .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.goal-row .bot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green-ink); border-color: transparent; }
:root[data-theme="dark"] .badge.green { color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.amber { background: var(--amber-soft); color: #9a5b00; border-color: transparent; }
:root[data-theme="dark"] .badge.amber { color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bell-wrap { position: relative; }
.bell-wrap #bell { position: relative; }
.bell-count { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 45; animation: rise .15s ease; }
.bell-panel .list-item .grow b { font-size: 13.5px; }
.rm-item .row-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.date-chip.tone-red { background: var(--red-soft); border-color: transparent; color: var(--red); }
.date-chip.tone-amber { background: var(--amber-soft); border-color: transparent; color: #9a5b00; }
.date-chip.tone-blue { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.warn { color: #b46b00; }
.chip.toggle, .chip.on { display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.chip.on { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
.count { background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 7px; }

/* ------------------------------------------------------------ tables & lists */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--surface-2); }
table.t td.r, table.t th.r { text-align: right; }
tr.theme-row td { background: var(--surface-2); padding: 8px 18px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
tr.theme-row td > span { display: inline-flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
tr.theme-row td > b { float: right; font-weight: 700; color: var(--muted); }
table.t tr.theme-row:hover td { background: var(--surface-2); }
.mini { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.cell-name { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 190px; }
.cell-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.ico-sq { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.ico-sq.green { background: var(--green-soft); color: var(--green-ink); }
.ico-sq.red { background: var(--red-soft); color: var(--red); }
.ico-sq.amber { background: var(--amber-soft); color: #b46b00; }
.ico-sq.blue { background: var(--blue-soft); color: var(--blue); }
.ico-sq.violet { background: #efeaff; color: var(--violet); }
:root[data-theme="dark"] .ico-sq.violet { background: #241d44; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow span { font-size: 12px; color: var(--muted); }
.date-chip { width: 44px; text-align: center; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px 0; flex: none; }
.date-chip b { display: block; font-size: 16px; line-height: 1.1; }
.date-chip span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ico-sq { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 16px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* Cartes d'éléments (comptes, dettes, objectifs) */
.bank-card { position: relative; overflow: hidden; border-radius: 20px; padding: 18px 18px 16px; color: #fff; min-height: 188px; display: flex; flex-direction: column; gap: 10px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.18), transparent 55%), linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 12px 28px -12px var(--c1), 0 2px 6px rgba(0,0,0,.08); transition: transform .15s ease, box-shadow .15s ease; }
.bank-card:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -14px var(--c1), 0 2px 6px rgba(0,0,0,.1); }
.bank-card::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(255,255,255,.08); pointer-events: none; }
.bank-card.dark-text { color: #111a14; }
.bank-card.dark-text::after { border-color: rgba(0,0,0,.06); }
.bank-card.inactive { filter: grayscale(.7); opacity: .65; }
.bc-top { display: flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.bc-top .grow { flex: 1; min-width: 0; }
.bc-top b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-top .grow span { font-size: 12px; opacity: .85; }
.bc-mono { min-width: 44px; height: 44px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; letter-spacing: .02em; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(4px); }
.dark-text .bc-mono { background: rgba(255,255,255,.45); border-color: rgba(0,0,0,.08); }
.bank-card .row-actions .icon-btn { color: inherit; opacity: .85; }
.bank-card .row-actions .icon-btn:hover { background: rgba(255,255,255,.2); color: inherit; opacity: 1; }
.bc-grip { border: 0; background: transparent; color: inherit; opacity: .75; padding: 6px 4px; margin-right: -6px; border-radius: 8px; cursor: grab; touch-action: none; display: grid; place-items: center; }
.bc-grip:hover, .bc-grip:focus-visible { opacity: 1; background: rgba(255,255,255,.2); outline: none; }
.bank-card.dragging { cursor: grabbing; transform: rotate(-1.5deg) scale(1.03); box-shadow: 0 28px 50px -18px rgba(0,0,0,.45); transition: none; }
.bc-placeholder { border: 2px dashed var(--line); border-radius: 20px; background: var(--surface-2); min-height: 120px; }
.reorder-hint { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin: -4px 0 12px; }
.scen { gap: 8px; }
.scen.reco { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,199,132,.15), var(--shadow); }
.scen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.scen-grid > div { background: var(--surface-2); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; font-size: 12px; }
.scen-grid b { font-size: 14px; }
.sav-big { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sav-big b { font-size: 30px; letter-spacing: -.02em; color: var(--green-ink); }
:root[data-theme="dark"] .sav-big b { color: var(--green); }
.tile.lump { border-left: 4px solid var(--amber); }
.lump-tip { display: flex; align-items: center; gap: 7px; font-size: 12.5px; background: var(--amber-soft); color: #7a4a00; padding: 8px 10px; border-radius: 10px; }
:root[data-theme="dark"] .lump-tip { color: var(--amber); }
.rcv-row { display: grid; grid-template-columns: 40px minmax(200px, 1.6fr) minmax(130px, 1fr) 110px minmax(140px, 1fr) 280px; align-items: center; gap: 18px; padding: 14px 0; }
.rcv-row + .rcv-row { border-top: 1px solid var(--line); }
.rcv-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rcv-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcv-who > span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcv-partial { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-width: 320px; }
.rcv-partial span { font-size: 12px; color: var(--muted); }
.rcv-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 13px; }
.rcv-cell > span:first-child { font-size: 11.5px; color: var(--muted); }
.rcv-cell > span.neg, .rcv-cell > span.warn { font-size: 12px; font-weight: 600; }
.rcv-amount { align-items: flex-end; text-align: right; }
.rcv-amount b { font-size: 17px; }
.rcv-row .row-actions { gap: 6px; justify-content: flex-end; }
@media (max-width: 1150px) {
  .rcv-row { grid-template-columns: 40px 1fr 1fr; }
  .rcv-row .rcv-who { grid-column: 2 / -1; }
  .rcv-amount { align-items: flex-start; text-align: left; }
  .rcv-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.rcv-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.rcv-item + .rcv-item { border-top: 1px solid var(--line); }
.rcv-item .grow { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.rcv-item .grow > span { font-size: 12.5px; color: var(--muted); }
.rcv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 150px; font-size: 12.5px; }
.rcv-meta b { font-size: 17px; }
.rcv-item .row-actions { gap: 6px; flex-wrap: wrap; }
.acc-sum.neutral > div:first-child b { color: var(--ink); }
.debt-row { display: grid; grid-template-columns: 40px minmax(170px, 1.5fr) minmax(130px, 1fr) minmax(130px, .9fr) minmax(140px, 1fr) auto; align-items: center; gap: 18px; padding: 14px 0; }
.debt-row + .debt-row { border-top: 1px solid var(--line); }
.dr-name { min-width: 0; display: flex; flex-direction: column; }
.dr-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-name span, .dr-cell span, .dr-progress span { font-size: 12px; color: var(--muted); }
.dr-progress { display: flex; flex-direction: column; gap: 5px; }
.dr-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dr-cell .big-num { font-size: 17px; }
.debt-row .row-actions { gap: 6px; }
.plan-sentence { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 12px 0; line-height: 1.55; }
table.t.compact th, table.t.compact td { padding: 9px 12px; }
table.t.compact tr.best td { background: var(--green-soft); }
.order-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.order-item + .order-item { border-top: 1px dashed var(--line); }
.order-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.order-item .grow span { font-size: 12px; color: var(--muted); }
.order-n { width: 26px; height: 26px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
@media (max-width: 1100px) {
  .debt-row { grid-template-columns: 40px 1fr 1fr; }
  .debt-row .dr-progress { grid-column: 2 / -1; }
  .debt-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.wallet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.wallet { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 16px 16px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 1px 2px rgba(14,23,18,.04); transition: box-shadow .15s ease, transform .15s ease; }
.wallet:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.wallet.inactive { opacity: .55; }
.wallet.dragging { box-shadow: 0 24px 44px -16px rgba(0,0,0,.35); }
.wallet-logo { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(14,23,18,.08), 0 4px 10px -4px rgba(14,23,18,.25); background: #fff; }
.wallet-logo.mono { display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.wallet-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wallet-info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-info span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-bal { text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.wallet-bal b { font-size: 19px; letter-spacing: -.02em; }
.wallet-bal span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.wallet-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 0; opacity: 0; transition: opacity .15s ease; background: var(--surface); border-radius: 10px; }
.wallet:hover .wallet-actions, .wallet:focus-within .wallet-actions { opacity: 1; }
.wallet-actions .bc-grip { color: var(--muted); margin: 0; }
.wallet-actions .bc-grip:hover { background: var(--surface-2); }
@media (hover: none) { .wallet-actions { position: static; opacity: 1; background: none; } }
.acc-section { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.acc-section h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.acc-section > span { font-size: 13px; }
.acc-section .btn { margin-left: auto; }
.card.soft { box-shadow: none; background: var(--surface-2); }
.bc-placeholder.small { min-height: 64px; border-radius: 16px; }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mm-row { display: flex; align-items: center; gap: 12px; }
.mm-tile { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--c1); border-radius: 16px; padding: 12px 12px 12px 14px; box-shadow: var(--shadow); }
.mm-tile.inactive { opacity: .55; }
.mm-tile.dragging { box-shadow: 0 24px 44px -16px rgba(0,0,0,.35); transform: scale(1.02); }
.mm-tile .grow { flex: 1; min-width: 0; }
.mm-tile .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-tile .grow span { font-size: 12px; color: var(--muted); }
.mm-logo { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 11.5px; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); flex: none; letter-spacing: .02em; }
.mm-logo.dark-text { color: #111a14; }
.mm-bal { font-weight: 800; font-size: 22px; letter-spacing: -.02em; white-space: nowrap; padding-left: 56px; }
.mm-tile .bc-grip { color: var(--muted); margin: 0; }
.mm-tile .bc-grip:hover { background: var(--surface-2); }
.cash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cash-tile { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow);
  background: repeating-linear-gradient(135deg, rgba(47,125,79,.05) 0 12px, transparent 12px 24px), var(--surface); flex-wrap: wrap; }
.cash-tile.inactive { opacity: .55; }
.cash-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #3d9b62, #1f5f3a); box-shadow: 0 8px 18px -8px #2f7d4f; flex: none; }
.cash-tile .grow { flex: 1; min-width: 140px; display: flex; flex-direction: column; }
.cash-tile .grow span { font-size: 12.5px; }
.cash-tile .grow b { font-size: 22px; letter-spacing: -.02em; }
.cash-actions { display: flex; align-items: center; gap: 6px; }
.bc-mid { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.bc-chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f6e27a, #c9a227 55%, #f3d36b); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); opacity: .95; }
.bc-debt { background: #fff; color: var(--red); font-weight: 800; font-size: 11.5px; padding: 4px 10px; border-radius: 99px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.bc-bal { font-size: 23px; font-weight: 800; letter-spacing: -.02em; position: relative; z-index: 1; margin-top: auto; }
.bc-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; opacity: .9; position: relative; z-index: 1; }
.bc-foot span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input[type=color].input { padding: 4px 6px; height: 42px; cursor: pointer; }
.acc-sum { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-right: 8px; }
.acc-sum > div { display: flex; flex-direction: column; line-height: 1.2; }
.acc-sum span { font-size: 12px; font-weight: 600; }
.acc-sum b { font-size: 16px; }
.acc-sum > div:first-child b { font-size: 20px; color: var(--green-ink); }
:root[data-theme="dark"] .acc-sum > div:first-child b { color: var(--green); }
.badge.type-blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.type-green { background: var(--green-soft); color: var(--green-ink); border-color: transparent; }
.badge.type-amber { background: var(--amber-soft); color: #9a5b00; border-color: transparent; }
.badge.type-violet { background: #efeaff; color: var(--violet); border-color: transparent; }
:root[data-theme="dark"] .badge.type-violet { background: #241d44; }
.acc-group-head { display: flex; align-items: center; gap: 12px; margin: 6px 2px 12px; }
.acc-group-head .ico-sq { width: 40px; height: 40px; border-radius: 12px; }
.acc-group-head h3 { margin: 0; font-size: 17px; }
.acc-group-head .grow { flex: 1; min-width: 0; }
.acc-group-head .grow span { font-size: 12.5px; }
.acc-total { text-align: right; display: flex; flex-direction: column; }
.acc-total b { font-size: 18px; }
.acc-total span { font-size: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile .head { display: flex; align-items: center; gap: 10px; }
.tile .head .grow { flex: 1; min-width: 0; }
.tile .head b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .head span { font-size: 12px; color: var(--muted); }
.tile .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.tile .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.tile .meta b { color: var(--ink); }

/* Insights du coach */
.tip { display: flex; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.tip + .tip { margin-top: 10px; }
.tip .ico-sq { width: 36px; height: 36px; }
.tip b { display: block; margin-bottom: 2px; }
.tip p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.tip a.more { display: inline-flex; margin-top: 8px; font-weight: 700; color: var(--green-ink); font-size: 13px; gap: 4px; align-items: center; }
:root[data-theme="dark"] .tip a.more { color: var(--green); }
.tip.danger { border-color: rgba(229,72,77,.35); background: linear-gradient(0deg, var(--red-soft), var(--surface) 70%); }
.tip.warning { border-color: rgba(245,165,36,.35); }

/* Jauge de score */
.gauge { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.gauge .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .lbl b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; display: block; line-height: 1; }
.gauge .lbl span { color: var(--muted); font-weight: 600; }

/* Graphiques */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tt { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s; z-index: 2; }
.chart .tt b { display: block; margin-bottom: 2px; }
.chart .tt .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 13px; min-width: 0; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .v { font-weight: 700; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; }
.hbar .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* Chat */
.chat { display: flex; flex-direction: column; height: 560px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; font-size: 13.8px; }
.bubble.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.bot h4 { margin: 6px 0 2px; font-size: 14px; }
.bubble.bot ul { margin: 4px 0; padding-left: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 11px; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.chip:hover { border-color: var(--green); color: var(--green-ink); }
.chat-input { display: flex; gap: 8px; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin: 0 2px; animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

/* Modale & notifications */
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 10, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease; }
.modal { width: 100%; max-width: 760px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: rise .2s ease; }
.modal:focus { outline: none; }
.modal.wide { max-width: 920px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px 8px; position: sticky; top: 0; background: var(--surface); z-index: 2; border-radius: 22px 22px 0 0; }
.modal-h h3 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.modal-b { padding: 14px 28px 26px; }
.modal .form { gap: 16px 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line); }
.modal-f .btn { padding: 11px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-lg); animation: rise .2s ease; display: flex; gap: 8px; align-items: center; }
.toast.error { background: var(--red); color: #fff; }

.split { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); gap: 10px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-variant-numeric: tabular-nums; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.advice h4 { margin: 14px 0 6px; font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.advice p, .advice li { color: var(--ink-2); font-size: 13.5px; }
.advice ul { padding-left: 18px; margin: 6px 0; }
.rule { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rule .badge { white-space: normal; }
.rule > div { border-radius: 14px; padding: 12px; border: 1px solid var(--line); }
.rule b { font-size: 20px; display: block; }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .icon-btn.burger { display: inline-grid; }
  .main { padding: 14px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; }
  .auth-hero h1 { font-size: 30px; }
  .auth-feats { display: none; }
}
@media (max-width: 560px) {
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; }
  .modal-h { padding: 18px 18px 6px; }
  .modal-b { padding: 10px 18px 22px; }
  .g4 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .field.half { grid-column: span 2; }
  .page-head h1 { font-size: 23px; }
  .kpi .v { font-size: 23px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .rule { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 90px 1fr auto; }
}

/* ============================================================ Mobile & application installée */
.tabbar, .fab, .offline { display: none; }
.offline:not(.hidden) { display: flex; position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); z-index: 70; align-items: center; gap: 6px; background: var(--ink); color: var(--surface); font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 99px; box-shadow: var(--shadow-lg); }
.table-wrap { -webkit-overflow-scrolling: touch; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { white-space: nowrap; flex: none; }

@media (max-width: 900px) {
  body { -webkit-tap-highlight-color: transparent; }
  .main { padding: 0 14px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 25; margin: 0 -14px 14px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
  .icon-btn.burger { display: none; }
  #quick-add { display: none; }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  /* Barre d'onglets */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 700; border-radius: 12px; cursor: pointer; }
  .tabbar a.active, .tabbar button.active { color: var(--green-ink); }
  :root[data-theme="dark"] .tabbar a.active, :root[data-theme="dark"] .tabbar button.active { color: var(--green); }
  .tabbar a.active svg, .tabbar button.active svg { transform: translateY(-1px); }
  .tab-count { position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-style: normal; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
  /* Bouton flottant « nouvelle transaction » */
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 34; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--green); color: #fff; box-shadow: 0 12px 28px -8px rgba(22,199,132,.6); cursor: pointer; }
  .fab:active { transform: scale(.96); }
  .shell.nav-open .fab, .shell.nav-open .tabbar { visibility: hidden; }
  /* Mise en page */
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 13px; }
  .page-head .actions { width: 100%; }
  .acc-sum { gap: 14px 18px; width: 100%; margin: 0 0 4px; }
  .acc-sum b { font-size: 15px; }
  .acc-sum > div:first-child b { font-size: 18px; }
  .card { padding: 16px; border-radius: 16px; }
  .table-wrap { margin: 0 -16px -16px; }
  .glow { padding: 8px; margin: 0 -4px; }
  .insight { flex-wrap: wrap; }
  .chat { height: 70vh; }
  .input, select.input, textarea.input { font-size: 16px; }
  .bell-panel { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; }
  .bank-card { min-height: 170px; }
}

@media (max-width: 640px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; border-radius: 14px; }
  .kpi .t { font-size: 12px; }
  .kpi .v { font-size: 19px; margin: 6px 0 0; }
  .kpi .s { font-size: 11.5px; }
  .kpi .f { font-size: 11.5px; margin-top: 8px; padding-top: 8px; }
  .page-head .actions .btn { flex: 1; justify-content: center; }
  .acc-section .btn { margin-left: 0; }
  .acc-section { margin-top: 20px; }
  /* Tableaux → lignes en cartes */
  table.t thead { display: none; }
  table.t, table.t tbody, table.t tfoot { display: block; }
  table.t tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.t td { display: block; border: 0; padding: 0; }
  table.t td:first-child { flex: 1 1 100%; }
  table.t td.r { margin-left: auto; }
  table.t tr:hover td { background: none; }
  table.t tr.theme-row { padding: 8px 16px; background: var(--surface-2); }
  table.t tr.theme-row td { flex: 1 1 100%; background: none; padding: 0; }
  table.t tfoot tr { background: var(--surface-2); }
  table.t td .row-actions { justify-content: flex-start; }
  table.t td[colspan] { flex: 1 1 auto; }
  table.t.compact tr { padding: 10px 12px; }
  .cell-name { min-width: 0; }
  /* Dettes et sommes à recevoir */
  .debt-row, .rcv-row { grid-template-columns: 40px 1fr 1fr; gap: 10px 14px; }
  .debt-row .dr-name, .rcv-row .rcv-who { grid-column: 2 / -1; }
  .debt-row .dr-progress { grid-column: 1 / -1; }
  .debt-row .row-actions, .rcv-row .row-actions { grid-column: 1 / -1; }
  .rcv-amount { align-items: flex-start; text-align: left; }
  /* Comptes */
  .tiles, .wallet-grid, .cash-grid, .mm-grid { grid-template-columns: 1fr; }
  .bc-bal { font-size: 22px; }
  .wallet-actions { position: static; opacity: 1; background: none; }
  .cash-tile .cash-actions { width: 100%; }
  /* Échéancier / rappels */
  .list-item { flex-wrap: wrap; }
  .rm-item .row-actions { width: 100%; justify-content: flex-start; }
  .date-chip { width: 40px; }
  .donut-wrap svg { width: 140px; height: 140px; }
  .scen-grid b { font-size: 13px; }
  .sav-big b { font-size: 26px; }
  .stat-line { font-size: 13px; }
  .tip { padding: 12px; }
  .hbar { grid-template-columns: 96px 1fr auto; }
  .auth-form { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
}

@media (display-mode: standalone) {
  .auth-hero { padding-top: calc(28px + env(safe-area-inset-top)); }
}
@media (max-width: 640px) {
  .wallet { flex-wrap: wrap; }
  .wallet-actions { width: 100%; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
  .card-head { flex-wrap: wrap; }
  .card-head .pill-row { width: 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .card-head .pill-row::-webkit-scrollbar { display: none; }
  .card-head .pill-row > * { flex: none; }
  .card-head .sub { white-space: normal; }
}
/* Dépense ponctuelle rapide */
.quick-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qk { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; text-align: center; transition: border-color .12s, background .12s; }
.qk:hover { border-color: var(--green); }
.qk.on { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); box-shadow: 0 0 0 3px rgba(22,199,132,.12); }
:root[data-theme="dark"] .qk.on { color: var(--green); }
@media (max-width: 900px) { #quick-exp { display: none; } }
/* Au quotidien */
.daily-hero { display: flex; flex-direction: column; gap: 16px; }
.dh-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dh-top > div { display: flex; flex-direction: column; gap: 2px; }
.dh-top span { font-size: 12.5px; font-weight: 600; }
.dh-top b { font-size: 24px; letter-spacing: -.02em; }
.dh-top > div:first-child b { color: var(--green-ink); }
:root[data-theme="dark"] .dh-top > div:first-child b { color: var(--green); }
.dh-top small { font-size: 11.5px; font-weight: 700; }
.dh-budget { background: var(--surface-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.dh-budget.empty-budget { align-items: flex-start; }
.dh-budget.empty-budget p { margin: 0; color: var(--ink-2); }
.dh-msg { margin: 0; color: var(--ink-2); }
.progress.big { height: 12px; }
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-chips .chip { display: inline-flex; align-items: center; gap: 6px; }
.day-group + .day-group { margin-top: 6px; }
.day-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; margin: 0 -6px; background: var(--surface-2); border-radius: 10px; font-weight: 700; font-size: 13px; text-transform: capitalize; }
.day-head b { color: var(--red); }
.today-strip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; box-shadow: var(--shadow); }
.today-strip span { display: inline-flex; align-items: center; gap: 6px; }
.today-strip > svg { margin-left: auto; color: var(--muted); }
.today-strip:hover { border-color: var(--green); }
@media (max-width: 640px) {
  .dh-top { grid-template-columns: 1fr 1fr; }
  .dh-top > div:first-child { grid-column: 1 / -1; }
  .dh-top b { font-size: 18px; white-space: nowrap; }
  .dh-top > div:first-child b { font-size: 30px; }
  .quick-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .quick-chips::-webkit-scrollbar { display: none; }
  .quick-chips .chip { flex: none; }
  .today-strip { gap: 8px 14px; font-size: 13px; }
}
