/* modules/budget/budget.css */

/* --- 1. VARIABLES & BASE --- */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --bg-page: #f1f5f9;
  --bg-card: #ffffff;

  --text-main: #1e293b;
  --text-muted: #64748b;

  --radius-l: 16px;
  --radius-m: 10px;
  --radius-s: 6px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* --- 2. LAYOUT & CONTAINER --- */
.budget-view {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--text-main);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.view-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.025em;
}

.nens-title.theme-pol {
  color: #1e3a8a !important;
  background: #eaf2ff !important;
  border-left: 4px solid #1e3a8a !important;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
}

.nens-table.theme-pol thead th {
  background: #f5f9ff !important;
  color: #1e3a8a !important;
}

.nens-table.theme-pol {
  border-top: 2px solid #bcd3ff !important;
}

.nens-title.theme-pep {
  color: #14532d !important;
  background: #eaf7ea !important;
  border-left: 4px solid #14532d !important;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
}

.nens-table.theme-pep thead th {
  background: #f6fdf6 !important;
  color: #14532d !important;
}

.nens-table.theme-pep {
  border-top: 2px solid #b9e3b9 !important;
}

/* --- 3. NAVIGATION TABS (Pills) --- */
.budget-tabs-container {
  display: inline-flex;
  background: var(--bg-card);
  padding: 6px;
  border-radius: 50px;
  box-shadow: var(--shadow-md);
  gap: 8px;
  position: relative;
  z-index: 10;
}
.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 40px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}
.tab-item:hover {
  background-color: var(--bg-page);
  color: var(--text-main);
}
.tab-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: scale(1.02);
}
.tab-icon {
  font-size: 1.1em;
  line-height: 1;
}

.owner-tabs {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 4px;
}
.owner-tab {
  padding: 6px 20px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  transition: 0.2s;
}
.owner-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- 4. BOUTONS UNIFIÉS (Global) --- */

/* Style de Base (Taille Standard : 40px) */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  height: 40px; /* Hauteur Fixe */
  padding: 0 24px;

  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: 1px solid transparent;
  border-radius: 50px;

  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.pf-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Variante Secondaire (Fond Blanc) */
.pf-btn.btn-secondary {
  background: white;
  color: var(--text-muted);
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

.pf-btn.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Boutons Icônes seuls */
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-s);
  transition: background 0.2s;
}
.btn-icon {
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: #e2e8f0;
  transform: scale(1.1);
}

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

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

.month-actions .btn-icon-small {
  font-size: 0.75rem;
  padding: 2px 6px;
  height: 24px;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.month-actions .btn-icon-small:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* --- 5. TABLEAU MODERNE --- */
.pf-table {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.pf-table th {
  background: #f8fafc;
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.pf-table td {
  padding: 3px 16px;
  border-bottom: 1px solid var(--bg-page);
  vertical-align: middle;
  font-size: 0.95rem;
}
.pf-table tbody tr:last-child td {
  border-bottom: none;
}
.pf-table tbody tr:hover {
  background-color: #f8fafc;
}

.row-income td:first-child {
  border-left: 4px solid var(--success);
}
.row-expense td:first-child {
  border-left: 4px solid var(--danger);
}
.row-estimate td:first-child {
  border-left: 4px solid var(--warning);
}
.row-estimate td {
  color: var(--text-muted);
  font-style: italic;
}

.table-responsive {
  overflow-x: auto;
}
.sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 2;
  border-right: 1px solid var(--bg-page);
  min-width: 150px;
}

.cell-amount {
  font-family: "Consolas", "Monaco", monospace;
  font-weight: 700;
}
.cell-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
}

.savings-table .row-extres td {
  background: #fffbeb;
  border-top: 2px solid #e2e8f0;
}

/* Bouton supprimer au survol (Style Epargne) */
.btn-cell-delete {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  text-decoration: none;
  transition: all 0.2s;
}
.btn-cell-delete:hover {
  background: var(--danger);
  color: white;
}
td:hover .btn-cell-delete {
  display: flex;
}

.pf-table tfoot {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
}
.pf-table tfoot td {
  padding: 18px 16px;
  border-top: 1px solid #e2e8f0;
}

/* --- 6. FORMULAIRES & INPUTS --- */
.pf-label {
  display: block;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.pf-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-m);
  font-size: 1rem;
  background: #f8fafc;
  color: var(--text-main);
  box-sizing: border-box;
  transition: all 0.2s;
}
.pf-input:focus {
  background: var(--bg-card);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.form-group {
  margin-bottom: 16px;
}

input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  vertical-align: middle;
  margin-right: 8px;
}
input[type="checkbox"]:checked {
  background-color: var(--success);
  border-color: var(--success);
}
input[type="checkbox"]:checked::after {
  content: "✓";
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* Suppression flèches input number (Cross-browser) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* --- 7. MODALE --- */
.pf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pf-modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@keyframes modalPop {
  from {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.pf-modal-title {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 15px;
  margin-bottom: 8px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* --- 8. UTILITAIRES & BADGES --- */
.text-success {
  color: var(--success);
}
.text-danger {
  color: var(--danger);
}
.text-muted {
  color: var(--text-muted);
}
.font-bold {
  font-weight: 700;
}
.badge-type {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-type.mensuel {
  background: #eff6ff;
  color: var(--primary);
}
.badge-type.annuel {
  background: #f3e8ff;
  color: #9333ea;
}
.budget-note {
  margin-top: 15px;
  font-size: 0.85em;
  opacity: 0.8;
  color: var(--text-muted);
}

/* --- 9. MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
  .budget-tabs-container {
    display: flex;
    width: 100%;
    overflow-x: auto;
    border-radius: 15px;
    justify-content: space-between;
  }
  .tab-item {
    padding: 10px 15px;
    flex: 1;
    justify-content: center;
    white-space: nowrap;
    font-size: 0.85rem;
  }
  .view-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .pf-btn {
    width: 100%;
    justify-content: center;
    margin-top: 5px;
  }
  .pf-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* --- 10. BUDGET PREVISIONNEL (TIMELINE) --- */

.prev-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.prev-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}
.prev-section-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
}

/* Inputs "Invisible" */
.prev-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
  padding: 4px 0;
  border-radius: 4px;
  transition: all 0.2s;
}
.prev-input:hover,
.prev-input:focus {
  background: #eef2ff;
  border-color: #6366f1;
  outline: none;
}
.prev-input.bold-blue {
  color: #0284c7;
  font-weight: 700;
}

/* Tableaux Config & Alloc */
.prev-salary-table {
  width: 100%;
  max-width: 900px;
  background: var(--bg-card);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.prev-salary-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}
.prev-salary-table th:first-child {
  text-align: left;
}
.prev-salary-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
}

.prev-timeline-wrapper {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-l);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-top: 15px;
}
.prev-alloc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
}
.prev-alloc-table th {
  padding: 6px 10px;
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
  text-align: center;
  font-size: 0.9rem;
}

.prev-alloc-table td {
  padding: 3px 14px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
  text-align: center;
  font-size: 0.9rem;
}

/* Colonne Sticky */
.col-sticky {
  position: sticky !important;
  left: 0 !important;
  z-index: 10;
  background-color: var(--bg-card);
  border-right: 2px solid #e2e8f0;
  text-align: left !important;
  min-width: 220px;
  font-weight: 600;
  color: var(--text-main);
}
.col-sticky.header-cell {
  top: 0;
  z-index: 30 !important;
  background-color: #f8fafc;
  color: var(--text-muted);
}
.col-sticky small {
  display: block;
  font-weight: normal;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.75rem;
}

/* En-têtes Mois */
.th-month {
  background: #1e293b !important;
  color: white !important;
  font-size: 0.85rem !important;
  border-left: 2px solid white;
  padding: 8px !important;
}
.th-month.current {
  background: var(--primary) !important;
}
.th-sub {
  font-size: 0.7rem !important;
  text-transform: uppercase;
  background: #f8fafc;
  color: var(--text-muted);
}

/* Lignes */
.row-total td {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  border-top: 2px solid #e2e8f0;
}
.row-restant td {
  background: #eff6ff;
  font-weight: 700;
  border-bottom: 2px solid #bfdbfe;
}

/* Couleurs */
.txt-alex {
  color: #0891b2;
}
.txt-laia {
  color: #f59e0b;
}
.txt-global {
  color: var(--text-muted);
  font-weight: 700;
  background: #f8fafc;
}
.val-ok {
  color: var(--success);
}
.val-ko {
  color: var(--danger);
}

/* Navigation */
.nav-group {
  display: flex;
  gap: 5px;
}
.btn-nav {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: var(--radius-s);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: 0.2s;
}
.btn-nav:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #94a3b8;
}

/* --- ACTIONS SUR LIGNES (Edit / Delete) --- */
.row-actions {
  display: none; /* Masqué par défaut */
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  gap: 4px;
  background: rgba(255, 255, 255, 0.9); /* Petit fond pour lisibilité */
  padding: 2px;
  border-radius: 4px;
}

/* On affiche au survol de la cellule */
td:hover .row-actions {
  display: flex;
}

.btn-icon-action {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.btn-icon-action.edit {
  color: #3b82f6;
} /* Bleu */
.btn-icon-action.edit:hover {
  background: #eff6ff;
}

.btn-icon-action.delete {
  color: #ef4444;
} /* Rouge */
.btn-icon-action.delete:hover {
  background: #fef2f2;
}

/* --- 11. RÉCAPITULATIF VIREMENTS (Tableau Unique) --- */

.recap-wrapper {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center; /* Centré */
}

.recap-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 100%;
  max-width: 600px; /* Pas trop large pour rester lisible */
}

.recap-header {
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.recap-table {
  width: 100%;
  border-collapse: collapse;
}

.recap-table th,
.recap-table td {
  padding: 10px 15px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  font-size: 0.95rem;
}

.recap-table th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

/* Colonne Labels (Gauche) */
.recap-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: #1e293b;
}

/* Colonne Alex (Cyan) */
.col-alex {
  background-color: #ecfeff;
  color: #0891b2;
  border-left: 1px solid #cffafe;
}
th.col-alex {
  background-color: #cffafe;
  border-bottom-color: #a5f3fc;
}

/* Colonne Laia (Ambre) */
.col-laia {
  background-color: #fffbeb;
  color: #d97706;
  border-left: 1px solid #fef3c7;
}
th.col-laia {
  background-color: #fef3c7;
  border-bottom-color: #fde68a;
}

/* Colonne Global */
.col-global {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  border-left: 2px solid #e2e8f0;
}

/* Ligne Grand Total */
.row-grand-total td {
  background-color: #1e293b;
  color: white;
  font-weight: 800;
  border: none;
  padding: 12px 15px;
}
/* On garde les couleurs de texte même sur fond sombre pour la lisibilité */
.row-grand-total .col-alex {
  background: #164e63;
  color: #67e8f9;
  border: none;
}
.row-grand-total .col-laia {
  background: #78350f;
  color: #fcd34d;
  border: none;
}
.row-grand-total .col-global {
  background: #334155;
  color: white;
  border: none;
}

/* --- 12. OPTIMISATIONS MOBILES (Mode Largeur Fixe 680px) --- */

@media (max-width: 768px) {
  /* 1. ON FORCE TOUT LE SITE A FAIRE MINIMUM 680px */
  /* Cela inclut le Header et le Footer global */
  html,
  body {
    min-width: 680px !important;
    overflow-x: auto !important; /* Active le scroll horizontal global si besoin */
    position: relative;
  }

  /* Si ton header/footer a des classes spécifiques, ajoute-les ici */
  header,
  footer,
  .navbar,
  .site-header,
  .site-footer {
    min-width: 680px !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Le conteneur principal du budget */
  .budget-view {
    min-width: 680px !important;
    width: 100%;
    padding-right: 10px; /* Petite marge de sécurité */
  }

  /* 2. TABLEAU REVENUS (Doit s'afficher en entier sans scroll interne) */
  .prev-salary-table {
    min-width: 100%; /* Prend toute la largeur dispo (680px) */
    width: 100%;
  }

  /* 3. TABLEAU REPARTITION (Timeline) */
  /* Lui est très large (> 1000px). On le laisse scroller DANS la page de 680px */
  .prev-timeline-wrapper {
    width: 100%;
    overflow-x: auto !important; /* Scrollbar interne */
    display: block;
  }

  /* 4. ACTIONS (Crayon/Poubelle) */
  /* On garde la logique "au clic" car c'est plus sûr sur mobile */
  .row-actions {
    display: none !important;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: #ffffff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 0 10px;
    align-items: center;
    gap: 10px;
    z-index: 50;
    border-left: 1px solid #e2e8f0;
  }
  .row-actions.show-actions {
    display: flex !important;
  }

  /* On ajuste la taille des icônes à cette vue dézoomée */
  .btn-icon-action {
    font-size: 1.2rem;
    padding: 5px;
    width: 34px;
    height: 34px;
  }

  /* 5. COLONNE STICKY */
  /* Puisque la page est large, on peut laisser une largeur confortable */
  .col-sticky {
    min-width: 180px !important;
    position: sticky !important;
    left: 0;
  }

  /* 6. HEADER DE SECTION (Alignement) */
  .prev-section-header {
    flex-direction: row; /* On peut garder aligné car on a de la place (680px) */
    align-items: center;
  }
}

/* ============================================================================
   13. STYLES SPÉCIFIQUES AU SUIVI MENSUEL (suivi.php)
   ============================================================================ */

.cat-card {
  background: var(--bg-card);
  border-radius: var(--radius-l);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.btn-add-item {
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-add-item:hover {
  background: var(--bg-card);
  transform: rotate(90deg) scale(1.1);
  box-shadow: var(--shadow-sm);
  border-color: currentColor;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Animation "Charges à venir" */
.fade-pulse {
  animation: pulseText 2s infinite;
}
@keyframes pulseText {
  0% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.8;
  }
}

/* Navigation par mois (Si elle n'est pas déjà gérée par .nav-group au-dessus) */
.suivi-nav-group {
  display: flex;
  background: #e2e8f0;
  border-radius: var(--radius-s);
  overflow: hidden;
}
.suivi-btn-nav {
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: bold;
  border-right: 1px solid #cbd5e1;
  transition:
    background 0.2s,
    color 0.2s;
}
.suivi-btn-nav:last-child {
  border-right: none;
}
.suivi-btn-nav:hover {
  background: var(--bg-card);
  color: var(--primary);
}

/* Sélecteur dynamique de mois (dans l'import CSV) */
input[type="month"].pf-input {
  font-family: inherit;
  color: var(--text-main);
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-s);
}

/* ============================================================================
   14. EPARGNE (epargne.php)
   ============================================================================ */

/* Style compact pour les inputs intégrés au tableau d'épargne */
.epargne-inline-input {
  width: 100%;
  min-width: 60px;
  max-width: 85px;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  padding: 2px 4px;
  border-radius: 4px;
  transition: 0.2s;
  font-size: 0.85rem;
  margin: 0 auto;
}

.epargne-inline-input:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.epargne-inline-input:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* ==========================================================================
   COMPOSANT : CALCULATRICE FLOTTANTE (SOMME RAPIDE)
   ========================================================================== */

/* Bouton flottant à DROITE */
.pf-fab-sum {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #2563eb; /* Bleu primaire unifié */
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pf-fab-sum:hover {
  transform: scale(1.1);
  background-color: #1d4ed8;
}

.pf-fab-sum.active {
  background-color: #10b981; /* Devient vert quand activé */
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
}

/* Barre de résultat en bas au centre */
.pf-sum-bar {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
  background: white;
  padding: 12px 24px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 9998;
  border: 1px solid #e2e8f0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: inherit;
}

.pf-sum-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.pf-sum-label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
}

.pf-sum-value {
  font-size: 1.2rem;
  color: #0f172a;
  font-weight: bold;
}

.pf-sum-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.pf-sum-close:hover {
  color: #ef4444; /* Croix rouge au survol */
}

/* Effets sur le curseur quand le mode est actif */
body.sum-mode-active {
  cursor: cell !important;
}

body.sum-mode-active input,
body.sum-mode-active .sum-target {
  cursor: cell !important;
}

/* Style des champs/cellules sélectionnés */
.sum-selected {
  outline: 2px dashed #10b981 !important;
  outline-offset: -2px;
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  transition: background-color 0.2s;
}
