
:root {
  --navy: #1B2B4B;
  --red: #D0192F;
  --blue: #1A56DB;
  --white: #FFFFFF;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #6C757D;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;
  --green: #198754;
  --orange: #FD7E14;
  --yellow: #FFC107;
  --sidebar-width: 240px;
  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-900); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); font-size: 14px; }

/* ===== SPLASH / AUTH ===== */
#splash {
  position: fixed; inset: 0; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; flex-direction: column; gap: 32px;
}
.splash-logo { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.splash-logo .logo-text { color: white; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; opacity: 0.6; font-weight: 300; }
.splash-tagline { color: rgba(255,255,255,0.5); font-size: 13px; text-align: center; }
.splash-btns { display: flex; gap: 12px; }
.btn-splash-primary {
  background: var(--red); color: white; border: none; padding: 12px 32px;
  border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-splash-primary:hover { background: #b5162a; transform: translateY(-1px); }
.btn-splash-secondary {
  background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3);
  padding: 12px 32px; border-radius: var(--radius); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-splash-secondary:hover { border-color: white; background: rgba(255,255,255,0.05); }

/* ===== AUTH MODAL ===== */
#auth-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 2000;
  display: none; align-items: center; justify-content: center;
}
#auth-modal.open { display: flex; }
.auth-box {
  background: white; border-radius: var(--radius-lg); width: 440px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); padding: 36px;
}
.auth-box h2 { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.auth-box .auth-subtitle { color: var(--gray-600); font-size: 13px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; transition: border-color 0.2s;
  background: white;
}
.form-group input:focus, .form-group select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-auth {
  width: 100%; padding: 12px; background: var(--navy); color: white; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 8px;
}
.btn-auth:hover { background: #142038; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--gray-600); }
.auth-switch a { color: var(--blue); font-weight: 500; cursor: pointer; }

/* Token input */
.token-inputs { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
.token-inputs input {
  width: 44px; height: 52px; text-align: center; font-size: 22px; font-weight: 700;
  font-family: var(--mono); border: 2px solid var(--gray-300); border-radius: var(--radius);
  color: var(--navy);
}
.token-inputs input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,0.15); }
.token-demo-box {
  background: var(--gray-100); border-radius: var(--radius); padding: 12px 16px;
  font-family: var(--mono); font-size: 18px; text-align: center; letter-spacing: 6px;
  color: var(--navy); font-weight: 600; margin: 12px 0;
}
.token-label { font-size: 12px; color: var(--gray-500); text-align: center; margin-bottom: 4px; }

/* ===== WELCOME POPUP ===== */
#welcome-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: white; border-radius: var(--radius-lg); padding: 48px 56px;
  box-shadow: var(--shadow-lg); z-index: 5000; display: none; text-align: center;
  min-width: 440px;
}
#welcome-popup.show { display: block; }
.welcome-title { font-size: 36px; font-weight: 700; color: var(--navy); margin-bottom: 12px; line-height: 1.2; }
.welcome-sub { color: var(--gray-600); font-size: 15px; margin-bottom: 24px; }
.role-badge {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 600; margin-bottom: 24px;
}
.role-badge.superadmin { background: #fff3cd; color: #664d03; }
.role-badge.admin { background: #cfe2ff; color: #084298; }
.role-badge.client { background: #d1e7dd; color: #0a3622; }
.role-badge.fournisseur { background: #f8d7da; color: #842029; }
.welcome-progress { height: 4px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.welcome-progress-bar { height: 100%; background: var(--blue); border-radius: 4px; animation: progressAnim 5s linear forwards; }
@keyframes progressAnim { from { width: 0%; } to { width: 100%; } }
#popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 4999; display: none; }
#popup-overlay.show { display: block; }

/* ===== APP LAYOUT ===== */
#app { display: none; min-height: 100vh; }
#app.visible { display: flex; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width); background: var(--navy); color: white;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 100; overflow-y: auto;
}
.sidebar-header { padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo .logo-label { font-size: 11px; color: rgba(255,255,255,0.45); letter-spacing: 3px; text-transform: uppercase; }
.sidebar-user { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: white; line-height: 1.3; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section-title { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.3); letter-spacing: 1.5px; text-transform: uppercase; padding: 16px 16px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; border-radius: 0; position: relative;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; background: rgba(255,255,255,0.10); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--red); border-radius: 0 2px 2px 0; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.btn-logout {
  display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.5);
  font-size: 13px; cursor: pointer; padding: 8px 0; transition: color 0.15s; background: none; border: none; font-family: var(--font);
}
.btn-logout:hover { color: var(--red); }

/* MAIN CONTENT */
#main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: white; padding: 0 28px; height: 60px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page-content { padding: 24px 28px; flex: 1; }

/* VERSION BADGE */
#version-badge {
  position: fixed; bottom: 12px; left: 12px;
  background: rgba(27,43,75,0.85); color: rgba(255,255,255,0.6);
  font-family: var(--mono); font-size: 11px; padding: 4px 10px;
  border-radius: 20px; z-index: 9999; backdrop-filter: blur(4px);
  letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; border: none; font-family: var(--font); }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #1648c2; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b5162a; }
.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: #142038; }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--gray-500); background: var(--gray-50); }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ===== CARDS & PANELS ===== */
.card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-body { padding: 20px; }

/* KPI CARDS */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: white; border-radius: var(--radius-lg); padding: 20px;
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); margin-bottom: 4px; font-family: var(--mono); }
.kpi-sub { font-size: 12px; color: var(--gray-500); }
.kpi-icon { font-size: 28px; margin-bottom: 10px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--gray-200); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* STATUS BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-blue { background: #EFF6FF; color: #1D4ED8; }
.badge-green { background: #F0FDF4; color: #166534; }
.badge-red { background: #FEF2F2; color: #991B1B; }
.badge-orange { background: #FFF7ED; color: #9A3412; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-navy { background: #EEF2FF; color: var(--navy); }
.badge-yellow { background: #FEFCE8; color: #854D0E; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 3000; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; width: 640px; }
.modal-lg { width: 820px; }
.modal-xl { width: 960px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 1; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 22px; color: var(--gray-500); cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { color: var(--gray-800); background: var(--gray-100); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== TABS ===== */
.tabs-nav { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-btn { padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--gray-600); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover:not(.active) { color: var(--gray-800); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== FILTERS & SEARCH ===== */
.filters-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-input {
  padding: 8px 12px 8px 36px; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 13px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236C757D' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 10px center;
  width: 240px; transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--blue); outline: none; }
.filter-chip { padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; border: 1.5px solid var(--gray-300); background: white; color: var(--gray-600); }
.filter-chip.active { background: var(--navy); color: white; border-color: var(--navy); }

/* ===== TOAST ===== */
#toast-container { position: fixed; top: 72px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; background: white;
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--blue); max-width: 340px; animation: toastIn 0.3s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--orange); }
.toast-icon { font-size: 16px; margin-top: 1px; }
.toast-text { font-size: 13px; font-weight: 500; color: var(--gray-800); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== FORM ELEMENTS ===== */
.form-section-title { font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.8px; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-100); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.full-width { grid-column: 1/-1; }
.form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; resize: vertical; min-height: 80px; transition: border-color 0.2s; }
.form-group textarea:focus { border-color: var(--blue); outline: none; }

/* ===== DASHBOARD ===== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart-bar-wrap { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-bottom: 4px; }
.chart-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-bar { background: var(--blue); border-radius: 4px 4px 0 0; width: 100%; min-height: 4px; transition: height 0.5s ease; }
.chart-bar-label { font-size: 10px; color: var(--gray-500); font-family: var(--mono); }
.chart-bar-val { font-size: 10px; font-weight: 600; color: var(--navy); }

/* PIPELINE */
.pipeline-stages { display: flex; gap: 0; margin-bottom: 12px; }
.pipeline-stage { flex: 1; text-align: center; padding: 10px 4px; position: relative; }
.pipeline-stage:not(:last-child)::after { content: '▶'; position: absolute; right: -8px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 12px; z-index: 1; }
.stage-count { font-size: 22px; font-weight: 700; color: var(--navy); font-family: var(--mono); }
.stage-label { font-size: 11px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stage-amount { font-size: 12px; color: var(--gray-600); font-family: var(--mono); }

/* ===== KANBAN ===== */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { background: var(--gray-100); border-radius: var(--radius-lg); min-width: 240px; padding: 14px; flex: 1; }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kanban-col-title { font-size: 13px; font-weight: 700; color: var(--navy); }
.kanban-count { font-size: 11px; font-weight: 700; color: white; background: var(--gray-500); border-radius: 12px; padding: 2px 8px; }
.kanban-card { background: white; border-radius: var(--radius); padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); cursor: pointer; transition: box-shadow 0.15s; }
.kanban-card:hover { box-shadow: var(--shadow); }
.kanban-card-client { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.kanban-card-service { font-size: 12px; color: var(--gray-600); margin-bottom: 8px; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-avatars { display: flex; }
.kanban-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); border: 2px solid white; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: white; margin-left: -6px; }
.kanban-avatar:first-child { margin-left: 0; }
.kanban-date { font-size: 11px; color: var(--gray-500); font-family: var(--mono); }

/* ===== PLANNING GRID ===== */
.planning-grid { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; background: white; }
.planning-header { display: grid; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.planning-header-cell { padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; text-align: center; border-right: 1px solid var(--gray-200); }
.planning-row { display: grid; border-bottom: 1px solid var(--gray-100); }
.planning-row:last-child { border-bottom: none; }
.planning-resource { padding: 12px; font-size: 13px; font-weight: 600; color: var(--navy); background: var(--gray-50); border-right: 1px solid var(--gray-200); }
.planning-cell { padding: 6px; border-right: 1px solid var(--gray-100); min-height: 48px; }
.task-chip { background: var(--blue); color: white; border-radius: 4px; padding: 3px 8px; font-size: 11px; font-weight: 600; margin-bottom: 3px; display: block; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-chip.urgent { background: var(--red); }
.task-chip.done { background: var(--green); }
.task-chip.todo { background: var(--gray-400); }

/* ===== GANTT ===== */
.gantt-wrap { overflow-x: auto; }
.gantt-row { display: flex; align-items: center; min-height: 40px; border-bottom: 1px solid var(--gray-100); }
.gantt-label { width: 140px; flex-shrink: 0; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--navy); background: var(--gray-50); border-right: 1px solid var(--gray-200); }
.gantt-track { flex: 1; position: relative; height: 40px; background: white; }
.gantt-bar { position: absolute; height: 24px; top: 8px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: 11px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; }
.gantt-header { display: flex; border-bottom: 2px solid var(--gray-300); }
.gantt-header-label { width: 140px; flex-shrink: 0; padding: 8px 12px; background: var(--gray-50); border-right: 1px solid var(--gray-200); }
.gantt-header-days { flex: 1; display: flex; }
.gantt-day-cell { flex: 1; text-align: center; padding: 8px 2px; font-size: 10px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; border-right: 1px solid var(--gray-100); }

/* ===== CONTACT CARD ===== */
.contact-header { display: flex; align-items: flex-start; gap: 20px; padding: 24px; border-bottom: 1px solid var(--gray-200); }
.contact-avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: white; flex-shrink: 0; }
.contact-info h2 { font-size: 20px; font-weight: 700; color: var(--navy); }
.contact-info .contact-company { font-size: 14px; color: var(--gray-600); margin-top: 2px; }
.contact-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* STARS */
.star-rating { display: flex; gap: 2px; }
.star { font-size: 18px; cursor: pointer; color: var(--gray-300); transition: color 0.1s; }
.star.filled { color: var(--yellow); }

/* RIB PREVIEW */
.rib-preview {
  background: var(--navy); border-radius: var(--radius-lg); padding: 20px 24px;
  color: white; margin-top: 16px; position: relative; overflow: hidden;
}
.rib-preview::before {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.05);
}
.rib-bank { font-size: 13px; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.rib-titulaire { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.rib-iban { font-family: var(--mono); font-size: 14px; letter-spacing: 2px; margin-bottom: 10px; color: rgba(255,255,255,0.9); word-break: break-all; }
.rib-row { display: flex; gap: 24px; }
.rib-field label { font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.8px; }
.rib-field span { font-family: var(--mono); font-size: 13px; display: block; }

/* STRIPE */
.stripe-banner {
  background: var(--navy); color: white; border-radius: var(--radius-lg);
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.stripe-banner-title { font-size: 14px; font-weight: 700; }
.stripe-payment-methods { display: flex; gap: 6px; align-items: center; }
.payment-badge { background: white; color: var(--navy); border-radius: 4px; padding: 3px 8px; font-size: 11px; font-weight: 700; }

/* NOTIFICATIONS */
.notif-channels { display: flex; gap: 12px; margin-bottom: 20px; }
.channel-toggle { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1.5px solid var(--gray-300); border-radius: var(--radius); cursor: pointer; transition: all 0.15s; }
.channel-toggle.active { border-color: var(--blue); background: #EFF6FF; }
.channel-toggle input { display: none; }
.toggle-switch { width: 36px; height: 20px; background: var(--gray-300); border-radius: 10px; position: relative; transition: background 0.2s; }
.channel-toggle.active .toggle-switch { background: var(--blue); }
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: left 0.2s; box-shadow: var(--shadow-sm); }
.channel-toggle.active .toggle-knob { left: 19px; }

/* DOCUMENT PREVIEW */
.doc-preview { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 32px; max-width: 700px; margin: 0 auto; }
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
.doc-from h3 { font-size: 14px; font-weight: 700; color: var(--navy); }
.doc-from p { font-size: 12px; color: var(--gray-600); line-height: 1.7; }
.doc-to { text-align: right; }
.doc-title { font-size: 20px; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
.doc-ref { font-family: var(--mono); font-size: 13px; color: var(--gray-600); }
.doc-divider { border: none; border-top: 2px solid var(--navy); margin: 20px 0; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.doc-table thead th { background: var(--navy); color: white; padding: 8px 12px; font-size: 12px; text-align: left; }
.doc-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.doc-totals { text-align: right; margin-left: auto; min-width: 240px; }
.doc-total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.doc-total-row.total-ttc { font-weight: 700; font-size: 16px; color: var(--navy); border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 8px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 15px; font-weight: 600; color: var(--gray-500); }
.empty-sub { font-size: 13px; color: var(--gray-400); margin-top: 6px; }

/* ACCOUNT MANAGEMENT */
.user-table-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; }

/* TIMELINE */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-dot { position: absolute; left: -21px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid white; box-shadow: 0 0 0 2px var(--blue); }
.timeline-date { font-size: 11px; color: var(--gray-500); font-family: var(--mono); margin-bottom: 4px; }
.timeline-text { font-size: 13px; color: var(--gray-800); font-weight: 500; }

/* ===== RESPONSIVE & EXTRAS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mono { font-family: var(--mono); }
.text-small { font-size: 12px; }
.text-muted { color: var(--gray-500); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-navy { color: var(--navy); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }
.security-warning { background: #FEF9C3; border: 1px solid #FDE047; border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: #854D0E; display: flex; align-items: flex-start; gap: 8px; }

/* ===== COMMERCIAL DASHBOARD BANNER ===== */
.comm-banner {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.comm-banner-title {
  padding: 12px 20px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.comm-pipeline {
  display: flex;
  align-items: stretch;
  padding: 16px 20px 20px;
  gap: 0;
  position: relative;
}
.comm-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 8px;
}
.comm-stage:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 16px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 12px solid var(--gray-200);
  z-index: 2;
}
.comm-stage:not(:last-child)::before {
  content: '';
  position: absolute;
  right: -3px;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 14px solid white;
  z-index: 3;
}
.comm-stage-inner {
  width: 100%;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 10px 12px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}
.comm-stage-inner:hover {
  border-color: var(--blue);
  background: #EFF6FF;
}
.comm-stage-inner.active-stage {
  border-color: var(--blue);
  background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}
.comm-stage-icon {
  font-size: 22px;
  margin-bottom: 6px;
  display: block;
}
.comm-stage-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  white-space: nowrap;
}
.comm-stage-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 4px;
}
.comm-stage-amount {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  font-family: var(--mono);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.comm-stage-sub {
  font-size: 10px;
  color: var(--gray-400);
  font-style: italic;
}
.comm-stage-bar {
  height: 4px;
  border-radius: 2px;
  margin-top: 10px;
  width: 100%;
  background: var(--gray-200);
  overflow: hidden;
}
.comm-stage-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Color variants per stage */
.stage-affaires .comm-stage-inner { border-color: #CBD5E1; }
.stage-affaires .comm-stage-count { color: #475569; }
.stage-affaires .comm-stage-bar-fill { background: #94A3B8; }
.stage-affaires .comm-stage-inner:hover, .stage-affaires .comm-stage-inner.active-stage { border-color: #64748B; background: #F8FAFC; }

.stage-devis .comm-stage-inner { border-color: #BFDBFE; }
.stage-devis .comm-stage-count { color: var(--blue); }
.stage-devis .comm-stage-bar-fill { background: var(--blue); }
.stage-devis .comm-stage-inner:hover, .stage-devis .comm-stage-inner.active-stage { border-color: var(--blue); background: #EFF6FF; }

.stage-signe .comm-stage-inner { border-color: #A7F3D0; }
.stage-signe .comm-stage-count { color: #059669; }
.stage-signe .comm-stage-bar-fill { background: #10B981; }
.stage-signe .comm-stage-inner:hover, .stage-signe .comm-stage-inner.active-stage { border-color: #059669; background: #F0FDF9; }

.stage-facture .comm-stage-inner { border-color: #FDE68A; }
.stage-facture .comm-stage-count { color: #D97706; }
.stage-facture .comm-stage-bar-fill { background: #F59E0B; }
.stage-facture .comm-stage-inner:hover, .stage-facture .comm-stage-inner.active-stage { border-color: #D97706; background: #FFFBEB; }

.stage-compense .comm-stage-inner { border-color: #C4B5FD; }
.stage-compense .comm-stage-count { color: #7C3AED; }
.stage-compense .comm-stage-bar-fill { background: #8B5CF6; }
.stage-compense .comm-stage-inner:hover, .stage-compense .comm-stage-inner.active-stage { border-color: #7C3AED; background: #F5F3FF; }

/* Funnel rate badges */
.comm-funnel-row {
  display: flex;
  align-items: center;
  padding: 10px 20px 14px;
  gap: 6px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  font-size: 11px;
  color: var(--gray-500);
  overflow-x: auto;
}
.funnel-rate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.funnel-arrow {
  color: var(--gray-400);
  font-size: 13px;
  flex-shrink: 0;
}
.comm-totals-row {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--gray-200);
}
.comm-total-cell {
  flex: 1;
  padding: 10px 14px;
  border-right: 1px solid var(--gray-100);
  text-align: center;
}
.comm-total-cell:last-child { border-right: none; }
.comm-total-label { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 3px; }
.comm-total-val { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--navy); }


/* ===== MODULE BANQUE ===== */
.bank-header-bar {
  display: flex; align-items: stretch; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.bank-kpi {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 16px 20px; flex: 1; min-width: 150px; box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--gray-300);
}
.bank-kpi.credit  { border-top-color: var(--green); }
.bank-kpi.debit   { border-top-color: var(--red); }
.bank-kpi.solde   { border-top-color: #7C3AED; }
.bank-kpi.matched { border-top-color: var(--blue); }
.bank-kpi-label { font-size: 10px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.bank-kpi-val   { font-size: 22px; font-weight: 700; font-family: var(--mono); color: var(--navy); }
.bank-kpi-sub   { font-size: 11px; color: var(--gray-500); margin-top: 3px; }

.bank-import-zone {
  border: 2px dashed var(--gray-300); border-radius: var(--radius-lg);
  background: var(--gray-50); padding: 28px 24px; text-align: center;
  transition: all 0.2s; cursor: pointer; margin-bottom: 20px;
}
.bank-import-zone:hover, .bank-import-zone.dragover {
  border-color: var(--blue); background: #EFF6FF;
}
.bank-import-zone .import-icon { font-size: 36px; margin-bottom: 8px; }
.bank-import-zone .import-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.bank-import-zone .import-sub { font-size: 12px; color: var(--gray-500); }
.bank-import-formats { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.bank-format-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  background: var(--navy); color: white;
}

.bank-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.bank-filter-group { display: flex; gap: 6px; }

/* Transaction rows */
.tx-row { display: grid; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.tx-row:hover { background: var(--gray-50); }
.tx-row.tx-credit .tx-amount { color: var(--green); }
.tx-row.tx-debit  .tx-amount { color: var(--red); }
.tx-row.tx-matched { background: #F0FDF4; }
.tx-row.tx-matched:hover { background: #DCFCE7; }
.tx-date { font-family: var(--mono); font-size: 12px; color: var(--gray-500); }
.tx-libelle { font-size: 13px; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-ref { font-family: var(--mono); font-size: 11px; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount { font-family: var(--mono); font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; }
.tx-match-badge { text-align: center; }
.tx-actions { text-align: right; }

.match-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.match-pill.auto { background: #D1FAE5; color: #065F46; }
.match-pill.manual { background: #DBEAFE; color: #1E40AF; }
.match-pill.unmatched { background: var(--gray-100); color: var(--gray-500); }

/* Bank account selector */
.bank-account-card {
  background: white; border: 1.5px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 14px 18px; cursor: pointer; transition: all 0.15s; display: flex;
  align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px;
}
.bank-account-card:hover { border-color: var(--blue); }
.bank-account-card.selected { border-color: var(--blue); background: #EFF6FF; }
.bank-account-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.bank-account-iban { font-family: var(--mono); font-size: 11px; color: var(--gray-500); }
.bank-account-bal  { font-family: var(--mono); font-size: 16px; font-weight: 700; }


/* ===== TICKETING MODULE ===== */
.tk-kpi-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; margin-bottom: 20px; }
.tk-kpi { background: white; border-radius: var(--radius-lg); padding: 16px 18px; border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); border-top: 3px solid var(--gray-300); }
.tk-kpi.tk-nouveau  { border-top-color: #94A3B8; }
.tk-kpi.tk-planifie { border-top-color: var(--blue); }
.tk-kpi.tk-en_cours { border-top-color: var(--orange); }
.tk-kpi.tk-urgente  { border-top-color: var(--red); }
.tk-kpi.tk-termine  { border-top-color: var(--green); }
.tk-kpi.tk-sla      { border-top-color: #7C3AED; }
.tk-kpi-label { font-size: 10px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.tk-kpi-val   { font-size: 26px; font-weight: 700; font-family: var(--mono); color: var(--navy); line-height: 1; }
.tk-kpi-sub   { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

.tk-card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); margin-bottom: 10px; overflow: hidden; transition: box-shadow 0.15s; }
.tk-card:hover { box-shadow: var(--shadow); }
.tk-card-accent { height: 4px; }
.tk-card-body { padding: 14px 16px; }
.tk-ref  { font-family: var(--mono); font-size: 11px; color: var(--gray-400); }
.tk-titre { font-size: 14px; font-weight: 700; color: var(--navy); margin: 3px 0; }
.tk-desc  { font-size: 12px; color: var(--gray-600); line-height: 1.5; margin-bottom: 8px; }
.tk-meta  { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.tk-tag   { background: var(--gray-100); color: var(--gray-600); border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 600; }

.tk-progress-wrap { margin: 8px 0; }
.tk-progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--gray-500); margin-bottom: 4px; }
.tk-progress-bar  { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.tk-progress-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }

.tk-deadline { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius); font-size: 12px; font-weight: 600; margin: 6px 0; }
.tk-deadline.ok      { background:#F0FDF4; color:#166534; border:1px solid #BBF7D0; }
.tk-deadline.warning { background:#FFFBEB; color:#92400E; border:1px solid #FDE68A; }
.tk-deadline.late    { background:#FEF2F2; color:#991B1B; border:1px solid #FECACA; }
.tk-deadline.done    { background:#F5F3FF; color:#5B21B6; border:1px solid #DDD6FE; }

.tk-iv-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--gray-100); }
.tk-iv-row:last-child { border-bottom:none; }
.tk-iv-avatar { width:28px; height:28px; border-radius:50%; color:white; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; flex-shrink:0; }
.tk-iv-name { font-size:12px; font-weight:600; color:var(--navy); }
.tk-iv-meta { font-size:11px; color:var(--gray-500); }

.tk-comment  { display:flex; gap:10px; margin-bottom:10px; }
.tk-comment-av { width:26px; height:26px; border-radius:50%; background:var(--blue); color:white; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:2px; }
.tk-comment-bubble { background:var(--gray-50); border-radius:var(--radius); padding:8px 12px; flex:1; }
.tk-comment-meta   { font-size:10px; color:var(--gray-400); margin-bottom:3px; }
.tk-comment-text   { font-size:12px; color:var(--gray-800); line-height:1.5; }

.tk-notif-btn { padding:5px 10px; border-radius:var(--radius); font-size:11px; font-weight:600; cursor:pointer; border:1.5px solid var(--gray-300); background:white; color:var(--gray-700); display:inline-flex; align-items:center; gap:4px; transition:all .15s; }
.tk-notif-btn:hover { border-color:var(--blue); color:var(--blue); }

.tk-gauge-row { display:flex; gap:8px; align-items:center; margin-bottom:8px; }
.tk-gauge-label { font-size:12px; color:var(--gray-600); width:150px; flex-shrink:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tk-gauge-bar   { flex:1; height:10px; background:var(--gray-200); border-radius:5px; overflow:hidden; }
.tk-gauge-fill  { height:100%; border-radius:5px; }
.tk-gauge-count { font-size:11px; font-family:var(--mono); color:var(--gray-500); width:30px; text-align:right; }

.board-cols { display:flex; gap:12px; overflow-x:auto; padding-bottom:8px; }
.board-col  { background:var(--gray-100); border-radius:var(--radius-lg); min-width:220px; flex:1; padding:12px; }
.board-col-hdr { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; padding-bottom:8px; border-bottom:2px solid var(--gray-200); }
.board-mini-card { background:white; border-radius:var(--radius); padding:10px 12px; margin-bottom:6px; box-shadow:var(--shadow-sm); border:1px solid var(--gray-200); cursor:pointer; transition:box-shadow .15s; }
.board-mini-card:hover { box-shadow:var(--shadow); }

