/**
 * Sales Center — Sales Performance panel (Phase 6A.2.2)
 * All rules scoped under #dashboardsView.sales-center-modern [data-dashboard-panel="sales"]
 * Do not restyle shell, other tabs, or #dashboardView. No !important.
 */

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] {
  --sc-sales-gap: 12px;
  --sc-sales-radius: 8px;
  --sc-sales-ink: var(--ds-color-ink, var(--ink, #24262d));
  --sc-sales-muted: var(--ds-color-muted, var(--muted, #6b7280));
  --sc-sales-line: var(--ds-color-line, var(--line, #e5e7eb));
  --sc-sales-surface: #fff;
  --sc-sales-quiet: #f8f9fa;
  --sc-sales-accent: var(--ds-color-accent, var(--accent, #0f766e));
  flex-direction: column;
  gap: var(--sc-sales-gap);
  min-width: 0;
  max-width: 100%;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"]:not([hidden]) {
  display: flex;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"][hidden] {
  display: none;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"].is-loading {
  opacity: 0.55;
  min-height: 12rem;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-instagram-handoff-panel.sc-sales-ig,
#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-quote-followup-panel.sc-sales-followup {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--sc-sales-line);
  border-radius: var(--sc-sales-radius);
  background: var(--sc-sales-surface);
  box-shadow: none;
  min-width: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-instagram-handoff-panel.sc-sales-ig > h3,
#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-quote-followup-panel.sc-sales-followup > h3 {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--sc-sales-ink);
  letter-spacing: -0.01em;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--sc-sales-line);
  border-radius: 6px;
  background: var(--sc-sales-surface);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sc-sales-accent);
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] #dashboardQuoteFollowupKpis .metric-tile.dashboard-kpi::before {
  background: color-mix(in srgb, var(--sc-sales-accent) 70%, #1f2937);
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi strong {
  display: block;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--sc-sales-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi span {
  color: var(--sc-sales-muted);
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .dashboard-empty,
#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-body .dashboard-empty {
  margin: 0;
  padding: 12px 10px;
  border: 1px dashed var(--sc-sales-line);
  border-radius: 6px;
  background: var(--sc-sales-quiet);
  color: var(--sc-sales-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: left;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queues.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  min-width: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-panel.panel--nested {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--sc-sales-line);
  border-radius: 6px;
  background: var(--sc-sales-quiet);
  box-shadow: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-panel > h4 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--sc-sales-ink);
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-body {
  min-width: 0;
  overflow: hidden;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue {
  min-width: 0;
  overflow: hidden;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table.data-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0;
  display: table;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table thead th {
  padding: 4px 6px 6px 0;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--sc-sales-muted);
  text-align: left;
  border-bottom: 1px solid var(--sc-sales-line);
  white-space: nowrap;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table tbody td {
  padding: 6px 8px 6px 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--sc-sales-ink);
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
  border-bottom: 1px solid color-mix(in srgb, var(--sc-sales-line) 70%, transparent);
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table tbody tr:last-child td {
  border-bottom: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table tbody td:last-child {
  width: 5.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--sc-sales-muted);
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__item {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--sc-sales-line);
  min-width: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__company {
  margin: 0 0 2px;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--sc-sales-ink);
  overflow-wrap: break-word;
  word-break: normal;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__contact,
#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__meta {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sc-sales-muted);
  overflow-wrap: break-word;
  word-break: normal;
}

#dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__label {
  font-weight: 550;
  color: color-mix(in srgb, var(--sc-sales-muted) 80%, var(--sc-sales-ink));
}

@media screen and (max-width: 1280px) {
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi strong {
    font-size: 1.0625rem;
  }
}

@media screen and (max-width: 1024px) {
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queues.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-panel:last-child {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 1024px) and (min-width: 431px) {
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"]:not([hidden]) {
    padding-bottom: calc(var(--mobile-bottom-nav-h, 4rem) + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }
}

@media screen and (max-width: 768px) {
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queues.dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue-panel:last-child {
    grid-column: auto;
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__table.data-table {
    display: none;
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-queue__list {
    display: block;
  }
}

@media screen and (max-width: 430px) {
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] {
    padding-bottom: 0.5rem;
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-instagram-handoff-panel.sc-sales-ig,
  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .dashboard-quote-followup-panel.sc-sales-followup {
    padding: 12px;
  }

  #dashboardsView.sales-center-modern [data-dashboard-panel="sales"] .sc-sales-kpis .metric-tile.dashboard-kpi strong {
    font-size: 1rem;
  }
}
