/* =====================================================================
   Zenve BI — Executive Dashboard & CEO Control Center Suite CSS
   Strict Viewport & Scroll Containment, High-Contrast Typography
   ===================================================================== */

/* Body locking when Executive overlay is active */
html.zexec-locked,
body.zexec-locked {
  overflow: hidden !important;
  height: 100% !important;
}

/* Master Root Container */
#zexec-root {
  display: none;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 224px !important;
  width: calc(100vw - 224px) !important;
  max-width: calc(100vw - 224px) !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  z-index: 60 !important;
  background: var(--background, #f8fafc) !important;
  color: var(--foreground, #0f172a) !important;
  font-family: var(--font-sans, "Manrope", sans-serif);
  box-sizing: border-box !important;
  scrollbar-width: thin !important;
  scrollbar-color: #cbd5e1 #f8fafc !important;
}

@media (max-width: 1023px) {
  #zexec-root {
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

#zexec-root * {
  box-sizing: border-box;
}

/* Custom Scrollbars */
#zexec-root::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#zexec-root::-webkit-scrollbar-track {
  background: #f1f5f9;
}

#zexec-root::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#zexec-root::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Header Area */
.zexec-head {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.zexec-head-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zexec-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zexec-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.zexec-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.zexec-pulse-dot {
  width: 7px;
  height: 7px;
  background: #2563eb;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
  animation: zexec-pulse 2s infinite;
}

@keyframes zexec-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

.zexec-sub {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.zexec-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.zexec-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.zexec-btn.primary {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.zexec-btn.primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

/* Tabs Bar */
.zexec-tabs-bar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.zexec-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.zexec-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.zexec-tab.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 700;
}

.zexec-tab-badge {
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
}

.zexec-tab.active .zexec-tab-badge {
  background: #bfdbfe;
  color: #1e40af;
}

/* Body Content Area */
.zexec-body,
#zexec-root .zexec-body,
#zexec-root div.zexec-body,
#zexec-root main.zexec-body {
  padding: 24px 28px 64px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

/* KPI Grid */
.zexec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.zexec-kpi {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zexec-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zexec-kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.zexec-kpi-icon {
  font-size: 20px;
}

.zexec-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.zexec-kpi-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.zexec-delta {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.zexec-delta.up {
  color: #059669;
}

.zexec-delta.down {
  color: #e11d48;
}

.zexec-delta.warn {
  color: #d97706;
}

.zexec-subtext {
  color: #64748b;
}

/* Panels */
.zexec-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.zexec-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.zexec-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.zexec-card-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}

/* Tables */
.zexec-table-wrap {
  overflow-x: auto;
}

.zexec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.zexec-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.zexec-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}

.zexec-table tr:hover td {
  background: #f8fafc;
}

/* Badges */
.zexec-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.zexec-badge.success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.zexec-badge.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

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

.zexec-badge.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.zexec-badge.purple {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.zexec-badge.neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.zexec-progress-bar {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.zexec-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.zexec-progress-fill.success {
  background: #10b981;
}

.zexec-progress-fill.info {
  background: #3b82f6;
}

.zexec-progress-fill.warning {
  background: #f59e0b;
}

.zexec-progress-fill.danger {
  background: #ef4444;
}

.zexec-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
}

.zexec-decision-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.zexec-decision-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.zexec-decision-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zexec-decision-id {
  font-family: var(--font-mono, "IBM Plex Mono", monospace);
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
}

.zexec-decision-action {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
}

.zexec-decision-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #64748b;
  flex-wrap: wrap;
  gap: 8px;
}

.zexec-decision-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.zexec-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.zexec-risk-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zexec-risk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.zexec-risk-val {
  font-size: 16px;
  font-weight: 800;
  color: #059669;
}

.zexec-risk-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.zexec-btn-sm {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.15s ease;
}

.zexec-btn-sm:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.zexec-btn-sm.approved {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  cursor: default;
}