/* ============================================
   ENHANCEMENTS.CSS - Suivi Achats Premium
   Loaded AFTER styles.css for cascade priority
   ============================================ */

/* === GLOBAL VIEWPORT & HIGH-DENSITY FIT (100% ZOOM DEFAULT) === */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

.app-shell {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* === CORPORATE WHITE TOPBAR === */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  position: sticky;
  top: 0;
  z-index: 200;
}

.topbar-main {
  padding: 0.75rem 1.5rem;
}

.topbar-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-title-group h1,
#appTitle {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.topbar-title-group p,
#appSubtitle {
  font-size: 0.75rem;
  color: #64748b;
}

.brand-badge {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

#topbarLogo {
  height: 36px;
  max-width: 120px;
  border-radius: 0.4rem;
  object-fit: contain;
}

/* Theme selector & buttons on corporate topbar */
.topbar-tools select,
.topbar .tool-inline select,
#themeSelect {
  color: #0f172a;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.topbar-tools select option,
.topbar .tool-inline select option {
  color: #0f172a;
  background: #fff;
}

.topbar .user-chip {
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.82rem;
}

.topbar .btn-soft {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}

.topbar .btn-soft:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.topbar .tool-inline span {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
}


/* === UNIFIED PILL TABBAR === */
.sa-top-tabs, .tabbar:not(#tabbar) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  overflow-x: auto;
}

.tab {
  color: #1e293b;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 6px 16px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.tab .tab-label {
  color: inherit;
  font-weight: 600;
}

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

.tab:hover .tab-label {
  color: #0f172a;
}

.tab.active {
  color: #ffffff !important;
  background: #2563eb !important;
  border: 1px solid #2563eb !important;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35) !important;
  font-weight: 700 !important;
}

.tab.active .tab-label {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.tab-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  color: inherit;
}

.tab.active .tab-icon-badge {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
}

.tab-icon-badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}


/* Only hide the inline BC form on page-followup (edit modal is used instead) */
#page-followup > .panel-entry { display: none; }


/* === KPI PRO CARDS & HIGH-DENSITY GRID === */
.kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
  gap: 8px !important;
}

/* Full-width responsive workspace & high-density layout */
.workspace {
  width: 100% !important;
  max-width: 100% !important;
  margin: 6px auto 16px !important;
  box-sizing: border-box !important;
}

.sa-content {
  padding: 10px 14px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Override original chart grid that's too narrow */
.chart-grid {
  display: block !important;
}

.kpi-pro-card,
.kpi-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border-left: 4px solid transparent;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-pro-card:hover,
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.kpi-pro-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(0,0,0,.03);
}

.kpi-pro-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  stroke: currentColor;
}

.kpi-pro-body { flex: 1; min-width: 0; }

.kpi-pro-value,
.kpi-card .kpi-value,
.kpi-value {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: var(--text, #1e293b);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-pro-label,
.kpi-card .kpi-label,
.kpi-label {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}

.kpi-pro-sub {
  font-size: 0.68rem;
  color: var(--muted, #94a3b8);
  margin-top: 0.1rem;
}


/* Card color variants */
.kpi-blue { border-left-color: #3b82f6; }

.kpi-blue .kpi-pro-icon { background: rgba(59,130,246,.1); color: #3b82f6; }

.kpi-indigo { border-left-color: #6366f1; }

.kpi-indigo .kpi-pro-icon { background: rgba(99,102,241,.1); color: #6366f1; }

.kpi-teal { border-left-color: #0d9488; }

.kpi-teal .kpi-pro-icon { background: rgba(13,148,136,.1); color: #0d9488; }

.kpi-green { border-left-color: #16a34a; }

.kpi-green .kpi-pro-icon { background: rgba(22,163,74,.1); color: #16a34a; }

.kpi-amber { border-left-color: #0284c7; }

.kpi-amber .kpi-pro-icon { background: rgba(2,132,199,.1); color: #0284c7; }

.kpi-orange { border-left-color: #ea580c; }

.kpi-orange .kpi-pro-icon { background: rgba(234,88,12,.1); color: #ea580c; }

.kpi-red { border-left-color: #dc2626; }

.kpi-red .kpi-pro-icon { background: rgba(220,38,38,.1); color: #dc2626; }

.kpi-purple { border-left-color: #9333ea; }

.kpi-purple .kpi-pro-icon { background: rgba(147,51,234,.1); color: #9333ea; }

.kpi-cyan { border-left-color: #06b6d4; }

.kpi-cyan .kpi-pro-icon { background: rgba(6,182,212,.1); color: #06b6d4; }

.kpi-slate { border-left-color: #64748b; }

.kpi-slate .kpi-pro-icon { background: rgba(100,116,139,.1); color: #64748b; }

.kpi-rose { border-left-color: #e11d48; }

.kpi-rose .kpi-pro-icon { background: rgba(225,29,72,.1); color: #e11d48; }

.kpi-emerald { border-left-color: #059669; }

.kpi-emerald .kpi-pro-icon { background: rgba(5,150,105,.1); color: #059669; }

.kpi-sky { border-left-color: #0284c7; }

.kpi-sky .kpi-pro-icon { background: rgba(2,132,199,.1); color: #0284c7; }


/* === COLORED SUMMARY CARDS (suivi BC) === */
.summary-card:nth-child(1) { border-left: 4px solid #2563eb; }

.summary-card:nth-child(1) .summary-value { color: #2563eb; }

.summary-card:nth-child(2) { border-left: 4px solid #059669; }

.summary-card:nth-child(2) .summary-value { color: #059669; }

.summary-card:nth-child(3) { border-left: 4px solid #e11d48; }

.summary-card:nth-child(3) .summary-value { color: #e11d48; }

.summary-card:nth-child(4) { border-left: 4px solid #7c3aed; }

.summary-card:nth-child(4) .summary-value { color: #7c3aed; }

.summary-card:nth-child(5) { border-left: 4px solid #0284c7; }

.summary-card:nth-child(5) .summary-value { color: #0284c7; }

.summary-card:nth-child(6) { border-left: 4px solid #881337; }

.summary-card:nth-child(6) .summary-value { color: #881337; }


/* === SUMMARY CARDS BAR === */
.followup-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
  transition: transform 0.2s, box-shadow 0.2s;
}

body[data-theme="dark"] .summary-card {
  background: #111e38;
  border-color: #1e2c45;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}

.summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

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

.summary-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
  font-weight: 600;
}

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


/* === TABLE & SCROLL CONTAINERS (HIGH DENSITY) === */
.table-container,
.table-shell,
.table-wrap {
  overflow-x: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  border-radius: 8px !important;
}

.followup-table,
.dense-table,
.compact-table {
  min-width: 950px !important;
  width: 100% !important;
  font-size: 11.5px !important;
  border-collapse: separate;
  border-spacing: 0;
}

.followup-table th,
.dense-table th,
.compact-table th {
  white-space: nowrap;
  padding: 8px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #1e293b !important;
  background: #f1f5f9 !important;
  border-bottom: 2px solid #cbd5e1 !important;
  position: sticky;
  top: 0;
  z-index: 1;
  line-height: 1.3 !important;
}

body[data-theme="dark"] .followup-table th,
body[data-theme="dark"] .dense-table th,
body[data-theme="dark"] .compact-table th {
  background: #172339 !important;
  color: #f1f5f9 !important;
  border-bottom: 2px solid #334155 !important;
}

.followup-table td,
.dense-table td,
.compact-table td {
  white-space: nowrap;
  padding: 7px 10px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  vertical-align: middle;
  color: #1e293b !important;
  line-height: 1.3 !important;
}

body[data-theme="dark"] .followup-table td,
body[data-theme="dark"] .dense-table td,
body[data-theme="dark"] .compact-table td {
  color: #f1f5f9 !important;
  border-bottom: 1px solid #1e2c45 !important;
}

.followup-table tbody tr { transition: background 0.15s; }

.followup-table tbody tr:nth-child(odd) { background: #ffffff !important; }
.followup-table tbody tr:nth-child(even) { background: #f8fafc !important; }
.followup-table tbody tr:hover { background: #f1f5f9 !important; }

body[data-theme="dark"] .followup-table tbody tr:nth-child(odd) { background: #0c1629 !important; }
body[data-theme="dark"] .followup-table tbody tr:nth-child(even) { background: #111e38 !important; }
body[data-theme="dark"] .followup-table tbody tr:hover { background: #1a2a4a !important; }

.followup-table tbody tr:nth-child(odd) td.actions-cell { background: #ffffff !important; }
.followup-table tbody tr:nth-child(even) td.actions-cell { background: #f8fafc !important; }
.followup-table tbody tr:hover td.actions-cell { background: #f1f5f9 !important; }

body[data-theme="dark"] .followup-table tbody tr:nth-child(odd) td.actions-cell { background: #0c1629 !important; }
body[data-theme="dark"] .followup-table tbody tr:nth-child(even) td.actions-cell { background: #111e38 !important; }
body[data-theme="dark"] .followup-table tbody tr:hover td.actions-cell { background: #1a2a4a !important; }


/* === ACTIONS COLUMN === */
.actions-cell, thead th:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface, #fff);
  border-left: 2px solid var(--line, #e2e8f0);
  padding: 0.25rem 0.35rem;
  white-space: nowrap;
  opacity: 1;
  max-width: 200px;
}


.icon-actions {
  display: flex;
  gap: 1px;
  flex-wrap: nowrap;
  justify-content: center;
}

.icon-actions .icon-btn {
  padding: 2px;
  min-width: 22px;
  min-height: 22px;
}

/* BC Table Action Buttons — Clean Gruna / Indigo / Emerald / Ruby */
.followup-table .icon-actions {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}

.followup-table .icon-btn,
.followup-table .view-bc-btn {
  border-radius: 6px !important;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
  padding: 0 !important;
  border-width: 1px !important;
}

.followup-table .icon-svg,
.followup-table .icon-svg svg {
  width: 13px !important;
  height: 13px !important;
}

/* Details: Indigo */
.followup-table .view-bc-btn,
.followup-table .icon-btn[data-action="view-bc"] {
  color: #4f46e5 !important;
  background: #eef2ff !important;
  border-color: #c7d2fe !important;
}
.followup-table .view-bc-btn:hover,
.followup-table .icon-btn[data-action="view-bc"]:hover {
  background: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
  transform: scale(1.08);
}
body[data-theme="dark"] .followup-table .view-bc-btn,
body[data-theme="dark"] .followup-table .icon-btn[data-action="view-bc"] {
  color: #a5b4fc !important;
  background: rgba(99, 102, 241, 0.18) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
}
body[data-theme="dark"] .followup-table .view-bc-btn:hover,
body[data-theme="dark"] .followup-table .icon-btn[data-action="view-bc"]:hover {
  background: #6366f1 !important;
  color: #ffffff !important;
}

/* Edit: Blue */
.followup-table .icon-btn.icon-edit,
.followup-table .icon-btn[data-action="edit-bc"] {
  color: #1d4ed8 !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}
.followup-table .icon-btn.icon-edit:hover,
.followup-table .icon-btn[data-action="edit-bc"]:hover {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  transform: scale(1.08);
}
body[data-theme="dark"] .followup-table .icon-btn.icon-edit,
body[data-theme="dark"] .followup-table .icon-btn[data-action="edit-bc"] {
  color: #93c5fd !important;
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
}
body[data-theme="dark"] .followup-table .icon-btn.icon-edit:hover,
body[data-theme="dark"] .followup-table .icon-btn[data-action="edit-bc"]:hover {
  background: #2563eb !important;
  color: #ffffff !important;
}

/* Payments: Emerald */
.followup-table .icon-btn.icon-pay,
.followup-table .icon-btn[data-action="pay-bc"] {
  color: #047857 !important;
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}
.followup-table .icon-btn.icon-pay:hover,
.followup-table .icon-btn[data-action="pay-bc"]:hover {
  background: #047857 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  transform: scale(1.08);
}
body[data-theme="dark"] .followup-table .icon-btn.icon-pay,
body[data-theme="dark"] .followup-table .icon-btn[data-action="pay-bc"] {
  color: #34d399 !important;
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
body[data-theme="dark"] .followup-table .icon-btn.icon-pay:hover,
body[data-theme="dark"] .followup-table .icon-btn[data-action="pay-bc"]:hover {
  background: #059669 !important;
  color: #ffffff !important;
}

/* Delete: Ruby / Gruna */
.followup-table .icon-btn.icon-delete,
.followup-table .icon-btn[data-action="delete-bc"] {
  color: #9f1239 !important;
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
}
.followup-table .icon-btn.icon-delete:hover,
.followup-table .icon-btn[data-action="delete-bc"]:hover {
  background: #9f1239 !important;
  color: #ffffff !important;
  border-color: #9f1239 !important;
  transform: scale(1.08);
}
body[data-theme="dark"] .followup-table .icon-btn.icon-delete,
body[data-theme="dark"] .followup-table .icon-btn[data-action="delete-bc"] {
  color: #fb7185 !important;
  background: rgba(159, 18, 57, 0.22) !important;
  border-color: rgba(159, 18, 57, 0.4) !important;
}
body[data-theme="dark"] .followup-table .icon-btn.icon-delete:hover,
body[data-theme="dark"] .followup-table .icon-btn[data-action="delete-bc"]:hover {
  background: #be123c !important;
  color: #ffffff !important;
}




/* === INTERACTIVE CHARTS === */
.interactive-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 900px) {
  .interactive-charts-grid { grid-template-columns: 1fr; }

}

.chart-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text, #1e293b);
  margin-bottom: 0.15rem;
}

.chart-subtitle {
  font-size: 0.72rem;
  color: var(--muted, #94a3b8);
  margin-bottom: 1rem;
}


/* Donut */
.donut-wrapper { display: flex; align-items: center; gap: 1.5rem; justify-content: center; }

.donut-chart {
  width: 140px; height: 140px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.donut-hole {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--surface, #fff);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  font-size: 1.5rem; font-weight: 800; color: var(--text, #1e293b);
  line-height: 1.1;
}

.donut-hole span { font-size: 0.65rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }

.donut-legend { display: flex; flex-direction: column; gap: 0.75rem; }

.legend-item { font-size: 0.82rem; color: var(--text); display: flex; align-items: flex-start; gap: 0.5rem; line-height: 1.4; }

.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; margin-top: 3px; }


/* Horizontal Bars */
.hbar-chart { display: flex; flex-direction: column; gap: 0.45rem; }

.hbar-row { display: flex; align-items: center; gap: 0.5rem; cursor: default; }

.hbar-row:hover .hbar-fill { filter: brightness(1.1); }

.hbar-label { width: 130px; flex-shrink: 0; font-size: 0.72rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }

.hbar-track { flex: 1; height: 24px; background: var(--surface-3, #f1f5f9); border-radius: 0.35rem; overflow: hidden; }

.hbar-fill {
  height: 100%; border-radius: 0.35rem; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 0.4rem; min-width: 20px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1), filter 0.2s;
  animation: barGrow 0.8s cubic-bezier(0.4,0,0.2,1);
}

@keyframes barGrow { from { width: 0; }
 }

.hbar-value { font-size: 0.65rem; color: #fff; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.2); }


/* Trend (vertical bars) */
.trend-chart { display: flex; align-items: flex-end; gap: 0.25rem; height: 180px; padding-top: 1.5rem; }

.trend-bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; cursor: default; position: relative; }

.trend-bar {
  width: 100%; max-width: 48px; border-radius: 0.35rem 0.35rem 0 0;
  position: relative; display: flex; justify-content: center;
  transition: height 0.8s cubic-bezier(0.4,0,0.2,1), filter 0.2s;
  animation: barGrowV 0.8s cubic-bezier(0.4,0,0.2,1);
  min-height: 4px;
}

@keyframes barGrowV { from { height: 0; }
 }

.trend-bar-group:hover .trend-bar { filter: brightness(1.15); }

.trend-count { position: absolute; top: -18px; font-size: 0.65rem; font-weight: 700; color: var(--text); }

.trend-label { font-size: 0.62rem; color: var(--muted); margin-top: 0.3rem; font-weight: 600; }


/* Status bars */
.status-chart { display: flex; flex-direction: column; gap: 0.4rem; }

.status-row { display: flex; align-items: center; gap: 0.4rem; cursor: default; }

.status-row:hover .status-fill { filter: brightness(1.1); }

.status-label-text { width: 110px; flex-shrink: 0; font-size: 0.72rem; color: var(--text); text-align: right; white-space: nowrap; }

.status-track { flex: 1; height: 22px; background: var(--surface-3, #f1f5f9); border-radius: 0.3rem; overflow: hidden; }

.status-fill {
  height: 100%; border-radius: 0.3rem; display: flex; align-items: center; padding-left: 0.4rem;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1), filter 0.2s;
  animation: barGrow 0.8s cubic-bezier(0.4,0,0.2,1); min-width: 8px;
}

.status-count { font-size: 0.62rem; color: #fff; font-weight: 700; }

.status-pct { width: 35px; font-size: 0.7rem; font-weight: 700; color: var(--muted); text-align: right; }


/* === AI WIDGET (ANIMATED ORBITING LOGO) === */
.ai-widget {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-widget-lg { width: 130px; height: 130px; }
.ai-widget-sm { width: 36px; height: 36px; }
.ai-widget-sm .ai-core {
  font-size: 20px;
  background: linear-gradient(135deg, #00d4aa, #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(0,212,170,.3));
}
.ai-widget-sm .ai-orbit::before, .ai-widget-sm .ai-orbit::after,
.ai-widget-sm .ai-orbit-2::before, .ai-widget-sm .ai-orbit-2::after {
  width: 4px; height: 4px;
}
.ai-widget-xs { width: 28px; height: 28px; }
.ai-widget-xs .ai-core {
  font-size: 16px;
  background: linear-gradient(135deg, #00d4aa, #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(0,212,170,.3));
}
.ai-widget-xs .ai-orbit::before, .ai-widget-xs .ai-orbit::after,
.ai-widget-xs .ai-orbit-2::before, .ai-widget-xs .ai-orbit-2::after {
  width: 3px; height: 3px;
}
.ai-core { font-weight: 900; font-family: 'Courier New', monospace; z-index: 3; position: relative; }
.ai-core::before { content: 'A'; }
.ai-widget-lg .ai-core {
  font-size: 62px;
  background: linear-gradient(135deg, #00d4aa 0%, #00b4d8 30%, #7c3aed 60%, #f59e0b 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: coreGradient 3s ease infinite;
  filter: drop-shadow(0 0 12px rgba(0,212,170,.4)) drop-shadow(0 0 30px rgba(124,58,237,.2));
}
@keyframes coreGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.ai-orbit {
  position: absolute; top: 50%; left: 50%;
  width: 100%; height: 100%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(0,212,170,.3);
  border-radius: 50%;
  animation: spinOrbit 8s linear infinite;
  pointer-events: none;
}
.ai-orbit::before, .ai-orbit::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; }
.ai-orbit::before { top: -4px; left: calc(50% - 4px); background: #00d4aa; box-shadow: 0 0 12px #00d4aa, 0 0 25px rgba(0,212,170,.5); }
.ai-orbit::after { bottom: -4px; left: calc(50% - 4px); background: #f59e0b; box-shadow: 0 0 12px #f59e0b, 0 0 25px rgba(245,158,11,.5); }
.ai-orbit-2 { width: 68%; height: 68%; border: 2px solid rgba(124,58,237,.25); animation: spinOrbit 5s linear infinite reverse; }
.ai-orbit-2::before { background: #7c3aed !important; box-shadow: 0 0 12px #7c3aed, 0 0 25px rgba(124,58,237,.5) !important; }
.ai-orbit-2::after { background: #00b4d8 !important; box-shadow: 0 0 12px #00b4d8, 0 0 25px rgba(0,180,216,.5) !important; }
@keyframes spinOrbit { 100% { transform: translate(-50%, -50%) rotate(360deg); } }
.ai-ring3 {
  position: absolute; top: 50%; left: 50%;
  width: 115%; height: 115%;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(0,212,170,.15);
  border-radius: 50%;
  animation: spinOrbit 15s linear infinite;
  pointer-events: none;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* AI Auto-Cycling Effects (30 Animations) */
.ai-fx-1 { animation: fxPulse 1.2s ease-in-out infinite; }
@keyframes fxPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
.ai-fx-2 { animation: fxSpin 1.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes fxSpin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
.ai-fx-3 { animation: fxBounce 0.8s ease infinite; }
@keyframes fxBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.ai-fx-4 { animation: fxShrink 2s ease-in-out infinite alternate; }
@keyframes fxShrink { 0%{transform:scale(1)} 100%{transform:scale(0.85)} }
.ai-fx-5 .ai-core { animation: fxExplodeCore 2s ease infinite alternate; }
.ai-fx-5 .ai-orbit { animation: fxExplodeOrbit 2s ease infinite alternate; }
@keyframes fxExplodeCore { 0%{transform:scale(1)} 100%{transform:scale(1.4)} }
@keyframes fxExplodeOrbit { 0%{transform:translate(-50%,-50%) scale(1)} 100%{transform:translate(-50%,-50%) scale(1.3)} }
.ai-fx-6 { animation: fxRubber 1s ease infinite; }
@keyframes fxRubber { 0%{transform:scaleX(1) scaleY(1)} 30%{transform:scaleX(1.2) scaleY(0.8)} 60%{transform:scaleX(0.85) scaleY(1.15)} 100%{transform:scaleX(1) scaleY(1)} }
.ai-fx-7 { animation: fxSkew 1.5s ease-in-out infinite alternate; }
@keyframes fxSkew { 0%{transform:skewX(0) skewY(0)} 100%{transform:skewX(10deg) skewY(-5deg)} }
.ai-fx-8 { animation: fxFlipX 1.2s ease-in-out forwards; perspective: 500px; }
@keyframes fxFlipX { 0%{transform:rotateX(0)} 100%{transform:rotateX(360deg)} }
.ai-fx-9 { animation: fxFlipY 1.2s ease-in-out forwards; }
@keyframes fxFlipY { 0%{transform:rotateY(0)} 100%{transform:rotateY(360deg)} }
.ai-fx-10 { animation: fxSwing 1s ease-in-out infinite; transform-origin: top center; }
@keyframes fxSwing { 0%,100%{transform:rotate(0)} 25%{transform:rotate(12deg)} 75%{transform:rotate(-12deg)} }
.ai-fx-11 { animation: fxWobble 1.2s ease-in-out infinite; }
@keyframes fxWobble { 0%,100%{transform:translateX(0)} 15%{transform:translateX(-6px)} 30%{transform:translateX(5px)} 45%{transform:translateX(-3px)} }
.ai-fx-12 { animation: fxJello 1s ease-in-out infinite; }
@keyframes fxJello { 0%,100%{transform:skewX(0) skewY(0)} 22%{transform:skewX(-8deg) skewY(-8deg)} 33%{transform:skewX(4deg) skewY(4deg)} }
.ai-fx-13 { animation: fxHeart 1.3s ease-in-out infinite; }
@keyframes fxHeart { 0%,100%{transform:scale(1)} 14%{transform:scale(1.15)} 28%{transform:scale(1)} 42%{transform:scale(1.1)} }
.ai-fx-14 { animation: fxFlash 1s ease infinite; }
@keyframes fxFlash { 0%,50%,100%{opacity:1} 25%,75%{opacity:0.4} }
.ai-fx-15 { animation: fxTada 1s ease-in-out infinite; }
@keyframes fxTada { 0%,100%{transform:scale(1) rotate(0)} 20%{transform:scale(0.9) rotate(-3deg)} 40%,60%{transform:scale(1.1) rotate(3deg)} 80%{transform:scale(1.05) rotate(-2deg)} }
.ai-fx-16 { animation: fxHyper 0.4s linear infinite; }
@keyframes fxHyper { 100%{transform:rotate(360deg)} }
.ai-fx-17 { animation: fxFloat 2s ease-in-out infinite; }
@keyframes fxFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.ai-fx-18 .ai-orbit { border-color: #00d4aa; box-shadow: 0 0 16px #00d4aa; animation: spinOrbit 0.8s linear infinite; }
.ai-fx-18 .ai-orbit-2 { border-color: #7c3aed; box-shadow: 0 0 16px #7c3aed; animation: spinOrbit 0.5s linear infinite reverse; }
.ai-fx-19 .ai-core { animation: fxColorShift 0.8s linear infinite; }
@keyframes fxColorShift { 0%{filter:hue-rotate(0)} 100%{filter:hue-rotate(360deg)} }
.ai-fx-20 { animation: fxScaleRot 2s ease-in-out infinite; }
@keyframes fxScaleRot { 0%{transform:scale(1) rotate(0)} 50%{transform:scale(1.2) rotate(180deg)} 100%{transform:scale(1) rotate(360deg)} }
.ai-fx-21 { animation: fxPulse 0.5s ease infinite; }
.ai-fx-22 { animation: fxBounce 0.6s ease infinite, fxSpin 2s linear infinite; }
.ai-fx-23 .ai-core { animation: fxExplodeCore 2.5s ease infinite alternate; }
.ai-fx-24 { animation: fxRubber 0.7s ease infinite; filter: drop-shadow(0 0 10px #00d4aa); }
.ai-fx-25 { animation: fxSwing 0.6s ease infinite; filter: drop-shadow(0 0 10px #7c3aed); }
.ai-fx-26 { animation: fxWobble 0.9s ease infinite; filter: hue-rotate(90deg); }
.ai-fx-27 { animation: fxJello 0.7s ease infinite; filter: hue-rotate(180deg); }
.ai-fx-28 { animation: fxTada 0.8s ease infinite; filter: drop-shadow(0 0 12px #f59e0b); }
.ai-fx-29 { animation: fxHeart 0.9s ease infinite; filter: hue-rotate(270deg); }
.ai-fx-30 { animation: fxFloat 1.2s ease infinite, fxSpin 2s linear infinite; }


/* === LOGIN SCREEN === */
.login-shell {
  background: #f8fafc;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  border: 1px solid #e2e8f0;
  max-width: 440px;
  padding: 2.25rem 2rem;
}

.login-shell input {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.login-shell .btn-primary {
  background: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 8px;
  font-weight: 700;
}


/* === PAGINATION === */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.4rem 0;
}


/* === KPI FILTER BAR === */
.kpi-filter-bar {
  background-color: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}


/* === NOUVEAU BC BUTTON === */
.add-bc-trigger {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}


/* === DETAIL MODAL === */
.modal-xl { max-width: 900px; width: 95vw; }

.detail-section { margin-bottom: 1rem; }

.detail-section h4 { font-size: 0.85rem; font-weight: 700; color: var(--primary, #3b82f6); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.03em; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem; }

.detail-item { background: var(--surface-2, #f8fafc); padding: 0.5rem 0.65rem; border-radius: 0.4rem; border-left: 3px solid var(--primary, #3b82f6); }

.detail-item .d-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.detail-item .d-value { font-size: 0.9rem; font-weight: 700; color: var(--text); }

.detail-articles-table { width: 100%; font-size: 0.8rem; border-collapse: collapse; }

.detail-articles-table th { background: var(--surface-2, #f1f5f9); padding: 0.4rem 0.5rem; text-align: left; font-size: 0.7rem; text-transform: uppercase; }

.detail-articles-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line, #e8edf2); }


/* === PILLS (department management) === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  font-size: 0.78rem;
  color: var(--text);
  border: 1px solid var(--line, #e2e8f0);
}

.pill-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.pill-remove:hover { color: #e11d48; }


/* === CHART FULLSCREEN OVERLAY === */
#chartFullscreenOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  padding: 2rem;
  overflow-y: auto;
  animation: fadeIn 0.25s ease;
}

#chartFullscreenOverlay.active { display: flex; align-items: center; justify-content: center; }

@keyframes fadeIn { from { opacity: 0; }
 to { opacity: 1; }
 }

#chartFullscreenContent {
  width: 90vw;
  max-width: 1200px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface, #fff);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn { from { transform: scale(0.85); opacity: 0; }
 to { transform: scale(1); opacity: 1; }
 }

#chartFullscreenContent .chart-panel,
#chartFullscreenContent .fleet-card,
#chartFullscreenContent .fleet-chart-panel {
  border: none;
  box-shadow: none;
  padding: 0;
}

#chartFullscreenContent .hbar-track { height: 32px; }

#chartFullscreenContent .trend-chart { height: 300px; }

#chartFullscreenContent .donut-chart { width: 200px; height: 200px; }

#chartFullscreenContent .donut-hole { width: 120px; height: 120px; font-size: 2rem; }

#chartFullscreenClose {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  color: rgba(255,255,255,.7);
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 10000;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,.1);
  transition: all 0.2s;
}

#chartFullscreenClose:hover { color: #fff; background: rgba(255,255,255,.2); }


/* Double-click hint on chart panels */
.chart-panel, .fleet-chart-panel, .fleet-card {
  cursor: pointer;
  position: relative;
}

.chart-panel:hover::after, .fleet-chart-panel:hover::after {
  content: 'Double-cliquez pour agrandir';
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  font-size: 0.6rem;
  color: var(--muted, #94a3b8);
  background: var(--surface-2, #f1f5f9);
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  pointer-events: none;
  opacity: 0.8;
}


/* === DA VALIDATION & DELIVERY ACTION ICONS === */
.btn-open-validate-da {
  color: #1d4ed8 !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-open-validate-da:hover {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  transform: scale(1.08);
}

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

body[data-theme="dark"] .btn-open-validate-da:hover {
  background: #2563eb !important;
  color: #ffffff !important;
}

.btn-open-deliver-bc {
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-open-deliver-bc:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.status-valide {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  font-weight: 600;
}

.status-service {
  background: rgba(99, 102, 241, 0.12) !important;
  color: #4f46e5 !important;
  border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

.status-achat {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #2563eb !important;
  border: 1px solid rgba(59, 130, 246, 0.25) !important;
}


/* === MULTI-SELECT DROPDOWN === */
.multi-select-container {
  position: relative;
  display: inline-block;
  min-width: 170px;
  max-width: 260px;
}

.multi-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text, #1e293b);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.multi-select-trigger:hover, .multi-select-trigger:focus {
  border-color: var(--primary, #3b82f6);
  outline: none;
}

.multi-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  text-align: left;
}

.multi-select-arrow {
  font-size: 0.75rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 290px;
  max-width: 90vw;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 500;
  padding: 0.5rem;
  box-sizing: border-box;
}

.multi-select-dropdown.hidden {
  display: none !important;
}

.multi-select-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.multi-select-search {
  width: 100%;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 4px;
  box-sizing: border-box;
}

.multi-select-quick-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  padding: 0 0.2rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary, #3b82f6);
  cursor: pointer;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-link:hover {
  text-decoration: underline;
}

.multi-select-list {
  max-height: 240px;
  overflow-y: auto;
  padding-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.multi-select-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  color: var(--text, #1e293b);
}

.multi-select-item:hover {
  background: var(--surface-2, #f1f5f9);
}

.multi-select-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary, #3b82f6);
  flex-shrink: 0;
}

.multi-select-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   EXECUTIVE REPORTS & PAGE ENHANCEMENTS — ULTRA-ELEGANT SUITE
   ============================================================ */

/* Executive Reports Summary 4 Cards */
.reports-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 1200px) {
  .reports-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}

@media (max-width: 640px) {
  .reports-summary-grid { grid-template-columns: 1fr; }

}


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

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

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

.report-metric-blue::before { background: #2563eb; }

.report-metric-emerald::before { background: #10b981; }

.report-metric-amber::before { background: #0284c7; }

.report-metric-purple::before { background: #8b5cf6; }


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

.report-metric-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.report-metric-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.4rem;
  font-weight: 500;
}


/* Analytical Breakdown Grid */
.reports-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .reports-breakdown-grid { grid-template-columns: 1fr; }

}


.reports-card,
#page-reports .panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.reports-card .panel-title-row h3,
#page-reports .panel-title-row h3 {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reports-breakdown-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.reports-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.reports-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.reports-bar-name {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reports-bar-amount {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.reports-bar-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.reports-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transition: width 0.6s ease;
}

.reports-bar-fill.secondary {
  background: linear-gradient(90deg, #0d9488, #10b981);
}


/* Executive Key Indicators 2-col Grid */
.reports-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .reports-metrics-grid { grid-template-columns: 1fr; }

}

.reports-metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.reports-metric-item-info {
  display: flex;
  flex-direction: column;
}

.reports-metric-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
}

.reports-metric-item-desc {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.reports-metric-item-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #2563eb;
  white-space: nowrap;
}


/* Enhanced Filter Bar for Suivi BC and Paiements (Compact Flexible Wrap) */
.filters-grid-compact,
.premium-filters-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: flex-end !important;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.filters-grid-compact > *,
.filters-grid-compact input,
.filters-grid-compact select,
.filters-grid-compact .multi-select-container {
  flex: 1 1 120px !important;
  min-width: 110px !important;
}

.filters-grid-compact input,
.filters-grid-compact select,
.filters-grid-compact .multi-select-trigger {
  height: 32px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 6px;
  box-sizing: border-box !important;
}

.filters-grid-compact input:focus,
.filters-grid-compact select:focus,
.filters-grid-compact .multi-select-trigger:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filters-grid-compact .btn,
.filters-grid-compact button {
  height: 32px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  flex: 0 0 auto !important;
}

/* ============================================================
   EXECUTIVE MODERN THEME, GLASSMORPHISM & STATUS BADGES
   ============================================================ */
.panel, .card, .section-card, .form-card, .chart-card, .reports-card {
  backdrop-filter: blur(12px);
  border-radius: 10px !important;
  padding: 12px 14px !important;
  margin-bottom: 10px !important;
  box-shadow: 0 2px 12px -2px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.page-header {
  padding: 8px 12px !important;
  margin-bottom: 8px !important;
  border-radius: 10px !important;
}

.chart-card:hover, .reports-card:hover {
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.08);
}


/* Status Badges */
.badge-status, .status-pill, .tag, .mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 18px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Validé / Réceptionné / Soldé (Success) */
.badge-status.valide, .badge-status.paye, .badge-status.receptionne, .badge-status.solde,
.status-pill.status-valide, .status-pill.status-ok, .status-pill.ok,
.status-valide, .status-receptionne, .tag-success {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

body[data-theme="dark"] .badge-status.valide,
body[data-theme="dark"] .badge-status.paye,
body[data-theme="dark"] .badge-status.receptionne,
body[data-theme="dark"] .badge-status.solde,
body[data-theme="dark"] .status-pill.status-valide,
body[data-theme="dark"] .status-pill.status-ok,
body[data-theme="dark"] .status-pill.ok,
body[data-theme="dark"] .status-valide,
body[data-theme="dark"] .status-receptionne,
body[data-theme="dark"] .tag-success {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(52, 211, 153, 0.3) !important;
}

/* En attente DA / Transmis / En cours (Pending) */
.badge-status.en_cours, .badge-status.engage, .badge-status.attente, .badge-status.transmis, .badge-status.partiel,
.status-pill.status-en_cours, .status-pill.status-transmis, .status-pill.status-partiel, .status-pill.status-warn,
.status-pill.warn, .delay-pill.warn, .alert-pill.warn,
.status-transmis, .status-partiel, .status-service, .status-achat, .tag-primary, .tag-warn {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

body[data-theme="dark"] .badge-status.en_cours,
body[data-theme="dark"] .badge-status.engage,
body[data-theme="dark"] .badge-status.attente,
body[data-theme="dark"] .badge-status.transmis,
body[data-theme="dark"] .badge-status.partiel,
body[data-theme="dark"] .status-pill.status-en_cours,
body[data-theme="dark"] .status-pill.status-transmis,
body[data-theme="dark"] .status-pill.status-partiel,
body[data-theme="dark"] .status-pill.status-warn,
body[data-theme="dark"] .status-pill.warn,
body[data-theme="dark"] .delay-pill.warn,
body[data-theme="dark"] .alert-pill.warn,
body[data-theme="dark"] .status-transmis,
body[data-theme="dark"] .status-partiel,
body[data-theme="dark"] .status-service,
body[data-theme="dark"] .status-achat,
body[data-theme="dark"] .tag-primary,
body[data-theme="dark"] .tag-warn {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Retard / Alerte / Bloqué (Urgent) */
.badge-status.retard, .badge-status.alerte, .badge-status.bloque,
.status-pill.status-retard, .status-pill.status-late, .status-pill.late,
.delay-pill.late, .delay-pill.danger, .tag-danger, .badge-imp-critical {
  background: #fff1f2 !important;
  color: #9f1239 !important;
  border: 1px solid #fecdd3 !important;
}

body[data-theme="dark"] .badge-status.retard,
body[data-theme="dark"] .badge-status.alerte,
body[data-theme="dark"] .badge-status.bloque,
body[data-theme="dark"] .status-pill.status-retard,
body[data-theme="dark"] .status-pill.status-late,
body[data-theme="dark"] .status-pill.late,
body[data-theme="dark"] .delay-pill.late,
body[data-theme="dark"] .delay-pill.danger,
body[data-theme="dark"] .tag-danger,
body[data-theme="dark"] .badge-imp-critical {
  background: rgba(159, 18, 57, 0.2) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(251, 113, 133, 0.35) !important;
}

/* Brouillon / Neutre */
.badge-status.draft, .badge-status.brouillon, .badge-status.cloture,
.status-pill.status-brouillon, .status-pill.status-info, .status-pill.status-cloture,
.status-brouillon, .status-cloture, .tag-muted, .delay-pill.on_time {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

body[data-theme="dark"] .badge-status.draft,
body[data-theme="dark"] .badge-status.brouillon,
body[data-theme="dark"] .badge-status.cloture,
body[data-theme="dark"] .status-pill.status-brouillon,
body[data-theme="dark"] .status-pill.status-info,
body[data-theme="dark"] .status-pill.status-cloture,
body[data-theme="dark"] .status-brouillon,
body[data-theme="dark"] .status-cloture,
body[data-theme="dark"] .tag-muted,
body[data-theme="dark"] .delay-pill.on_time {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}

/* BC Importance / Priority Pills */
.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-high {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

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

.badge-imp-normal {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

body[data-theme="dark"] .badge-imp-normal {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}

/* BC Page Primary Buttons & Overhauls */
#page-followup #btnOpenNewBcDrawer,
#page-followup .btn-primary {
  background: #881337 !important;
  color: #ffffff !important;
  border: 1px solid #9f1239 !important;
  box-shadow: 0 2px 8px rgba(136, 19, 55, 0.25) !important;
  transition: all 0.2s ease !important;
}

#page-followup #btnOpenNewBcDrawer:hover,
#page-followup .btn-primary:hover {
  background: #9f1239 !important;
  border-color: #be123c !important;
  box-shadow: 0 4px 14px rgba(136, 19, 55, 0.35) !important;
  transform: translateY(-1px);
}

#page-followup .filters-grid-compact select,
#page-followup .filters-grid-compact input {
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}

body[data-theme="dark"] #page-followup .filters-grid-compact select,
body[data-theme="dark"] #page-followup .filters-grid-compact input {
  background: #162444 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

body[data-theme="dark"] .actions-cell,
body[data-theme="dark"] thead th:last-child {
  background: #111e38 !important;
  border-left: 2px solid #1e2c45 !important;
}


/* === DARK THEME EXECUTIVE SYSTEM === */
body[data-theme="dark"] .topbar {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] #appTitle,
body[data-theme="dark"] .topbar-title-group h1 {
  color: #f8fafc;
}

body[data-theme="dark"] #appSubtitle,
body[data-theme="dark"] .topbar-title-group p {
  color: #94a3b8;
}

body[data-theme="dark"] .topbar-tools select,
body[data-theme="dark"] #themeSelect {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

body[data-theme="dark"] .topbar .user-chip {
  background: #1e293b;
  color: #38bdf8;
  border-color: #334155;
}

body[data-theme="dark"] .topbar .btn-soft {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

body[data-theme="dark"] .tabbar {
  background: #111e38;
  border-top: 1px solid #1e293b;
  border-bottom: 1px solid #223863;
}

body[data-theme="dark"] .tab {
  color: #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 9999px !important;
}

body[data-theme="dark"] .tab:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}

body[data-theme="dark"] .tab.active {
  color: #ffffff !important;
  background: #2563eb !important;
  border: 1px solid #3b82f6 !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5) !important;
}

body[data-theme="dark"] .tab .tab-label {
  color: inherit !important;
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .chart-card,
body[data-theme="dark"] .reports-card,
body[data-theme="dark"] .filters-grid-compact {
  background: #111e38;
  border-color: #223863;
  color: #f8fafc;
}

body[data-theme="dark"] .filters-grid-compact input,
body[data-theme="dark"] .filters-grid-compact select {
  background: #162444;
  color: #f8fafc;
  border-color: #334155;
}

body[data-theme="dark"] .report-metric-card {
  background: #162444;
  border-color: #223863;
}

body[data-theme="dark"] .reports-bar-track {
  background: #1e293b;
}

body[data-theme="dark"] .reports-metric-item {
  background: #162444;
  border-color: #223863;
}

body[data-theme="dark"] .reports-metric-item-title,
body[data-theme="dark"] .reports-bar-name {
  color: #f8fafc;
}

body[data-theme="dark"] .reports-metric-item-desc {
  color: #94a3b8;
}


/* ============================================================
   PRINT / PDF LAYOUT — EXECUTIVE REPORT GENERATION
   ============================================================ */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
  }

  .topbar, .tabbar, .toolbar-actions, .kpi-filter-bar,
  #printReportsBtn, #exportExecSummaryBtn, #exportGrandLivreBcBtn, #exportBordereauDpBtn,
  .btn, .tool-inline, .user-chip, #chartModalBackdrop {
    display: none !important;
  }

  .app-shell, .workspace, .page {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .page:not(.active) {
    display: none !important;
  }

  .reports-page-header {
    border-bottom: 2px solid #0284c7 !important;
    padding-bottom: 12px !important;
    margin-bottom: 16px !important;
  }

  .reports-card, .panel {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 15px !important;
  }

  .report-metric-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
  }

  .reports-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
  }

  .reports-breakdown-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 15px !important;
    break-inside: avoid;
  }

}



/* ============================================================
   LUXURY EXECUTIVE GRUNA / GARNET PALETTE & TYPOGRAPHY
   ============================================================ */
body, button, input, select, textarea {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

:root {
  --gruna: #881337;
  --gruna-hover: #9f1239;
  --primary: #2563eb !important;
  --primary-hover: #1d4ed8 !important;
  --primary-active: #1e40af !important;
  --primary-soft: #eff6ff !important;
  --primary-soft-2: #dbeafe !important;
  --primary-border: rgba(37, 99, 235, 0.2) !important;
}

.brand-badge, .sa-brand-icon {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
}

.btn-primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
}
.btn-primary:hover {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
  transform: translateY(-1px);
}

.btn-soft {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid rgba(37, 99, 235, 0.2) !important;
}
.btn-soft:hover {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

.sa-nav-item.active {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}
.sa-nav-item.active::before {
  background: #3b82f6 !important;
}

.kpi-card.primary {
  border-left: 4px solid #2563eb !important;
}
.kpi-card.primary .value {
  color: #2563eb !important;
}

/* ============================================================
   SEGMENTED HORIZONTAL PILL BARS & SUBVIEWS (NO ENDLESS SCROLL)
   ============================================================ */
.sa-pill-track-wrapper {
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 4px;
}
.sa-pill-track {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 5px 8px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.sa-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 9999px !important;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}
.sa-pill-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}
.sa-pill-btn.active {
  background: #2563eb !important;
  border: 1.5px solid #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
}
.sa-pill-btn.active i {
  color: #ffffff !important;
}
.sa-pill-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
}
.sa-pill-btn.active .sa-pill-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* PERIOD PILL BAR (DASHBOARD KPI & REPORTS) */
.sa-period-bar-container {
  margin-bottom: 1.25rem;
  background: #ffffff;
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.sa-period-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.sa-period-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #64748b;
  text-transform: uppercase;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.sa-period-pills {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.sa-period-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 9999px !important;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}
.sa-period-pill:hover:not(.active) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}
.sa-period-pill.active {
  background: #2563eb !important;
  border: 1.5px solid #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
}
.sa-period-pill.active i {
  color: #ffffff !important;
}

/* SUBVIEWS CONTAINER ANIMATION & BEHAVIOR */
.sa-subview {
  display: none;
  animation: saFadeIn 0.2s ease-in-out;
}
.sa-subview.active {
  display: block;
}
@keyframes saFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* TOPBAR HORIZONTAL NAVIGATION (SAVE HORIZONTAL SPACE & COMPACT FIT) */
.sa-topbar {
  height: 48px !important;
  min-height: 48px !important;
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  gap: 8px !important;
  z-index: 300;
  transition: background 0.2s ease, border-color 0.2s ease;
}

/* Light / Clair Theme Topbar */
body:not([data-theme="dark"]) .sa-topbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Dark / Sombre Theme Topbar */
body[data-theme="dark"] .sa-topbar,
[data-theme="dark"] .sa-topbar {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

.sa-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0 !important;
}
.sa-brand-logo {
  height: 26px !important;
  max-height: 26px !important;
  width: auto !important;
  object-fit: contain;
  margin-right: 6px;
  border-radius: 4px;
  animation: logoFloat 3s ease-in-out infinite;
}
.sa-brand-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.sa-brand-text {
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: -0.3px;
}
body:not([data-theme="dark"]) .sa-brand-text {
  color: #0f172a !important;
}
[data-theme="dark"] .sa-brand-text {
  color: #ffffff !important;
}

.sa-brand-sub {
  font-size: 9.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
body:not([data-theme="dark"]) .sa-brand-sub {
  color: #64748b !important;
}
[data-theme="dark"] .sa-brand-sub {
  color: #94a3b8 !important;
}

.sa-top-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
  margin: 0 6px !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.sa-top-tab.tab,
.sa-top-tab {
  padding: 4px 10px !important;
  border-radius: 9999px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  height: 32px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  min-width: max-content !important;
}
@media (max-width: 1440px) {
  .sa-top-tab.tab,
  .sa-top-tab {
    padding: 3px 8px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
  }
}
.sa-top-tab span,
.sa-top-tab .tab-label,
.tab-label {
  display: inline-block !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  visibility: visible !important;
  color: inherit !important;
}
/* Inactive tabs - Light Mode */
body:not([data-theme="dark"]) .sa-top-tab {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body:not([data-theme="dark"]) .sa-top-tab i {
  color: #334155 !important;
  font-size: 12px !important;
}
body:not([data-theme="dark"]) .sa-top-tab .tab-label {
  color: #1e293b !important;
  font-weight: 600 !important;
}
/* Inactive tabs - Dark Mode */
[data-theme="dark"] .sa-top-tab {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-top-tab i {
  color: #94a3b8 !important;
  font-size: 12px !important;
}
/* Inactive tab hover - Light Mode */
body:not([data-theme="dark"]) .sa-top-tab:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px);
}
body:not([data-theme="dark"]) .sa-top-tab:hover i {
  color: #0f172a !important;
}
/* Inactive tab hover - Dark Mode */
[data-theme="dark"] .sa-top-tab:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
[data-theme="dark"] .sa-top-tab:hover i {
  color: #ffffff !important;
}
/* Active tab - Light Mode */
body:not([data-theme="dark"]) .sa-top-tab.tab.active,
body:not([data-theme="dark"]) .sa-top-tab.active {
  background: #2563eb !important;
  border: 1px solid #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
  font-weight: 700 !important;
}
/* Active tab - Dark Mode */
[data-theme="dark"] .sa-top-tab.tab.active,
[data-theme="dark"] .sa-top-tab.active {
  background: #2563eb !important;
  border: 1px solid #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5) !important;
  font-weight: 700 !important;
}
.sa-top-tab.tab.active i,
.sa-top-tab.active i,
.sa-top-tab.tab.active .tab-label,
.sa-top-tab.active .tab-label,
.sa-top-tab.tab.active span,
.sa-top-tab.active span {
  color: #ffffff !important;
}
.sa-top-tab .tab-icon-badge {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  color: inherit !important;
}
.sa-top-tab .tab-icon-badge svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  vertical-align: middle;
}
.sa-top-tab.tab.active .tab-icon-badge svg,
.sa-top-tab.active .tab-icon-badge svg {
  stroke: #ffffff !important;
  color: #ffffff !important;
}
.sa-topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  flex-shrink: 0 !important;
}

.sa-topbar-credits {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 10px !important;
  border-radius: 9999px !important;
  font-size: 11px !important;
  height: 30px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}
body:not([data-theme="dark"]) .sa-topbar-credits {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body:not([data-theme="dark"]) .sa-topbar-credits strong { color: #0f172a !important; font-weight: 700 !important; }
body:not([data-theme="dark"]) .sa-topbar-credits i { color: #2563eb !important; }
body:not([data-theme="dark"]) .sa-topbar-credits .credits-firm { font-weight: 700; color: #2563eb !important; }

[data-theme="dark"] .sa-topbar-credits {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-topbar-credits strong { color: #ffffff !important; font-weight: 700 !important; }
[data-theme="dark"] .sa-topbar-credits i { color: #60a5fa !important; }
[data-theme="dark"] .sa-topbar-credits .credits-firm { font-weight: 700; color: #60a5fa !important; }
.sa-topbar-credits .credits-sep { opacity: 0.45; margin: 0 2px; color: #94a3b8; }

@media (max-width: 1550px) {
  .sa-topbar-credits .credits-firm,
  .sa-topbar-credits .credits-sep {
    display: none !important;
  }
}
@media (max-width: 1280px) {
  .sa-topbar-credits .credits-text {
    display: none !important;
  }
  .sa-topbar-credits::after {
    content: "AIS";
    font-weight: 700;
    margin-left: 4px;
  }
}
@media (max-width: 900px) {
  .sa-topbar-credits {
    display: none !important;
  }
}

.sa-nav-pill-link, #linkToStock, #linkToPortalAppro {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 4px 8px !important;
  border-radius: 9999px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  height: 30px !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}
body:not([data-theme="dark"]) .sa-nav-pill-link {
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #1e293b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body:not([data-theme="dark"]) .sa-nav-pill-link i { color: #64748b !important; }
body:not([data-theme="dark"]) .sa-nav-pill-link:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
body:not([data-theme="dark"]) .sa-nav-pill-link:hover i { color: #0f172a !important; }
[data-theme="dark"] .sa-nav-pill-link {
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-nav-pill-link i { color: #94a3b8 !important; }
[data-theme="dark"] .sa-nav-pill-link:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .sa-nav-pill-link:hover i { color: #ffffff !important; }

#linkToGdsScanner {
  color: #059669 !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
}
#linkToGdsScanner i {
  color: #059669 !important;
}
#linkToGdsScanner:hover {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}
#linkToGdsScanner:hover i {
  color: #ffffff !important;
}

#themeToggleBtn,
.sa-icon-btn {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  font-size: 12px !important;
  border-radius: 9999px !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
}

#userChipWrap,
.sa-user-btn {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: 9999px !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
}

.sa-initials {
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

body:not([data-theme="dark"]) .sa-icon-btn,
body:not([data-theme="dark"]) .sa-user-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body:not([data-theme="dark"]) .sa-icon-btn:hover,
body:not([data-theme="dark"]) .sa-user-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
[data-theme="dark"] .sa-icon-btn,
[data-theme="dark"] .sa-user-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-icon-btn:hover,
[data-theme="dark"] .sa-user-btn:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}

.sa-ucard-credits {
  padding: 8px 10px;
  font-size: 11px;
  color: #64748b;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 8px;
}
.sa-ucard-credits .credit-firm {
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 2px;
}
.sa-ucard-credits .credit-dev {
  font-size: 10.5px;
  color: #334155;
}
[data-theme="dark"] .sa-ucard-credits {
  background: #1e293b;
  color: #94a3b8;
}
[data-theme="dark"] .sa-ucard-credits .credit-firm {
  color: #60a5fa;
}
[data-theme="dark"] .sa-ucard-credits .credit-dev {
  color: #cbd5e1;
}

.sa-app-footer {
  text-align: center;
  padding: 18px 0;
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #64748b;
}
[data-theme="dark"] .sa-app-footer {
  border-top-color: #1e293b;
  color: #94a3b8;
}

/* REPORTS TABBED SUB-SECTIONS (ZERO-SCROLL) */
.reports-sub-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line, #e2e8f0);
}
.reports-sub-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 9999px !important;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}
.reports-sub-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}
.reports-sub-btn.active {
  background: #2563eb !important;
  border: 1.5px solid #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
}
.reports-sub-btn.active i {
  color: #ffffff !important;
}
.reports-subview {
  animation: saFadeIn 0.18s ease-in-out;
}

/* DARK THEME SUPPORT */
[data-theme="dark"] .sa-top-tabs {
  background: transparent !important;
}
[data-theme="dark"] .sa-top-tab.tab,
[data-theme="dark"] .sa-top-tab {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-top-tab.tab i,
[data-theme="dark"] .sa-top-tab i {
  color: #94a3b8 !important;
}
[data-theme="dark"] .sa-top-tab.tab:hover,
[data-theme="dark"] .sa-top-tab:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .sa-top-tab.tab:hover i,
[data-theme="dark"] .sa-top-tab:hover i {
  color: #ffffff !important;
}
[data-theme="dark"] .sa-top-tab.tab.active,
[data-theme="dark"] .sa-top-tab.active {
  background: #2563eb !important;
  border: 1px solid #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5) !important;
}
[data-theme="dark"] .sa-top-tab.tab.active i,
[data-theme="dark"] .sa-top-tab.active i,
[data-theme="dark"] .sa-top-tab.tab.active .tab-label,
[data-theme="dark"] .sa-top-tab.active .tab-label {
  color: #ffffff !important;
}
[data-theme="dark"] .sa-nav-pill-link {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
}
[data-theme="dark"] .sa-nav-pill-link i {
  color: #94a3b8 !important;
}
[data-theme="dark"] .sa-nav-pill-link:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .sa-nav-pill-link:hover i {
  color: #ffffff !important;
}
[data-theme="dark"] .reports-sub-nav {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .sa-period-bar-container {
  background: #131b2e;
  border-color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .sa-period-label {
  color: #94a3b8;
}
[data-theme="dark"] .reports-sub-btn,
[data-theme="dark"] .sa-period-pill,
[data-theme="dark"] .sa-pill-btn {
  background: #1e293b;
  border: 1.5px solid #334155;
  color: #cbd5e1;
}
[data-theme="dark"] .reports-sub-btn:hover:not(.active),
[data-theme="dark"] .sa-period-pill:hover:not(.active),
[data-theme="dark"] .sa-pill-btn:hover:not(.active) {
  background: #27354f;
  border-color: #64748b;
  color: #ffffff;
}
[data-theme="dark"] .reports-sub-btn.active,
[data-theme="dark"] .sa-period-pill.active,
[data-theme="dark"] .sa-pill-btn.active {
  background: #2563eb !important;
  border: 1.5px solid #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

/* === HIGH-DENSITY COMPACT FORM & ACTION CONTROLS === */
.page-header {
  padding: 8px 12px !important;
  margin-bottom: 8px !important;
}

.page-header h2 {
  font-size: 15px !important;
}

.page-header p {
  font-size: 11px !important;
  margin: 2px 0 0 !important;
}

.page-header .btn,
.toolbar-actions .btn,
.sa-content .btn {
  padding: 5px 10px !important;
  font-size: 12px !important;
  height: 32px !important;
  box-sizing: border-box !important;
}

.form-group,
.dense-form .field {
  margin-bottom: 6px !important;
}

.scanner-banner {
  padding: 8px 14px !important;
  margin-bottom: 10px !important;
  border-radius: 10px !important;
}

.scanner-banner h3 {
  font-size: 14px !important;
}

.scanner-banner p {
  font-size: 11px !important;
}

.btn-scanner-action {
  padding: 5px 12px !important;
  font-size: 12px !important;
  height: 32px !important;
}

/* DA Status Pending Refined Palette */
.status-pill.status-da-pending {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

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

/* =====================================================
   MOBILE RESPONSIVENESS SUITE (max-width: 768px & 480px)
   ===================================================== */
@media (max-width: 768px) {
  /* Topbar: Height 50px, touch-scrollable tabs */
  .sa-topbar {
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 8px !important;
    gap: 6px !important;
  }
  .sa-top-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 4px !important;
    padding: 0 4px !important;
  }
  .sa-top-tabs::-webkit-scrollbar {
    display: none !important;
  }
  .sa-top-tab {
    flex-shrink: 0 !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-height: 38px !important;
    white-space: nowrap !important;
  }

  /* Right actions: Compact icons, credits hidden on mobile */
  .sa-topbar-credits {
    display: none !important;
  }
  .sa-topbar-right {
    gap: 4px !important;
  }
  .sa-topbar-right button,
  .sa-topbar-right a {
    padding: 4px 6px !important;
    font-size: 13px !important;
  }

  /* Workspace: Mobile padding */
  .sa-workspace,
  .workspace-content,
  .page-container,
  main {
    padding: 8px 10px !important;
  }

  /* Cards, headers, and grids */
  .sa-card,
  .card {
    padding: 12px !important;
    margin-bottom: 10px !important;
    border-radius: 10px !important;
  }
  .grid-2, .grid-3, .grid-4,
  .cockpit-kpi-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Modals and slide-over drawers: full-width on mobile */
  .modal-dialog,
  .sa-modal,
  .sa-drawer,
  .slide-over {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-height: 100vh !important;
  }

  /* Touch targets: min 44px for main controls */
  .btn:not(.btn-xs):not(.btn-sm),
  button.btn-primary,
  button.btn-secondary {
    min-height: 44px !important;
  }
}

@media (max-width: 480px) {
  .sa-topbar {
    height: 46px !important;
    padding: 0 6px !important;
  }
  .sa-top-tab .tab-text {
    font-size: 11px !important;
  }
  .sa-workspace,
  .workspace-content {
    padding: 6px 6px !important;
  }
}

/* ============================================================
   EXECUTIVE CORPORATE TAB ROW SURFACE & MODAL LAYERING
   ============================================================ */
.sa-tab-row,
.sa-tab-row#tabbar {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  justify-content: center !important;
  padding: 6px 16px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  position: sticky !important;
  top: 48px !important;
  z-index: 299 !important;
  flex-wrap: wrap !important;
}

[data-theme="dark"] .sa-tab-row,
[data-theme="dark"] .sa-tab-row#tabbar,
body[data-theme="dark"] .sa-tab-row,
body[data-theme="dark"] .sa-tab-row#tabbar {
  background: #131b2e !important;
  border-bottom-color: #1e293b !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

/* Redundant guarantee: Modal backdrops strictly above navigation tabs */
.modal-backdrop {
  z-index: 10000 !important;
}


