/**
 * Dashboard Overview — Visual Recovery V2
 * Coherent analytics surface (not a grid of identical bordered boxes).
 */

#dashboardView.dashboard-overview-modern {
  --dash-gap: 16px;
  --dash-radius: var(--v2-radius-lg);
  --dash-control: var(--v2-control-h);
  --dash-touch: var(--v2-touch);
  --dash-ink: var(--v2-text);
  --dash-muted: var(--v2-text-muted);
  --dash-line: var(--v2-border);
  --dash-surface: var(--v2-surface);
  --dash-surface-quiet: var(--v2-surface-muted);
  --dash-accent: var(--v2-brand-strong);
  --dash-accent-soft: var(--v2-brand-soft);
  gap: 14px;
  padding-bottom: 12px;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header {
  align-items: flex-end;
  gap: 12px;
  padding: 0;
  margin: 0 0 2px;
  border-bottom: 0;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__eyebrow {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--v2-text-faint);
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__title {
  font-size: var(--v2-type-page);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__sub {
  color: var(--v2-text-secondary);
  max-width: 36rem;
  margin: 4px 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__title {
  margin: 2px 0 0;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__eyebrow {
  margin: 0;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-header__actions .primary-button,
#dashboardView.dashboard-overview-modern .dashboard-overview-header__actions .ghost-button {
  min-height: var(--dash-control);
  border-radius: var(--v2-radius-sm);
  box-shadow: none;
}

/* KPI strip — one coherent analytics band */
#dashboardView.dashboard-overview-modern #metricGrid.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 4px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
}

#dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile {
  margin: 0;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-right: 1px solid var(--v2-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  position: relative;
}

#dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile::before {
  content: none;
  display: none;
  height: 0;
}

#dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile:last-child {
  border-right: 0;
}

#dashboardView.dashboard-overview-modern .dash-metric-tile__label {
  font-size: var(--v2-type-meta);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v2-text-faint);
}

#dashboardView.dashboard-overview-modern .dash-metric-tile__value {
  font-size: var(--v2-type-kpi);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
  line-height: 1.15;
}

#dashboardView.dashboard-overview-modern .dash-metric-tile__hint {
  font-size: var(--v2-type-meta);
  color: var(--v2-text-muted);
  background: transparent;
  border-radius: 0;
  padding: 0;
  display: inline;
}

/* Primary workspace: forecast + tasks without nested card chrome overload */
#dashboardView.dashboard-overview-modern .dashboard-overview-primary {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  align-items: start;
}

#dashboardView.dashboard-overview-modern #dashboardOpportunityCounts {
  max-height: 18.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-panel.panel {
  margin: 0;
  padding: 0;
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  background: var(--v2-surface);
  box-shadow: var(--v2-shadow-xs);
  overflow: hidden;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-panel > .panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin: 0;
  border-bottom: 1px solid var(--v2-border);
  background: var(--v2-surface-muted);
}

#dashboardView.dashboard-overview-modern .dashboard-overview-panel > .panel-heading h2 {
  margin: 0;
  font-size: var(--v2-type-section);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--v2-text);
}

#dashboardView.dashboard-overview-modern .dashboard-overview-panel > .panel-heading .ghost-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8125rem;
}

#dashboardView.dashboard-overview-modern #stageBars,
#dashboardView.dashboard-overview-modern #upcomingTasks,
#dashboardView.dashboard-overview-modern #recentLeads,
#dashboardView.dashboard-overview-modern #priorityDeals,
#dashboardView.dashboard-overview-modern #activityList,
#dashboardView.dashboard-overview-modern .dash-count-list {
  padding: 8px 10px 12px;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-upcoming,
#dashboardView.dashboard-overview-modern .dashboard-overview-forecast {
  margin: 0;
}

#dashboardView.dashboard-overview-modern .dash-count-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dashboardView.dashboard-overview-modern #dashboardOpportunityTotal {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--dash-ink);
}

#dashboardView.dashboard-overview-modern .dash-count-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#dashboardView.dashboard-overview-modern .dash-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#dashboardView.dashboard-overview-modern .dash-count-row:hover {
  background: var(--dash-surface-quiet);
}

#dashboardView.dashboard-overview-modern .dash-count-row__label {
  font-size: 0.875rem;
  color: var(--dash-ink);
}

#dashboardView.dashboard-overview-modern .dash-count-row__value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 2.5ch;
  text-align: right;
  color: var(--dash-muted);
}

#dashboardView.dashboard-overview-modern .dash-count-row.is-nonzero .dash-count-row__value {
  color: var(--dash-accent);
}

#dashboardView.dashboard-overview-modern .dash-count-empty {
  margin: 8px 10px;
}

#dashboardView.dashboard-overview-modern .dashboard-overview-forecast .dash-stage-row,
#dashboardView.dashboard-overview-modern .dashboard-overview-forecast .stage-row {
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
}

#dashboardView.dashboard-overview-modern .dash-stage-row,
#dashboardView.dashboard-overview-modern .stage-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--v2-border) 70%, transparent);
}

#dashboardView.dashboard-overview-modern .dash-stage-row:last-child,
#dashboardView.dashboard-overview-modern .stage-row:last-child {
  border-bottom: 0;
}

#dashboardView.dashboard-overview-modern .dash-list-item.priority-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--v2-border) 75%, transparent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#dashboardView.dashboard-overview-modern .dash-list-item.priority-item:last-child {
  border-bottom: 0;
}

#dashboardView.dashboard-overview-modern .dash-list-item__title {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--v2-text);
}

#dashboardView.dashboard-overview-modern .dashboard-overview-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

#dashboardView.dashboard-overview-modern .dash-list-item__meta {
  color: var(--v2-text-muted);
  font-size: var(--v2-type-meta);
  gap: 8px;
}

#dashboardView.dashboard-overview-modern .activity-panel .activity-list,
#dashboardView.dashboard-overview-modern .activity-item {
  border-color: transparent;
}

@media (max-width: 1100px) {
  #dashboardView.dashboard-overview-modern #metricGrid.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile:nth-child(2n) {
    border-right: 0;
  }

  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile:nth-child(-n + 2) {
    border-bottom: 1px solid var(--v2-border);
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-primary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #dashboardView.dashboard-overview-modern {
    gap: 10px;
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-header {
    align-items: stretch;
    gap: 8px;
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-header__sub {
    display: none;
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-header__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Compact 2×2 KPI bento — keep one analytics surface, not a tall stack */
  #dashboardView.dashboard-overview-modern #metricGrid.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
  }

  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile {
    border-right: 1px solid var(--v2-border);
    border-bottom: 1px solid var(--v2-border);
    padding: 10px 12px;
    min-height: 0;
    gap: 2px;
  }

  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile:nth-child(2n) {
    border-right: 0;
  }

  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile:nth-child(n + 3) {
    border-bottom: 0;
  }

  #dashboardView.dashboard-overview-modern .dash-metric-tile__label {
    font-size: 0.625rem;
  }

  #dashboardView.dashboard-overview-modern .dash-metric-tile__value {
    font-size: 1.125rem;
  }

  #dashboardView.dashboard-overview-modern .dash-metric-tile__hint,
  #dashboardView.dashboard-overview-modern .metric-tile.dash-metric-tile small {
    font-size: 0.625rem;
    margin-top: 0;
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-header__actions .ghost-button,
  #dashboardView.dashboard-overview-modern .dashboard-overview-header__actions .primary-button {
    min-height: var(--dash-touch);
  }

  #dashboardView.dashboard-overview-modern .dashboard-overview-secondary {
    grid-template-columns: 1fr;
  }
}
