html[data-theme="dark"] .dash-edit-preview-btn.active {
  background: var(--bg-subtle);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  color-scheme: dark;
}

/* ===== Dashboard Layout ===== */
.dashboard-body {
  overflow: hidden;
  height: 100vh;
}

.dash-app {
  display: flex;
  height: 100vh;
  background: var(--bg);
}

.dash-sidebar-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 12px;
}

.dash-sidebar-brand {
  padding: 0 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Super admin: title only on top; business list sits between two rules below */
.dash-sidebar.super-admin .dash-sidebar-brand {
  padding-bottom: 12px;
  border-bottom: none;
  margin-bottom: 0;
}

.dash-sidebar-biz-panel {
  display: none;
  flex-direction: column;
  margin-bottom: 12px;
}

.dash-sidebar.super-admin .dash-sidebar-biz-panel {
  display: flex;
}

.dash-sidebar-search-wrap {
  position: relative;
  padding: 0 4px 8px;
}

.dash-sidebar-search {
  width: 100%;
  padding: 8px 32px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg-white);
}

.dash-sidebar-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.dash-sidebar-search::-webkit-search-cancel-button {
  display: none;
}

.dash-sidebar-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(calc(-50% - 4px));
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dash-sidebar-search-clear:hover {
  color: var(--text-primary);
  background: var(--border);
}

.dash-sidebar-biz-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-height: min(280px, 40vh);
  overflow-y: auto;
}

/* Sidebar */
.dash-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  z-index: 50;
}

.dash-sidebar-tag {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.dash-nav-empty {
  padding: 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.dash-nav-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--border);
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius);
  background: none;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.dash-nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dash-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.dash-back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.dash-back-link:hover {
  color: var(--accent);
}

.dash-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  z-index: 40;
}

.dash-sidebar-overlay.open {
  display: block;
}

/* Main area */
.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-menu-btn {
  display: none;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
}

.dash-header-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-header-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-refresh-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.dash-refresh-btn:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.dash-refresh-btn.spinning {
  animation: dash-spin 0.8s linear infinite;
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

.dash-sync-status {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: 100px;
}

.dash-sync-status.live {
  color: var(--success);
  background: var(--success-surface);
}

.dash-sync-status.error {
  color: var(--accent);
  background: var(--accent-light);
}

.dash-calls-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 14px;
  background: var(--bg-subtle);
  border-radius: 100px;
}

.dash-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.dash-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-icon-btn:hover {
  background: var(--bg-subtle);
}

.dash-theme-btn .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .dash-theme-btn .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .dash-theme-btn .theme-icon-moon {
  display: block;
}

.login-theme-btn {
  position: absolute;
  top: 24px;
  right: 24px;
}

/* Incoming banner */
.dash-incoming {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 24px 0;
  padding: 10px 16px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  animation: dash-slide-in 0.45s ease-out;
}

.dash-incoming-pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.dash-incoming-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: dash-ring-pulse 1.5s ease-out infinite;
}

@keyframes dash-slide-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes dash-ring-pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Content */
.dash-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
}

.dash-content-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.dash-section.scroll-mt {
  scroll-margin-top: 20px;
}

.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-section-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.dash-section-head--overview {
  flex-wrap: wrap;
  gap: 12px 16px;
}

.dash-overview-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dash-overview-select,
.dash-overview-date {
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.dash-overview-select {
  cursor: pointer;
}

.dash-overview-date:focus,
.dash-overview-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.dash-overview-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-overview-range-sep {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dash-overview-period {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: 100px;
}

.dash-section-label {
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted) !important;
}

.dash-section-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 100px;
}

/* Orders */
.dash-orders-split {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.dash-orders-block .dash-empty {
  grid-column: 1 / -1;
}

.dash-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.dash-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.925rem;
  padding: 32px;
}

.dash-order-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.dash-order-card.is-new {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
  animation: dash-slide-in 0.45s ease-out;
}

.dash-order-card.status-accepted {
  border-left: 3px solid var(--success);
}

.dash-order-card.status-completed {
  border-left: 3px solid var(--text-muted);
}

.dash-order-card.status-rejected {
  opacity: 0.65;
  border-left: 3px solid var(--accent);
}

.dash-order-card.status-rejected .dash-order-rejection {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--accent);
}

.dash-order-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.dash-order-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dash-order-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  padding: 3px 8px;
  background: var(--success-surface);
  border-radius: 4px;
  min-width: 42px;
  text-align: center;
  line-height: 1.2;
}

.dash-order-timer.live {
  font-variant-numeric: tabular-nums;
}

.dash-order-card.status-completed .dash-order-timer {
  color: var(--text-secondary);
  background: var(--bg-subtle);
}

.dash-order-customer {
  font-weight: 700;
  font-size: 0.9375rem;
}

.dash-order-phone {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.dash-order-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
}

.dash-order-badge.pending {
  background: var(--accent-light);
  color: var(--accent);
}

.dash-order-badge.accepted {
  background: var(--success-surface);
  color: var(--success);
}

.dash-order-badge.completed {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.dash-order-badge.rejected {
  background: var(--bg-subtle);
  color: var(--accent);
}

.dash-order-items {
  list-style: none;
  margin-bottom: 14px;
}

.dash-order-items li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
}

.dash-order-total {
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-bottom: 14px;
  font-size: 0.9375rem;
}

.dash-order-rejection {
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dash-reject-textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-white);
  resize: vertical;
}

.dash-reject-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.dash-order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-order-actions .btn {
  padding: 8px 14px;
  font-size: 0.8125rem;
  flex: 1;
  min-width: 80px;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--bg-white);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-danger:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Metrics */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dash-metric {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.dash-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dash-metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.dash-metric-change {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 6px;
}

.dash-metric-change.up {
  color: var(--success);
}

.dash-metric-change.down {
  color: var(--accent);
}

/* Panel & Table */
.dash-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.dash-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.dash-table-wrap {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dash-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.dash-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.dash-table--customers {
  table-layout: fixed;
}

.dash-table--customers th:nth-child(1),
.dash-table--customers td:nth-child(1) {
  width: 33.33%;
  text-align: left;
}

.dash-table--customers th:nth-child(2),
.dash-table--customers td:nth-child(2) {
  width: 33.33%;
  text-align: center;
}

.dash-table--customers th:nth-child(3),
.dash-table--customers td:nth-child(3) {
  width: 33.33%;
  text-align: right;
}

.dash-table--customers .dash-empty {
  text-align: center;
}

.dash-customers-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dash-customers-search {
  flex: 1 1 180px;
  min-width: 0;
  max-width: 320px;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
}

.dash-customers-search:focus {
  outline: none;
  border-color: var(--accent);
}

.dash-customers-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.dash-customers-pagination.hidden {
  display: none;
}

.dash-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.dash-page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
}

.dash-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dash-page-label {
  min-width: 52px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dash-table tr:last-child td {
  border-bottom: none;
}

.dash-table .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
}

.dash-table .dash-table-time {
  white-space: nowrap;
}

.dash-table--calls .dash-call-expand-col {
  width: 40px;
  padding-left: 8px;
  padding-right: 4px;
}

.dash-call-expand-cell {
  width: 40px;
  padding-left: 8px;
  padding-right: 4px;
  vertical-align: middle;
}

.dash-call-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.dash-call-expand-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.dash-call-row.is-expanded .dash-call-expand-btn {
  color: var(--accent);
  border-color: var(--accent);
}

.dash-call-row.is-expanded .dash-call-expand-btn svg {
  transform: rotate(180deg);
}

.dash-call-expand-btn svg {
  transition: transform var(--transition);
}

.dash-call-phone {
  color: var(--text-secondary);
  white-space: nowrap;
}

.dash-call-detail-row td {
  padding: 0 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dash-call-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 12px 4px;
}

.dash-call-detail-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-call-detail-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dash-call-detail-block p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dash-call-detail-muted {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dash-outcome-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-outcome-tag.booked {
  background: var(--success-surface);
  color: var(--success);
}

.dash-outcome-tag.missed {
  background: var(--accent-light);
  color: var(--accent);
}

.dash-outcome-tag.info {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* Analytics */
.dash-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#ordersLineChartPanel {
  grid-row: 1;
  grid-column: 1;
}

#revenueLineChartPanel {
  grid-row: 1;
  grid-column: 2;
}

#callsChartPanel {
  grid-row: 2;
  grid-column: 1;
}

#outcomesChartPanel {
  grid-row: 2;
  grid-column: 2;
}

.dash-analytics-grid--calls-first #callsChartPanel,
.dash-analytics-grid--calls-first #outcomesChartPanel {
  grid-row: 1;
}

.dash-analytics-grid--calls-first #callsChartPanel {
  grid-column: 1;
}

.dash-analytics-grid--calls-first #outcomesChartPanel {
  grid-column: 2;
}

.dash-analytics-grid--orders-only #ordersLineChartPanel {
  grid-column: 1 / -1;
}

.dash-analytics-grid--revenue-only #revenueLineChartPanel {
  grid-column: 1 / -1;
}

.dash-panel--wide {
  grid-column: 1 / -1;
}

.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dash-panel-head .dash-panel-title {
  margin: 0;
  flex: 1;
  min-width: 140px;
}

.dash-panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.dash-chart-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.dash-chart-expand-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dash-chart-expand-btn.is-expanded {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-subtle);
}

.dash-chart-expand-btn.is-expanded .chart-expand-icon {
  display: none;
}

.dash-chart-expand-btn.is-expanded .chart-minimize-icon {
  display: block;
}

.dash-chart-expand-btn .chart-minimize-icon.hidden {
  display: none;
}

.dash-chart-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dash-chart-overlay.hidden {
  display: none;
}

.dash-chart-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dash-chart-overlay-slot {
  position: relative;
  z-index: 1;
  width: min(960px, 94vw);
  max-height: 90vh;
  overflow: auto;
}

.dash-chart-overlay-slot .dash-panel {
  margin: 0;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.dash-panel.is-chart-overlay .dash-line-chart-wrap {
  min-height: 420px;
}

.dash-panel.is-chart-overlay .dash-chart-empty {
  min-height: 420px;
}

body.chart-overlay-open {
  overflow: hidden;
}

html[data-theme="dark"] .dash-chart-overlay-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dash-line-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-line-toggle {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition), opacity var(--transition);
}

.dash-line-toggle:not(.is-on) {
  opacity: 0.55;
}

.dash-line-toggle.is-on[data-series="total"] {
  color: var(--text-primary);
  border-color: var(--text-primary);
  background: var(--bg-subtle);
}

.dash-line-toggle.is-on[data-series="completed"] {
  color: var(--success);
  border-color: var(--success);
  background: var(--success-surface);
}

.dash-line-toggle.is-on[data-series="rejected"] {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-light);
}

.dash-line-chart-wrap {
  min-height: 180px;
  position: relative;
  overflow: visible;
}

.dash-chart-tooltip {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  padding: 8px 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 220px;
}

.dash-chart-tooltip.hidden {
  display: none;
}

.dash-chart-tooltip-title {
  display: block;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dash-chart-tooltip-row span:last-child {
  font-weight: 700;
  color: var(--text-primary);
}

.dash-line-hit {
  fill: transparent;
  stroke: none;
  cursor: crosshair;
}

.dash-line-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.dash-line-grid {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.dash-line-axis {
  fill: var(--text-muted);
  font-size: 11px;
  pointer-events: none;
}

.dash-order-line {
  fill: none;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.dash-order-line--total {
  stroke: var(--text-primary);
}

.dash-order-line--completed {
  stroke: var(--success);
}

.dash-order-line--rejected {
  stroke: var(--accent);
}

circle.dash-order-line--total {
  fill: var(--text-primary);
  stroke: none;
}

circle.dash-order-line--completed {
  fill: var(--success);
  stroke: none;
}

circle.dash-order-line--rejected {
  fill: var(--accent);
  stroke: none;
}

.dash-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 8px 6px 0;
  box-sizing: border-box;
}

.dash-bar-chart--dense {
  gap: 4px;
}

.dash-bar-chart--dense .dash-bar-label {
  font-size: 0.625rem;
}

.dash-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 0;
}

.dash-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  cursor: crosshair;
}

.dash-bar {
  width: 100%;
  max-width: 36px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.85;
  transition: opacity var(--transition);
}

.dash-bar-col:hover .dash-bar {
  opacity: 1;
}

.dash-bar-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dash-bar-value {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-height: 1em;
}

.dash-outcomes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-outcome-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-outcome-row span:first-child {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dash-outcome-bar-wrap {
  flex: 2;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.dash-outcome-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.dash-outcome-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 36px;
  text-align: right;
}

/* Print Modal */
.dash-print-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dash-print-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}

.dash-print-panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dash-print-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px dashed var(--border);
}

.dash-print-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
}

.dash-print-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.dash-print-body {
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.dash-print-body .receipt-title {
  text-align: center;
  font-weight: 700;
  margin-bottom: 12px;
}

.dash-print-body .receipt-divider {
  border-top: 1px dashed var(--border);
  margin: 10px 0;
}

.dash-print-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.dash-print-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .dash-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dash-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }

  .dash-sidebar.open {
    transform: translateX(0);
  }

  .dash-menu-btn {
    display: flex;
  }

  .dash-header {
    padding: 14px 16px;
  }

  .dash-content {
    padding: 16px;
  }

  .dash-incoming {
    margin: 12px 16px 0;
  }

  .dash-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .dash-calls-badge span:not(.dash-live-dot) {
    display: none;
  }

  .dash-calls-badge::after {
    content: 'today';
    font-size: 0.8125rem;
  }
}

/* ===================================================================
   Multi-role login system UI
   =================================================================== */

/* ===== Login page ===== */
.login-body {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
}

.login-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px;
}

.login-logo {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: 20px;
}

.login-title {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-form input,
.login-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-white);
}

.login-form input:focus,
.login-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.login-form .btn-full {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.login-note {
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

/* ===== Sidebar: logout + business list ===== */
.dash-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-top: auto;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: none;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}

.dash-logout:hover {
  color: var(--accent);
}

.dash-biz-item svg {
  flex-shrink: 0;
}

/* ===== Header action buttons ===== */
.dash-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.dash-action-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dash-action-btn.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

.dash-role-pill {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: 4px;
}

/* ===== Super Admin landing ===== */
.dash-superadmin-landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.dash-landing-card {
  text-align: center;
  max-width: 420px;
  padding: 40px;
}

.dash-landing-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.dash-landing-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ===== Edit Mode panel ===== */
.dash-edit-panel {
  background: var(--bg-white);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.dash-edit-head h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.dash-edit-head p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.dash-edit-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.dash-edit-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.dash-edit-preview-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dash-edit-preview-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-muted, #f3f4f6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-edit-preview-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.dash-edit-preview-btn:hover {
  color: var(--text-secondary);
}

.dash-edit-preview-btn.active {
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dash-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.dash-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ===== Toggle switch ===== */
.dash-switch {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
}

.dash-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.dash-switch-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 100px;
  transition: background var(--transition);
}

.dash-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--bg-white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

.dash-switch input:checked + .dash-switch-track {
  background: var(--success);
}

.dash-switch input:checked + .dash-switch-track::after {
  transform: translateX(18px);
}

/* ===== Call recordings ===== */
.dash-recordings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-recording,
.dash-recording--inline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-recording--inline {
  margin-top: 4px;
  background: var(--bg-white);
}

.dash-rec-play {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-rec-play:hover {
  background: var(--accent-hover);
}

.dash-rec-info {
  flex: 1;
  min-width: 0;
}

.dash-rec-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dash-rec-caller {
  font-weight: 700;
  font-size: 0.875rem;
}

.dash-rec-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.dash-rec-topic {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 2px 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-rec-bar {
  padding: 7px 0;
  cursor: pointer;
}

.dash-rec-track {
  position: relative;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: 4px;
}

.dash-rec-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  pointer-events: none;
}

.dash-rec-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-white);
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.dash-rec-dur {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
}

/* ===== Appointments calendar ===== */
.dash-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.dash-expand-btn:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.dash-calendar-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-x: auto;
}

.dash-calendar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 12px;
  min-width: 100%;
}

.dash-cal-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-cal-day {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  text-align: center;
}

.dash-cal-dow {
  font-weight: 700;
  font-size: 0.875rem;
}

.dash-cal-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dash-cal-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-appt {
  padding: 10px 12px;
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
  background: var(--bg);
}

.dash-appt-pending {
  border-left-color: var(--accent);
}

.dash-appt-time {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

.dash-appt-customer {
  font-weight: 700;
  font-size: 0.875rem;
  margin-top: 2px;
}

.dash-appt-service {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.dash-appt-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-appt-status {
  text-transform: capitalize;
}

/* Calendar fullscreen present mode */
.dash-calendar-wrap.present {
  position: fixed;
  inset: 0;
  z-index: 400;
  border-radius: 0;
  padding: 32px;
  padding-top: 64px;
  overflow: auto;
  background: var(--bg);
}

.dash-calendar-present-close {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 401;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.dash-calendar-present-close:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.dash-calendar-wrap.present .dash-calendar-present-close {
  display: flex;
}

.dash-calendar-wrap.present .dash-calendar {
  grid-auto-columns: minmax(200px, 1fr);
  height: 100%;
}

body.present-open {
  overflow: hidden;
}

/* ===== Generic modal ===== */
.dash-modal {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dash-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}

.dash-modal-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dash-modal-panel-wide {
  max-width: 460px;
}

.dash-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.dash-check-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.dash-check-label input {
  width: auto;
}

.dash-modal-success {
  font-size: 0.875rem;
  color: var(--success);
  margin-top: 8px;
}

.dash-modal-body code {
  font-family: var(--font-mono, monospace);
  font-size: 0.8125rem;
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 4px;
}

.dash-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dash-modal-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
}

.dash-modal-body {
  padding: 20px;
}

.dash-modal-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.dash-modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.dash-modal-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .dash-action-btn span {
    display: none;
  }

  .dash-action-btn {
    padding: 8px;
  }

  .login-card {
    padding: 28px 22px;
  }
}
