/* 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. */
/* (en sombre, l'ombre ne se voit pas : un fin liseré clair détache les cartes, puces et boutons du fond) */
:root[data-theme="dark"] {
  --red: #ff8085; --orange: #ffa25e; --green: #57d896; --violet: #c9b0ff;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .07), 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 0 0 1px rgba(255, 255, 255, .07), 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; }
header .date .short { display: none; }
@media (max-width: 400px) { header .date .long { display: none; } header .date .short { display: inline; } }
.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); }
.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; }
/* titres sur deux lignes : coupés en lignes de longueur égale, jamais un mot seul en bas */
.section-title, h2, h3 { text-wrap: balance; }
/* 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; }
.item.queued { opacity: .6; }  /* faite hors connexion : partira au retour du réseau */
.item.queued .t { text-decoration: line-through; }
.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); }
/* Bouton teinté : l'action d'une ligne parmi d'autres ; le bouton plein reste unique dans la carte. */
.btn.tinted { background: var(--soft); color: var(--link); }
.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; }
.shared-files { margin: 4px 0 12px; padding-left: 18px; overflow-wrap: anywhere; }
.shared-files li { margin: 4px 0; }
.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: opacity .16s, transform .16s, visibility .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 .grow > .row-actions { margin-top: 8px; }  /* gestes sous un texte long (mémoire, messages) */
.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 ---------- */
/* 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.up { animation-name: menu-up; }  /* (ouvert au-dessus de son bouton) */
@keyframes menu-up { 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: 480px) {
  :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; }
  .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; }

/* ---------- application installée : connexion, hors connexion, renouvellement ---------- */
.login { max-width: 420px; margin: 10vh auto 0; padding: 16px; text-align: center; }
.login .card { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 24px 20px; }
.login-logo { align-self: center; border-radius: 16px; }
.login h1 { font-size: 24px; margin: 4px 0 0; }
.login .m { color: var(--hint); line-height: 1.45; margin: 0; }
.login .small { font-size: 13px; }
.login .btn { min-height: 48px; justify-content: center; }
.login-main { margin-top: 12px; }
.login-sep { display: flex; align-items: center; gap: 10px; color: var(--hint); font-size: 13px; margin: 8px 0; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line, rgba(127,127,127,.25)); }
.login-msg { min-height: 1.4em; margin: 6px 0 0; font-size: 14px; }
.login-msg.bad { color: var(--red); }
.notice.offline-note { background: var(--bg); border: 1px dashed var(--hint); }
.notice.renew-note > svg.i { color: var(--accent); }
.notice.renew-note .btn { margin-left: auto; }
/* verrouillage : tout est masqué tant que l'empreinte (ou Windows Hello) n'est pas validée */
body.locked > :not(.lock-screen) { visibility: hidden !important; }
.lock-screen { position: fixed; inset: 0; z-index: 1000; background: var(--bg2); display: grid; place-items: center; padding: 16px;
  overflow-y: auto; }
.lock-card { width: 100%; max-width: 400px; background: var(--bg); border-radius: var(--r-l, 18px); padding: 28px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 10px; }
.lock-card h1 { font-size: 22px; margin: 4px 0 0; }
.lock-card .m { color: var(--hint); margin: 0; line-height: 1.45; }
.lock-card .btn { min-height: 48px; justify-content: center; }
.lock-card .login-logo { align-self: center; border-radius: 16px; }

/* ---------- Finances › Récap : périmètre, indicateurs, répartition, charges ---------- */
.perimeter { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin: 8px 0 2px; }
.perimeter .chips { flex: 1 1 16rem; }
.perimeter .chip { min-height: 36px; padding: 6px 14px; background: var(--bg); box-shadow: var(--shadow); }
.perimeter .chip.on { background: var(--soft); color: var(--link); }
.touch .perimeter .chip { min-height: 44px; }  /* (au doigt : 44 px, comme les autres puces) */
.perimeter-note { margin: 6px 4px 0; font-size: 13px; }
.recap-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.recap-kpis .kpi .m { display: block; font-size: 12px; margin-top: 2px; }
.kpi.warn b { color: var(--orange); }
@media (min-width: 900px) { .recap-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.split-row + .split-row, .cat-row + .cat-row { margin-top: 12px; }
.split-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.split-head .name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.split-head b.red { color: var(--red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.split-row .bars { margin: 6px 0 4px; }
.cat-track { position: relative; height: 10px; border-radius: 6px; background: var(--bg2); margin-top: 6px; }
.cat-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); }
.cat-track i.over { background: var(--orange); }
.cat-track .avg { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.item b.amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.item b.amount.red { color: var(--red); }
.chart-tip.multi { text-align: left; display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.chart-tip.multi span { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.chart-tip.multi i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.recap-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .recap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; } }
/* Récap : lignes cliquables et détail « D'où vient ce chiffre ? » */
button.split-row, button.cat-row { display: block; width: 100%; border: 0; background: none; padding: 6px 8px; margin-left: -8px; margin-right: -8px;
  width: calc(100% + 16px); text-align: left; color: inherit; font: inherit; border-radius: var(--r-s); cursor: pointer; }
button.split-row:hover, button.cat-row:hover { background: var(--bg2); }
.kpi.bad b { color: var(--red); }
.recap-hint { margin: 6px 4px 0; font-size: 12px; }
.detail-list { display: flex; flex-direction: column; margin-top: 8px; max-height: min(60vh, 520px); overflow-y: auto; }
.detail-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); margin: 12px 0 4px; }
.detail-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 18%, transparent); }
.detail-row .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.detail-row b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.detail-row b.red { color: var(--red); }
.detail-row.sub-total .t { font-weight: 650; }
.detail-row.total { border-bottom: 0; border-top: 2px solid var(--text); margin-top: 4px; }
.detail-row.total .t, .detail-row.total b { font-weight: 750; font-size: 16px; }
/* Conseils de Cresus */
.item.advice { align-items: flex-start; }
.advice-action { margin-top: 6px; font-size: 14px; line-height: 1.45; }
.item.advice .row-actions { margin-top: 8px; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips.classify { margin-top: 12px; gap: 8px; }
.chips.classify .chip { min-height: 40px; padding: 8px 14px; }
.detail-row .grow .btn.small { margin-top: 6px; }
.card.week-advice { margin-top: 12px; }
.card.week-advice .item { align-items: center; }
.kpi .kpi-split { display: block; font-size: 12px; margin-top: 4px; }
/* Charges : rapprochement des sorties, familles dépliables, portée du classement */
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg2); margin: 6px 0 2px; }
.split-bar i { display: block; height: 100%; }
.cat-sub { margin: 0 0 8px 12px; padding-left: 10px; border-left: 2px solid color-mix(in srgb, var(--hint) 30%, transparent); }
.cat-sub .detail-row { padding: 6px 0; }
.seg.classify-scope { margin: 10px 0 4px; display: flex; flex-wrap: wrap; }
.seg.classify-scope button { flex: 1 1 auto; }
/* Charges lot 2 : fournisseurs, suggestions */
.item.supplier .cat-track { margin-top: 6px; }
.item.suggestion .row-actions { margin-top: 8px; }
/* Clôture, banques */
.item.closing-item { flex-wrap: wrap; }
.item.closing-item > .btn { margin-left: 46px; }
.bank-list { display: grid; gap: 6px; margin-top: 10px; }
.item.wrap .grow .field { margin-top: 8px; width: 100%; }
/* Un seul modèle pour fermer : ✕ en haut à droite, « Retour » à gauche si on vient d'une liste, poignée à glisser */
.sheet-top { position: sticky; top: -8px; z-index: 2; display: flex; align-items: center; justify-content: space-between;
             margin: -8px -16px 6px; padding: 6px 8px 2px; background: var(--bg); min-height: 44px; }
.sheet-top .grab { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); margin: 0; }
.sheet-close { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--bg2); color: var(--text);
               display: grid; place-items: center; cursor: pointer; }
.sheet-close:hover { filter: brightness(.95); }
.sheet-back { border: 0; background: none; color: var(--link); font-weight: 650; font-size: 15px; display: inline-flex; align-items: center;
              gap: 4px; min-height: 44px; padding: 0 8px; cursor: pointer; }
.palette-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 20px;
                 background: var(--bg2); color: var(--text); display: grid; place-items: center; cursor: pointer; }
#paletteInput { padding-right: 56px; }
@media (hover: hover) and (pointer: fine) { .sheet-top .grab { display: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
/* Tâches : « ⋯ » visible, date précise */
.item .task-more { flex: none; color: var(--hint); }
.item .task-more:hover { color: var(--text); }
.date-pick { margin-top: 12px; flex-wrap: wrap; }
.date-pick .field { flex: 1 1 10rem; min-width: 0; }
.grid-actions.one { grid-template-columns: 1fr; }
.item.suggestion .proof { color: var(--text); }
.doc-text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--bg2); border-radius: 12px; padding: 12px; }
.rename-row { margin-top: 10px; }
.suggest-note { padding-bottom: 0; }
.suggest-actions { justify-content: flex-end; flex-wrap: wrap; padding-top: 8px; }
/* Équipe : avatars illustrés, cartes, budget, conversation */
.avatar { position: relative; flex: none; display: inline-block; border-radius: 50%; }
.avatar svg { display: block; border-radius: 50%; }
.avatar .ai-pill { position: absolute; right: -4px; bottom: -2px; font-size: 9px; font-weight: 750; line-height: 1; padding: 2px 4px;
                   border-radius: 6px; background: var(--bg); color: var(--hint); border: 1px solid var(--sep); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.agent-card { border: 0; text-align: left; background: var(--bg); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow);
              width: 100%; display: grid; gap: 10px; cursor: pointer; color: var(--text); }
.agent-card.paused { opacity: .7; }
.agent-card .name { font-weight: 700; font-size: 17px; }
.agent-head { display: flex; gap: 14px; align-items: center; }
.agent-hero .big { font-size: 26px; font-weight: 750; }
.agent-hero .mandate { margin-top: 12px; }
.watch-list { margin: 6px 0 0; padding-left: 20px; color: var(--hint); font-size: 14px; }
.budget-bar { height: 8px; border-radius: 4px; background: var(--bg2); overflow: hidden; margin: 10px 0 6px; }
.budget-bar.small { height: 6px; margin: 0; }
.budget-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.budget-bar i.warn { background: var(--orange); }
.feed-filter { padding: 12px 16px 4px; flex-wrap: wrap; }
.item.feed-item.alert .t { color: var(--orange); }
.agent-conv { display: grid; gap: 12px; margin: 14px 0 8px; }
.agent-conv .qa { background: var(--bg2); border-radius: 12px; padding: 12px; }
.agent-conv .q { font-weight: 650; margin-bottom: 6px; }
.agent-conv .a { white-space: pre-wrap; line-height: 1.5; }
.agent-conv ul { margin: 6px 0 0; padding-left: 20px; }
.verify { color: var(--orange); }
.settings-agent .item { flex-wrap: wrap; }
.feed-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.feed-filter .chip { flex: none; }
.tag.agent-badge { display: inline-flex; align-items: center; gap: 6px; }
.tag.agent-badge i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.agent-conv .sources { margin-top: 8px; }
.agent-conv .sources ol { margin: 4px 0 0; padding-left: 20px; font-size: 14px; }
.agent-conv .sources a { color: var(--link); overflow-wrap: anywhere; }
.agent-conv .second { margin-top: 10px; border-left: 3px solid var(--sep); padding: 4px 0 4px 10px; }
.agent-conv .second ul { margin: 4px 0 0; padding-left: 20px; }
.agent-conv .qa .btn { margin-top: 8px; }
.drill-steps { margin: 8px 0; padding-left: 20px; font-size: 14px; color: var(--hint); }
.drill-steps li { margin: 3px 0; }
/* liens des sources : zone de toucher de 44 px sur téléphone */
.agent-conv .sources li { margin: 2px 0; }
.agent-conv .sources a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; }
/* Équipe : chef d'équipe, pôles, fiche de poste, contrôle de Cresus, 👍/👎, journal */
.lead-card { margin-bottom: 4px; }
.pole-title { margin: 14px 0 8px; }
.model-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--sep); font-size: 14px; }
.model-row:last-of-type { border-bottom: 0; }
.agent-conv .origin { margin-bottom: 4px; }
.control { margin-top: 8px; }
.control .ok { color: var(--green); }
.qa-foot { margin-top: 8px; align-items: center; }
.rating { display: inline-flex; gap: 6px; flex: none; }
.agent-conv .qa .rating .btn, .rating .btn.rate { margin-top: 0; min-width: 44px; min-height: 44px; justify-content: center; }
.rating .btn.rate.on { background: var(--accent-soft, var(--bg2)); outline: 2px solid var(--accent); }
.journal-row { align-items: center; flex-wrap: wrap; }
/* Équipe : mémoire de l'équipe (propositions, dossier permanent) */
.proposal { align-items: flex-start; }
.proposal .tag { margin: 4px 0; display: inline-block; }
.proposal-actions { flex-wrap: wrap; margin-top: 8px; }
.dossier-item { align-items: flex-start; }
.dossier-item .tag { margin-top: 4px; display: inline-block; }
.sources-links { display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 14px; }
.sources-links a { color: var(--link); display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
/* Équipe : qualité, points de contrôle */
button.item.quality-row { width: 100%; text-align: left; cursor: pointer; }
.control-row { flex-wrap: wrap; align-items: center; }
.control-row .seg { flex: none; }

/* ---------- Jour en 5 cartes (audit étape 5) : À faire maintenant, Aujourd'hui, argent, conseil, Voir tout ---------- */
.jour-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; align-items: start; }
.jour-side > .card:first-child { margin-top: 12px; }
.now-card { margin-top: 12px; }
.now-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.now-head h2 { font-size: 17px; margin: 0; flex: 1 1 auto; min-width: 0; }
.now-item { padding-left: 0; padding-right: 0; }
.now-item .grow { min-width: 0; }
.now-acts { margin-top: 8px; flex-wrap: wrap; gap: 8px; }
.today-card .today-ev { width: 100%; border: 0; background: none; text-align: left; padding: 8px 0; min-height: 44px; }
.today-card .today-ev .time { flex: none; width: 52px; font-variant-numeric: tabular-nums; color: var(--hint); font-weight: 650; }
.today-card .today-ev .grow { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; }
.today-card .today-ev.next .t { font-weight: 700; }
.today-card .today-ev.next .time { color: var(--link); }
.money-line .item { width: 100%; border: 0; background: none; text-align: left; padding: 0; min-height: 44px; }
.money-line .grow { display: flex; flex-direction: column; min-width: 0; }
.money-line .link { color: var(--link); font-weight: 650; flex: none; }
.wide-btn { display: flex; width: 100%; justify-content: center; margin-top: 14px; min-height: 46px; }
@media (min-width: 900px) and (min-height: 521px) {
  .jour-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}
.now-open { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; border: 0; background: none;
            padding: 0; text-align: left; min-height: 44px; color: inherit; font: inherit; }
.now-open .m { color: var(--hint); }
.now-preview { white-space: pre-wrap; background: var(--bg2); border-radius: var(--r); padding: 12px 14px; margin: 10px 0 4px;
               max-height: 50vh; overflow: auto; font-size: 14px; line-height: 1.45; }
@media (max-width: 599px) {
  .now-item > .ic { display: none; }                 /* téléphone : toute la largeur pour le texte et les gestes */
  .now-acts { gap: 6px; }
  .now-acts .btn { padding: 9px 11px; }
}
.week-done { margin: -4px 4px 8px; }

/* ---------- en-tête : barre « Rechercher ou demander à Cresus » (✦ : la conversation), + Nouveau, ton menu ----------
   Modèles : la barre de recherche toujours visible et au centre (Notion, Linear, Slack), « + Nouveau » (Google Drive,
   Notion), le profil en bas de la barre latérale (Notion, Linear, Slack). Sur ordinateur, l'en-tête ne garde que la
   recherche et « + Nouveau », au centre ; ton menu est en bas de la barre latérale. Sur téléphone, le rond de ton initiale
   reste en haut à droite et le + flottant reste, avec une marge en bas pour qu'il ne cache jamais un bouton. */
.hcenter { display: contents; }  /* (téléphone : la barre et « + Nouveau » se placent comme des éléments de l'en-tête) */
.search-bar { flex: 0 1 460px; min-width: 0; height: 44px; display: flex; align-items: center; gap: 4px; padding-right: 4px;
              border: 1px solid var(--sep); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow); }
.search-open { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; border: 0;
               border-radius: 12px; background: none; color: var(--hint); font: inherit; font-size: 15px; text-align: left; cursor: text; }
.search-open svg.i { flex: none; width: 18px; height: 18px; }
.search-open .ph { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-open .kbd { flex: none; margin: 0; }
.search-ask { display: grid; flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; place-items: center;
              background: var(--btn); color: var(--accent-text); }
.search-ask.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--btn) 55%, transparent); }  /* conversation ouverte */
.search-ask svg.i { width: 18px; height: 18px; }
.me-btn { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center;
          background: var(--btn); color: var(--accent-text); font-size: 17px; font-weight: 750; }
.new-btn { display: none; }
.menu-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hint); padding: 8px 12px 2px; }
.menu-sep { height: 1px; background: var(--sep); margin: 6px 4px; }
.menu-item .kbd { margin-left: auto; }
.menu { overflow-y: auto; overscroll-behavior: contain; }
body.menu-open .fab { visibility: hidden; }  /* (un menu ouvert : le + flottant ne le recouvre pas) */
.palette-ask { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-top: 1px solid var(--sep);
               padding: 12px 18px; background: var(--bg); color: var(--link); font: inherit; font-weight: 650; text-align: left; }
.palette-ask[hidden] { display: none; }
.palette-ask .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-ask svg.i { flex: none; color: var(--link); }
@media (min-width: 900px) and (min-height: 521px) {
  .new-btn:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; flex: none; border: 0; border-radius: 12px; min-height: 44px;
             padding: 0 12px; font: inherit; font-weight: 650; background: var(--soft); color: var(--link); }
  .new-btn svg.i:last-child { width: 16px; height: 16px; }
  .fab { display: none; }
}
/* Ordinateur : le titre à gauche, la recherche et « + Nouveau » au centre de la colonne du contenu (680 px au plus).
   Fenêtre plus étroite (ou conversation ouverte à droite) : le titre garde sa place (jamais rogné), le groupe se cale
   juste après lui et la barre rétrécit. */
@media (min-width: 900px) and (min-height: 521px) {
  header { display: grid; grid-template-columns: minmax(215px, 1fr) minmax(0, 680px) minmax(0, 1fr); column-gap: 16px; }
  header .hcenter { display: flex; align-items: center; gap: 10px; min-width: 0; }
  header .hcenter .search-bar { flex: 1 1 0; }
  header #meBtn { display: none; }
}
/* écran d'ordinateur étroit (Telegram Desktop réduit) : « + » seul, pour laisser la place au titre et à la barre */
@media (min-width: 900px) and (max-width: 1099px) and (min-height: 521px) {
  .new-btn:not([hidden]) { gap: 0; padding: 0; width: 44px; justify-content: center; }
  .new-btn .lbl, .new-btn svg.i:last-child { display: none; }
}
/* fenêtre de moins de 1 200 px : « Ctrl K » masqué (la barre de recherche garde de la place) */
@media (max-width: 1199px) { .search-open .kbd { display: none; } }
/* téléphone et tablette debout : la barre en pleine largeur sous le titre */
@media (max-width: 899px) and (orientation: portrait) {
  header { flex-wrap: wrap; row-gap: 10px; }
  .search-bar { order: 5; flex: 1 0 100%; }
}
@media (max-width: 899px), (max-height: 520px) {
  .search-open .kbd { display: none; }
}
.touch .search-open .kbd { display: none; }
/* au doigt : barre de 52 px et ✦ de 44 px (cibles d'au moins 44 px) */
.touch .search-bar { height: 52px; }
.touch .search-ask { width: 44px; height: 44px; border-radius: 12px; }
/* téléphone en paysage (peu haut) : une seule ligne, la barre se partage la place avec le titre */
@media (orientation: landscape) and (max-width: 899px), (orientation: landscape) and (max-height: 520px) {
  .search-bar { flex: 1 1 220px; max-width: 460px; }
  header .who { flex: 0 1 auto; min-width: 150px; }
}
/* ton menu, en bas de la barre latérale (ordinateur seulement ; sur téléphone : le rond de ton initiale, en haut à droite) */
nav.tabbar .me-row { display: none; }
@media (min-width: 900px) and (min-height: 521px) {
  /* (fenêtre peu haute : la barre latérale défile, la ligne reste visible en bas) */
  nav.tabbar button.me-row { display: flex; margin-top: auto; height: auto; min-height: 56px; padding: 8px 10px; gap: 10px;
                             color: var(--text); text-align: left; position: sticky; bottom: 0; background: var(--bg); }
  nav.tabbar button.me-row:hover, nav.tabbar button.me-row[aria-expanded="true"] { background: linear-gradient(var(--soft), var(--soft)), var(--bg); }
  .me-row .av { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
                background: var(--btn); color: var(--accent-text); font-size: 15px; font-weight: 750; }
  .me-row .av svg.i { width: 18px; height: 18px; }
  .me-row .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .me-row .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .me-row .m { display: block; margin: 0; color: var(--hint); font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden;
               text-overflow: ellipsis; }
}
#paletteInput::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }  /* (une seule croix : la nôtre) */
@media (max-width: 899px), (max-height: 520px) {
  main { padding-bottom: calc(var(--tabbar) + 96px + var(--b-safe)); }
}
#sheet:focus { outline: none; }

/* ---------- Finances : grandes rubriques repliables (audit étape 7) ---------- */
.fold { scroll-margin-top: calc(var(--top-inset) + 72px); }
.fold + .fold { border-top: 1px solid var(--sep); margin-top: 18px; }
.fold-head { width: 100%; border: 0; background: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
             gap: 2px 10px; padding: 16px 4px 6px; min-height: 48px; text-align: left; color: var(--text); }
/* (petit écran : le chiffre clé passe sous le titre plutôt que de l'écraser) */
.fold-title { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 720; letter-spacing: -.01em; text-wrap: balance;
              flex: 1 1 11rem; min-width: 0; }
.fold-title svg.i { width: 18px; height: 18px; color: var(--hint); transition: transform .18s; flex: 0 0 18px; }
.fold-head[aria-expanded="true"] .fold-title svg.i { transform: rotate(90deg); }
.fold-aside { color: var(--hint); font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; margin-left: auto; }
.fold-aside.warn { color: var(--orange); }
.fold-body > .section-title:first-child { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .fold-title svg.i { transition: none; } }
/* Barre du bas sur téléphone : son propre ordre (Jour · À traiter · Finances · Tâches · Plus) ; la barre latérale garde le sien */
nav.tabbar button { order: var(--m-order, 8); }
@media (min-width: 900px) and (min-height: 521px) { nav.tabbar button { order: 0; } }
/* rubrique dans une rubrique (détail des charges) : plus discrète */
.fold .fold { border-top: 0; margin-top: 4px; }
.fold .fold .fold-head { padding: 12px 4px 4px; min-height: 44px; }
.fold .fold .fold-title { font-size: 15px; font-weight: 650; color: var(--link); }
.fold .fold .fold-title svg.i { color: var(--link); }
/* « Plus » : le chiffre d'un écran rangé là (ex. échéances de l'Agenda) */
.grid-actions .act .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; margin-left: 4px; }
/* Tirer vers le bas pour actualiser (téléphone, tablette) : le rechargement complet du navigateur est désactivé */
html, body { overscroll-behavior-y: contain; }
.ptr { position: fixed; z-index: 9; top: calc(var(--top-inset) - 44px); left: 50%; margin-left: -20px; width: 40px; height: 40px;
       border-radius: 50%; background: var(--bg); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); display: grid; place-items: center;
       color: var(--hint); opacity: 0; pointer-events: none; transition: opacity .12s; }
.ptr.on { opacity: 1; }
.ptr.ready { color: var(--link); }
.ptr.spin svg { animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ptr.spin svg { animation: none; } }
/* Équipe : « Demander à… » (audit étape 8) */
.ask-row { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-bottom: 10px; }
.ask-who { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; min-height: 64px;
           padding: 6px 4px; border-radius: 12px; color: var(--text); }
.ask-who:hover { background: color-mix(in srgb, var(--bg2) 55%, transparent); }
.ask-name { font-size: 13px; font-weight: 600; }
/* ---------- Personnaliser la barre du bas (lot b) ---------- */
nav.tabbar button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }  /* (appui long : notre panneau) */
.bar-preview { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px; margin: 10px 0 12px; border-radius: 14px;
               background: var(--bg2); }
.bar-chip { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--hint);
            text-align: center; min-width: 0; }
.bar-chip span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list { list-style: none; margin: 0 0 12px; padding: 0; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); overflow: hidden; }
.bar-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; min-height: 52px; background: var(--bg); }
.bar-row + .bar-row { border-top: 1px solid var(--sep); }
.bar-row .t { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bar-row .icon-btn { box-shadow: none; background: var(--bg2); }
.bar-row .icon-btn[aria-disabled="true"] { opacity: .35; }
.bar-handle { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; color: var(--hint); cursor: grab;
              touch-action: none; flex: 0 0 44px; user-select: none; }
.bar-row.dragging { box-shadow: 0 6px 18px rgba(0, 0, 0, .18); position: relative; z-index: 1; }
.bar-row.dragging .bar-handle { cursor: grabbing; }
.bar-sep { padding: 10px 14px 6px; font-size: 12.5px; font-weight: 650; color: var(--hint); text-transform: uppercase; letter-spacing: .05em;
           background: var(--bg2); }
/* texte réservé aux lecteurs d'écran (annonces) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: -1px; }

/* ---------- fiche d'un rendez-vous (lot c) ---------- */
.pressable { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
button.ev { width: 100%; border: 0; background: none; text-align: left; color: inherit; }
button.ev:hover { background: color-mix(in srgb, var(--bg2) 55%, transparent); }
button.ev + button.ev { border-top: 1px solid var(--sep); }
.week button.evt, .week button.pill { border-top: 0; border-right: 0; border-bottom: 0; text-align: left; display: block; width: auto; cursor: pointer; }
.week button.pill { border-left: 0; }
/* au doigt (tablette, pointeur principal tactile) : la liste du jour plutôt que la grille, dont les rendez-vous courts
   font 22 px de haut ; un ordinateur portable à écran tactile (souris ou pavé) garde la grille */
@media (pointer: coarse) {
  .week { display: none !important; }
  .agenda-list { display: block !important; }
  .days-strip { display: flex !important; }
}
.week button.pill { width: 100%; }
.ev-place { display: flex; align-items: center; gap: 4px; margin: 2px 0 10px; }
.ev-actions { margin: 6px 0 4px; }
.prep-box { white-space: pre-wrap; background: var(--bg2); border-radius: 12px; padding: 12px 14px; margin: 8px 0; font-size: 14px; line-height: 1.5; }
.ev-people { display: grid; gap: 2px; margin: 4px 0 6px; }
.ev-person { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--sep); font-size: 14px; }
.ev-person .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* lot e : ta réponse à une invitation, « Décaler », confirmation de ce qui part chez quelqu'un */
.ev-reply, .ev-shift { margin: 2px 0 8px; }
.seg.ev-seg { display: flex; width: 100%; }
.seg.ev-seg button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
                     color: var(--text); }
.seg.ev-seg button.on { background: var(--soft); color: var(--link); }
.ev-confirm { margin: 8px 0; font-size: 15px; line-height: 1.45; }
.ev-confirm-acts { margin-top: 14px; justify-content: flex-end; }

/* ---------- ta photo : dans les ronds (menu, ligne à ton nom, Réglages) et son recadrage ---------- */
.me-btn, .me-row .av, .profile-av { overflow: hidden; padding: 0; }  /* (la photo remplit tout le rond) */
.me-btn img, .me-row .av img, .profile-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.profile-av { flex: 0 0 64px; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
              background: var(--btn); color: var(--accent-text); font-size: 26px; font-weight: 750; }
.profile-av svg.i { width: 28px; height: 28px; }
.profile-row { gap: 14px; }
.photo-stage { display: block; width: min(300px, 100%); aspect-ratio: 1; margin: 12px auto 6px; border-radius: 16px;
               background: var(--bg2); touch-action: none; cursor: grab; }
.photo-stage.grabbing { cursor: grabbing; }
.photo-zoom-row { display: flex; align-items: center; gap: 12px; width: min(300px, 100%); margin: 0 auto 10px; }
.photo-zoom-row .m { margin: 0; }
.photo-zoom { flex: 1; min-width: 0; min-height: 44px; accent-color: var(--btn); }

/* ---------- voix : 🔊 écouter un message, choisir la voix de chacun (Réglages › Voix, fiche d'un expert) ---------- */
.speak-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; border: 0; border-radius: 10px;
             min-height: 36px; padding: 0 12px; background: var(--soft); color: var(--link); font: inherit; font-size: 13.5px; font-weight: 650; }
.speak-btn svg.i { width: 16px; height: 16px; }
.speak-btn.icon-only { width: 36px; padding: 0; }
.speak-btn.playing { background: var(--btn); color: var(--accent-text); }
.speak-btn.loading { opacity: .65; cursor: progress; }
.touch .speak-btn { min-height: 44px; }
.touch .speak-btn.icon-only { width: 44px; }
.bubble .when { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.bubble .when .speak-btn:not(.playing) { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; }
.voice-list .voice-row { gap: 10px; }
.voice-row.on { background: var(--soft); }
.voice-row .t .tag { margin-left: 8px; }
.voice-g { color: var(--hint); font-weight: 500; }
.voice-accents { margin: 4px 0 6px; }
.voice-credits { margin-top: 10px; }
.voice-person .row-actions { align-items: center; }
/* sous une réponse d'expert : la date garde sa place, les gestes (🔊, 👍/👎) passent à la ligne sur un petit écran */
.qa-foot > .m.grow { flex: 1 1 9rem; }

/* Réglages › Voix : consommation et coût */
.voice-costs .item { padding-left: 0; padding-right: 0; }          /* (tout aligné sur la marge de la carte) */
.voice-costs .item + .item::before { left: 0; }
.voice-costs .cost-top { padding-top: 0; }
.cost-bar { height: 8px; border-radius: 999px; background: var(--bg2); overflow: hidden; margin: 2px 0 10px; }
.cost-bar > i { display: block; height: 100%; background: var(--btn); border-radius: 999px; }
.cost-bar.low > i { background: var(--orange); }
.cost-lines { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.cost-lines .cost-main { font-weight: 650; }
/* les réglages : l'intitulé garde sa place, la liste passe à la ligne sur un petit écran */
.voice-costs .cost-row { flex-wrap: wrap; }
.voice-costs .cost-row > .grow { min-width: 9rem; }
.voice-costs select.field.cost-select { width: auto; min-width: 12rem; max-width: 100%; flex: 0 1 auto; }
.cost-help { margin-top: 6px; }
.voice-costs .notice { margin: 6px 0 8px; }

/* Mails : une rubrique par nature ; la raison du classement ; les suspects bien visibles */
.mail-groups > .card { margin-bottom: 4px; }
.mail-group .mail-hint { padding-bottom: 0; }
.mail-group.suspects { box-shadow: inset 0 0 0 1.5px var(--red); }
.mail-group > .notice { margin: 10px 12px 2px; }
.item.mail .mail-why { font-size: 12.5px; }
/* Mails, étape M2 : « ⋯ » au bout des gestes ; les spams d'expéditeurs connus, à vérifier */
.item.mail .row-actions .mail-more { margin-left: auto; }
.mail-group.spams { box-shadow: inset 0 0 0 1.5px var(--orange); }
.mail-bulk { flex-wrap: wrap; gap: 8px; }
.item.mail .mail-ask { font-size: 12.5px; color: var(--text); font-weight: 600; }

/* ---------- Lire un mail dans Cresus (mailreader.js) ---------- */
.sheet.wide { max-height: calc(var(--app-h) * .96); }
@media (min-width: 900px) and (min-height: 521px) {
  .sheet.wide { width: min(880px, calc(100vw - 320px)); max-height: calc(var(--app-h) - 48px); bottom: 24px; }
}
.item button.mail-open { display: block; width: 100%; border: 0; background: none; padding: 0; margin: 0; color: inherit;
                         font: inherit; font-weight: 600; text-align: left; cursor: pointer; min-height: 24px; }
.item button.mail-open:hover { text-decoration: underline; }
.reader .thread { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.mr-msg { background: var(--bg2); border-radius: 14px; padding: 4px 12px 10px; }
.mr-msg.mine { background: color-mix(in srgb, var(--accent) 12%, var(--bg2)); }
.mr-msg.draft { box-shadow: inset 0 0 0 1.5px var(--orange); }
.mr-head { display: flex; width: 100%; align-items: baseline; gap: 8px; border: 0; background: none; color: var(--text);
            padding: 8px 0 4px; min-height: 44px; font: inherit; text-align: left; cursor: pointer; }
.mr-from { font-weight: 650; overflow-wrap: anywhere; }
.mr-date { margin-left: auto; color: var(--hint); font-size: 12.5px; white-space: nowrap; }
.mr-peek { color: var(--hint); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-to { color: var(--hint); font-size: 12.5px; margin-bottom: 6px; overflow-wrap: anywhere; }
.mr-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.mr-quote { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--hint); font-size: 13.5px; border-left: 3px solid var(--sep);
             padding-left: 10px; margin-top: 6px; }
.reader .link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 0; background: none; padding: 0;
                color: var(--link); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.reader .link:hover { text-decoration: underline; }
.mr-quote-btn { display: flex; margin-top: 2px; }
.mr-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mr-files .chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px;
                   background: var(--bg); color: var(--link); text-decoration: none; font-size: 13.5px; overflow-wrap: anywhere; }
.mr-original { display: block; width: 100%; height: min(70vh, 640px); border: 1px solid var(--sep); border-radius: 10px;
                background: #fff; margin-top: 8px; }
.reply-box { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sep); scroll-margin-top: 56px; }
.reply-box h4 { margin: 0 0 4px; font-size: 16px; }
.reply-to { overflow-wrap: anywhere; margin-bottom: 6px; }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; overflow-wrap: anywhere; }
.check-line input { width: 20px; height: 20px; flex: none; }
.reply-text { width: 100%; min-height: 150px; resize: vertical; margin-top: 4px; }
.reply-hint { width: 100%; margin-top: 8px; }
.reply-notes { margin-top: 6px; color: var(--orange); }
.reply-actions, .reader-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reply-why { margin-top: 8px; }
.reader-actions { padding-top: 12px; margin-top: 16px; border-top: 1px solid var(--sep); }
.item.wrap > select.field.cost-select { width: auto; min-width: 9.5rem; max-width: 100%; flex: 0 1 auto; }
.limit-offer .row-actions { margin-top: 8px; }
.limit-row > .grow { flex: 1 1 14rem; }   /* (petit téléphone : le menu passe dessous au lieu d écraser le texte) */
.reader-todo { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sep); }
.reader-todo h4 { margin: 0 0 2px; font-size: 16px; }
.reply-why.no-reply { margin-top: 14px; color: var(--text); }
