/* Customers workspace settling
   Keep the directory, customer record, and relationship context inside the
   usable canvas beside the shared navigation at every desktop width. */
@media (min-width: 901px) {
  .premium-app.customer-reference-shell:not(.sidebar-collapsed) {
    grid-template-columns: 300px minmax(0, 1fr) !important;
  }

  .premium-app.customer-reference-shell:not(.sidebar-collapsed) > .crm-sidebar {
    width: 300px !important;
  }
}

.customers-page-v8,
.customer-directory-screen-v8,
.customer-directory-header-v8,
.customer-directory-layout-v8,
.customer-directory-panel-v8,
.customer-quick-preview-v8,
.customer-preview-hero-v8,
.customer-priority-grid-v8,
.customer-preview-lower-v8 {
  min-width: 0 !important;
  max-width: 100% !important;
}

.customers-page-v8,
.customer-directory-screen-v8,
.customer-directory-header-v8,
.customer-directory-layout-v8,
.customer-quick-preview-v8 {
  width: 100% !important;
}

.customer-directory-screen-v8 {
  grid-template-columns: minmax(0, 1fr) !important;
}

.customer-directory-layout-v8 {
  grid-template-columns: minmax(290px, 320px) minmax(0, 1fr) !important;
  overflow: hidden !important;
}

/* Four long filter labels cannot remain readable in one narrow row. */
.customer-directory-panel-v8 > nav {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.customer-directory-panel-v8 > nav button {
  min-width: 0 !important;
  min-height: 44px !important;
  padding-right: 8px !important;
  padding-left: 8px !important;
  white-space: normal !important;
  line-height: 1.15 !important;
}

.customer-directory-panel-v8 > nav button.active::after {
  left: 10px !important;
  right: 10px !important;
}

.customer-preview-identity-v8,
.customer-preview-identity-v8 > div,
.customer-preview-actions-v8,
.customer-preview-contact-v8,
.customer-preview-lower-v8 > *,
.customer-priority-grid-v8 > article,
.customer-priority-grid-v8 article > div {
  min-width: 0 !important;
}

@media (min-width: 901px) and (max-width: 1500px) {
  .customer-directory-header-v8 {
    display: grid !important;
    grid-template-columns: minmax(210px, auto) minmax(0, 1fr) !important;
  }

  .customer-directory-header-actions-v8 {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .customer-directory-header-actions-v8 > label:first-child {
    width: auto !important;
    min-width: 150px !important;
    flex: 1 1 220px !important;
  }

  .premium-app.customer-reference-shell .customer-directory-header-actions-v8 :is(.customer-directory-bulk-v8) {
    display: none !important;
  }

  .customer-preview-hero-v8 {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .customer-open-workspace-v8 {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .customer-preview-actions-v8 {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 8px 12px !important;
  }

  .customer-preview-contact-v8 {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    flex-wrap: wrap !important;
  }

  .customer-preview-actions-v8 a,
  .customer-preview-actions-v8 button:not(.customer-preview-build-project-v10) {
    width: 48px !important;
    min-width: 48px !important;
  }
}

@media (min-width: 901px) and (max-width: 1400px) {
  .customer-preview-lower-v8 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .customer-directory-layout-v8 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
