/* ============================================================
   KOST GROUP — BACK-OFFICE FINANCIER v4.0
   Design System Premium — Navy / Orange / Light Gray
   ============================================================ */

/* ─── GOOGLE FONTS ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS VARIABLES ────────────────────────────────────────── */
:root {
  /* Primary Palette - Navy */
  --navy:          #0f1c3f;
  --navy-dark:     #080f22;
  --navy-mid:      #162040;
  --navy-light:    #1e2d5a;
  --navy-subtle:   #243468;

  /* Accent - Orange */
  --orange:        #f97316;
  --orange-dark:   #ea6300;
  --orange-light:  #fb923c;
  --orange-bg:     #fff7ed;
  --orange-subtle: #ffedd5;

  /* Neutrals */
  --white:         #ffffff;
  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-400:      #94a3b8;
  --gray-500:      #64748b;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1e293b;
  --gray-900:      #0f172a;

  /* Semantic Colors */
  --success:       #10b981;
  --success-bg:    #d1fae5;
  --success-dark:  #059669;
  --danger:        #ef4444;
  --danger-bg:     #fee2e2;
  --danger-dark:   #dc2626;
  --warning:       #f59e0b;
  --warning-bg:    #fef3c7;
  --warning-dark:  #d97706;
  --info:          #3b82f6;
  --info-bg:       #dbeafe;
  --info-dark:     #2563eb;
  --purple:        #8b5cf6;
  --purple-bg:     #ede9fe;

  /* Layout */
  --sidebar-w:     260px;
  --sidebar-collapsed: 72px;
  --topbar-h:      64px;

  /* Typography */
  --font:          'Inter', system-ui, -apple-system, sans-serif;

  /* Borders & Radii */
  --radius-xs:     4px;
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     24px;
  --border:        #e2e8f0;
  --border-navy:   rgba(255,255,255,0.08);

  /* Shadows */
  --shadow-xs:     0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-md:     0 8px 24px rgba(0,0,0,.1);
  --shadow-lg:     0 16px 48px rgba(0,0,0,.14);
  --shadow-navy:   0 4px 24px rgba(15,28,63,.3);

  /* Transitions */
  --transition:    all .2s ease;
  --transition-slow: all .35s ease;
}

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ─── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-screen.hidden { display: none; }

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .4s ease;
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 32px;
}
.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--white);
  box-shadow: var(--shadow-navy);
}
.login-logo h1 {
  font-size: 1.5rem; font-weight: 800;
  color: var(--navy); letter-spacing: -.5px;
}
.login-logo p {
  font-size: .82rem; color: var(--gray-500);
  margin-top: -8px; letter-spacing: .03em;
}

.login-divider {
  text-align: center; font-size: .8rem;
  color: var(--gray-400); margin: 20px 0;
  position: relative;
}
.login-divider::before, .login-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 38%; height: 1px; background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: .84rem; font-weight: 600;
  color: var(--gray-700); margin-bottom: 8px;
}
.input-wrap { position: relative; }
.input-wrap i.input-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); color: var(--gray-400);
  font-size: .9rem; pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--gray-900);
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}
.input-wrap input:focus {
  border-color: var(--navy); background: var(--white);
  box-shadow: 0 0 0 3px rgba(15,28,63,.08);
}
.input-wrap .toggle-pass {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); color: var(--gray-400);
  background: none; border: none; font-size: .9rem;
  transition: var(--transition);
}
.input-wrap .toggle-pass:hover { color: var(--gray-600); }

.login-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white); border: none;
  border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
  letter-spacing: .02em;
  transition: var(--transition);
  box-shadow: var(--shadow-navy);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.login-btn:hover {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.login-btn:active { transform: translateY(0); }
.login-btn .spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%; animation: spin .7s linear infinite;
}

.login-error {
  background: var(--danger-bg); color: var(--danger-dark);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 500;
  display: none; align-items: center; gap: 8px;
  margin-bottom: 16px; border-left: 3px solid var(--danger);
}
.login-error.show { display: flex; }

@keyframes shake {
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-8px)}
  40%{transform:translateX(8px)}
  60%{transform:translateX(-5px)}
  80%{transform:translateX(5px)}
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: var(--transition-slow);
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-navy);
  gap: 12px; flex-shrink: 0;
}
.sidebar-logo {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: var(--white);
  box-shadow: 0 4px 12px rgba(249,115,22,.4);
}
.sidebar-logo-text {
  overflow: hidden;
  transition: var(--transition-slow);
}
.sidebar-logo-text h2 {
  font-size: .95rem; font-weight: 800;
  color: var(--white); white-space: nowrap;
  letter-spacing: -.3px;
}
.sidebar-logo-text span {
  font-size: .7rem; color: var(--gray-400);
  white-space: nowrap; letter-spacing: .05em;
}
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
  position: absolute; right: -12px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; color: var(--gray-600);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 10;
  display: none; /* shown only in desktop */
}

.nav-section-label {
  padding: 20px 18px 6px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--gray-500);
  white-space: nowrap; overflow: hidden;
  transition: var(--transition-slow);
}
.sidebar.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; }

.nav-menu {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 0 16px;
}
.nav-item {
  display: flex; align-items: center;
  padding: 11px 18px; gap: 12px;
  color: rgba(255,255,255,.6);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  border-left: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--white); border-left-color: var(--orange);
}
.nav-item.active {
  background: rgba(249,115,22,.15);
  color: var(--white); border-left-color: var(--orange);
}
.nav-item i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item span { overflow: hidden; transition: var(--transition-slow); }
.sidebar.collapsed .nav-item span { opacity: 0; width: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px; border-left: none; }
.sidebar.collapsed .nav-item.active { border-radius: var(--radius-sm); margin: 2px 8px; }

.nav-badge {
  margin-left: auto; background: var(--danger);
  color: var(--white); font-size: .65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 99px; flex-shrink: 0;
  transition: var(--transition-slow);
}
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border-navy);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05);
  margin-bottom: 10px;
}
.sidebar-avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--white);
}
.sidebar-user-info { overflow: hidden; transition: var(--transition-slow); }
.sidebar-user-name {
  font-size: .875rem; font-weight: 600; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .72rem; color: var(--gray-400); white-space: nowrap;
}
.sidebar.collapsed .sidebar-user-info { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; }

.btn-logout {
  width: 100%; padding: 9px;
  background: rgba(239,68,68,.12); color: var(--danger);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
  white-space: nowrap; overflow: hidden;
}
.btn-logout:hover { background: rgba(239,68,68,.2); }
.sidebar.collapsed .btn-logout span { display: none; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: var(--transition-slow);
  min-width: 0;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ─── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.menu-btn {
  display: none; background: none; border: none;
  color: var(--gray-600); font-size: 1.1rem; padding: 6px;
  border-radius: var(--radius-xs); transition: var(--transition);
}
.menu-btn:hover { background: var(--gray-100); color: var(--gray-900); }

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: .88rem; color: var(--gray-500);
}
.breadcrumb-current { font-weight: 600; color: var(--gray-900); }

.topbar-right {
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.topbar-date {
  font-size: .8rem; color: var(--gray-500);
  background: var(--gray-100); padding: 6px 12px;
  border-radius: var(--radius-sm);
}
.role-chip {
  padding: 5px 12px; border-radius: 99px;
  font-size: .75rem; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
}
.role-chip.super_admin, .role-chip.admin, .role-chip.dg {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white);
}
.role-chip.cashier, .role-chip.accountant {
  background: var(--info-bg); color: var(--info-dark);
}
.role-chip.manager, .role-chip.sales {
  background: var(--orange-subtle); color: var(--orange-dark);
}
.role-chip.read_only {
  background: var(--gray-100); color: var(--gray-500);
}

.conn-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.conn-badge.online { background: var(--success-bg); color: var(--success-dark); }
.conn-badge.offline { background: var(--warning-bg); color: var(--warning-dark); }
.conn-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ─── PAGE CONTAINER ────────────────────────────────────────── */
.page-container {
  flex: 1; padding: 28px 28px 40px;
  overflow-y: auto; min-width: 0;
}

/* ─── PAGES ─────────────────────────────────────────────────── */
.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }

/* Page IA : flex au lieu de block quand active */
#page-agent-ia.active { display: flex !important; }

/* Page IA = sort du flux normal pour occuper tout l'espace dispo */
#page-agent-ia.active {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex !important;
  flex-direction: column;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 28px;
}
.page-title h2 {
  font-size: 1.4rem; font-weight: 800; color: var(--navy);
  letter-spacing: -.5px;
}
.page-title p {
  font-size: .82rem; color: var(--gray-500); margin-top: 4px;
}
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  border: 1.5px solid transparent;
  transition: var(--transition); cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--navy); color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--navy-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-orange {
  background: var(--orange); color: var(--white);
  box-shadow: 0 2px 8px rgba(249,115,22,.3);
}
.btn-orange:hover { background: var(--orange-dark); transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--gray-700);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-success {
  background: var(--success); color: var(--white);
}
.btn-success:hover { background: var(--success-dark); }
.btn-danger {
  background: var(--danger-bg); color: var(--danger-dark);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-xs { padding: 4px 10px; font-size: .75rem; border-radius: var(--radius-xs); }
.btn-icon {
  padding: 8px; border-radius: var(--radius-sm);
  background: transparent; border-color: var(--border);
}
.btn-icon:hover { background: var(--gray-100); }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  right: 0; height: 3px;
  background: linear-gradient(90deg, var(--kpi-color, var(--navy)), transparent);
}
.kpi-card.kpi-navy { --kpi-color: var(--navy); }
.kpi-card.kpi-orange { --kpi-color: var(--orange); }
.kpi-card.kpi-success { --kpi-color: var(--success); }
.kpi-card.kpi-danger { --kpi-color: var(--danger); }
.kpi-card.kpi-info { --kpi-color: var(--info); }
.kpi-card.kpi-purple { --kpi-color: var(--purple); }
.kpi-card.kpi-warning { --kpi-color: var(--warning); }

.kpi-header { display: flex; align-items: center; justify-content: space-between; }
.kpi-label {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-500);
}
.kpi-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.kpi-navy .kpi-icon { background: rgba(15,28,63,.08); color: var(--navy); }
.kpi-orange .kpi-icon { background: var(--orange-subtle); color: var(--orange); }
.kpi-success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-danger .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.kpi-info .kpi-icon { background: var(--info-bg); color: var(--info); }
.kpi-purple .kpi-icon { background: var(--purple-bg); color: var(--purple); }
.kpi-warning .kpi-icon { background: var(--warning-bg); color: var(--warning); }

.kpi-value {
  font-size: 1.7rem; font-weight: 800; color: var(--gray-900);
  letter-spacing: -.5px; line-height: 1;
}
.kpi-sub {
  font-size: .78rem; color: var(--gray-500);
  display: flex; align-items: center; gap: 6px;
}
.kpi-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .75rem; font-weight: 600; padding: 2px 7px;
  border-radius: 99px;
}
.kpi-trend.up { background: var(--success-bg); color: var(--success-dark); }
.kpi-trend.down { background: var(--danger-bg); color: var(--danger-dark); }

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 20px; margin-bottom: 28px;
}
.chart-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.chart-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.chart-card-title {
  font-size: .9rem; font-weight: 700; color: var(--gray-900);
}
.chart-card-sub {
  font-size: .78rem; color: var(--gray-400); margin-top: 2px;
}
.chart-wrap { position: relative; height: 260px; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title {
  font-size: .9rem; font-weight: 700; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 24px; }
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label {
  font-size: .78rem; font-weight: 600; color: var(--gray-500);
  white-space: nowrap;
}

.search-box {
  position: relative; flex: 1; max-width: 320px; min-width: 180px;
}
.search-box i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: var(--gray-400); font-size: .85rem;
}
.search-box input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; background: var(--white); color: var(--gray-900);
  outline: none; transition: var(--transition);
}
.search-box input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,28,63,.06);
}

.select-filter {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--gray-700);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none;
  cursor: pointer; outline: none; transition: var(--transition);
}
.select-filter:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,28,63,.06);
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow: hidden;
}
.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.table-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.table-toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.table-count {
  font-size: .8rem; color: var(--gray-500); font-weight: 500;
}

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead {
  background: var(--gray-50);
  position: sticky; top: 0; z-index: 2;
}
thead th {
  padding: 11px 16px;
  text-align: left; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-500); white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--gray-900); }
thead th.sorted { color: var(--navy); }
thead th i { font-size: .7rem; margin-left: 4px; opacity: .5; }
thead th.sorted i { opacity: 1; }

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody td {
  padding: 13px 16px;
  font-size: .875rem; color: var(--gray-700);
  white-space: nowrap;
}
tbody td.wrap { white-space: normal; max-width: 280px; }
tbody td strong { color: var(--gray-900); font-weight: 600; }
.table-empty {
  text-align: center; padding: 60px 20px;
  color: var(--gray-400);
}
.table-empty i { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.table-empty p { font-size: .875rem; }

/* Table Action Buttons */
.table-actions { display: flex; align-items: center; gap: 6px; }
.action-btn {
  width: 30px; height: 30px; border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; border: none; transition: var(--transition);
  cursor: pointer;
}
.action-btn.edit { background: var(--info-bg); color: var(--info-dark); }
.action-btn.edit:hover { background: var(--info); color: var(--white); }
.action-btn.delete { background: var(--danger-bg); color: var(--danger-dark); }
.action-btn.delete:hover { background: var(--danger); color: var(--white); }
.action-btn.view { background: var(--gray-100); color: var(--gray-600); }
.action-btn.view:hover { background: var(--gray-200); }
.action-btn.toggle { background: var(--warning-bg); color: var(--warning-dark); }
.action-btn.toggle:hover { background: var(--warning); color: var(--white); }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.badge-navy { background: rgba(15,28,63,.1); color: var(--navy); }
.badge-orange { background: var(--orange-subtle); color: var(--orange-dark); }
.badge-success { background: var(--success-bg); color: var(--success-dark); }
.badge-danger { background: var(--danger-bg); color: var(--danger-dark); }
.badge-warning { background: var(--warning-bg); color: var(--warning-dark); }
.badge-info { background: var(--info-bg); color: var(--info-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }

/* ── Badge & ligne Clôture verrouillée ───────────────────────── */
.badge-lock {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: .65rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: .3px;
}
.row-locked {
  background: #fffbfb !important;
  opacity: .85;
}
.row-locked td {
  color: #9ca3af;
}
.row-locked td strong,
.row-locked td .amount-pos,
.row-locked td .amount-neg,
.row-locked td .mono {
  color: #9ca3af !important;
}
.action-btn.lock {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
}

/* Activity badges */
.badge-groupe { background: rgba(15,28,63,.08); color: var(--navy); }
.badge-trip { background: var(--orange-subtle); color: var(--orange-dark); }
.badge-b2c { background: var(--info-bg); color: var(--info-dark); }
.badge-b2b { background: var(--purple-bg); color: var(--purple); }

/* Statut Clôture */
.badge-ouvert { background: var(--info-bg); color: var(--info-dark); }
.badge-cloture { background: var(--success-bg); color: var(--success-dark); }
.badge-en-cours { background: var(--warning-bg); color: var(--warning-dark); }
.badge-valide { background: var(--success-bg); color: var(--success-dark); }
.badge-rejete { background: var(--danger-bg); color: var(--danger-dark); }
.badge-attente { background: var(--gray-100); color: var(--gray-500); }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group-m { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: .82rem; font-weight: 600; color: var(--gray-700);
}
.form-label span.req { color: var(--danger); margin-left: 2px; }
.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--gray-900); background: var(--white);
  outline: none; transition: var(--transition); width: 100%;
}
.form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,28,63,.06);
}
.form-control::placeholder { color: var(--gray-400); }
.form-select {
  padding: 10px 32px 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--gray-900); background: var(--white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none;
  outline: none; transition: var(--transition); width: 100%; cursor: pointer;
}
.form-select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,28,63,.06);
}
textarea.form-control { min-height: 90px; resize: vertical; }
.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }

.form-section-title {
  grid-column: 1 / -1;
  padding-top: 8px; padding-bottom: 10px;
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--navy);
  border-bottom: 1.5px solid var(--orange-subtle);
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,28,63,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 600px;
  box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(-10px);
  transition: var(--transition);
}
.modal.modal-lg { max-width: 780px; }
.modal.modal-sm { max-width: 440px; }
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-size: 1rem; font-weight: 800; color: var(--navy);
  display: flex; align-items: center; gap: 10px;
}
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: var(--gray-100); border: none;
  color: var(--gray-500); font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Confirm Delete Modal */
.delete-modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--danger-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--danger);
  margin: 0 auto 16px;
}
.delete-modal-text {
  text-align: center; margin-bottom: 8px;
}
.delete-modal-text h3 { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.delete-modal-text p { font-size: .84rem; color: var(--gray-500); margin-top: 6px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--gray-600);
  font-size: .83rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); cursor: pointer;
}
.page-btn:hover { border-color: var(--navy); color: var(--navy); }
.page-btn.active {
  background: var(--navy); border-color: var(--navy);
  color: var(--white);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: .8rem; color: var(--gray-500); padding: 0 8px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toastContainer {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9998; display: flex; flex-direction: column;
  gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px;
  background: var(--navy); color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .85rem; max-width: 360px;
  pointer-events: all;
  animation: toastIn .3s ease;
  border-left: 4px solid rgba(255,255,255,.2);
}
.toast.toast-success { background: var(--success-dark); border-left-color: rgba(255,255,255,.3); }
.toast.toast-error { background: var(--danger-dark); border-left-color: rgba(255,255,255,.3); }
.toast.toast-warning { background: var(--warning-dark); border-left-color: rgba(255,255,255,.3); }
.toast i { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
.toast-close {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,.6); font-size: .8rem;
  cursor: pointer; flex-shrink: 0;
  transition: var(--transition);
}
.toast-close:hover { color: var(--white); }

@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ============================================================
   READONLY BANNER
   ============================================================ */
.readonly-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: none; align-items: center; gap: 10px;
  font-size: .83rem; color: var(--warning-dark); font-weight: 500;
  margin-bottom: 20px;
}
.readonly-banner.show { display: flex; }
body.role-read_only .readonly-banner { display: flex; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 190;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   USER PERMISSIONS UI
   ============================================================ */
.perms-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  flex-wrap: wrap; gap: 8px;
}
.perm-module {
  display: flex; align-items: center; gap: 8px;
  font-size: .84rem; font-weight: 600; color: var(--navy);
}
.perm-module i { font-size: .85rem; color: var(--gray-400); }
.perm-toggles { display: flex; gap: 6px; }
.perm-opt {
  padding: 4px 12px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--white);
  cursor: pointer; transition: var(--transition);
}
.perm-opt:hover { border-color: var(--gray-400); }
.perm-opt.active[data-val="aucun"] { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-600); }
.perm-opt.active[data-val="lecture"] { background: var(--info-bg); border-color: var(--info); color: var(--info-dark); }
.perm-opt.active[data-val="ecriture"] { background: var(--success-bg); border-color: var(--success); color: var(--success-dark); }

/* ============================================================
   AMOUNT DISPLAY
   ============================================================ */
.amount-pos { color: var(--success-dark); font-weight: 700; }
.amount-neg { color: var(--danger-dark); font-weight: 700; }
.amount-neutral { color: var(--gray-900); font-weight: 600; }
.mono { font-family: 'Courier New', monospace; }

/* ============================================================
   DASHBOARD SPECIFIC
   ============================================================ */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--white); border: 1px solid var(--border);
  transition: var(--transition);
}
.alert-item:hover { border-color: var(--orange); box-shadow: var(--shadow-sm); }
.alert-item-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.alert-item.critical .alert-item-icon { background: var(--danger-bg); color: var(--danger); }
.alert-item.warning .alert-item-icon { background: var(--warning-bg); color: var(--warning); }
.alert-item.info .alert-item-icon { background: var(--info-bg); color: var(--info); }
.alert-item-body { flex: 1; min-width: 0; }
.alert-item-title { font-size: .875rem; font-weight: 600; color: var(--gray-900); }
.alert-item-desc { font-size: .8rem; color: var(--gray-500); margin-top: 2px; }
.alert-item-date { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }

/* Summary mini-table in dashboard */
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td {
  padding: 9px 0; font-size: .83rem;
  border-bottom: 1px solid var(--gray-100); color: var(--gray-700);
}
.mini-table td:last-child { text-align: right; font-weight: 600; color: var(--gray-900); }
.mini-table tr:last-child td { border-bottom: none; }

/* ============================================================
   ACTIVITY TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 14px; position: relative;
  padding-bottom: 16px;
}
.timeline-item::before {
  content: ''; position: absolute;
  left: 15px; top: 28px; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--white);
}
.timeline-dot.success { border-color: var(--success); color: var(--success); }
.timeline-dot.danger { border-color: var(--danger); color: var(--danger); }
.timeline-dot.warning { border-color: var(--warning); color: var(--warning); }
.timeline-content { flex: 1; }
.timeline-text { font-size: .85rem; color: var(--gray-700); font-weight: 500; }
.timeline-meta { font-size: .75rem; color: var(--gray-400); margin-top: 2px; }

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat-box {
  background: var(--white); border-radius: var(--radius-sm);
  padding: 16px; text-align: center;
  border: 1px solid var(--border);
}
.stat-box-value { font-size: 1.35rem; font-weight: 800; color: var(--navy); }
.stat-box-label { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap {
  background: var(--gray-200); border-radius: 99px;
  height: 6px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--navy), var(--navy-light));
  transition: width .5s ease;
}
.progress-bar.orange { background: linear-gradient(90deg, var(--orange), var(--orange-light)); }
.progress-bar.success { background: linear-gradient(90deg, var(--success), var(--success-dark)); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), var(--danger-dark)); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 64px 20px;
}
.empty-state-icon {
  width: 72px; height: 72px; margin: 0 auto 20px;
  background: var(--gray-100); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--gray-400);
}
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--gray-700); }
.empty-state p { font-size: .84rem; color: var(--gray-400); margin-top: 8px; max-width: 300px; margin-inline: auto; }
.empty-state .btn { margin-top: 20px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 4px;
  background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 20px;
  width: fit-content;
}
.tab-btn {
  padding: 8px 18px; border-radius: var(--radius-xs);
  font-size: .83rem; font-weight: 600; color: var(--gray-500);
  background: transparent; border: none; cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active {
  background: var(--white); color: var(--navy);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--gray-700); }

/* ============================================================
   COLLAPSIBLE FORM PANEL
   ============================================================ */
.collapsible-panel {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 20px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.collapsible-panel.collapsed .panel-body { display: none; }
.panel-header {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
}
.collapsible-panel.collapsed .panel-header { border-bottom: none; }
.panel-title {
  font-size: .9rem; font-weight: 700; color: var(--navy);
  display: flex; align-items: center; gap: 10px;
}
.panel-toggle {
  width: 28px; height: 28px; border-radius: var(--radius-xs);
  background: var(--gray-100); display: flex; align-items: center;
  justify-content: center; font-size: .75rem; color: var(--gray-500);
  transition: var(--transition);
}
.collapsible-panel.collapsed .panel-toggle { transform: rotate(-90deg); }
.panel-body { padding: 22px; }

/* ============================================================
   JUSTIFICATIF / FILE UPLOAD
   ============================================================ */
.file-upload {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 24px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--gray-50);
}
.file-upload:hover { border-color: var(--navy); background: rgba(15,28,63,.02); }
.file-upload i { font-size: 1.8rem; color: var(--gray-400); margin-bottom: 8px; }
.file-upload p { font-size: .83rem; color: var(--gray-500); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .menu-btn { display: flex; }
  .page-container { padding: 16px; }
  .topbar { padding: 0 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .topbar-date { display: none; }
  .modal { margin: 0; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-toolbar-right { justify-content: flex-end; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.4rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.d-none { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   IMPORT MODULE — Styles complémentaires
   ============================================================ */

/* Zone de dépôt */
.import-drop-zone {
  border: 2.5px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  padding: 56px 32px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
  margin-bottom: 24px;
}
.import-drop-zone.drag-over,
.import-drop-zone:hover  {
  border-color: var(--orange);
  background: var(--orange-bg);
}
.import-drop-icon  { font-size: 3.5rem; color: var(--orange); margin-bottom: 16px; line-height: 1; }
.import-drop-title { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.import-drop-sub   { font-size: .88rem; color: var(--gray-500); margin-bottom: 12px; }
.import-formats    {
  display: flex; gap: 10px; justify-content: center; margin-top: 12px;
  font-size: .8rem; color: var(--gray-500);
}

/* Étapes wizard */
.import-steps {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.import-step {
  display: flex; align-items: center; gap: 8px;
  background: var(--gray-100); border-radius: 20px;
  padding: 7px 16px; font-size: .82rem; font-weight: 600;
  color: var(--gray-500); border: 1px solid var(--gray-200);
  transition: all .2s;
}
.import-step .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gray-300); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
}
.import-step.active {
  background: var(--orange-bg); color: var(--orange-dark);
  border-color: var(--orange);
}
.import-step.active .step-num {
  background: var(--orange);
}
.import-step.completed {
  background: #f0fdf4; color: var(--success-dark);
  border-color: var(--success);
}
.import-step.completed .step-num {
  background: var(--success);
}
.import-step-line {
  flex: 1; min-width: 20px; height: 2px;
  background: var(--gray-200); border-radius: 2px;
}

/* Mapping info */
.import-mapping-info {
  background: #eff6ff; border: 1px solid #93c5fd;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .85rem; color: #1e40af;
}

/* ============================================================
   JUSTIFICATIFS — Styles
   ============================================================ */
.justif-url-cell a {
  color: var(--navy); font-size: .8rem;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.justif-url-cell a:hover { color: var(--orange); }

/* ============================================================
   AGENT IA — Expert Financier Gemini
   ============================================================ */

/* Badge nav */
.ia-nav-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f97316, #a855f7);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

/* Statut contexte */
.ia-context-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 16px;
  font-weight: 500;
}
.ia-context-status.loading { background: #1e293b; color: #94a3b8; }
.ia-context-status.ok      { background: #064e3b; color: #34d399; }
.ia-context-status.warn    { background: #1a1000; color: #fcd34d; }

/* Layout principal */
.ia-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  height: calc(100vh - 200px);
  min-height: 500px;
}
@media (max-width: 900px) {
  .ia-layout { grid-template-columns: 1fr; height: auto; }
}

/* Sidebar gauche */
.ia-sidebar {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ia-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* KPIs rapides */
.ia-kpi-panel { display: flex; flex-direction: column; gap: 8px; }
.ia-kpi {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.ia-kpi-label { font-size: 0.75rem; color: var(--gray-400); margin-bottom: 3px; }
.ia-kpi-val   { font-size: 1rem; font-weight: 700; color: var(--navy); }
.ia-kpi-val.ia-kpi-red  { color: var(--danger); }
.ia-kpi-val.ia-kpi-warn { color: var(--warning-dark); }
.ia-kpi-val.ia-kpi-green{ color: var(--success-dark); }

/* Questions rapides */
.ia-quick-list { display: flex; flex-direction: column; gap: 6px; }
.ia-quick-btn {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.3;
}
.ia-quick-btn:hover {
  background: var(--orange-light);
  border-color: var(--orange);
  color: var(--orange);
}

/* Zone de chat */
.ia-chat-container {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.ia-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

/* Messages */
.ia-msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 85%;
  animation: fadeInUp .25s ease;
}
.ia-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ia-msg-bot  { align-self: flex-start; }

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

/* Avatars */
.ia-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ia-avatar-user { background: var(--orange); color: white; }
.ia-avatar-bot  { background: linear-gradient(135deg, #7c3aed, #a855f7); color: white; }

/* Bulles */
.ia-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 100%;
  word-break: break-word;
}
.ia-msg-user .ia-bubble {
  background: var(--orange);
  color: white;
  border-bottom-right-radius: 4px;
}
.ia-msg-bot .ia-bubble {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ia-msg-bot .ia-bubble h2,
.ia-msg-bot .ia-bubble h3,
.ia-msg-bot .ia-bubble h4 { color: var(--navy); margin: 8px 0 4px; font-size: 0.9rem; }
.ia-msg-bot .ia-bubble ul  { padding-left: 18px; margin: 6px 0; }
.ia-msg-bot .ia-bubble li  { margin-bottom: 3px; }
.ia-msg-bot .ia-bubble code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-family: monospace; font-size: 0.82rem; color: var(--orange); }
.ia-msg-bot .ia-bubble strong { color: var(--orange); }
.ia-msg-bot .ia-bubble p { margin: 4px 0; }

.ia-time {
  font-size: 0.7rem;
  color: var(--gray-400);
  margin-top: 3px;
  padding: 0 4px;
}

/* Indicateur frappe */
.ia-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}
.ia-typing span {
  width: 8px;
  height: 8px;
  background: var(--gray-300);
  border-radius: 50%;
  animation: iaBounce 1.2s infinite;
}
.ia-typing span:nth-child(2) { animation-delay: .2s; }
.ia-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes iaBounce {
  0%,60%,100% { transform: translateY(0); background: var(--gray-300); }
  30% { transform: translateY(-6px); background: #a855f7; }
}

/* Barre d'input */
.ia-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.ia-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--navy);
  background: var(--bg-light);
  outline: none;
  transition: border-color .2s;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}
.ia-input:focus { border-color: #a855f7; background: var(--white); }
.ia-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #a855f7);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: opacity .2s, transform .1s;
}
.ia-send-btn:hover   { opacity: .9; transform: scale(1.05); }
.ia-send-btn:active  { transform: scale(.95); }
.ia-send-btn:disabled{ opacity: .5; cursor: not-allowed; transform: none; }

.ia-input-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--gray-400);
  padding: 4px 16px 8px;
  background: var(--white);
}

/* Fiche impression */
@media print {
  .sidebar, .topbar, .filter-bar, .page-actions,
  .nav-menu, .sidebar-footer, .topbar, .newBtn,
  .btn, .pagination, .modal-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page { display: block !important; }
  .page:not(.active) { display: none !important; }
  body { background: white; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
}

/* ============================================================
   MODULES FINANCIERS AVANCÉS v1.0
   Échéancier · Rapprochement Bancaire · Réclamations · Dettes
   ============================================================ */

/* ─── ROW STATUTS ────────────────────────────────────────────── */
tr.row-alert td {
  background: #fffbeb !important;
  border-left: 3px solid #f59e0b;
}
tr.row-alert td:first-child {
  border-left: 3px solid #f59e0b;
}
tr.row-danger td {
  background: #fff5f5 !important;
  border-left: 3px solid #ef4444;
}

/* ─── BADGES FINANCIERS ─────────────────────────────────────── */
.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-muted {
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}

/* ─── PROGRESS BARRE MINI (dettes) ─────────────────────────── */
.progress-mini {
  width: 80px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.progress-bar-mini {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: 4px;
  transition: width .4s ease;
  min-width: 2px;
}

/* ─── RAPPRO CHECKBOX ───────────────────────────────────────── */
.rappro-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--orange);
}

/* ─── TEXT HELPERS ──────────────────────────────────────────── */
.text-right { text-align: right; }
.text-danger { color: #ef4444 !important; }
.text-success { color: #10b981 !important; }
.text-warning { color: #f59e0b !important; }
.text-muted   { color: #94a3b8 !important; }

/* ─── KPI VARIANTS ──────────────────────────────────────────── */
.kpi-card.kpi-warning {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
}
.kpi-card.kpi-warning .kpi-label,
.kpi-card.kpi-warning .kpi-sub { color: rgba(255,255,255,.85); }
.kpi-card.kpi-warning .kpi-value { color: white; }
.kpi-card.kpi-warning .kpi-icon { background: rgba(255,255,255,.2); color: white; }

/* ─── BTN-ICON VARIANTS ─────────────────────────────────────── */
.btn-icon-success {
  background: #dcfce7;
  color: #16a34a;
  border: none;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon-success:hover { background: #16a34a; color: white; }
.btn-icon-success:disabled { opacity: .4; cursor: not-allowed; }

.btn-icon-warning {
  background: #fef3c7;
  color: #d97706;
  border: none;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon-warning:hover { background: #d97706; color: white; }

/* ─── REMINDER BADGE ────────────────────────────────────────── */
#reminderBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: white;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: auto;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ─── TABLE TYPE-BADGE ──────────────────────────────────────── */
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── FORM HINT ─────────────────────────────────────────────── */
.form-hint {
  font-size: .75rem;
  color: #94a3b8;
  margin-top: 4px;
}
.req { color: #ef4444; font-size: .85rem; }

/* ============================================================
   EXPERT FINANCIER IA — PREMIUM 2026 WORKSPACE
   Version 3.0 — Enterprise-grade AI copilot
   ============================================================ */

/* ── Page root ─────────────────────────────────────────────── */
#page-agent-ia {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  overflow: hidden;
  background: #f0f4f8;
}

/* ── Top bar premium ────────────────────────────────────────── */
.ia-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #162032 100%);
  border-bottom: 1px solid rgba(248,113,22,.3);
  flex-shrink: 0;
  gap: 16px;
  flex-wrap: wrap;
}
.ia-topbar-left  { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ia-topbar-right { display: flex; align-items: center; gap: 10px; }

/* Brand badge */
.ia-brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ia-brand-orb {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 0 20px rgba(249,115,22,.4);
}
.ia-orb-ping {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0f172a;
  animation: iaPing 2s ease-in-out infinite;
}
@keyframes iaPing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: .7; }
}
.ia-brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: white;
  letter-spacing: .3px;
}
.ia-brand-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  margin-top: 1px;
}

/* Trust badges */
.ia-trust-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ia-trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.ia-trust-green  { background: rgba(34,197,94,.15);  color: #86efac;  border: 1px solid rgba(34,197,94,.3); }
.ia-trust-blue   { background: rgba(59,130,246,.15);  color: #93c5fd;  border: 1px solid rgba(59,130,246,.3); }
.ia-trust-orange { background: rgba(249,115,22,.15);  color: #fdba74;  border: 1px solid rgba(249,115,22,.3); }

/* Context pill */
.ia-ctx-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.1);
  color: #94a3b8;
  background: rgba(255,255,255,.05);
  transition: all .3s;
}
.ia-ctx-pill.ok   { color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.ia-ctx-pill.warn { color: #fcd34d; border-color: rgba(252,211,77,.4); background: rgba(252,211,77,.1); }
.ia-ctx-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: iaPing 1.5s infinite;
}

/* Action buttons (topbar) */
.ia-action-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  transition: all .2s;
}
.ia-action-btn:hover { background: rgba(255,255,255,.15); color: white; border-color: rgba(255,255,255,.25); }
.ia-action-btn.ia-action-danger:hover { background: rgba(239,68,68,.25); border-color: rgba(239,68,68,.5); color: #fca5a5; }

/* ── Workspace (main grid) ──────────────────────────────────── */
.ia-workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
@media (max-width: 960px) {
  .ia-workspace { grid-template-columns: 1fr; }
  .ia-panel-left { display: none; }
}

/* ── Left panel ─────────────────────────────────────────────── */
.ia-panel-left {
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 16px;
}
.ia-panel-section-label {
  font-size: .7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.ia-section-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ia-dot-green  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.ia-dot-orange { background: #f97316; box-shadow: 0 0 6px #f97316; }

/* KPI Grid 2×3 */
.ia-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.ia-kpi2 {
  border-radius: 10px;
  padding: 10px 10px 8px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: transform .15s, box-shadow .15s;
}
.ia-kpi2:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ia-kpi2-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  flex-shrink: 0;
}
.ia-kpi2-body { min-width: 0; flex: 1; }
.ia-kpi2-label { font-size: .67rem; font-weight: 600; color: inherit; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-kpi2-val   { font-size: .82rem; font-weight: 800; color: inherit; line-height: 1.3; word-break: break-all; }

/* KPI Color variants */
.ia-kpi2-navy   { background: #f0f9ff; border-color: #bae6fd; color: #0c4a6e; }
.ia-kpi2-navy .ia-kpi2-icon   { background: #0ea5e9; color: white; }
.ia-kpi2-danger { background: #fff1f2; border-color: #fecdd3; color: #881337; }
.ia-kpi2-danger .ia-kpi2-icon { background: #e11d48; color: white; }
.ia-kpi2-success{ background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.ia-kpi2-success .ia-kpi2-icon{ background: #22c55e; color: white; }
.ia-kpi2-info   { background: #f5f3ff; border-color: #ddd6fe; color: #3b0764; }
.ia-kpi2-info .ia-kpi2-icon   { background: #a855f7; color: white; }
.ia-kpi2-warn   { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.ia-kpi2-warn .ia-kpi2-icon   { background: #f59e0b; color: white; }
.ia-kpi2-orange { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.ia-kpi2-orange .ia-kpi2-icon { background: #f97316; color: white; }

/* Skeleton loading */
.ia-skeleton-val {
  display: inline-block;
  width: 70px; height: 12px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: iaSkeleton 1.5s infinite;
}
@keyframes iaSkeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Divider */
.ia-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  margin: 12px 0;
  flex-shrink: 0;
}

/* ============================================================
   SCHEMA MANAGER — Gestionnaire Modules & Colonnes
   ============================================================ */

/* Onglet admin spécial */
.tab-btn-admin {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border-color: #f97316 !important;
  color: #c2410c !important;
  font-weight: 600;
}
.tab-btn-admin.active {
  background: linear-gradient(135deg, #f97316, #ea580c) !important;
  color: white !important;
}

/* Top bar du SM */
.sm-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sm-topbar-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: .85rem;
}
.sm-topbar-info i { font-size: 1.4rem; margin-top: 2px; }
.sm-topbar-info strong { display: block; font-size: .95rem; margin-bottom: 3px; color: #1e293b; }
.sm-topbar-info p { color: #78716c; margin: 0; font-size: .82rem; }

/* Workspace 2 colonnes */
.sm-workspace {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 500px;
}
@media (max-width: 900px) {
  .sm-workspace { grid-template-columns: 1fr; }
}

/* Sidebar modules */
.sm-sidebar {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sm-sidebar-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #94a3b8;
  padding: 4px 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sm-module-list { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.sm-mod-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .83rem;
  color: #475569;
  transition: all .15s;
  border: 1px solid transparent;
}
.sm-mod-item:hover { background: #f8fafc; border-color: #e2e8f0; }
.sm-mod-item.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 600;
}
.sm-mod-item i { width: 16px; text-align: center; flex-shrink: 0; }
.sm-mod-item span:nth-child(2) { flex: 1; }
.sm-mod-count {
  background: #f1f5f9;
  color: #64748b;
  font-size: .68rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.sm-add-mod-btn {
  margin-top: 8px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
  color: #f97316;
  background: none;
  border-left: none; border-right: none; border-bottom: none;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s;
}
.sm-add-mod-btn:hover { color: #ea580c; }

/* Main panel */
.sm-main {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: .9rem;
}

/* Panel header */
.sm-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
  flex-wrap: wrap;
}
.sm-panel-title { font-size: 1rem; font-weight: 700; color: #1e293b; margin: 0 0 3px; display: flex; align-items: center; gap: 8px; }
.sm-panel-sub   { font-size: .78rem; color: #94a3b8; margin: 0; }
.sm-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Info bar */
.sm-info-bar {
  background: #f0f9ff;
  border-bottom: 1px solid #bae6fd;
  padding: 8px 20px;
  font-size: .77rem;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Fields table */
.sm-fields-table { flex: 1; overflow-y: auto; }
.sm-fields-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #64748b;
  position: sticky;
  top: 0;
  z-index: 1;
}
.sm-field-rows { display: flex; flex-direction: column; }
.sm-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
  cursor: grab;
}
.sm-field-row:hover { background: #fafbfc; }
.sm-field-row.dragging { opacity: .5; background: #eff6ff; cursor: grabbing; }
.sm-field-row.drag-over { border-top: 2px solid #3b82f6; background: #eff6ff; }

/* Colonnes largeurs */
.sm-drag-handle { color: #cbd5e1; cursor: grab; width: 18px; flex-shrink: 0; }
.sm-col-pos     { width: 42px; flex-shrink: 0; }
.sm-col-label   { flex: 2; min-width: 120px; font-size: .83rem; }
.sm-col-key     { flex: 2; min-width: 120px; }
.sm-col-type    { flex: 1.5; min-width: 110px; }
.sm-col-tbl,
.sm-col-frm,
.sm-col-req     { width: 72px; flex-shrink: 0; display: flex; justify-content: center; }
.sm-col-opt     { flex: 2; min-width: 120px; font-size: .75rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-col-act     { width: 72px; flex-shrink: 0; display: flex; gap: 4px; }

/* Badges & codes */
.sm-pos-badge {
  background: #f1f5f9;
  color: #64748b;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}
.sm-key-code {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .74rem;
  color: #7c3aed;
  font-family: 'Courier New', monospace;
}
.sm-type-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sm-type-text     { background: #f0fdf4; color: #15803d; }
.sm-type-number   { background: #eff6ff; color: #1d4ed8; }
.sm-type-select   { background: #fefce8; color: #a16207; }
.sm-type-boolean  { background: #fdf4ff; color: #7e22ce; }
.sm-type-date     { background: #fff7ed; color: #c2410c; }
.sm-type-textarea { background: #f0f9ff; color: #0369a1; }
.sm-type-email    { background: #ecfdf5; color: #065f46; }
.sm-type-tel      { background: #fef2f2; color: #b91c1c; }

/* Toggle switch */
.sm-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
}
.sm-toggle input { opacity: 0; width: 0; height: 0; }
.sm-toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 18px;
  transition: .2s;
}
.sm-toggle-slider::before {
  content: '';
  position: absolute;
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.sm-toggle input:checked + .sm-toggle-slider { background: #22c55e; }
.sm-toggle input:checked + .sm-toggle-slider::before { transform: translateX(16px); }

/* Check labels dans le modal */
.sm-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: border-color .15s;
}
.sm-check-label:hover { border-color: #94a3b8; }
.sm-check-label input { width: 15px; height: 15px; accent-color: #3b82f6; }

/* btn-navy */
.btn-navy {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-navy:hover { background: #1a2a5e; }

/* ── Zone questions rapides MOBILE ─────────────────────────── */
.ia-mobile-quick {
  display: none; /* caché par défaut sur grand écran */
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 14px;
  flex-shrink: 0;
}
.ia-mobile-quick-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #94a3b8;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ia-quick-scroll {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.ia-quick-scroll::-webkit-scrollbar { display: none; }
.ia-quick-scroll .ia-quick-btn {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: .76rem;
  padding: 7px 12px;
  border-radius: 20px;
}
@media (max-width: 960px) {
  .ia-mobile-quick { display: block; }
}

/* Quick prompt grid */
.ia-quick-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.ia-quick-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: .78rem;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.ia-quick-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(249,115,22,.08), rgba(168,85,247,.08));
  opacity: 0;
  transition: opacity .2s;
}
.ia-quick-btn:hover { border-color: #f97316; color: #c2410c; transform: translateX(2px); }
.ia-quick-btn:hover::before { opacity: 1; }

/* Panel footer trust */
.ia-panel-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ia-footer-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .7rem;
  color: #94a3b8;
}

/* ── Chat zone ──────────────────────────────────────────────── */
.ia-chat-zone {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
}

/* Chat canvas (messages area) */
.ia-chat-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}
.ia-chat-canvas::-webkit-scrollbar { width: 5px; }
.ia-chat-canvas::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Empty state */
.ia-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #94a3b8;
  padding: 40px 20px;
  text-align: center;
}
.ia-empty-orb {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(249,115,22,.12), rgba(168,85,247,.12));
  border: 2px solid rgba(249,115,22,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: #f97316;
  animation: iaFloat 3s ease-in-out infinite;
}
@keyframes iaFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.ia-empty-state h3 { font-size: .95rem; font-weight: 700; color: #334155; margin: 0; }
.ia-empty-state p  { font-size: .82rem; color: #94a3b8; margin: 0; max-width: 280px; }

/* Messages */
.ia-msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 88%;
  animation: iaMsgIn .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes iaMsgIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ia-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ia-msg-bot  { align-self: flex-start; max-width: 92%; }

/* Avatars */
.ia-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.ia-avatar-user { background: linear-gradient(135deg, #f97316, #fb923c); color: white; }
.ia-avatar-bot  { background: linear-gradient(135deg, #1e293b, #334155); color: white; font-size: .9rem; }

/* Bubbles */
.ia-bubble {
  padding: 13px 16px;
  border-radius: 16px;
  font-size: .875rem;
  line-height: 1.65;
  max-width: 100%;
  word-break: break-word;
  position: relative;
}
.ia-msg-user .ia-bubble {
  background: linear-gradient(135deg, #f97316, #ea6c0a);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(249,115,22,.3);
}
.ia-msg-bot .ia-bubble {
  background: white;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Bot bubble rich content */
.ia-msg-bot .ia-bubble h2,
.ia-msg-bot .ia-bubble h3,
.ia-msg-bot .ia-bubble h4 {
  color: #0f172a;
  margin: 10px 0 5px;
  font-size: .9rem;
  display: flex; align-items: center; gap: 6px;
}
.ia-msg-bot .ia-bubble ul  { padding-left: 20px; margin: 6px 0; }
.ia-msg-bot .ia-bubble li  { margin-bottom: 4px; line-height: 1.5; }
.ia-msg-bot .ia-bubble code {
  background: #f1f5f9; padding: 2px 7px; border-radius: 5px;
  font-family: monospace; font-size: .82rem; color: #f97316;
}
.ia-msg-bot .ia-bubble strong { color: #0f172a; font-weight: 700; }
.ia-msg-bot .ia-bubble em { color: #64748b; }
.ia-msg-bot .ia-bubble p { margin: 5px 0; }
.ia-msg-bot .ia-bubble hr { border: none; border-top: 1px solid #f1f5f9; margin: 10px 0; }

/* Executive summary block inside bot bubble */
.ia-exec-summary {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 0;
}
.ia-exec-summary .ia-exec-title {
  font-size: .75rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.ia-exec-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}
.ia-exec-kpi-item { text-align: center; }
.ia-exec-kpi-item .val { font-size: 1rem; font-weight: 800; color: white; }
.ia-exec-kpi-item .lbl { font-size: .65rem; color: rgba(255,255,255,.5); margin-top: 2px; }

/* Key findings block */
.ia-findings {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0;
}
.ia-findings-title {
  font-size: .72rem;
  font-weight: 700;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}

/* Risk block */
.ia-risk-block {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-left: 3px solid #e11d48;
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: .82rem;
}

/* CTA buttons in bot response */
.ia-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.ia-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  font-family: inherit;
}
.ia-cta-primary {
  background: #f97316;
  color: white;
  border-color: #ea6c0a;
  box-shadow: 0 2px 8px rgba(249,115,22,.3);
}
.ia-cta-primary:hover { background: #ea6c0a; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,.4); }
.ia-cta-secondary {
  background: white;
  color: #1e293b;
  border-color: #e2e8f0;
}
.ia-cta-secondary:hover { border-color: #f97316; color: #f97316; }
.ia-cta-outline {
  background: transparent;
  color: #7c3aed;
  border-color: #ddd6fe;
}
.ia-cta-outline:hover { background: #f5f3ff; }

/* Timestamp */
.ia-time {
  font-size: .68rem;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
  align-self: flex-end;
}

/* Typing indicator */
.ia-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}
.ia-typing span {
  width: 8px; height: 8px;
  background: #cbd5e1;
  border-radius: 50%;
  animation: iaBounce2 1.4s infinite;
}
.ia-typing span:nth-child(2) { animation-delay: .2s; }
.ia-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes iaBounce2 {
  0%, 60%, 100% { transform: translateY(0) scale(1); background: #cbd5e1; }
  30%           { transform: translateY(-7px) scale(1.1); background: #f97316; }
}

/* ── Composer (input area) ──────────────────────────────────── */
.ia-composer {
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 14px 20px;
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.05);
}
.ia-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color .2s, box-shadow .2s;
}
.ia-composer-inner.focused {
  border-color: #f97316;
  background: white;
  box-shadow: 0 0 0 3px rgba(249,115,22,.12), 0 4px 16px rgba(0,0,0,.08);
}
.ia-composer-icon {
  color: #94a3b8;
  font-size: .9rem;
  padding-bottom: 2px;
  flex-shrink: 0;
  transition: color .2s;
}
.ia-composer-inner.focused .ia-composer-icon { color: #f97316; }
.ia-composer-input {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  outline: none;
  font-size: .9rem;
  font-family: inherit;
  color: #1e293b;
  line-height: 1.55;
  max-height: 130px;
  overflow-y: auto;
}
.ia-composer-input::placeholder { color: #94a3b8; }
.ia-composer-send {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(249,115,22,.4);
}
.ia-composer-send:hover   { transform: scale(1.08); box-shadow: 0 4px 14px rgba(249,115,22,.5); }
.ia-composer-send:active  { transform: scale(.94); }
.ia-composer-send:disabled{ opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.ia-composer-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  font-size: .7rem;
  color: #94a3b8;
}
.ia-composer-meta kbd {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: .68rem;
  color: #475569;
}
.ia-composer-model {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #7c3aed;
}

/* ── Count-up animation for KPI values ──────────────────────── */
@keyframes iaCountUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ia-kpi2-val.updated {
  animation: iaCountUp .4s ease;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .ia-trust-badges { display: none; }
}
@media (max-width: 700px) {
  .ia-chat-canvas { padding: 16px 14px; }
  .ia-composer    { padding: 10px 14px; }
  .ia-msg         { max-width: 96%; }
  .ia-exec-kpi-row { grid-template-columns: 1fr 1fr; }
}

/* Override old ia-layout rules to avoid conflict */
.ia-layout { display: none !important; }

/* ============================================================
   MODULE FORMATEURS B2B — CSS v1.0
   ============================================================ */

/* ─── NAV SUB-ITEMS ────────────────────────────────────────── */
.nav-sub {
  padding-left: 40px !important;
  font-size: .85rem !important;
  opacity: .88;
}
.nav-sub i { font-size: .8rem !important; }

/* ─── KPI ROW ──────────────────────────────────────────────── */
.ft-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ft-kpi {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .2s;
}
.ft-kpi:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ft-kpi-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.ft-kpi-lbl {
  font-size: .72rem;
  color: var(--gray-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.ft-kpi-danger .ft-kpi-val { color: var(--danger); }
.ft-kpi-warning .ft-kpi-val { color: var(--warning); }
.ft-kpi-success .ft-kpi-val { color: var(--success); }
.ft-kpi-navy .ft-kpi-val { color: var(--navy); }

/* ─── FILTRES ───────────────────────────────────────────────── */
.ft-filters-card { padding: 16px; margin-bottom: 16px; }
.ft-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ft-filter-input  { flex: 2; min-width: 200px; }
.ft-filter-select { flex: 1; min-width: 140px; }

/* ─── BADGE FORMATEUR ──────────────────────────────────────── */
.ft-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}
.ft-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-b2b {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 600;
}

/* ─── FICHE FORMATEUR ──────────────────────────────────────── */
.ft-profil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.ft-profil-section h4 {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--navy);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--orange);
}
.ft-profil-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 8px;
}
.ft-profil-row span:first-child {
  color: var(--gray-400);
  font-size: .82rem;
  flex-shrink: 0;
}
.ft-profil-row strong {
  color: var(--gray-700);
  font-size: .85rem;
  text-align: right;
  word-break: break-word;
}

/* ─── TOTAUX ROW ────────────────────────────────────────────── */
.ft-totaux-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: .88rem;
}

/* ─── FORM SECTION TITLE ────────────────────────────────────── */
.ft-form-section {
  grid-column: 1 / -1;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--orange);
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--orange-subtle);
  margin-bottom: 4px;
}

/* ─── DOCUMENTS ─────────────────────────────────────────────── */
.ft-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 8px;
  background: white;
  flex-wrap: wrap;
}
.ft-doc-type {
  background: var(--navy);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── IMPORT MODULE ────────────────────────────────────────── */
.ft-import-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 4px;
}
.ft-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: .45;
  transition: all .2s;
}
.ft-step.active { opacity: 1; }
.ft-step.done   { opacity: .7; }
.ft-step-num {
  width: 32px; height: 32px;
  background: var(--gray-200);
  color: var(--gray-500);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  transition: all .2s;
}
.ft-step.active .ft-step-num {
  background: var(--orange);
  color: white;
  box-shadow: 0 0 0 4px rgba(249,115,22,.2);
}
.ft-step.done .ft-step-num {
  background: var(--success);
  color: white;
}
.ft-step span:last-child {
  font-size: .72rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.ft-step.active span:last-child { color: var(--orange); }
.ft-step-line {
  width: 40px;
  height: 2px;
  background: var(--gray-200);
  margin-top: -14px;
  flex-shrink: 0;
}

.ft-import-card { overflow: visible; }

/* Upload zone */
.ft-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
}
.ft-upload-zone:hover,
.ft-upload-zone.drag-over {
  border-color: var(--orange);
  background: var(--orange-bg);
}

/* Sheet grid */
.ft-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.ft-sheet-card {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}
.ft-sheet-card:hover { border-color: var(--navy); }
.ft-sheet-card.selected {
  border-color: var(--orange);
  background: var(--orange-bg);
}

/* Import summary */
.ft-import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ft-import-stat {
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ft-import-stat strong {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.ft-import-stat span {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.ft-import-stat-total  { background: #f1f5f9; color: var(--navy); }
.ft-import-stat-ok     { background: #d1fae5; color: #059669; }
.ft-import-stat-dup    { background: #fef3c7; color: #d97706; }
.ft-import-stat-err    { background: #fee2e2; color: #dc2626; }

/* Import alert */
.ft-import-alert {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 12px 16px;
  color: #856404;
  font-size: .88rem;
}

/* ─── LÉGENDE ENTITÉS ───────────────────────────────────────── */
.ft-entity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.ft-el {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.ft-el-formateur  { background:#dbeafe; color:#1d4ed8; border-color:#bfdbfe; }
.ft-el-dossier    { background:#f3e8ff; color:#7c3aed; border-color:#e9d5ff; }
.ft-el-paiement   { background:#d1fae5; color:#059669; border-color:#a7f3d0; }
.ft-el-reclamation{ background:#fef3c7; color:#d97706; border-color:#fde68a; }
.ft-el-controle   { background:#fee2e2; color:#dc2626; border-color:#fecaca; }

/* ─── GRILLE 38 COLONNES ────────────────────────────────────── */
.ft-col38-info {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px;
}
.ft-col38-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}
.ft-col38-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 5px;
}
.ft-col38-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--gray-600);
  padding: 3px 6px;
  border-radius: 4px;
  background: white;
  border: 1px solid var(--gray-200);
}
.ft-col38-item em {
  font-style: normal;
  font-weight: 700;
  color: var(--orange);
  min-width: 18px;
  font-size: .7rem;
}
.ft-col38-item:hover {
  cursor: pointer;
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* ─── FILTRES RAPIDES STATUT ─────────────────────────────────── */
.ft-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.ft-qf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 2px solid transparent;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  background: var(--gray-100);
  color: var(--gray-600);
}
.ft-qf-btn:hover { filter: brightness(.95); transform: translateY(-1px); }
.ft-qf-btn.active { box-shadow: 0 2px 8px rgba(0,0,0,.15); }

/* Tous */
.ft-qf-all                     { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.ft-qf-all.active               { background: var(--navy);    color: #fff;            border-color: var(--navy); }

/* Non réglés */
.ft-qf-nr                      { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.ft-qf-nr.active                { background: #dc2626; color: #fff;   border-color: #dc2626; }

/* En cours */
.ft-qf-ec                      { background: #fef3c7; color: #d97706; border-color: #fcd34d; }
.ft-qf-ec.active                { background: #d97706; color: #fff;   border-color: #d97706; }

/* Réglés */
.ft-qf-ok                      { background: #d1fae5; color: #059669; border-color: #6ee7b7; }
.ft-qf-ok.active                { background: #059669; color: #fff;   border-color: #059669; }

/* À vérifier */
.ft-qf-av                      { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }
.ft-qf-av.active                { background: #64748b; color: #fff;   border-color: #64748b; }

/* Compteur dans les boutons */
.ft-qf-count {
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: .78rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}
.ft-qf-btn.active .ft-qf-count {
  background: rgba(255,255,255,.25);
}

/* KPI cliquables */
.ft-kpi[data-clickable]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ft-kpi-row  { grid-template-columns: 1fr 1fr; }
  .ft-profil-grid { grid-template-columns: 1fr; }
  .ft-import-steps { gap: 2px; }
  .ft-step-line { width: 20px; }
  .ft-col38-grid { grid-template-columns: 1fr 1fr; }
  .ft-entity-legend { gap: 6px; }
  .ft-quick-filters { gap: 6px; }
  .ft-qf-btn { padding: 6px 10px; font-size: .78rem; }
}
