/* Budget : charte pastel (préfixe b- pour toutes les classes). Mobile d'abord, mode sombre automatique. */
:root {
  --bg: #f4f5fb; --card: #ffffff; --text: #262b40; --muted: #7b8199; --line: #e8eaf3;
  --primary: #5b67d0; --primary-ink: #ffffff; --primary-soft: #eceefc;
  --pos: #2f9e6e; --neg: #d6516d; --warn: #a66a12; --warn-bg: #fff3dc;
  --err-bg: #fde8ec; --ok-bg: #e2f5ec; --info-bg: #e9effd; --chip: #f0f1f8;
  --mint: #e1f5ec; --mint-ink: #237a53; --pink: #fde8ef; --pink-ink: #b23d5d;
  --lav: #efebfd; --lav-ink: #5b45c4; --sky: #e4f1fd; --sky-ink: #2c6ea6; --peach: #fff0e2;
  --head-a: #eef0fd; --head-b: #f8edf8;
  --radius: 20px; --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(70, 80, 140, .05), 0 6px 18px rgba(70, 80, 140, .07);
  --nav-h: 66px;
  --row-bg: rgba(91, 103, 208, .035); --new-bg: rgba(91, 103, 208, .11);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13151d; --card: #1c1f2b; --text: #e8eaf3; --muted: #9aa0b8; --line: #2b2f40;
    --primary: #9aa5f5; --primary-ink: #11131c; --primary-soft: #262c4a;
    --pos: #63cf9c; --neg: #f08aa0; --warn: #f2c15e; --warn-bg: #3a2f17;
    --err-bg: #43222b; --ok-bg: #173a2a; --info-bg: #1f2a45; --chip: #262a39;
    --mint: #18352a; --mint-ink: #7fdcb0; --pink: #3d2130; --pink-ink: #f5a3b8;
    --lav: #2a2546; --lav-ink: #b9abff; --sky: #1b2e44; --sky-ink: #8fc4f2; --peach: #3a2c1f;
    --head-a: #1d2133; --head-b: #261d2e;
    --shadow: none;
    --row-bg: rgba(255, 255, 255, .03); --new-bg: rgba(154, 165, 245, .14);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
img { max-width: 100%; }

/* Bandeaux */
.b-testbanner { background: #ffd978; color: #3a2f12; text-align: center; font-size: .82rem; font-weight: 600; padding: 4px 8px; }
.b-offline { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: .85rem; padding: 4px 8px; }

/* Connexion */
.b-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(150deg, var(--head-a), var(--head-b)); }
.b-login-box { width: 100%; max-width: 360px; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 30px 22px; display: grid; gap: 14px; text-align: center; }
.b-login-logo { margin: 0 auto; }
.b-login-box h1 { font-size: 1.5rem; }

/* Structure */
.b-app { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.b-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: linear-gradient(120deg, var(--head-a), var(--head-b)); border-bottom: 1px solid var(--line); }
.b-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 750; font-size: 1.12rem; letter-spacing: -.2px; }
.b-top-title { flex: 1; text-align: right; color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 4px; }
.b-top .b-icon-btn { color: var(--primary); }
.b-top .b-icon-btn.b-active { background: var(--card); }
.b-view { max-width: 760px; margin: 0 auto; padding: 14px 16px 26px; outline: none; }
.b-page { display: grid; gap: 14px; min-width: 0; }
.b-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 6px 6px env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.b-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; min-width: 0; border-radius: 14px; }
.b-nav svg { width: 23px; height: 23px; }
.b-nav a.b-active { color: var(--primary); font-weight: 650; background: var(--primary-soft); }
.b-badge { position: absolute; top: 3px; left: 50%; margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--neg); color: #fff; font-size: .68rem; line-height: 18px; text-align: center; }

/* Cartes */
.b-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.b-card-h { font-size: 1.02rem; font-weight: 700; }
.b-sub-h { font-size: .9rem; color: var(--muted); font-weight: 600; margin-top: 4px; }
.b-card-warn { background: var(--warn-bg); }
.b-card-error { background: var(--err-bg); }
.b-card p { margin: 0; }
/* Les grilles ne s'élargissent jamais au-delà de l'écran à cause d'un texte long */
.b-card > *, .b-page > *, .b-acc > *, .b-tile > * { min-width: 0; }
.b-bankhead { min-width: 0; }
.b-hero { text-align: center; gap: 6px; background: linear-gradient(160deg, var(--card) 40%, var(--primary-soft)); }
.b-hero-label { color: var(--muted); font-size: .88rem; }
.b-total-amount { font-size: 2.1rem; font-weight: 750; margin: 0; letter-spacing: -.6px; }
.b-chart { position: relative; width: 100%; min-width: 0; }
.b-chart-hero { height: 190px; margin-top: 4px; }
.b-chart-donut { height: 210px; }
.b-chart-bars { height: 220px; }
.b-chart canvas { display: block; }

/* Puces */
.b-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.b-chips::-webkit-scrollbar { display: none; }
.b-chips-center { justify-content: center; }
.b-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 5px 13px; font-size: .85rem; cursor: pointer; }
.b-chips-sm .b-chip { padding: 3px 10px; font-size: .78rem; }
.b-chip-on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.b-chip-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip-dot, var(--muted)); }

/* Tuiles des comptes */
.b-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 620px) { .b-tiles { gap: 12px; } }
/* Tuile carrée ; son contenu se règle sur sa propre largeur (unités cqi), du téléphone au grand écran */
.b-tile { aspect-ratio: 1 / 1; display: flex; flex-direction: column; gap: 1px; padding: 7px; border-radius: 14px; border: 1.5px solid var(--tile-line, var(--line)); background: var(--tile-bg, var(--card)); color: var(--text); min-width: 0; box-shadow: var(--shadow); container-type: inline-size; overflow: hidden;
  font: inherit; text-align: left; cursor: pointer; position: relative; transition: opacity .15s, filter .15s, background-color .15s; -webkit-tap-highlight-color: transparent; }
@media (min-width: 620px) { .b-tile { padding: 14px; border-radius: var(--radius); gap: 2px; } }
.b-tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px; margin-bottom: auto; }
.b-tile .b-logo { width: clamp(22px, 24cqi, 60px); height: clamp(22px, 24cqi, 60px); border-radius: 28%; }
.b-tile .b-tag { font-size: clamp(.5rem, 5.5cqi, .85rem); padding: 1px clamp(4px, 3cqi, 10px); }
.b-tile-name { font-weight: 650; font-size: clamp(.62rem, 8.6cqi, 1.45rem); line-height: 1.2; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.b-tile-bank { font-size: clamp(.55rem, 6.2cqi, 1rem); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tile-bal { font-size: clamp(.64rem, 12.5cqi, 2.1rem); line-height: 1.25; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-logo { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: #fff; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.b-logo img { width: 100%; height: 100%; object-fit: contain; }
.b-logo-md { width: 44px; height: 44px; }
.b-logo-sm { width: 36px; height: 36px; border-radius: 10px; }
.b-logo-txt { color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .5px; }

/* Indicateurs */
.b-monthnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.b-monthnav h2 { font-size: 1.05rem; }
.b-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.b-kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.b-kpi { display: grid; gap: 2px; align-content: start; background: var(--chip); border-radius: var(--radius-sm); padding: 10px; color: var(--text); min-width: 0; }
.b-kpi span { font-size: .76rem; color: inherit; opacity: .8; }
.b-kpi b { font-size: clamp(.86rem, 3.9vw, 1.12rem); white-space: nowrap; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }
.b-kpi small { font-size: .7rem; opacity: .8; }
.b-kpi-dep { background: var(--pink); color: var(--pink-ink); }
.b-kpi-rev { background: var(--mint); color: var(--mint-ink); }
.b-kpi-ep { background: var(--lav); color: var(--lav-ink); }
.b-kpi-sky { background: var(--sky); color: var(--sky-ink); }
.b-kpi .b-pos, .b-kpi .b-neg { color: inherit; }
.b-up { color: var(--neg) !important; opacity: 1 !important; }
.b-down { color: var(--pos) !important; opacity: 1 !important; }
.b-kpi-dep .b-up, .b-kpi-dep .b-down { font-weight: 600; }
.b-kpi-rev .b-up { color: var(--pos) !important; }
.b-kpi-rev .b-down { color: var(--neg) !important; }
.b-legend { display: grid; gap: 2px; }
.b-legend-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 6px 4px; color: var(--text); border-radius: 10px; min-width: 0; }
a.b-legend-row:active { background: var(--chip); }
.b-legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.b-legend-pct { color: var(--muted); font-size: .8rem; }
.b-legend-amt { font-size: .92rem; font-variant-numeric: tabular-nums; }
.b-bar { width: 100%; height: 6px; display: block; }
.b-bar-bg { fill: var(--chip); }
.b-cta { display: flex; justify-content: space-between; align-items: center; background: var(--warn-bg); color: var(--warn); font-weight: 650; border-radius: var(--radius); padding: 13px 16px; }
.b-more { justify-self: end; font-size: .9rem; }
.b-more-load { text-align: center; padding: 14px 0 22px; }

/* Statistiques */
.b-catstats { display: grid; }
.b-catstat { border-top: 1px solid var(--line); }
.b-catstat:first-child { border-top: 0; }
.b-catstat-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; cursor: pointer; list-style: none; min-width: 0; }
.b-catstat-head::-webkit-details-marker { display: none; }
.b-catstat-main { display: grid; gap: 5px; min-width: 0; }
.b-catstat-name { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.b-catstat-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.b-catstat-name > span, .b-merchant-name > span { flex: none; white-space: nowrap; }
.b-catstat-amt { font-variant-numeric: tabular-nums; }
.b-catstat-kid { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 6px 0 6px 46px; color: var(--text); font-size: .88rem; }
.b-catstat[open] { padding-bottom: 6px; }
.b-merchants { display: grid; gap: 4px; }
.b-merchant { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; color: var(--text); min-width: 0; }
.b-merchant-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: .78rem; font-weight: 700; }
.b-merchant-main { display: grid; gap: 5px; min-width: 0; }
.b-merchant-name { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.b-merchant-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }

/* Alertes */
.b-alerts { display: grid; gap: 8px; }
.b-alert { display: block; border-radius: var(--radius-sm); padding: 10px 13px; font-size: .9rem; color: var(--text); border-left: 4px solid; }
.b-alert-error { background: var(--err-bg); border-color: var(--neg); }
.b-alert-warn { background: var(--warn-bg); border-color: var(--warn); }
.b-alert-info { background: var(--info-bg); border-color: var(--primary); }

/* Opérations */
.b-filters { display: grid; gap: 8px; }
.b-filter-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .b-filter-row { grid-template-columns: repeat(3, 1fr); } }
.b-txlist { display: grid; gap: 12px; }
.b-day { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; padding-bottom: 4px; }
.b-day-h { font-size: .78rem; font-weight: 650; color: var(--muted); padding: 10px 14px 6px; text-transform: none; }
.b-tx { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: calc(100% - 12px); margin: 3px 6px; padding: 8px 10px; background: var(--row-bg);
  border: 0; border-left: 4px solid transparent; border-radius: 12px; text-align: left; cursor: pointer; min-width: 0; }
.b-tx:active { filter: brightness(.97); }
.b-tx-pending { opacity: .72; }
.b-tx-main { display: grid; min-width: 0; }
.b-tx-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tx-sub { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .77rem; color: var(--muted); min-width: 0; }
.b-tx-sub > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.b-sep { opacity: .6; }
.b-tx-amount { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.b-pos { color: var(--pos); }
.b-neg { color: var(--neg); }
.b-neutral { color: var(--muted); }
.b-cat-ic { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; background: var(--chip); font-size: 1.05rem; flex: none; overflow: hidden; }
.b-cat-ic img { width: 26px; height: 26px; }
.b-cat-sm { width: 26px; height: 26px; border-radius: 9px; font-size: .75rem; vertical-align: middle; }
.b-cat-sm img { width: 18px; height: 18px; }
.b-cat-none { color: var(--muted); font-weight: 700; border: 1.5px dashed var(--muted); background: transparent; }
.b-tag { display: inline-block; font-size: .68rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.b-tag-transfer { background: var(--sky); color: var(--sky-ink); }
.b-tag-warn { background: var(--warn-bg); color: var(--warn); }
.b-tag-pending { background: var(--chip); color: var(--muted); }
.b-tag-ok { background: var(--ok-bg); color: var(--pos); }
.b-tag-err { background: var(--err-bg); color: var(--neg); }
.b-tag-gap { margin-left: 6px; vertical-align: middle; }
.b-empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* À vérifier */
.b-trf { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.b-trf-sides { display: grid; grid-template-columns: 1fr; gap: 4px; }
.b-trf-sides > div { display: grid; min-width: 0; }
.b-trf-sides > div > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-trf-arrow { display: flex !important; gap: 8px; align-items: center; color: var(--primary); padding-left: 2px; }
.b-trf-arrow span { display: inline-block; transform: rotate(90deg); order: -1; }
@media (min-width: 560px) {
  .b-trf-sides { grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
  .b-trf-arrow { flex-direction: column; gap: 0; }
  .b-trf-arrow span { transform: none; order: 0; }
}
.b-review-list { display: grid; gap: 6px; }
.b-rv { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 8px 8px 10px; border-left: 4px solid transparent; border-radius: 12px; min-width: 0; }
.b-rv-main { display: grid; background: none; border: 0; text-align: left; padding: 0; cursor: pointer; min-width: 0; }
.b-rv-sugg { font-size: .82rem; margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.b-ok { color: var(--pos); border: 1.5px solid var(--pos); background: var(--card); }

/* Comptes */
.b-bankhead { display: flex; align-items: center; gap: 10px; }
.b-bankhead h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-bankhead-total { font-variant-numeric: tabular-nums; }
.b-acc { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 10px 10px 8px; border-left: 4px solid transparent; border-radius: var(--radius-sm); min-width: 0; }
.b-acc-main { display: grid; min-width: 0; }
.b-acc-main > * { overflow: hidden; text-overflow: ellipsis; }
.b-acc-main > .b-wrap { white-space: normal; }
.b-acc-side { display: grid; justify-items: end; align-content: start; gap: 2px; flex: none; }
.b-acc-bal { font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.b-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.b-swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.b-swatch-auto { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: .8rem; cursor: pointer; }
.b-swatch-on { box-shadow: 0 0 0 2.5px var(--primary); }
.b-swatch-auto.b-swatch-on { background: var(--primary-soft); color: var(--primary); }

/* Réglages */
.b-menu { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.b-menu-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 16px; color: var(--text); border-top: 1px solid var(--line); }
.b-menu-item:first-child { border-top: 0; }
.b-menu-item small { display: block; color: var(--muted); font-size: .8rem; }
.b-menu-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); font-size: 1.15rem; }
.b-chev { color: var(--muted); font-size: 1.3rem; }
.b-back { font-size: .9rem; }
.b-conn { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.b-card-h + .b-conn { border-top: 0; padding-top: 0; }
.b-conn-main { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.b-conn-main > span.b-small { flex-basis: 100%; }
.b-conn-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.b-catrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 5px 0 5px 48px; border-top: 1px solid var(--line); }
.b-catrow-parent { grid-template-columns: auto 1fr auto; padding-left: 0; border-top: 0; }
.b-catrow-name { display: grid; min-width: 0; }
.b-archived { opacity: .55; }
.b-rule { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); padding: 9px 0; text-align: left; cursor: pointer; min-width: 0; }
.b-rule-main { display: grid; min-width: 0; }
.b-rule-main > * { overflow: hidden; text-overflow: ellipsis; }
.b-details > summary { cursor: pointer; font-weight: 650; }
.b-run { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.b-run-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.b-run-msg { margin: 0; white-space: pre-wrap; word-break: break-word; font: .78rem/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.b-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; margin: 0; }
.b-iconpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.b-iconpick button { display: grid; place-items: center; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; }
.b-iconpick button img { width: 30px; height: 30px; }
.b-iconpick-on { border-color: var(--primary) !important; background: var(--primary-soft) !important; }
.b-dl { display: grid; gap: 8px; }
.b-import-out { display: grid; gap: 8px; }
.b-import-list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.b-import-row { display: grid; border-top: 1px solid var(--line); padding: 6px 0; }

/* Formulaires et boutons */
.b-input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 12px; }
.b-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.b-input-short { max-width: 110px; }
.b-input-inline { display: inline-block; width: auto; max-width: 160px; margin-left: 6px; padding: 4px 8px; }
input[type=color].b-input { padding: 2px; height: 42px; }
.b-field { display: grid; gap: 5px; font-size: .88rem; color: var(--muted); text-align: left; }
.b-field .b-input { color: var(--text); }
.b-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.b-check, .b-radio { display: flex; gap: 8px; align-items: center; font-size: .92rem; text-align: left; }
.b-check input { flex: none; }
.b-radio { flex-wrap: wrap; }
.b-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 9px 15px; font-weight: 650; cursor: pointer; text-align: center; }
.b-btn:disabled { opacity: .5; cursor: default; }
.b-btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.b-btn-danger { color: var(--neg); border-color: var(--neg); }
.b-btn-block { width: 100%; }
.b-btn-sm { padding: 5px 11px; font-size: .85rem; }
.b-icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 1.3rem; flex: none; }
.b-ghost { visibility: hidden; }
.b-link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-weight: 650; }
.b-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.b-spin svg { animation: b-rot 1s linear infinite; }
@keyframes b-rot { to { transform: rotate(360deg); } }

/* Dialogues */
.b-dialog { border: 0; padding: 0; border-radius: 22px 22px 0 0; width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; background: var(--card); color: var(--text); }
@media (min-width: 680px) { .b-dialog { border-radius: 22px; margin: auto; } }
.b-dialog::backdrop { background: rgba(25, 28, 45, .45); }
.b-dlg { display: grid; grid-template-rows: auto 1fr; max-height: 92vh; }
.b-dlg-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.b-dlg-head h2 { flex: 1; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-dlg-body { overflow-y: auto; padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; align-content: start; }
.b-txd-head { text-align: center; }
.b-txd-amount { font-size: 1.9rem; font-weight: 750; margin: 0; }
.b-txd-section { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.b-txd-section h3 { font-size: .88rem; color: var(--muted); }
.b-txd-section p { margin: 0; }
.b-catbtn { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 12px; cursor: pointer; text-align: left; flex-wrap: wrap; }
.b-apply { display: grid; gap: 8px; background: var(--chip); border-radius: 14px; padding: 10px 12px; }
.b-cand { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 12px; text-align: left; cursor: pointer; }
.b-cand b { grid-row: span 2; align-self: center; }
.b-note-box { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 8px 12px; font-size: .88rem; margin: 0; }
.b-txd-raw summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.b-txd-raw dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .85rem; margin: 8px 0 0; }
.b-txd-raw dt { color: var(--muted); }
.b-txd-raw dd { margin: 0; word-break: break-word; }
.b-picker { display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; }
.b-pick-group { display: grid; gap: 2px; margin-bottom: 6px; }
.b-pick { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; border-radius: 12px; padding: 8px 10px; text-align: left; cursor: pointer; }
.b-pick:hover, .b-pick:focus-visible { background: var(--chip); }
.b-pick-parent { font-weight: 650; }
.b-pick-child { padding-left: 58px; }
.b-pick-on { background: var(--primary-soft); color: var(--primary); }
.b-details-inline summary { cursor: pointer; color: var(--primary); font-weight: 650; font-size: .9rem; }
.b-details-inline { display: grid; gap: 10px; }
.b-testout { display: grid; gap: 2px; }
.b-testout p { margin: 0; }

/* Divers */
.b-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 50; max-width: calc(100% - 32px); background: #2a2f45; color: #fff; border-radius: 14px; padding: 10px 16px; font-size: .9rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.b-toast-error { background: var(--neg); }
.b-loading { color: var(--muted); text-align: center; padding: 30px 0; }
.b-muted { color: var(--muted); }
.b-muted-strong { color: var(--warn); font-weight: 650; }
.b-small { font-size: .82rem; }
.b-center { text-align: center; }
.b-big { font-size: 2.4rem; margin: 0; }
.b-error { color: var(--neg); margin: 0; }
.b-error-text { color: var(--neg); }

/* Page de retour de la banque */
.b-cb { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(150deg, var(--head-a), var(--head-b)); }
.b-cb-box { max-width: 420px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; text-align: center; display: grid; gap: 12px; }
.b-cb-icon { font-size: 2.4rem; margin: 0; }
.b-cb-box h1 { font-size: 1.3rem; }

/* ---------- v0.3 ---------- */
/* Tuiles des comptes = boutons de sélection (accueil) */
.b-tile-check { display: grid; place-items: center; width: clamp(16px, 13cqi, 26px); height: clamp(16px, 13cqi, 26px); border-radius: 50%; background: var(--tile-ink, var(--primary)); color: #fff; font-size: clamp(.55rem, 7cqi, .9rem); font-weight: 800; }
.b-tile-off { background: var(--card); border-style: dashed; border-color: var(--line); opacity: .55; filter: saturate(.35); box-shadow: none; }
.b-tile-off .b-tile-check { background: transparent; color: transparent; border: 1.5px solid var(--line); }
.b-tile:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Bandeau du haut : total des comptes choisis */
.b-band { border-radius: var(--radius); padding: 18px 16px 16px; text-align: center; color: var(--text);
  background: linear-gradient(135deg, #c9cff8 0%, #e6d6f5 55%, #f8dfe8 100%); box-shadow: var(--shadow); display: grid; gap: 2px; }
.b-band-label { margin: 0; font-size: .9rem; font-weight: 600; color: #4b4f7a; }
.b-band-amount { margin: 0; font-size: clamp(2rem, 9vw, 2.7rem); font-weight: 780; letter-spacing: -.8px; font-variant-numeric: tabular-nums; color: #232650; }
.b-band-sub { margin: 0; font-size: .78rem; color: #5d6190; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .b-band { background: linear-gradient(135deg, #2d3366 0%, #3a2c55 55%, #4a2a3e 100%); }
  .b-band-label, .b-band-sub { color: #c9cdf3; }
  .b-band-amount { color: #fff; }
}

/* Choix de la période : boutons presque carrés */
.b-seg { display: flex; gap: 3px; padding: 3px; background: var(--chip); border-radius: 10px; overflow-x: auto; scrollbar-width: none; }
.b-seg::-webkit-scrollbar { display: none; }
.b-seg-btn { flex: 1 1 auto; border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 7px 6px; font-size: .76rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-align: center; }
.b-seg-on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(40, 50, 110, .14); }
.b-seg-tabs .b-seg-btn { padding: 9px 12px; font-size: .88rem; }
.b-evo { gap: 10px; }
.b-evo-value { margin: 0; font-size: 1.45rem; font-weight: 750; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.b-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .b-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.b-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.b-kpi-bal { background: var(--sky); color: var(--sky-ink); }
.b-kpi-balneg { background: var(--peach); color: var(--warn); }
.b-donut-wrap { display: grid; gap: 12px; min-width: 0; }
.b-bio-card { background: var(--lav); }
.b-ok-text { color: var(--pos); font-weight: 650; }
.b-actions-start { justify-content: flex-start; }

/* Écran verrouillé */
.b-unlock-help { text-align: left; font-size: .88rem; }
.b-unlock-help summary { cursor: pointer; color: var(--muted); }
.b-unlock-pw { display: grid; gap: 8px; margin-top: 8px; }

/* Échéancier */
.b-rec-row { cursor: default; }
.b-rec-amounts { display: grid; justify-items: end; gap: 1px; }
.b-rec-amounts small { font-size: .7rem; white-space: nowrap; }
.b-rec-late { opacity: .8; }
.b-rec-btns { display: flex; gap: 2px; align-items: center; }
.b-rv:has(.b-rec-btns) { grid-template-columns: minmax(0, 1fr) auto auto; }
.b-details-card summary { cursor: pointer; font-weight: 650; }

/* Virements du mois */
.b-flows { display: grid; gap: 6px; }
.b-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: var(--chip); border-radius: 12px; }
.b-flow b { margin-left: auto; font-variant-numeric: tabular-nums; }
.b-flow small { width: 100%; text-align: right; }
.b-flow-arrow { color: var(--muted); }
.b-trf-acc { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 650; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.b-rv-btn { width: 100%; background: none; border: 0; border-left: 4px solid transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; grid-template-columns: minmax(0, 1fr) auto; }

/* Menu : en bas sur téléphone, sur le côté sur PC */
.b-nav-brand, .b-nav-pc { display: none !important; }
@media (min-width: 1024px) {
  :root { --side-w: 236px; }
  .b-app { padding-bottom: 0; padding-left: var(--side-w); }
  .b-nav { top: 0; bottom: 0; right: auto; width: var(--side-w); height: auto; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px;
    border-top: 0; border-right: 1px solid var(--line); background: linear-gradient(180deg, #e7e9fc 0%, #f3e6f4 100%); }
  .b-nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; font-size: .95rem; border-radius: 14px; color: #4c507a; }
  .b-nav a:hover { background: rgba(255, 255, 255, .55); }
  .b-nav a.b-active { background: var(--card); color: var(--primary); box-shadow: 0 2px 8px rgba(70, 80, 140, .12); }
  .b-nav-brand, .b-nav-pc { display: flex !important; }
  .b-nav-brand { font-weight: 780; font-size: 1.15rem; color: var(--text) !important; margin-bottom: 14px; }
  .b-nav-brand:hover { background: transparent !important; }
  .b-nav [data-tab="reglages"] { margin-top: auto; }
  .b-badge { position: static; margin-left: auto; }
  .b-top .b-brand { visibility: hidden; }
  .b-view-wide { max-width: 1140px; }
  /* tuiles carrées de 220 px au plus, toutes sur une ligne (jusqu'à 6 comptes), centrées */
  .b-view-wide .b-tiles { grid-template-columns: repeat(var(--n, 4), minmax(0, 220px)); justify-content: center; gap: 14px; }
  .b-view-wide .b-home { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .b-view-wide .b-home > * { grid-column: 1 / -1; }
  .b-view-wide .b-home > .b-evo { grid-column: 1; }
  .b-view-wide .b-home > .b-evo + .b-card { grid-column: 2; }
  .b-chart-hero { height: 240px; }
  .b-view-wide .b-home .b-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) and (prefers-color-scheme: dark) {
  .b-nav { background: linear-gradient(180deg, #1d2133 0%, #261d2e 100%); }
  .b-nav a { color: var(--muted); }
  .b-nav a:hover { background: rgba(255, 255, 255, .06); }
}

/* v0.4 : opérations arrivées depuis la dernière ouverture, liseré seul pour le compte */
.b-tx-new { background: var(--new-bg); box-shadow: inset 0 0 0 1px rgba(91, 103, 208, .18); }
.b-tx-new .b-tx-label { font-weight: 780; }
.b-tx-new .b-tx-amount { font-weight: 800; }
.b-new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(91, 103, 208, .22); }
.b-rv { background: var(--row-bg); }

/* v0.4 : fenêtre de détail sans défilement horizontal (longs libellés, références) */
.b-dialog, .b-dlg, .b-dlg-body { overflow-x: hidden; }
.b-dlg-body > * { min-width: 0; }
.b-dlg-body p, .b-dlg-body dd, .b-dlg-body dt, .b-dlg-body summary, .b-dlg-body .b-btn, .b-dlg-body label { overflow-wrap: anywhere; word-break: break-word; }
.b-dlg-body .b-btn { white-space: normal; text-align: center; }
.b-dlg-head h2 { min-width: 0; }

/* v0.4 : logos un peu plus grands dans les tuiles */
.b-tile .b-logo { width: clamp(24px, 28cqi, 68px); height: clamp(24px, 28cqi, 68px); }
/* téléphone : logo plus grand sans couper le nom sur 2 lignes (interlignes resserrés) */
@media (max-width: 619px) {
  .b-tile { gap: 0; }
  .b-tile-name { line-height: 1.1; flex: none; }
  .b-tile-bank, .b-tile-bal { line-height: 1.15; }
}

/* v0.4 : période précédente / suivante */
.b-evo-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.b-evo-nav b { font-size: .95rem; text-align: center; flex: 1; }
.b-evo-nav .b-icon-btn[disabled] { opacity: .25; cursor: default; }

/* v0.4 : à venir (liste des opérations) */
.b-upcoming .b-tx { cursor: default; opacity: .9; }
.b-upcoming .b-tx-label { font-weight: 600; }
.b-up-tag { font-size: .68rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--lav); color: var(--lav-ink); }
.b-up-tag-bank { background: var(--sky); color: var(--sky-ink); }

/* v0.4 : ordre des comptes sur l'accueil */
.b-order-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.b-order-row:last-child { border-bottom: 0; }
.b-order-row .b-icon-btn { width: 34px; height: 34px; font-size: 1.05rem; }
.b-order-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.b-order-name b { font-size: .92rem; }
.b-order-name small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-order-row .b-icon-btn[disabled] { opacity: .25; cursor: default; }
.b-order-row .b-check { font-size: .82rem; white-space: nowrap; }
.b-row-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.b-row-line:last-child { border-bottom: 0; }
.b-row-line > span { min-width: 0; overflow-wrap: anywhere; }
