/* --- VARIABLES DESIGN SYSTEM --- */
:root {
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Couleurs de Thème Clair Premium */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  /* Couleurs de Textes */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Accents */
  --color-primary: #3b82f6;      /* Bleu - Neutre / Consolidé */
  --color-primary-hover: #2563eb;
  --color-indigo: #6366f1;       /* Indigo - Personnel */
  --color-indigo-hover: #4f46e5;
  --color-emerald: #10b981;      /* Émeraude - Professionnel */
  --color-emerald-hover: #059669;
  --color-danger: #ef4444;       /* Rouge - Dépenses / Alertes */
  --color-danger-hover: #dc2626;
  --color-warning: #f59e0b;      /* Jaune/Orange - Alertes légères */
  --color-success: #10b981;

  /* Ombres & Bords */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --sidebar-width: 260px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* --- LOGIQUE DE BASE --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
  color: var(--text-main);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-indigo {
  color: var(--color-indigo) !important;
}

.text-emerald {
  color: var(--color-emerald) !important;
}

.text-danger {
  color: var(--color-danger) !important;
}

.text-warning {
  color: var(--color-warning) !important;
}

.text-right {
  text-align: right;
}

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

.text-sm {
  font-size: 0.8rem;
}

.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }

/* --- ÉCRAN DE LOGIN --- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-app);
  z-index: 100;
  position: absolute;
  top: 0;
  left: 0;
}

.login-box {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-indigo));
  color: #ffffff;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-logo i {
  width: 28px;
  height: 28px;
}

.login-header h2 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-info {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.login-info code {
  background-color: var(--bg-app);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-main);
  font-family: monospace;
}

/* --- STRUCTURING APPLICATION (DESKTOP LAYOUT) --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- BARRE LATÉRALE (SIDEBAR) --- */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-indigo));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.logo-icon i {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background-color: var(--bg-app);
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--color-success);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  width: 100%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background-color: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-color);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background-color: rgba(239, 68, 68, 0.08);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-logout i {
  width: 16px;
  height: 16px;
}

/* --- MAIN CONTENT CONTAINER --- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- HEADER --- */
.app-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.header-title h2 {
  font-size: 1.4rem;
  line-height: 1.2;
}

.header-title p {
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.scope-selector {
  display: flex;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
}

.scope-btn {
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.scope-btn i {
  width: 14px;
  height: 14px;
}

.scope-btn.active {
  background-color: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.current-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: var(--bg-app);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.current-date i {
  width: 16px;
  height: 16px;
}

/* --- DYNAMIC VIEWS WRAPPER --- */
.content-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.content-section {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.content-section.active {
  display: block;
}

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

/* --- CARDS BASE --- */
.app-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

/* --- DASHBOARD SECTION --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-total .kpi-icon {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--color-primary);
}

.card-perso .kpi-icon {
  background-color: rgba(99, 102, 241, 0.08);
  color: var(--color-indigo);
}

.card-pro .kpi-icon {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-emerald);
}

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-trend {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 2px;
}

.kpi-trend.positive { color: var(--color-success); }
.kpi-trend.negative { color: var(--color-danger); }
.kpi-trend.neutral { color: var(--text-muted); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
}

.chart-container.large-chart {
  height: 380px;
}

.dashboard-right-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Alertes de trésorerie */
.alerts-card {
  border-left: 4px solid var(--color-warning);
}

.alert-header {
  border-bottom: none;
  padding-bottom: 8px;
}

.alert-header i {
  width: 20px;
  height: 20px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.alert-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.alert-item i {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.alert-content p {
  font-weight: 500;
}

.alert-content span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* --- SPLIT VIEW (FORM + LIST) --- */
.split-view {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

/* --- FORMULAIRES --- */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

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

.horizontal-form {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.horizontal-form .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 200px;
}

.form-actions-horizontal {
  display: flex;
  align-items: center;
}

/* Simulateur salariés */
.salary-live-preview {
  margin-top: 20px;
  padding: 16px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.salary-live-preview h4 {
  font-size: 0.8rem;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.preview-row.total {
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
  margin-top: 8px;
  font-weight: 600;
}

/* --- BUTTONS --- */
.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-app);
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-primary);
  padding: 0;
  font-size: 0.85rem;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--color-danger-hover);
}

/* Actions inline */
.actions-cell {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.btn-icon i {
  width: 14px;
  height: 14px;
}

.btn-icon:hover {
  background-color: var(--bg-app);
  color: var(--text-main);
}

.btn-icon.btn-icon-danger:hover {
  background-color: rgba(239, 68, 68, 0.08);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}

/* --- TABLES --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background-color: var(--bg-app);
  font-family: var(--font-title);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:hover {
  background-color: rgba(248, 250, 252, 0.6);
}

.table-compact th, .table-compact td {
  padding: 8px 12px;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(248, 250, 252, 0.4);
}

/* Badge dans les tables */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-perso {
  background-color: rgba(99, 102, 241, 0.08);
  color: var(--color-indigo);
}

.badge-pro {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-emerald);
}

.badge-inflow {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-emerald);
}

.badge-outflow {
  background-color: rgba(239, 68, 68, 0.08);
  color: var(--color-danger);
}

/* --- COMTPES LIST GRID --- */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.account-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 140px;
  position: relative;
  transition: var(--transition-normal);
}

.account-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.account-name-label {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.account-type-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.account-card.perso-card {
  border-top: 4px solid var(--color-indigo);
}

.account-card.pro-card {
  border-top: 4px solid var(--color-emerald);
}

.account-card.perso-card .account-type-badge {
  background-color: rgba(99, 102, 241, 0.08);
  color: var(--color-indigo);
}

.account-card.pro-card .account-type-badge {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-emerald);
}

.account-balance-value {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 8px;
}

.account-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* --- FORECAST CONTROLS --- */
.flex-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle {
  display: flex;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
}

.toggle-btn {
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.toggle-btn.active {
  background-color: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Table prévisionnelle */
.negative-balance-row {
  background-color: rgba(239, 68, 68, 0.03);
}

.negative-balance-cell {
  color: var(--color-danger);
  font-weight: 600;
}

.forecast-header-date {
  font-weight: 600;
}

/* --- INSIGHTS / ANALYSES --- */
.insights-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.donut-chart-wrapper {
  position: relative;
  width: 180px;
  height: 180px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  min-width: 180px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Scorecard Santé */
.health-metrics {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.health-metric-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.metric-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.metric-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.metric-value-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-val {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 70px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.5s ease-out;
}

.bg-indigo { background-color: var(--color-indigo); }
.bg-emerald { background-color: var(--color-emerald); }
.bg-blue { background-color: var(--color-primary); }

/* Tips list */
.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  background-color: var(--bg-app);
  transition: var(--transition-fast);
}

.tip-item:hover {
  border-color: var(--text-light);
}

.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tip-icon.tip-tax { color: var(--color-primary); }
.tip-icon.tip-saving { color: var(--color-indigo); }
.tip-icon.tip-warn { color: var(--color-danger); }
.tip-icon.tip-idea { color: var(--color-warning); }

.tip-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tip-details h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.tip-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.tip-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  margin-top: 6px;
}

.tag-saving { background-color: rgba(99, 102, 241, 0.08); color: var(--color-indigo); }
.tag-tax { background-color: rgba(59, 130, 246, 0.08); color: var(--color-primary); }
.tag-expense { background-color: rgba(239, 68, 68, 0.08); color: var(--color-danger); }
.tag-pro { background-color: rgba(16, 185, 129, 0.08); color: var(--color-emerald); }

/* --- IMPORTS & CONNECTEURS --- */
.upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  background-color: var(--bg-app);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.upload-dropzone:hover {
  border-color: var(--color-primary);
  background-color: #ffffff;
}

.upload-dropzone i {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
}

.connectors-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.connector-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  transition: var(--transition-fast);
}

.connector-item:hover {
  box-shadow: var(--shadow-sm);
}

.connector-brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connector-details h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Superposition Synchro Animée */
.sync-animation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-modal {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 320px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* trombone justificatif */
.receipt-link {
  color: var(--text-muted);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.receipt-link:hover {
  background-color: var(--bg-app);
  color: var(--color-primary);
}

.receipt-link i {
  width: 16px;
  height: 16px;
}

/* --- FILTERS & INTERACTIVE DESIGN --- */
.list-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.list-header h3 {
  align-self: flex-start;
}

.filters-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.search-input {
  flex: 1;
}

.filter-select {
  width: 200px;
}

/* Adaptabilité responsive */
@media (max-width: 1024px) {
  .split-view {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .insights-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* --- DB PROFILES SELECTOR & MANAGEMENT --- */
.db-profiles-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
  margin-top: 8px;
}

.db-profile-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-fast);
}

.db-profile-card:hover {
  border-color: var(--border-focus);
  background-color: rgba(59, 130, 246, 0.02);
}

.db-profile-card.active {
  border-color: var(--color-primary);
  background-color: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.db-profile-card-details h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.db-profile-card-details p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.db-profile-badge-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.db-profile-card-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.db-profile-card-badge.sqlite {
  background-color: rgba(99, 102, 241, 0.08);
  color: var(--color-indigo);
}

.db-profile-card-badge.postgres {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-emerald);
}

.db-profile-card-badge.active-indicator {
  background-color: var(--color-primary);
  color: #ffffff;
}


/* ==========================================================================
   LIAISON BANCAIRE, RATIOS FINANCIERS & CALCULATEURS
   ========================================================================== */

.status-dot.red { background-color: var(--color-danger); }

.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  color: #1e3a8a;
  font-size: 0.9rem;
}
.info-banner.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.info-banner svg { flex-shrink: 0; width: 18px; height: 18px; }
.info-banner code { background: rgba(0, 0, 0, 0.06); padding: 1px 5px; border-radius: 4px; }

.bank-connection-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.bank-connection-row .status-dot { width: 10px; height: 10px; flex-shrink: 0; }
.bank-connection-info { display: flex; flex-direction: column; flex: 1; }
.bank-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* Ratios */
.ratios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.ratio-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--text-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.ratio-card.level-ok { border-left-color: var(--color-success); }
.ratio-card.level-warning { border-left-color: var(--color-warning); }
.ratio-card.level-danger { border-left-color: var(--color-danger); }
.ratio-title { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.ratio-value { font-family: var(--font-title); font-size: 1.7rem; font-weight: 700; color: var(--text-main); }
.ratio-line { font-size: 0.8rem; color: var(--text-muted); }
.ratio-bar-ok { background: var(--color-success); }
.ratio-bar-warning { background: var(--color-warning); }
.ratio-bar-danger { background: var(--color-danger); }
.ratio-bar-unknown { background: var(--text-light); }
.ratios-compare { margin-top: 20px; }
.ratios-compare h4 { margin-bottom: 8px; }

/* Calculateurs */
.calc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.calc-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.calc-tab:hover { color: var(--text-main); }
.calc-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-results { display: flex; flex-direction: column; }
.calc-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.calc-result-row.strong { font-weight: 700; font-size: 1.1rem; }
.calc-disclaimer { margin-top: 8px; }
