/* =====================================================================
   Zenve BI — Doctors & Clinical Medical Board Executive Suite CSS
   Strict Viewport & Scroll Containment, High-Contrast Typography
   ===================================================================== */

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

/* Master Root Container */
#zdoc-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) {
  #zdoc-root {
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

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

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

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

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

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

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

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

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

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

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

.zdoc-pulse-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: zdoc-pulse 2s infinite;
}

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

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

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

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

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

/* Buttons */
.zdoc-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;
}

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

.zdoc-btn.primary {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.zdoc-btn.primary:hover {
  background: #047857;
  border-color: #047857;
}

/* Tabs Bar */
.zdoc-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;
}

.zdoc-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;
}

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

.zdoc-tab.active {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
  font-weight: 700;
}

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

.zdoc-tab.active .zdoc-tab-badge {
  background: #a7f3d0;
  color: #065f46;
}

/* Body Content Area */
.zdoc-body,
#zdoc-root .zdoc-body,
#zdoc-root div.zdoc-body,
#zdoc-root main.zdoc-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 */
.zdoc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.zdoc-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;
}

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

.zdoc-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zdoc-kpi-icon {
  font-size: 18px;
}

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

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

.zdoc-delta {
  font-weight: 700;
}

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

.zdoc-delta.down {
  color: #dc2626;
}

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

.zdoc-subtext {
  color: #64748b;
  font-weight: 500;
}

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

.zdoc-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

.zdoc-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

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

.zdoc-table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.zdoc-table th {
  padding: 12px 14px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.zdoc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}

.zdoc-table tbody tr:hover {
  background: #f8fafc;
}

/* Status Badges & Pills */
.zdoc-pill {
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
}

.zdoc-pill.active {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

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

.zdoc-pill.critical {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Modal Dialog */
.zdoc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.zdoc-modal-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  padding: 24px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.zdoc-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.zdoc-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.zdoc-form-group {
  margin-bottom: 14px;
}

.zdoc-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.zdoc-input,
.zdoc-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  background: #ffffff;
  color: #0f172a;
}

.zdoc-input:focus,
.zdoc-select:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.zdoc-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}