/* =====================================================================
   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;
  min-height: 100dvh;
  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;
  height: 100dvh;
  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: transparent !important; border: none; cursor: pointer;
  align-items: center; justify-content: center;
  color: transparent; border-radius: 0;
  -webkit-appearance: none; appearance: none;
  outline: none;
}
.sidebar-expand-overlay:hover,
.sidebar-expand-overlay:focus,
.sidebar-expand-overlay:active { background: transparent !important; outline: none; }
.sidebar-collapsed .sidebar-brand:hover .sidebar-expand-overlay { display: flex; }
.sidebar-collapsed .sidebar-brand:hover .sidebar-brand-logo {
  filter: brightness(1.18);
  transition: filter .15s;
}
.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); }

/* ── Boutons génériques ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px; height: 32px;
  border-radius: 8px; border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-xs); }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border); }

/* ── Burger menu topbar ──────────────────────────────────────── */
.topbar-burger-wrap { position: relative; display: none; }
.topbar-burger-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 0; background: none; border: none;
  cursor: pointer; color: var(--text);
  transition: color .15s;
}
.topbar-burger-btn:hover { color: var(--primary); }
.topbar-burger-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.10);
  min-width: 220px; z-index: 200; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.topbar-burger-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: none; border-radius: 6px;
  background: none; color: var(--text); font-size: var(--fs-base);
  font-weight: 600; cursor: pointer; text-align: left; width: 100%;
  transition: background .12s;
}
.topbar-burger-item:hover { background: var(--surface-2); }
.topbar-burger-item svg { color: var(--primary); flex-shrink: 0; }
.topbar-burger-search-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: none; border-radius: 6px;
  background: none; color: var(--text-muted); font-size: var(--fs-sm);
  cursor: pointer; text-align: left; width: 100%;
  transition: background .12s;
}
.topbar-burger-search-item:hover { background: var(--surface-2); }
.topbar-burger-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* Bloc toggle dans le burger */
.topbar-burger-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px 4px;
}
.topbar-burger-toggle-label {
  font-size: var(--fs-sm); color: var(--text-muted);
}

/* Tablette : masquer les boutons texte et le toggle, afficher le burger */
@media (max-width: 1100px) {
  .topbar-action-btn { display: none !important; }
  .topbar-burger-wrap { display: block; }
  .topbar-global .topbar-right > .display-toggle { display: none; }
}

/* Mobile : masquer aussi la barre de recherche dans la topbar */
@media (max-width: 640px) {
  .topbar-global .project-search-wrap { display: none; }
  .topbar-burger-search-item { display: flex; }
}

/* Sur tablette, masquer l'item recherche dans le burger (search reste visible) */
@media (min-width: 641px) and (max-width: 1100px) {
  .topbar-burger-search-item,
  .topbar-burger-search-item + .topbar-burger-sep { display: none; }
}

/* 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: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  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: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  text-align: left;
  padding: 6px 12px;
  font-weight: 700;
  font-size: var(--fs-sm);
  white-space: nowrap;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid rgba(255,255,255,.2);
}
.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);
  background: rgba(109,40,217,.04);
  border-left: 1px solid rgba(109,40,217,.1);
}

/* 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); }
[data-theme="dark"] .tip-td-avg { background: rgba(217,119,6,.04); border-left-color: rgba(217,119,6,.15); }
[data-theme="dark"] .tip-th-name { background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%); }

/* 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);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ── 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:hove
/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 2px;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-size-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-right: 10px;
  white-space: nowrap;
}
.pagination-size-select {
  font-size: var(--fs-xs);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: background .12s, border-color .12s;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Pages d'authentification (login, register, forgot, reset, verify) ───── */
.login-bg-col {
  flex: 1 1 50%;
  display: none;
  position: relative;
  overflow: hidden;

  /* Image split dark/light : dark à gauche, light à droite.
     background-size: 200% auto → zoom sur une seule moitié.
     Par défaut (thème clair) : moitié droite. */
  background-image: url('/login-bg.png');
  background-size: 200% auto;
  background-repeat: no-repeat;
  background-position: 100% 50%;
  background-color: #f0f2f8;
}

[data-theme="dark"] .login-bg-col {
  /* Thème sombre : moitié gauche de l'image. */
  background-position: 0% 50%;
  background-color: #0d0e1a;
}

@media (min-width: 768px) {
  .login-bg-col { display: block !important; }
}

.login-bg-overlay {
  position: absolute;
  inset: 0;
  /* léger dégradé pour améliorer la lisibilité du badge app en bas */
  background: linear-gradient(to top, rgba(0,0,0,.35) 0%, transparent 40%);
  pointer-events: none;
}

[data-theme="dark"] .login-bg-overlay {
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 40%);
}

.login-bg-brand {
  position: absolute;
  bottom: 36px;
  left: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.3px;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}

.login-mobile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

/* ══════════════════════════════════════════════════════════════
   NOTIFICATIONS — cloche, dropdown, page
   ══════════════════════════════════════════════════════════════ */

/* ── Bouton cloche dans la topbar ── */
.notif-bell-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.notif-bell-btn:hover { background: none; color: var(--text-muted); }
.notif-bell-btn.has-unread { color: var(--primary); }

/* ── Badge rouge nombre non-lus ── */
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #e53e3e);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg, #fff);
}

/* ── Dropdown portal ── */
.notif-dropdown {
  position: fixed;
  z-index: 9999;
  width: 360px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.notif-dropdown-title { font-weight: 600; font-size: 14px; color: var(--text); }
.notif-mark-all-btn {
  font-size: 12px; color: var(--primary);
  background: none; border: none; cursor: pointer; padding: 0;
}
.notif-mark-all-btn:hover { text-decoration: underline; }
.notif-dropdown-list { max-height: 360px; overflow-y: auto; }
.notif-dropdown-footer { border-top: 1px solid var(--border); padding: 10px 16px; text-align: center; }
.notif-view-all-btn {
  font-size: 13px; color: var(--primary);
  background: none; border: none; cursor: pointer; padding: 0; width: 100%;
}
.notif-view-all-btn:hover { text-decoration: underline; }

/* ── Item dropdown ── */
.notif-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 24px 12px 16px; /* padding-right 24px pour le scrollbar + dot */
  cursor: pointer;
  transition: background .12s;
  border-top: 1px solid var(--border);
  position: relative;
}
.notif-item:first-child { border-top: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item-unread {
  background: color-mix(in srgb, var(--primary) 5%, transparent);
  border-left: 3px solid var(--primary) !important;
  padding-left: 13px; /* 16px - 3px border */
}
.notif-item-unread:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
/* Scrollbar fine dans la liste dropdown */
.notif-dropdown-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.notif-dropdown-list::-webkit-scrollbar { width: 4px; }
.notif-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.notif-dropdown-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.notif-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
}
.notif-avatar-icon span { font-size: 16px; line-height: 1; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.4; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item-text {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.notif-item-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
/* .notif-unread-dot défini dans .notif-row-actions */

/* ══════════════════════════════════════════════════════════════
   PAGE /notifications — design tableau
   ══════════════════════════════════════════════════════════════ */

/* Wrapper direct de .main — reçoit padding: 0 24px automatiquement */
.notif-center-wrap {
  margin-top: 20px;
  padding-bottom: 28px;
}

/* Bloc carte centré max-800px */
.notif-block {
  max-width: 65%;
  margin: 0 auto;
  padding: 0;
  overflow: visible;
}

/* En-tête interne du bloc */
.notif-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

/* En-tête */
.notif-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.notif-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.notif-markall-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg, #fff);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.notif-markall-btn:disabled { opacity: .4; cursor: default; }
.notif-markall-btn:not(:disabled):hover { opacity: .85; }

/* Barre admin */
.notif-admin-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 13px;
}
.notif-admin-label { color: #d97706; font-weight: 700; }
.notif-seed-select {
  padding: 3px 8px; font-size: 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); height: auto;
}

/* Toolbar */
.notif-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
}
.notif-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.notif-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.notif-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.notif-search-input::placeholder { color: var(--text-muted); }
.notif-search-input:focus { border-color: var(--primary); }

.notif-filters { display: flex; gap: 8px; flex-shrink: 0; }

/* Dropdown filtres */
.notif-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.notif-filter-btn:hover { background: var(--surface-2); border-color: var(--primary); }
.notif-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.notif-filter-option {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.notif-filter-option:hover { background: var(--surface-2); }
.notif-filter-option.active { font-weight: 600; color: var(--primary); }

/* Lignes tableau */
.notif-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  transition: background .12s;
}
.notif-row:hover { background: var(--surface-2); }
.notif-row-unread {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
  border-left: 3px solid var(--primary) !important;
  padding-left: 17px; /* 20px - 3px de bordure */
}
.notif-row-unread:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }

.notif-row-body { flex: 1; min-width: 0; }
.notif-row-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 2px;
}
.notif-row-text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-type-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.notif-row-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

.notif-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  /* largeur fixe = 2 boutons (28px) + gap (4px) + puce (8px) + gaps */
  width: 72px;
  opacity: 0;
  transition: opacity .15s;
  position: relative;
}
.notif-row:hover .notif-row-actions { opacity: 1; }

/* La puce non-lue est toujours visible, positionnée en absolu */
.notif-unread-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.notif-row:hover .notif-unread-dot { opacity: 0; }

/* Pagination */
.notif-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.notif-pagination-info { font-size: 13px; color: var(--text-muted); }
.notif-page-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.notif-page-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--primary); }
.notif-page-btn:disabled { opacity: .4; cursor: default; }

/* Bouton icône small */
.btn-icon-sm {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  padding: 0;
}
.btn-icon-sm:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

/* Dark mode */
[data-theme="dark"] .notif-badge { box-shadow: 0 0 0 2px var(--bg-dark, #1a1b2e); }
[data-theme="dark"] .notif-dropdown { box-shadow: 0 8px 32px rgba(0,0,0,.4); }
[data-theme="dark"] .notif-type-badge { filter: brightness(.85); }

/* ══════════════════════════════════════════════════════════════
   PAGE /communication — layout 3 panneaux (email-style)
   ══════════════════════════════════════════════════════════════ */

.comm-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--bg);
  padding: 0 !important; /* annule le padding global .main > * */
}

/* ── Topbar 3 colonnes ── */
.comm-topbar {
  display: flex;
  align-items: stretch;
  height: 44px;
  border-bottom: 1px solid var(--border);
  background: var(--surface, #fff);
  flex-shrink: 0;
}
.comm-topbar-1 {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  border-right: 1px solid var(--border);
}
.comm-topbar-2 {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.comm-topbar-folder {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.comm-topbar-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.comm-topbar-filter-btn {
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.comm-topbar-filter-btn:hover { background: var(--surface-2); color: var(--text); }
.comm-topbar-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.comm-topbar-action-btn {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 4px;
}
.comm-topbar-action-btn:hover { background: var(--surface-2); color: var(--text); }
.comm-topbar-3 {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  min-width: 0;
}
.comm-topbar-ticket-ref {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.comm-wrap {
  display: flex;
  flex: 1;
  min-height: 0;          /* force shrink dans un flex column */
  overflow: hidden;
}

/* ── Sidebar gauche ── */
.comm-sidebar {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 4px;
  background: var(--surface, #fff);
}

.comm-compose-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  text-align: center;
}
.comm-compose-btn:hover { filter: brightness(1.1); }

.comm-nav { display: flex; flex-direction: column; gap: 2px; }
.comm-nav-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; border-radius: 7px;
  border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--text-muted); text-align: left;
  transition: background .12s, color .12s;
}
.comm-nav-item:hover { background: var(--surface-2); color: var(--text); }
.comm-nav-item.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 600; }
.comm-nav-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.comm-sidebar-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.comm-sidebar-label { font-size: 12px; color: var(--text-muted); padding: 2px 4px; }

/* ── Liste centrale ── */
.comm-list {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface, #fff);
}
.comm-list-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.comm-list-pagination {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface, #fff);
  gap: 8px;
}
.comm-list-pagination-info {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.comm-list-pagination-btns { display: flex; gap: 6px; }
.comm-list-pagination-btns button {
  padding: 4px 10px; font-size: 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer;
}
.comm-list-pagination-btns button:hover:not(:disabled) { background: var(--border); }
.comm-list-pagination-btns button:disabled { opacity: 0.4; cursor: default; }
.comm-list-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.comm-search {
  height: 32px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 10px; font-size: 13px; color: var(--text);
  outline: none;
}
.comm-search:focus { border-color: var(--primary); }
.comm-markall-btn {
  font-size: 12px; color: var(--primary);
  background: none; border: none; cursor: pointer; padding: 0; white-space: nowrap;
}
.comm-markall-btn:hover { text-decoration: underline; }

.comm-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px; padding: 40px 20px;
  text-align: center;
}

.comm-list-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  position: relative;
}
.comm-list-row:hover { background: var(--surface-2); }
.comm-list-row.selected { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.comm-list-row.unread { background: color-mix(in srgb, var(--primary) 4%, transparent); border-left: 3px solid var(--primary); padding-left: 11px; }
.comm-list-row-body { flex: 1; min-width: 0; }
.comm-list-row-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.comm-list-row-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-list-row-subject { font-size: 12px; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-list-row-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.comm-list-row-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.comm-unread-dot {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0;
}

/* ── Panneau détail droite ── */
.comm-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.comm-detail-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.comm-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface, #fff);
  flex-shrink: 0;
}

/* Thread messages */
.comm-thread {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.comm-message {
  display: flex; gap: 12px; align-items: flex-start;
}
.comm-message.from-admin .comm-message-content {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  border-color: color-mix(in srgb, var(--primary) 20%, transparent);
}
.comm-message-content {
  flex: 1; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.comm-message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comm-message-body { font-size: 14px; color: var(--text); line-height: 1.55; white-space: pre-wrap; }

/* Pièces jointes */
.comm-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.comm-attach-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
  text-decoration: none; color: var(--text);
  font-size: 12px; max-width: 200px;
}
.comm-attach-chip:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.comm-attach-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-attach-size { color: var(--text-muted); flex-shrink: 0; }

/* Images inline dans le thread */
.comm-attach-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.comm-attach-image {
  position: relative; display: inline-flex; flex-direction: column;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  max-width: 300px;
}
.comm-attach-img {
  display: block; max-width: 300px; max-height: 300px;
  width: auto; height: auto; object-fit: contain;
}
.comm-attach-img-skeleton {
  width: 120px; height: 80px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--text-muted);
}
.comm-attach-image-overlay {
  position: absolute; inset: 0 0 26px 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  opacity: 0; transition: opacity 0.15s;
}
.comm-attach-image:hover .comm-attach-image-overlay { opacity: 1; }
.comm-attach-overlay-btn {
  background: rgba(255,255,255,0.92); border: none; border-radius: 8px;
  padding: 8px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: #1e293b;
}
.comm-attach-overlay-btn:hover { background: #fff; transform: scale(1.08); }
.comm-attach-img-name {
  font-size: 11px; color: var(--text-muted); padding: 4px 8px;
  background: var(--surface-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 300px;
  flex-shrink: 0;
}

/* Lightbox */
.comm-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
}
.comm-lightbox-img {
  max-width: 90vw; max-height: 88vh;
  object-fit: contain; border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.comm-lightbox-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  font-size: 22px; cursor: pointer; width: 40px; height: 40px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.comm-lightbox-close:hover { background: rgba(255,255,255,0.28); }
.comm-lightbox-download {
  position: absolute; top: 16px; right: 64px;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  cursor: pointer; padding: 8px 14px; border-radius: 6px; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
.comm-lightbox-download:hover { background: rgba(255,255,255,0.28); }
.comm-lightbox-img {
  max-width: 90vw; max-height: 85vh;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

/* ── Éditeur de texte riche (RichTextEditor) ── */
.rte-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, var(--surface));
  overflow: hidden;
}
.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2, var(--surface));
  flex-wrap: wrap;
}
.rte-btn {
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 26px;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.rte-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.rte-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.rte-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}
.rte-editor {
  padding: 10px 12px;
  outline: none;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
  overflow-y: auto;
}
.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
/* Styles du contenu formaté */
.rte-editor b, .rte-editor strong { font-weight: 700; }
.rte-editor i, .rte-editor em { font-style: italic; }
.rte-editor u { text-decoration: underline; }
.rte-editor s { text-decoration: line-through; }
.rte-editor a { color: var(--primary); text-decoration: underline; }
.rte-editor ul, .rte-editor ol { padding-left: 20px; margin: 4px 0; }
.rte-editor li { margin: 2px 0; }
/* Image inline collée */
.rte-img-wrap {
  display: inline-block;
  position: relative;
  cursor: pointer;
  max-width: 100%;
}
.rte-inline-img {
  max-width: 320px;
  max-height: 240px;
  border-radius: 4px;
  display: block;
}
.rte-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 4px;
}
.rte-img-wrap:hover .rte-img-overlay { display: flex; }
.rte-img-overlay-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.rte-img-overlay-btn:hover { background: rgba(255,255,255,0.35); }
.rte-img-del { border-color: rgba(255,80,80,0.6); }
.rte-img-del:hover { background: rgba(220,50,50,0.5); }


/* ═══════════════════════════════════════════════════════════════
   PAGE /communication — CSS manquant (reconstruit)
   ══════════════════════════════════════════════════════════════ */

/* ── Navigation sidebar ── */
.comm-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.comm-nav-item:hover { background: var(--surface-2); color: var(--text); }
.comm-nav-item.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 600; }
.comm-nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}

/* ── Liste tickets / notifs ── */
.comm-list-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  background: var(--surface);
}
.comm-list-row:hover { background: var(--surface-2); }
.comm-list-row.selected { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.comm-list-row.unread { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.comm-list-row.unread .comm-list-row-subject { font-weight: 600; color: var(--text); }
.comm-list-row-body { flex: 1; min-width: 0; }
.comm-list-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
.comm-list-row-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.comm-list-row-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.comm-list-row-subject { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.comm-list-row-preview { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.comm-list-row-meta { display: flex; align-items: center; gap: 6px; }

/* ── Messages dans le fil ── */
.comm-msg {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
}
.comm-msg-bubble {
  flex: 1;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 0;
}
.comm-msg.from-admin .comm-msg-bubble {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.comm-msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comm-msg-author { font-size: 12px; font-weight: 700; color: var(--text); }
.comm-msg-time { font-size: 11px; color: var(--text-muted); }
.comm-msg-body { font-size: 13px; line-height: 1.6; color: var(--text); word-break: break-word; }
.comm-msg-body b, .comm-msg-body strong { font-weight: 700; }
.comm-msg-body i, .comm-msg-body em { font-style: italic; }
.comm-msg-body u { text-decoration: underline; }
.comm-msg-body s { text-decoration: line-through; }
.comm-msg-body a { color: var(--primary); text-decoration: underline; }
.comm-msg-body ul, .comm-msg-body ol { padding-left: 18px; margin: 4px 0; }

/* ── Édition de message ── */
.comm-edit-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 2px 6px; border-radius: 4px;
}
.comm-edit-btn:hover { background: var(--surface-2); color: var(--text); }
.comm-edit-block { margin-top: 8px; }
.comm-edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.comm-edit-timer { font-size: 11px; color: var(--text-muted); }

/* ── Formulaire de réponse ── */
.comm-reply-form {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.comm-reply-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input, var(--surface));
}
.comm-reply-textarea:focus { outline: none; border-color: var(--primary); }
.comm-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

/* ── Pièces jointes preview ── */
.comm-files-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.comm-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-muted);
  max-width: 180px;
}
.comm-file-chip.has-preview { padding-left: 2px; }
.comm-file-chip-img { width: 28px; height: 28px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.comm-file-remove {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 13px; padding: 0 0 0 2px; line-height: 1; flex-shrink: 0;
}
.comm-file-remove:hover { color: var(--danger); }

/* ── Détail notification ── */
.comm-notif-detail {
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
}
.comm-notif-detail h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--text); }
.comm-notif-detail-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.comm-notif-detail-body { font-size: 14px; line-height: 1.7; color: var(--text); }

/* ── Panneau broadcast (admin) ── */
.comm-broadcast-panel {
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
  max-width: 540px;
}
.comm-broadcast-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 18px; }
.comm-broadcast-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Formulaire générique comm ── */
.comm-form-group { display: flex; flex-direction: column; gap: 5px; }
.comm-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.comm-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input, var(--surface));
}
.comm-input:focus { outline: none; border-color: var(--primary); }
.comm-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input, var(--surface));
  cursor: pointer;
}
.comm-select:focus { outline: none; border-color: var(--primary); }

/* ── Modale "Nouveau ticket" ── */
.comm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comm-modal {
  background: var(--surface);
  border-radius: 12px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  overflow: hidden;
}
.comm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.comm-modal-close {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--text-muted); line-height: 1; padding: 0 4px;
}
.comm-modal-close:hover { color: var(--text); }
.comm-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Ticket chips (type / page) ── */
.ticket-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ticket-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.ticket-chip-type { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.ticket-chip-page { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ── Tag select (multi-select catégories) ── */
.tag-select { position: relative; }
.tag-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input, var(--surface));
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  gap: 6px;
}
.tag-select-trigger.has-value { color: var(--text); }
.tag-select-trigger.open { border-color: var(--primary); }
.tag-select-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}
.tag-select-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  text-align: left;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
}
.tag-select-option:hover { background: var(--surface-2); }
.tag-select-option.selected { color: var(--primary); font-weight: 600; }
.tag-select-check { color: var(--primary); flex-shrink: 0; }

/* ── Images inline dans les messages (collées via Ctrl+V) ── */
.msg-img-wrap {
  display: inline-block;
  position: relative;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  max-width: 300px;
  vertical-align: bottom;
  margin: 7px;
}
.msg-inline-img {
  display: block;
  max-width: 300px;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 7px;
}
.msg-img-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.msg-img-wrap:hover .msg-img-hover-overlay { opacity: 1; }
