.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.page-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.page-title .custom-select-wrapper {
  min-width: auto;
}
.page-title .custom-select__trigger {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  box-shadow: none;
}
.page-title .custom-select-wrapper.is-open .custom-select__trigger {
  box-shadow: none;
  border: none;
}
/* .page-title span {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
} */

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  white-space: nowrap;
}
.tab {
  padding: 8px 0;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  max-width: 140px; /* Force truncation for longer tabs */
}
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.tab.add-view {
  color: var(--brand);
  font-weight: 600;
  max-width: none;
}
/* QA #581: keyboard focus on a tab link (Reports tabs and every other .tabs strip). base.css
   turns :focus outlines off; the ring is drawn inside the tab because .tabs scrolls (overflow-x)
   and would clip a ring drawn outside it. */
.tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  border-radius: 4px;
}

.tab-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close,
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
  flex-shrink: 0;
}
.tab-close {
  width: 16px;
  height: 16px;
  font-size: 14px;
}
[data-draggable-item],
.tab {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.drag-handle {
  width: 14px;
  height: 14px;
  cursor: grab;
  touch-action: none;
}
.drag-handle:active,
.is-dragging,
.is-dragging * {
  cursor: grabbing !important;
}

/* Show icons on hover */
.tab:hover .tab-close,
.tab:hover .drag-handle {
  opacity: 1;
  visibility: visible;
}

/* Also show close icon on active tab by default (if preferred, or just hover)
   In screenshot it seems visible on hover. We'll stick to hover. */

.tab-close:hover {
  color: var(--danger);
}

.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.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);
}
.search-input input {
  border: none;
  outline: none;
  padding: 4px;
  width: 100%;
  background: transparent;
  color: var(--text);
}

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

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

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

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

.contacts-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;
}

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

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

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

.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.contact-initials {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.contact-details {
  display: flex;
  flex-direction: column;
}

.tag {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-opportunity {
  background: var(--yellow-bg);
  color: var(--yellow);
}
.tag-lead {
  background: var(--danger-bg);
  color: var(--danger);
}
.tag-customer {
  background: var(--success-bg);
  color: var(--success);
}
.tag-marketing {
  background: var(--pink-bg);
  color: var(--pink);
}
.tag-sales {
  background: var(--info-bg);
  color: var(--info);
}
.tag-subscriber {
  background: var(--orange-bg);
  color: var(--orange);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.btn:hover {
  background: var(--surface-hover);
}
.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
.btn-pagination {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.btn-pagination.active {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}
.btn-text {
  border: none;
  color: var(--brand);
  font-weight: 600;
  background: transparent;
  cursor: pointer;
}
.search-input--large {
  max-width: 280px;
}
.btn-icon-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
