/* =============================================
   SEED TO BLOOM FINANCE — Design System
   Thème clair, épuré
   ============================================= */

/* ===========================
   VARIABLES
   =========================== */
:root {
  --bg:         #F8F8F6;
  --surface:    #FFFFFF;
  --surface-2:  #F2F2EF;
  --cream:      #EFE1B0;
  --navy:       #051833;
  --blue:       #BAD1FD;
  --violet:     #E4D1FE;
  --brown:      #412F21;
  --success:    #4CAF82;
  --warning:    #E8A838;
  --danger:     #E85454;
  --text:       #1A1A1A;
  --text-2:     #6B6B6B;
  --border:     #E8E8E4;

  --blue-10:    rgba(186,209,253,0.15);
  --violet-10:  rgba(228,209,254,0.15);
  --success-10: rgba(76,175,130,0.12);
  --warning-10: rgba(232,168,56,0.12);
  --danger-10:  rgba(232,84,84,0.10);
  --navy-10:    rgba(5,24,51,0.08);
  --cream-10:   rgba(239,225,176,0.25);
}

/* ===========================
   RESET
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Scrollbar fine */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #d0d0cc; }

/* ===========================
   ÉCRAN DE CONNEXION
   =========================== */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  width: 380px;
  max-width: 95vw;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo .logo-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--navy);
  display: block;
}
.login-logo .logo-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-top: 2px;
  display: block;
}

.login-error {
  background: var(--danger-10);
  border: 1px solid rgba(232,84,84,0.25);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ===========================
   LAYOUT PRINCIPAL
   =========================== */
#app {
  display: flex;
  height: 100vh;
}

/* ===========================
   SIDEBAR
   =========================== */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  display: block;
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-top: 2px;
  display: block;
}

/* Groupes de navigation */
.nav-group {
  padding: 12px 0 2px;
}
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 0 20px 4px;
  display: block;
}

/* Items de navigation */
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 20px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  border-left: 2px solid transparent;
  transition: all 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-item.active {
  color: var(--navy);
  font-weight: 500;
  border-left-color: var(--blue);
  background: rgba(186,209,253,0.15);
}
.nav-item .ti {
  font-size: 15px;
  flex-shrink: 0;
  opacity: 0.65;
}
.nav-item.active .ti {
  opacity: 1;
  color: var(--navy);
}

/* Bas de sidebar — profil */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-info .user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.user-info .user-company {
  font-size: 11px;
  color: var(--text-2);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.12s;
  width: 100%;
}
.btn-logout:hover {
  color: var(--danger);
  border-color: rgba(232,84,84,0.3);
  background: var(--danger-10);
}

/* ===========================
   CONTENU PRINCIPAL
   =========================== */
#main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* Sections */
.section {
  display: none;
  padding: 40px 48px;
  max-width: 1600px;
  width: 100%;
  animation: none;
}
.section.active {
  display: block;
  animation: fadeIn 0.15s ease;
}

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

/* En-tête de page */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header-left h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.1;
}
.page-header-left .page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-shrink: 0;
}

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-cream {
  background: var(--cream-10);
  border-color: rgba(239,225,176,0.5);
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-title .ti { font-size: 14px; }

/* ===========================
   KPI CARDS
   =========================== */
.kpi-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.kpi-icon.blue   { background: var(--blue-10);    color: #4a78d9; }
.kpi-icon.violet { background: var(--violet-10);  color: #8e68d5; }
.kpi-icon.green  { background: var(--success-10); color: var(--success); }
.kpi-icon.orange { background: var(--warning-10); color: var(--warning); }
.kpi-icon.red    { background: var(--danger-10);  color: var(--danger); }
.kpi-icon.navy   { background: var(--navy-10);    color: var(--navy); }
.kpi-icon.cream  { background: var(--cream-10);   color: var(--brown); }

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
  padding-right: 44px;
  display: block;
}
.kpi-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
  display: block;
}
.kpi-value.blue    { color: #3b6dd4; }
.kpi-value.green   { color: var(--success); }
.kpi-value.danger  { color: var(--danger); }
.kpi-value.violet  { color: #7c5cbf; }
.kpi-value.warning { color: var(--warning); }

.kpi-sub {
  font-size: 12px;
  color: var(--text-2);
  display: block;
}
.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
}
.kpi-badge.up   { background: var(--success-10); color: var(--success); }
.kpi-badge.down { background: var(--danger-10);  color: var(--danger); }
.kpi-badge.flat { background: var(--surface-2);  color: var(--text-2); }

/* Mini barre dans KPI */
.kpi-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.kpi-progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ===========================
   GRILLES
   =========================== */
.grid-2     { display: grid; grid-template-columns: 1fr 1fr;    gap: 16px; margin-bottom: 20px; }
.grid-3     { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.grid-65-35 { display: grid; grid-template-columns: 65fr 35fr; gap: 16px; margin-bottom: 20px; }
.grid-60-40 { display: grid; grid-template-columns: 60fr 40fr; gap: 16px; margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }

/* ===========================
   TABLEAUX
   =========================== */
.table-wrap { overflow-x: auto; }

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

thead { background: var(--surface-2); }
thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th:first-child { border-radius: 8px 0 0 0; }
thead th:last-child  { border-radius: 0 8px 0 0; }

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-mono {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.td-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
}
.td-muted {
  color: var(--text-2);
  font-size: 13px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================
   BADGES STATUT
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
/* Factures */
.badge-payee     { background: var(--success-10); color: #2d8b5e; }
.badge-attente   { background: var(--warning-10); color: #9a6010; }
.badge-en-attente { background: var(--warning-10); color: #9a6010; }
.badge-retard    { background: var(--danger-10);  color: #c43030; }
.badge-en-retard { background: var(--danger-10);  color: #c43030; }
/* Abonnements */
.badge-actif     { background: var(--success-10); color: #2d8b5e; }
.badge-pause     { background: var(--warning-10); color: #9a6010; }
.badge-annule    { background: var(--surface-2);  color: var(--text-2); border: 1px solid var(--border); }
/* URSSAF */
.badge-a-venir   { background: var(--blue-10);    color: #3b6dd4; }
.badge-a-payer   { background: var(--warning-10); color: #9a6010; }
.badge-paye      { background: var(--success-10); color: #2d8b5e; }
/* Génériques */
.badge-neutral   { background: var(--surface-2);  color: var(--text-2); border: 1px solid var(--border); }
.badge-blue      { background: var(--blue-10);    color: #3b6dd4; }
.badge-violet    { background: var(--violet-10);  color: #7c5cbf; }
.badge-success   { background: var(--success-10); color: #2d8b5e; }
.badge-warning   { background: var(--warning-10); color: #9a6010; }
.badge-danger    { background: var(--danger-10);  color: #c43030; }

/* ===========================
   BOUTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.12s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(186,209,253,0.4);
}

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #0b2d53; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 7px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--danger-10);
  color: var(--danger);
  border: 1px solid rgba(232,84,84,0.2);
}
.btn-danger:hover { background: rgba(232,84,84,0.18); }

.btn-success {
  background: var(--success-10);
  color: #2d8b5e;
  border: 1px solid rgba(76,175,130,0.2);
}

.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-xs  { padding: 4px 9px;  font-size: 11px; border-radius: 6px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ===========================
   FORMULAIRES
   =========================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.form-input,
.form-select,
.form-textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(186,209,253,0.2);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-2); opacity: 0.6; }
.form-select option { background: var(--surface); color: var(--text); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ===========================
   MODALS
   =========================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 30px;
  width: 540px;
  max-width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  animation: modalIn 0.15s ease;
}
.modal.modal-sm { width: 420px; }
.modal.modal-lg { width: 680px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
}
.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: 6px;
  font-size: 18px;
  display: flex;
  align-items: center;
  transition: all 0.1s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ===========================
   GRAPHIQUES
   =========================== */
.chart-wrap { position: relative; width: 100%; }
canvas { display: block; width: 100%; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===========================
   PROGRESS BARS
   =========================== */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.progress-label {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-bar-wrap {
  width: 120px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.4s ease;
}
.progress-bar-fill.green  { background: var(--success); }
.progress-bar-fill.orange { background: var(--warning); }
.progress-bar-fill.red    { background: var(--danger); }
.progress-bar-fill.violet { background: #b09ae0; }

.progress-pct {
  font-size: 12px;
  color: var(--text-2);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}
.progress-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--navy);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
}

/* Progress bar standalon */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.4s ease;
}
.progress-bar .fill.green  { background: var(--success); }
.progress-bar .fill.orange { background: var(--warning); }
.progress-bar .fill.red    { background: var(--danger); }

/* Jauge */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.gauge-fill {
  position: relative;
  width: 180px;
  height: 90px;
  overflow: hidden;
}
.gauge-fill svg { width: 100%; }

/* ===========================
   CHARGES URSSAF
   =========================== */
.urssaf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.urssaf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.urssaf-card.alerte-rouge  {
  border-color: rgba(232,84,84,0.4);
  background: rgba(232,84,84,0.04);
}
.urssaf-card.alerte-orange {
  border-color: rgba(232,168,56,0.4);
  background: rgba(232,168,56,0.05);
}
.urssaf-card.paye {
  border-color: rgba(76,175,130,0.35);
  background: rgba(76,175,130,0.04);
}

.urssaf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.urssaf-titre {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}
.urssaf-echeance {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}
.urssaf-montant {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 500;
  color: var(--navy);
  margin: 6px 0 4px;
}
.urssaf-detail {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.urssaf-countdown {
  font-size: 12px;
  font-weight: 500;
}
.urssaf-countdown.rouge { color: var(--danger); }
.urssaf-countdown.orange { color: var(--warning); }

/* ===========================
   ABONNEMENTS — timeline
   =========================== */
.abo-timeline {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

/* ===========================
   GOAL CARDS
   =========================== */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.goal-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.3;
}
.goal-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.goal-current {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
}
.goal-target { font-size: 12px; color: var(--text-2); }
.goal-bar-wrap {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.goal-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--success);
  transition: width 0.4s ease;
}
.goal-pct { font-size: 11px; color: var(--text-2); }
.goal-date { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* ===========================
   SIMULATEUR
   =========================== */
.sim-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 9px;
  padding: 3px;
  width: fit-content;
  margin-bottom: 24px;
}
.sim-tab {
  padding: 7px 20px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-2);
  background: transparent;
  border: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.12s;
}
.sim-tab.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.sim-panel { display: none; }
.sim-panel.active { display: block; }

.sim-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
}
.sim-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.sim-line:last-child { border-bottom: none; }
.sim-line-label { color: var(--text-2); }
.sim-line-label.strong { color: var(--text); font-weight: 500; }
.sim-line-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--navy);
}
.sim-line-amount.neg { color: var(--danger); }
.sim-line-amount.pos { color: var(--success); }
.sim-total { background: rgba(5,24,51,0.03); }
.sim-total .sim-line-label { color: var(--navy); font-weight: 600; }
.sim-total .sim-line-amount { font-size: 24px; color: var(--navy); }
.sim-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 20px 2px;
  display: block;
}

/* Slider versement */
.slider-wrap { display: flex; flex-direction: column; gap: 8px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-label { font-size: 13px; color: var(--text-2); }
.slider-value { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 500; color: var(--navy); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--navy);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--navy);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* Scénarios annuels */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.scenario-card {
  border-radius: 10px;
  padding: 16px 18px;
  border: 1px solid var(--border);
}
.scenario-card.optimiste { border-color: rgba(76,175,130,0.3); background: var(--success-10); }
.scenario-card.realiste  { border-color: rgba(5,24,51,0.2);   background: var(--blue-10); }
.scenario-card.pessimiste{ border-color: rgba(232,168,56,0.3); background: var(--warning-10); }
.scenario-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.scenario-ca    { font-family: 'Cormorant Garamond', serif; font-size: 24px; color: var(--navy); }
.scenario-sub   { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ===========================
   RÉPARTITION
   =========================== */
.repartition-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.rep-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.rep-card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 10px;
}
.rep-recommande {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.rep-recommande span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: var(--navy);
  font-weight: 500;
}
.rep-actuel-label { font-size: 11px; color: var(--text-2); margin-top: 10px; margin-bottom: 4px; }
.rep-ecart { font-size: 12px; margin-top: 6px; }
.rep-ecart.ok { color: var(--success); }
.rep-ecart.ko { color: var(--warning); }

/* ===========================
   IMPORT / EXPORT
   =========================== */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-2);
}
.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--blue);
  background: var(--blue-10);
}
.file-drop .ti { font-size: 28px; display: block; margin-bottom: 10px; opacity: 0.5; }
.file-drop p { font-size: 13px; }
.file-drop label { color: var(--navy); cursor: pointer; text-decoration: underline; }

.import-preview {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}
.import-row {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.import-row:last-child { border-bottom: none; }
.import-row.doublon { background: var(--warning-10); color: var(--warning); }
.import-row.new { background: var(--success-10); }
.import-row.header { background: var(--surface-2); font-weight: 600; color: var(--text-2); }

.export-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.12s;
}
.export-btn:hover { background: var(--surface-2); border-color: var(--blue); }

/* ===========================
   PDF BOUTON
   =========================== */
.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.12s;
  font-family: 'DM Sans', sans-serif;
}
.pdf-btn.vide    { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }
.pdf-btn.present { color: #3b6dd4;       background: var(--blue-10);   border: 1px solid rgba(186,209,253,0.4); }
.pdf-btn.vide:hover    { background: var(--border); }
.pdf-btn.present:hover { background: rgba(186,209,253,0.3); }

/* ===========================
   MOIS SÉLECTEUR
   =========================== */
.month-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--navy);
}
.month-selector select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--navy);
  outline: none;
  cursor: pointer;
}

/* ===========================
   COMPTE CARDS
   =========================== */
.comptes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.pot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.pot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.pot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.pot-nom { font-size: 13px; font-weight: 600; color: var(--navy); }
.pot-icon { font-size: 22px; margin-bottom: 6px; }
.pot-solde {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  font-weight: 500;
  margin: 2px 0 4px;
}
.pot-sub { font-size: 11px; color: var(--text-2); margin-bottom: 10px; }
.pot-bar { height: 4px; background: var(--border); border-radius: 2px; }
.pot-bar-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.compte-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.compte-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.compte-nom { font-size: 14px; font-weight: 600; color: var(--navy); }
.compte-solde {
  font-family: 'Cormorant Garamond', serif;
  font-size: 34px;
  font-weight: 500;
  color: var(--navy);
  margin: 4px 0 6px;
}
.compte-upd { font-size: 11px; color: var(--text-2); }
.compte-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.compte-historique { margin-top: 12px; }
.compte-historique-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.compte-historique-item:last-child { border-bottom: none; }

/* ===========================
   RAPPORT MENSUEL — phrase auto
   =========================== */
.rapport-phrase {
  background: var(--cream-10);
  border: 1px solid rgba(239,225,176,0.6);
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--brown);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===========================
   ALERTE INLINE
   =========================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert.danger  { background: var(--danger-10);  color: #c43030; border: 1px solid rgba(232,84,84,0.2); }
.alert.warning { background: var(--warning-10); color: #9a6010; border: 1px solid rgba(232,168,56,0.2); }
.alert.success { background: var(--success-10); color: #2d8b5e; border: 1px solid rgba(76,175,130,0.2); }
.alert.info    { background: var(--blue-10);    color: #2c5aad; border: 1px solid rgba(186,209,253,0.4); }

/* ===========================
   SKELETON LOADERS
   =========================== */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #e8e8e3 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
.skeleton-text  { display: inline-block; height: 0.85em; vertical-align: middle; }
.skeleton-block { display: block; }

/* ===========================
   TOAST
   =========================== */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
  pointer-events: none;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#toast.show    { opacity: 1; transform: translateY(0); }
#toast.success { background: var(--success); }
#toast.error   { background: var(--danger); }
#toast.info    { background: var(--navy); }

/* ===========================
   DIVIDER
   =========================== */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ===========================
   EMPTY STATES
   =========================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
}
.empty-state .ti { font-size: 38px; display: block; margin-bottom: 12px; opacity: 0.25; }
.empty-state h3 { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ===========================
   TRANSITIONS RAPIDES
   =========================== */
.fade-in { animation: fadeIn 0.15s ease; }

/* ===========================
   FISCAL BNC JAUGE
   =========================== */
.fiscal-plafond-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}
.fiscal-plafond-bar {
  flex: 1;
  height: 10px;
  background: var(--surface-2);
  border-radius: 5px;
  overflow: hidden;
}
.fiscal-plafond-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--success);
  transition: width 0.4s ease;
}
.fiscal-plafond-fill.warning { background: var(--warning); }
.fiscal-plafond-fill.danger  { background: var(--danger); }
.fiscal-plafond-pct {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
}

/* ===========================
   RÉCAP CHARGES MENSUEL
   =========================== */
.charges-recap {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.charges-recap-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.charges-recap-line:last-child { border-bottom: none; }
.charges-recap-label { color: var(--text-2); }
.charges-recap-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: var(--navy);
}
.charges-recap-total {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.charges-recap-total .label { font-weight: 600; color: var(--navy); }
.charges-recap-total .amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
}

/* ===========================
   CARD RÉSULTAT GLOBAL
   =========================== */
.result-card {
  background: var(--navy);
  border-radius: 12px;
  padding: 24px 28px;
  color: #fff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.result-card-item {}
.result-card-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 6px;
}
.result-card-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 500;
}

/* ===========================
   RESPONSIVE — tablette
   =========================== */
@media (max-width: 1100px) {
  .section { padding: 28px 32px; }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-65-35, .grid-60-40 { grid-template-columns: 1fr; }
  .urssaf-grid { grid-template-columns: repeat(2, 1fr); }
  .result-card { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  #sidebar { width: 200px; min-width: 200px; }
  .section { padding: 20px 22px; }
  .kpi-grid-3 { grid-template-columns: 1fr 1fr; }
  .goals-grid { grid-template-columns: 1fr; }
  .comptes-grid { grid-template-columns: 1fr; }
  .scenarios-grid { grid-template-columns: 1fr; }
}
