/* CRM top area: compact date context + Quick Actions only. */
html body[data-view="crm"] .aq-crm-premium {
  gap: 10px !important;
}

html body[data-view="crm"] .aq-crm-pagehead {
  display: none !important;
}

html body[data-view="crm"] .aq-crm-pagehead > div:first-child {
  display: none !important;
}

html body[data-view="crm"] .aq-crm-pagehead nav {
  order: 1 !important;
  width: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  display: flex !important;
  align-items: center !important;
  background: transparent !important;
}

html body[data-view="crm"] .aq-crm-pagehead nav > button,
html body[data-view="crm"] .aq-crm-pagehead nav .aq-crm-system {
  display: none !important;
}

html body[data-view="crm"] .aq-crm-pagehead nav .aq-crm-context {
  display: none !important;
}

html body[data-view="crm"] .aq-crm-pagehead nav .aq-crm-date-clean {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 32px !important;
  padding: 0 11px !important;
  border: 1px solid #dbe4ed !important;
  border-radius: 8px !important;
  color: #66788e !important;
  background: #fff !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

html body[data-view="crm"] .aq-crm-head-actions {
  order: 2 !important;
  width: auto !important;
  max-width: none !important;
  height: 40px !important;
  padding: 0 !important;
  align-items: center !important;
}

html body[data-view="crm"] .aq-crm-head-actions .crm-new-menu {
  width: auto !important;
  max-width: none !important;
}

html body[data-view="crm"] .aq-crm-head-actions .aq-crm-quick {
  width: 174px !important;
  min-width: 174px !important;
  max-width: 174px !important;
  min-height: 40px !important;
  height: 40px !important;
}

html body[data-view="crm"] .aq-crm-head-actions .crm-new-dropdown {
  top: 44px !important;
  right: 0 !important;
}

@media (max-width: 720px) {
  html body[data-view="crm"] .aq-crm-filter-actions { grid-column: 1 / -1 !important; }
}

html body[data-view="crm"] .aq-crm-filters {
  grid-template-columns: minmax(170px,.7fr) minmax(170px,.7fr) minmax(260px,1.25fr) 118px auto !important;
  align-items: end !important;
  gap: 10px !important;
  padding: 10px 12px !important;
}

html body[data-view="crm"] .aq-crm-filters label {
  align-self: end !important;
  gap: 5px !important;
}

html body[data-view="crm"] .aq-crm-filters label > span {
  min-height: 12px !important;
  font-size: 9.5px !important;
  line-height: 12px !important;
}

html body[data-view="crm"] .aq-crm-filters select,
html body[data-view="crm"] .aq-crm-filters > button,
html body[data-view="crm"] .aq-crm-filter-date,
html body[data-view="crm"] .aq-crm-filter-actions .aq-crm-quick {
  min-height: 42px !important;
  height: 42px !important;
  max-height: 42px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
}

html body[data-view="crm"] .aq-crm-filters select {
  padding: 0 32px 0 12px !important;
  font-size: 11.5px !important;
}

html body[data-view="crm"] .aq-crm-filters > button {
  width: 118px !important;
  padding: 0 12px !important;
  font-size: 10px !important;
}

html body[data-view="crm"] .aq-crm-filter-actions {
  display: flex !important;
  align-items: center !important;
  align-self: end !important;
  gap: 8px !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  padding: 0 !important;
  min-width: max-content !important;
}

html body[data-view="crm"] .aq-crm-filter-date {
  padding: 0 10px !important;
  border: 1px solid #d5dee7 !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  color: #66788e !important;
  background: #fff !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

html body[data-view="crm"] .aq-crm-filter-actions .crm-new-menu {
  position: relative !important;
}

html body[data-view="crm"] .aq-crm-filter-actions .aq-crm-quick {
  width: 158px !important;
  min-width: 158px !important;
  max-width: 158px !important;
  padding: 0 9px 0 12px !important;
  border: 1px solid #d9502e !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  color: #fff !important;
  background: linear-gradient(135deg,#ee6a43,#dc4f2e) !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  box-shadow: 0 5px 12px rgba(164,57,31,.14) !important;
}

html body[data-view="crm"] .aq-crm-filter-actions .aq-crm-quick b {
  display: grid !important;
  place-items: center !important;
  min-width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: rgba(255,255,255,.2) !important;
  font-size: 9px !important;
}

html body[data-view="crm"] .aq-crm-filter-actions .crm-new-dropdown {
  position: absolute !important;
  z-index: 80 !important;
  top: 47px !important;
  right: 0 !important;
  width: 610px !important;
  max-width: calc(100vw - 330px) !important;
}

html body[data-view="crm"] .aq-crm-filter-actions .crm-new-menu.open .crm-new-dropdown {
  display: grid !important;
}

@media (max-width: 1250px) {
  html body[data-view="crm"] .aq-crm-filters {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  html body[data-view="crm"] .aq-crm-filters > label:nth-child(3) { grid-column: 1 / -1 !important; }
  html body[data-view="crm"] .aq-crm-filter-actions { justify-self: end !important; }
}

/* Follow-up register: stronger hierarchy, clearer urgency, natural height. */
html body[data-view="crm"] .aq-crm-follow-panel {
  align-self: start !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

html body[data-view="crm"] .aq-crm-follow-panel > header {
  min-height: 66px !important;
  padding: 13px 18px !important;
}

html body[data-view="crm"] .aq-crm-follow-panel > header h2 {
  font-size: 18px !important;
  line-height: 1.15 !important;
}

html body[data-view="crm"] .aq-crm-follow-panel > header p {
  margin-top: 4px !important;
  color: #6a7d93 !important;
  font-size: 11.5px !important;
}

html body[data-view="crm"] .aq-crm-follow-panel > header > button {
  color: #1d5b8f !important;
  font-size: 11.5px !important;
}

html body[data-view="crm"] #view .aq-crm-follow-list {
  max-height: none !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 3px 16px 5px !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  scrollbar-width: none !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row {
  grid-template-columns: minmax(240px,1.45fr) minmax(120px,.52fr) minmax(160px,.62fr) 86px !important;
  gap: 13px !important;
  min-height: 58px !important;
  padding: 9px 4px !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row span b {
  color: #102744 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row > strong {
  color: #173a5e !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row em {
  min-height: 29px !important;
  padding: 0 12px !important;
  border: 1px solid transparent !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 850 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row em.overdue-critical {
  border-color: #f3b4ac !important;
  color: #a92d24 !important;
  background: #fee7e4 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row em.overdue {
  border-color: #f4cf91 !important;
  color: #a95708 !important;
  background: #fff0d7 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row i {
  min-height: 31px !important;
  padding: 0 11px !important;
  border: 1px solid #b9cee2 !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  color: #194f7d !important;
  background: #f7fbff !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  font-style: normal !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row:hover {
  background: #f8fbfe !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row:hover i {
  border-color: #2b6ea5 !important;
  color: #fff !important;
  background: #2b6ea5 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row i svg {
  width: 13px !important;
  height: 13px !important;
}

/* CRM dashboard usability corrections: keep actions visible and avoid nested desktop scrolling. */
html body[data-view="crm"] .aq-crm-follow-panel,
html body[data-view="crm"] .aq-crm-customer-panel {
  min-width: 0 !important;
  overflow: hidden !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row {
  grid-template-columns: minmax(0,1fr) minmax(88px,.42fr) minmax(124px,.52fr) 70px !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row > * {
  min-width: 0 !important;
}

html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row i {
  width: 70px !important;
  padding: 0 7px !important;
  box-sizing: border-box !important;
}

html body[data-view="crm"] #view :is(
  .aq-crm-pipeline-panel .crm-control-table-wrap,
  .aq-customer-performance-list,
  .aq-crm-follow-list
) {
  max-height: none !important;
  overflow: visible !important;
  scrollbar-gutter: auto !important;
}

html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table {
  min-width: 0 !important;
  table-layout: fixed !important;
}

html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(1) { width: 38% !important; }
html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(2) { width: 15% !important; }
html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(3) { width: 10% !important; }
html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(4) { width: 17% !important; }
html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(5) { width: 15% !important; }
html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table th:nth-child(6) { width: 5% !important; }

html body[data-view="crm"] .aq-customer-performance-head,
html body[data-view="crm"] .aq-customer-performance-row {
  grid-template-columns: minmax(0,1fr) 112px 142px !important;
  column-gap: 12px !important;
}

html body[data-view="crm"] .aq-customer-performance-row > .crm-win-rate {
  min-width: 86px !important;
  white-space: nowrap !important;
}

@media (max-width: 1180px) {
  html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row {
    grid-template-columns: minmax(0,1fr) 110px 140px 74px !important;
  }
}

@media (max-width: 720px) {
  html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row {
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 7px 10px !important;
  }

  html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row em,
  html body[data-view="crm"] .aq-crm-follow-list .crm-priority-row i {
    justify-self: start !important;
  }

  html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table-wrap {
    overflow-x: auto !important;
  }

  html body[data-view="crm"] .aq-crm-pipeline-panel .crm-control-table {
    min-width: 720px !important;
    table-layout: auto !important;
  }

  html body[data-view="crm"] .aq-customer-performance-head,
  html body[data-view="crm"] .aq-customer-performance-row {
    grid-template-columns: minmax(0,1fr) 96px 112px !important;
    padding-inline: 12px !important;
    column-gap: 8px !important;
  }
}
