/* Cresus — tableau de bord. Système visuel : couleurs du thème Telegram, échelle typographique
   12 / 13 / 15 / 17 / 22 / 28, rayons 10 / 14 / 20, icônes au trait 2 px. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --text: var(--tg-theme-text-color, #15171c);
  /* Texte secondaire : la couleur « indice » de Telegram, rapprochée du texte pour atteindre 4,5:1 (WCAG AA). */
  --hint: color-mix(in srgb, var(--tg-theme-hint-color, #8b909a) 55%, var(--text));
  --accent: var(--tg-theme-button-color, #2f6fed);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --btn: color-mix(in srgb, var(--accent) 84%, #000);          /* fond des boutons pleins : texte blanc lisible */
  --link: color-mix(in srgb, var(--accent) 78%, var(--text));  /* liens et textes d'accent */
  --sep: color-mix(in srgb, var(--hint) 20%, transparent);
  --soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --red: #c4252b; --red-soft: color-mix(in srgb, #e5484d 13%, transparent);
  --orange: #a84100; --orange-soft: color-mix(in srgb, #f76b15 13%, transparent);
  --green: #1d7347; --green-soft: color-mix(in srgb, #30a46c 13%, transparent);
  --violet: #7238a8; --violet-soft: color-mix(in srgb, #8e4ec6 13%, transparent);
  --r-s: 10px; --r: 14px; --r-l: 20px;
  --tabbar: 64px; --side: 236px; --chat-w: 400px; --content-max: 1600px;
  --top-inset: 0px; --bottom-inset: 0px; --left-inset: 0px; --right-inset: 0px;
  /* Zones de sécurité : encoche (paysage) et zones réservées par Telegram en plein écran. */
  --l: max(env(safe-area-inset-left), var(--left-inset)); --r-safe: max(env(safe-area-inset-right), var(--right-inset));
  --b-safe: calc(env(safe-area-inset-bottom) + var(--bottom-inset));
  --gutter: 16px;
  --app-h: 100dvh; --app-top: 0px;  /* hauteur réellement visible (clavier compris), tenue à jour par core.js */
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  color-scheme: light;
}
/* Palette propre (quand vous forcez « Clair » ou « Sombre », ou dans Chrome) : remplace les couleurs de Telegram. */
:root[data-base="light"] {
  --bg: #ffffff; --bg2: #f1f2f6; --text: #15171c; --accent: #2f6fed; --accent-text: #ffffff;
  --hint: color-mix(in srgb, #8b909a 55%, var(--text));
}
:root[data-base="dark"] {
  --bg: #17212b; --bg2: #0f1720; --text: #f2f4f7; --accent: #4f8fd8; --accent-text: #ffffff;
  --hint: color-mix(in srgb, #8696a8 55%, var(--text));
}
/* Thème sombre : celui de Telegram, ou celui de l'appareil quand le tableau de bord est ouvert dans Chrome. */
:root[data-theme="dark"] {
  --red: #ff8085; --orange: #ffa25e; --green: #57d896; --violet: #c9b0ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: var(--tg-theme-bg-color, #17212b); --bg2: var(--tg-theme-secondary-bg-color, #0f1720);
    --text: var(--tg-theme-text-color, #f2f4f7); --accent: var(--tg-theme-button-color, #4f8fd8);
    --red: #ff8085; --orange: #ffa25e; --green: #57d896; --violet: #c9b0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--text); min-height: 100%;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 18px; height: 18px; flex: 0 0 auto; }
.hidden, [hidden] { display: none !important; }  /* l'attribut hidden l'emporte sur display: grid/flex */
.muted { color: var(--hint); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- en-tête ---------- */
/* Bandeau opaque sous les boutons de Telegram (Close, ⋯) en plein écran : le contenu ne défile plus dessous. */
body::before { content: ""; position: fixed; z-index: 8; top: 0; left: 0; right: 0; height: var(--top-inset);
               background: var(--bg2); pointer-events: none; }
header { padding: calc(14px + var(--top-inset)) calc(var(--gutter) + var(--r-safe)) 8px calc(var(--gutter) + var(--l));
         display: flex; align-items: center; gap: 8px; }
header .who { flex: 1; min-width: 0; }
header h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .date { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { border: 0; background: var(--bg); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
            flex: 0 0 44px; box-shadow: var(--shadow); }
.chat-btn { border: 0; height: 44px; border-radius: 999px; padding: 0 16px 0 13px; display: flex; align-items: center; gap: 7px;
            background: var(--btn); color: var(--accent-text); font-weight: 650; font-size: 14px; flex: 0 0 auto;
            box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.kbd { font-size: 12px; color: var(--hint); border: 1px solid var(--sep); border-radius: 6px; padding: 1px 5px; margin-left: 4px; }
/* « main » est un conteneur : la mise en page suit la place réellement disponible (chat ouvert, tablette…). */
main { container: main / inline-size;
       padding: 4px calc(var(--gutter) + var(--r-safe)) calc(var(--tabbar) + 28px + var(--b-safe)) calc(var(--gutter) + var(--l)); }

/* ---------- éléments communs ---------- */
.section-title { font-size: 12.5px; font-weight: 650; color: var(--hint); text-transform: uppercase; letter-spacing: .05em;
                 margin: 20px 4px 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* Liens discrets : zone à toucher agrandie par la marge intérieure, sans changer la mise en page. */
.section-title .link { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--link); border: 0; background: none;
                       padding: 12px 10px; margin: -12px -10px; font-size: 13px; }
.card { background: var(--bg); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.pad { padding: 14px 16px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; width: 100%;
        border: 0; background: none; text-align: left; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--sep); }
.item.with-check + .item.with-check::before { left: 54px; }
button.item:hover, .item.clickable:hover { background: color-mix(in srgb, var(--bg2) 55%, transparent); }
.item .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 34px;
            background: var(--bg2); color: var(--hint); }
.item .ic.accent { background: var(--soft); color: var(--link); }
.item .ic.orange { background: var(--orange-soft); color: var(--orange); }
.item .ic.green { background: var(--green-soft); color: var(--green); }
.item .ic.red { background: var(--red-soft); color: var(--red); }
.item .ic.violet { background: var(--violet-soft); color: var(--violet); }
.grow { flex: 1; min-width: 0; }
/* Lignes « texte + boutons » : quand la place manque, les boutons passent SOUS le texte au lieu de l'écraser. */
.item:has(> .btn, > .row-actions, > .seg, > .inline-input) { flex-wrap: wrap; row-gap: 10px; }
.item:has(> .btn, > .row-actions, > .seg, > .inline-input) > .grow { flex: 1 1 11rem; }
.item > .btn, .item > .row-actions, .item > .seg, .item > .inline-input { margin-left: auto; }
.item > .tag, .item > .amount, .item > svg.i { flex: none; }
.t { overflow-wrap: anywhere; }
.m { color: var(--hint); font-size: 13px; margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.m svg.i { width: 13px; height: 13px; }
.m > span { display: inline-flex; align-items: center; gap: 3px; }
.tag { border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 650; background: var(--bg2); color: var(--hint);
       display: inline-flex; align-items: center; gap: 3px; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.orange { background: var(--orange-soft); color: var(--orange); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.accent { background: var(--soft); color: var(--link); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; }
.amount.red { color: var(--red); } .amount.green { color: var(--green); }
.check { width: 44px; height: 44px; flex: 0 0 44px; margin: -10px; border: 0; background: none; padding: 0; position: relative;
         display: grid; place-items: center; }
.check::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; transition: all .18s;
                 border: 2px solid color-mix(in srgb, var(--hint) 80%, transparent); }
.check svg { width: 13px; height: 13px; opacity: 0; color: #fff; transition: opacity .18s; position: relative; }
.check:hover::before { border-color: var(--green); }
.check.on::before { background: var(--green); border-color: var(--green); }
.check.on svg { opacity: 1; }
.item.leaving { opacity: 0; transform: translateX(24px); transition: all .28s ease; }
.empty { padding: 24px 16px; text-align: center; color: var(--hint); }
.empty .e { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%; background: var(--bg2); }
.btn { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 650; font-size: 14px; background: var(--bg2);
       display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--btn); color: var(--accent-text); }
.btn.danger { color: var(--red); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; min-height: 34px; }
.btn:disabled { opacity: .5; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--bg); border-radius: 12px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; font-size: 13.5px; font-weight: 650; color: var(--hint);
              min-height: 34px; }
.seg button.on { background: var(--bg2); color: var(--text); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
input.field, select.field, textarea.field { width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; background: var(--bg2);
                                            color: var(--text); }
textarea.field { min-height: 110px; resize: vertical; }
label.lbl { display: block; font-size: 13px; font-weight: 650; color: var(--hint); margin: 10px 2px 4px; }
.quick { display: flex; gap: 8px; align-items: center; background: var(--bg); border-radius: var(--r); padding: 6px 6px 6px 14px;
         box-shadow: var(--shadow); margin-top: 10px; }
.quick input { flex: 1; border: 0; background: none; padding: 8px 0; outline: none; }

/* ---------- carte « Ma journée » ---------- */
/* Même famille que les autres cartes ; une touche d'accent discrète, juste en clair comme en sombre. */
.day-card { position: relative; overflow: hidden; border-radius: var(--r-l); padding: 16px; display: flex; flex-direction: column; gap: 12px;
            background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 11%, var(--bg)) 0%, var(--bg) 58%);
            border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--sep)); box-shadow: var(--shadow); }
.dc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dc-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.dc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dc-tile { border: 0; text-align: left; border-radius: var(--r); padding: 12px; min-height: 96px; background: var(--bg2); color: var(--text);
           display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; column-gap: 10px; align-items: center; }
.dc-tile:hover { background: color-mix(in srgb, var(--accent) 8%, var(--bg2)); }
.dc-ic { grid-row: 1; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--link); }
.dc-tile > b { grid-row: 1; font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dc-tile > b small { font-size: 15px; font-weight: 600; color: var(--hint); }
.dc-lbl { grid-column: 1 / -1; font-size: 13px; color: var(--hint); margin-top: 8px; line-height: 1.3; }
.dc-bar { grid-column: 1 / -1; align-self: end; height: 6px; border-radius: 6px; background: color-mix(in srgb, var(--hint) 22%, transparent);
          overflow: hidden; margin-top: 8px; }
.dc-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); transition: width .4s ease; }
.dc-next { border: 0; background: none; color: var(--text); text-align: left; width: 100%; display: flex; align-items: center; gap: 12px;
           padding: 12px 0 0; border-top: 1px solid var(--sep); min-height: 56px; }
.dc-next > svg.i { color: var(--hint); flex: none; }
.dc-next .t { display: block; font-weight: 650; overflow-wrap: anywhere; }
.dc-next .m { margin-top: 4px; }
.dc-kicker { display: block; font-size: 12px; font-weight: 650; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.dc-time { flex: none; min-width: 58px; height: 44px; padding: 0 10px; border-radius: 12px; display: grid; place-items: center;
           background: var(--btn); color: var(--accent-text); font-weight: 750; font-variant-numeric: tabular-nums; }
.dc-time.empty { background: var(--bg2); color: var(--hint); min-width: 44px; }
.ring { width: 76px; height: 76px; flex: 0 0 76px; position: relative; }
.ring svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 17px; line-height: 1.1; }
.ring .v small { display: block; font-size: 12px; font-weight: 600; opacity: .85; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.kpi { background: var(--bg); border-radius: var(--r); padding: 12px 14px; text-align: left; border: 0; box-shadow: var(--shadow);
       display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .lbl { color: var(--hint); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.kpi b { font-size: 21px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .trend { font-size: 12px; font-weight: 650; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); } .trend.flat { color: var(--hint); }
svg.spark { width: 100%; height: 28px; display: block; margin-top: 4px; }

/* ---------- agenda ---------- */
.day { font-size: 13px; font-weight: 650; padding: 12px 16px 4px; }
.day .rel { color: var(--link); }
.ev { display: flex; gap: 12px; padding: 8px 16px 10px; }
.ev .time { width: 46px; flex: 0 0 46px; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; padding-top: 1px; }
.ev .time small { display: block; color: var(--hint); font-weight: 400; }
.ev .bar { width: 3px; border-radius: 3px; background: var(--accent); flex: 0 0 3px; }
.ev .grow .t { font-weight: 550; }
.days-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px; scrollbar-width: none; }
.days-strip button { border: 0; background: var(--bg); border-radius: 12px; padding: 8px 0; min-width: 40px; flex: 1 1 0;
                     display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--hint); box-shadow: var(--shadow); }
.days-strip button b { font-size: 17px; color: var(--text); }
.days-strip button.on { background: var(--btn); color: var(--accent-text); }
.days-strip button.on b { color: var(--accent-text); }
.days-strip button .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-top: 3px; opacity: .7; }
.week { display: none; }

/* ---------- finances ---------- */
.big { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--hint); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--accent); vertical-align: middle; margin-right: 5px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--violet) 0 4px, transparent 4px 7px); }
svg.chart { width: 100%; height: 150px; display: block; margin-top: 10px; }
.companies { display: grid; grid-template-columns: 1fr; gap: 10px; }
.company { border: 0; text-align: left; background: var(--bg); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); width: 100%; }
.company .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.company .name { font-weight: 650; overflow-wrap: anywhere; }
.bars { display: grid; gap: 4px; margin-top: 8px; }
.bar-line { height: 6px; border-radius: 6px; background: var(--bg2); overflow: hidden; display: flex; }
.bar-line i { display: block; height: 100%; border-radius: 6px; }
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 130px; padding-top: 6px; }
.months .mcol { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; align-items: center; }
.months .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.months .pair i { width: 10px; border-radius: 4px 4px 0 0; display: block; }
.months small { font-size: 12px; color: var(--hint); }
.back { border: 0; background: none; color: var(--link); font-weight: 650; display: inline-flex; align-items: center; gap: 4px;
        padding: 10px 8px; margin: 0 -8px; min-height: 44px; }

/* ---------- réglages ---------- */
.switch { position: relative; width: 52px; height: 44px; flex: 0 0 52px; margin: -8px -3px; border: 0; background: none; padding: 0; }
.switch::before { content: ""; position: absolute; left: 3px; top: 8px; width: 46px; height: 28px; border-radius: 999px;
                  background: color-mix(in srgb, var(--hint) 45%, transparent); transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 11px; left: 6px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
                 box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.switch.on::before { background: var(--green); }
.switch.on::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; background: var(--bg2); display: inline-flex;
        gap: 5px; align-items: center; min-height: 34px; text-align: left; }
.chip.on { background: var(--soft); color: var(--link); }
.inline-input { width: 120px; border: 0; border-radius: 10px; padding: 8px 10px; background: var(--bg2); text-align: right; min-height: 40px; }

/* ---------- navigation ---------- */
nav.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
             background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px);
             border-top: 1px solid var(--sep); padding: 0 var(--r-safe) var(--b-safe) var(--l); }
nav.tabbar .brand { display: none; }
nav.tabbar button { border: 0; background: none; height: var(--tabbar); display: flex; flex-direction: column; position: relative;
                    align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 650; color: var(--hint); min-width: 0; }
nav.tabbar button svg.i { width: 23px; height: 23px; }
nav.tabbar button.on { color: var(--link); }
nav.tabbar button.desk { display: none; }
nav.tabbar .badge { position: absolute; top: 6px; left: 50%; margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px;
                    border-radius: 9px; background: #d42a30; color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.fab { position: fixed; right: calc(18px + var(--r-safe)); bottom: calc(var(--tabbar) + 18px + var(--b-safe)); z-index: 6;
       width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--btn); color: var(--accent-text);
       box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); display: grid; place-items: center; }
.fab svg.i { width: 26px; height: 26px; }

/* ---------- panneaux, palette, notification ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: var(--l); right: var(--r-safe); bottom: 0; z-index: 10; background: var(--bg); border-radius: 20px 20px 0 0;
         max-height: calc(var(--app-h) * .88); overflow-y: auto; overscroll-behavior: contain;
         padding: 8px 16px calc(18px + var(--b-safe)); transform: translateY(calc(100% + 60px));
         visibility: hidden; transition: transform .25s ease, visibility .25s; }
.sheet.on { transform: none; visibility: visible; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.sheet .sub { color: var(--hint); font-size: 13px; margin-bottom: 12px; }
.grid-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.act { border: 0; background: var(--bg2); border-radius: 12px; padding: 12px; font-weight: 650; font-size: 14px; text-align: left;
       display: flex; align-items: center; gap: 8px; min-height: 48px; }
.act.primary { background: var(--btn); color: var(--accent-text); grid-column: 1 / -1; justify-content: center; }
.act.danger { color: var(--red); }
.preview { white-space: pre-wrap; font-size: 13.5px; background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin: 8px 0;
           max-height: 5.6em; overflow: hidden; position: relative; }
.preview.open { max-height: none; }
.preview.clipped:not(.open) { -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.palette { position: fixed; z-index: 12; left: calc(12px + var(--l)); right: calc(12px + var(--r-safe)); top: calc(12px + var(--top-inset) + var(--app-top)); background: var(--bg); border-radius: 16px;
           box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; visibility: hidden; opacity: 0; transform: translateY(-8px);
           transition: all .16s; }
.palette.on { visibility: visible; opacity: 1; transform: none; }
.palette input { width: 100%; border: 0; padding: 16px 18px; font-size: 16px; background: var(--bg); outline: none; border-bottom: 1px solid var(--sep); }
.palette .results { max-height: calc(var(--app-h) * .6); overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.palette .res { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; width: 100%; border: 0; background: none;
                text-align: left; min-height: 48px; }
.palette .res.sel { background: var(--soft); }
.palette .res .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.palette .res .kind { display: block; font-size: 12px; color: var(--hint); }
.toast { position: fixed; left: calc(16px + var(--l)); right: calc(16px + var(--r-safe)); bottom: calc(var(--tabbar) + 16px + var(--b-safe)); z-index: 11;
         background: #1f2329; color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
         transform: translateY(30px); opacity: 0; pointer-events: none; transition: all .22s; }
.toast:not(.on) { visibility: hidden; }
.toast.on { transform: none; opacity: 1; pointer-events: auto; }
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: #9cc2ff; font-weight: 700; min-height: 44px; padding: 0 8px; }
.sk { background: linear-gradient(90deg, var(--bg) 25%, var(--bg2) 50%, var(--bg) 75%); background-size: 200% 100%;
      animation: sk 1.2s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }
.cols, .top, .kanban { display: block; }
.dragover { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--r); }

/* ---------- À traiter : résumé, rubriques par priorité ---------- */
.handle-summary { margin-top: 6px; }
.handle-summary .row { display: flex; gap: 16px; align-items: center; }
.handle-summary .grow > b { font-size: 16px; display: block; margin-bottom: 8px; }
.big-count { font-size: 40px; font-weight: 750; letter-spacing: -.03em; line-height: 1; color: var(--red); flex: none; min-width: 48px; text-align: center;
             font-variant-numeric: tabular-nums; }
.big-count.zero { color: var(--green); }
.explain { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sep); line-height: 1.45; }
.explain svg.i { vertical-align: -2px; margin-right: 4px; }
.explain .link { border: 0; background: none; color: var(--link); font-weight: 650; font-size: inherit; padding: 12px 6px; margin: -12px -6px; }
.handle { display: flex; flex-wrap: wrap; gap: 0 24px; align-items: flex-start; }
.handle-sec { flex: 1 1 100%; min-width: 0; }
.handle-sec.info .card { opacity: .92; }
.section-title .level { border: 0; cursor: pointer; text-transform: none; letter-spacing: 0; flex: none; position: relative;
                        padding: 4px 8px; min-height: 26px; }
.section-title .level::after { content: ""; position: absolute; inset: -10px -4px; }  /* zone tactile élargie */
.cards-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cards-grid .card + .card { margin-top: 0; }
.item.wrap { flex-wrap: wrap; }
.item.dim { opacity: .72; }
.link-row { display: block; width: 100%; border: 0; border-top: 1px solid var(--sep); background: none; color: var(--link); font-weight: 650;
            padding: 12px 16px; text-align: left; min-height: 46px; }
.m.pad { padding: 8px 16px 12px; }

/* ---------- conversation avec Cresus ---------- */
.chat-btn.on { background: var(--btn); color: var(--accent-text); }
/* Hauteur = partie réellement visible : le champ de saisie reste au-dessus du clavier. */
aside.chat { position: fixed; z-index: 10; top: var(--app-top); left: 0; right: 0; height: var(--app-h); background: var(--bg2);
             display: flex; flex-direction: column;
             padding: var(--top-inset) var(--r-safe) var(--b-safe) var(--l);
             transform: translateX(100%); visibility: hidden; transition: transform .25s ease, visibility .25s; }
aside.chat.on { transform: none; visibility: visible; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--sep); }
.chat-head .btn.small { min-height: 40px; }
.chat-head .logo, .chat-empty .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-text); flex: 0 0 34px;
                                      background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #7c3aed)); }
.chat-head .m { margin-top: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { border-radius: 16px; padding: 9px 12px 6px; background: var(--bg); box-shadow: var(--shadow); line-height: 1.45; }
.msg.me .bubble { background: var(--btn); color: var(--accent-text); border-bottom-right-radius: 5px; }
.msg.bot .bubble { border-bottom-left-radius: 5px; }
.bubble .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .when { font-size: 12px; opacity: .78; text-align: right; margin-top: 2px; }
.bubble.error { display: flex; align-items: center; gap: 8px; color: var(--red); }
.typing .bubble { display: flex; gap: 4px; padding: 12px 14px; }
.typing .bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--hint); animation: blink 1.2s infinite; }
.typing .bubble i:nth-child(2) { animation-delay: .2s; } .typing .bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-action { background: var(--bg); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); width: min(100%, 420px); border-left: 3px solid var(--accent); }
.chat-action .head { display: flex; gap: 10px; align-items: flex-start; }
.chat-action .head > svg.i { color: var(--accent); margin-top: 2px; }
.chat-action .preview { margin: 8px 0; }
.chat-action .row-actions { align-items: center; }
.chat-action .tag svg.i { width: 12px; height: 12px; vertical-align: -2px; }
.chat-empty { margin: auto; text-align: center; max-width: 360px; display: grid; gap: 8px; justify-items: center; color: var(--text); }
.chat-empty .m { justify-content: center; }
.chat-empty .chips { justify-content: center; margin-top: 6px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--bg); border-top: 1px solid var(--sep); position: relative; }
/* commandes « / » : liste au-dessus de la saisie, comme le menu de Telegram */
.chat-cmds { display: none; position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); max-height: min(320px, 45vh); overflow-y: auto;
  background: var(--bg); border-radius: var(--r); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); border: 1px solid var(--sep); padding: 4px; z-index: 5; }
.chat-cmds.on { display: block; }
.chat-cmds .cmd { display: flex; gap: 10px; align-items: baseline; width: 100%; min-height: 44px; border: 0; background: none; color: var(--text);
  text-align: left; padding: 8px 10px; border-radius: var(--r-s); }
.chat-cmds .cmd b { color: var(--link); flex: 0 0 auto; }
.chat-cmds .cmd span { color: var(--hint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-cmds .cmd.on, .chat-cmds .cmd:hover { background: var(--soft); }
/* fil : messages automatiques, messages longs repliés, boutons, messages plus anciens */
.msg.auto .bubble { background: var(--bg2); box-shadow: none; border: 1px solid var(--sep); }
.bubble .kind { font-size: 12px; font-weight: 600; color: var(--hint); margin-bottom: 4px; }
.bubble .txt.folded { max-height: 14em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.bubble .more { border: 0; background: none; color: var(--link); font-weight: 600; padding: 6px 0; min-height: 32px; font-size: 14px; }
.msg.me .bubble .more { color: inherit; }
.kb { display: grid; gap: 6px; width: min(100%, 420px); }
.kb-row { display: flex; gap: 6px; flex-wrap: wrap; }
.kb-row .btn { background: var(--bg); color: var(--link); border: 1px solid var(--sep); box-shadow: var(--shadow); flex: 1 1 8rem; justify-content: center; min-width: 0; white-space: normal; text-align: center; }
.chat-log > .older { align-self: center; }
.chat-input textarea { flex: 1; resize: none; border: 0; border-radius: 18px; padding: 10px 14px; background: var(--bg2); max-height: 160px; outline: none; line-height: 1.4; }
.chat-input textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-input .send { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; border: 0; background: var(--btn); color: var(--accent-text); display: grid; place-items: center; }
.chat-input .send:disabled { opacity: .5; }
.chat-input .mic { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; border: 0; background: var(--bg2); color: var(--link);
                   display: grid; place-items: center; }
.chat-input .mic:disabled { opacity: .5; }
.chat-input .cancel, .chat-input .clock { display: none; }
/* enregistrement en cours : chronomètre à la place du champ, micro rouge, croix pour annuler */
.chat-input.recording textarea, .chat-input.recording .send { display: none; }
.chat-input.recording .clock { display: flex; flex: 1; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 18px;
                               background: var(--red-soft); color: var(--red); font-weight: 650; font-variant-numeric: tabular-nums; }
.chat-input.recording .cancel { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%;
                                border: 0; background: var(--bg2); color: var(--hint); }
.chat-input.recording .mic { background: #d42a30; color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 42, 48, .45); } 50% { box-shadow: 0 0 0 8px rgba(212, 42, 48, 0); } }

/* ---------- menu du thème ---------- */
.menu { position: fixed; z-index: 13; min-width: 240px; max-width: calc(100vw - 16px); background: var(--bg); border-radius: 14px; padding: 6px;
        box-shadow: 0 16px 48px rgba(0,0,0,.22); border: 1px solid var(--sep); animation: menu-in .14s ease; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0;
             background: none; border-radius: 10px; text-align: left; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg2); }
.menu-item.on { color: var(--link); font-weight: 650; }
.menu-item .m { margin-top: 0; font-weight: 400; }
.menu-item > svg.i:last-child { color: var(--link); }

/* ---------- dépôt de fichier, raccourcis ---------- */
.dropzone { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; pointer-events: none;
            background: color-mix(in srgb, var(--accent) 14%, rgba(0,0,0,.25)); opacity: 0; visibility: hidden; transition: opacity .15s; }
.dropzone.on { opacity: 1; visibility: visible; }
.dropzone .box { background: var(--bg); border: 2px dashed var(--accent); border-radius: var(--r-l); padding: 28px 32px; max-width: 460px;
                 text-align: center; display: grid; gap: 8px; justify-items: center; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.dropzone .box svg.i { width: 34px; height: 34px; color: var(--accent); }
.dropzone .box .m { justify-content: center; }
.shortcuts { display: grid; gap: 2px; }
.shortcuts .sc { display: flex; gap: 12px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--sep); font-size: 14px; }
.shortcuts .kbd { flex: 0 0 136px; white-space: normal; text-align: center; margin: 0; font-size: 12px; padding: 3px 6px; color: var(--text); background: var(--bg2); }

.bank-return { max-width: 520px; margin: 12vh auto 0; padding: 16px; text-align: center; }
.bank-return .big-count { margin: 0 auto 8px; }
.bank-return h1 { font-size: 22px; margin: 8px 0; }
.bank-return p { color: var(--hint); line-height: 1.5; }

/* ================= FORMATS D'ÉCRAN =================
   1. La NAVIGATION suit la fenêtre (barre du bas sous 900 px, barre latérale au-delà).
   2. La MISE EN PAGE du contenu suit la place réellement disponible dans « main » (requêtes de conteneur) :
      elle reste juste quand le chat est ouvert, sur tablette ou dans une petite fenêtre Telegram. */

/* ---------- téléphone ---------- */
@media (max-width: 899px) {
  header .kbd { display: none; }
}
@media (max-width: 599px) {
  #browserBtn, #fullBtn { display: none !important; }  /* fenêtre étroite : rangés dans « Plus » */
}
@media (max-width: 400px) {
  #refreshBtn { display: none; }  /* petit téléphone : « Actualiser » est dans « Plus » (et l'actualisation est automatique) */
}
@media (max-width: 480px) {
  .chat-btn { width: 44px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  :root { --gutter: 12px; }
}
/* Téléphone en paysage : la hauteur est rare, barre du bas compacte et en-tête resserré. */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --tabbar: 50px; }
  nav.tabbar button { flex-direction: row; gap: 6px; font-size: 13px; }
  nav.tabbar button svg.i { width: 20px; height: 20px; }
  nav.tabbar .badge { position: static; margin-left: 2px; }
  header { padding-top: calc(8px + var(--top-inset)); }
  header h1 { font-size: 18px; }
  .fab { width: 48px; height: 48px; bottom: calc(var(--tabbar) + 12px + var(--b-safe)); }
  .day-card { padding: 12px 14px; gap: 10px; }
  .dc-tile { min-height: 80px; }
}
/* Écrans tactiles (classe « touch » posée par core.js) : toutes les commandes font au moins 44 px. */
.touch .btn.small, .touch .seg button, .touch .chip, .touch .inline-input, .touch .quick input { min-height: 44px; }
.touch .bubble .more { min-height: 44px; }
.touch .seg button { min-width: 44px; }
.touch .section-title .link { padding: 14px 10px; margin: -14px -10px; }
.touch .explain .link { padding: 14px 6px; margin: -14px -6px; }
/* étiquette de priorité : bordure transparente = zone tactile de 44 px, la pastille visible ne change pas */
.touch .section-title .level { border: 10px solid transparent; background-clip: padding-box; margin: -10px -10px -10px 0; }
.touch .chat-input textarea { min-height: 44px; }

/* ---------- mise en page selon la place disponible ---------- */
@container main (min-width: 600px) {
  .top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
  .top .kpis { margin-top: 0; }
  .day-card { padding: 20px; gap: 14px; }
  .dc-head h2 { font-size: 19px; }
  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }
  .kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0 20px; align-items: start; }
  .companies { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  svg.chart { height: 220px; }
  .handle-sec { flex: 1 1 380px; }
  .handle-sec.wide { flex-basis: 100%; }
  .cards-grid { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
  .days-strip { display: none; }
  .week { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); background: var(--bg); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
  .week .h { font-size: 12px; font-weight: 650; padding: 10px 4px; border-bottom: 1px solid var(--sep); text-align: center; }
  .week .h.today { color: var(--link); }
  .week .allday { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--sep); min-height: 8px; }
  .week .allday div { padding: 3px; display: grid; gap: 3px; }
  .week .hours { position: relative; border-right: 1px solid var(--sep); }
  .week .hours span { position: absolute; right: 6px; font-size: 12px; color: var(--hint); transform: translateY(-50%); }
  .week .daycol { position: relative; border-left: 1px solid var(--sep); }
  .week .daycol.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
  .week .line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--sep); }
  .week .evt { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 6px; font-size: 12px; overflow: hidden;
               background: var(--soft); color: var(--link); border-left: 3px solid var(--accent); line-height: 1.25; cursor: default; }
  /* titre sur 2 lignes si la case le permet ; heure et lieu ensuite (détail complet au survol) */
  .week .evt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 650;
                 color: var(--text); overflow-wrap: anywhere; }
  .week .pill { font-size: 12px; border-radius: 6px; padding: 2px 6px; background: var(--violet-soft); color: var(--violet);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .week .now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 2; }
  .agenda-list { display: none; }
}
@container main (min-width: 1000px) {
  .cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr); }
}
/* Grand écran : quatre colonnes (À faire · Agenda · À traiter · Échéances) et les quatre indicateurs alignés. */
@container main (min-width: 1400px) {
  .cols.three { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cols.three > .split { display: contents; }
  .top { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .top .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- ordinateur et grande tablette : barre latérale (pas sur un écran peu haut, ex. téléphone en paysage) ---------- */
@media (min-width: 900px) and (min-height: 521px) {
  body { font-size: 15.5px; padding-left: var(--side); }
  :root { --gutter: 32px; }
  /* contenu centré jusqu'à 1 600 px : l'en-tête et ses boutons restent alignés avec lui */
  header, main { max-width: var(--content-max); margin-inline: auto; }
  header { padding-top: calc(22px + var(--top-inset)); padding-bottom: 10px; }
  header h1 { font-size: 26px; }
  main { padding-top: 8px; padding-bottom: 48px; }
  nav.tabbar { top: 0; bottom: 0; right: auto; width: var(--side); display: flex; flex-direction: column; gap: 2px;
               padding: calc(22px + var(--top-inset)) 12px 24px calc(12px + var(--l)); border-top: 0; border-right: 1px solid var(--sep); }
  nav.tabbar .brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 750; letter-spacing: -.02em; padding: 0 10px 20px; }
  nav.tabbar .brand span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--accent-text);
                           background: linear-gradient(135deg, var(--btn), color-mix(in srgb, var(--btn) 65%, #5b21b6)); }
  nav.tabbar { overflow-y: auto; }  /* écran peu haut (téléphone en paysage) : la barre défile, les boutons gardent 44 px */
  nav.tabbar button { height: 44px; flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; }
  nav.tabbar button svg.i { width: 19px; height: 19px; }
  nav.tabbar button.on { background: var(--soft); }
  nav.tabbar button.desk { display: flex; }
  nav.tabbar button.more { display: none; }
  nav.tabbar .badge { position: static; margin-left: auto; }
  nav.tabbar button.talk { margin-top: auto; background: var(--soft); color: var(--link); }
  nav.tabbar button.talk.on { background: var(--btn); color: var(--accent-text); }
  .fab { right: calc(32px + var(--r-safe)); bottom: 32px; }
  .toast { left: auto; right: 32px; bottom: 32px; width: 420px; }
  .sheet { left: auto; right: 32px; bottom: 32px; width: 480px; border-radius: 20px; max-height: calc(var(--app-h) * .8); }
  .palette { left: calc(var(--side) + (100vw - var(--side)) / 2 - 320px); right: auto; width: 640px; top: calc(80px + var(--top-inset)); }
  aside.chat { left: auto; width: 420px; box-shadow: -10px 0 40px rgba(0,0,0,.12); }
}
/* Très grand écran : la conversation reste ouverte à droite, le tableau de bord se resserre à côté. */
@media (min-width: 1200px) and (min-height: 521px) {
  aside.chat { width: var(--chat-w); box-shadow: none; border-left: 1px solid var(--sep); }
  body.chat-open { padding-right: var(--chat-w); }
  body.chat-open .fab, body.chat-open .toast, body.chat-open .sheet { right: calc(var(--chat-w) + 32px); }
  body.chat-open .palette { left: calc(var(--side) + (100vw - var(--side) - var(--chat-w)) / 2 - 320px); }
}
@media (min-width: 2200px) {
  body { font-size: 16px; }
  :root { --side: 260px; --chat-w: 440px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* conseils (holding et dividendes) */
.tips { margin: 8px 0; padding-left: 18px; display: grid; gap: 8px; line-height: 1.45; }
body:has(.palette.on) .fab { display: none; }  /* la recherche ouverte passe devant le bouton + */

/* ---------- sous-onglets d'un écran (Finances, Agenda, Mails, Réglages) ---------- */
.subtabs { position: sticky; top: var(--top-inset); z-index: 7; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
           padding: 8px 2px 10px; margin: 2px -2px 4px; background: var(--bg2); }
.subtabs::-webkit-scrollbar { display: none; }
.subtab { flex: none; border: 0; border-radius: 999px; padding: 0 16px; min-height: 40px; font-size: 14px; font-weight: 650;
          background: var(--bg); color: var(--text); box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.subtab:hover { background: color-mix(in srgb, var(--bg) 80%, var(--accent)); }
.subtab.on { background: var(--btn); color: var(--accent-text); }
.subtab .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #d42a30; color: #fff; font-size: 12px;
                 font-weight: 700; display: inline-grid; place-items: center; }
.subtab.on .count { background: #fff; color: #b3141a; }
.touch .subtab { min-height: 44px; }
/* Finances : bandeau des trois chiffres clés (3 colonnes ; lignes compactes sur téléphone) */
.kpis.band { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; }
@container main (max-width: 599px) {
  .kpis.band { grid-template-columns: 1fr; gap: 6px; }
  .kpis.band .kpi { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; min-height: 48px; }
  .kpis.band .kpi b { font-size: 17px; }
}
.settings-group { max-width: 980px; }

/* registre consolidé, positions par groupes */
.ledger-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.ledger-totals b { font-size: 19px; }
@container main (max-width: 459px) { .ledger-totals { grid-template-columns: 1fr; } .ledger-totals > div { display: flex; justify-content: space-between; align-items: baseline; } }
.notice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--orange-soft); border-radius: var(--r-s); padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.notice > svg.i { color: var(--orange); flex: none; }
.notice .grow { flex: 1 1 14rem; min-width: 0; }
.card > .notice.pad { margin: 8px 12px; }
.item.group-head { background: var(--bg2); }
.item.sub-line .t { font-size: 14px; }
.item.total-line { border-top: 2px solid var(--sep); }

/* plan de remboursement : réglages par palier */
.item.palier .row-actions { margin-top: 6px; }
.flex-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.flex-row .grow { flex: 1 1 10rem; min-width: 0; }
.item.palier .notice { margin: 6px 0 0; }

/* graphique : bornes et valeur pointée */
.chart-box { position: relative; touch-action: pan-y; }
.chart-box .axis { position: absolute; left: 4px; font-size: 12px; color: var(--hint); background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 0 4px; border-radius: 4px; pointer-events: none; }
.chart-box .axis.top { top: 12px; } .chart-box .axis.bottom { bottom: 2px; }
.chart-tip { position: absolute; top: 4px; min-width: 120px; text-align: center; font-size: 13px; font-weight: 650; background: var(--text); color: var(--bg);
             border-radius: 8px; padding: 4px 8px; pointer-events: none; }
