/* ==========================================================================
   NAZOUM CRM / SRM - RFQ & GESTION DES CONSULTATIONS
   Design System & Tokens CSS (Harmonisation Graphique & WCAG AA)
   ========================================================================== */

:root {
  /* Palette 60-30-10 */
  /* Dominante / Neutre (60%) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Surfaces & Cartes (30%) */
  --card-bg: #ffffff;
  --card-header: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-text: #f8fafc;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;

  /* Accents (10%) */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #059669;
  --success-hover: #047857;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --info: #0284c7;
  --info-light: #f0f9ff;
  --info-border: #bae6fd;

  /* Échelle d'espacement (4/8px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typographie */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-size-3xl: 1.875rem;   /* 30px */

  /* Rayons de courbure */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Ombres */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset de base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
}

/* Layout Principal */
.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.brand-info h1 {
  font-size: var(--font-size-base);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-info p {
  font-size: var(--font-size-xs);
  color: #94a3b8;
  font-weight: 500;
}

/* Sélecteur d'Entité (Cloisonnement strict) */
.entity-selector-box {
  padding: var(--space-4) var(--space-5);
  background: rgba(255, 255, 255, 0.04);
  margin: var(--space-4) var(--space-4) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entity-selector-box label {
  display: block;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.entity-select {
  width: 100%;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.entity-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* Menu de Navigation */
.nav-menu {
  list-style: none;
  padding: var(--space-3) var(--space-4);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.nav-item button:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active button {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: var(--font-size-xs);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--font-size-xs);
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-footer .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #22c55e;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-app);
}

/* Header Supérieur */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title-section {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-title-section h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.active-entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Page Content Container */
.page-container {
  padding: var(--space-8);
  flex: 1;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-alt);
  border-color: #94a3b8;
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

/* Cartes KPI / Statistiques */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.blue { background-color: var(--primary-light); color: var(--primary); }
.kpi-icon.green { background-color: var(--success-light); color: var(--success); }
.kpi-icon.amber { background-color: var(--warning-light); color: var(--warning); }
.kpi-icon.purple { background-color: #f3e8ff; color: #7e22ce; }

.kpi-content h4 {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.kpi-content .kpi-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

/* Cartes et Panneaux de Données */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-6);
  background: var(--card-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-body {
  padding: var(--space-6);
}

/* Tableaux de Données */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.data-table th {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface-alt);
}

/* Badges de Statut */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-draft { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-active { background: var(--info-light); color: var(--info); border: 1px solid var(--info-border); }
.badge-review { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-awarded { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-closed { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* Option Livraison Badge */
.badge-delivery-yes {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-weight: 600;
}

.badge-delivery-no {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 600;
}

/* Matrice Comparateur RFQ */
.comparison-matrix-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
}

.comparison-matrix {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.comparison-matrix th,
.comparison-matrix td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
}

.comparison-matrix .th-item-col {
  background: #f8fafc;
  min-width: 250px;
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.comparison-matrix .th-supplier-col {
  background: #f1f5f9;
  min-width: 200px;
  text-align: center;
}

.comparison-matrix .th-supplier-col.winner {
  background: #ecfdf5;
  border-top: 3px solid var(--success);
}

.matrix-best-price {
  background-color: #ecfdf5 !important;
  color: #047857;
  font-weight: 700;
}

.matrix-total-row {
  background: #f8fafc;
  font-weight: 700;
  font-size: var(--font-size-base);
}

.matrix-total-row td {
  border-top: 2px solid var(--border-strong);
}

.matrix-delivery-row {
  background: #fffbeb;
  font-weight: 600;
}

/* Étoiles d'évaluation */
.star-rating {
  display: inline-flex;
  gap: 2px;
  color: #fbbf24;
}

.star-rating .star-empty {
  color: #cbd5e1;
}

/* Formulaires */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: var(--space-1);
}

.form-label .required {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-light);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.form-col {
  flex: 1;
  min-width: 200px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform var(--transition-fast);
}

.modal-backdrop.active .modal-dialog {
  transform: translateY(0);
}

.modal-dialog.modal-lg {
  max-width: 950px;
}

.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-alt);
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Onglets */
.tabs-header {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-light);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Alertes & Bannières */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-info { background: var(--info-light); color: #0369a1; border: 1px solid var(--info-border); }
.alert-success { background: var(--success-light); color: #047857; border: 1px solid var(--success-border); }
.alert-warning { background: var(--warning-light); color: #b45309; border: 1px solid var(--warning-border); }

/* Zone d'éléments d'une campagne (Lignes de devis) */
.item-repeater-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-2);
}

.item-repeater-table th {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  color: var(--text-light);
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-strong);
  text-align: left;
}

.item-repeater-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

/* Cartes de Zone Dangereuse / Critique */
.card-danger {
  border: 1px solid #fecaca;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.08);
}

.card-danger .card-header {
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
}

.card-danger .card-title {
  color: #991b1b;
}

/* Style d'impression */
@media print {
  .sidebar, .topbar, .btn, .modal-backdrop {
    display: none !important;
  }
  body, .app-layout, .main-wrapper, .page-container {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
  .comparison-matrix-container {
    border: 1px solid #000;
  }
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    padding: var(--space-4);
  }
  .page-container {
    padding: var(--space-4);
  }
}


/* ==========================================================================
   PANNEAU DE CONFIGURATION & GESTION DES ACCÈS UTILISATEURS
   ========================================================================== */

.config-subnav {
  display: flex;
  gap: var(--space-2);
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  background: var(--bg-surface);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.config-tab-btn {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-light);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}

.config-tab-btn:hover {
  color: var(--primary);
}

.config-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.badge-role {
  font-size: var(--font-size-xs);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-role-admin { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-role-manager { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-role-viewer { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-role-master { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-weight: 800; }

.topbar-user-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-user-pill:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Identité de l'application - Aperçu */
.app-identity-preview {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  box-shadow: var(--shadow-md);
}

.app-identity-preview .preview-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* ==========================================================================
   FEUILLE DE RAPPORT OFFICIEL & EXPORT PDF (SOCIÉTÉ CLIENT)
   ========================================================================== */

.official-report-sheet {
  background: #ffffff;
  color: #0f172a;
  padding: 30px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin: 0 auto var(--space-6);
  max-width: 1050px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.report-watermark {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 5rem;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.03);
  pointer-events: none;
  white-space: nowrap;
  text-transform: uppercase;
}

.report-client-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
}

.report-client-info h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.report-client-legal-tags {
  font-size: 0.8rem;
  color: #334155;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  font-weight: 500;
}

.report-client-contact {
  text-align: right;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.4;
}

.report-title-banner {
  background: #f1f5f9;
  border-left: 5px solid var(--primary);
  padding: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-title-banner h3 {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.report-table-official {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-5);
  font-size: 0.825rem;
}

.report-table-official th {
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  border: 1px solid #94a3b8;
  padding: 8px 10px;
  text-align: left;
}

.report-table-official td {
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
  color: #1e293b;
  vertical-align: middle;
}

.report-table-official .row-highlight-green {
  background-color: #ecfdf5 !important;
  font-weight: 700;
}

.report-adjudication-box {
  border: 2px solid #059669;
  background: #f0fdf4;
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
}

.report-signatures-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-8);
  page-break-inside: avoid;
}

.report-signature-cell {
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #f8fafc;
}

.report-signature-cell .sig-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.report-signature-cell .sig-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
}

/* RÈGLES IMPRESSION A4 PAYSAGE / PORTRAIT HAUTE QUALITÉ */
@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body, .app-layout, .main-wrapper, .page-container {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: auto !important;
  }

  .sidebar,
  .topbar,
  .btn,
  .modal-backdrop,
  .tabs-header,
  .config-subnav,
  .no-print {
    display: none !important;
  }

  .official-report-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .report-table-official th,
  .report-table-official td {
    border-color: #333333 !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .report-adjudication-box {
    border-color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .report-signatures-grid {
    page-break-inside: avoid !important;
  }
}

/* ==========================================================================
   AUTHENTICATION SCREEN (Masque d'authentification obligatoire)
   ========================================================================== */
.auth-screen-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%);
  z-index: 99999;
  padding: 1.5rem;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  animation: authFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem 0;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.auth-badge-box {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-error-alert {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 0.875rem;
  color: var(--text-light);
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 2.75rem;
  width: 100%;
}

.auth-submit-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.6rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  cursor: pointer;
}

.auth-card-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ==========================================================================
   ROLE CHECKBOXES & PERMISSION BADGES
   ========================================================================== */
.roles-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: var(--bg-surface-alt);
}

.role-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.role-checkbox-item:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.role-checkbox-item input[type="checkbox"] {
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.role-checkbox-content {
  display: flex;
  flex-direction: column;
}

.role-checkbox-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.role-checkbox-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-role {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  margin: 1px 3px 1px 0;
}
.badge-role-admin { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-role-rfq { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-role-quotes { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-role-award { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }
.badge-role-eval { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.badge-role-report { background: #e0e7ff; color: #4338ca; border: 1px solid #a5b4fc; }
.badge-role-view { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* ==========================================================================
   MODULE DRIVE CLOUD & DOCUMENTS AMAYRAF
   ========================================================================== */

.drive-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.drive-header-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.drive-header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.drive-title-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.drive-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drive-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.drive-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.drive-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.drive-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.drive-search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-light);
  pointer-events: none;
}

.drive-search-box input {
  padding: 6px 10px 6px 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  background: var(--bg-surface-alt);
  min-width: 220px;
  transition: all 0.2s;
}

.drive-search-box input:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.drive-view-toggle {
  display: inline-flex;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.btn-toggle {
  border: none;
  background: transparent;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-toggle:hover {
  color: var(--text-main);
}

.btn-toggle.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.drive-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border-subtle);
  font-size: var(--font-size-sm);
}

.breadcrumb-item {
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

.breadcrumb-item:hover {
  background: var(--primary-light);
}

.breadcrumb-item.active {
  color: var(--text-main);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-separator {
  color: var(--text-light);
  font-size: 0.8rem;
}

/* DROPZONE */
.drive-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  background: var(--bg-surface);
  transition: all 0.2s;
  cursor: pointer;
}

.drive-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drive-dropzone.drag-active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.005);
}

.drive-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.drive-dropzone-inner svg {
  color: var(--primary);
}

/* GRILLE DE DOCUMENTS */
.drive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.drive-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.drive-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.drive-card.is-dir:hover {
  background: #f8fafc;
  border-color: #93c5fd;
}

.drive-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) 0;
}

.drive-card-info {
  margin-top: var(--space-1);
}

.drive-card-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-card-meta {
  font-size: var(--font-size-xs);
  color: var(--text-light);
  margin-top: 3px;
}

.drive-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.drive-card:hover .drive-card-actions {
  opacity: 1;
}

.btn-action-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
}

.btn-action-icon:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-action-icon.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* VUE LISTE / TABLEAU */
.drive-table-row {
  cursor: pointer;
  transition: background 0.15s;
}

.drive-table-row:hover {
  background: var(--bg-surface-alt);
}

/* FOOTER STATS */
.drive-footer-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* GESTION DES ACCÈS & RÔLES DRIVE (ACL) */
.drive-acl-legend {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.acl-user-row:hover {
  background: var(--bg-surface-alt);
}

.acl-user-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  transition: all 0.15s;
}

.acl-user-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

