/* ===========================
   BudgetCalendar : Finance Organizer
   Style global V5.2.0 — UI compacte (6×7 garanti)
   Couleurs: primaire #3282ae, secondaire #7da0b9
   Coins: 12px — Ombres subtiles
   =========================== */

:root{
  --primary: #3282ae;
  --primary-2: #7da0b9;
  --green: #4CAF50;
  --red: #E57373;
  --blue: #4A90E2;
  --anthracite: #2F3E46;
  --white: #F8F9FA;
  --bg: #eef3f7;
  --radius: 12px;
  --shadow: 0 8px 20px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);

  /* Couleurs des transactions - modifiables via les paramètres */
  --tx-income: #4CAF50;
  --tx-expense: #E57373;
  --tx-transfer: #4A90E2;

  /* Thème sombre */
  --white-dark: #0F1113;
  --anthracite-dark: #E6ECF1;

  /* Densité compacte : garantir 6 rangées visibles */
  --tx-row-height: 24px; /* Augmenter légèrement la hauteur des transactions */
  --tx-gap: 4px; /* Augmenter l'espace entre les transactions */
  --day-header-h: 26px;
  --band-top-h: 58px;      /* hauteur bandeau pilules */
  --navbar-h: 40px;        /* hauteur barre nav */
  --footer-h: 24px;        /* footer fixe */

  /* Sécurité supplémentaire (delta) pour s'assurer d'un espace sous la 6e rangée */
  --calendar-bottom-gap: 12px;

  /* Hauteur disponible pour la grille : évite le scroll global + delta de sécurité */
  --calendar-h: calc(100vh - (var(--band-top-h) + var(--navbar-h) + var(--footer-h) + var(--calendar-bottom-gap) + 40px));
}

/* ===== Reset/structure ===== */
*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0; padding:0;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans";
  background: var(--bg);
  color: var(--anthracite);
  overflow: hidden; /* Pas de scroll global */
}

/* marge de sécurité sous le calendrier pour ne jamais heurter le footer */
#app-root, .app-shell { 
  padding-bottom: calc(var(--footer-h) + var(--calendar-bottom-gap) + 20px); 
  min-height: 100vh;
}

/* ===== Boutons génériques ===== */
button{ cursor:pointer; }
.btn{
  appearance: none; border:1px solid rgba(0,0,0,.12);
  background:#fff; color: var(--anthracite);
  padding:7px 10px; border-radius: 10px;
  min-height: 34px;
  transition: box-shadow .15s ease, transform .02s ease, background .15s ease;
}
.btn:hover{ box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.btn:active{ transform: translateY(1px); }
.btn:focus{ outline: 2px solid var(--primary-2); outline-offset: 2px; }

.btn.small{ padding:4px 8px; min-height: 28px; border-radius: 8px; }
.btn-primary{ border-color: transparent; background: var(--primary); color:#fff; }
.btn-primary:hover{ background: #2e79a1; }
.btn-danger{ border-color: #ffd6d6; background: #ffeef0; color:#b93131; }
.btn-warning{ border-color: #ffe0b2; background: #fff3e0; color:#e65100; }
.btn-google{ background:#db4437; color:#fff; border-color: #db4437; }

/* CORRECTION : Styles V2 supprimés car les boutons ont été retirés de l'interface */

/* ===== En-têtes du sidepanel ===== */
.sidepanel-header {
  position: relative;
  min-height: 48px;
  padding: 8px 16px;
}

/* Bouton X fixe en haut à droite */
.sidepanel-header #btn-sidepanel-close {
  position: absolute;
  top: 8px;
  right: 16px;
  z-index: 10;
}

/* Le bouton X est toujours visible */

/* ===== Pastille de notification sur le bouton Menu ===== */
.btn[data-role="menu-button"] {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
}

#header-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
}

#header-settings h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#header-settings .btn-back {
  flex-shrink: 0;
}

#header-notifications {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
}

#header-notifications h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#header-notifications .btn-back {
  flex-shrink: 0;
}

/* ===== Topbar (Logo + Titre + Informations de solde + Boutons + Déconnexion) ===== */
.month-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 10px; margin:8px 10px;
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: var(--shadow);
  height: var(--band-top-h);
  position: relative; /* Assurer que c'est bien positionné */
  z-index: 10; /* S'assurer qu'il est au-dessus */
}
.topbar-left{ display:flex; align-items:center; gap:12px; min-width:0; }
.brand{
  height: calc(var(--band-top-h) - 12px); /* le logo remplit quasi toute la bannière */
  width:auto; display:block;
}
.brand-title{
  color:#fff; font-weight:800; white-space:nowrap;
  font-size: 16px;
  line-height: 1.2;
}
.topbar-center{ 
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; 
  justify-content: center;
}
.topbar-right{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.month-topbar .pill{
  color:#fff; background: var(--primary);
  border:1.5px solid #fff; border-radius: 999px;
  padding:5px 10px; font-weight:700; white-space:nowrap;
  font-size: 12px;
}
.btn-logout{ background:#fff; color:#1d2a31; border-color:#fff; }
.btn-menu{ background:#fff; color:#1d2a31; border-color:#fff; font-weight:600; }
.btn-danger{ border-color: #ffd6d6; background: #ffeef0; color:#b93131; }

/* ===== Navbar (flèches, titre, “Aujourd’hui”, picker) ===== */
.navbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:6px; padding:4px 10px; margin:0 10px;
  height: var(--navbar-h);
}
.nav-left, .nav-right{ display:flex; align-items:center; gap:6px; }
.nav-center{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  font-size: 20px; font-weight: 800; color: var(--anthracite);
  text-transform: capitalize;
}
.segment{ display:none !important; } /* switch supprimé */
.month-picker{
  height:30px; border:1px solid #d7e4ec; background:#fff; border-radius: 10px;
  padding:3px 8px; color:#24333a;
}

/* ===== Mini-mois (desktop masqué) ===== */
.mini-month{ margin: 6px 10px; background:#fff; border-radius: var(--radius); box-shadow: var(--shadow); padding:6px; }
.mini-head{ display:grid; grid-template-columns: repeat(7, 1fr); gap:3px; font-size:12px; color:#4d5b63; text-align:center; margin-bottom:3px; }
.mini-grid{ display:grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 22px; gap:3px; }
.mini-cell{
  display:flex; align-items:center; justify-content:center;
  border-radius: 8px; background:#f6fafc; color:#38505b;
  border:1px solid #e3edf4;
}
.mini-cell.today{ outline:2px solid var(--primary-2); outline-offset:-2px; }
.mini-cell.selected{ background:#e5f2fb; border-color:#c2e0f4; font-weight:700; }
@media (min-width: 768px){ .mini-month{ display:none; } }

/* ===== Grille Calendrier ===== */
.calendar{ margin: 6px 10px 12px; }
.calendar.month{
  display:grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;          /* 6 lignes = hauteurs égales automatiquement */
  gap:6px;
  height: var(--calendar-h);    /* clé pour garder 6 lignes visibles */
  min-height: 360px;
  /* Espace visuel sous la grille */
  margin-bottom: var(--calendar-bottom-gap);
}

/* Case jour */
.day-cell{
  display: flex; flex-direction: column; align-items: stretch;
  min-height: 0;
  border-radius: var(--radius); background: #fff; border: 1px solid #e7eef4;
  box-shadow: var(--shadow); padding: 0; text-align: left;
  /* Assurer une hauteur minimale pour éviter la coupure */
  min-height: 100px; /* Augmenter de 80px à 100px */
  cursor: pointer;
  transition: all 0.2s ease;
  /* S'assurer que toute la case est cliquable */
  position: relative;
  overflow: hidden;
}

/* Case jour avec solde négatif */
.day-cell.negative-balance {
  background: white; /* Partie transactions reste blanche */
  border-color: rgba(0,0,0,0.1); /* Bordure normale */
}

.day-cell.negative-balance .day-header {
  background: var(--red); /* En-tête rouge */
  color: #fff; /* Texte blanc sur l'en-tête */
}

.day-cell.negative-balance .day-balance {
  color: #fff; /* Texte blanc comme les autres jours */
  font-weight: 800;
}
.day-cell:hover:not(.other-month) {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
.day-cell:focus{ outline:3px solid #cfe7f7; }
.day-cell.today{ box-shadow: 0 0 0 2px var(--blue) inset, var(--shadow); }
.day-cell.selected{ box-shadow: 0 0 0 3px var(--blue) inset, var(--shadow); }

/* Jours hors-mois : grisés et gelés */
.day-cell.other-month {
  opacity: 0.6;
  background: #f8f9fa;
  border-color: #e9ecef;
  cursor: not-allowed;
  /* Garder le même style arrondi que les autres cases */
  border-radius: var(--radius);
  pointer-events: none;
}

.day-cell.other-month .day-header {
  background: #6c757d; /* Bleu grisé au lieu de gris clair */
  color: #ffffff;
  /* Garder le même style arrondi */
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.day-cell.other-month .day-body {
  background: #f8f9fa;
  /* Garder le même style arrondi */
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.day-cell.other-month .tx {
  opacity: 0.7;
}

/* En-tête de jour */
.day-header{
  display:flex; align-items:center; justify-content:space-between;
  background: var(--primary-2); color:#fff;
  padding:6px 8px;
  border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
  font-weight:700; height: auto;
  min-height: var(--day-header-h);
}
.day-date{
  font-size: 11px; /* Réduire pour la date longue */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  line-height: 1.2;
}
.day-balance{
  font-weight:800;
  font-size: 13px;
  white-space: nowrap;
}

/* Corps (liste des transactions) : scroll interne pour toutes les transactions */
.day-body{
  min-height: 0; flex: 1 1 auto;
  /* Clamp V2 : Limiter à 3 lignes par défaut */
  max-height: calc((var(--tx-row-height) * 3) + (var(--tx-gap) * 2));
  overflow: hidden; /* Masquer le scroll par défaut pour le clamp */
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: var(--tx-gap);
  /* Assurer un espace minimum pour éviter la coupure */
  min-height: calc((var(--tx-row-height) * 2) + (var(--tx-gap) * 1));
  /* S'assurer que le corps prend tout l'espace disponible */
  flex-grow: 1;
  position: relative;
}

/* Classe pour le mode "Voir tout" */
.day-body.expanded {
  max-height: calc((var(--tx-row-height) * 10) + (var(--tx-gap) * 9));
  overflow: auto; /* Activer le scroll en mode étendu */
}

/* Bouton "Voir tout" */
.day-view-all {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(255,255,255,0.9), #fff);
  padding: 8px 6px 6px;
  text-align: center;
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  border-radius: 0 0 var(--radius) var(--radius);
  display: none;
}

.day-view-all.visible {
  display: block;
}

.day-view-all:hover {
  background: linear-gradient(transparent, rgba(240,248,255,0.9), #f0f8ff);
}

/* Lignes de transaction — couleurs par type, montants neutres */
.tx{
  display:flex; align-items:center; justify-content:space-between;
  gap:6px; padding:3px 6px;
  border-radius: 8px; min-height: var(--tx-row-height);
  font-weight:600;
  font-size: 12px;
  cursor: inherit; /* Hériter du curseur de la case de jour (pointer) */
  transition: all 0.15s ease;
  position: relative;
  z-index: 2;
}
/* Supprimer l'effet hover pour les transactions individuelles */
/* libellé tronqué visuellement (ellipsis) */
.tx-label{
  flex:1 1 auto; min-width:0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color:#29434e;
}
/* montant tronqué visuellement (ellipsis) */
.tx-amount{
  flex:0 0 auto; max-width: 110px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color:#1f2a30;
  font-weight: 700;
}
.tx.revenue{ background:#e8f5e9; border:1px solid #cde7d0; color:#1b5e20; }
.tx.expense{ background:#ffebee; border:1px solid #ffd5d9; color:#b71c1c; }
.tx.transfer{ background:#e3f2fd; border:1px solid #cde5ff; color:#0d47a1; }



/* Indicateur pour les transactions récurrentes (maintenant dans la liste du popup) */

/* Espace en bas pour équilibrer visuellement */
.tx-bottom-spacer{
  height: 6px; /* Même hauteur que l'espace en haut */
  flex-shrink: 0;
}

/* Scrollbar interne discrète */
.day-body::-webkit-scrollbar{ width:8px; }
.day-body::-webkit-scrollbar-thumb{ background:#d8e4ec; border-radius:999px; }
.day-body{ scrollbar-color:#d8e4ec transparent; scrollbar-width:thin; }

/* ===== Modal (transaction) ===== */
#modal{ display:none; }
#modal .modal-sheet{
  position:absolute; left:50%; top:50%; transform: translate(-50%, -50%);
  width:min(800px, calc(100vw - 32px)); 
  max-height: calc(100vh - 100px);
  overflow:auto; background:#fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding:20px;
}
.sheet-title{ margin:0 0 8px; font-size:20px; font-weight: 700; color: var(--anthracite); }

/* Formulaires */
.form-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.form-grid .full{ grid-column: 1 / -1; }
label{ display:block; font-weight:700; font-size:13px; margin:4px 0 6px; color:#3c4a51; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea{
  width:100%; padding:8px 10px; border:1px solid #d8e4ec; border-radius:10px; background:#fff;
  min-height: 36px; color:#122027;
}
input:focus, select:focus, textarea:focus{ outline:2px solid var(--primary-2); border-color: transparent; }

/* Section récurrence */
.section{ border:1px solid #e6edf3; border-radius:10px; padding:12px; background:#f9fcfe; margin-top: 16px; }
.section-title{ font-size:13px; font-weight:800; margin:0; padding:0 6px; color:#4c5b63; }

/* Chips (signe transfert) */
.chip{ display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; background:#fff; border:1px solid #e0e9f0; border-radius:999px; margin-right: 8px; }
.chip input{ transform: scale(1.05); }

/* Tableau dans la modale */
.table{ 
  width:100%; 
  border-collapse:collapse; 
  background:#fff; 
  max-height: calc((var(--tx-row-height) * 3) + 40px); /* Hauteur pour 3 transactions + header */
  overflow-y: auto; /* Scroll vertical si nécessaire */
  display: table;
  table-layout: fixed;
  border: 1px solid #e3edf4; /* Bordure normale */
}
.table thead th{
  text-align:left; font-size:12px; color:#56707c; padding:6px; background:#f6fafc; border-bottom:1px solid #e3edf4;
  position: sticky; /* Garder le header visible lors du scroll */
  top: 0;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table thead th:last-child{
  text-align:right;
}
.table tbody td{ 
  padding:6px; 
  border-bottom:1px solid #f0f4f7; 
  border-right: 1px solid #f0f4f7; /* Ajouter une bordure droite pour voir les colonnes */
  height: var(--tx-row-height); /* Utiliser la même hauteur que les transactions du calendrier */
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table tbody td:last-child{
  text-align:right;
}

/* Boutons d'action dans le tableau */
.table .btn-small {
  padding: 2px 6px;
  min-height: 24px;
  font-size: 12px;
  margin-left: 4px;
}

.table .btn-small:first-child {
  margin-left: 0;
}
.table tbody tr:hover{ background:#fafcff; }

/* Styles normaux pour le tbody */
#tx-day-tbody {
  background: #fff;
}

/* Styles normaux pour le tbody */
#tx-day-tbody {
  background: #fff;
  min-height: 50px;
}

/* Assurer que les lignes du tableau sont visibles */
#tx-day-tbody tr {
  background: #fff;
  border-bottom: 1px solid #f0f4f7;
}

#tx-day-tbody tr:hover {
  background: #fafcff;
}

/* Scrollbar pour le tableau */
.table::-webkit-scrollbar{ width:8px; }
.table::-webkit-scrollbar-thumb{ background:#d8e4ec; border-radius:999px; }
.table{ scrollbar-color:#d8e4ec transparent; scrollbar-width:thin; }

/* Actions du formulaire */
.form-actions{ display:flex; gap:8px; justify-content:flex-end; align-items:center; margin-top:16px; }

/* ===== Auth (page connexion) ===== */
.auth-shell{ 
  height:100vh; 
  display:flex; 
  flex-direction: column;
  align-items:center; 
  justify-content:center; 
  padding:16px; 
  gap: 0; /* Pas d'espace entre la bannière et la carte */
}

/* Bannière d'authentification */
.auth-banner {
  width: min(460px, 94vw);
  background: var(--primary);
  border-radius: var(--radius) var(--radius) 0 0; /* Coins arrondis seulement en haut */
  padding: 6px 10px;
  box-shadow: var(--shadow);
  margin-bottom: 0; /* Collé à la carte */
  height: var(--band-top-h); /* Même hauteur que la topbar du calendrier */
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.banner-logo {
  height: calc(var(--band-top-h) - 12px);
  width: auto;
}

.banner-title {
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.auth-card{ 
  width: min(460px, 94vw); 
  background:#fff; 
  border-radius: 0 0 var(--radius) var(--radius); /* Coins arrondis seulement en bas */
  box-shadow: var(--shadow); 
  padding:16px; 
  margin-top: 0; /* Collé à la bannière */
}
.tabs{ display:flex; gap:8px; background:#f1f6fa; border-radius: 999px; padding:4px; margin-bottom: 12px; }
.tab{ flex:1; border:0; background:transparent; border-radius:999px; min-height:36px; font-weight:800; color:#45616d; }
.tab.active{ background: var(--primary); color:#fff; }
.field{ margin-bottom:10px; }
.actions{ display:flex; flex-direction:column; gap:10px; }
.hr-or{ display:flex; align-items:center; justify-content:center; gap:10px; color:#7f8c95; }
.hr-or::before, .hr-or::after{ content:""; height:1px; background:#e3edf4; flex:1; }

/* ===== Aide pour les popups Google ===== */
.popup-help {
  font-size: 12px;
  color: #6a7c86;
  margin-top: 8px;
  text-align: center;
  padding: 6px 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e3edf4;
  line-height: 1.3;
}

.popup-help:hover {
  background: #f1f6fa;
  border-color: #d8e4ec;
}

/* ===== Footer ===== */
#app-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  color: #6a7c86;
  font-size: 12px;
  text-align: center;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 999999;
  font-weight: 600;
  display: block;
  visibility: visible;
  opacity: 1;
}

/* Empêcher la duplication de la topbar */
.month-topbar:not(:first-of-type) {
  display: none !important;
}

/* S'assurer que le footer est bien visible et pas caché par la topbar */
#app-footer {
    position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  color: #6a7c86;
  font-size: 12px;
  text-align: center;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 999999;
  font-weight: 600;
  display: block;
  visibility: visible;
  opacity: 1;
}

/* Empêcher que la topbar se duplique en bas */
.month-topbar {
  position: relative;
  z-index: 10;
}

/* ===== Accessibilité & états ===== */
:focus-visible{ outline:2px solid var(--primary-2); outline-offset:2px; }
[aria-live="polite"]{ position:relative; }

/* ===== Stylisation des indicateurs dans le dropdown de fréquence ===== */
#tx-frequency {
  font-family: inherit;
}

#tx-frequency option {
  color: #374151; /* Couleur normale pour le texte principal */
  font-weight: 600;
  padding: 8px;
  line-height: 1.4;
}

/* ===== Dropdown personnalisé pour la fréquence ===== */
.custom-select {
  position: relative;
  width: 100%;
  min-height: 36px;
  border: 1px solid #d8e4ec;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

.select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  min-height: 36px;
  color: #122027;
}

.select-arrow {
  font-size: 12px;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.custom-select.open .select-arrow {
  transform: rotate(180deg);
}

.select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d8e4ec;
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.custom-select.open .select-options {
  display: block;
}

.select-option {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s ease;
}

.select-option:hover {
  background-color: #f3f4f6;
}

.select-option.selected {
  background-color: #e5f2fb;
  color: #0d47a1;
}

.option-main {
  font-weight: 600;
  color: #374151;
}

.option-indicator {
  color: #9ca3af;
  font-weight: normal;
  font-size: 0.9em;
}

/* ===== Media: mobile ===== */
@media (max-width: 767px){
  .navbar{ flex-wrap: wrap; }
  .nav-center{ width:100%; order: 1; text-align:center; margin-top:2px; }
  .nav-right{ order: 2; width:100%; justify-content:center; }

  body{ font-size: 13px; }

  :root{
    --tx-row-height: 22px; /* Augmenter légèrement en mobile aussi */
    --day-header-h: 24px;
    /* un peu plus de delta en mobile */
    --calendar-h: calc(100vh - (var(--band-top-h) + var(--navbar-h) + var(--footer-h) + var(--calendar-bottom-gap) + 44px));
  }

  .brand{ height: calc(var(--band-top-h) - 10px); }
  #modal .modal-sheet{ 
    top: 12px; 
    max-height: calc(100vh - 34px); 
    width: calc(100vw - 16px);
    margin: 0 8px;
  }
  .form-grid{ grid-template-columns: 1fr; }
  
  /* Ajuster la taille des dates en mobile */
  .day-date {
    font-size: 10px; /* Réduire pour la date longue en mobile */
  }
  
  /* Bannière responsive */
  .month-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .topbar-center {
    order: 2;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }
  
  .topbar-left {
    order: 1;
  }
  
  .topbar-right {
    order: 3;
  }
  
  .month-topbar .pill {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  /* Bannière d'authentification responsive */
  .auth-banner {
    padding: 6px 10px;
  }
  
  .banner-logo {
    height: calc(var(--band-top-h) - 10px);
  }
  
  .banner-title {
    font-size: 14px;
  }
}

/* ===== Modal des catégories V2 ===== */
.category-modal {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.category-card {
  background: #fff;
  border: 2px solid #e3edf4;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.category-card:hover {
  border-color: var(--primary-2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.category-card.selected {
  border-color: var(--primary);
  background: #f0f8ff;
}

.category-card.archived {
  opacity: 0.6;
  background: #f5f5f5;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.category-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-2);
  color: white;
  border-radius: 6px;
  font-size: 16px;
}

.category-name {
  font-weight: 600;
  color: var(--anthracite);
  flex: 1;
}

.category-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.category-card:hover .category-actions {
  opacity: 1;
}

.category-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.category-action-btn:hover {
  background: #f0f0f0;
  color: var(--anthracite);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 12px;
  background: #f9fcfe;
}

.icon-item {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 20px;
  color: var(--anthracite);
}

.icon-item:hover {
  border-color: var(--primary-2);
  background: #f0f8ff;
}

.icon-item.selected {
  border-color: var(--primary);
  background: #e5f2fb;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 12px;
  background: #f9fcfe;
}

.color-item {
  width: 32px;
  height: 32px;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-item:hover {
  border-color: rgba(0,0,0,0.2);
  transform: scale(1.1);
}

.color-item.selected {
  border-color: #000;
  transform: scale(1.2);
}

.category-form {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}

.category-form h3 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 16px;
}

.category-form-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.category-input {
  flex: 1;
}

.category-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  min-height: 40px;
}

.category-preview-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  color: white;
}

.category-preview-name {
  font-weight: 600;
  color: var(--anthracite);
}

.category-stats {
  display: flex;
  gap: 16px;
  margin: 16px 0;
  padding: 12px;
  background: #f0f8ff;
  border-radius: 8px;
  border: 1px solid #e5f2fb;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

/* ===== Autocomplétion des catégories ===== */
.field {
  position: relative;
}
.category-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d8e4ec;
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: #f0f8ff;
}

.suggestion-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  color: white;
}

.suggestion-name {
  font-weight: 500;
  color: var(--anthracite);
}

/* ===== Modal des rapports V2 ===== */
.reports-modal {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.reports-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e3edf4;
  padding-bottom: 8px;
}

.report-nav-btn {
  padding: 8px 12px;
  border: 1px solid #e3edf4;
  background: #fff;
  color: var(--anthracite);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.report-nav-btn:hover {
  background: #f0f8ff;
  border-color: var(--primary-2);
}

.report-nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.reports-controls {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.reports-filters {
  background: #f0f8ff;
  border: 1px solid #e5f2fb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.reports-content {
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  min-height: 300px;
}

.loading-message, .error-message {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

.error-message {
  color: #e57373;
}

.report-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e3edf4;
}

.report-header h3 {
  margin: 0 0 8px;
  color: var(--anthracite);
  font-size: 18px;
}

.report-meta {
  color: #666;
  font-size: 12px;
}

.report-summary {
  margin-bottom: 20px;
}

.report-summary h4 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.summary-item {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 12px;
}

.summary-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--anthracite);
}

.report-breakdown {
  margin-bottom: 20px;
}

.report-breakdown h4 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
}

.breakdown-list {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  overflow: hidden;
}

.breakdown-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e3edf4;
  align-items: center;
}

.breakdown-item:last-child {
  border-bottom: none;
}

.breakdown-category {
  font-weight: 600;
  color: var(--anthracite);
}

.breakdown-amount {
  font-weight: 700;
  color: var(--anthracite);
  text-align: right;
}

.breakdown-percentage {
  font-size: 12px;
  color: #666;
  text-align: right;
  min-width: 50px;
}

.report-chart {
  margin-bottom: 20px;
}

.report-chart h4 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
}

.balance-chart {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px;
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
}

.chart-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 6px;
}

.chart-date {
  font-size: 10px;
  color: #666;
  margin-bottom: 4px;
}

.chart-balance {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
}

/* ===== Modal des budgets V2 ===== */
.budgets-modal {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.budgets-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e3edf4;
  padding-bottom: 8px;
}

.budget-nav-btn {
  padding: 8px 12px;
  border: 1px solid #e3edf4;
  background: #fff;
  color: var(--anthracite);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.budget-nav-btn:hover {
  background: #f0f8ff;
  border-color: var(--primary-2);
}

.budget-nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.budgets-controls {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.budgets-period {
  display: flex;
  align-items: center;
  gap: 8px;
}

.budgets-period label {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
}

.budgets-period select {
  padding: 6px 8px;
  border: 1px solid #e3edf4;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}

.budgets-content {
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  min-height: 300px;
}

.budget-tab-content {
  display: none;
}

.budget-tab-content.active {
  display: block;
}

.budget-summary {
  margin-bottom: 20px;
}

.budget-summary h3 {
  margin: 0 0 16px;
  color: var(--anthracite);
  font-size: 18px;
}

.budget-overview {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 16px;
}

.budget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.budget-item:last-child {
  margin-bottom: 0;
}

.budget-label {
  font-size: 14px;
  color: #666;
}

.budget-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--anthracite);
}

.budget-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e3edf4;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar::before {
  content: '';
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
  min-width: 40px;
  text-align: right;
}

.budgets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.budget-card {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 16px;
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.budget-header h4 {
  margin: 0;
  color: var(--anthracite);
  font-size: 16px;
}

.budget-actions {
  display: flex;
  gap: 4px;
}

.budget-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-amount, .budget-used {
  font-size: 14px;
  color: #666;
}

.budget-amount strong, .budget-used strong {
  color: var(--anthracite);
  font-weight: 600;
}

/* ===== Modal des exports V2 ===== */
.exports-modal {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.exports-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.export-section {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 16px;
}

.export-section h3 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
  font-weight: 600;
}

.export-data-options, .export-period-options, .export-format-options, .export-advanced-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--anthracite);
}

.checkbox-label input, .radio-label input {
  margin: 0;
}

.custom-period {
  margin-top: 12px;
  padding: 12px;
  background: #f0f8ff;
  border: 1px solid #e5f2fb;
  border-radius: 8px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-range label {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
}

.date-range input {
  padding: 6px 8px;
  border: 1px solid #e3edf4;
  border-radius: 6px;
  font-size: 12px;
}

.export-date-format {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.export-date-format label {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
}

.export-date-format select {
  padding: 6px 8px;
  border: 1px solid #e3edf4;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}

.export-preview {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 12px;
  padding: 16px;
}

.export-preview h3 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
  font-weight: 600;
}

.preview-content {
  min-height: 200px;
}

.preview-placeholder {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

.preview-info {
  margin-bottom: 16px;
  padding: 12px;
  background: #f0f8ff;
  border: 1px solid #e5f2fb;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.preview-sample {
  margin-top: 16px;
}

.preview-code {
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Panneau Latéral Menu V2 ===== */
.btn-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-menu:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
}

.btn-menu .material-symbols-outlined {
  font-size: 20px;
}

.btn-menu .menu-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--anthracite);
}

.btn-menu {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Overlay */
.sidepanel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidepanel-overlay.visible {
  opacity: 1;
}

/* Panneau latéral */
.sidepanel {
  position: fixed;
  top: 0;
  right: 0;
  width: clamp(360px, 33vw, 520px);
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidepanel.open {
  transform: translateX(0);
}

/* Responsive mobile */
@media (max-width: 768px) {
  .sidepanel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }
}

/* Header du panneau */
.sidepanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e3edf4;
  background: #f9fcfe;
  flex-shrink: 0;
}

.sidepanel-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--anthracite);
}

.sidepanel-header .btn-close {
  padding: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidepanel-header .btn-close:hover {
  background: #f0f8ff;
  border-color: var(--primary-2);
  color: var(--primary);
}

/* Contenu du panneau */
.sidepanel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Navigation simplifiée du drawer */
.page-navigation {
  margin-bottom: 20px;
}

.page-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-nav-list li {
  margin: 0;
}

.page-nav-link {
  display: block;
  padding: 12px 16px;
  color: var(--anthracite);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
  margin-bottom: 4px;
}

.page-nav-link:hover {
  background: #f0f8ff;
  color: var(--primary);
}

.page-nav-link.active {
  background: var(--primary);
  color: white;
}

/* Séparateur dans la navigation */
.nav-separator {
  height: 1px;
  background: #e3edf4;
  margin: 12px 16px;
}

/* Bouton de déconnexion dans la navigation */
.page-nav-link.btn {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: inherit;
}

.page-nav-link.btn:hover {
  background: #ffebee;
  color: #b71c1c;
}

/* Suppression de la ligne de séparation pour les paramètres */

/* Panels d'onglets */
.sidepanel-panels {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Placeholders */
.panel-placeholder h3 {
  margin: 0 0 16px;
  color: var(--anthracite);
  font-size: 16px;
  font-weight: 600;
}

.panel-placeholder h4 {
  margin: 0 0 12px;
  color: var(--anthracite);
  font-size: 14px;
  font-weight: 600;
}

.panel-placeholder p {
  margin: 0;
  color: #666;
  font-style: italic;
  padding: 20px;
  text-align: center;
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
}

/* Filtres placeholder */
.placeholder-filters {
  margin-bottom: 20px;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
  margin-bottom: 4px;
}

.filter-group select {
  width: 100%;
  padding: 8px;
  border: 1px solid #e3edf4;
  border-radius: 6px;
  background: #f9fcfe;
  color: #666;
}

.filter-group select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Résultats placeholder */
.placeholder-results {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stats catégorie placeholder */
.placeholder-top-category {
  margin-bottom: 20px;
}

.category-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
}

.category-name {
  font-weight: 600;
  color: var(--anthracite);
}

.category-percentage {
  font-weight: 700;
  color: var(--primary);
}

/* Courbe placeholder */
.placeholder-curve {
  margin-bottom: 20px;
}

.curve-container {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Budget placeholder */
.placeholder-global-budget {
  margin-bottom: 20px;
}

.budget-card {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 16px;
}

.budget-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--anthracite);
  margin-bottom: 8px;
}

.budget-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e3edf4;
  border-radius: 4px;
  overflow: hidden;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--anthracite);
  min-width: 40px;
  text-align: right;
}

/* Budgets par catégorie placeholder */
.placeholder-category-budgets {
  margin-bottom: 20px;
}

.budgets-table {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Export placeholder */
.placeholder-export-options {
  margin-bottom: 20px;
}

.export-format, .export-period {
  margin-bottom: 12px;
}

.placeholder-export-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Catégories placeholder */
.placeholder-categories-list {
  margin-bottom: 20px;
}

.categories-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.categories-list {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Séparateur du menu */
.menu-separator {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 16px 0;
}

/* Footer du drawer */
.sidepanel-footer {
  padding: 16px 20px;
  border-top: 1px solid #e3edf4;
  background: transparent;
  flex-shrink: 0;
  margin-top: auto;
  display: none; /* Masqué par défaut, affiché seulement dans les paramètres */
}

/* S'assurer que le footer est visible dans les paramètres */
#panel-settings ~ .sidepanel-footer,
.sidepanel.show-settings .sidepanel-footer {
  display: block !important;
}

.sidepanel-footer .btn {
  width: 100%;
  justify-content: center;
}

/* Focus trap pour l'accessibilité */
.sidepanel:focus-within {
  outline: none;
}

/* Verrouillage du scroll du body quand le panneau est ouvert */
body.sidepanel-open {
  overflow: hidden;
}

/* ===== Règles de mot de passe ===== */
.password-rules {
  margin-top: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  font-size: 12px;
}

.rule {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.rule:last-child {
  margin-bottom: 0;
}

.rule-icon {
  font-size: 14px;
  min-width: 16px;
  text-align: center;
}

.rule-icon.valid {
  color: var(--green);
}

.rule-icon.invalid {
  color: var(--red);
}

.rule-text {
  color: var(--anthracite);
  line-height: 1.3;
}

.field-help {
  margin-top: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-small {
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
}

.link-small:hover {
  text-decoration: underline;
}

.match-status {
  font-size: 14px;
}

.match-status.valid {
  color: var(--green);
}

.match-status.invalid {
  color: var(--red);
}

/* ===== Onglet Notifications ===== */
.notifications-panel {
  padding: 16px;
}

.notifications-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e3edf4;
}

.notifications-header h3 {
  margin: 0;
  flex: 1;
}

.notifications-content {
  flex: 1;
  overflow-y: auto;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-item {
  background: #fff;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.notification-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-color: var(--primary-2);
}

.notification-item.unread {
  border-left: 4px solid var(--primary);
  background: #f0f8ff;
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.notification-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.notification-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  color: white;
}

.notification-icon.balance { background: var(--red); }
.notification-icon.transaction { background: var(--blue); }
.notification-icon.recurrent { background: var(--green); }
.notification-icon.report { background: var(--primary-2); }

.notification-title {
  font-weight: 600;
  color: var(--anthracite);
  font-size: 14px;
  flex: 1;
}

.notification-date {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
}

.notification-body {
  color: #666;
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.notification-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.notification-action {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid #e3edf4;
  color: #666;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-action:hover {
  background: #f0f8ff;
  border-color: var(--primary-2);
  color: var(--primary);
}

.notification-action.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.notification-action.primary:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
}

.notifications-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.empty-state {
  text-align: center;
  color: #666;
}

.empty-state .material-symbols-outlined {
  font-size: 48px;
  color: #ccc;
  margin-bottom: 16px;
}

.empty-state h4 {
  margin: 0 0 8px 0;
  color: var(--anthracite);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

/* ===== Onglet Paramètres ===== */
.settings-panel {
  padding: 16px;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e3edf4;
}

.settings-header h3 {
  margin: 0;
  flex: 1;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #f0f8ff;
  border: 1px solid #e5f2fb;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: #e5f2fb;
  border-color: var(--primary-2);
}

.btn-back .material-symbols-outlined {
  font-size: 16px;
}

.settings-section {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e3edf4;
}

.settings-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--anthracite);
}

.settings-section .field {
  margin-bottom: 16px;
}

.settings-section .field:last-child {
  margin-bottom: 0;
}

.settings-section label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--anthracite);
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d9e0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--anthracite);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(50, 130, 174, 0.1);
}

.checkbox-label {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 0 !important;
}

.checkbox-label.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-checkbox {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label.disabled .form-checkbox {
  cursor: not-allowed;
}

.checkbox-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--anthracite);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d9e0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--anthracite);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(50, 130, 174, 0.1);
}

.form-input[readonly] {
  background: #f8f9fa;
  color: #666;
  cursor: not-allowed;
}

.form-color {
  width: 40px;
  height: 32px;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

.color-selectors {
  display: flex;
  gap: 16px;
  align-items: center;
}

.color-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-selector label {
  font-size: 11px;
  font-weight: 500;
  color: #666;
  margin: 0;
}

.export-buttons {
  display: flex;
  gap: 8px;
}

.about-content {
  background: #f9fcfe;
  border: 1px solid #e3edf4;
  border-radius: 8px;
  padding: 16px;
}

.about-content p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--anthracite);
}

.about-content p:last-of-type {
  margin-bottom: 12px;
}

.about-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.about-links .link-small {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
}

.about-links .link-small:hover {
  text-decoration: underline;
}

.settings-actions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e3edf4;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* ===== Mode Compact ===== */
body.is-compact {
  --tx-row-height: 20px; /* Réduire la hauteur des transactions */
  --tx-gap: 2px; /* Réduire l'espace entre les transactions */
  --day-header-h: 22px; /* Réduire la hauteur des en-têtes de jour */
  --band-top-h: 50px; /* Réduire la hauteur du bandeau */
  --navbar-h: 36px; /* Réduire la hauteur de la navbar */
  --footer-h: 20px; /* Réduire la hauteur du footer */
  --calendar-bottom-gap: 8px; /* Réduire l'espace sous le calendrier */
}

body.is-compact .month-topbar {
  padding: 4px 8px;
  margin: 6px 8px;
}

body.is-compact .navbar {
  padding: 4px 8px;
  margin: 6px 8px;
}

body.is-compact .pill {
  padding: 4px 8px;
  font-size: 12px;
}

body.is-compact .btn {
  padding: 4px 8px;
  min-height: 28px;
}

body.is-compact .btn.small {
  padding: 2px 6px;
  min-height: 24px;
}

body.is-compact .sidepanel {
  padding: 12px;
}

body.is-compact .settings-panel {
  padding: 12px;
}

body.is-compact .settings-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
}

body.is-compact .settings-actions {
  margin-top: 16px;
  padding-top: 12px;
}

/* ===== Focus visible pour l'accessibilité ===== */
.form-select:focus-visible,
.form-checkbox:focus-visible,
.settings-actions .btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== SPA Pages ===== */
.page {
  min-height: 100vh;
  padding: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--anthracite);
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-2);
}

.page-placeholder {
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--anthracite);
}

.page-placeholder p {
  margin: 10px 0;
  font-size: 16px;
}


/* Gestion de l'attribut hidden */
[hidden] {
  display: none !important;
}

/* ===== Responsive pour mobile ===== */
@media (max-width: 768px) {
  .settings-actions {
    flex-direction: column;
  }
  
  .settings-actions .btn {
    flex: none;
    width: 100%;
  }
  
  .page {
    padding: 15px;
  }
  
  .page-title {
    font-size: 20px;
  }
  
  .page-placeholder {
    padding: 30px 20px;
  }
}

/* ===== Sous-onglets Split & Dettes ===== */
.subtab-navigation {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
  background: #f9fcfe;
  border-radius: 8px 8px 0 0;
  padding: 4px;
}

.subtab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  color: var(--anthracite);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
  flex: 1;
  text-align: center;
}

.subtab-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
}

.subtab-btn[aria-selected="true"] {
  color: var(--primary);
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.subtab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: #999;
  background: #f5f5f5;
}

.subtab-btn:disabled:hover {
  background: #f5f5f5;
  color: #999;
}

.subtab-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.subtab-panels {
  min-height: 400px;
}

.subtab-panel {
  display: none;
}

.subtab-panel.active {
  display: block;
}

/* Placeholders Split & Dettes */
.split-placeholder,
.debt-placeholder {
  background: white;
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
}

.split-placeholder h3,
.debt-placeholder h3 {
  margin: 0 0 20px 0;
  color: var(--anthracite);
  font-size: 20px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--anthracite);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.field-help {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  font-style: italic;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  justify-content: center;
}

.form-actions .btn {
  padding: 12px 24px;
  font-weight: 500;
}

.form-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive pour les sous-onglets */
@media (max-width: 768px) {
  .subtab-navigation {
    flex-direction: column;
  }
  
  .subtab-btn {
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  
  .subtab-btn[aria-selected="true"] {
    border-left-color: var(--primary);
    border-bottom-color: transparent;
  }
  
  .split-placeholder,
  .debt-placeholder {
    padding: 20px;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* ===== Thème sombre ===== */
.dark-theme {
  --white: var(--white-dark);
  --anthracite: var(--anthracite-dark);
  --bg: #1a1a1a;
  --shadow: 0 8px 20px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.2);
}

.dark-theme .btn {
  background: #2a2a2a;
  color: var(--anthracite-dark);
  border-color: #444;
}

.dark-theme .btn:hover {
  background: #333;
}

.dark-theme .form-input,
.dark-theme .form-select,
.dark-theme .form-color {
  background: #2a2a2a;
  color: var(--anthracite-dark);
  border-color: #444;
}

.dark-theme .settings-panel {
  background: #2a2a2a;
  color: var(--anthracite-dark);
}

.dark-theme .settings-section {
  border-color: #444;
}

/* ===== Styles des notifications ===== */
.notifications-panel {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.notifications-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.notifications-list {
  flex: 1;
  overflow-y: auto;
}

.notifications-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--anthracite);
  opacity: 0.7;
}

.notifications-empty .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.notification-item {
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.notification-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.notification-item.unread {
  border-left: 4px solid var(--primary);
  background: rgba(50, 130, 174, 0.05);
}

.notification-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.notification-icon {
  font-size: 16px;
}

.notification-title {
  font-weight: 600;
  flex: 1;
  color: var(--anthracite);
}

.notification-date {
  font-size: 12px;
  color: var(--anthracite);
  opacity: 0.7;
}

.notification-body {
  font-size: 14px;
  color: var(--anthracite);
  opacity: 0.8;
  margin-bottom: 8px;
}

.notification-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notification-action {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--white);
  color: var(--anthracite);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-action:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.notification-action.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.notification-action.primary:hover {
  background: #2e79a1;
}

/* ===== Styles des paramètres ===== */
.settings-panel {
  padding: 20px;
  background: white;
  border-radius: var(--radius);
  margin: 10px;
  /* Suppression de max-height et overflow-y pour éviter le double scroll */
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.settings-header h3 {
  margin: 0;
  color: var(--anthracite);
  font-size: 20px;
  font-weight: 600;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: var(--anthracite);
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: #e9e9e9;
  border-color: #ccc;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h4 {
  margin: 0 0 16px 0;
  color: var(--anthracite);
  font-size: 16px;
  font-weight: 600;
}

.field {
  margin-bottom: 20px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--anthracite);
  font-size: 14px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-color {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--anthracite);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-color:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(50, 130, 174, 0.1);
}

.form-color {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

.field-help {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--anthracite);
}

.form-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.color-selectors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.color-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-selector label {
  font-size: 12px;
  color: #666;
  margin: 0;
}

.export-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.export-buttons .btn {
  flex: 1;
}

.settings-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.about-content {
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.about-content p {
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

.about-content p:last-child {
  margin-bottom: 0;
}

.about-content strong {
  color: var(--anthracite);
  font-weight: 600;
}

.about-links {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.about-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
}

.about-links a:hover {
  color: var(--primary-2);
  text-decoration: underline;
}

/* ===== Pastille de notification ===== */
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-menu {
  position: relative;
}

/* ===== Responsive pour les paramètres ===== */
@media (max-width: 768px) {
  .settings-panel {
    margin: 5px;
    padding: 16px;
    max-height: calc(100vh - 100px);
  }
  
  .color-selectors {
    grid-template-columns: 1fr;
  }
  
  .settings-actions {
    flex-direction: column;
  }
  
  .about-links {
    flex-direction: column;
    gap: 8px;
  }
}
