/* modules/budget/budget.css */

/* --- 1. VARIABLES & BASE --- */
.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;
}

/* Thèmes des tableaux */
.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;
}

/* --- 2. NAVIGATION TABS (Pills) --- */
.budget-tabs-container {
  display: inline-flex;
  background: var(--bg-panel);
  padding: 6px;
  border-radius: 50px;
  box-shadow: var(--shadow);
  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-panel);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- 3. BOUTONS SPÉCIFIQUES & ACTIONS --- */
.pf-btn {
  border-radius: 50px;
}
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: background 0.2s;
  font-size: 1.1rem;
}
.btn-icon:hover {
  background: #e2e8f0;
  transform: scale(1.1);
}
.btn-safe-click {
  position: relative;
  z-index: 10 !important;
  pointer-events: auto !important;
}

.month-actions {
  display: flex;
  gap: 4px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
.month-header-container:hover .month-actions {
  opacity: 1;
}
.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;
}

/* --- 4. TABLEAU MÉTIER --- */
.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 !important;
  left: 0 !important;
  background: var(--bg-panel) !important;
  z-index: 20 !important;
  border-right: 1px solid var(--bg-page);
  min-width: 150px;
}
th.sticky-col {
  z-index: 30 !important;
  background: #f8fafc !important;
}

.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;
}

.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;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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;
}

/* --- 5. MODALES (Extras Budget) --- */
.pf-modal-content.modal-large {
  max-width: 900px;
  transition: max-width 0.3s ease;
}
.import-table-wrapper {
  max-height: 45vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}
.import-dropzone {
  border: 2px dashed #cbd5e1;
  padding: 40px 20px;
  text-align: center;
  border-radius: 12px;
  background: #f8fafc;
}

/* --- 6. 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);
}

/* --- 7. BUDGET PREVISIONNEL (TIMELINE) --- */
.prev-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.prev-section-header {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  width: 100% !important;
  box-sizing: border-box;
}
.prev-section-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
}
.prev-header-left {
  display: flex;
  gap: 10px;
  align-items: center;
}
.prev-header-actions {
  display: flex;
  gap: 10px;
}

/* Configuration Chromatique Parent 1 & 2 */
.txt-p1,
.txt-alex {
  color: color-mix(in srgb, var(--p1-main, #0891b2) 85%, #000000) !important;
  font-weight: bold;
  text-align: center;
}
.col-p1,
.col-alex {
  color: color-mix(in srgb, var(--p1-main, #0891b2) 85%, #000000) !important;
  text-align: center;
}
th.col-p1,
td.col-p1 {
  background-color: color-mix(
    in srgb,
    var(--p1-main, #0891b2) 8%,
    #ffffff
  ) !important;
  text-align: center;
}
input.txt-p1 {
  color: color-mix(in srgb, var(--p1-main, #0891b2) 85%, #000000) !important;
  text-align: center;
  font-weight: 600;
}
input.txt-p1:focus {
  border-color: var(--p1-main, #0891b2) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--p1-main, #0891b2) 10%, #ffffff) !important;
}

.txt-p2 {
  color: color-mix(in srgb, var(--p2-main, #f59e0b) 85%, #000000) !important;
  font-weight: bold;
  text-align: center;
}
.col-p2 {
  color: color-mix(in srgb, var(--p2-main, #f59e0b) 85%, #000000) !important;
  text-align: center;
}
th.col-p2,
td.col-p2 {
  background-color: color-mix(
    in srgb,
    var(--p2-main, #f59e0b) 8%,
    #ffffff
  ) !important;
  text-align: center;
}
input.txt-p2 {
  color: color-mix(in srgb, var(--p2-main, #f59e0b) 85%, #000000) !important;
  text-align: center;
  font-weight: 600;
}
input.txt-p2:focus {
  border-color: var(--p2-main, #f59e0b) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--p2-main, #f59e0b) 10%, #ffffff) !important;
}

.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;
}

.prev-salary-table {
  width: 100%;
  max-width: 900px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  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 small {
  font-weight: normal;
  text-transform: none;
}
.prev-salary-table th.th-family-savings,
.prev-salary-table td.td-family-savings {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}
.prev-salary-table th:first-child {
  text-align: left;
}
.prev-salary-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  vertical-align: middle;
}

.prev-salary-table tbody tr:nth-child(1) td:first-child {
  text-align: left !important;
  font-weight: bold !important;
  color: var(--text-main) !important;
  border-left: 4px solid var(--p1-main, #0891b2) !important;
}
.prev-salary-table tbody tr:nth-child(2) td:first-child {
  text-align: left !important;
  font-weight: bold !important;
  color: var(--text-main) !important;
  border-left: 4px solid var(--p2-main, #f59e0b) !important;
}

.prev-timeline-wrapper {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: var(--bg-panel);
  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 var(--border-light);
  white-space: nowrap;
  text-align: center;
  font-size: 0.9rem;
}
.prev-alloc-table td {
  padding: 3px 10px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.col-sticky {
  position: sticky !important;
  left: 0 !important;
  z-index: 10;
  background-color: var(--bg-panel);
  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;
}

.th-month {
  background: #1e293b !important;
  color: white !important;
  font-size: 0.85rem !important;
  border-left: 2px solid white;
  padding: 8px !important;
}
.th-month span {
  text-transform: capitalize;
}
.th-month .cycle-start-label {
  font-size: 0.75rem;
  font-weight: normal;
  color: #64748b;
  margin-top: 2px;
}
.th-month.current {
  background: var(--primary) !important;
}
.th-sub {
  font-size: 0.7rem !important;
  text-transform: uppercase;
  background: #f8fafc;
  color: var(--text-muted);
}

.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;
}
.row-restant td.td-separator {
  border-left: 2px solid #cbd5e1;
  background: #e2e8f0;
}
.row-indicative {
  background: #f8fafc;
  color: #94a3b8;
}
.row-indicative .col-sticky {
  opacity: 0.8;
}
.cat-name-label {
  font-weight: 600;
  color: var(--text-main);
}
.row-indicative .cat-name-label {
  color: #64748b;
}
.row-indicative .cat-name-label span {
  font-size: 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 5px;
}
.cat-target-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: right;
}
.txt-global {
  color: var(--text-muted);
  font-weight: 700;
  background: #f8fafc;
  border-left: 2px solid #e2e8f0;
}
.val-ok {
  color: var(--success);
}
.val-ko {
  color: var(--danger);
}

.nav-group {
  display: flex;
  gap: 5px;
}
.btn-nav {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  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;
}

.row-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50 !important;
  opacity: 0;
  pointer-events: none;
  display: flex;
  gap: 8px;
  transition: opacity 0.2s ease-in-out;
}
tr:hover .row-actions {
  opacity: 1;
  pointer-events: auto !important;
}

/* --- 8. RÉCAPITULATIF VIREMENTS --- */
.recap-wrapper {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
}
.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;
}
.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-header span {
  text-transform: capitalize;
}
.recap-table {
  width: 100%;
  border-collapse: collapse;
}
.recap-table th,
.recap-table td {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  vertical-align: middle;
  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;
}
.recap-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: #1e293b;
}

.recap-th-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.recap-th-content span {
  text-transform: uppercase;
}
.validation-badge {
  background: #10b981;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.recap-table .pf-btn.btn-small {
  background: #ffffff !important;
  font-size: 0.7rem !important;
  padding: 2px 8px !important;
  height: auto !important;
  width: auto !important;
  font-weight: 600;
  border-radius: 9px !important;
  box-shadow: none !important;
  transform: none !important;
  transition: all 0.2s ease;
}
.col-p1 .pf-btn.btn-small {
  color: var(--p1-main, #0891b2) !important;
  border: 1px solid var(--p1-main, #0891b2) !important;
}
.col-p1 .pf-btn.btn-small:hover {
  background: color-mix(
    in srgb,
    var(--p1-main, #0891b2) 12%,
    #ffffff
  ) !important;
}
.col-p2 .pf-btn.btn-small {
  color: var(--p2-main, #f59e0b) !important;
  border: 1px solid var(--p2-main, #f59e0b) !important;
}
.col-p2 .pf-btn.btn-small:hover {
  background: color-mix(
    in srgb,
    var(--p2-main, #f59e0b) 12%,
    #ffffff
  ) !important;
}

.row-grand-total td {
  background-color: #1e293b;
  color: white;
  font-weight: 800;
  border: none;
  padding: 12px 15px;
}
.row-grand-total .col-p1 {
  background: color-mix(
    in srgb,
    var(--p1-main, #0891b2) 65%,
    #000000
  ) !important;
  color: color-mix(in srgb, var(--p1-main, #0891b2) 20%, #ffffff) !important;
  border: none;
}
.row-grand-total .col-p2 {
  background: color-mix(
    in srgb,
    var(--p2-main, #f59e0b) 65%,
    #000000
  ) !important;
  color: color-mix(in srgb, var(--p2-main, #f59e0b) 20%, #ffffff) !important;
  border: none;
}
.row-grand-total .col-global {
  background: #334155;
  color: white;
  border: none;
}

/* --- 9. STYLES DU SUIVI MENSUEL --- */
.cat-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.cat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  width: 100%;
}
.cat-card-title-group {
  display: flex;
  flex-direction: column;
}
.cat-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}
.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-panel);
  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;
}
.fade-pulse {
  animation: pulseText 2s infinite;
}
@keyframes pulseText {
  0% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.8;
  }
}
.suivi-nav-group {
  display: flex;
  background: #e2e8f0;
  border-radius: 6px;
  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-panel);
  color: var(--primary);
}
input[type="month"].pf-input {
  font-family: inherit;
  color: var(--text-main);
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

/* --- 10. SECTION NOTES BUDGETAIRES --- */
.budget-notes-section {
  margin: 20px 0;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
}
.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.notes-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #1e293b;
}
.notes-header h3 span {
  text-transform: capitalize;
}
.note-save-indicator {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s;
}
#monthNoteArea {
  width: 100%;
  resize: vertical;
  border-color: #cbd5e1;
  background: #f8fafc;
  margin-bottom: 10px;
}
.notes-footer {
  text-align: right;
}
.notes-footer .pf-btn {
  width: auto;
  display: inline-flex;
}

/* --- 11. EPARGNE --- */
.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);
}

/* --- 12. CALCULATRICE FLOTTANTE --- */
.pf-fab-sum {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #2563eb;
  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: 9000;
  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;
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
}
.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: 8999;
  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;
}
body.sum-mode-active {
  cursor: cell !important;
}
body.sum-mode-active input,
body.sum-mode-active .sum-target {
  cursor: cell !important;
}
.sum-selected {
  outline: 2px dashed #10b981 !important;
  outline-offset: -2px;
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  transition: background-color 0.2s;
}

/* --- 13. MODALE PARAMÈTRES BUDGET (Design System HouseHub) --- */
.budget-settings-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.budget-settings-backdrop.show {
  display: flex;
}
.budget-settings-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  width: 100%;
  max-width: 800px;
  height: 80vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  animation: modalIn 0.18s ease;
}
.bs-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bs-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-main);
}
.bs-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0 0.5rem;
}
.bs-close:hover {
  background: var(--bg-page);
  color: var(--text-main);
}
.bs-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.bs-sidebar {
  width: 200px;
  border-right: 1px solid var(--border-light);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.4rem;
  overflow-y: auto;
}
.bs-tab-btn {
  text-align: left;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  font-size: 0.9rem;
}
.bs-tab-btn:hover {
  background: var(--border-light);
  color: var(--text-main);
}
.bs-tab-btn.active {
  background: var(--text-main);
  color: var(--bg-panel);
}
.bs-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--bg-panel);
}
.bs-pane {
  display: none;
}
.bs-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Utilitaires et Formulaires Paramètres */
.bs-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--bg-panel);
}
.bs-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.bs-section-title {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 0;
  margin-bottom: 1rem;
}
.bs-section-subtitle {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 1rem;
}
.bs-section-subtitle.bordered {
  margin: 0 0 15px 0;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 5px;
  font-size: 0.95rem;
}

.bs-form-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.bs-form-inline.align-center {
  align-items: center;
}
.bs-input-flex {
  flex: 1;
  min-width: 150px;
  padding: 0.4rem 0.75rem;
}
.bs-input-fixed {
  width: 130px;
  padding: 0.4rem 0.75rem;
}
.bs-input-icon {
  width: 65px;
  padding: 0.4rem 0.2rem;
  font-size: 1.1rem;
  cursor: pointer;
  text-align: center;
}
.bs-input-color {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
}

.bs-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}
.bs-currency-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.bs-currency-select {
  width: 75px;
  padding: 3px 6px;
  font-size: 0.8rem;
  height: auto;
  cursor: pointer;
  background: var(--bg-page);
}
.bs-divider {
  margin: 1.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--border-light);
}
.bs-badge-default {
  font-size: 0.7em;
  background: var(--success);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

/* Onboarding Checklist */
.bs-onboarding-card {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 15px;
  margin-bottom: 25px;
  border-radius: 8px;
}
.bs-onboarding-title {
  margin: 0 0 10px 0;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
}
.bs-onboarding-desc {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: #d97706;
}
.bs-onboarding-list {
  margin: 0;
  padding-left: 20px;
  color: #b45309;
  font-size: 0.9rem;
  line-height: 1.8;
}
.bs-onboarding-list li {
  margin-bottom: 4px;
}
.bs-onboarding-list strong {
  font-size: 1.1rem;
  margin-right: 5px;
}
.bs-onboarding-link {
  color: #b45309;
  text-decoration: underline;
  font-weight: bold;
  cursor: pointer;
}

/* Affichage Tag Cloud Règles */
.bs-rule-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  margin-bottom: 1rem;
  color: var(--text-main);
  font-family: inherit;
}
.bs-accordion-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.bs-accordion-count {
  font-size: 0.8rem;
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: auto;
  margin-right: 10px;
}
.bs-rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0;
}
.bs-rule-tag {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.15s;
}
.bs-rule-tag:hover {
  border-color: var(--danger);
  background: #fef2f2;
}
.bs-rule-tag-del {
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  margin-top: -2px;
}
.bs-rule-tag:hover .bs-rule-tag-del {
  color: var(--danger);
}

/* CSV & Utils */
.bs-desc {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.bs-csv-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 25px;
  transition: all 0.2s;
  background: var(--bg-page);
}
.bs-csv-dropzone:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}
.bs-csv-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}
.bs-csv-title {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
}
.bs-csv-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.bs-csv-preview {
  display: none;
  background: var(--bg-page);
  padding: 15px;
  border-radius: var(--radius);
  border: 1px dashed var(--primary);
  margin-bottom: 25px;
}
.bs-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}
.bs-text-muted-normal {
  color: var(--text-muted);
  font-weight: normal;
}
.bs-card-gray {
  background: var(--bg-panel);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 15px;
}
.bs-input-mb {
  margin-bottom: 10px;
}
.bs-text-right {
  text-align: right;
}
.bs-csv-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: white;
}
.bs-csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
  white-space: nowrap;
}
.bs-csv-thead {
  background: var(--bg-page);
  border-bottom: 2px solid var(--border-light);
}
.bs-csv-th {
  padding: 10px 15px;
  font-weight: 600;
  color: var(--text-main);
  border-right: 1px solid var(--border-light);
}
.bs-csv-th-index {
  font-size: 0.75rem;
  color: var(--primary);
  margin-bottom: 2px;
}
.bs-csv-td-empty {
  padding: 15px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}
.bs-csv-tr {
  border-bottom: 1px solid #e2e8f0;
}
.bs-csv-td {
  padding: 10px 15px;
  color: var(--text-muted);
  border-right: 1px dashed #e2e8f0;
}

/* Ajouts Structure Global Budget */
.budget-hero {
  text-align: center;
  margin-bottom: 30px;
}
.budget-title-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}
.budget-title-group h1 {
  margin: 0;
}
.btn-settings-gear {
  position: relative;
}
.budget-error-msg {
  text-align: center;
  padding: 50px;
  color: var(--danger);
}

@keyframes pulse-warning {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Le bouton engrenage devient un simple conteneur fixe */
.btn-header-settings {
  position: relative;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  text-decoration: none;
  color: inherit;
}

/* C'est uniquement l'icône à l'intérieur qui tourne ! */
.gear-icon-anim {
  display: inline-block;
  transition: transform 0.4s ease-in-out;
}
.btn-header-settings:hover .gear-icon-anim {
  transform: rotate(90deg);
}

.alert-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger, #ef4444);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.85rem;
  font-weight: bold;
  position: absolute;
  top: -4px;
  right: -4px;
  animation: pulse-warning 2s infinite;
  border: 2px solid white;
  line-height: 1;
}

.alert-dot-inline {
  position: relative;
  top: auto;
  right: auto;
  display: inline-flex;
  margin-left: 6px;
  width: 16px;
  height: 16px;
  font-size: 0.75rem;
  border-width: 1px;
  animation: none; /* Pas de clignotement dans le menu pour ne pas agresser l'œil */
}

/* Responsive Modale Paramètres */
@media (max-width: 650px) {
  .bs-layout {
    flex-direction: column;
  }
  .bs-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 0.5rem;
    white-space: nowrap;
  }
  .bs-tab-btn {
    flex-shrink: 0;
  }
  .bs-content {
    padding: 1rem;
  }
}

/* Responsive Mobile Budget */
@media (max-width: 768px) {
  .budget-view {
    padding: 10px !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }
  .budget-tabs-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding-bottom: 5px;
    scrollbar-width: none;
  }
  .budget-tabs-container::-webkit-scrollbar {
    display: none;
  }
  .tab-item {
    flex: 0 0 auto !important;
    padding: 8px 16px !important;
  }
  .budget-view > div[style*="display:grid"] {
    gap: 10px !important;
    margin-bottom: 15px !important;
  }
  .budget-view > div[style*="display:grid"] > div {
    padding: 12px 10px !important;
  }
  .budget-view .categories-grid > .cat-card {
    padding: 0 !important;
  }
  .budget-view
    > div[style*="justify-content: space-between"]:not(.view-header) {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-top: 20px !important;
  }
  .budget-view
    > div[style*="justify-content: space-between"]:not(.view-header)
    > div:first-child {
    width: 100% !important;
  }
  .budget-view
    > div[style*="justify-content: space-between"]:not(.view-header)
    > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .budget-view
    > div[style*="justify-content: space-between"]:not(.view-header)
    > div:last-child
    .pf-btn {
    flex: 1 1 50% !important;
    padding: 0 5px !important;
    font-size: 0.8rem !important;
    justify-content: center;
  }
  .prev-section-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .prev-section-header > div {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .prev-section-header .nav-group {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
  }
  .prev-section-header .nav-group .btn-nav {
    flex: 1;
    text-align: center;
  }
  .prev-section-header .pf-btn {
    flex: 1 1 calc(50% - 10px) !important;
    width: auto !important;
    padding: 0 5px !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
  }
  .prev-salary-table,
  .prev-alloc-table,
  .pf-table,
  .savings-table,
  .recap-wrapper {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    border-radius: 8px !important;
    margin-bottom: 15px;
  }
  .recap-card {
    min-width: 100% !important;
    width: 100% !important;
  }
  .recap-table th,
  .recap-table td {
    padding: 8px 4px !important;
    font-size: 0.8rem !important;
  }
  .recap-header {
    font-size: 0.9rem !important;
    padding: 8px 10px !important;
  }
  .row-grand-total td {
    padding: 10px 4px !important;
  }
  .row-actions {
    position: static !important;
    display: inline-flex !important;
    opacity: 1 !important;
    box-shadow: none !important;
    background: transparent !important;
    border-left: none !important;
    padding: 1px 0 !important;
    transform: none !important;
    justify-content: flex-start;
    width: auto !important;
  }
  .col-sticky,
  .sticky-col {
    min-width: 120px !important;
    position: sticky !important;
    left: 0;
    z-index: 20 !important;
    white-space: normal !important;
    background: white !important;
  }
  th.sticky-col,
  th.col-sticky {
    z-index: 30 !important;
    background: #f8fafc !important;
  }
  .action-toolbar {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  .suivi-nav-group {
    width: 100%;
    justify-content: space-between;
  }
  .suivi-btn-nav {
    flex: 1;
    text-align: center;
  }
  .month-actions {
    opacity: 1 !important;
  }
  .btn-cell-delete {
    display: flex !important;
    opacity: 0.7;
    position: static;
    transform: none;
    right: auto;
    top: auto;
  }
  .cat-card-header {
    padding: 12px 10px;
  }
}
