/* Responsive layout corrections. Keep workflow and record data unchanged. */
.directory-workspace :is(.page-heading, .directory-header, .heading-actions, .panel-head, .form-actions, .dialog-top, .lead-overview-contact, .lead-contact-actions) {
  min-width: 0;
}
.directory-workspace :is(.page-heading, .directory-header, .heading-actions, .panel-head, .form-actions) {
  flex-wrap: wrap;
}
.directory-workspace .page-heading > div,
.directory-workspace .directory-header > div,
.directory-workspace .dialog-top > div {
  min-width: 0;
  max-width: 100%;
}
.directory-workspace .heading-actions {
  flex-shrink: 1;
  max-width: 100%;
  gap: 8px;
}
.directory-workspace .button {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.directory-workspace :is(h1, h2, h3, .breadcrumb strong, .lead-contact-actions a) {
  overflow-wrap: anywhere;
}
.directory-workspace .dialog-top {
  align-items: flex-start;
  gap: 14px;
}
.directory-workspace .dialog-top .icon-button {
  flex: 0 0 44px;
}
.directory-workspace #detail-title {
  line-height: 1.3;
}
.directory-workspace :is(.form-grid, .directory-filter-grid) > * {
  min-width: 0;
}
.directory-workspace :is(.field, .directory-filter) :is(select, textarea, input:not([type="checkbox"]):not([type="radio"])) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

/* Long column names stay inside their own headers at every breakpoint. */
.directory-workspace .directory-table.directory-compact th {
  height: auto;
  white-space: normal;
  vertical-align: middle;
  overflow-wrap: normal;
}
.directory-workspace .directory-table.directory-compact th button {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 0;
  white-space: normal;
  overflow-wrap: normal;
  line-height: 1.35;
  text-align: inherit;
}
.directory-workspace .directory-table.directory-compact td {
  height: auto;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.directory-workspace .directory-table .directory-title {
  display: block;
  max-width: 100%;
  height: auto;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.4;
}
.directory-workspace .directory-table .compact-value-basis {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
}
.directory-workspace .owner-company-table .owner-count-col > small {
  white-space: normal;
  overflow-wrap: normal;
  line-height: 1.35;
}
.directory-workspace .owner-company-table .owner-contact-col strong {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.directory-workspace .owner-company-table .owner-shared-warning {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

/* Summary counts and owner-research access must not be ellipsized away. */
.directory-workspace.lead-screen .directory-summary {
  height: auto;
  min-height: 22px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 14px;
  line-height: 1.5;
}
.directory-workspace.lead-screen .directory-summary > span:nth-child(2) {
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.directory-workspace .owner-research-link {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #205a9c;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.directory-workspace .lead-section-switches {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.directory-workspace .lead-section-switches summary > .icon,
.directory-workspace .lead-section-switches summary > .group-chevron {
  flex-shrink: 0;
}
.directory-workspace .lead-section-switches summary > span:not(.group-chevron) {
  min-width: 0;
  white-space: normal;
  overflow-wrap: normal;
  line-height: 1.3;
}
.directory-workspace .lead-tools-popup .directory-filter-grid {
  align-items: end;
}
.directory-workspace .lead-tools-popup .directory-popup-actions {
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  /* Override the shared nav column direction only for the bottom tab bar. */
  .directory-workspace:not(.lead-screen) .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex-direction: row;
    align-items: stretch;
    height: auto;
    min-height: 72px;
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .directory-workspace:not(.lead-screen) .mobile-tabbar a {
    width: auto;
    min-width: 0;
    max-width: 100%;
    min-height: 56px;
    padding: 6px 2px;
    gap: 4px;
    text-align: center;
  }
  .directory-workspace:not(.lead-screen) .mobile-tabbar small {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: normal;
    font-size: 10px;
    line-height: 1.25;
  }
  .directory-workspace:not(.lead-screen) {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .directory-workspace .page-heading > .heading-actions {
    width: 100%;
    flex: 0 1 100%;
    justify-content: flex-start;
  }
  .directory-workspace .directory-header {
    gap: 8px 12px;
    align-items: center;
  }
  .directory-workspace .directory-header > div:first-child {
    flex: 1 1 200px;
  }
  .directory-workspace.lead-screen .directory-header .heading-actions {
    width: 100%;
    flex: 0 1 100%;
    justify-content: flex-start;
  }
  .directory-workspace.lead-screen .directory-header h1 {
    white-space: normal;
    margin: 2px 0;
  }
  .directory-workspace.lead-screen .directory-summary > span:nth-child(2) {
    flex: 1 1 100%;
  }
  .directory-workspace .directory-table.owner-company-table.directory-compact th.col-project,
  .directory-workspace .directory-table.owner-company-table.directory-compact td.col-project {
    width: calc(100% - 174px);
  }
  .directory-workspace .directory-table.owner-company-table.directory-compact .owner-count-col {
    width: 60px;
    padding: 6px 4px;
  }
  .directory-workspace .directory-table.owner-company-table.directory-compact .col-value {
    width: 114px;
  }
  .directory-workspace .owner-company-table .owner-count-col > small {
    font-size: 10px;
  }
  .directory-workspace .directory-table.directory-compact .col-value strong {
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  .directory-workspace .directory-table.directory-compact .compact-value-basis {
    font-size: 10px;
    line-height: 1.4;
  }
  .directory-workspace .owner-company-table .compact-mobile-actions {
    gap: 2px 10px;
    align-items: flex-start;
  }
  .directory-workspace .owner-company-table .compact-mobile-actions :is(button, a) {
    white-space: normal;
    overflow-wrap: normal;
    line-height: 1.35;
    text-align: left;
  }
  .directory-workspace .lead-section-switches {
    gap: 8px;
  }
  .directory-workspace .lead-section-switches summary {
    gap: 6px;
  }
}

@media (max-width: 420px) {
  .directory-workspace .lead-tools-popup .directory-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .directory-workspace .lead-tools-popup .directory-popup-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .directory-workspace .lead-tools-popup .directory-popup-actions .directory-check {
    grid-column: 1 / -1;
    white-space: normal;
    margin-right: 0;
  }
}
