.companies-page {
  padding: 0 0 80px;
  max-width: 100%;
  margin: 0 auto;
}

.companies-page .page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.companies-page .page-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.companies-page .page-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.companies-page .page-title span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.companies-page .page-header .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.companies-page .search-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4.75px 12px;
  flex-grow: 1;
  max-width: 300px;
  background: var(--surface);
  gap: 8px;
}

.companies-page .search-input input {
  border: none;
  outline: none;
  padding: 4px;
  width: 100%;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.companies-page .search-input--large {
  max-width: 280px;
}

.companies-page .filters-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.companies-page .filters-bar .companies-filter-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
}

.companies-page .filters-bar .companies-filter-select.custom-select-wrapper {
  min-width: 0;
}

.companies-page .filters-bar .companies-filter-select .custom-select__trigger {
  height: 36px;
  width: max-content;
  min-width: 0;
  padding: 0 12px;
  white-space: nowrap;
}

.companies-page .filters-bar .companies-created-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.companies-page .filters-bar .companies-filter-select.is-set .custom-select__trigger {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.companies-page .filters-bar .companies-filter-select.is-set .custom-select__value {
  color: var(--brand);
  font-weight: 600;
}

.companies-page .companies-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.companies-page .companies-active-filters__label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.companies-page .companies-active-filters__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.companies-page .companies-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  background: var(--brand-soft);
  color: var(--text);
  box-shadow: none;
}

.companies-page .companies-filter-chip__field {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.companies-page .companies-filter-chip__field::after {
  content: "·";
  margin-left: 6px;
  color: var(--text-subtle);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.companies-page .companies-filter-chip__value {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.companies-page .companies-filter-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.companies-page .companies-filter-chip__remove svg {
  width: 12px;
  height: 12px;
}

.companies-page .companies-filter-chip__remove:hover {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand);
}

.companies-page .companies-active-filters__clear {
  flex: 0 0 auto;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

.companies-page .companies-active-filters__clear:hover {
  background: var(--brand-soft);
}

.companies-page .custom-select__option.is-selected {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.companies-viewbar {
  margin-bottom: 24px;
}

.companies-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.companies-tabs::-webkit-scrollbar {
  display: none;
}

.companies-tab {
  position: relative;
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.companies-tab.is-active {
  color: var(--brand);
  font-weight: 600;
}

/* QA #581: keyboard focus on these tabs (Reports, Sequences, record tabs). base.css turns
   :focus outlines off; drawn inside the tab because the strip scrolls (overflow-x) and would
   clip a ring outside it. */
.companies-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  border-radius: 4px;
}

.companies-tab__count {
  margin-left: 6px;
  font-weight: 600;
  color: inherit;
  opacity: 0.85;
}

.list-selection-bar {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 4%));
}

.list-selection-bar__section {
  display: flex;
  align-items: center;
  padding: 10px 16px;
}

.list-selection-bar__section + .list-selection-bar__section {
  border-left: 1px solid var(--border);
}

.list-selection-bar__section--end {
  margin-left: auto;
  border-left: 1px solid var(--border);
}

.list-selection-bar__count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.list-selection-bar__select-all {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.list-selection-bar__select-all:hover {
  text-decoration: underline;
}

.list-selection-bar__clear {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.list-selection-bar__clear:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.list-page-size {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.list-page-size__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.list-page-size__select.custom-select-wrapper {
  width: 92px;
  min-width: 92px;
}

.list-page-size__select .custom-select__trigger {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 8px;
  background: var(--bg, var(--surface));
}

.companies-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

.companies-tab--add {
  color: var(--brand);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.companies-filter-select {
  min-width: 140px;
}

.companies-filter-select .custom-select__trigger {
  font-size: 13px;
}

.companies-table-card {
  margin-top: 2px;
}

.companies-table {
  min-width: 900px;
}

.companies-check-cell {
  width: 40px;
  text-align: center !important;
  padding-left: 10px !important;
  padding-right: 6px !important;
}

.companies-check-cell input {
  width: 14px;
  height: 14px;
  accent-color: var(--brand);
}

.company-name-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
  text-decoration: none;
  color: var(--text);
}

.company-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.company-name-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.company-name-copy strong {
  font-size: 14px;
  color: var(--brand);
  font-weight: 600;
  white-space: nowrap;
}

.company-name-copy small {
  font-size: 12px;
  color: var(--text-subtle);
  line-height: 1.3;
}

.companies-empty {
  padding: 70px 20px;
  text-align: center;
  background: var(--surface);
}

.companies-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-subtle);
}

.companies-empty h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

.companies-empty p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.companies-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 4%));
}

.companies-pagination-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.companies-pagination-meta > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.companies-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.companies-page-arrow {
  width: 34px;
  height: 34px;
  padding: 0 !important;
}

.companies-page-arrow:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.companies-fixed-bar {
  position: fixed;
  z-index: 45;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  min-height: 58px;
  padding: 10px clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.companies-total {
  font-size: 13px;
  color: var(--text-muted);
}

.companies-total strong {
  color: var(--text);
  font-weight: 700;
}

.companies-fixed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 10020;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition:
    opacity var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.modal__body.crm-d-grid.crm-gap-3 {
  max-height: 470px;
}
@media (max-width: 991.98px) {
  .companies-fixed-bar {
    left: 0;
    padding: 9px 16px;
    width: 100%;
    max-width: 100%;
  }

  .companies-fixed-actions {
    overflow: auto;
    margin-left: 0;
  }

  .companies-filter-select {
    flex: 0 0 auto;
  }

  .companies-tabs {
    gap: 20px;
  }
}

@media (max-width: 767.98px) {
  .companies-fixed-bar {
    bottom: var(--mobile-nav-h, 0);
  }
  .companies-page {
    padding: 0 0 60px;
  }
  .companies-fixed-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .companies-fixed-actions {
    width: 100%;
  }

  .companies-fixed-actions .btn-crm {
    flex: 0 0 auto;
  }

  .companies-pagination {
    padding-bottom: 4px;
  }

  .companies-filter-select {
    min-width: 0;
  }

  .filters-bar {
    flex-wrap: nowrap;
    overflow: auto;
    padding-bottom: 10px;
  }
}

/* Lock the Companies page viewport while a right-side drawer is open. */
html.company-drawer-open,
html.company-drawer-open body,
body.company-drawer-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.company-drawer-open {
  touch-action: none;
}

/* The drawer remains the only scrollable area. */
.company-create-drawer.popup-drawer,
.company-edit-drawer.popup-drawer {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.company-create-drawer .crm-grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.company-create-drawer .company-drawer-select.custom-select-wrapper {
  display: block;
  width: 100%;
  min-width: 0;
}

@media (max-width: 520px) {
  .company-create-drawer .crm-grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

.company-create-drawer .company-drawer-select .custom-select__trigger {
  width: 100%;
  min-height: 46px;
}

.company-create-drawer .field {
  gap: 2px;
}

.company-create-drawer .field > label,
.company-create-drawer .field > .field__label {
  display: block;
  margin-bottom: 2px;
  padding-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.company-create-drawer .drawer-footer {
  background: var(--surface);
  border-top-color: var(--border);
}

.company-create-drawer .drawer-header {
  border-bottom-color: var(--border);
}

.company-create-drawer .popup-body-form,
.company-edit-drawer .popup-body-form {
  min-height: 0;
  height: auto;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.company-create-overlay,
.company-edit-overlay {
  touch-action: none;
}

/* Row height of the lists (view setting `rowHeight`, HUB-296). `default` adds no class. */
.crm-table--compact td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.crm-table--comfortable td {
  padding-top: 24px;
  padding-bottom: 24px;
}

/* View settings panel (ViewSettingsPanel): columns, row height, layout. */
.view-settings {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.view-settings .field {
  margin-bottom: 0;
}

.view-settings__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 6px;
}

.view-settings__heading .field__label {
  margin-bottom: 0;
}

.view-settings__segmented {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.view-settings__group + .view-settings__group {
  margin-top: var(--sp-3);
}

.view-settings__group-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
}

.view-settings__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.view-settings__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 8px;
  min-height: 40px;
  border-top: 1px solid var(--border);
}

.view-settings__item:first-child {
  border-top: 0;
}

.view-settings__item.is-selected {
  cursor: grab;
}

.view-settings__item.is-dragging {
  opacity: 0.45;
}

.view-settings__item.is-over {
  box-shadow: inset 0 2px 0 var(--brand);
}

.view-settings__label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-settings__badge {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 600;
}

.view-settings__grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: grab;
}

.view-settings__grip:focus-visible {
  outline: 2px solid var(--brand);
}

.view-settings__item .icon-btn:disabled,
.view-settings__item .icon-btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.view-settings__item .icon-btn:disabled:hover,
.view-settings__item .icon-btn.is-locked:hover {
  background: transparent;
  color: inherit;
}

/* B3 create panel: start. The 28 Oct design's Create Company panel (create-form.css). Every rule
   is scoped to .cc-design, which only CreateCompanyDrawer renders: Contacts', Leads' and Deals'
   drawers and the company Edit drawer share the other classes and stay as they are. */
.cc-design.popup-overlay {
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: none;
}
.cc-design.popup-drawer {
  width: 560px;
  max-width: 100%;
}
.cc-design.company-create-drawer .field > label,
.cc-design.company-create-drawer .field > .field__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cc-design .cf-req {
  margin-left: 2px;
  color: inherit;
}
.cc-design .cc-assoc {
  margin-top: 8px;
}
.cc-design .cc-assoc h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}
.cc-design .cc-assoc .cf-assoc__obj {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
/* Plain ×, as .cf-x (create-form.css:16-18; Staging vs Design P3-1). */
.cc-design .drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
}
.cc-design .drawer-close:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: none;
}
.cc-design .drawer-close svg {
  width: 20px;
  height: 20px;
}
/* Point 33: "Gosh, that looks familiar", under the domain field. */
.cc-design .cc-dup {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--warning-bg);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.cc-design .cc-dup__title {
  margin: 0 0 2px;
  font-weight: 600;
}
.cc-design .cc-dup__text {
  margin: 0;
}
.cc-design .cc-dup__list {
  margin: 4px 0 0;
  padding-left: 18px;
}
.cc-design .cc-dup a {
  color: var(--brand);
  font-weight: 600;
}
/* QA 3.1: single-choice custom fields (Type, Lifecycle stage) as the design's dropdown, its
   chevron and spacing (create-form.css:35). Height and font stay the panel's own inputs'. */
.cc-design .cf-select {
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475467' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}
.cc-design .cf-select:disabled {
  cursor: default;
}
/* The design has no dark theme; the app's own select chevron grey reads on a dark surface. */
.cc-design .cf-select:is([data-theme="dark"] *) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
/* B3 create panel: end */

/* B7 board card extras: start. An addition after the 28 Oct design's card foot (list-page.js
   card :2263-2272): linked contacts, the open-task pill (the design's .badge, components.css) and
   the Email and Task quick actions. Only Companies' cards draw .lp-bcard__extra. */
.lp-bcard__extra {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 24px;
}
.lp-bcard__avs {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.lp-bcard__av {
  display: inline-flex;
  border-radius: 50%;
  text-decoration: none;
}
.lp-bcard__av + .lp-bcard__av {
  margin-left: -6px;
}
.lp-bcard__av .lp-av {
  box-shadow: 0 0 0 2px var(--surface);
}
.lp-bcard__more {
  margin-left: 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.lp-bcard__extra .badge {
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-bcard__acts {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  margin-left: auto;
}
/* B7 board card extras: end */
