/* CRM dashboard cockpit v1 · isolated from all other routes.
   Scoped to the DashboardView's temporary .crm-dashboard wrapper. */
#page-content:has(> .crm-dashboard) {
  padding-top: 22px !important;
  padding-bottom: 32px;
}
.crm-dashboard {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.crm-dashboard .page-head.crm-dashboard__head {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-bottom: 17px !important;
  margin-bottom: 18px !important;
  border-bottom: 1px solid var(--line) !important;
}
.crm-dashboard__head .left { max-width: none; min-width: 0; flex: 1 1 360px; }
.crm-dashboard__head .eyebrow {
  margin-bottom: 5px;
  font-size: .66rem;
  letter-spacing: .16em;
}
html[data-business-profile] .crm-dashboard__head.page-head h1,
.crm-dashboard__head.page-head h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.95rem, 2.9vw, 3rem) !important;
  line-height: 1.08 !important;
  letter-spacing: -.035em !important;
  text-wrap: balance;
}
.crm-dashboard__head.page-head .desc {
  max-width: 66ch;
  margin: 7px 0 0;
  color: var(--ink-muted);
  font-size: .82rem;
  line-height: 1.5;
}
.crm-dashboard__head-side {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 2px;
  flex: 0 0 auto;
}
.crm-dashboard__date {
  color: var(--ink-muted);
  font-size: .75rem;
  font-weight: 500;
}
.crm-dashboard__calendar-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: .8rem;
  font-weight: 650;
  text-decoration: none;
}
.crm-dashboard__calendar-link:hover {
  border-color: var(--ink-muted);
  background: var(--bg-alt);
}
.crm-dashboard .kpi-grid.crm-dashboard__kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px !important;
  margin-bottom: 17px;
}
.crm-dashboard__kpis > .kpi {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 128px;
  padding: 17px 18px !important;
  box-shadow: none;
}
.crm-dashboard__kpis .kpi-label {
  font-size: .69rem;
  letter-spacing: .09em;
  line-height: 1.4;
  margin-bottom: 9px;
}
html[data-business-profile] .crm-dashboard__kpis .kpi-value,
.crm-dashboard__kpis .kpi-value {
  font-size: clamp(1.65rem, 2.25vw, 2.35rem) !important;
  line-height: 1.12;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.crm-dashboard__kpis .kpi-sub {
  font-size: .75rem;
  line-height: 1.45;
  margin-top: 7px;
}
.crm-dashboard__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(295px, 1fr);
  gap: 16px;
  align-items: start;
}
.crm-dashboard__primary,
.crm-dashboard__aside {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.crm-dashboard .card {
  min-width: 0;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
}
.crm-dashboard .section-head {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line) !important;
}
html[data-business-profile] .crm-dashboard .section-head h2,
.crm-dashboard .section-head h2 {
  margin: 0;
  font-size: clamp(1.06rem, 1.55vw, 1.38rem) !important;
  line-height: 1.25;
  font-weight: 600;
}
.crm-dashboard .section-head a {
  flex: 0 0 auto;
  font-size: .75rem;
  font-weight: 600;
}
.crm-dashboard .stack {
  gap: 8px;
}
.crm-dashboard .card-flat {
  min-width: 0;
  padding: 11px 13px;
  border-color: var(--line);
  background: var(--bg-elev);
}
.crm-dashboard .card-flat .row-between {
  align-items: center;
  gap: 8px;
}
.crm-dashboard .card-flat .row-between > * {
  min-width: 0;
}
.crm-dashboard .card-flat .row-between .small,
.crm-dashboard .card-flat .row-between div,
.crm-dashboard .card-flat .small {
  overflow-wrap: anywhere;
}
.crm-dashboard .card-flat .eyebrow {
  margin-bottom: 3px !important;
  font-size: .66rem;
}
.crm-dashboard .card-flat .small {
  font-size: .73rem;
  line-height: 1.45;
}
.crm-dashboard .card-flat:focus-visible,
.crm-dashboard__calendar-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.crm-dashboard__chart .chart {
  min-width: 0;
  overflow: hidden;
}
.crm-dashboard__chart .chart svg {
  display: block;
  max-width: 100%;
}
.crm-dashboard__chart .chart rect { fill: #355944; }
.crm-dashboard__chart .chart text { fill: var(--ink-muted); }
.crm-dashboard__upcoming .empty-state {
  min-height: 90px;
  padding: 17px 12px;
}
.crm-dashboard .timeline {
  gap: 0;
}
.crm-dashboard .timeline-item {
  gap: 11px;
  padding: 10px 0;
  line-height: 1.5;
}
.crm-dashboard .timeline-item .meta { font-size: .74rem; }
.crm-dashboard__actions .stack { gap: 6px; }
.crm-dashboard__actions .card-flat {
  min-height: 48px;
  padding: 10px 13px;
}
.crm-dashboard__actions .card-flat:hover { border-color: var(--ink-muted); }
@media (max-width: 1160px) {
  .crm-dashboard .kpi-grid.crm-dashboard__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .crm-dashboard__grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  }
}
@media (max-width: 860px) {
  .crm-dashboard__grid { grid-template-columns: minmax(0, 1fr); }
  .crm-dashboard__head-side { align-items: flex-start; }
}
@media (max-width: 640px) {
  #page-content:has(> .crm-dashboard) { padding-top: 14px !important; }
  .crm-dashboard .page-head.crm-dashboard__head {
    gap: 11px;
    padding-bottom: 13px !important;
    margin-bottom: 15px !important;
  }
  html[data-business-profile] .crm-dashboard__head.page-head h1,
  .crm-dashboard__head.page-head h1 {
    font-size: clamp(1.85rem, 8.4vw, 2.55rem) !important;
  }
  .crm-dashboard__head-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .crm-dashboard .kpi-grid.crm-dashboard__kpis { gap: 9px !important; }
  .crm-dashboard__kpis > .kpi {
    min-height: 116px;
    padding: 14px !important;
  }
  .crm-dashboard__primary, .crm-dashboard__aside { gap: 12px; }
  .crm-dashboard .card { padding: 15px; }
}
@media (max-width: 390px) {
  .crm-dashboard .kpi-grid.crm-dashboard__kpis {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .crm-dashboard__kpis > .kpi { min-height: 0; }
}
@media print {
  #page-content:has(> .crm-dashboard) { padding: 0 !important; }
  .crm-dashboard__head-side { display: none; }
  .crm-dashboard__grid { display: block; }
  .crm-dashboard__primary, .crm-dashboard__aside { gap: 12px; }
  .crm-dashboard .card { break-inside: avoid; margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .crm-dashboard .card, .crm-dashboard .card-flat { transition: none; }
}
