/* =====================================================================
   Crowdlending Tracker — base styles
   Theming via data-theme on <html> ('light' default, 'dark' override).
   Font scale via data-fontsize on <html> ('large' default, 'medium', 'compact').
   ===================================================================== */

/* ================= Font scale variables ================= */
:root {
  --fs-xs:    11px;
  --fs-sm:    12px;
  --fs-base:  14px;
  --fs-md:    16px;
  --fs-lg:    22px;
  --fs-table: 13px;
}
[data-fontsize="medium"] {
  --fs-xs:    10px; --fs-sm:    11px; --fs-base:  13px;
  --fs-md:    15px; --fs-lg:    20px; --fs-table: 12px;
}
[data-fontsize="compact"] {
  --fs-xs:     9px; --fs-sm:    10px; --fs-base:  12px;
  --fs-md:    13px; --fs-lg:    18px; --fs-table: 11px;
}

/* ================= Color themes ================= */
:root, [data-theme="light"] {
  --bg:            #f0f4ff;
  --surface:       #ffffff;
  --surface-2:     #e8eef8;
  --border:        #c7d2e8;
  --text:          #0f172a;
  --text-muted:    #4a5880;
  --input-bg:      #ffffff;
  --input-border:  #c7d2e8;
  --sidebar-bg:          #1e3a8a;
  --sidebar-text:        #bfcfee;
  --sidebar-text-active: #ffffff;
  --sidebar-hover:       #163080;
  --sidebar-border:      #2a4a9e;
  --sidebar-accent:      #4ade80;
  --primary:       #1e40af;
  --primary-hover: #1e3a8a;
  --accent:        #4ade80;
  --accent-hover:  #22c55e;
  --success:       #16a34a;
  --warning:       #ca8a04;
  --danger:        #dc2626;
  --shadow:        0 1px 3px rgba(30,58,138,.10), 0 1px 2px rgba(30,58,138,.06);
  --b-en_cours-bg:#dbeafe; --b-en_cours-fg:#1e40af;
  --b-rembourse-bg:#dcfce7;--b-rembourse-fg:#166534;
  --b-en_retard-bg:#fee2e2; --b-en_retard-fg:#991b1b;
  --b-procedure-bg:#fef3c7;--b-procedure-fg:#92400e;
  --b-cloture-bg: #e2e8f0; --b-cloture-fg: #475569;
  --b-depot-bg:   #dcfce7; --b-depot-fg:   #166534;
  --b-retrait-bg: #fee2e2; --b-retrait-fg: #991b1b;
  --b-paye-bg:    #dcfce7; --b-paye-fg:    #166534;
  --b-partiel-bg: #fef3c7; --b-partiel-fg: #92400e;
  --b-retard-bg:  #fef3c7; --b-retard-fg:  #92400e;
  --b-impaye-bg:  #fee2e2; --b-impaye-fg:  #991b1b;
  --error-bg:     #fee2e2; --error-fg:     #991b1b;
  --success-bg:   #dcfce7; --success-fg:   #166534;
}

[data-theme="dark"] {
  --bg:            #060e1f;
  --surface:       #111c35;
  --surface-2:     #0d1629;
  --border:        #1e3a6a;
  --text:          #e2e8f8;
  --text-muted:    #7a90b8;
  --input-bg:      #0d1629;
  --input-border:  #1e3a6a;
  --sidebar-bg:          #060e1f;
  --sidebar-text:        #8aabdc;
  --sidebar-text-active: #ffffff;
  --sidebar-hover:       #0d1a40;
  --sidebar-border:      #1e3a6a;
  --sidebar-accent:      #4ade80;
  --primary:       #3b82f6;
  --primary-hover: #60a5fa;
  --accent:        #4ade80;
  --accent-hover:  #86efac;
  --success:       #4ade80;
  --warning:       #facc15;
  --danger:        #f87171;
  --shadow:        0 1px 6px rgba(0,0,0,.6), 0 1px 3px rgba(0,0,0,.4);
  --b-en_cours-bg:#1e3a8a; --b-en_cours-fg:#bfdbfe;
  --b-rembourse-bg:#14532d;--b-rembourse-fg:#bbf7d0;
  --b-en_retard-bg:#7f1d1d; --b-en_retard-fg:#fecaca;
  --b-procedure-bg:#78350f;--b-procedure-fg:#fde68a;
  --b-cloture-bg: #1e3a6a; --b-cloture-fg: #93b4d8;
  --b-depot-bg:   #14532d; --b-depot-fg:   #bbf7d0;
  --b-retrait-bg: #7f1d1d; --b-retrait-fg: #fecaca;
  --b-paye-bg:    #14532d; --b-paye-fg:    #bbf7d0;
  --b-partiel-bg: #78350f; --b-partiel-fg: #fde68a;
  --b-retard-bg:  #78350f; --b-retard-fg:  #fde68a;
  --b-impaye-bg:  #7f1d1d; --b-impaye-fg:  #fecaca;
  --error-bg:     #450a0a; --error-fg:     #fecaca;
  --success-bg:   #14532d; --success-fg:   #bbf7d0;
}

/* ================= Base ================= */
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: var(--fs-base);
  transition: font-size .15s ease;
}
a { color: var(--primary); }

/* ================= Layout shell ================= */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app-shell.sidebar-collapsed { grid-template-columns: 56px 1fr; }

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  white-space: nowrap;
  border-right: 1px solid var(--sidebar-border);
  transition: width .22s ease;
}
.sidebar-collapsed .sidebar { opacity: 1; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative;
  min-height: 52px;
}
.sidebar-brand-logo { flex-shrink: 0; display: flex; align-items: center; }
.sidebar-brand-text {
  font-size: var(--fs-md);
  font-weight: 700;
  color: #fff;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .2s;
}
.sidebar-collapsed .sidebar-brand-text { opacity: 0; width: 0; }
.sidebar-panel-btn {
  background: none; border: none; cursor: pointer;
  color: var(--sidebar-text); padding: 4px; border-radius: 6px;
  display: flex; align-items: center; opacity: .6;
  transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.sidebar-panel-btn:hover { opacity: 1; background: rgba(255,255,255,.1); }
.sidebar-collapsed .sidebar-panel-btn { display: none; }
.sidebar-expand-overlay {
  display: none; position: absolute; inset: 0;
  background: none; border: none; cursor: pointer;
  align-items: center; justify-content: center;
  color: var(--sidebar-text); border-radius: 0;
}
.sidebar-collapsed .sidebar-brand:hover .sidebar-expand-overlay { display: flex; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--fs-base);
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-nav a svg { flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; transition: opacity .2s, width .2s; }
.sidebar-collapsed .nav-label { opacity: 0; width: 0; }
.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar-sep { height: 1px; background: var(--sidebar-border); margin: 6px 16px; }

/* Main content */
.main { display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }
.main > *:not(.topbar):not(.topbar-global):not(.card) { padding: 0 24px; }
/* Cards as direct children of .main keep their own internal padding; just add horizontal margin */
.main > .card { margin-left: 24px; margin-right: 24px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  margin-bottom: 16px;
  gap: 12px;
}
.topbar h2 { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.topbar-global {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* btn-add-invest */
.btn-add-invest {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 20px;
  font-size: var(--fs-base); font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
  transition: background .15s, box-shadow .15s;
}
.btn-add-invest:hover { background: var(--primary-hover); box-shadow: 0 3px 12px rgba(59,130,246,.5); }

/* btn-icon — bouton icône discret (cercle hover) */
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: transparent;
  border: none; border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-icon svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.btn-icon:disabled {
  opacity: 0.5;
  cursor: default;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Display toggle (Brut / Net) ─────────────────────────────── */
.display-toggle {
  display: flex;
  align-items: center;
  background: var(--primary);
  border-radius: 20px;
  padding: 3px;
  gap: 1px;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
  flex-shrink: 0;
}
.display-toggle-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 16px;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: rgba(255,255,255,.7);
  transition: background .15s, color .15s;
  line-height: 1;
  white-space: nowrap;
}
.display-toggle-btn.active {
  background: #fff;
  color: var(--primary);
}
.display-toggle-btn:hover:not(.active) {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* Thème sombre : logos plateformes — noir/gris → blanc, couleurs préservées */
[data-theme="dark"] .logo-plateforme {
  filter: invert(1) hue-rotate(180deg);
}

/* Icônes de la bibliothèque (SVG noirs sur fond transparent) */
.app-lib-icon,
.nav-lib-icon {
  display: block;
  object-fit: contain;
}
[data-theme="dark"] .app-lib-icon,
[data-theme="dark"] .nav-lib-icon {
  filter: invert(1);
}
[data-theme="dark"] .app-lib-icon-no-invert {
  filter: none;
}
/* Icône nav active : teinte primaire */
/* Sidebar toujours sombre → icônes toujours inversées */
.sidebar-nav .nav-lib-icon {
  filter: invert(1);
  opacity: 0.85;
}
.sidebar-nav a.active .nav-lib-icon {
  filter: invert(1);
  opacity: 1;
}



/* Thème sombre : fond du toggle plus discret */
[data-theme="dark"] .display-toggle {
  background: rgba(59,130,246,.25);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  border: 1px solid rgba(59,130,246,.4);
}
[data-theme="dark"] .display-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}
[data-theme="dark"] .display-toggle-btn:hover:not(.active) {
  background: rgba(59,130,246,.2);
  color: rgba(255,255,255,.9);
}

/* ── Barre de recherche projet (topbar) ──────────────────────── */
.project-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  color: var(--primary);
  min-width: 330px;
}
.project-search-input {
  flex: 1;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  font-size: var(--fs-md);
  color: var(--text);
  min-width: 0;
}
.project-search-input::placeholder { color: var(--primary); opacity: 0.6; }
.project-search-clear {
  display: flex;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-muted);
  line-height: 1;
  opacity: .7;
  transition: opacity .1s;
}
.project-search-clear:hover { opacity: 1; }
.project-search-kbd {
  font-size: 10px;
  color: var(--primary);
  opacity: .55;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 1px 4px;
  letter-spacing: .02em;
  white-space: nowrap;
  font-family: system-ui, sans-serif;
}
.project-search-dropdown {
  position: absolute;
  top: 40px;
  left: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 300px;
  max-width: 400px;
  overflow: hidden;
}
.project-search-item {
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.project-search-item:last-child { border-bottom: none; }
.project-search-item:hover,
.project-search-item.active { background: var(--surface-2); }
.project-search-item-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-search-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 3px;
}

/* ================= UI primitives ================= */

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 1rem; font-weight: 600; margin: 0 0 14px; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.kpi .value { font-size: 1.35rem; font-weight: 700; }

/* Buttons */
button {
  font-size: var(--fs-base);
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button:hover { background: var(--border); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.danger:hover { opacity: .85; }
button.ghost { background: none; border: none; color: var(--text-muted); padding: 4px 8px; }
button.ghost:hover { color: var(--text); background: var(--surface-2); }
button.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 8px; display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
button.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* Inputs */
input, select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--input-border); border-radius: 6px;
  background: var(--input-bg); color: var(--text); font-size: var(--fs-base);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,.2);
}
label {
  display: block; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-muted); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Form grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Row */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 120px; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
th {
  text-align: left; font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600;
  white-space: nowrap;
}
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { text-align: right; white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }
.actions button { padding: 4px 10px; font-size: var(--fs-xs); }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: var(--fs-xs); font-weight: 600; text-transform: none; letter-spacing: .03em;
}
.badge.en_cours   { background: var(--b-en_cours-bg);   color: var(--b-en_cours-fg); }
.badge.rembourse  { background: var(--b-rembourse-bg);  color: var(--b-rembourse-fg); }
.badge.en_retard  { background: var(--b-en_retard-bg);  color: var(--b-en_retard-fg); }
.badge.procedure  { background: var(--b-procedure-bg);  color: var(--b-procedure-fg); }
.badge.cloture    { background: var(--b-cloture-bg);    color: var(--b-cloture-fg); }
.badge.depot      { background: var(--b-depot-bg);      color: var(--b-depot-fg); }
.badge.retrait    { background: var(--b-retrait-bg);    color: var(--b-retrait-fg); }
.badge.paye       { background: var(--b-paye-bg);       color: var(--b-paye-fg); }
.badge.partiel    { background: var(--b-partiel-bg);    color: var(--b-partiel-fg); }
.badge.retard     { background: var(--b-retard-bg);     color: var(--b-retard-fg); }
.badge.impaye     { background: var(--b-impaye-bg);     color: var(--b-impaye-fg); }

/* ── Chips catégories / secteurs d'investissement ────────────── */
.chip-cat  {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
  font-weight: 500; background: rgba(99,102,241,.12); color: var(--primary);
  border: 1px solid rgba(99,102,241,.25);
}
.chip-sect {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
  font-weight: 500; background: rgba(16,185,129,.12); color: var(--success);
  border: 1px solid rgba(16,185,129,.25);
}

/* ── Preferences (Interface page) ───────────────────────────── */
.pref-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pref-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  min-width: 160px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-align: center;
  font: inherit;
  line-height: 1.3;
}

.pref-option:hover {
  border-color: var(--primary);
  background: var(--surface-hover, var(--surface));
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.pref-option.active {
  border-color: var(--primary);
  background: rgba(59,130,246,.07);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}

.pref-option svg,
.pref-option img {
  display: block;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.font-preview {
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

/* Utilities */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.success      { color: var(--success); }
.danger       { color: var(--danger); }
.error {
  background: var(--error-bg); color: var(--error-fg);
  border: 1px solid var(--danger); border-radius: 6px;
  padding: 10px 14px; font-size: var(--fs-sm); margin-bottom: 12px;
}
.success-msg {
  background: var(--success-bg); color: var(--success-fg);
  border: 1px solid var(--success); border-radius: 6px;
  padding: 10px 14px; font-size: var(--fs-sm); margin-bottom: 12px;
}
.import-module-note {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 10px; padding: 8px 12px;
  background: rgba(59,130,246,.07); border: 1px solid rgba(59,130,246,.2);
  border-radius: 6px; font-size: var(--fs-sm); color: var(--text-muted);
  line-height: 1.5;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}

/* Login */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 36px; box-shadow: var(--shadow);
}

/* Export dropdown */
.export-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); z-index: 50;
  min-width: 200px; padding: 4px;
}
.export-dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 9px 12px; border: none; background: none;
  border-radius: 6px; cursor: pointer; color: var(--text);
}
.export-dropdown button:hover { background: var(--surface-2); }
.export-dropdown button span { display: flex; flex-direction: column; gap: 1px; }
.export-dropdown button strong { font-size: var(--fs-sm); }
.export-dropdown button small { font-size: var(--fs-xs); color: var(--text-muted); }

/* ================= Charts row ================= */
.charts-row {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 14px;
  margin-bottom: 16px;
  padding: 0 24px;
}

/* SoldeChart */
.solde-chart-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 20px 12px; box-shadow: var(--shadow);
}
.solde-chart-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 8px; flex-wrap: wrap; gap: 8px;
}
.solde-chart-info { display: flex; flex-direction: column; gap: 2px; }
.solde-chart-date { font-size: var(--fs-xs); color: var(--text-muted); }
.solde-chart-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.solde-chart-controls { display: flex; align-items: center; gap: 8px; }
.solde-chart-ranges { display: flex; gap: 2px; }
.solde-range-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: 500; padding: 4px 8px;
  border-radius: 5px; cursor: pointer; transition: background .12s, color .12s;
}
.solde-range-btn:hover { background: var(--surface-2); color: var(--text); }
.solde-range-btn.active {
  background: var(--surface-2); color: var(--text); font-weight: 700;
  border: 1px solid var(--border);
}

/* SoldeChart — tooltip flottant */
.sg-tooltip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  white-space: nowrap;
  min-width: 110px;
}
.sg-tooltip-date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.sg-tooltip-value {
  font-size: var(--fs-md);
  font-weight: 700;
  color: #4fa8e8;   /* même bleu que la courbe */
  letter-spacing: -.01em;
}

/* DistributionChart */
.dist-chart-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 16px 12px; box-shadow: var(--shadow); position: relative;
}
.dist-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dist-chart-title { font-weight: 700; font-size: 1rem; }
.dist-dropdown {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; user-select: none;
}
.dist-tooltip {
  position: absolute;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; pointer-events: none;
  z-index: 20; display: flex; align-items: flex-start; gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); min-width: 140px;
}
.dist-tooltip-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.dist-tooltip-amt  { font-size: var(--fs-sm); font-weight: 700; }
.dist-tooltip-name { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }
.dist-tooltip-pct  { font-size: var(--fs-xs); color: var(--text-muted); }

/* ================= UserMenu ================= */
.user-menu-wrap { position: relative; }

/* Trigger button at bottom of sidebar */
.user-menu-trigger {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; background: none; border: none;
  border-top: 1px solid var(--sidebar-border); width: 100%;
  color: var(--sidebar-text); text-align: left; transition: background .15s; min-height: 56px;
}
.user-menu-trigger:hover { background: var(--sidebar-hover); }
.user-menu-trigger-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.user-menu-trigger-name {
  font-size: var(--fs-sm); font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Main popup */
.user-menu-popup {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.3); z-index: 200; overflow: hidden;
}

/* Header: avatar + name + email */
.user-menu-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.user-menu-name {
  font-size: var(--fs-sm); font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-email { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Separator */
.user-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Section labels */
.user-menu-section-header {
  padding: 8px 16px 4px;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 600;
}

/* Active view row (shows current profile + opens sub-panel) */
.user-menu-vue-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px;
  background: none; border: none; color: var(--text); font-size: var(--fs-sm);
  cursor: pointer; text-align: left; transition: background .12s;
}
.user-menu-vue-row:hover { background: var(--surface-2); }
.user-menu-vue-row.active { background: var(--surface-2); }
.user-menu-vue-name { flex: 1; font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Regular menu items */
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px;
  background: none; border: none; color: var(--text); font-size: var(--fs-sm);
  cursor: pointer; text-align: left; transition: background .12s;
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.danger { color: var(--danger); background: none; border: none; }
.user-menu-item.danger:hover { background: var(--surface-2); }

/* Sub-panel (profile switcher) */
.user-menu-subpanel {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.3); z-index: 201; overflow: hidden;
  min-width: 220px;
}
.user-menu-subpanel-title {
  padding: 10px 14px 8px;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 600;
}
.user-menu-subpanel-section {
  padding: 8px 14px 4px;
  font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500;
}

/* Profile items in sub-panel */
.user-menu-profile-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px;
  background: none; border: none; color: var(--text);
  font-size: var(--fs-sm); cursor: pointer; text-align: left;
  transition: background .12s;
}
.user-menu-profile-item:hover { background: var(--surface-2); }
.user-menu-profile-item.selected { color: var(--primary); font-weight: 600; }
.user-menu-profile-item.selected svg { color: var(--primary); }
/* TeamBadge dans un item sélectionné : fond plus vif, icône toujours blanche */
.user-menu-profile-item.selected .team-badge { background: #2563eb; }
.user-menu-profile-item.selected .team-badge svg { color: #fff; }
.user-menu-profile-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Gérer les profils" link */
.user-menu-profile-manage {
  display: block; width: 100%; padding: 10px 14px;
  background: none; border: none; text-align: left;
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--primary); cursor: pointer; transition: background .12s;
}
.user-menu-profile-manage:hover { background: var(--surface-2); }

/* ================= Profile / MonCompte ================= */
.profile-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500; margin-bottom: 4px; display: block; }
.profile-field { margin-bottom: 14px; position: relative; }
.profile-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; z-index: 50; box-shadow: var(--shadow); overflow: hidden;
}
.modal-field { margin-bottom: 12px; }

/* Famille & Entreprises */
.famille-wrap { padding: 0 24px; }
.famille-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.famille-tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 8px 16px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted);
  cursor: pointer; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.famille-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.famille-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: 10px; padding: 1px 6px;
  font-size: var(--fs-xs); margin-left: 5px;
}
.membre-list { display: flex; flex-direction: column; gap: 10px; }
.membre-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.membre-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.membre-name { font-weight: 600; font-size: var(--fs-base); }
.membre-role { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
.membre-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 10px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text-muted);
  font-weight: 600; font-size: var(--fs-xs); flex-shrink: 0;
}
.member-add-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 8px; cursor: pointer; transition: background .15s;
}
.member-add-row:hover { background: var(--border); }
.member-add-circle {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface);
  border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 18px;
}
.member-dots-btn { background: none; border: none; color: var(--text-muted); padding: 6px 8px; border-radius: 6px; cursor: pointer; line-height: 1; display: flex; align-items: center; }
.member-dots-btn:hover { background: var(--border); color: var(--text); }
.member-dots-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 30; min-width: 150px;
  overflow: hidden; padding: 4px;
}
.member-dots-menu-item {
  display: flex; align-items: center; width: 100%;
  padding: 8px 12px; background: none; border: none; border-radius: 6px;
  font-size: var(--fs-sm); color: var(--text); text-align: left;
  cursor: pointer; transition: background .12s;
}
.member-dots-menu-item:hover { background: var(--surface-2); }
.member-dots-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.danger-item { color: var(--danger) !important; }
.danger-item:hover { background: color-mix(in srgb, var(--danger) 10%, transparent) !important; }

/* Theme switcher */
.theme-switcher { display: flex; gap: 4px; align-items: center; }
.theme-switcher button { padding: 5px 10px; font-size: var(--fs-xs); border-radius: 5px; }
.theme-switcher button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* CategorySelect */
.cat-select-wrap { position: relative; }

/* Bouton déclencheur */
.cat-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%; padding: 0 10px;
  border: 1px solid var(--input-border); border-radius: 6px;
  min-height: 36px; background: var(--input-bg);
  font-size: var(--fs-sm); color: var(--text);
  cursor: pointer; text-align: left;
  transition: border-color .12s;
}
.cat-select-trigger:hover { border-color: var(--primary); }
.cat-select-trigger.open  { border-color: var(--primary); }
.cat-select-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropdown */
.cat-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); z-index: 40;
  max-height: 220px; overflow-y: auto;
}

/* Ligne catégorie */
.cat-select-item {
  display: flex; align-items: center; gap: 10px;
  padding: 1px 12px; cursor: pointer;
  font-size: var(--fs-sm); color: var(--text);
  transition: background .1s;
}
.cat-select-item:hover { background: var(--surface-2); }
.cat-select-item.checked { font-weight: 500; }
.cat-select-item input[type="checkbox"] {
  flex-shrink: 0; width: 14px; height: 14px;
  accent-color: var(--primary); cursor: pointer;
}

.cat-select-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: none; background: none; font-size: var(--fs-sm); cursor: pointer; text-align: left; color: var(--text); }
.cat-select-dropdown button:hover { background: var(--surface-2); }
.cat-select-sep { height: 1px; background: var(--border); margin: 4px 0; }
.cat-select-new-form { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.cat-select-new-actions { display: flex; gap: 6px; }
.cat-select-add-btn { padding: 4px 10px; font-size: var(--fs-xs); }
.cat-select-empty { padding: 10px 12px; font-size: var(--fs-xs); color: var(--text-muted); }
.cat-select-err { padding: 4px 12px; font-size: var(--fs-xs); color: var(--danger); }

/* ================= Depots/Retraits Tabs + Layout ================= */
.dr-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  margin-top: 8px;
  margin-bottom: 20px;
}
.dr-tab {
  background: none; border: none;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 20px; font-size: 1rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.dr-tab:hover { color: var(--text); background: none; }
.dr-tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

.dr-mouvements-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  padding: 0 24px;
  align-items: start;
  min-height: calc(100vh - 200px);
}
.dr-mouvements-list { min-width: 0; }
.dr-mouvements-detail { position: sticky; top: 64px; }

.dr-row { transition: background .12s; }
.dr-row:hover td { background: var(--surface-2) !important; }
.dr-row-selected td { background: rgba(59,130,246,.08) !important; }

.dr-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.dr-detail-empty {
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: var(--fs-sm);
  flex-direction: column; gap: 4px; padding: 40px 20px;
  min-height: 200px;
}
/* Titre */
.dr-detail-title {
  padding: 18px 20px 16px;
  font-size: var(--fs-base);
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
/* Champs label / valeur */
.dr-detail-fields {
  flex: 1;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.dr-detail-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 20px;
}
.dr-detail-label {
  font-size: var(--fs-sm);
  color: var(--text);
  flex-shrink: 0;
}
.dr-detail-value {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-align: right;
  margin-left: 16px;
}
/* Bouton "Modifier" — texte plein, pas de hover */
.dr-detail-footer {
  padding: 0;
}
.dr-detail-edit-btn {
  display: block; width: 100%;
  background: none; border: none;
  padding: 16px 20px;
  font-size: 1rem; font-weight: 500;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

/* KPI row : 3 colonnes égales */
.dr-kpi-row {
  display: flex;
  gap: 12px;
  padding: 0 24px;
  margin-bottom: 15px;
  padding-bottom: 15px;
}
.dr-kpi-row > .kpi {
  flex: 1;
}

/* KPI cliquable */
.dr-kpi-clickable {
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.dr-kpi-clickable:hover {
  border-color: var(--border);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.dr-kpi-active {
  border-width: 1.5px !important;
}
.dr-kpi-active-success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,.14) !important;
  background: rgba(34,197,94,.05);
}
.dr-kpi-active-danger {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.14) !important;
  background: rgba(239,68,68,.05);
}
.dr-kpi-active-neutral {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.14) !important;
  background: rgba(59,130,246,.05);
}

/* Bouton "Effacer les filtres" dans la topbar */
.dr-clear-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.dr-clear-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ================= Multi-select plateforme (filtres mouvements) ================= */
.plat-multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.plat-multiselect-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.plat-multiselect-trigger:hover {
  border-color: var(--primary);
}
.plat-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 200;
  padding: 4px 0;
}
.plat-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.plat-multiselect-item:hover {
  background: var(--surface-2);
}
.plat-multiselect-item input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--primary);
}

/* ================= MonCompte — layout 2 colonnes ================= */
.account-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  padding: 0 24px;
  align-items: start;
  flex: 1;
}
.account-sidebar {
  padding: 24px 16px 32px 0;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 60px;
}
.account-title {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 0 0 20px;
  padding: 0 8px;
  color: var(--text);
}
.account-nav-group {
  margin-bottom: 8px;
}
.account-nav-label {
  display: block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 8px;
  margin-bottom: 6px;
}
.account-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
  margin-bottom: 2px;
}
.account-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.account-nav-item.active {
  background: rgba(59,130,246,.12);
  color: var(--primary);
  font-weight: 600;
}
.account-content {
  padding: 24px 0 32px 28px;
  min-width: 0;
}

/* AccountForm interne — profil + préférences côte-à-côte */
.profile-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.profile-section { margin-bottom: 20px; }
.profile-section-title {
  font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  font-weight: 600; margin-bottom: 12px; padding: 0;
}
.profile-input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--input-border); border-radius: 6px;
  background: var(--input-bg); color: var(--text); font-size: var(--fs-base);
}
.profile-email-row { display: flex; align-items: center; gap: 10px; }
.profile-email-value { font-size: var(--fs-base); color: var(--text); }
.profile-manage-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 14px; font-size: var(--fs-sm); color: var(--text-muted);
  cursor: pointer; transition: background .12s;
}
.profile-manage-btn:hover { background: var(--surface-2); }
.profile-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 10px; border: 1px solid var(--input-border);
  border-radius: 6px; background: var(--input-bg); color: var(--text);
  font-size: var(--fs-base); cursor: pointer; position: relative;
  transition: border-color .12s; user-select: none;
}
.profile-select-trigger:hover, .profile-select-trigger.open { border-color: var(--primary); }
.profile-select-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; font-size: var(--fs-sm); cursor: pointer;
  transition: background .1s; color: var(--text);
}
.profile-select-option:hover { background: var(--surface-2); }
.profile-select-option.selected { font-weight: 600; }

/* ── Tooltip CSS instantané (data-tooltip) ─────────────────────────────── */
.cell-tooltip { position: relative; cursor: help; }
.cell-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 400;
  white-space: pre-line;
  text-align: left;
  min-width: 200px;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  z-index: 200;
}
.cell-tooltip:hover::after { opacity: 1; }

/* ── Tableau Remboursements enregistrés (InvestissementDetail) ────────── */
.remb-table { table-layout: fixed; width: 100%; }
.remb-table th, .remb-table td { text-align: center; }
.remb-table th:first-child, .remb-table td:first-child { text-align: left; width: 92px; }
.remb-table th:last-child,  .remb-table td:last-child  { width: 36px; }

/* ── Sélecteur couleurs graphiques (Settings > Apparence) ────── */
.chart-color-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.chart-color-item {
  flex: 1;
  min-width: 200px;
}
.chart-color-item label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.chart-color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.color-family-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-family-select-row select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.color-family-indicator {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15);
  flex-shrink: 0;
}
.color-shade-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.color-shade-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .1s;
  position: relative;
}
.color-shade-btn:hover {
  transform: scale(1.15);
  z-index: 1;
}
.color-shade-btn.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--surface);
}
.color-shade-label {
  display: block;
  font-size: 9px;
  color: inherit;
  position: absolute;
  bottom: 1px;
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
}
.color-shade-btn:hover .color-shade-label {
  opacity: 1;
}
.color-preview-pair {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.color-preview-bar {
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  border: 1px solid rgba(0,0,0,.12);
  transition: background-color .15s;
}
.color-preview-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .85;
}
.color-preview-hex {
  font-size: 11px;
  font-weight: 600;
  opacity: .9;
}

/* ── Palettes suggérées (Settings > Apparence) ───────────────── */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.palette-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font: inherit;
}
.palette-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover, var(--surface));
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.palette-card.active {
  border-color: var(--primary);
  background: rgba(59,130,246,.07);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.palette-swatches {
  display: flex;
  gap: 4px;
}
.palette-swatch {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.palette-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

/* ── Bibliothèque d'icônes (Admin) ───────────────────────────── */
.icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.icon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s;
}
.icon-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.icon-card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: var(--surface-2, #f0f4ff);
  flex-shrink: 0;
  align-self: flex-start;
}
[data-theme="dark"] .icon-card-preview {
  background: rgba(255,255,255,.08);
}
.icon-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.icon-card-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  font-family: monospace;
}
.icon-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.icon-card-file {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
  opacity: .7;
}
.icon-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}
.icon-history {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.icon-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.icon-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.icon-history-row:last-child {
  border-bottom: none;
}


/* ═══════════════════════════════════════════════════════════════
   TABLEAU INTÉRÊTS PAR PLATEFORME (TableauInteretsPlateforme)
   ═══════════════════════════════════════════════════════════════ */
.tip-wrapper { margin-bottom: 24px; }

.tip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}
.tip-mode-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Table de base */
.tip-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1400px;
  font-size: var(--fs-sm);
}

/* En-têtes */
.tip-th-year {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 6px 10px;
  letter-spacing: .04em;
}
.tip-th-total,
.tip-th-avg {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  text-align: right;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 6px 10px;
}
.tip-th-name {
  background: var(--surface-2);
  text-align: left;
  padding: 6px 12px;
  font-weight: 600;
  font-size: var(--fs-sm);
  white-space: nowrap;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--border);
}
.tip-th-month {
  background: var(--surface-2);
  text-align: right;
  padding: 6px 8px;
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 90px;
  border-bottom: 1px solid var(--border);
}
.tip-th-total,
.tip-th-avg {
  min-width: 105px;
  white-space: nowrap;
}

/* Cellules plateforme */
.tip-td-name {
  padding: 7px 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--border);
  color: var(--text);
}
.tip-td-num {
  padding: 7px 8px;
  text-align: right;
  white-space: nowrap;
  color: var(--text);
}
.tip-td-total {
  padding: 7px 10px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(109,40,217,.06);
  border-left: 1px solid rgba(109,40,217,.15);
}
.tip-td-avg {
  padding: 7px 10px;
  text-align: right;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

/* Valeurs projetées */
.tip-projected { color: var(--text-muted); font-style: italic; }
.tip-dash { color: var(--text-muted); opacity: .5; }

/* Cellules cliquables (drill-down) */
.tip-td-clickable { cursor: pointer; }
.tip-row-plat:hover .tip-td-clickable { text-decoration: underline dotted; text-underline-offset: 2px; }
.tip-td-active {
  background: rgba(var(--primary-rgb, 99,102,241), 0.14) !important;
  font-weight: 700;
  color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* Mois après remboursement complet */
.tip-td-closed {
  background: var(--surface-2) !important;
}
.tip-td-closed.tip-col-current {
  background: rgba(109,40,217,0.045) !important;
}
[data-theme="dark"] .tip-td-closed {
  background: rgba(255,255,255,0.04) !important;
}
[data-theme="dark"] .tip-td-closed.tip-col-current {
  background: rgba(109,40,217,0.08) !important;
}

/* Cellule cliquable (lien vers mouvements) */
.tip-td-link:hover { background: var(--primary-light, rgba(109,40,217,.1)) !important; color: var(--primary); }

/* Lignes corps */
.tip-row-plat { border-bottom: 1px solid var(--border); }
.tip-row-plat:hover .tip-td-name,
.tip-row-plat:hover .tip-td-num,
.tip-row-plat:hover .tip-td-total,
.tip-row-plat:hover .tip-td-avg {
  background: var(--surface-2);
}
.tip-row-plat:hover .tip-td-name { background: var(--surface-2); }

/* Pied de tableau */
.tip-footer-total td,
.tip-footer-capital td,
.tip-footer-perf td {
  border-top: 2px solid var(--border);
  padding: 7px 8px;
  text-align: right;
  white-space: nowrap;
  font-size: var(--fs-sm);
}
.tip-footer-total td.tip-td-name,
.tip-footer-capital td.tip-td-name,
.tip-footer-perf td.tip-td-name {
  text-align: left;
  font-weight: 600;
  font-style: normal;
  background: var(--surface);
  color: var(--text);
  border-right: 1px solid var(--border);
}
.tip-footer-total {
  background: rgba(109,40,217,.08);
  font-weight: 700;
}
.tip-footer-total td { border-top: 2px solid rgba(109,40,217,.3); }
.tip-footer-capital { color: var(--text-muted); font-style: italic; }
.tip-footer-capital td { border-top: 1px solid var(--border); }
.tip-footer-perf td { border-top: 1px solid var(--border); }
.tip-footer-total td.tip-td-total { background: rgba(109,40,217,.12); border-left: 1px solid rgba(109,40,217,.2); }

/* Dark mode ajustements */
[data-theme="dark"] .tip-footer-total { background: rgba(217,119,6,.12); }
[data-theme="dark"] .tip-td-total { background: rgba(217,119,6,.08); }

/* Colonne mois courant */
.tip-th-month-current {
  position: relative;
  color: var(--text) !important;
  font-weight: 700 !important;
}
.tip-th-month-current::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed, #4f46e5);
  border-radius: 0 0 2px 2px;
}
.tip-col-current {
  background: rgba(109,40,217,0.045) !important;
  font-weight: 600;
}
.tip-footer-total .tip-col-current {
  background: rgba(109,40,217,0.13) !important;
}
.tip-footer-capital .tip-col-current,
.tip-footer-perf .tip-col-current {
  background: rgba(109,40,217,0.045) !important;
}
[data-theme="dark"] .tip-col-current {
  background: rgba(109,40,217,0.08) !important;
}
[data-theme="dark"] .tip-footer-total .tip-col-current {
  background: rgba(109,40,217,0.18) !important;
}

.tip-th-empty {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.tip-perf-mode {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  bord
/* ── DrillCellPanel table ── */
.drill-table {
  width: 100% !important;
  min-width: 100% !important;
  border-collapse: collapse !important;
  margin: 0 !important;
  table-layout: auto;
  display: table;
}
/* Neutralise le hover global tr:hover td pour les lignes de données cliquables.
   Le hover est géré par les styles inline (cursor, opacity). */
.drill-table tr:hover td { background: inherit; }
/* Les lignes cliquables ont leur propre hover via opacity inline — on protège
   les lignes "header de section" (sous-total, total) contre le global hover. */
.drill-table tr.drill-row-fixed:hover td { background: inherit !important; }
