/* ================================================================
   CollabDoc — Feuille de style principale  (SB Admin 2 inspired)
================================================================ */

:root {
  /* ── Charte : bleu nuit. UNE couleur pilote boutons/focus/liens (60+ usages).
        Déclinaisons dérivées en CSS (color-mix) → personnalisable par l'admin. ── */
  --primary:         var(--accent-base, #1B3A6B);   /* accent personnalisable par l'admin (base.html) */
  --primary-dk:      color-mix(in srgb, var(--primary) 84%, #000);
  --primary-weak:    color-mix(in srgb, var(--primary) 13%, var(--card));
  --primary-line:    color-mix(in srgb, var(--primary) 38%, var(--card));
  --side-accent:     color-mix(in srgb, var(--primary) 50%, #ffffff);  /* accent éclairci pour le cadre sombre (suit la charte) */
  --accent:          #d97706;   /* ambre — accent secondaire (conservé) */
  --success:         #0B7E55;
  --danger:          #C41E3A;
  --warning:         #B45309;
  --info:            #0B6F79;
  --violet:          #5E37C0;
  --badge-mix:       #000;   /* cible d'assombrissement du texte des badges (clair) ; #fff en sombre */
  --ff-mono:         'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --ff-display:      'Fraunces', 'Hanken Grotesk', Georgia, serif;

  /* ── Surfaces & encre — HAUT CONTRASTE : cadre/canvas marqué, cartes blanches qui décollent ── */
  --canvas:          #CFCEC6;   /* plan de travail (fond de page) — nettement + sombre que le blanc */
  --bg:              #F1EFEA;   /* teinte CLAIRE : survols, remplissages, lignes paires */
  --card:            #ffffff;   /* documents & cartes : blanc pur (point lumineux) */
  --card-bg:         #ffffff;
  --surface-2:       #F4F3EF;
  --border:          #E3E0D8;   /* hairlines internes (sur fond blanc) */
  --edge:            #B7B5AC;   /* bord des cartes contre le canvas sombre */
  --text:            #45434E;   /* texte courant */
  --text-dark:       #0E0D12;   /* titres / encre quasi-noire */
  --muted:           #66646F;

  /* ── Ombres + franches : les cartes blanches se détachent du canvas ── */
  --shadow-sm:       0 1px 2px rgba(15,14,20,.10), 0 1px 1px rgba(15,14,20,.05);
  --shadow:          0 2px 5px rgba(15,14,20,.10), 0 10px 26px -10px rgba(15,14,20,.28);
  --shadow-lg:       0 18px 44px -14px rgba(15,14,20,.40);
  --sidebar-w:       224px;
  --sidebar-icon-w:  56px;
  --radius:          10px;
}

/* ── Mode sombre ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  /* l'accent admin éclairci pour rester lisible sur fond sombre ; les déclinaisons se redérivent */
  --primary: color-mix(in srgb, var(--accent-base, #1B3A6B) 58%, #fff);
  --primary-dk: color-mix(in srgb, var(--primary) 80%, #000);
  --canvas: #0C0B10;            /* plan de travail sombre */
  --bg: #201E29;               /* teinte de survol/remplissage sombre */
  --surface: #18171F;
  --surface2: #201E29;
  --surface-2: #201E29;
  --card: #18171F;
  --card-bg: #18171F;
  --text: #C3C0CC;
  --text-dark: #F2F0E9;        /* (était absent en sombre → titres quasi invisibles) */
  --text-muted: #8E8B98;
  --muted: #8E8B98;
  --border: #2C2B37;
  --edge: #2C2B37;
  --badge-mix: #fff;   /* texte des badges éclairci sur fond sombre */
  /* sémantique avivée pour le fond sombre (pastilles pleines, rôles) */
  --success: #2FA875;
  --danger:  #E8536C;
  --warning: #D69A3C;
  --info:    #2C9CA8;
  --violet:  #9374E0;
  --input-bg: #201E29;
  --topbar-bg: #14131A;
  --sidebar-bg: linear-gradient(180deg,#17161C,#0E0D12);
}
[data-theme="dark"] body { background: var(--canvas); color: var(--text); }
[data-theme="dark"] .card { background: var(--card-bg); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .topbar { background: var(--topbar-bg) !important; border-bottom-color: var(--border) !important; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--input-bg) !important; color: var(--text) !important; border-color: var(--border) !important; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.85); }
[data-theme="dark"] .modal { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .modal-header { border-bottom-color: var(--border); }
[data-theme="dark"] .modal-footer { border-top-color: var(--border); }
[data-theme="dark"] .list-item { border-bottom-color: var(--border); }
[data-theme="dark"] .list-item:hover { background: var(--surface2); }
[data-theme="dark"] table { color: var(--text); }
[data-theme="dark"] th { background: var(--surface2) !important; color: var(--text) !important; border-color: var(--border) !important; }
[data-theme="dark"] td { border-color: var(--border) !important; }
[data-theme="dark"] tr:hover { background: var(--surface2) !important; }
[data-theme="dark"] .admin-tabs { background: var(--surface); border-bottom-color: var(--border); }
[data-theme="dark"] .admin-tab { color: var(--text-muted); }
[data-theme="dark"] .admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
[data-theme="dark"] .card-header { border-bottom-color: var(--border); }
[data-theme="dark"] .nav-search-input { background: var(--input-bg) !important; color: var(--text) !important; border-color: var(--border) !important; }
[data-theme="dark"] .nav-search-results { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .search-result-item { color: var(--text); border-bottom-color: var(--border); }
[data-theme="dark"] .search-result-item:hover { background: var(--surface2); }
[data-theme="dark"] .notif-panel { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .page-sub { color: var(--text-muted); }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .settings-section { border-color: var(--border); }
[data-theme="dark"] .provider-card { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .provider-card.selected { border-color: var(--primary); background: var(--surface2); }
[data-theme="dark"] .sidebar { background: linear-gradient(180deg,#1a1a3e,#0f0f2e) !important; }
[data-theme="dark"] .topbar-right .topbar-user { color: var(--text); }
[data-theme="dark"] .topbar-btn, [data-theme="dark"] .notif-btn { color: var(--text); }
[data-theme="dark"] .flash-container .flash { filter: brightness(0.85); }
[data-theme="dark"] .todo-topbar-btn:hover { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .todo-topbar-panel { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .todo-panel-header { background: rgba(245,158,11,0.1); color: #f59e0b; border-color: var(--border); }
[data-theme="dark"] .kpi-tile { background: var(--card-bg) !important; border-color: var(--border); }
[data-theme="dark"] .kpi-tile-num { color: var(--text) !important; }
[data-theme="dark"] .kpi-tile-lbl { color: var(--text-muted) !important; }
[data-theme="dark"] .project-card { background: var(--card-bg) !important; border-color: var(--border); color: var(--text); }
[data-theme="dark"] .kpi-card { background: var(--card-bg) !important; border-right-color: var(--border); border-bottom-color: var(--border); border-left-color: var(--border); }
[data-theme="dark"] .kpi-blue  .kpi-icon { background: color-mix(in srgb, var(--primary) 22%, transparent); }
[data-theme="dark"] .kpi-green .kpi-icon { background: rgba(16,185,129,.15); }
[data-theme="dark"] .kpi-orange .kpi-icon { background: rgba(245,158,11,.15); }
[data-theme="dark"] .kpi-red   .kpi-icon { background: rgba(239,68,68,.15); }
[data-theme="dark"] .kpi-cyan  .kpi-icon { background: rgba(6,182,212,.15); }
[data-theme="dark"] .nav-search-kbd { background: var(--input-bg); border-color: var(--border); }
[data-theme="dark"] .kpi-value { color: var(--text); }
[data-theme="dark"] .kpi-label { color: var(--text-muted); }
.topbar-dark-btn {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  padding: 0.3rem 0.5rem; border-radius: 5px; transition: background 0.2s;
}
.topbar-dark-btn:hover { background: rgba(0,0,0,0.08); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── FOCUS VISIBLE (accessibilité + UX clavier) ──────────────────────────── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
.sidebar-item:focus-visible { outline: 2px solid rgba(255,255,255,0.8); outline-offset: -2px; }
a:not(.btn):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

body {
  font-family: 'Hanken Grotesk', 'Nunito', 'Segoe UI', Arial, sans-serif;
  background: var(--canvas);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ── SKIP LINK (accessibilité) ───────────────────────────── */
.skip-link { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { position: fixed; left: 50%; top: 0.5rem; transform: translateX(-50%); width: auto; height: auto; overflow: visible; background: white; color: var(--primary); padding: 0.5rem 1rem; border-radius: 6px; z-index: 9999; font-weight: 700; box-shadow: var(--shadow); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-from, #1d1c22) 10%, var(--sidebar-to, #0e0d12) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  z-index: 100;
  transition: width 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-top: 55px;
}
.sidebar.collapsed { width: 0; }

/* ── Sidebar icon-only (toggle desktop) ──────────────────── */
.sidebar.icon-only {
  width: var(--sidebar-icon-w);
  overflow: visible;
}
.sidebar.icon-only .sidebar-heading,
.sidebar.icon-only .tour-auto-row { display: none; }
.sidebar.icon-only .sidebar-divider { margin: 0.3rem 0.5rem; }
.sidebar.icon-only .sidebar-item {
  padding: 0.72rem;
  justify-content: center;
  gap: 0;
  border-left: none;
  border-radius: 8px;
  margin: 2px 0.4rem;
  overflow: visible;
  position: relative;
}
.sidebar.icon-only .sidebar-item > span:not(.sidebar-badge) {
  display: block;
  position: absolute;
  left: calc(var(--sidebar-icon-w) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
}
.sidebar.icon-only .sidebar-item:hover > span:not(.sidebar-badge) { opacity: 1; }
.sidebar.icon-only .sidebar-item.active {
  border-radius: 8px;
  margin-right: 0.4rem;
}
.sidebar.icon-only .sidebar-brand {
  padding: 1rem 0.5rem;
  justify-content: center;
}
.sidebar.icon-only .sidebar-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  padding: 4px;
  border-radius: 8px;
}
.sidebar.icon-only .sidebar-footer {
  padding: 0.6rem 0;
  justify-content: center;
}
.sidebar.icon-only .sidebar-user-info { display: none; }
.sidebar.icon-only .sidebar-user-card { justify-content: center; }
.sidebar.icon-only .tour-btn-demo {
  width: 36px;
  padding: 0.55rem;
  margin: 0.35rem auto;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
.sidebar.icon-only .sidebar-icon { width: 20px; height: 20px; stroke: rgba(255,255,255,.85); }

body.demo-active .sidebar {
  top: 40px;
  top: var(--demo-banner-h, 40px);
  height: calc(100% - 40px);
  height: calc(100% - var(--demo-banner-h, 40px));
}

/* scrollbar fine sur la sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-brand {
  display: flex;
  justify-content: center;
  padding: 1rem 0.75rem 0.75rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}
.sidebar-brand:hover { opacity: 0.9; }
.sidebar-brand-icon { font-size: 1.3rem; flex-shrink: 0; }
.sidebar-logo { width: 140px; max-width: 100%; height: auto; display: block; margin: 0 auto; background: white; border-radius: 10px; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* ── Bouton visite guidée animé (mode démo) ── */
@keyframes tour-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(96,165,250,0.55), 0 2px 8px rgba(0,0,0,0.25); }
  60%  { box-shadow: 0 0 0 7px rgba(96,165,250,0), 0 2px 8px rgba(0,0,0,0.25); }
  100% { box-shadow: 0 0 0 0 rgba(96,165,250,0), 0 2px 8px rgba(0,0,0,0.25); }
}
@keyframes tour-icon-bounce {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-3px); }
  70%       { transform: translateY(-1px); }
}
.tour-btn-demo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0.75rem 0.3rem;
  padding: 0.6rem 0.9rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 70%, #fff), var(--primary));
  color: #fff;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: calc(100% - 1.5rem);
  text-align: left;
  letter-spacing: 0.01em;
  animation: tour-pulse 2.2s ease-out infinite;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.tour-btn-demo:hover { opacity: 0.88; transform: translateY(-1px); }
.tour-btn-demo .t-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  animation: tour-icon-bounce 2.2s ease-in-out infinite;
}

/* ── Toggle auto-tours ── */
.tour-auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.1rem 0.9rem 0.5rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
}
.tour-auto-toggle {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s;
}
.tour-auto-toggle.on { background: var(--side-accent); }
.tour-auto-toggle .knob {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: left 0.18s;
  pointer-events: none;
}
.tour-auto-toggle.on .knob { left: 16px; }

.sidebar-heading {
  padding: 0.7rem 0.9rem 0.5rem 1rem;
  font-size: 0.68rem;
  line-height: 1.6;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.78);
  flex-shrink: 0;
  scroll-margin-top: 4px;
  border-left: 3px solid var(--side-accent);
  background: rgba(255,255,255,0.05);
  border-radius: 0 4px 4px 0;
  margin: 0 0.5rem 0 0;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin: 0.5rem 0;
  flex-shrink: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 1.25rem;
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
  flex-shrink: 0;
}
.sidebar-item:hover  { color: white; background: rgba(255,255,255,0.1); border-left-color: rgba(255,255,255,0.5); }
.sidebar-item.active {
  color: white; background: color-mix(in srgb, var(--side-accent) 26%, transparent);
  border-left-color: var(--side-accent);
  border-radius: 0 20px 20px 0;
  margin-right: 0.75rem;
}
.sidebar-item.active .sidebar-icon { stroke: var(--side-accent); }
.sidebar-icon { flex-shrink: 0; width: 18px; height: 18px; stroke: rgba(255,255,255,0.75); fill: none; vertical-align: middle; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 0.9rem 1rem;
}
.sidebar-user-card { display: flex; align-items: center; gap: 0.6rem; }
.sidebar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; color: white; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.4);
}
.sidebar-user-name { font-size: 0.82rem; font-weight: 700; color: white; white-space: nowrap; }
.sidebar-user-role { font-size: 0.68rem; color: rgba(255,255,255,0.5); text-transform: capitalize; }
.sidebar-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  font-size: 0.6rem; font-weight: 800; line-height: 1;
  padding: 0.1rem 0.3rem; border-radius: 10px; min-width: 16px;
  margin-left: 0.35rem; flex-shrink: 0; vertical-align: middle;
}
.sidebar.icon-only .sidebar-badge {
  position: absolute; top: 3px; right: 3px;
  font-size: 0.55rem; padding: 0.08rem 0.22rem; margin: 0;
}

/* ── CONTENT WRAPPER ──────────────────────────────────────── */
#content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.25s ease;
}


/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: 52px;
  background: white;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 350;
}
.topbar-toggle {
  background: none; border: none; font-size: 1.2rem;
  color: var(--muted); cursor: pointer; padding: 0.3rem 0.5rem;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.topbar-toggle:hover { background: var(--bg); color: var(--text-dark); }

.topbar-nav-btn {
  background: var(--bg); border: 1px solid var(--border); cursor: pointer;
  font-size: 1rem; font-weight: 700; color: var(--text);
  padding: 0.15rem 0.55rem; border-radius: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s; line-height: 1.5; user-select: none;
  min-width: 30px; text-align: center; flex-shrink: 0;
}
.topbar-nav-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
[data-theme="dark"] .topbar-nav-btn { background: var(--bg); color: var(--text); border-color: var(--border); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }
.topbar-divider { width: 0; height: 2rem; border-right: 1px solid var(--border); margin: 0 0.3rem; }

.topbar-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.9rem; color: var(--muted); padding: 0.3rem 0.5rem;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
}
.topbar-btn:hover { background: var(--bg); color: var(--text-dark); }

.notif-btn {
  background: none; border: none; color: var(--muted); font-size: 1rem;
  cursor: pointer; position: relative; padding: 0.3rem 0.6rem;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
  display: flex; align-items: center; gap: 0.3rem;
}
.notif-btn:hover { background: var(--bg); color: var(--text-dark); }
.notif-btn-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em; }
@media (max-width: 768px) { .notif-btn-label { display: none; } }

.notif-badge {
  position: absolute; top: 0; right: 0;
  background: var(--danger); color: white;
  border-radius: 10px; font-size: 0.6rem; font-weight: 800;
  padding: 0.05rem 0.28rem; min-width: 15px; text-align: center;
}

/* À faire maintenant — topbar widget */
.todo-topbar-btn {
  background: none; border: none; color: var(--accent, #f59e0b); font-size: 0.9rem;
  cursor: pointer; position: relative; padding: 0.3rem 0.6rem;
  border-radius: 6px; transition: background 0.15s;
  display: flex; align-items: center; gap: 0.3rem; font-weight: 700;
}
.todo-topbar-btn:hover { background: #fffbef; }
.todo-topbar-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.01em; }
@media (max-width: 768px) { .todo-topbar-label { display: none; } }
.todo-topbar-badge {
  background: var(--accent, #f59e0b); color: #fff;
  border-radius: 10px; font-size: 0.6rem; font-weight: 800;
  padding: 0.05rem 0.3rem; min-width: 15px; text-align: center;
}
.todo-topbar-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card-bg, #fff); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  min-width: 280px; max-width: 340px; z-index: 9000;
}
.todo-panel-header {
  padding: 0.55rem 1rem; font-size: 0.82rem; font-weight: 700;
  border-bottom: 1px solid var(--border); color: #856404; background: #fffbef;
  border-radius: 10px 10px 0 0;
}
.todo-panel-list { list-style: none; margin: 0; padding: 0; }
.todo-panel-list li { border-bottom: 1px solid var(--border); }
.todo-panel-list li:last-child { border-bottom: none; }
.todo-panel-list a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; font-size: 0.82rem; color: var(--text-dark);
  text-decoration: none; transition: background 0.13s;
}
.todo-panel-list a:hover { background: var(--sidebar-hover, #f1f5f9); }
.todo-panel-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.todo-panel-dot.review    { background: #f59e0b; }
.todo-panel-dot.contribute { background: var(--primary); }
.todo-panel-dot.workflow  { background: #8b5cf6; }

.topbar-user {
  display: flex; align-items: center; gap: 0.4rem;
  text-decoration: none; color: var(--text);
  font-size: 0.82rem; font-weight: 600;
  padding: 0.25rem 0.5rem; border-radius: 6px;
  transition: background 0.15s;
}
.topbar-user:hover { background: var(--bg); }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8rem; flex-shrink: 0;
}
.topbar-username { color: var(--text-dark); }
.topbar-logout {
  display: flex; align-items: center;
  background: none; border: 1.5px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 1rem;
  padding: 0.28rem 0.55rem; border-radius: 6px; text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s; line-height: 1;
}
.topbar-logout:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* ── NOTIFICATION PANEL ───────────────────────────────────── */
.notif-panel {
  position: fixed; top: 52px; right: 1rem; width: 460px;
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 350; border: 1px solid var(--border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 70px);
}
@media (max-width: 520px) { .notif-panel { width: calc(100vw - 1rem); right: 0.5rem; } }
#notifList { overflow-y: auto; flex: 1; }

/* Filtres notifications */
.notif-filters {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.45rem;
  background: var(--bg, #f8fafc);
}
.notif-search-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.3rem 0.6rem; font-size: 0.82rem; outline: none;
  background: #fff;
}
.notif-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.notif-tab-group {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; width: fit-content;
}
.notif-tab {
  background: #fff; border: none; padding: 0.25rem 0.7rem;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  color: var(--muted); border-right: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.3rem; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.notif-tab:last-child { border-right: none; }
.notif-tab:hover { background: var(--bg); color: var(--text-dark); }
.notif-tab.active { background: var(--primary); color: #fff; }
.notif-tab-badge {
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 0.6rem; font-weight: 800;
  padding: 0 5px; min-width: 14px; text-align: center; line-height: 1.4;
}
.notif-tab.active .notif-tab-badge { background: rgba(255,255,255,0.35); }
.notif-type-select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.25rem 0.5rem; font-size: 0.8rem;
  width: 100%; background: #fff; outline: none; cursor: pointer;
}
.notif-type-select:focus { border-color: var(--primary); }
.notif-panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 0.9rem;
  background: var(--primary); color: white;
}
.notif-panel-header .btn-link { color: rgba(255,255,255,0.85); }
.notif-panel-header .btn-link:hover { color: white; }
.notif-item {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.65rem 1rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: background 0.15s;
}
.notif-item:hover { background: var(--bg); }
.notif-item-unread { background: var(--primary-weak); border-left: 3px solid var(--primary); }
.notif-item-icon   { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }
.notif-item-body   { flex: 1; min-width: 0; }
.notif-item-title  { font-weight: 700; font-size: 0.84rem; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-msg    { color: var(--muted); font-size: 0.77rem; margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time   { color: var(--muted); font-size: 0.7rem; white-space: nowrap; flex-shrink: 0; margin-top: 0.15rem; }
.notif-empty       { padding: 1.5rem; text-align: center; color: var(--muted); font-size: 0.85rem; }
.notif-overlay     { position: fixed; inset: 0; z-index: 199; }

/* ── FLASH MESSAGES ───────────────────────────────────────── */
.flash-container { position: fixed; top: 62px; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; max-width: 380px; }
.flash {
  padding: 0.7rem 1.25rem 0.7rem 1rem;
  border-radius: var(--radius); font-size: 0.87rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.75rem;
  box-shadow: var(--shadow-lg); animation: slideIn 0.25s cubic-bezier(.4,0,.2,1);
  border: 1px solid transparent;
}
.flash-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.flash-danger  { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.flash-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.flash-info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.flash-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; opacity: 0.6; flex-shrink: 0; margin-left: auto; }
.flash-action-btn {
  display: inline-flex; align-items: center; gap: 0.2rem;
  background: rgba(0,0,0,0.1); border: 1px solid rgba(0,0,0,0.15); border-radius: 5px;
  padding: 0.18rem 0.55rem; font-size: 0.78rem; font-weight: 700;
  text-decoration: none; color: inherit; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s; margin-left: auto;
}
.flash-action-btn:hover { background: rgba(0,0,0,0.18); }
/* Quand l'action-btn est présent : il prend le margin-left:auto, × le suit sans gap */
.flash:has(.flash-action-btn) .flash-action-btn { margin-left: auto; }
.flash:has(.flash-action-btn) .flash-close { margin-left: 0.5rem; }
@keyframes slideIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ── LAYOUT ───────────────────────────────────────────────── */
.main-content { padding: 1.5rem 1.75rem; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-title { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); }
.page-sub   { color: var(--muted); font-size: 0.87rem; margin-top: 0.2rem; }
.breadcrumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden;
  border: 1px solid var(--edge);
}
.card-header {
  padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  background: white;
}
.card-title { font-weight: 700; font-size: 0.93rem; color: var(--text-dark); }
.card-body  { padding: 1.25rem; }
.mb-md { margin-bottom: 1rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-sm { margin-top: 0.5rem; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: none; border-radius: 8px; padding: 0.5rem 1rem;
  font-size: 0.87rem; font-weight: 600; cursor: pointer;
  will-change: transform;
  text-decoration: none; transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; white-space: nowrap;
  font-family: inherit; letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dk); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--primary) 55%, transparent); }
.btn-primary:disabled, .btn-primary[disabled] { background: color-mix(in srgb, var(--primary) 38%, #fff); color: #fff; opacity: 0.7; cursor: not-allowed; pointer-events: none; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #17a673; box-shadow: 0 0.125rem 0.25rem rgba(28,200,138,.4); }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #c0392b; box-shadow: 0 0.125rem 0.25rem rgba(231,74,59,.4); }
.btn-danger-soft { background: #fde8e8; color: #c0392b; border: 1px solid #f5c6c6; }
.btn-danger-soft:hover { background: #fbd5d5; }
.btn-ghost   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost:hover   { background: var(--bg); border-color: var(--edge); }
.btn-link    { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.82rem; text-decoration: underline; padding: 0; font-family: inherit; }
.btn-sm  { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-xs  { padding: 0.18rem 0.45rem; font-size: 0.72rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-warning { background: var(--warning); color: #6b4200; }
.btn-warning:hover { background: #e0ac00; }

/* ── TABLES ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th {
  text-align: left; padding: 0.7rem 1rem;
  background: var(--bg); border-bottom: 2px solid var(--border);
  font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 800; white-space: nowrap;
}
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

/* ── Row actions — hover reveal ──────────────────────────── */
td.actions-cell,
.row-actions { opacity: 0; pointer-events: none; transition: opacity 0.18s; white-space: nowrap; }
tr:hover td.actions-cell,
tr:hover .row-actions,
tr:focus-within td.actions-cell,
tr:focus-within .row-actions { opacity: 1; pointer-events: auto; }
@media (hover: none) { td.actions-cell, .row-actions { opacity: 1; pointer-events: auto; } }
.row-inactive td { opacity: 0.55; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.2rem 0.55rem;
  border-radius: 20px; font-size: 0.7rem; font-weight: 700;
}
.badge-ok, .badge-success { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: color-mix(in srgb, var(--success) 72%, var(--badge-mix)); }
.badge-info    { background: color-mix(in srgb, var(--info) 15%, var(--card)); color: color-mix(in srgb, var(--info) 75%, var(--badge-mix)); }
.badge-warn, .badge-orange, .badge-warning { background: color-mix(in srgb, var(--warning) 16%, var(--card)); color: color-mix(in srgb, var(--warning) 78%, var(--badge-mix)); }
.badge-danger  { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: color-mix(in srgb, var(--danger) 78%, var(--badge-mix)); }
.badge-purple  { background: color-mix(in srgb, var(--violet) 15%, var(--card)); color: color-mix(in srgb, var(--violet) 75%, var(--badge-mix)); }
.badge-blue    { background: var(--primary-weak); color: var(--primary-dk); }
.section-title-bar { font-size:0.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); padding:0.5rem 0 0.5rem; margin:1.5rem 0 0.75rem; border-bottom:1px solid var(--border); }

/* Status badges */
.status-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.status-en_attente  { background: color-mix(in srgb, var(--warning) 16%, var(--card)); color: color-mix(in srgb, var(--warning) 78%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--card)); }
.status-en_revision { background: color-mix(in srgb, var(--info) 15%, var(--card)); color: color-mix(in srgb, var(--info) 75%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--info) 32%, var(--card)); }
.status-soumis      { background: var(--primary-weak); color: var(--primary-dk); border: 1px solid var(--primary-line); }
.status-accepte     { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: color-mix(in srgb, var(--success) 72%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--success) 32%, var(--card)); }
.status-rejete      { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: color-mix(in srgb, var(--danger) 78%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--card)); }
.status-integre     { background: color-mix(in srgb, var(--violet) 15%, var(--card)); color: color-mix(in srgb, var(--violet) 75%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--violet) 32%, var(--card)); }
.status-reassigne   { background: color-mix(in srgb, var(--muted) 18%, var(--card)); color: var(--text); border: 1px solid var(--border); }
.status-actif       { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: color-mix(in srgb, var(--success) 72%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--success) 32%, var(--card)); }
.status-terminé     { background: color-mix(in srgb, var(--info) 15%, var(--card)); color: color-mix(in srgb, var(--info) 75%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--info) 32%, var(--card)); }
.status-archivé     { background: color-mix(in srgb, var(--muted) 18%, var(--card)); color: var(--text); border: 1px solid var(--border); }
.status-annule      { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: color-mix(in srgb, var(--danger) 78%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--card)); }
.status-correction  { background: color-mix(in srgb, var(--warning) 16%, var(--card)); color: color-mix(in srgb, var(--warning) 78%, var(--badge-mix)); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--card)); }

/* Priority badges */
.priority-badge { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 20px; font-size: 0.68rem; font-weight: 700; }
.priority-urgente { background: #f8d7da; color: #721c24; }
.priority-normale { background: #e2e3e5; color: #495057; }
.priority-basse   { background: #d1ecf1; color: #0c5460; }

/* Role tags */
.role-tag { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 4px; font-size: 0.68rem; font-weight: 700; text-transform: capitalize; }
.role-admin        { background: var(--violet); color: white; }
.role-decideur     { background: var(--primary); color: white; }
.role-contributeur { background: var(--info); color: white; }
.role-lecteur      { background: var(--muted); color: white; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
.form-group:last-child { margin-bottom: 0; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
label { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"],
select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.75rem;
  font-size: 0.88rem; font-family: inherit; color: var(--text-dark);
  background: white; transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
input[type="text"]:hover, input[type="password"]:hover, input[type="email"]:hover,
input[type="date"]:hover, select:hover, textarea:hover {
  border-color: var(--edge);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}
textarea { resize: vertical; min-height: 80px; }
.input-disabled { background: var(--bg); color: var(--muted); }
.input-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; border: 1px solid var(--border); border-radius: 5px; width: 200px; }
.search-input { width: 280px; }
.select-sm { width: auto; padding: 0.3rem 0.6rem; }
.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.field-hint a { color: var(--primary); }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  align-items: flex-start; justify-content: center;
  padding: 2rem 1rem; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.logo-preview-wrap { margin-bottom: .5rem; }
.logo-preview { max-height: 80px; max-width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 4px; background: white; }

.modal, .modal-box {
  background: white; border-radius: var(--radius); width: 100%; max-width: 580px;
  box-shadow: var(--shadow-lg); animation: modalIn 0.22s cubic-bezier(.4,0,.2,1);
}
.modal-box.modal-lg { max-width: 720px; }
[data-theme="dark"] .modal, [data-theme="dark"] .modal-box { background: var(--surface); }
@keyframes modalIn { from{opacity:0;transform:translateY(-16px)} to{opacity:1;transform:translateY(0)} }
.modal-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border-radius: 10px 10px 0 0;
}
.modal-header h2 { font-size: 1rem; font-weight: 800; color: var(--text-dark); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--danger); }
.modal-body   { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; background: var(--bg); border-radius: 0 0 10px 10px; }
.reassign-mode-btn { display:flex; align-items:center; gap:0.6rem; flex:1; padding:0.7rem 0.9rem; border:2px solid var(--border); border-radius:8px; cursor:pointer; transition:border-color .15s,background .15s; background:var(--bg); }
.reassign-mode-btn:hover { border-color: var(--primary); background: var(--surface2); }
.reassign-mode-btn.active { border-color: var(--primary); background: var(--primary-weak); }
[data-theme="dark"] .reassign-mode-btn.active { background: color-mix(in srgb, var(--primary) 22%, transparent); }

/* ── LIST GROUP ───────────────────────────────────────────── */
.list-group { }
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text); transition: background 0.15s; gap: 1rem;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg); }
.list-item-clickable { cursor: pointer; }
.list-item-clickable:hover { background: var(--bg); }
.list-item-unread { background: var(--primary-weak); }
.list-item-active { background: color-mix(in srgb, var(--success) 12%, var(--card)); }
.li-main  { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.li-title { font-weight: 700; font-size: 0.88rem; color: var(--text-dark); }
.li-sub   { font-size: 0.77rem; color: var(--muted); }
.li-meta  { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ── KPI GRID ─────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: white; border-radius: var(--radius); padding: 1.1rem 1.4rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  gap: 0.75rem;
}
a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cbd5e1; }
.kpi-blue   { border-top: 3px solid var(--primary); }
.kpi-green  { border-top: 3px solid var(--success); }
.kpi-orange { border-top: 3px solid var(--accent);  }
.kpi-red    { border-top: 3px solid var(--danger);  }
.kpi-cyan   { border-top: 3px solid var(--info);    }
.kpi-left   { display: flex; flex-direction: column; gap: 0.25rem; }
.kpi-icon   {
  font-size: 1.4rem;
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--bg);
}
.kpi-blue  .kpi-icon { background: var(--primary-weak); }
.kpi-green .kpi-icon { background: #f0fdf4; }
.kpi-orange .kpi-icon { background: #fffbeb; }
.kpi-red   .kpi-icon { background: #fef2f2; }
.kpi-cyan  .kpi-icon { background: #ecfeff; }
.kpi-value  { font-size: 2rem; font-weight: 800; color: var(--text-dark); line-height: 1; letter-spacing: -0.02em; }
.kpi-label  { font-size: 0.72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* Anciens KPI (rétrocompat) */
.kpi-card .kpi-icon:only-child { font-size: 1.5rem; }

/* ── DASHBOARD GRID ───────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 768px) {
  .dash-grid { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  #content-wrapper { margin-left: 0 !important; }
}

/* ── PROJECTS GRID ────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 1.25rem; }
.project-card {
  background: white; border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: transform 0.18s, box-shadow 0.18s; display: flex; flex-direction: column; gap: 0.5rem;
  border: 1px solid var(--border); border-top: 4px solid var(--primary);
}
.project-card:hover { transform: translateY(-4px); box-shadow: 0 0.6rem 2rem rgba(37,99,235,.15); }
.pc-header  { display: flex; justify-content: space-between; align-items: center; }
.pc-category{ font-size: 0.72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pc-title   { font-weight: 800; font-size: 1rem; color: var(--text-dark); }
.pc-desc    { font-size: 0.82rem; color: var(--muted); }
.pc-footer  { display: flex; gap: 0.75rem; font-size: 0.77rem; color: var(--muted); margin-top: auto; flex-wrap: wrap; }

/* ── PROJECT DETAIL LAYOUT ────────────────────────────────── */
.project-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; align-items: start; }
.project-main   { }
.project-sidebar{ }
@media (max-width: 900px) { .project-layout { grid-template-columns: 1fr; } }

/* ── EDITOR ───────────────────────────────────────────────── */
.source-tabs  { display: flex; gap: 0.5rem; }
.source-tab   {
  border: 1.5px solid var(--border); background: white; border-radius: 6px;
  padding: 0.45rem 1rem; font-size: 0.87rem; font-weight: 700; cursor: pointer; color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.source-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.upload-zone  {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 2.5rem; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-weak); }
.upload-icon  { font-size: 2.5rem; margin-bottom: 0.5rem; }
.file-name-display { background: var(--bg); border-radius: 6px; padding: 0.5rem 0.75rem; margin-top: 0.75rem; font-size: 0.85rem; }
.action-bar   { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* ── DOC PREVIEW ──────────────────────────────────────────── */
.doc-preview       { font-size: 0.92rem; line-height: 1.65; }
.doc-preview-compact { font-size: 0.82rem; line-height: 1.5; max-height: 300px; overflow-y: auto; }
.doc-preview h1,.doc-preview h2,.doc-preview h3 { margin: 0.75rem 0 0.35rem; color: var(--primary); }
.doc-preview p { margin-bottom: 0.6rem; }
.doc-preview ul,.doc-preview ol { margin: 0.5rem 0 0.5rem 1.5rem; }
.doc-preview table { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
.doc-preview td,.doc-preview th { border: 1px solid var(--border); padding: 0.4rem 0.6rem; }
.doc-preview blockquote { border-left: 3px solid var(--primary); padding: 0.4rem 1rem; color: var(--muted); background: var(--bg); margin: 0.5rem 0; }

/* ── SÉLECTEUR MODÈLE IA ──────────────────────────────────── */
.ai-model-selector { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ai-model-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem; border-radius: 20px;
  border: 1.5px solid var(--border); background: #fff;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s; color: var(--text);
}
.ai-model-btn:hover { border-color: var(--primary); color: var(--primary); }
.ai-model-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.ai-btn-icon { font-size: 0.75rem; font-weight: 700; }
.ai-btn-icon.claude { color: #cc785c; }
.ai-btn-icon.gemini { color: #4285f4; }
.ai-model-btn.active .ai-btn-icon { color: #fff; }

/* ── EXCEL VIEWER ─────────────────────────────────────────── */
.excel-viewer { padding: 1rem; }
.excel-sheet-title { font-size: 0.88rem; font-weight: 700; color: var(--primary); margin: 1rem 0 0.4rem; padding: 0.25rem 0.6rem; background: var(--bg); border-left: 3px solid var(--primary); border-radius: 0 4px 4px 0; }
.excel-table-wrap { overflow-x: auto; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 1rem; }
.excel-table { border-collapse: collapse; width: 100%; min-width: 400px; font-size: 0.83rem; }
.excel-table th { background: var(--primary); color: #fff; font-weight: 600; text-align: left; padding: 0.45rem 0.75rem; border: 1px solid rgba(255,255,255,0.15); white-space: nowrap; }
.excel-table td { padding: 0.35rem 0.75rem; border: 1px solid var(--border); }
.excel-table tr:nth-child(even) td { background: var(--bg); }
.excel-table tr:hover td { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* ── PPTX SLIDES VIEWER ───────────────────────────────────── */
.pptx-slides-viewer { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; padding: 1rem; }
.pptx-slide { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.2rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: flex; flex-direction: column; gap: 0.5rem; }
.pptx-slide-num { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pptx-slide-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0; }
.pptx-slide-body { font-size: 0.85rem; line-height: 1.5; padding-left: 1.1rem; margin: 0; color: var(--text); }
.pptx-slide-body li { margin-bottom: 0.25rem; }

/* ── AI MATRIX TABLE ─────────────────────────────────────── */
.ai-matrix-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.ai-matrix-table th { background: #f8f9fa; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 0.6rem 0.75rem; border: 1px solid #e3e6f0; line-height: 1.4; }
.ai-matrix-table td { padding: 0.55rem 0.75rem; border: 1px solid #e3e6f0; vertical-align: middle; }
.ai-matrix-table td:not(:first-child) { text-align: center; }
.ai-matrix-table input[type="radio"], .ai-matrix-table input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.ai-matrix-table tbody tr:hover:not(.ai-row-disabled) { background: #f8f9fc; }
.ai-matrix-table .ai-row-disabled { opacity: 0.42; pointer-events: none; background: #fafafa; }
.ai-model-desc { font-size: 0.75rem; color: var(--muted); margin-left: 0.4rem; }
.ai-key-missing { font-size: 0.72rem; color: #b45309; display: block; margin-top: 0.15rem; }

/* ── AI PROVIDERS / MODELS CARDS ─────────────────────────── */
.ai-prov-card { background: #fff; border: 1px solid #e3e6f0; border-radius: 8px; padding: .75rem 1rem; transition: box-shadow .15s; }
.ai-prov-card:hover { box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 18%, transparent); }
.ai-prov-disabled { opacity: .6; }
.ai-type-badge { display: inline-block; padding: .1rem .45rem; border-radius: 4px; font-size: .72rem; font-weight: 600; margin-left: .4rem; }
.ai-type-anthropic { background: #f5f0ff; color: #7c3aed; }
.ai-type-gemini { background: var(--primary-weak); color: #1d4ed8; }
.ai-type-openai_compat { background: #f0fdf4; color: #166534; }

/* ── PAGE DOC (Word) ──────────────────────────────────────── */
.doc-page-full, .doc-page-preview {
  font-family: Arial, Helvetica, sans-serif; font-size: 12pt;
  line-height: 1.7; color: #1a1a1a; background: white;
}
.doc-page-full { padding: 2.5cm 2.5cm 2.5cm 3cm; min-height: 600px; }
.doc-page-preview.compact { padding: 1rem 1.25rem; font-size: 0.82rem; }
.doc-page-full h1, .doc-page-preview h1 { font-size: 18pt; color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: 6px; margin: 0 0 16px; }
.doc-page-full h2, .doc-page-preview h2 { font-size: 14pt; color: var(--primary); margin: 20px 0 10px; }
.doc-page-full h3, .doc-page-preview h3 { font-size: 12pt; color: #2c5f9e; margin: 14px 0 7px; }
.doc-page-full p, .doc-page-preview p { margin-bottom: 10px; text-align: justify; }
.doc-page-full ul, .doc-page-preview ul, .doc-page-full ol, .doc-page-preview ol { margin: 6px 0 10px 28px; }
.doc-page-full li, .doc-page-preview li { margin-bottom: 4px; }
.doc-page-full table, .doc-page-preview table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.doc-page-full th, .doc-page-preview th { background: var(--primary); color: white; padding: 7px 12px; text-align: left; font-weight: 700; }
.doc-page-full td, .doc-page-preview td { border: 1px solid #ccc; padding: 6px 12px; }
.doc-page-full tr:nth-child(even) td, .doc-page-preview tr:nth-child(even) td { background: #f5f8fc; }
.doc-page-full blockquote, .doc-page-preview blockquote { border-left: 4px solid var(--primary); padding: 6px 16px; margin: 12px 0; color: #444; background: #f5f8fc; font-style: italic; }


/* ── NOTIFY CHOICE ────────────────────────────────────────── */
.notify-choice .card-body { padding: 0.75rem 1rem; }
.notify-label { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--dark); }
.notify-radio { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1.5rem; cursor: pointer; font-size: 0.88rem; }
.notify-radio input[type=radio] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ── CONTRIBUTE LAYOUT ────────────────────────────────────── */
.contribute-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1rem; align-items: start; }
.instructions-panel { position: sticky; top: 70px; }
.instructions-text { font-size: 0.88rem; line-height: 1.6; white-space: pre-wrap; }
.deadline-box { background: #fff3cd; border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.85rem; border-left: 4px solid var(--warning); }
@media (max-width: 900px) { .contribute-layout { grid-template-columns: 1fr; } .instructions-panel { position: static; } }

/* ── REQUEST / CONTRIB DETAIL ─────────────────────────────── */
.request-layout { display: grid; grid-template-columns: 1fr 400px; gap: 1.25rem; align-items: start; }
.contrib-detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .request-layout,.contrib-detail-layout { grid-template-columns: 1fr; } }

.contrib-item { border-bottom: 1px solid var(--border); padding: 1.25rem; }
.contrib-item:last-child { border-bottom: none; }
.contrib-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.contrib-preview { background: var(--bg); border-radius: 6px; padding: 0.75rem; font-size: 0.85rem; max-height: 200px; overflow-y: auto; }
.contrib-actions { display: flex; gap: 0.75rem; margin-top: 0.75rem; align-items: center; flex-wrap: wrap; }
.review-comment { background: #fff3cd; border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.83rem; margin-top: 0.5rem; border-left: 3px solid var(--warning); }
.contrib-selector { cursor: pointer; }
.contrib-selector input[type=checkbox] { margin-right: 0.5rem; }

/* ── COMMENTS ─────────────────────────────────────────────── */
.comments-list { padding: 0 1.25rem 0.5rem; }
.comment { background: var(--bg); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.comment-owner { background: var(--primary-weak); border-left: 3px solid var(--primary); }
.comment-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; font-size: 0.82rem; }
.comment-body { font-size: 0.87rem; }

/* ── INTEGRATE LAYOUT ─────────────────────────────────────── */
.integrate-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .integrate-layout { grid-template-columns: 1fr; } }

.ai-chat-history { max-height: 250px; overflow-y: auto; margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-msg  { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-assistant { justify-content: flex-start; }
.chat-error { justify-content: center; }
.chat-bubble { max-width: 85%; padding: 0.5rem 0.85rem; border-radius: 10px; font-size: 0.85rem; line-height: 1.5; }
.chat-user .chat-bubble { background: var(--primary); color: white; border-radius: 10px 10px 2px 10px; }
.chat-assistant .chat-bubble { background: var(--bg); border: 1px solid var(--border); border-radius: 10px 10px 10px 2px; }
.chat-error .chat-bubble { background: #f8d7da; color: #721c24; border-radius: 8px; }

.ai-prompt-area { display: flex; flex-direction: column; gap: 0.5rem; }
.ai-prompt-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.ai-loading-card { }
.spinner {
  width: 36px; height: 36px; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ADMIN ────────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.admin-tab {
  background: none; border: none; padding: 0.7rem 1.25rem;
  font-size: 0.88rem; font-weight: 700; cursor: pointer; font-family: inherit;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-tab:hover { color: var(--text-dark); }

.settings-section { margin-bottom: 1.75rem; }
.settings-title { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.provider-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.provider-card {
  flex: 1; min-width: 200px; border: 2px solid var(--border); border-radius: 8px;
  padding: 1rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.3rem;
  transition: border-color 0.15s, background 0.15s;
}
.provider-card.selected { border-color: var(--primary); background: var(--primary-weak); }
.provider-card input { display: none; }
.provider-logo { font-size: 1.5rem; }
.provider-name { font-weight: 800; }
.provider-desc { font-size: 0.78rem; color: var(--muted); }
.api-key-wrap  { display: flex; gap: 0.5rem; }
.api-key-wrap input { flex: 1; }
.hidden { display: none; }

/* ── INFO LIST ────────────────────────────────────────────── */
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; font-size: 0.85rem; }
.info-list dt { font-weight: 700; color: var(--muted); white-space: nowrap; }

/* ── LOGIN ────────────────────────────────────────────────── */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, #000) 100%); }
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-box { background: white; border-radius: 12px; padding: 2.5rem; box-shadow: 0 1rem 3rem rgba(0,0,0,0.3); }
.login-logo  { text-align: center; margin-bottom: 0.75rem; }
.login-logo-img { width: 140px; height: auto; margin: 0 auto; display: block; }
.login-title { font-size: 1.5rem; font-weight: 800; text-align: center; color: var(--primary); margin-bottom: 0.25rem; }
.login-sub   { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 1.75rem; }
.login-form  { display: flex; flex-direction: column; gap: 1rem; }
.login-footer { text-align: center; color: var(--muted); font-size: 0.77rem; margin-top: 1.25rem; }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert { border-radius: 7px; padding: 0.75rem 1rem; font-size: 0.87rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center; color: var(--muted); padding: 2.5rem 1.5rem; font-size: 0.87rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
}
.empty-state-icon { font-size: 2.2rem; opacity: 0.5; line-height: 1; margin-bottom: 0.25rem; }
.empty-state-title { font-weight: 700; color: var(--text-dark); font-size: 0.92rem; }
.empty-state-sub { color: var(--muted); font-size: 0.82rem; max-width: 34ch; }
.empty-state-box { border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--bg); }
.empty-state-full { grid-column: 1/-1; text-align: center; padding: 3.5rem 2rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

/* ── MISC ─────────────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.flex-row   { display: flex; align-items: center; }
.flex-col   { display: flex; flex-direction: column; }
.gap-sm     { gap: 0.4rem; }
.gap-md     { gap: 0.75rem; }
.tag        { background: var(--primary-weak); color: var(--primary-dk); border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 0.7rem; font-weight: 700; display: inline-block; }
.deadline   { color: var(--warning); font-size: 0.8rem; font-weight: 700; }
.deadline-late { color: var(--danger); }
.link-primary { color: var(--primary); text-decoration: none; font-weight: 700; }
.link-primary:hover { text-decoration: underline; }

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .flash-container, .btn, .action-bar, .notif-panel { display: none !important; }
  #content-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .print-area { font-size: 11pt; }
}

/* ── SEARCH GLOBALE ───────────────────────────────────────── */
.nav-search-wrap { position: relative; flex: 1; min-width: 0; max-width: 400px; }
.nav-search-icon {
  position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--muted); fill: none;
  pointer-events: none; flex-shrink: 0;
}
.nav-search-input {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px;
  color: var(--text-dark); padding: 0.42rem 2.4rem 0.42rem 2rem; font-size: 0.83rem;
  width: 100%; outline: none; transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.nav-search-input::placeholder { color: var(--muted); }
.nav-search-input:focus {
  border-color: var(--primary); background: white;
  box-shadow: 0 0 0 3px var(--primary-weak);
}
.nav-search-kbd {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: #fff; border: 1px solid var(--border); border-radius: 4px;
  padding: 0.08rem 0.32rem; font-size: 0.68rem; font-weight: 700;
  color: var(--muted); pointer-events: none; font-family: inherit; line-height: 1.5;
  transition: opacity 0.15s;
}
.nav-search-input:focus ~ .nav-search-kbd { opacity: 0; }
[data-theme="dark"] .nav-search-kbd { background: var(--input-bg); border-color: var(--border); }
.nav-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: white; border-radius: 8px; box-shadow: var(--shadow); z-index: 500; overflow: hidden; display: none; min-width: 300px; border: 1px solid var(--border); }
.nav-search-results.show { display: block; }
.search-result-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.9rem; cursor: pointer; text-decoration: none; color: var(--text); font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg); }
.search-result-icon { font-size: 1rem; flex-shrink: 0; }
.search-result-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.search-result-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-type-badge { font-size: 0.67rem; border-radius: 4px; padding: 1px 6px; flex-shrink: 0; margin-left: auto; color: white; }
.badge-type-flux { background: var(--primary); }
.badge-type-demande { background: #1cc88a; }
.badge-type-utilisateur { background: #f6c23e; color: #333 !important; }
.search-no-result { padding: 0.75rem 1rem; color: var(--muted); font-size: 0.83rem; }

/* ── DEADLINE ALERTS ──────────────────────────────────────── */
@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}
.deadline-alert-box {
  background: #fff5f5; border: 1px solid #f5c6cb;
  border-left: 4px solid var(--danger);
  border-radius: 8px; margin-bottom: 1.25rem; overflow: hidden;
}
.deadline-alert-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 1rem; background: var(--danger); color: #fff; font-size: 0.88rem;
}
.deadline-bell { animation: blink-red 1.2s ease-in-out infinite; font-size: 1.1rem; }
.deadline-alert-list { list-style: none; padding: 0; margin: 0; }
.deadline-alert-item {
  border-bottom: 1px solid #fde8e8; display: flex; align-items: center; padding-right: 0.5rem;
}
.deadline-alert-item:last-child { border-bottom: none; }
.deadline-alert-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem; text-decoration: none; color: var(--text);
  transition: background 0.15s; flex: 1;
}
.deadline-alert-link:hover { background: #fde8e8; }
.deadline-icon { font-size: 1.05rem; flex-shrink: 0; }
.deadline-info { display: flex; flex-direction: column; gap: 0.15rem; }
.deadline-title { font-weight: 700; font-size: 0.88rem; color: var(--text-dark); }
.deadline-meta { font-size: 0.78rem; color: var(--muted); }
.deadline-badge { font-weight: 700; padding: 1px 7px; border-radius: 20px; font-size: 0.72rem; }
.deadline-badge.expired { background: #f8d7da; color: #721c24; }
.deadline-badge.soon    { background: #fff3cd; color: #856404; }
.deadline-chevron { font-size: 0.75rem; margin-left: 0.4rem; }
.dismiss-form { margin-left: auto; flex-shrink: 0; }
.dismiss-btn {
  background: none; border: none; cursor: pointer;
  color: #c0392b; font-size: 0.85rem; padding: 2px 7px;
  border-radius: 4px; opacity: 0.6; transition: opacity 0.15s, background 0.15s;
}
.dismiss-btn:hover { opacity: 1; background: #f8d7da; }

.alert-show-more-row { border-top: 1px solid #f5c6cb; }
.alert-show-more-btn {
  display: block; width: 100%; background: none; border: none;
  padding: 7px 14px; font-size: 0.82rem; font-weight: 600;
  color: #c0392b; cursor: pointer; text-align: left;
  transition: background 0.15s;
}
.alert-show-more-btn:hover { background: #fdf3f3; }

/* ── ALERT STRIP (bandeau délais dashboard) ───────────────── */
.alert-strip {
  background: #fff5f5; border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  border-radius: 8px; margin-bottom: 1.25rem; overflow: hidden;
}
.alert-strip-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; background: var(--danger); color: #fff;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  user-select: none;
}
.alert-strip-header:hover { background: #b91c1c; }

/* Icône rouge validation dans panneau notifications */
.notif-icon-validation {
  background: #fee2e2; border-radius: 50%;
  width: 1.6rem; height: 1.6rem; display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
}

/* ── PENDING ACTIONS ──────────────────────────────────────── */
.pending-list { list-style: none; padding: 0; margin: 0; }
.pending-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.pending-item:last-child { border-bottom: none; }
.pending-item a { color: var(--text); text-decoration: none; flex: 1; font-weight: 600; }
.pending-item a:hover { color: var(--primary); }
.pending-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pending-dot.review    { background: var(--warning); }
.pending-dot.contribute{ background: var(--info); }
.empty-state-sm {
  text-align: center; padding: 2rem 1.5rem; color: var(--muted); font-size: 0.85rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
}
.empty-state-sm .empty-icon { font-size: 2rem; opacity: 0.5; line-height: 1; }
.empty-state-sm .empty-title { font-weight: 700; color: var(--text-dark); font-size: 0.88rem; }

/* ── PROJECT CARD ENRICHIE ────────────────────────────────── */
.proj-card { border-left: 4px solid var(--border); }
.proj-card.status-actif   { border-left-color: var(--success); border-top-color: var(--success); }
.proj-card.status-terminé { border-left-color: var(--info);    border-top-color: var(--info); }
.proj-card.status-archivé { border-left-color: var(--muted);   border-top-color: var(--muted); }
.progress-bar-wrap { height: 6px; background: #e9ecef; border-radius: 3px; margin-top: 0.5rem; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--success); border-radius: 3px; transition: width 0.4s; }
.proj-card-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.proj-card-meta .owner-avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: white; font-size: 0.65rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ── VERSION TIMELINE ─────────────────────────────────────── */
.version-timeline { list-style: none; padding: 0; margin: 0; position: relative; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.version-timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.version-tl-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.45rem 0; position: relative; }
.version-tl-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--border); border: 2px solid white; box-shadow: 0 0 0 2px var(--border); flex-shrink: 0; margin-top: 2px; z-index: 1; position: relative; }
.version-tl-dot.current { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.version-tl-body { flex: 1; }
.version-tl-link { font-size: 0.82rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.version-tl-link:hover { text-decoration: underline; }
.version-tl-meta { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.version-search-wrap { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); }
.version-search-input { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ── UPLOAD PROGRESS ──────────────────────────────────────── */
.upload-progress-wrap { display: none; align-items: center; gap: 0.6rem; padding: 0.5rem 0; }
.upload-progress-wrap.show { display: flex; }
.upload-spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── WORD COUNTER ─────────────────────────────────────────── */
.word-counter { font-size: 0.75rem; color: var(--muted); text-align: right; padding: 0.2rem 0.5rem; }

/* ── AUTO-SAVE ────────────────────────────────────────────── */
.autosave-indicator { font-size: 0.75rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.autosave-indicator.saved { color: var(--success); }

/* ── SIDE-BY-SIDE INTEGRATE ───────────────────────────────── */
.compare-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.compare-pane-title { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }

/* ── CONTRIBUTION INTÉGRÉE ────────────────────────────────── */
.contrib-integrated { opacity: 0.5; pointer-events: none; }
.integrated-badge { font-size: 0.7rem; background: #d4edda; color: #155724; border-radius: 4px; padding: 1px 6px; }

/* ── FILTRES CONTRIBUTIONS ────────────────────────────────── */
.contrib-filter-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.contrib-filter-btn { padding: 0.28rem 0.75rem; font-size: 0.78rem; border: 1px solid var(--border); border-radius: 20px; background: white; cursor: pointer; color: var(--muted); transition: background 0.15s, color 0.15s, border-color 0.15s; font-family: inherit; font-weight: 600; }
.contrib-filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── PROMPT HISTORY ───────────────────────────────────────── */
.prompt-history-wrap { position: relative; }
.prompt-history-btn { font-size: 0.75rem; color: var(--muted); cursor: pointer; padding: 0.1rem 0.4rem; border: 1px solid var(--border); border-radius: 4px; background: white; font-family: inherit; }
.prompt-history-btn:hover { color: var(--primary); }
.prompt-history-dropdown { position: absolute; bottom: 100%; left: 0; right: 0; background: white; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 100; display: none; max-height: 220px; overflow-y: auto; }
.prompt-history-dropdown.show { display: block; }
.prompt-history-item { padding: 0.5rem 0.8rem; font-size: 0.8rem; cursor: pointer; border-bottom: 1px solid var(--border); color: var(--text); }
.prompt-history-item:last-child { border-bottom: none; }
.prompt-history-item:hover { background: var(--bg); color: var(--primary); }

/* ── AUDIT LOG ────────────────────────────────────────────── */
.audit-table { font-size: 0.82rem; }
.audit-action-badge { font-size: 0.7rem; padding: 2px 7px; border-radius: 4px; background: var(--primary-weak); color: var(--primary); font-weight: 700; }

/* ── ADMIN CHARTS ─────────────────────────────────────────── */
.chart-wrap { position: relative; height: 200px; }

/* ── RESPONSIVE MOBILE ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar : cachée par défaut, slide depuis gauche */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease, width 0.25s ease;
    width: var(--sidebar-w) !important;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Overlay pour fermer la sidebar */
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 199;
  }
  .sidebar-overlay.active { display: block; }

  /* Contenu principal : pleine largeur */
  .main-wrapper { margin-left: 0 !important; }

  /* Topbar : réduire */
  .topbar { padding: 0 0.75rem; gap: 0.4rem; }
  .nav-search-wrap { flex: 1; max-width: 200px; }
  .nav-search-input { width: 100% !important; font-size: 0.78rem; }
  .topbar-divider { display: none; }
  .topbar-user span:not(.topbar-avatar) { display: none; }

  /* Tables : scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* Cards et grids */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .kpi-card { padding: 0.75rem; }
  .kpi-value { font-size: 1.5rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .admin-tabs { flex-wrap: wrap; gap: 0.3rem; }
  .admin-tab { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

  /* Modals : plein écran sur mobile */
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Page headers */
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  /* Formulaires */
  .form-row { flex-direction: column; }

  /* Boutons */
  .btn { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.1rem; }
  .card-header { flex-wrap: wrap; gap: 0.3rem; }
  .nav-search-wrap { max-width: 140px; }
}

/* ── PAGINATION ─────────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 0.6rem; border-radius: 6px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 0.82rem; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.pager-btn:hover { background: var(--bg); }
.pager-btn.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }
.pager-btn.disabled { opacity: 0.4; pointer-events: none; }
.pager-info { font-size: 0.78rem; color: var(--muted); margin: 0 0.5rem; }

/* ── PAGE AIDE ───────────────────────────────────────────── */
.help-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.help-tab { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 0.35rem 0.9rem; font-size: 0.82rem; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.help-tab:hover { border-color: var(--primary); color: var(--primary); }
.help-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 768px) { .help-grid { grid-template-columns: 1fr; } }
.help-card .card-body { padding: 0.9rem 1rem; }
.help-list { padding-left: 1.2rem; margin: 0.5rem 0 0; font-size: 0.85rem; line-height: 1.8; }
.help-steps { padding-left: 1.2rem; margin: 0.5rem 0 0; font-size: 0.85rem; line-height: 1.9; }
.help-flow { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.75rem; font-size: 0.8rem; }
.hf-step { background: var(--primary-weak); color: var(--primary); padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 600; }
.help-shortcuts { display: flex; flex-direction: column; gap: 0.6rem; }
.shortcut-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; }
kbd { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 0.78rem; font-family: monospace; }
.faq-list { display: flex; flex-direction: column; gap: 0.5rem; }
.faq-item { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.faq-q { cursor: pointer; padding: 0.75rem 1rem; font-weight: 600; font-size: 0.88rem; list-style: none; background: var(--bg); }
.faq-q:hover { background: #f0f4ff; }
.faq-a { padding: 0.75rem 1rem; font-size: 0.85rem; border-top: 1px solid var(--border); line-height: 1.6; }

/* ── DEMO BANNER ─────────────────────────────────────────── */
.demo-banner {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 0.75rem;
  background: linear-gradient(90deg, #1a1a2e 0%, #16213e 100%);
  color: #e2e8f0; padding: 0.55rem 1.25rem;
  font-size: 0.82rem; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.demo-badge {
  background: #f59e0b; color: #1a1a2e;
  font-weight: 800; font-size: 0.72rem; letter-spacing: 0.07em;
  padding: 0.15rem 0.55rem; border-radius: 4px; flex-shrink: 0;
}
.demo-text { flex: 1; min-width: 160px; opacity: 0.85; }
.demo-countdown { color: #93c5fd; font-size: 0.8rem; white-space: nowrap; }
.demo-countdown strong { color: #60a5fa; }
.demo-reset-btn {
  background: rgba(255,255,255,0.12); color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 5px;
  padding: 0.2rem 0.65rem; font-size: 0.78rem; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.demo-reset-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }
.demo-close {
  background: none; border: none; color: #94a3b8;
  font-size: 1rem; cursor: pointer; padding: 0 0.25rem;
  line-height: 1; margin-left: auto; flex-shrink: 0;
}
.demo-close:hover { color: #fff; }
.demo-guide-btn {
  background: rgba(165,180,252,0.15); color: #a5b4fc;
  border: 1px solid rgba(165,180,252,0.3); border-radius: 5px;
  padding: 0.18rem 0.6rem; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.demo-guide-btn:hover { background: rgba(165,180,252,0.28); color: #c7d2fe; }

.demo-guide-wrap { position: relative; }

@keyframes guideDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#demoGuidePanel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 340px;
  max-width: 460px;
  background: #1a2340;
  border: 1px solid #2d3a5c;
  border-radius: 10px;
  padding: 1rem 1.2rem 0.9rem;
  box-shadow: 0 10px 36px rgba(0,0,0,0.5);
  z-index: 1200;
  color: #e8eaf6;
  font-size: 0.83rem;
}
#demoGuidePanel.open { display: block; animation: guideDropIn 0.18s ease; }
#demoGuidePanel::before {
  content: '';
  position: absolute;
  top: -6px; right: 18px;
  width: 11px; height: 11px;
  background: #1a2340;
  border-left: 1px solid #2d3a5c;
  border-top: 1px solid #2d3a5c;
  transform: rotate(45deg);
}
#demoGuidePanel ol {
  margin: 0.55rem 0 0.6rem;
  padding-left: 1.3rem;
  line-height: 2.1;
}
#demoGuidePanel ol li { font-size: 0.83rem; }
#demoGuidePanel ol a { color: #93c5fd; text-decoration: none; }
#demoGuidePanel ol a:hover { color: #bfdbfe; text-decoration: underline; }
#demoGuidePanel .guide-hint {
  font-size: 0.76rem; color: #6b7280;
  border-top: 1px solid #2d3a5c;
  padding-top: 0.5rem; margin-top: 0.1rem;
}

/* ── CSS TOOLTIPS ────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%);
  background: #1e293b; color: #f1f5f9;
  font-size: 0.75rem; line-height: 1.4; font-weight: 400;
  padding: 0.4rem 0.7rem; border-radius: 6px;
  white-space: nowrap; max-width: 220px; white-space: normal; text-align: center;
  pointer-events: none; z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-tooltip]:hover::after { opacity: 1; visibility: visible; }
[data-tooltip-pos="right"]::after {
  left: calc(100% + 8px); bottom: auto; top: 50%;
  transform: translateY(-50%);
}
[data-tooltip-pos="bottom"]::after {
  bottom: auto; top: calc(100% + 7px);
}

/* ── SCROLLBARS UNIFORMES ────────────────────────────────────────────────── */
.modal-body::-webkit-scrollbar,
.ai-chat-history::-webkit-scrollbar,
.contrib-preview::-webkit-scrollbar,
#notifList::-webkit-scrollbar,
.version-timeline::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.prompt-history-dropdown::-webkit-scrollbar { width: 4px; }

.modal-body::-webkit-scrollbar-track,
.ai-chat-history::-webkit-scrollbar-track,
.contrib-preview::-webkit-scrollbar-track,
#notifList::-webkit-scrollbar-track,
.version-timeline::-webkit-scrollbar-track,
.prompt-history-dropdown::-webkit-scrollbar-track { background: transparent; }

.modal-body::-webkit-scrollbar-thumb,
.ai-chat-history::-webkit-scrollbar-thumb,
.contrib-preview::-webkit-scrollbar-thumb,
#notifList::-webkit-scrollbar-thumb,
.version-timeline::-webkit-scrollbar-thumb,
.prompt-history-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18); border-radius: 2px;
}
.modal-body::-webkit-scrollbar-thumb:hover,
#notifList::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.32); }

/* ── TOAST EXIT ANIMATION ────────────────────────────────────────────────── */
@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); max-height: 80px; margin-bottom: 0.5rem; }
  to   { opacity: 0; transform: translateX(24px); max-height: 0;   margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}
.flash-hide {
  animation: slideOut 0.28s cubic-bezier(.4,0,.2,1) forwards;
  pointer-events: none;
  overflow: hidden;
}

/* ── REFONTE — Typographie (étape 5) ─────────────────────────
   Hanken Grotesk = UI (body) · IBM Plex Mono = données · Fraunces = titres */
.mono,
.li-date, .notif-dash-date, .notif-d,
.kpi-tile-num, .kpi-num,
.li-meta .badge.mono {
  font-family: var(--ff-mono);
  font-feature-settings: "tnum" 1;
}
.page-title, .dash-hero-left h1, .page-header h1 {
  font-family: var(--ff-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
