#crm-insights:not(:empty) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr);
  gap: 14px;
  margin-bottom: 14px;
}

#crm-insights:empty { display: none; }

#crm-insights .crm-queues {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

#crm-insights .crm-queue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  column-gap: 12px;
  padding: 14px;
  text-align: left;
  font-size: .875rem;
  line-height: 1.35;
}

#crm-insights .crm-queue strong {
  grid-area: 1 / 2 / span 2 / 3;
  font: 650 clamp(1.4rem, 3vw, 2rem) var(--mono);
  color: var(--text);
}

#crm-insights .crm-queue:first-child:enabled strong { color: var(--amber); }
#crm-insights .crm-queue small { margin-top: 3px; color: var(--muted); }

#crm-insights .crm-queue:disabled,
#crm-insights .crm-stage-filter:disabled { color: var(--muted); opacity: .78; cursor: default; }

#crm-insights .crm-funnel { min-width: 0; padding: 14px; }

#crm-insights .crm-funnel-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 7px;
}

#crm-insights .crm-funnel-heading p { margin: 0; font-size: .75rem; }

#crm-insights .crm-stage-filter {
  display: grid;
  grid-template-columns: minmax(6.6rem, auto) minmax(0, 1fr) minmax(2rem, auto);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: .8rem;
}

#crm-insights .crm-stage-filter:focus-visible { outline-offset: -2px; }
#crm-insights .crm-stage-filter strong { font: 650 .8rem var(--mono); text-align: right; }

#crm-insights .crm-queue:enabled:hover,
#crm-insights .crm-queue[aria-pressed="true"],
#crm-insights .crm-stage-filter:enabled:hover,
#crm-insights .crm-stage-filter[aria-pressed="true"] { border-color: #427573; background: #14313a; }

#crm-insights .crm-stage-track {
  display: flex;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: #263e51;
}

#crm-insights .crm-stage-track > span { flex: 0 0 auto; height: 100%; }

#crm-insights .crm-stage-breakdown {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
}

#crm-insights .crm-brand-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .75rem;
}

#crm-insights .crm-brand-legend li { display: flex; align-items: baseline; gap: 6px; }
#crm-insights .crm-brand-swatch { flex: 0 0 8px; height: 8px; border-radius: 2px; }
#crm .crm-reply-due { background: #f2be720a; }
#crm .crm-reply-due .crm-reply-status { color: var(--amber); }
#crm .crm-worklist {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  margin: 0 0 .8rem; padding: .45rem; border: 1px solid var(--line); border-radius: .6rem;
  background: #151e1a;
}
#crm .crm-work-filter {
  gap: .5rem; min-height: 39px; padding: .4rem .65rem;
  font-size: .8rem; font-weight: 650;
}
#crm .crm-work-filter strong { font: 650 .75rem var(--mono); color: var(--amber); }
#crm .crm-work-filter[aria-pressed="true"] { color: var(--mint); background: #243830; border-color: #455d52; }
.crm-desk { align-items: start; display: grid; grid-template-columns: minmax(0,1fr); gap: .8rem; }
.crm-contact-pane { min-width: 0; padding: 1rem; }
.crm-contact-pane h2 { font-size: 1.18rem; overflow-wrap: anywhere; }
.crm-pane-title { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.crm-contact-pane details { border-top: 1px solid var(--line); padding: .65rem 0; overflow-wrap:anywhere; }
.crm-contact-pane summary { color: var(--text); cursor: pointer; font-size: .84rem; }
.crm-contact-pane h3 { font-size: .95rem; }
.crm-contact-pane a { color: var(--mint); }
.crm-followup {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .65rem; margin: .85rem 0;
  padding: .8rem; background: #131e19; border: 1px solid var(--line); border-radius: .65rem;
}
.crm-followup h3, .crm-followup label:nth-of-type(3), .crm-followup .row-actions, .crm-followup p { grid-column: 1/-1; }
.crm-followup h3, .crm-followup p { margin: 0; }
.crm-followup p:empty { display: none; }
.crm-followup label { display: grid; min-width: 0; gap: .35rem; font-size: .78rem; color: var(--muted); }
.crm-followup input, .crm-followup select { min-width: 0; width: 100%; }
.crm-followup .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .4rem; }
.crm-followup button { min-height: 40px; }
.crm-selected { background: #b7e6cf16; }
.crm-due-overdue { color: var(--danger); }
.crm-due-today { color: var(--amber); }
@media (min-width: 1040px) {
  .crm-desk:has(.crm-contact-pane:not([hidden])) { grid-template-columns: minmax(0,1.5fr) minmax(270px,1fr); }
  .crm-contact-pane { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

@media (max-width: 800px) {
  #crm-insights:not(:empty) { grid-template-columns: minmax(0, 1fr); }
  #crm-insights .crm-queues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #crm-insights .crm-queue { padding: 11px; }
  #crm-insights .crm-stage-filter { min-height: 40px; }
  #crm .crm-work-filter { min-height: 44px; }
}

@media (max-width: 390px) {
  #crm-insights .crm-queue { grid-template-columns: minmax(0, 1fr); }
  #crm-insights .crm-queue strong { grid-area: auto; grid-row: 2; }
}
