/* ============================================================
   APPRO-NEXTGEN.CSS — Advanced Scanner, Linking & Next-Gen KPI
   SPA DOUROUB ELDJAZAIR — Suite Intégrée
   ============================================================ */

/* Top Scanner Actions Bar (High Density Fit) */
.scanner-banner {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px !important;
  margin-bottom: 10px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.scanner-banner h3 {
  margin: 0 0 0.2rem 0;
  font-size: 14px !important;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #0f172a;
}

.scanner-banner p {
  margin: 0;
  font-size: 11px !important;
  color: #64748b;
}

.btn-scanner-action {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
  border-radius: 6px;
  padding: 5px 12px !important;
  font-weight: 700;
  font-size: 12px !important;
  height: 32px !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(37,99,235,0.25);
  transition: all 0.2s;
  box-sizing: border-box !important;
}

.btn-scanner-action:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37,99,235,0.35);
}

.btn-scanner-dp {
  background: #0d9488;
  border-color: #0d9488;
  box-shadow: 0 1px 3px rgba(13,148,136,0.25);
}

.btn-scanner-dp:hover {
  background: #0f766e;
  box-shadow: 0 3px 8px rgba(13,148,136,0.35);
}

/* Scanner Modal & Progress */
.scanner-modal-content {
  padding: 1rem;
}

.scan-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 1rem 0;
}

.scan-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.2s ease;
}

.scan-log-box {
  background: #0f172a;
  color: #cbd5e1;
  font-family: monospace;
  font-size: 0.78rem;
  padding: 0.75rem;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.5;
  margin: 0.75rem 0;
  border: 1px solid #334155;
}

.scan-log-entry.success { color: #4ade80; }
.scan-log-entry.warn { color: #facc15; }
.scan-log-entry.info { color: #38bdf8; }

/* Demande de Paiement & Linking Badges */
.dp-badge-linked {
  background: rgba(16, 185, 129, 0.15);
  color: #065f46;
  border: 1px solid #10b981;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dp-badge-multi {
  background: rgba(59, 130, 246, 0.15);
  color: #1e40af;
  border: 1px solid #3b82f6;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dp-badge-direct {
  background: rgba(147, 51, 234, 0.15);
  color: #6b21a8;
  border: 1px solid #9333ea;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dp-badge-pending {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

body[data-theme="dark"] .dp-badge-pending {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Linking Modal Layout */
.linking-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.linking-calc-meter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.calc-meter-val {
  font-size: 1.15rem;
  font-weight: 800;
}

.calc-meter-diff.ok { color: #4ade80; }
.calc-meter-diff.diff { color: #f87171; }

.bc-selection-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.bc-selection-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}

.bc-selection-row:hover {
  background: #f8fafc;
}

.bc-selection-row.selected {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
}

/* Next-Gen KPI Dashboard Components */
.kpi-presets-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
}

.btn-kpi-preset {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-kpi-preset:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-kpi-preset.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

/* Payment Delays & Histogram */
.delay-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.delay-card {
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 1.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.delay-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.delay-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.delay-metric-val {
  font-size: 1.8rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.1;
}

.delay-metric-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.delay-buckets-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.delay-bucket {
  padding: 0.5rem;
  border-radius: 6px;
  text-align: center;
}

.delay-bucket .b-val {
  font-size: 1.1rem;
  font-weight: 800;
}

.delay-bucket .b-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
}

.b-green { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.b-blue  { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.b-amber { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.b-red   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

body[data-theme="dark"] .b-green { background: rgba(16, 185, 129, 0.15) !important; color: #34d399 !important; border-color: rgba(16, 185, 129, 0.35) !important; }
body[data-theme="dark"] .b-blue  { background: rgba(59, 130, 246, 0.15) !important; color: #60a5fa !important; border-color: rgba(59, 130, 246, 0.35) !important; }
body[data-theme="dark"] .b-amber { background: rgba(99, 102, 241, 0.15) !important; color: #a5b4fc !important; border-color: rgba(99, 102, 241, 0.35) !important; }
body[data-theme="dark"] .b-red   { background: rgba(220, 38, 38, 0.15) !important; color: #f87171 !important; border-color: rgba(220, 38, 38, 0.35) !important; }

/* Top Purchased Articles Table & Bar */
.top-articles-card {
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.article-rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
}

.article-rank-num {
  width: 24px;
  height: 24px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: #475569;
}

.article-rank-name {
  flex-grow: 1;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
}

.article-rank-name:hover {
  color: #2563eb;
  text-decoration: underline;
}

.article-rank-meter-wrap {
  width: 140px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.article-rank-meter {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 3px;
}

/* Multi-Supplier Comparison Matrix */
.comparison-container {
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.comparison-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.supplier-comp-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  border-top: 4px solid #3b82f6;
  position: relative;
}

.supplier-comp-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}

.comp-metric-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.8rem;
}

.comp-metric-row:last-child {
  border-bottom: none;
}

/* ============================================================
   FINANCIAL INTELLIGENCE & SUPPLIER ADVANCED ANALYTICS
   ============================================================ */
.financial-intel-section {
  margin-bottom: 1.5rem;
}

.fin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.fin-stat-card {
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fin-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.fin-stat-card.creance-accent {
  border-left: 4px solid #ef4444;
}

.fin-stat-card.prevision-accent {
  border-left: 4px solid #3b82f6;
}

.fin-stat-card.consumption-accent {
  border-left: 4px solid #10b981;
}

.fin-stat-card.recurrence-accent {
  border-left: 4px solid #8b5cf6;
}

.fin-stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.fin-stat-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
}

.fin-stat-lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 700;
  margin-top: 0.35rem;
}

.fin-stat-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}

/* Badges for BC Importance & Priority */
.badge-importance {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-imp-critical {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-imp-high {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-imp-normal {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Supplier Intelligence Table */
.fin-table-container {
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.fin-table th {
  background: #f8fafc;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.fin-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.fin-table tr:hover td {
  background: rgba(59, 130, 246, 0.04);
}

/* Prevision & Consumption Timeline Rows */
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.timeline-month-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem;
  text-align: center;
}

.timeline-month-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.timeline-month-val {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.timeline-month-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

/* ============================================================
   COMPLETE DARK THEME OVERRIDES FOR APPRO NEXT-GEN
   ============================================================ */
body[data-theme="dark"] .scanner-banner {
  background: linear-gradient(135deg, #111a2c 0%, #0d1320 100%) !important;
  border: 1px solid var(--line, #26344d) !important;
}

body[data-theme="dark"] .delay-card,
body[data-theme="dark"] .top-articles-card,
body[data-theme="dark"] .comparison-container,
body[data-theme="dark"] .fin-stat-card,
body[data-theme="dark"] .fin-table-container {
  background: var(--surface, #121a2a) !important;
  border-color: var(--line, #26344d) !important;
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .delay-card-title,
body[data-theme="dark"] .delay-metric-val,
body[data-theme="dark"] .top-articles-card h4,
body[data-theme="dark"] .comparison-header h4,
body[data-theme="dark"] .fin-stat-num,
body[data-theme="dark"] .supplier-comp-card h4 {
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .fin-table th {
  background: #172238 !important;
  color: #99a8c2 !important;
  border-bottom-color: #26344d !important;
}

body[data-theme="dark"] .fin-table td {
  border-bottom-color: #1e2c45 !important;
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .fin-table tr:hover td {
  background: rgba(102, 162, 255, 0.08) !important;
}

body[data-theme="dark"] .supplier-comp-card {
  background: #172238 !important;
  border-color: #26344d !important;
}

body[data-theme="dark"] .comp-metric-row {
  border-bottom-color: #26344d !important;
}

body[data-theme="dark"] .timeline-month-box {
  background: #172238 !important;
  border-color: #26344d !important;
}

body[data-theme="dark"] .timeline-month-val {
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .article-rank-row {
  border-bottom-color: #26344d !important;
}

body[data-theme="dark"] .article-rank-num {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .article-rank-name {
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .btn-kpi-preset {
  background: #172238 !important;
  color: #99a8c2 !important;
  border-color: #26344d !important;
}

body[data-theme="dark"] .btn-kpi-preset.active {
  background: #2f6fed !important;
  color: #ffffff !important;
}

body[data-theme="dark"] .badge-imp-critical {
  background: rgba(220, 38, 38, 0.25) !important;
  color: #fca5a5 !important;
  border-color: rgba(220, 38, 38, 0.45) !important;
}

body[data-theme="dark"] .badge-imp-high {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
}

body[data-theme="dark"] .badge-imp-normal {
  background: rgba(59, 130, 246, 0.25) !important;
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
}

body[data-theme="dark"] .fin-table-container h4,
body[data-theme="dark"] .fin-table-title {
  color: var(--text, #eef3ff) !important;
}

body[data-theme="dark"] .fin-search-input {
  background: #172238 !important;
  border-color: #26344d !important;
  color: #eef3ff !important;
}

body[data-theme="dark"] .btn-fin-filter {
  background: #172238 !important;
  border-color: #26344d !important;
  color: #99a8c2 !important;
}

body[data-theme="dark"] .btn-fin-filter.active {
  background: #2f6fed !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
}

/* Interactive Filter Toolbar for Financial Analytics */
.fin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.fin-search-input {
  background: #ffffff;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  min-width: 240px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fin-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.fin-filters-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-fin-filter {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-fin-filter:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-fin-filter.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* ============================================================
   SUIVI BC SLIDE-OVER DRAWER MODAL
   ============================================================ */
.bc-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.bc-drawer-panel {
  width: 100%;
  max-width: 620px;
  height: 100vh;
  background: #ffffff;
  color: #0f172a;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.bc-drawer-backdrop.active .bc-drawer-panel {
  transform: translateX(0);
}

.bc-drawer-head {
  padding: 1.25rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.bc-drawer-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.bc-drawer-head-info h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.bc-drawer-head-info p {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.bc-drawer-close {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.bc-drawer-close:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.bc-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem;
}

.bc-drawer-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
}

[data-theme="dark"] .bc-drawer-panel {
  background: #0f172a;
  color: #f8fafc;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .bc-drawer-head {
  background: #1e293b;
  border-bottom-color: #334155;
}

[data-theme="dark"] .bc-drawer-head-info h3 {
  color: #f8fafc;
}

[data-theme="dark"] .bc-drawer-head-info p {
  color: #94a3b8;
}

[data-theme="dark"] .bc-drawer-close {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

[data-theme="dark"] .bc-drawer-actions {
  border-top-color: #334155;
}

/* ============================================================
   MODERNIZED SUIVI BC TABLE & STATUS CHIPS
   ============================================================ */
.table-shell {
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

[data-theme="dark"] .table-shell {
  border-color: #334155;
  background: #0f172a;
}

#followupTableBody tr {
  transition: background-color 0.15s ease;
}

#followupTableBody tr:hover {
  background-color: rgba(37, 99, 235, 0.03);
}

[data-theme="dark"] #followupTableBody tr:hover {
  background-color: rgba(56, 189, 248, 0.05);
}

#followupTableBody td {
  padding: 0.85rem 0.95rem;
  font-size: 0.84rem;
  vertical-align: middle;
}

.dept-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

[data-theme="dark"] .dept-pill {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-brouillon, .status-pill.status-info, .status-pill.info {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.status-transmis {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-pill.status-late, .status-pill.late {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.status-partiel, .status-pill.status-warn, .status-pill.warn {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.status-receptionne, .status-pill.status-ok, .status-pill.ok {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-cloture, .status-pill.status-valide {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.icon-actions .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.icon-actions .icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   EXECUTIVE REPORTS SAAS DASHBOARD & P2P PIPELINE
   ============================================================ */
.reports-page-header {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .reports-page-header {
  background: #1e293b;
  border-color: #334155;
}

.reports-header-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #2563eb;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.reports-export-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reports-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.report-metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.report-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .report-metric-card {
  background: #1e293b;
  border-color: #334155;
}

.report-metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.report-metric-blue::before { background: linear-gradient(90deg, #2563eb, #38bdf8); }
.report-metric-indigo::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.report-metric-emerald::before { background: linear-gradient(90deg, #10b981, #34d399); }
.report-metric-rose::before { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.report-metric-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

[data-theme="dark"] .report-metric-label {
  color: #94a3b8;
}

.report-metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

[data-theme="dark"] .report-metric-value {
  color: #f8fafc;
}

.report-metric-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 6px;
}

[data-theme="dark"] .report-metric-sub {
  color: #94a3b8;
}

.p2p-pipeline-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .p2p-pipeline-card {
  background: #1e293b;
  border-color: #334155;
}

.p2p-pipeline-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  overflow-x: auto;
}

.p2p-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  flex: 1 1 0;
  min-width: 170px;
  transition: all 0.2s;
}

[data-theme="dark"] .p2p-step {
  background: #0f172a;
  border-color: #334155;
}

.p2p-step:hover {
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.p2p-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.p2p-badge-1 { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.p2p-badge-2 { background: rgba(14, 165, 233, 0.15); color: #0284c7; }
.p2p-badge-3 { background: rgba(136, 19, 55, 0.15); color: #881337; }
.p2p-badge-4 { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.p2p-badge-5 { background: rgba(16, 185, 129, 0.15); color: #059669; }

.p2p-info {
  display: flex;
  flex-direction: column;
}

.p2p-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .p2p-title {
  color: #94a3b8;
}

.p2p-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin: 1px 0;
}

[data-theme="dark"] .p2p-val {
  color: #f8fafc;
}

.p2p-sub {
  font-size: 0.72rem;
  color: #64748b;
}

[data-theme="dark"] .p2p-sub {
  color: #94a3b8;
}

.p2p-arrow {
  color: #94a3b8;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   EXECUTIVE CORPORATE MODAL DIALOGS & SCANNER
   ============================================================ */
.modal-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text, #0f172a);
}

[data-theme="dark"] .modal-card,
body[data-theme="dark"] .modal-card {
  background: #131b2e !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6) !important;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-header {
  background: #1e293b !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .modal-header h3,
body[data-theme="dark"] .modal-header h3 {
  color: #ffffff !important;
}

.modal-header .btn-ghost {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #64748b);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-header .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text, #0f172a);
}

[data-theme="dark"] .modal-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--line, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

[data-theme="dark"] .modal-footer,
body[data-theme="dark"] .modal-footer {
  background: #1e293b !important;
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

/* Scanner Dialog Theme Adaptation */
[data-theme="dark"] .scan-progress-bar-wrap {
  background: #1e293b !important;
}

.scan-log-entry.error {
  color: #f87171 !important;
}


