/* style.css — feuille de style de l'app Budget.
   Extraite de l'ancien <style> de index.html le 20/09/2026.
   Refonte sur la charte UX/UI (UX_UI_CHARTER.md, v1.3) le 24/09/2026 :
   tokens renommés comme Muscu, échelle de radius à 5 crans, cards bordées,
   carte hero sobre, modales en bottom-sheet, zones tactiles >= 44px. */

/* =====================================================
   1. DESIGN TOKENS — identiques à la charte §1, §3, §4, §6.5
   Thème SOMBRE uniquement (mode clair retiré le 28/09/2026, 4 apps).
   ===================================================== */
:root {
    /* Fonds */
    --bg:            #0d1014;
    --card:          #161b22;
    --card-2:        #1e2530;
    /* Bordures neutres */
    --border:        rgba(255,255,255,0.09);
    --border-strong: rgba(255,255,255,0.17);
    /* Texte */
    --text:          #e9eff6;
    --text-dim:      #8a97a8;

    /* Identité couple */
    --corentin:      #1f8fff;
    --corentin-rgb:  31,143,255;
    --corentin-dark: #1a5fc4;
    --lisa:          #ff3d7e;
    --lisa-rgb:      255,61,126;
    --lisa-dark:     #c4225f;

    /* États sémantiques */
    --done:          #12b981;
    --danger:        #ef4444;
    --gold:          #ffb800;

    /* Couleurs de CATÉGORIES (seules couleurs hors charte conservées, car elles
       portent un sens : Répartition du mois, objectifs de provisions).
       Charges = --danger, Reste = --done. Ne pas les utiliser en décoration. */
    --cat-depenses:  #FF9500;
    --cat-provisions:#FFCC00;

    /* Accent dynamique (profil) */
    --accent:        var(--corentin);
    --accent-rgb:    var(--corentin-rgb);
    --accent-dark:   var(--corentin-dark);
    --accent-soft:   rgba(var(--accent-rgb), 0.14);
    --accent-glow:   rgba(var(--accent-rgb), 0.30);
    --tint:          rgba(var(--accent-rgb), 0.07);
    --tint-strong:   rgba(var(--accent-rgb), 0.13);

    /* Surfaces flottantes */
    --glass-bar:     rgba(19,24,31,0.86);
    --glass-modal:   rgba(22,27,34,0.95);

    /* Radius (5 crans) */
    --r-xs: 4px;  --r-sm: 10px;  --r-md: 14px;  --r-lg: 18px;  --r-xl: 22px;  --r-pill: 999px;

    /* Ombres */
    --shadow-sm: 0 6px 16px rgba(0,0,0,0.30);
    --shadow:    0 14px 32px rgba(0,0,0,0.44), 0 2px 8px rgba(0,0,0,0.28);
    --shadow-lg: 0 -8px 40px rgba(0,0,0,0.5);

    /* Durées (charte §6.5 / §11.3) */
    --t-fast: .15s;
    --t-mid:  .22s;

    --f-body: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", sans-serif;

    /* Barre d'onglets flottante (charte §5.5b) */
    --nav-offset:    max(20px, calc(env(safe-area-inset-bottom) - 12px)); /* ~22px sur iPhone (Course : ~4px) */
    --tabbar-height: calc(62px + var(--nav-offset));
}

/* Profil actif (Corentin = défaut, Lisa = accent rose) — préférence par appareil,
   purement visuelle : le compte et les données restent partagés. */
body.profil-lisa {
    --accent:      var(--lisa);
    --accent-rgb:  var(--lisa-rgb);
    --accent-dark: var(--lisa-dark);
}

/* 2. THÈME CLAIR — retiré le 28/09/2026 (sombre uniquement). */

/* 3. LAYOUT GLOBAL (charte §6.2) */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--f-body); -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg); color: var(--text); color-scheme: dark; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; -webkit-overflow-scrolling: touch; overscroll-behavior: none; }   /* transition de fond retirée le 12/10/2026 : reste du thème clair */
button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.txt-dim { color: var(--text-dim); }

/* Titres de page (« Septembre 2026 », « Bilan Annuel »…) — échelle charte §2 */
main h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.2px; }
.header-title-group { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 16px; }
.header-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.page-title { margin-bottom: 16px; }
.view-intro { color: var(--text-dim); font-size: 13.5px; line-height: 1.4; margin: -8px 0 16px; }

/* Bouton icône rond (ex. 🗑️ supprimer le mois) — zone tactile 44px */
.btn-icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; font-size: 17px; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.btn-icon:active { transform: scale(0.97); }
.btn-icon.danger { border-color: rgba(239,68,68,0.35); }

/* 4. ÉCRAN DE CONNEXION */
#login-screen { position: fixed; inset: 0; background: var(--bg); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--card); border: 1px solid var(--border); padding: 36px 26px; border-radius: var(--r-xl); box-shadow: var(--shadow); width: 100%; max-width: 400px; text-align: center; }
.login-box h1 { margin-bottom: 6px; font-size: 24px; font-weight: 700; }
.login-box p { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.login-box input { width: 100%; min-height: 48px; padding: 12px 15px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--card-2); margin-bottom: 12px; color: var(--text); }
.login-btn { width: 100%; min-height: 48px; padding: 14px; border-radius: var(--r-md); border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.login-btn:active { transform: scale(0.97); }
#login-error { color: var(--danger); font-size: 13.5px; margin-top: 15px; display: none; }

/* 5. EN-TÊTE (liste des mois) */
.top-nav { background-color: var(--card); border-bottom: 1px solid var(--border); padding: 15px; padding-top: calc(23px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.nav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.nav-header h2 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* Barre d'onglets flottante « pilule » (charte §5.5b). Fixe en bas, PAR-DESSUS
   le contenu. Le conteneur laisse passer les touches (pointer-events:none), seule
   la pilule les capte. Le nav garde la classe .tab-buttons (JS inchangé). */
.tabbar-flottante { position: fixed; left: 14px; right: 14px; bottom: var(--nav-offset); z-index: 150; display: flex; pointer-events: none; }
.tab-buttons { pointer-events: auto; flex: 1; min-width: 0; display: flex; gap: 4px; height: 62px; padding: 5px; border-radius: var(--r-pill);
    background: var(--glass-bar); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--border); box-shadow: var(--shadow); }
.btn-tab { flex: 1; min-width: 0; padding: 0; border: none; border-radius: var(--r-pill); background: transparent; color: var(--text-dim); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
    transition: background var(--t-mid) ease, color var(--t-mid) ease, transform var(--t-fast) var(--ease-out); }
.btn-tab:active { transform: scale(0.97); }
.btn-tab.active { background: var(--accent-soft); color: var(--accent); }
.btn-tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }

/* 6. LISTE DES MOIS */
.year-group { margin-bottom: 8px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.year-header { min-height: 44px; padding: 12px 15px; background: var(--card-2); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.year-header::after { content: '▼'; font-size: 10px; color: var(--text-dim); transition: transform var(--t-mid) var(--ease-out); }
.year-header.collapsed::after { transform: rotate(-90deg); }
.month-sublist { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.month-sublist.hidden { display: none; }
.month-pill { min-height: 44px; display: flex; align-items: center; padding: 10px 12px; background: var(--card); border-radius: var(--r-sm); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--border);
    transition: background var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease; }
.month-pill.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* 7. CONTENU PRINCIPAL */
.main-content { flex: 1; padding: 15px; max-width: 1000px; margin: 0 auto; width: 100%; padding-bottom: calc(var(--tabbar-height) + 24px); }

/* 8. FORMULAIRES & CHAMPS (16px minimum : pas de zoom automatique sur iOS) */
input, select, textarea { font-size: 16px !important; outline: none; background: transparent; color: var(--text); border: none; }
input[type="number"] { background: var(--card-2); border-radius: var(--r-sm); padding: 4px 8px; }
.search-container input { width: 100%; min-height: 44px; padding: 10px 15px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--card); margin-bottom: 15px; }
.select-annee { min-height: 44px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--border); font-weight: 700; }

/* 9. CARDS (charte §5.1) */
.card { background-color: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-header { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.card-header h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header::after { content: '▼'; font-size: 11px; color: var(--text-dim); transition: transform var(--t-mid) var(--ease-out); }
.card-header.collapsed::after { transform: rotate(-90deg); }
.card-header.collapsed { margin-bottom: 0; padding-bottom: 0; border-bottom-color: transparent; } /* carte repliée : pas de filet ni de vide sous le titre */
.section-content { overflow: hidden; } /* pas de transition : max-height passe de none à 0, non animable */
.section-content.collapsed { max-height: 0 !important; }

/* 10. LIGNES D'ARTICLES */
.item-row { display: flex; align-items: center; background: var(--card); padding: 10px 0; border-bottom: 1px solid var(--border); touch-action: pan-y; }
.item-row:last-child { border-bottom: none; }
.drag-handle { min-height: 44px; display: flex; align-items: center; padding: 0 10px 0 0; color: var(--text-dim); cursor: grab; font-size: 17px; touch-action: none; }
.item-content { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.item-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.item-top textarea { flex: 1; font-weight: 600; padding: 0; resize: none; min-height: 24px; overflow: hidden; font-size: 15px; }
.item-montant { display: flex; align-items: center; gap: 6px; }
.item-top input[type="number"] { width: 90px; min-height: 44px; text-align: right; font-weight: 700; border: none; }
.item-bottom { display: flex; gap: 8px; align-items: center; }
.item-bottom input[type="date"], .item-bottom select { flex: 1; min-width: 0; min-height: 44px; background: var(--card-2); font-size: 13px !important; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text-dim); }
/* Onglet Fixes (ligne minimaliste) */
.fix-content { flex-direction: row; align-items: center; justify-content: space-between; }
.fix-cat { flex: 1; min-width: 0; min-height: 44px; font-weight: 600; background: none; border: none; padding: 0; }
.fix-montant { width: 90px; min-height: 44px; text-align: right; font-weight: 700; }
.montant-neg { color: var(--danger) !important; }

/* Panneau de répartition du mode Mixte (carte/espèces) : boutons ±5€ + chiffre glissable */
.item-mixte { display: flex; flex-direction: column; gap: 8px; background: var(--card-2); border-radius: var(--r-md); padding: 12px 10px; touch-action: none; }
.mixte-label { text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.9px; color: var(--text-dim); }
.mixte-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.mixte-btn { width: 44px; height: 44px; min-width: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; line-height: 1; transition: transform var(--t-fast) var(--ease-out); }
.mixte-btn:active { transform: scale(0.97); }
.mixte-scrub { min-width: 80px; text-align: center; touch-action: none; cursor: ns-resize; user-select: none; }
.mixte-value { font-size: 22px; font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.mixte-hint { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: -2px; }
.mixte-recap { display: flex; flex-direction: column; gap: 5px; padding-top: 10px; border-top: 1px dashed var(--border); }
.mixte-recap-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-dim); font-weight: 600; }
.mixte-recap-row span:last-child { color: var(--text); font-weight: 800; font-size: 13px; }
/* Boutons de ligne — zones tactiles 44px (charte §6.4) */
.btn-delete { width: 44px; height: 44px; flex: 0 0 44px; display: flex; align-items: center; justify-content: center; color: var(--danger); background: none; border: none; font-size: 17px; margin-left: 4px; cursor: pointer; border-radius: var(--r-sm); }
.btn-delete:active { background: rgba(239,68,68,0.12); }
.btn-pay-method { width: 44px; height: 44px; flex: 0 0 44px; display: flex; align-items: center; justify-content: center; background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 17px; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.btn-pay-method:active { transform: scale(0.97); }

/* 11. BOUTONS D'ACTION (charte §5.3 / §5.4) */
.btn-action { min-height: 48px; padding: 14px; color: #fff; border-radius: var(--r-md); font-weight: 700; font-size: 15px; cursor: pointer; border: none; width: 100%; margin-bottom: 10px; transition: transform var(--t-fast) var(--ease-out); }
.btn-action:active { transform: scale(0.97); }
.card .btn-action { margin: 12px 0 0; }
.bg-primary { background: var(--accent); color: #fff; }
.bg-danger  { background: var(--danger); color: #fff; }
.bg-neutral { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-small { min-height: 44px; padding: 10px 16px; border-radius: var(--r-sm); border: none; background: var(--card-2); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.btn-small:active { transform: scale(0.97); }
.btn-small.bg-primary { background: var(--accent); color: #fff; }

/* 12. CARTE HERO « Reste à vivre » / « Total à diviser » / « Total Dépenses » (charte §5.2)
   Sobre : dégradé --card-2 → --card, l'accent n'est porté que par le chiffre. */
.summary-card { background: linear-gradient(140deg, var(--card-2), var(--card) 55%); color: var(--text); text-align: center; padding: 18px 16px 20px; }
.summary-card h3 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.9px; color: var(--text-dim); }
.total-amount { font-size: 34px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.sub-text { font-size: 13.5px; color: var(--text-dim); }
.sub-text + .sub-text { margin-top: 2px; }
.sub-text.strong { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 6px; }

/* 13. REVENUS */
.revenus-box { background: var(--card); padding: 8px 16px; border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.revenus-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 0; }
.revenus-row:not(:last-child) { border-bottom: 1px dashed var(--border); }
/* Début d'un nouveau groupe logique (reportés / à ajouter / ajouts en cours) */
.revenus-row.revenus-group-start { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.revenus-row strong { font-size: 13.5px; font-weight: 600; flex: 1; padding-right: 10px; }
.revenus-box input { width: 110px; min-height: 44px; text-align: right; border: 1px solid var(--border); padding: 6px 10px; border-radius: var(--r-sm); font-weight: 700; color: var(--accent); }
/* Champs en lecture seule (reports Revolut/Espèces) : non interactifs, visuellement neutres. */
.revenus-box input[readonly] { color: var(--text-dim); background: var(--card-2); border-style: dashed; cursor: default; }

/* 14. BARRES DE PROGRESSION */
.progress-container { margin-bottom: 12px; }
.progress-header { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.progress-track { background: var(--card-2); border-radius: var(--r-xs); height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transform-origin: left center; transition: transform .3s var(--ease-out); }
/* Jauges du mois (#bar-*-m) : pilotées par transform:scaleX() depuis app.js (charte §11.3).
   Les jauges d'objectifs (sans id) restent en width inline, statiques. */
.progress-fill[id^="bar-"] { width: 100%; transform: scaleX(0); }
.fill-charges    { background: var(--danger); }
.fill-depenses   { background: var(--cat-depenses); }
.fill-provisions { background: var(--cat-provisions); }
.fill-reste      { background: var(--done); }
.obj-bloc { margin-top: 18px; }

/* 15. MODALES — bottom-sheet (charte §5.9) */
.overlay-popup { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: flex-end; justify-content: center; animation: fondIn .22s var(--ease-out); }
.popup-box { width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; background: var(--glass-modal); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border); border-bottom: none; border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-lg);
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; animation: feuilleIn .28s var(--ease-drawer); }
.popup-box h3 { font-size: 19px; font-weight: 700; }
.popup-box .btn-action { margin: 0; }
.popup-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.popup-text { color: var(--text-dim); font-size: 14px; line-height: 1.45; margin: 10px 0 20px; }
.popup-scroll { display: flex; flex-direction: column; }
.popup-scroll h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.popup-scroll .popup-text { margin: 4px 0 14px; }
#changelog-content { flex: 1; overflow-y: auto; text-align: left; font-size: 14.5px; margin-bottom: 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 0; }
.changelog-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.changelog-item:last-child { border-bottom: none; }
/* Boîte de dialogue maison (remplace alert()/confirm() natifs de Safari) */
.dialogue-actions { display: flex; gap: 10px; }
.dialogue-actions .btn-action { flex: 1; }
@keyframes fondIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes feuilleIn{ from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 16. INDICATEUR SYNC */
.status-dot { width: 9px; height: 9px; border-radius: 50%; background-color: var(--done); display: inline-block; margin-left: 5px; }
.status-dot.offline { background-color: var(--danger); }
.status-dot.saving  { background-color: var(--gold); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }

/* 17. RÉGLAGES */
.admin-section { background: var(--card); padding: 16px; border-radius: var(--r-lg); margin-bottom: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.admin-section h3 { font-size: 17px; font-weight: 700; }
.admin-section h3.danger { color: var(--danger); }
.admin-section .btn-action { margin-bottom: 0; }
#btn-vider-corbeille { margin-top: 12px; }
.admin-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.4; margin: 6px 0 12px; }
.admin-desc.strong { color: var(--text); font-weight: 700; }
.admin-file { margin-top: 4px; font-size: 14px !important; width: 100%; }
.obj-form { display: flex; gap: 8px; margin-top: 10px; }
.obj-form input { min-width: 0; min-height: 44px; border: 1px solid var(--border); padding: 10px; border-radius: var(--r-sm); background: var(--card-2); }
.obj-form input[type="text"] { flex: 1; }
.obj-form input[type="number"] { width: 80px; }
.obj-pill { justify-content: space-between; margin-bottom: 6px; }
.corb-row { font-size: 13.5px; border-bottom: 1px solid var(--border); padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.corb-vide { font-size: 13.5px; }
.app-version { text-align: right; color: var(--text-dim); font-size: 13px; margin-top: 30px; font-weight: 700; padding-bottom: 20px; }
.app-version span { font-weight: 400; }

/* Sélecteur de profil Corentin/Lisa (charte §5.6) */
.profile-switch { display: flex; gap: 8px; padding: 5px; margin-top: 2px; background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.profile-switch-btn { flex: 1; padding: 11px 8px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-dim); font-size: 14.5px; font-weight: 700; font-family: inherit; cursor: pointer; }
.profile-switch-btn.corentin.selected { background: rgba(31,143,255,0.14); border-color: var(--corentin); color: var(--corentin); }
.profile-switch-btn.lisa.selected { background: rgba(255,61,126,0.14); border-color: var(--lisa); color: var(--lisa); }

@media (min-width: 768px) {
    body { flex-direction: row; }
    .top-nav { width: 280px; height: 100vh; position: sticky; padding: 25px; border-bottom: none; border-right: 1px solid var(--border); }
    .main-content { padding: 40px 40px calc(var(--tabbar-height) + 40px); }
    .tabbar-flottante { left: 50%; right: auto; width: min(520px, calc(100% - 28px)); transform: translateX(-50%); }
}

/* 18. TOAST « Ligne supprimée — Annuler » (charte §5.8, animé en transform/opacity §11.3) */
#toast { position: fixed; bottom: calc(var(--tabbar-height) + 12px); left: 50%; transform: translate(-50%, 16px) scale(.96); opacity: 0; visibility: hidden; pointer-events: none;
    background: var(--card-2); color: var(--text); border: 1px solid var(--border); padding: 4px 4px 4px 18px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
    display: flex; align-items: center; gap: 12px; white-space: nowrap; box-shadow: var(--shadow-sm); z-index: 1000;
    transition: opacity .18s var(--ease-out), transform .18s var(--ease-out), visibility 0s linear .18s; }
#toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s var(--ease-out), transform .25s var(--ease-drawer), visibility 0s; }
#btn-undo { min-height: 44px; background: var(--accent); color: #fff; border: none; padding: 10px 16px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; cursor: pointer; }

/* ACCESSIBILITÉ — mouvement réduit (charte §11.9) */
@media (prefers-reduced-motion: reduce) {
    .btn-tab, .month-pill, .year-header::after, .card-header::after, .progress-fill,
    .btn-action, .btn-small, .btn-icon, .btn-pay-method, .mixte-btn, .login-btn { transition: none !important; }
    /* « Réduit ≠ zéro » (12/10/2026, skills Emil) : toast et pop-ups gardent leur fondu, sans déplacement. */
    #toast, #toast.show { transform: translate(-50%, 0) !important; }
    #toast { transition: opacity .2s ease, visibility 0s linear .2s !important; }
    #toast.show { transition: opacity .2s ease, visibility 0s !important; }
    .popup-box { animation-name: fondIn !important; }
    .status-dot.saving { animation: none; opacity: .6; }
}

/* =====================================================================================
   BUDGET V2 (18/10/2026) — tableau de bord inspiré de la maquette « refonte onglet Mois »
   Mêmes données que Budget ; seules la structure de l'onglet Mois et ces styles changent.
   Couleurs de catégorie : Charges indigo, Dépenses rouge, Provisions ambre (rayé), Reste vert.
   ===================================================================================== */
:root {
    --k-charges: #5b63e6;  --k-charges-txt: #a5abff;
    --k-dep:     #d9393d;  --k-dep-txt:     #ff8f91;
    --k-prov:    #f5b54a;  --k-prov-txt:    #f5c06a;
    --k-reste:   #12b981;  --k-reste-txt:   #5ee0b0;
}
.v2-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.v2-badge { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.v2-dim { color: var(--text-dim); }
.v2-vide { text-align: center; color: var(--text-dim); font-size: 13px; padding: 14px 0; margin: 0; }
.v2-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--text-dim); }
.v2-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* Navigateur de mois */
#month-nav-group { display: flex; flex-direction: column; gap: 8px; }
.v2-mois-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.v2-mois-btn { min-height: 44px; background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 15px; padding: 0 6px; cursor: pointer; }
.v2-mois-btn:first-child { text-align: left; } .v2-mois-btn:last-child { text-align: right; }
.v2-mois-btn:disabled { visibility: hidden; }
.v2-mois-cur { min-height: 44px; background: none; border: 0; font: inherit; font-size: 21px; font-weight: 800; color: var(--accent); letter-spacing: -.3px; text-align: center; cursor: pointer; padding: 0 4px; }
.v2-chev { font-size: 12px; opacity: .7; vertical-align: middle; }

/* Bascule (segmented) */
.v2-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--border); margin-bottom: 14px; }
.v2-seg button { min-height: 36px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.v2-seg button.on { background: var(--card-2, #1e2530); color: var(--text); font-weight: 700; }
.v2-pt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.v2-pt.c { background: var(--corentin, #1f8fff); } .v2-pt.l { background: var(--lisa, #ff3d7e); }

/* Héros */
.v2-hero { text-align: center; padding: 6px 0 18px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.v2-label { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-dim); }
.v2-big { font-variant-numeric: tabular-nums; letter-spacing: -1.5px; line-height: 1.1; }
.v2-big .v2-int { font-size: 52px; font-weight: 800; }
.v2-big .v2-dec { font-size: 24px; font-weight: 700; color: var(--text-dim); }
.v2-big.neg .v2-int { color: var(--k-dep-txt); }
.v2-sub { font-size: 13px; color: var(--text-dim); }
.v2-prog { width: 70%; height: 5px; border-radius: var(--r-pill); background: var(--card-2, #1e2530); overflow: hidden; margin-top: 8px; }
.v2-prog > div { height: 100%; background: var(--accent); border-radius: inherit; transform-origin: left; transform: scaleX(0); transition: transform .4s var(--ease-out); }

/* Cartes et barre empilée */
.v2-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.v2-leg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.v2-leg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-leg-i { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.v2-leg-i span { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.v2-leg-i strong { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2-leg-i:last-child { align-items: flex-end; }
.v2-leg-i.k-charges span { color: var(--k-charges-txt); } .v2-leg-i.k-dep span { color: var(--k-dep-txt); }
.v2-leg-i.k-provisions span, .v2-leg-i.k-avenir span { color: var(--k-prov-txt); } .v2-leg-i.k-reste span { color: var(--k-reste-txt); }
.v2-bar { display: flex; gap: 3px; height: 26px; border-radius: var(--r-pill); overflow: hidden; background: var(--card-2, #1e2530); }
.v2-bar i { display: block; flex-basis: 0; min-width: 4px; }
.v2-bar .k-charges { background: var(--k-charges); } .v2-bar .k-dep { background: var(--k-dep); } .v2-bar .k-reste { background: var(--k-reste); }
.v2-bar .k-provisions, .v2-bar .k-avenir { background: repeating-linear-gradient(135deg, var(--k-prov) 0 5px, #8a6420 5px 10px); }

/* Vignettes 2×2 */
.v2-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.v2-tile { text-align: left; border-radius: var(--r-lg); padding: 14px; color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 112px; cursor: pointer; border: 1px solid; transition: transform var(--t-fast) var(--ease-out); }
.v2-tile:active, .v2-act:active, .v2-op:active { transform: scale(.97); }
.v2-tile-ico { font-size: 22px; margin-bottom: 10px; }
.v2-tile-nom { font-size: 13px; opacity: .85; }
.v2-tile-mnt { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2-tile-mnt .v2-dec { font-size: 13px; opacity: .7; }
.v2-tile-info { font-size: 11px; opacity: .7; }
.t-charges   { background: linear-gradient(160deg, #2a2f6b, #1b1f45); border-color: #343a80; }
.t-depenses  { background: linear-gradient(160deg, #5c1f22, #3a1517); border-color: #7a2a2e; }
.t-provisions{ background: linear-gradient(160deg, #57401a, #3a2b13); border-color: #76582a; }
.t-revenus   { background: linear-gradient(160deg, #134a3a, #0e3128); border-color: #1d6650; }

/* Actions rapides */
.v2-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.v2-act { min-height: 48px; border-radius: var(--r-md); border: 0; font: inherit; font-size: 14px; font-weight: 700; color: #fff; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.a-dep { background: var(--k-dep); } .a-rev { background: #0e8f64; } .a-esp { background: var(--card-2, #1e2530); color: var(--text); border: 1px solid var(--border-strong); }

/* Opérations */
.v2-ops-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.v2-ops-head h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.v2-rond { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text-dim); display: flex; align-items: center; justify-content: center; font-size: 15px; cursor: pointer; }
#v2-ops, #v2-cal-detail { display: flex; flex-direction: column; gap: 8px; }
.v2-op { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 10px 12px; cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.v2-op-ico { width: 40px; height: 40px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: var(--card-2, #1e2530); }
.v2-op-ico.k-dep { background: #3a1517; } .v2-op-ico.k-rev { background: #0e3128; } .v2-op-ico.k-charges { background: #1b1f45; }
.v2-op-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v2-op-nom { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-op-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-op-mnt { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: var(--r-pill); background: #3a1517; color: var(--k-dep-txt); white-space: nowrap; }
.v2-op-mnt.pos { background: #0e3128; color: var(--k-reste-txt); }

/* Calendrier */
.v2-cal-jours, .v2-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.v2-cal-jours { font-size: 11px; color: var(--text-dim); text-align: center; margin-bottom: 6px; }
.v2-cal { margin-bottom: 16px; }
.v2-jour { height: 54px; padding: 0; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
.v2-jour span { font-size: 14px; font-weight: 600; }
.v2-jour small { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 12px; }
.v2-jour.c-futur span { color: var(--text-dim); }
.v2-jour.c-dep { background: #3a1517; } .v2-jour.c-dep small { color: var(--k-dep-txt); }
.v2-jour.c-rem { background: #0e3128; } .v2-jour.c-rem small { color: var(--k-reste-txt); }
.v2-jour.c-avenir { background: rgba(245,181,74,.08); border: 1px dashed var(--k-prov); } .v2-jour.c-avenir small { color: var(--k-prov-txt); }
.v2-jour.c-auj span { color: var(--accent); font-weight: 800; }
.v2-jour.c-sel { border: 2px solid var(--accent); }
.v2-cal-titre { font-size: 13px; font-weight: 600; color: var(--text-dim); }

/* Feuilles (bottom sheets) */
.v2-sheet-wrap { position: fixed; inset: 0; z-index: 500; pointer-events: none; visibility: hidden; transition: visibility 0s linear .32s; }
.v2-sheet-wrap.open { pointer-events: auto; visibility: visible; transition: none; }
.v2-sheet-fond { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .32s var(--ease-drawer); }
.v2-sheet-wrap.open .v2-sheet-fond { opacity: 1; }
.v2-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 60px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: var(--t-modale, #161b22); border-top: 1px solid var(--border-strong); border-radius: 26px 26px 0 0; /* opaque : --card est translucide en Verre */ box-shadow: 0 -12px 40px rgba(0,0,0,.6);
    padding: 0 16px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto;
    transform: translateY(100%); transition: transform .32s var(--ease-drawer); }
.v2-sheet-wrap.open .v2-sheet { transform: none; }
.v2-grab { position: sticky; top: 0; height: 22px; margin: 0 -16px; background: var(--t-modale, #161b22); z-index: 2; cursor: pointer; }
.v2-grab::after { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; margin-left: -20px; border-radius: var(--r-pill); background: var(--border-strong); }
.v2-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.v2-sheet-head h3 { flex: 1; margin: 0; font-size: 20px; font-weight: 800; }
.v2-sheet-head h3 small { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.v2-sheet-ico { width: 44px; height: 44px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; border: 1px solid; }
.v2-sheet .search-container { margin-bottom: 12px; }
.v2-sheet .btn-action { margin: 0 0 12px; }
.v2-sheet .revenus-box { margin-bottom: 16px; }
.v2-cats { gap: 10px; background: var(--bg); }
.v2-cat { display: flex; flex-direction: column; gap: 5px; }
.v2-cat .v2-row { color: var(--text); }
.v2-cat-bar { height: 6px; border-radius: var(--r-pill); background: var(--card-2, #1e2530); overflow: hidden; }
.v2-cat-bar i { display: block; height: 100%; background: var(--k-dep); border-radius: inherit; transform-origin: left; }
body.v2-feuille { overflow: hidden; }
body.v2-feuille .tabbar-flottante { opacity: 0; pointer-events: none; }
.tabbar-flottante { transition: opacity var(--t-mid) var(--ease-out); }
#toast { z-index: 1000; }

@media (prefers-reduced-motion: reduce) {
    .v2-sheet { transition: none; }
    .v2-sheet-fond { transition: opacity .2s linear; }
    .v2-prog > div, .v2-tile, .v2-act, .v2-op { transition: none; }
}

/* « + Démarrer … » discret (visible seulement sur le dernier mois) */
#btn-next-month { min-height: 36px; padding: 6px 14px; font-size: 13px; align-self: center; width: auto; border-radius: var(--r-pill); }

/* Pourcentages sous les montants de la barre empilée */
.v2-leg-i em { font-style: normal; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* Feuille « Tous les mois » */
.v2-an { font-size: 13px; font-weight: 700; color: var(--text-dim); letter-spacing: .5px; margin: 6px 0 8px; }
.v2-mois-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.v2-mois-item { min-height: 44px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--card-2, #1e2530); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.v2-mois-item.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Thème SOMBRE (data-style="simple") : la pastille active de la bascule doit ressortir
   (--card et --card-2 valent tous deux #2c2c2e) */
html[data-style="simple"] .v2-seg button.on { background: rgba(255,255,255,.16); }
html[data-style="simple"] .v2-mois-item { background: var(--card); }

/* Thème CLAIR (18/10/2026) : vignettes, pastilles et calendrier en teintes pastel, textes foncés */
html[data-style="clair"] {
    --k-charges-txt: #4b52d6; --k-dep-txt: #c0352f; --k-prov-txt: #a8710f; --k-reste-txt: #0b8a5c;
}
html[data-style="clair"] .v2-seg button.on { background: rgba(70,50,20,.10); }
html[data-style="clair"] .v2-prog { background: rgba(70,50,20,.10); }
html[data-style="clair"] .t-charges    { background: #e9eafc; border-color: #d4d7f7; }
html[data-style="clair"] .t-depenses   { background: #fbe7e6; border-color: #f3cfcd; }
html[data-style="clair"] .t-provisions { background: #fbf0dc; border-color: #f0dcb5; }
html[data-style="clair"] .t-revenus    { background: #e2f4ec; border-color: #c4e6d6; }
html[data-style="clair"] .v2-op-ico.k-dep, html[data-style="clair"] .v2-jour.c-dep, html[data-style="clair"] .v2-op-mnt { background: #fbe7e6; }
html[data-style="clair"] .v2-op-ico.k-rev, html[data-style="clair"] .v2-jour.c-rem, html[data-style="clair"] .v2-op-mnt.pos { background: #e2f4ec; }
html[data-style="clair"] .v2-op-ico.k-charges { background: #e9eafc; }
html[data-style="clair"] .v2-op-ico { background: rgba(70,50,20,.06); }
html[data-style="clair"] .v2-jour.c-avenir { background: rgba(245,181,74,.14); }
html[data-style="clair"] .a-esp { background: var(--card); }
html[data-style="clair"] .v2-sheet-fond { background: rgba(60,45,25,.35); }
html[data-style="clair"] .v2-sheet { box-shadow: 0 -12px 40px rgba(70,50,20,.18); }
