/* Admin-only presentation layer. Keeps production admin IDs, API contracts, and behaviors intact. */
#dashboardContainer .stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

#dashboardContainer .stat-card {
  position: relative;
  display: flex;
  min-height: 148px;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 18px 16px;
  border: 1px solid rgba(96, 165, 250, 0.28) !important;
  border-left-width: 1px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #0b1422, #111b2d) !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#dashboardContainer .stat-card::before,
#dashboardContainer .dashboard-chart-card::before,
#dashboardContainer .dashboard-order-status-card::before,
#dashboardContainer .dashboard-recent-card::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.5), transparent);
  content: "";
  pointer-events: none;
}

#dashboardContainer .stat-card:hover,
#dashboardContainer .stat-card:focus-visible {
  border-color: rgba(103, 232, 249, 0.68) !important;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28), 0 0 20px rgba(34, 211, 238, 0.08) !important;
  outline: none;
  transform: translateY(-2px);
}

#dashboardContainer .stat-card-topline {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

#page-users #usersTable .user-presence-cell {
  min-width: 145px;
  white-space: nowrap;
}

#page-users #usersTable .user-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
}

#page-users #usersTable .user-presence.is-online {
  color: #6ee7b7;
}

#page-users #usersTable .user-presence-dot {
  color: #34d399;
  font-size: 0.9rem;
  line-height: 1;
}

#dashboardContainer .stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(103, 232, 249, 0.24);
  border-radius: 9px;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.1);
  font-size: 15px;
  font-weight: 800;
}

#dashboardContainer .stat-label {
  min-width: 0;
  margin: 0;
  color: #cbd5e1 !important;
  font-size: 0.76rem;
  font-weight: 700;
}

#dashboardContainer .stat-card-hint {
  margin-left: auto;
  color: #64748b;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#dashboardContainer .stat-value {
  margin-top: 17px;
  color: #f0f9ff !important;
  font-size: clamp(1.45rem, 2.6vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#dashboardContainer .stat-helper {
  margin-top: auto;
  padding-top: 12px;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.45;
}

#dashboardContainer .dashboard-chart-card,
#dashboardContainer .dashboard-order-status-card,
#dashboardContainer .dashboard-recent-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(96, 165, 250, 0.3) !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #0b1422, #111b2d) !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

#dashboardContainer .dashboard-chart-card {
  padding: 0;
}

#dashboardContainer .dashboard-chart-header {
  position: relative;
  z-index: 1;
  align-items: flex-start;
  margin: 0;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

#dashboardContainer .dashboard-chart-header h3 {
  color: #f0f9ff !important;
  font-size: 1rem;
}

#dashboardContainer .dashboard-chart-header span {
  color: #94a3b8;
  font-size: 0.72rem;
}

#dashboardContainer .section-kicker {
  margin: 0 0 5px;
  color: #67e8f9;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#dashboardContainer .dashboard-chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#dashboardContainer .dashboard-period-toggle,
#dashboardContainer .dashboard-view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 9px;
  background: rgba(3, 9, 18, 0.78);
}

#dashboardContainer .dashboard-period-toggle button,
#dashboardContainer .dashboard-view-toggle button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
}

#dashboardContainer .dashboard-period-toggle button:hover,
#dashboardContainer .dashboard-period-toggle button:focus-visible,
#dashboardContainer .dashboard-period-toggle button.is-active,
#dashboardContainer .dashboard-view-toggle button:hover,
#dashboardContainer .dashboard-view-toggle button:focus-visible,
#dashboardContainer .dashboard-view-toggle button.is-active {
  color: #07111f;
  background: #f0c766;
  outline: none;
}

#dashboardContainer .dashboard-revenue-chart {
  display: block;
  width: 100%;
  min-height: 300px;
  padding: 16px 18px 12px;
}

#dashboardContainer .chart-grid-line {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-dasharray: 3 5;
}

#dashboardContainer .chart-axis-line {
  stroke: rgba(148, 163, 184, 0.38);
}

#dashboardContainer .chart-axis-label {
  fill: #94a3b8;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

#dashboardContainer .chart-bar {
  fill: #22d3ee;
  opacity: 0.78;
  transition: opacity 160ms ease;
}

#dashboardContainer .chart-bar:hover {
  opacity: 1;
}

#dashboardContainer .chart-area {
  fill: rgba(34, 211, 238, 0.12);
}

#dashboardContainer .chart-line {
  fill: none;
  stroke: #22d3ee;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

#dashboardContainer .chart-point {
  fill: #f0c766;
  stroke: #07111f;
  stroke-width: 2;
}

#dashboardContainer .kpi-detail-content {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  padding: 24px;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
  border-radius: 15px;
  color: #dbeafe;
  background: linear-gradient(135deg, #0b1422, #111b2d) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

#dashboardContainer .kpi-detail-content .modal-header {
  padding-right: 38px;
  color: #f0c766 !important;
  font-size: 1.08rem;
}

#dashboardContainer .kpi-detail-content .modal-subtitle {
  margin: -12px 0 16px;
  color: #94a3b8;
  font-size: 0.72rem;
}

#dashboardContainer .kpi-detail-scroll {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 8px;
  scrollbar-color: #334155 transparent;
}

#dashboardContainer .kpi-detail-table {
  min-width: 820px;
}

#dashboardContainer .kpi-detail-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #bae6fd;
  background: #18263a;
  box-shadow: 0 1px 0 rgba(96, 165, 250, 0.3);
}

#dashboardContainer .kpi-detail-table td {
  color: #cbd5e1;
  white-space: nowrap;
}

#dashboardContainer .kpi-detail-table tbody tr:nth-child(even) td,
#dashboardContainer #logsTable tbody tr:nth-child(even) td {
  background: rgba(30, 41, 59, 0.26);
}

#dashboardContainer .status-badge,
#dashboardContainer .entity-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(51, 65, 85, 0.35);
  font-size: 0.64rem;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

#dashboardContainer .status-completed,
#dashboardContainer .status-active,
#dashboardContainer .status-paid {
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
}

#dashboardContainer .status-pending,
#dashboardContainer .status-processing,
#dashboardContainer .status-shipping,
#dashboardContainer .status-low-stock {
  border-color: rgba(251, 191, 36, 0.38);
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
}

#dashboardContainer .status-cancelled,
#dashboardContainer .status-inactive {
  border-color: rgba(248, 113, 113, 0.36);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

#dashboardContainer #logsTable {
  min-width: 1040px;
}

#dashboardContainer #logsTable td {
  vertical-align: top;
  padding-top: 15px;
  padding-bottom: 15px;
}

#dashboardContainer #logsTable th:nth-child(1) { width: 140px; }
#dashboardContainer #logsTable th:nth-child(2) { width: 170px; }
#dashboardContainer #logsTable th:nth-child(3) { width: 130px; }
#dashboardContainer #logsTable th:nth-child(5) { width: 160px; }

#dashboardContainer .activity-admin,
#dashboardContainer .activity-id {
  display: block;
}

#dashboardContainer .activity-admin {
  color: #cbd5e1;
  font-size: 0.74rem;
}

#dashboardContainer .activity-id {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.61rem;
}

#dashboardContainer .activity-action {
  display: inline-block;
  max-width: 170px;
  color: #f0c766;
  font-size: 0.7rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

#dashboardContainer .activity-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 7px 18px;
  min-width: 480px;
}

#dashboardContainer .activity-detail-field {
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid rgba(71, 85, 105, 0.42);
}

#dashboardContainer .activity-detail-field span {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#dashboardContainer .activity-detail-field strong {
  display: block;
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#dashboardContainer .activity-detail-empty {
  color: #64748b;
  font-size: 0.7rem;
  font-style: italic;
}

#dashboardContainer .activity-time {
  color: #94a3b8;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 980px) {
  #dashboardContainer .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashboardContainer .dashboard-chart-header { flex-direction: column; }
  #dashboardContainer .dashboard-chart-controls { justify-content: flex-start; }
}

@media (max-width: 640px) {
  #dashboardContainer .stats-grid { grid-template-columns: 1fr; }
  #dashboardContainer .stat-card { min-height: 132px; }
  #dashboardContainer .dashboard-chart-header { padding: 17px 16px 14px; }
  #dashboardContainer .dashboard-revenue-chart { min-height: 250px; padding-inline: 4px; }
  #dashboardContainer .dashboard-chart-controls { width: 100%; }
  #dashboardContainer .dashboard-period-toggle,
  #dashboardContainer .dashboard-view-toggle { flex: 1 1 auto; }
  #dashboardContainer .dashboard-period-toggle button,
  #dashboardContainer .dashboard-view-toggle button { flex: 1 1 auto; }
  #dashboardContainer .kpi-detail-content { padding: 18px; }
  #dashboardContainer .activity-detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #dashboardContainer .stat-card,
  #dashboardContainer .chart-bar { transition: none; }
}

/* KPI modal lives outside #dashboardContainer in the production DOM. */
#kpiDetailModal {
  background: rgba(3, 9, 18, 0.78);
  backdrop-filter: blur(8px);
}

#kpiDetailModal .kpi-detail-content {
  position: relative;
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
  max-height: min(86vh, 760px);
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
  border-radius: 15px;
  color: #dbeafe;
  background: linear-gradient(135deg, #0b1422, #111b2d) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

#kpiDetailModal .modal-header {
  padding-right: 38px;
  color: #f0c766 !important;
  border-bottom-color: rgba(96, 165, 250, 0.25);
  font-size: 1.08rem;
}

#kpiDetailModal .modal-subtitle {
  margin: -12px 0 16px;
  color: #94a3b8;
  font-size: 0.72rem;
}

#kpiDetailModal .modal-close {
  z-index: 1;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
}

#kpiDetailModal .modal-close:hover,
#kpiDetailModal .modal-close:focus-visible {
  color: #ecfeff;
  border-color: rgba(34, 211, 238, 0.75);
  outline: none;
}

#kpiDetailModal .kpi-detail-scroll {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 8px;
  scrollbar-color: #334155 transparent;
}

#kpiDetailModal .kpi-detail-table {
  min-width: 820px;
}

#kpiDetailModal .kpi-detail-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #bae6fd;
  background: #18263a;
  box-shadow: 0 1px 0 rgba(96, 165, 250, 0.3);
}

#kpiDetailModal .kpi-detail-table td {
  color: #cbd5e1;
  white-space: nowrap;
}

#kpiDetailModal .kpi-detail-table tbody tr:nth-child(even) td {
  background: rgba(30, 41, 59, 0.26);
}

#kpiDetailModal .status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(51, 65, 85, 0.35);
  font-size: 0.64rem;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

#kpiDetailModal .status-completed,
#kpiDetailModal .status-active,
#kpiDetailModal .status-paid {
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
}

#kpiDetailModal .status-pending,
#kpiDetailModal .status-processing,
#kpiDetailModal .status-shipping {
  border-color: rgba(251, 191, 36, 0.38);
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
}

#kpiDetailModal .status-cancelled,
#kpiDetailModal .status-inactive {
  border-color: rgba(248, 113, 113, 0.36);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

#page-orders .payment-instructions,
#page-payments .payment-instructions,
#orderDetailContent .payment-instructions {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.045);
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}

#page-orders .payment-instructions > strong,
#page-payments .payment-instructions > strong,
#orderDetailContent .payment-instructions > strong {
  color: #0f172a;
  font-size: 12px;
}

#page-orders .payment-instructions > div,
#page-payments .payment-instructions > div,
#orderDetailContent .payment-instructions > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

#page-orders .payment-instructions > div span,
#page-payments .payment-instructions > div span,
#orderDetailContent .payment-instructions > div span {
  color: #64748b;
}

#page-orders .payment-instructions > div b,
#page-payments .payment-instructions > div b,
#orderDetailContent .payment-instructions > div b {
  color: #0f172a;
  text-align: right;
}

#page-orders .payment-instructions--compact,
#page-payments .payment-instructions--compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  max-width: 360px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 11px;
}

#page-orders .payment-instructions--compact span,
#page-payments .payment-instructions--compact span {
  white-space: nowrap;
}

#page-orders .payment-instructions--cod {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
}

#page-orders .payment-instructions--cod span {
  color: #64748b;
}

#page-orders #ordersTable td:nth-child(5),
#page-payments #paymentsTable td:nth-child(3) {
  min-width: 220px;
}

#page-orders #ordersTable td:last-child,
#page-payments #paymentsTable td:last-child {
  min-width: 190px;
}

@media (max-width: 640px) {
  #kpiDetailModal .kpi-detail-content { padding: 18px; }
}
