/* =========================================================
   CRM THREE COLUMN CONTACT LAYOUT
   ========================================================= */

.crm-contact-layout {
  width: 100%;
  /* Outer inset comes from .app__main (same as /companies list). */
  height: calc(100vh - var(--header-h) - var(--sp-8) - var(--sp-12));
  min-height: 0;
  padding: 0;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.crm-contact-layout > .company-record-header {
  flex: 0 0 auto;
}

.crm-contact-layout__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  /* Constrain columns to the row height so overflow-y:auto can scroll. */
  overflow: hidden;
  --crm-gutter-x: 14px;
  --crm-gutter-y: 0;
}

/* Desktop: exactly 3 / 6 / 3 columns */
.crm-contact-layout__left {
  flex: 0 0 25%;
  max-width: 25%;
}

.crm-contact-layout__center {
  flex: 0 0 50%;
  max-width: 50%;
}

.crm-contact-layout__right {
  flex: 0 0 25%;
  max-width: 25%;
}

/* Utility classes are the source of the column widths.
   The rules above only keep the three panels in one row. */

.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  position: relative;
  min-width: 0;
  min-height: 0;
}

/* =========================================================
   LEFT PANEL
   ========================================================= */

.crm-contact-layout__left {
  /* Row has a definite height (flex + overflow:hidden); fill it and scroll. */
  height: 100%;
  min-height: 0;
  align-self: stretch;

  overflow-x: hidden;
  overflow-y: auto;

  padding-bottom: 28px;
  box-sizing: border-box;

  scrollbar-width: thin;
  border-radius: var(--radius-lg);
  scrollbar-color: var(--border-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

/* =========================================================
   LEFT STICKY CONTACT HEADER
   ========================================================= */

.crm-left-sticky-contact {
  position: sticky;
  top: 0;

  z-index: 8;

  width: 100%;

  margin-bottom: 0;

  padding: 0 14px;

  background: var(--surface);

  border: 1px solid var(--border-strong);
  border-radius: 0 0 16px 16px;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(-100%);

  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;

  /*
     * Keep the compact card out of the normal layout while it
     * is hidden. Once visible, sticky positioning keeps it at
     * the top while the cards below continue to scroll.
     */
  max-height: 0;
  overflow: hidden;
}

.crm-left-sticky-contact.is-visible {
  max-height: 108px;
  border-radius: var(--radius-lg);

  padding-top: 15px;
  padding-bottom: 15px;

  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: translateY(0);

  margin-bottom: -108px;
}

.crm-left-sticky-contact__top {
  display: flex;
  align-items: center;

  min-height: 30px;

  gap: 8px;
}

.crm-left-sticky-contact__back,
.crm-left-sticky-contact__actions {
  display: inline-flex;
  align-items: center;

  border: 0;

  background: transparent;

  color: var(--text);

  padding: 0;

  cursor: pointer;
}

.crm-left-sticky-contact__back {
  width: 20px;
  height: 20px;

  justify-content: center;

  flex: 0 0 20px;
}

.crm-left-sticky-contact__back svg {
  width: 18px;
  height: 18px;

  fill: none;
  stroke: var(--text-muted);

  stroke-width: 1.8;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-left-sticky-contact__title {
  margin-right: auto;

  color: var(--text);

  font-size: 16px;
  font-weight: 700;

  line-height: 1;
}

.crm-left-sticky-contact__actions {
  gap: 4px;

  font-size: 14px;
  font-weight: 700;

  line-height: 1;
}

.crm-left-sticky-contact__actions svg {
  width: 14px;
  height: 14px;

  fill: none;
  stroke: currentColor;

  stroke-width: 2;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-left-sticky-contact__person {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 8px;
}

.crm-left-sticky-contact__avatar {
  position: relative;

  width: 28px;
  height: 28px;

  flex: 0 0 28px;
}

.crm-left-sticky-contact__avatar span {
  position: absolute;

  width: 7px;
  height: 7px;

  background: #29a9ed;

  transform: rotate(45deg);
}

.crm-left-sticky-contact__avatar span:nth-child(1) {
  left: 16px;
  top: 6px;
}

.crm-left-sticky-contact__avatar span:nth-child(2) {
  left: 10px;
  top: 12px;
}

.crm-left-sticky-contact__avatar span:nth-child(3) {
  right: 5px;
  top: 18px;
}

.crm-left-sticky-contact__avatar span:nth-child(4) {
  left: 22px;
  bottom: 9px;
}

.crm-left-sticky-contact__name {
  color: var(--text);

  font-size: 16px;
  font-weight: 700;

  line-height: 1.2;
}

/* =========================================================
   CENTER PANEL
   ========================================================= */

.crm-contact-layout__center {
  height: 100%;

  min-width: 0;
  min-height: 0;

  overflow: hidden;
}

/* =========================================================
   RIGHT PANEL
   ========================================================= */

.crm-contact-layout__right {
  height: 100%;
  min-height: 0;
  align-self: stretch;

  min-width: 0;

  overflow-x: hidden;
  overflow-y: auto;

  padding-bottom: 28px;
  box-sizing: border-box;

  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  -webkit-overflow-scrolling: touch;

  transition:
    opacity 0.2s ease,
    transform 0.28s ease;
}

/* =========================================================
   COMMON PANEL
   ========================================================= */

.crm-panel {
  display: flex;
  flex-direction: column;

  gap: 12px;

  min-width: 0;
}

/* =========================================================
   CENTER
   ========================================================= */

.crm-center-panel {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;

  min-height: 0;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);

  overflow: hidden;
}

/* =========================================================
   CENTER TABS
   ========================================================= */

.crm-center-tabs {
  display: flex;
  align-items: stretch;

  flex: 0 0 60px;

  border-bottom: 1px solid var(--border);

  overflow-x: auto;

  scrollbar-width: none;
}

.crm-center-tabs::-webkit-scrollbar {
  display: none;
}

.crm-center-tab {
  position: relative;

  flex: 1 0 auto;

  min-width: 145px;

  padding: 0 24px;

  border: 0;
  border-right: 1px solid var(--border);

  background: var(--surface);

  color: var(--text-muted);

  font-size: 15px;
  font-weight: 500;

  white-space: nowrap;

  cursor: pointer;

  transition:
    color 0.18s ease,
    background-color 0.18s ease;
}

.crm-center-tab:hover {
  background: var(--surface-2);

  color: var(--text);
}

.crm-center-tab.is-active {
  color: var(--text);

  font-weight: 650;
}

.crm-center-tab.is-active::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 3px;

  background: var(--brand);
}

/* =========================================================
   CENTER CONTENT
   ========================================================= */

.crm-center-content {
  flex: 1;

  min-height: 0;

  padding: 20px;

  overflow-y: auto;

  background: var(--bg);

  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* =========================================================
   EMPTY CARDS
   ========================================================= */

.crm-empty-card {
  flex: none;

  width: 100%;

  padding: 14px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);
}

.crm-empty-card--profile {
  min-height: 230px;
}

.crm-empty-card--large {
  min-height: 250px;
}

.crm-empty-card--playbook {
  min-height: 230px;
}

/* =========================================================
   CARD HEADER
   ========================================================= */

.crm-empty-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 15px;

  margin-bottom: 18px;
}

/* =========================================================
   PROFILE
   ========================================================= */

.crm-empty-profile {
  display: flex;
  align-items: center;

  gap: 14px;

  margin-bottom: 22px;
}

.crm-empty-profile__lines {
  flex: 1;

  min-width: 0;
}

/* =========================================================
   COMPANY
   ========================================================= */

.crm-empty-company {
  display: flex;
  align-items: center;

  gap: 13px;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.crm-empty-actions {
  display: grid;

  grid-template-columns: repeat(5, minmax(0, 1fr));

  gap: 7px;
}

/* =========================================================
   EMPTY CONTENT
   ========================================================= */

.crm-empty-content {
  display: flex;
  flex-direction: column;

  gap: 13px;
}

/* =========================================================
   SKELETON
   ========================================================= */

.crm-skeleton {
  display: block;

  height: 10px;

  border-radius: 5px;

  background: linear-gradient(
    90deg,
    var(--surface-3),
    var(--surface-hover),
    var(--surface-3)
  );

  background-size: 200% 100%;

  animation: crmSkeleton 2s ease-in-out infinite;
}

@keyframes crmSkeleton {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* =========================================================
   SKELETON SIZES
   ========================================================= */

.crm-skeleton--sm {
  width: 100px;
}

.crm-skeleton--title {
  width: 120px;
  height: 15px;
}

.crm-skeleton--name {
  width: 175px;
  height: 18px;

  margin-bottom: 9px;
}

.crm-skeleton--line {
  width: 100%;
  max-width: 210px;
}

.crm-skeleton--short {
  max-width: 135px;
}

.crm-skeleton--medium {
  max-width: 60%;
}

.crm-skeleton--avatar {
  width: 58px;
  height: 58px;

  flex: 0 0 58px;

  border-radius: 50%;
}

.crm-skeleton--company-logo {
  width: 50px;
  height: 50px;

  flex: 0 0 50px;

  border-radius: 9px;
}

.crm-skeleton--action {
  width: 42px;
  height: 11px;
}

.crm-skeleton--action-box {
  width: 100%;
  height: 42px;

  border-radius: 8px;
}

.crm-skeleton--label {
  width: 75px;
  height: 8px;

  margin-top: 4px;
}

.crm-skeleton--button {
  width: 115px;
  height: 34px;

  margin: 22px auto 0;

  border-radius: 18px;
}

.crm-skeleton--main-title {
  width: 160px;
  height: 17px;

  margin-bottom: 25px;
}

.crm-skeleton--main-line {
  width: 100%;
  height: 12px;

  margin-bottom: 15px;
}

/* =========================================================
   CENTER ACTIVITY VIEW
   ========================================================= */

.crm-activity-tabs {
  display: flex;
  align-items: stretch;
  flex: 0 0 60px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.crm-activity-tabs::-webkit-scrollbar {
  display: none;
}

.crm-activity-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 112px;
  height: 60px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.crm-activity-tab:hover {
  color: var(--text);
}

.crm-activity-tab.is-active {
  color: var(--text);
}

.crm-activity-tab.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--text);
}

.crm-activity-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 24px;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.crm-activity-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 10px;
}

.crm-activity-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Second row under tabs: Filters + Create/Log CTAs (design). */
.crm-activity-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 0 14px;
}

.crm-activity-actions__spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.crm-activity-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding-inline: 14px;
}

.crm-activity-add-btn__icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.crm-activity-add-btn__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding-inline: 14px;
}

.crm-activity-filters-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-filters-btn.is-active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft, color-mix(in srgb, var(--brand) 12%, transparent));
}

.crm-activity-filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.crm-activity-filter-panel__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.crm-activity-filter-panel__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.crm-activity-filter-panel__clear {
  grid-column: 1 / -1;
  justify-self: end;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.crm-activity-filter-panel__clear:hover {
  text-decoration: underline;
}

.crm-activity-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  color: #fff;
}

.crm-activity-type-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-type-icon--note {
  background: #e8912d;
  border-radius: 999px;
}

.crm-activity-type-icon--email {
  background: #3b82f6;
}

.crm-activity-type-icon--call {
  background: #10b981;
}

.crm-activity-type-icon--task {
  background: #8b5cf6;
}

.crm-activity-type-icon--meeting {
  background: #0ea5e9;
}

/* HUB-327: SMS / WhatsApp / LinkedIn messages and postal mail. */
.crm-activity-type-icon--communication {
  background: #14b8a6;
}

.crm-activity-type-icon--postal {
  background: #64748b;
}

.crm-activity-type-icon--default {
  background: var(--text-muted);
}

.crm-activity-search {
  position: relative;
  width: 242px;
  flex: 0 0 242px;
}

.crm-activity-search input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.crm-activity-search input::placeholder {
  color: var(--text-muted);
}

.crm-activity-search input:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.crm-activity-search svg {
  position: absolute;
  top: 11px;
  right: 16px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.crm-activity-expand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.crm-activity-expand svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.crm-activity-filters::-webkit-scrollbar {
  display: none;
}

.crm-activity-filter,
.crm-activity-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.crm-activity-filter:hover,
.crm-activity-clear:hover {
  background: var(--surface-hover);
}

.crm-activity-filter.is-active {
  background: var(--surface-3);
}

.crm-activity-filter svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-clear {
  margin-left: auto;
}

.crm-activity-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crm-activity-month-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crm-activity-month {
  padding: 6px 0 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.crm-activity-card {
  padding: 20px 42px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.crm-activity-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.crm-activity-card__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.crm-activity-card__title strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.crm-activity-card__top time {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.crm-activity-info-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-activity-card__description {
  margin-top: 9px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-line;
}

.crm-activity-actor {
  color: var(--brand);
  font-weight: 700;
}

.crm-activity-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.crm-activity-link:hover {
  text-decoration: underline;
}

.crm-activity-empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 991.98px) {
  .crm-activity-card {
    padding-left: 24px;
    padding-right: 24px;
  }

  .crm-activity-card__top {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .crm-activity-filter-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .crm-activity-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .crm-activity-tabs {
    padding-left: 0;
  }

  .crm-activity-tab {
    min-width: auto;
    padding-left: 12px;
    padding-right: 12px;
    font-size: 13px;
  }

  .crm-activity-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-activity-search {
    width: 100%;
    flex-basis: auto;
  }

  .crm-activity-expand {
    align-self: flex-end;
  }

  .crm-activity-card {
    padding: 16px;
    border-radius: 14px;
  }

  .crm-activity-card__description {
    font-size: 14px;
  }
}

/* =========================================================
   CENTER EMPTY CARDS
   ========================================================= */

.crm-empty-main-card {
  width: 100%;

  min-height: 145px;

  margin-bottom: 14px;

  padding: 24px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);
}

.crm-empty-main-card--large {
  min-height: 280px;
}

/* =========================================================
   ALWAYS VISIBLE COLLAPSE BUTTON
   IMPORTANT:
   It is outside the right panel.
   ========================================================= */

.crm-panel-collapse {
  display: none !important;
  position: absolute;

  top: 52px;

  /*
       The columns are 3 / 6 / 3, so the
       center/right boundary is exactly 75%
       of the layout width. Keep the button
       centered on that boundary.
    */

  left: calc(var(--crm-collapse-left, 75%) - 19px);
  right: auto;

  z-index: 100;

  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  padding: 0;

  background: var(--surface);

  color: var(--text-muted);

  border: 1px solid var(--border-strong);

  border-radius: 50%;

  box-shadow: var(--shadow-sm);

  cursor: pointer;

  transition:
    right 0.28s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.28s ease;
}

.crm-panel-collapse:hover {
  background: var(--surface-hover);

  color: var(--brand);
}

.crm-panel-collapse svg {
  width: 17px;
  height: 17px;

  fill: none;

  stroke: currentColor;

  stroke-width: 1.7;

  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =========================================================
   COLLAPSED RIGHT PANEL
   ========================================================= */

.crm-contact-layout.is-right-collapsed .crm-contact-layout__left {
  flex: 0 0 25%;
  max-width: 25%;
}

.crm-contact-layout.is-right-collapsed .crm-contact-layout__center {
  flex: 0 0 75%;
  max-width: 75%;
}

/*
   Hide only the right panel.
   The button remains completely independent.
*/

/* Right panel disappears */

.crm-contact-layout.is-right-collapsed .crm-contact-layout__right {
  width: 0;
  min-width: 0;

  opacity: 0;

  overflow: hidden;

  pointer-events: none;
}

/* =========================================================
   COLLAPSE BUTTON
   ========================================================= */

.crm-contact-layout.is-right-collapsed .crm-panel-collapse {
  left: auto;
  right: 3px;

  transform: rotate(180deg);
}

/* =========================================================
   CUSTOM SCROLLBARS
   ========================================================= */

.crm-contact-layout__left::-webkit-scrollbar,
.crm-contact-layout__right::-webkit-scrollbar,
.crm-center-content::-webkit-scrollbar {
  width: 6px;
}

.crm-contact-layout__left::-webkit-scrollbar-track,
.crm-contact-layout__right::-webkit-scrollbar-track,
.crm-center-content::-webkit-scrollbar-track {
  background: transparent;
}

.crm-contact-layout__left::-webkit-scrollbar-thumb,
.crm-contact-layout__right::-webkit-scrollbar-thumb,
.crm-center-content::-webkit-scrollbar-thumb {
  background: var(--border-strong);

  border-radius: 10px;
}

/* =========================================================
   MOBILE
   ========================================================= */

/* =========================================================
   RESPONSIVE COLUMNS
   ========================================================= */

@media (max-width: 1024px) {
  /* Tablet: stack ALL three columns vertically */
  .crm-contact-layout {
    height: auto;
    min-height: calc(100vh - var(--header-h));
    padding: 0;
    overflow: visible;
  }

  .crm-contact-layout__row {
    flex-wrap: wrap;
    height: auto;
    --crm-gutter-x: 10px;
    --crm-gutter-y: 10px;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .crm-center-panel {
    min-height: 500px;
  }

  /* There is no side-by-side right panel on tablet/mobile. */
  .crm-panel-collapse {
    display: none;
  }
}

/* MOBILE CONTACT PROFILE */

@media (max-width: 767.98px) {
  .crm-contact-profile__name {
    font-size: 18px;
  }

  .crm-contact-profile__designation,
  .crm-contact-profile__email a {
    font-size: 14px;
  }

  .crm-contact-profile__permission {
    padding: 18px 20px;
    font-size: 14px;
  }

  .crm-contact-profile__quick-actions {
    padding-left: 10px;
    padding-right: 10px;
  }

  .crm-contact-profile__action-icon {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 767.98px) {
  .crm-contact-layout {
    padding: 0;
  }

  .crm-contact-layout__row {
    --crm-gutter-x: 8px;
    --crm-gutter-y: 8px;
  }

  .crm-center-panel {
    min-height: 500px;
  }

  .crm-contact-layout.is-right-collapsed .crm-contact-layout__right {
    display: none;
  }

  .crm-panel-collapse {
    display: none;
  }
}

.crm-sidebar-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

/* =====================================================
   LEFT CONTACT PROFILE CARD
   ===================================================== */

.crm-contact-profile-card {
  width: 100%;
  flex: none;
}

.crm-contact-profile {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* TOP HEADER */

.crm-contact-profile__top {
  min-height: 60px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.crm-contact-profile__section-title {
  margin-left: 12px;
  margin-right: auto;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.crm-contact-profile__back,
.crm-contact-profile__actions {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.crm-contact-profile__back {
  display: flex;
  align-items: center;
  padding: 0;
}

/* R1: the design's back link holds the plural too (record-ui.php:231-234). Contact and
   company record pages only; Deals keeps the icon-only link beside its title. */
.crm-contact-profile__back--text {
  margin-right: auto;
  text-decoration: none;
}

.crm-contact-profile__back--text .crm-contact-profile__section-title {
  margin-right: 0;
}

.crm-contact-profile__back svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-profile__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.crm-contact-profile__actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* PERMISSION */

.crm-contact-profile__permission {
  margin: 20px 20px 13px;
  padding: 23px 24px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

/* CONTACT INFORMATION */

.crm-contact-profile__info {
  padding: 0 20px;
}

.crm-contact-profile__identity {
  display: flex;
  align-items: center;
  gap: 7px;
}

.crm-contact-profile__avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.crm-contact-profile__avatar span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #29a9ed;
  transform: rotate(45deg);
}

.crm-contact-profile__avatar span:nth-child(1) {
  left: 16px;
  top: 6px;
}

.crm-contact-profile__avatar span:nth-child(2) {
  left: 9px;
  top: 13px;
}

.crm-contact-profile__avatar span:nth-child(3) {
  right: 7px;
  top: 13px;
}

.crm-contact-profile__avatar span:nth-child(4) {
  left: 16px;
  bottom: 10px;
}

.crm-contact-profile__name {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.crm-contact-profile__designation {
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.crm-contact-profile__email {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.crm-contact-profile__email a {
  min-width: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  /* An address with no hyphen (e.g. a_b_c@example.com) can't wrap otherwise,
     pushing the copy and send icons past the card's overflow: hidden edge. */
  overflow-wrap: anywhere;
}

.crm-contact-profile__email button,
.crm-contact-profile__email .crm-contact-profile__open {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}

.crm-contact-profile__email svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* QUICK ACTIONS */

.crm-contact-profile__quick-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  padding: 22px 20px 18px;
}

.crm-contact-profile__quick-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.crm-contact-profile__action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
}

.crm-contact-profile__quick-actions
  button:first-child
  .crm-contact-profile__action-icon,
.crm-contact-profile__quick-actions
  button:last-child
  .crm-contact-profile__action-icon {
  background: var(--surface);
  border-color: var(--border);
}

.crm-contact-profile__action-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-profile__dots {
  display: flex;
  gap: 3px;
}

.crm-contact-profile__dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #666;
}

/* =====================================================
   ABOUT THIS CONTACT
   ===================================================== */

.crm-about-contact {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.crm-about-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.crm-about-label {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}

.crm-about-business-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 14px;
}

.crm-about-value {
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* HUB-615: a field edited in place (About and property-group cards), like HubSpot's sidebar */
.crm-inline__value,
.crm-inline__static {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% + 12px);
  min-height: 28px;
  margin: -4px -6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
  background: none;
  border: 0;
  border-radius: 6px;
}
.crm-inline__value {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.crm-inline__value:hover,
.crm-inline__value:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.crm-inline__value > span {
  flex: 1;
  min-width: 0;
}
.crm-inline__value.is-empty > span,
.crm-inline__static.is-empty {
  color: var(--text-subtle);
}
.crm-inline__pen {
  flex: none;
  color: var(--text-subtle);
  opacity: 0;
}
.crm-inline__value:hover .crm-inline__pen,
.crm-inline__value:focus-visible .crm-inline__pen {
  opacity: 1;
}
.crm-inline__editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crm-inline__editor.is-busy {
  opacity: 0.6;
  pointer-events: none;
}
/* HubSpot-style underlined input */
.crm-inline__editor .input {
  width: 100%;
  height: 30px;
  padding: 2px 0;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--brand);
  border-radius: 0;
  box-shadow: none;
}
.crm-inline__editor .input:focus {
  outline: none;
  box-shadow: none;
}
.crm-inline__editor textarea.input {
  height: auto;
  min-height: 60px;
}
.crm-inline__editor .input + .input {
  margin-top: 4px;
}
.crm-inline__editor .input-affix {
  border-bottom: 1.5px solid var(--brand);
}
.crm-inline__editor .input-affix .input {
  border-bottom: 0;
}
.crm-inline__editor .prp-radios {
  gap: 6px;
  padding: 4px 0 6px;
  border-bottom: 1.5px solid var(--brand);
}
.crm-inline__hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-subtle);
}
.crm-inline__error {
  margin: 0;
  font-size: 11.5px;
  color: var(--danger);
}
.crm-collapsible-card__count {
  min-width: 22px;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 999px;
}
/* The record name in the header: the inline editor keeps the heading size. */
.crm-contact-profile__name .crm-inline__value,
.company-profile-copy h1 .crm-inline__value {
  font-size: inherit;
  font-weight: inherit;
}
/* HUB-615: in-place dropdown (HubSpot's "-- ▾" with its option list open) */
.crm-inline__caret {
  color: var(--text-muted);
}
.crm-inline-dd {
  display: flex;
  flex-direction: column;
}
.crm-inline-dd__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 30px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1.5px solid var(--brand);
}
.crm-inline-dd__trigger .is-empty {
  color: var(--text-subtle);
}
.crm-inline-dd__trigger svg {
  flex: none;
  color: var(--brand);
}
.crm-inline-dd__panel {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow-md, 0 6px 16px rgba(16, 24, 40, 0.12));
  overflow: hidden;
}
.crm-inline-dd__search {
  display: block;
  width: calc(100% - 16px);
  margin: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}
.crm-inline-dd__search:focus {
  border-color: var(--brand);
}
.crm-inline-dd__list {
  max-height: 232px;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  list-style: none;
  outline: none;
}
.crm-inline-dd__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
}
.crm-inline-dd__option.is-active {
  background: var(--surface-hover);
}
.crm-inline-dd__option.is-selected {
  font-weight: 600;
  color: var(--brand);
}
.crm-inline-dd__option.is-empty {
  color: var(--text-subtle);
}
.crm-inline-dd__check {
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3px;
}
.crm-inline-dd__check.is-on {
  background: var(--brand)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E")
    center / 11px no-repeat;
  border-color: var(--brand);
}
.crm-inline-dd__none {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-subtle);
}
/* Card titles: one line, left-aligned, full title on hover */
.crm-collapsible-card__toggle {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.crm-collapsible-card__toggle > span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-collapsible-card__chevron {
  flex: none;
}
/* HUB-356: a property's history button, next to its label; shows on the row's hover */
.crm-prop-history {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  vertical-align: middle;
  color: var(--text-subtle);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}
.crm-prop-history:hover {
  color: var(--text);
  background: var(--surface-2, rgba(0, 0, 0, 0.05));
}
.crm-about-field:hover .crm-prop-history,
.evr-prop:hover .crm-prop-history,
.crm-prop-history:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .crm-prop-history {
    opacity: 1;
  }
}
.crm-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--text-subtle);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.crm-copy-btn:hover {
  color: var(--text);
  background: var(--surface-2, rgba(0, 0, 0, 0.05));
}

/* SIMPLE GENERATED CARDS */

.crm-collapsible-card--simple .crm-collapsible-card__body {
  padding-top: 14px;
}

/* NARROW LEFT COLUMN */

@media (max-width: 1200px) {
  .crm-contact-profile__name {
    font-size: 18px;
  }

  .crm-contact-profile__quick-actions {
    padding-left: 12px;
    padding-right: 12px;
  }

  .crm-contact-profile__action-icon {
    width: 38px;
    height: 38px;
  }
}

/* =====================================================
   CARD
   ===================================================== */

.crm-collapsible-card {
  width: 100%;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);

  overflow: hidden;
}

/* =====================================================
   HEADER
   ===================================================== */

.crm-collapsible-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 58px;

  padding: 0 20px;

  gap: 15px;
}

/* =====================================================
   TITLE TOGGLE
   ===================================================== */

.crm-collapsible-card__toggle {
  display: inline-flex;
  align-items: center;

  gap: 12px;

  padding: 0;

  border: 0;

  background: transparent;

  color: var(--text);

  font-family: inherit;

  font-size: 14px;
  font-weight: 700;

  line-height: 1;

  cursor: pointer;
}

/* =====================================================
   CHEVRON
   ===================================================== */

.crm-collapsible-card__chevron {
  width: 16px;
  height: 16px;

  flex: 0 0 16px;

  fill: none;

  stroke: var(--text-muted);

  stroke-width: 2;

  stroke-linecap: round;
  stroke-linejoin: round;

  transition: transform 0.2s ease;
}

/* =====================================================
   ACTION
   ===================================================== */

.crm-collapsible-card__action {
  padding: 0;

  border: 0;

  background: transparent;

  color: var(--brand);

  font-family: inherit;

  font-size: 13px;
  font-weight: 500;

  cursor: pointer;
}

.crm-collapsible-card__action:hover {
  color: var(--brand-hover);
}

.crm-collapsible-card__body {
  display: grid;
  grid-template-rows: 1fr;

  overflow: hidden;

  padding: 4px 20px 24px;

  opacity: 1;

  transition:
    grid-template-rows 0.25s ease,
    padding 0.25s ease,
    opacity 0.2s ease;
}

/*
   Inner wrapper is required for smooth collapse
*/

.crm-collapsible-card__body-inner {
  min-height: 0;

  overflow: hidden;
}

/* =====================================================
   COLLAPSED
   ===================================================== */

.crm-collapsible-card.is-collapsed .crm-collapsible-card__body {
  grid-template-rows: 0fr;

  padding-top: 0;
  padding-bottom: 0;

  opacity: 0;
}

/* =====================================================
   CHEVRON
   ===================================================== */

.crm-collapsible-card__chevron {
  transition: transform 0.25s ease;
}

.crm-collapsible-card.is-collapsed .crm-collapsible-card__chevron {
  transform: rotate(-90deg);
}

/* =====================================================
   PLAYBOOK CONTENT
   ===================================================== */

.crm-card-description {
  margin: 0 0 20px;

  color: var(--text);

  font-size: 13px;

  line-height: 1.6;
}

.crm-card-button {
  display: block;

  min-width: 142px;
  height: 40px;

  margin: 0 auto;

  border: 1px solid var(--border);

  border-radius: var(--radius-pill);

  background: var(--surface-2);

  color: var(--text-subtle);

  font-size: 14px;

  cursor: not-allowed;
}

/* =====================================================
   COMPANY CONTENT
   ===================================================== */

.company-card-item {
  display: flex;
  align-items: center;

  gap: 10px;

  padding: 10px;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  background: var(--surface);
}

.company-card-logo {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  flex: 0 0 40px;

  border-radius: 8px;

  background: var(--brand-soft);

  color: var(--brand);

  font-size: 12px;
  font-weight: 700;
}

.company-card-info {
  flex: 1;

  min-width: 0;
}

.company-card-info a {
  display: block;

  color: var(--brand);

  font-size: 12px;
  font-weight: 700;
}

.company-card-info span {
  display: block;

  margin-top: 3px;

  color: var(--text-muted);

  font-size: 10px;
}

.company-card-arrow {
  color: var(--text-subtle);

  font-size: 22px;
}

/* =====================================================
   DEAL CONTENT
   ===================================================== */

.deal-card-item {
  padding: 11px 0;

  border-bottom: 1px solid var(--border);
}

.deal-card-item:first-child {
  padding-top: 4px;
}

.deal-card-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.deal-card-title {
  display: block;

  margin-bottom: 5px;

  color: var(--brand);

  font-size: 12px;
  font-weight: 700;
}

.deal-card-item strong {
  color: var(--text);

  font-size: 12px;
}

.deal-card-item > span {
  color: var(--text-muted);

  font-size: 10px;
}

.deal-card-item small {
  display: block;

  margin-top: 3px;

  color: var(--text-muted);

  font-size: 10px;
}

/* =====================================================
   ATTACHMENT
   ===================================================== */

.attachment-card-item {
  display: flex;
  align-items: center;

  gap: 10px;

  padding: 9px;

  border: 1px solid var(--border);

  border-radius: var(--radius);
}

.attachment-pdf {
  width: 30px;
  height: 34px;

  display: grid;
  place-items: center;

  flex: 0 0 30px;

  border-radius: 4px;

  background: #f04438;

  color: white;

  font-size: 7px;
  font-weight: 700;
}

.attachment-card-info {
  flex: 1;

  min-width: 0;
}

.attachment-card-info strong {
  display: block;

  color: var(--text);

  font-size: 11px;
}

.attachment-card-info span {
  display: block;

  margin-top: 3px;

  color: var(--text-muted);

  font-size: 9px;
}

.attachment-more {
  border: 0;

  background: transparent;

  color: var(--text-subtle);

  font-size: 18px;

  cursor: pointer;
}

/*.crm-collapsible-card[data-card-id="about"] .crm-collapsible-card__body {
  padding: 6px 20px 24px;
}*/

.crm-collapsible-card[data-card-id="about"] .crm-collapsible-card__header {
  min-height: 58px;
}

/* =========================================================
   IMAGE-MATCHED LEFT / RIGHT CRM CONTENT
   Additive styles only — existing typography is preserved.
   ========================================================= */

.crm-sidebar-info-card {
  padding: 0 0 2px;
}

.crm-sidebar-info-card p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.55;
}

.crm-sidebar-info-card a,
.crm-associated-link,
.crm-attribution-content a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.crm-sidebar-info-card a:hover,
.crm-associated-link:hover,
.crm-attribution-content a:hover {
  text-decoration: underline;
}

/* Company card */

.company-card-item--hubspot {
  align-items: flex-start;
  padding: 10px;
}

.company-card-item--hubspot .company-card-logo {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.company-card-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.company-card-title-row a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.company-primary-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #dff3e9;
  color: #26744f !important;
  font-weight: 700;
  white-space: nowrap;
}

.company-card-detail {
  margin-top: 6px;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-card-detail a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.crm-inline-copy {
  margin-left: 3px;
  color: var(--text-subtle);
}

.company-card-association {
  margin-top: 8px;
  color: var(--text-muted);
}

/* Shared associated links */

.crm-associated-link {
  display: inline-block;
  margin-top: 13px;
}

/* Deals toolbar */

.crm-deals-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0px 0 8px;
}

.crm-deals-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
}

.crm-deals-toolbar button:first-child {
  width: 30px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.crm-deals-toolbar svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Deal cards */

.deal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
  color: var(--text-muted);
}

.deal-meta {
  margin-top: 5px;
  color: var(--text);
}

.deal-meta > span {
  color: var(--text-muted);
}

.deal-meta strong {
  color: var(--text);
}

.deal-association {
  margin-top: 8px;
  color: var(--text-muted);
}

/* R5b: the record timeline's filter row, chips and popovers, as the 28 Oct design (record-tabs.css `.raf-`, copied verbatim). */
.raf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.raf-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.raf-link:hover { background: var(--surface-hover); }
.raf-link svg, .raf-chip svg { width: 10px; height: 10px; flex: none; }
.raf-dd { margin-left: auto; }
.raf-chips { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; flex-wrap: nowrap; overflow: hidden; }
.raf-chip { display: inline-flex; align-items: center; flex: none; border-radius: var(--radius-sm, 8px); }
.raf-chip > button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: none; border: 0; border-radius: var(--radius-sm, 8px); cursor: pointer; white-space: nowrap; }
.raf-chip > button:hover { background: var(--surface-hover); }
.raf-chip.is-on { background: var(--surface-3, #eef2f6); }
.raf-chip .raf-x { padding: 0 8px; color: var(--text-muted); }
.raf-chip .raf-x svg { width: 13px; height: 13px; }
.raf-chip--clip { min-width: 0; flex: 0 1 auto; }
.raf-chip--clip > button:first-child { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.raf-chip--more { display: none; }
.raf-chips.is-tight .raf-chip--team { display: none; }
.raf-chips.is-tight .raf-chip--more { display: inline-flex; }
.raf-clearall { margin-left: auto; padding: 6px 8px; }
.raf-link:focus-visible, .raf-chip > button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.raf-pop { position: fixed; z-index: 1500; width: 280px; max-width: calc(100vw - 16px); max-height: min(440px, calc(100vh - 24px)); overflow-y: auto; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
.raf-pop--types { width: min(760px, calc(100vw - 16px)); }
.raf-pop--menu { width: auto; min-width: 170px; padding: 6px; }
.raf-menu button { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.raf-menu button:hover, .raf-menu button:focus-visible { background: var(--surface-hover); outline: none; }
.raf-menu svg { width: 10px; height: 10px; }
.raf-search { position: relative; display: block; margin-bottom: 8px; }
.raf-search input { width: 100%; height: 38px; padding: 0 34px 0 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 8px); }
.raf-search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.raf-search svg { position: absolute; right: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.raf-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.raf-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.raf-group legend { padding: 0; }
.raf-check { display: flex; align-items: flex-start; gap: 8px; padding: 5px 6px; font-size: 14px; border-radius: 6px; cursor: pointer; }
.raf-check:hover { background: var(--surface-hover); }
.raf-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); }
.raf-check span { min-width: 0; }
.raf-check small { display: block; font-size: 12px; color: var(--text-muted); }
.raf-check--all { font-weight: 600; }
.raf-group legend .raf-check { font-weight: 600; }
.raf-check--sub { padding-left: 22px; }
.raf-ic { display: inline-flex; margin-right: 4px; vertical-align: -2px; color: var(--text-muted); font-style: normal; }
.raf-ic svg { width: 13px; height: 13px; }
.raf-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.raf-pin { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.raf-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 10px; font: inherit; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.raf-opt:hover, .raf-opt:focus-visible { background: var(--surface-hover); outline: none; }
.raf-opt[aria-selected="true"] { font-weight: 600; background: var(--surface-3, #eef2f6); }
.raf-opt--sub { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; }
.raf-opt svg { width: 13px; height: 13px; }
.raf-custom { display: grid; gap: 8px; padding: 8px 4px 2px; }
.raf-custom label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.raf-custom input { height: 36px; padding: 0 8px; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 8px); }
.raf-apply { height: 34px; font: inherit; font-size: 13.5px; font-weight: 600; color: #fff; background: var(--brand); border: 0; border-radius: var(--radius-sm, 8px); cursor: pointer; }
@media (max-width: 767.98px) {
  .raf-chips { flex-wrap: wrap; overflow: visible; }
  .raf-chip--clip > button:first-child { max-width: 150px; }
  .raf-clearall { margin-left: 0; }
  .raf-pop--types { left: 8px !important; right: 8px; width: auto; }
  .raf-groups { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 1279.98px) {
  .raf-chips { flex-wrap: wrap; overflow: visible; row-gap: 4px; }
  .raf-chip--clip > button:first-child { max-width: none; }
  .raf-chips.is-tight .raf-chip--team { display: inline-flex; }
  .raf-chips .raf-chip--more { display: none !important; }
}

/* GLB6 (go-live Medium 6): a row that still doesn't fit with CRM team under More wraps, as the
   design's row below 1280px (above): every chip whole, CRM team back inline, no More. */
.raf-chips.is-wrap { flex-wrap: wrap; overflow: visible; row-gap: 4px; }
.raf-chips.is-wrap .raf-chip--clip > button:first-child { max-width: none; }
.raf-chips.is-wrap .raf-chip--team { display: inline-flex; }
.raf-chips.is-wrap .raf-chip--more { display: none !important; }

/* R5b: the timeline's empty state, as the 28 Oct design (activity-tabs.css:275-278). */
.act__empty { padding: 32px 16px; text-align: center; color: var(--text-muted); }
.act__empty-art { width: 120px; height: 100px; color: var(--brand); }
.act__empty-title { margin: 8px 0 4px; font-size: 15px; font-weight: 700; color: var(--text); }
.act__empty-text { margin: 0; font-size: 13.5px; }

/* R4: the compact sticky header (record-page.css:124-141). */
.rp-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 0;
}

.rp-sticky__card {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  padding: 10px 16px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s;
}

.rp-sticky.is-visible .rp-sticky__card {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.rp-sticky__top.crm-contact-profile__top {
  min-height: 0;
  margin: 0 0 10px;
  padding: 0;
  border-bottom: 0;
}

.rp-sticky__person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rp-sticky__avatar {
  display: inline-flex;
  flex: none;
}

/* The company's square initials at the design's xs size (record-page.css:130). */
.company-record-logo.company-record-logo--xs {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  border-radius: 8px;
  font-size: 11px;
}

.rp-sticky__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rp-sticky__create {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill, 999px);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.rp-sticky__create:hover,
.rp-sticky__create[aria-expanded='true'] {
  background: var(--surface-hover);
}

@media (max-width: 1024px) {
  .rp-sticky {
    top: var(--header-h, 64px);
  }
}

/* R4: company right cards collapse (record-tabs.js:274-277). */
.company-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.company-card-toggle .crm-collapsible-card__chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s;
}

.company-card-toggle[aria-expanded='false'] .crm-collapsible-card__chevron {
  transform: rotate(-90deg);
}

.company-associated-card.is-collapsed > :not(.company-card-head) {
  display: none;
}

/* R6b: the + Add panel (record-tabs.js:781-852, `.rt-drawer` / `.rt-dtabs` / `.rt-pick`). */
.modal-backdrop--drawer .modal.aad {
  width: min(520px, 100vw);
  max-width: 100vw;
}

.aad-tabs {
  display: flex;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}

.aad-tabs button {
  padding: 12px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.aad-tabs button.is-on {
  border-bottom-color: var(--brand);
  color: var(--text);
}

.aad-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.aad-right {
  margin: 0;
  text-align: right;
}

.aad-search {
  width: 100%;
}

.aad-pickhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aad-sort {
  width: auto;
}

.aad-list {
  display: flex;
  flex-direction: column;
}

.aad-pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.aad-pick small {
  color: var(--text-muted);
}

.aad-pick.is-dis {
  color: var(--text-muted);
  cursor: default;
}

.aad-note {
  margin: 8px 0;
  color: var(--text-muted);
}

.aad-radios {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aad-foot {
  align-items: center;
}

.aad-step {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 13px;
}

/* R6b: Attachments "Add ▾" (record-tabs.js:319-320). */
.att-add {
  position: relative;
  display: inline-flex;
}

.att-add__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
}

.att-add__list button {
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.att-add__list button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.att-add__list button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* R6a: sidebar association rows (record-tabs.css:104-105, :286-305, :404-412, `.rt-acard`). */
.crm-arows {
  display: flex;
  flex-direction: column;
}

.crm-arow {
  position: relative;
  padding: 12px 40px 12px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
}

.crm-arow__top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  margin-bottom: 6px;
}

.crm-arow__id {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

.crm-arow__name {
  display: block;
  max-width: 100%;
  color: var(--brand);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.crm-arow__name:hover {
  text-decoration: underline;
}

.crm-arow__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3, #eef1f5);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

button.crm-arow__tag {
  cursor: pointer;
}

.crm-arow__tag--ok {
  border-color: #75e0a7;
  background: #dcfae6;
  color: #067647;
}

.crm-arow__menu {
  position: absolute;
  top: 10px;
  right: 8px;
}

.crm-arow__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.crm-arow__more svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.crm-arow__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
}

.crm-arow__list button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

/* R7: View all properties is a link; a rule after Preview (record-tabs.js:365). */
.crm-arow__list a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.crm-arow__list a:hover,
.crm-arow__list a:focus-visible {
  outline: none;
  background: var(--surface-hover);
}

.crm-arow__rule {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.crm-arow__list button:hover:not(:disabled),
.crm-arow__list button:focus-visible {
  outline: none;
  background: var(--surface-hover);
}

.crm-arow__list button:disabled {
  color: var(--text-muted);
  cursor: default;
}

.crm-arow__sub {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 13px;
}

.crm-arow__lines {
  display: flex;
  flex-direction: column;
}

.crm-assoc-line--copy {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.crm-assoc-line--copy > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crm-assoc-line--copy strong {
  color: var(--text);
  font-weight: 600;
}

.crm-assoc-copy {
  display: inline-flex;
  flex: none;
  margin-left: auto;
  padding: 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--brand);
  cursor: pointer;
}

.crm-assoc-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.crm-assoc-copy:hover {
  background: var(--surface-hover);
}

.crm-arow__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.crm-arow__addlabel {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.crm-arow__viewall {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-weight: 700;
}

/* R6a: "Edit association to <name>" (record-tabs.css, `.rt-modal` / `.rt-lsel`). */
.alm__label {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.alm__help,
.alm__note {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.alm__sel {
  position: relative;
}

.alm__box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 32px 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  cursor: text;
}

.alm__sel.is-open .alm__box {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.alm__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: var(--surface-3, #eef1f5);
  font-size: 13px;
}

.alm__chip button {
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.alm__q {
  flex: 1 1 80px;
  min-width: 80px;
  height: 30px;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
}

.alm__caret {
  position: absolute;
  top: 50%;
  right: 8px;
  border: 0;
  background: none;
  color: var(--text-muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.alm__pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 5;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
}

.alm__list {
  max-height: 240px;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  list-style: none;
}

.alm__group {
  padding: 8px 14px 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.alm__opt {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  cursor: pointer;
}

.alm__opt small {
  color: var(--text-muted);
}

.alm__opt:hover,
.alm__opt.is-act {
  background: var(--surface-hover);
}

.alm__empty {
  padding: 10px 14px;
  color: var(--text-muted);
}

.alm__manage {
  display: block;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

/* R3: "<name> - All Properties" (record-tabs.css:445-517, `.rt-drawer--props`). */
.modal-backdrop--drawer .modal.apd {
  width: min(720px, 100vw);
  max-width: 100vw;
}

.apd-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px 32px 8px;
}

.apd-search {
  width: 220px;
  height: 40px;
}

.apd-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.apd-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.apd-body {
  padding: 0 32px 24px;
}

.apd-none {
  margin: 16px 0;
  color: var(--text-muted);
}

.apd-group h3 {
  margin: 12px 0 4px;
}

.apd-group h3 button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.apd-group h3 button svg {
  width: 18px;
  height: 18px;
  flex: none;
  align-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s;
}

.apd-group h3 button[aria-expanded='false'] svg {
  transform: rotate(-90deg);
}

.apd-group h3 small {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.apd-group h3 button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.apd-list {
  margin: 0;
  padding-left: 28px;
}

.apd-row {
  position: relative;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
}

.apd-row:hover {
  border-bottom-color: var(--border-strong);
}

.apd-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.apd-row dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.apd-row dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.apd-row__tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}

.apd-row:hover .apd-row__tools,
.apd-row:focus-within .apd-row__tools {
  opacity: 1;
}

.apd-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.apd-tool:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.apd-tool svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.apd-tool:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.apd-menu {
  position: relative;
  display: inline-flex;
}

.apd-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 230px;
  padding: 6px 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
}

.apd-menu__list button,
.apd-menu__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.apd-menu__list button:hover:not(:disabled),
.apd-menu__list a:hover,
.apd-menu__list button:focus-visible,
.apd-menu__list a:focus-visible {
  outline: 0;
  background: var(--surface-hover);
}

.apd-menu__list button:disabled {
  color: var(--text-muted);
  cursor: default;
}

@media (max-width: 767.98px) {
  .apd-tools,
  .apd-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .apd-search {
    flex: 1 1 100%;
    width: 100%;
  }

  .apd-list {
    padding-left: 0;
  }
}

/* R2: the record page's More activities menu (record-popups-hs.css:396-413, `.hx-amenu--more`). */
.crm-acts-more {
  position: fixed;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  width: 330px;
  max-width: calc(100vw - 16px);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.2);
}

.crm-acts-more__arrow {
  position: absolute;
  top: -9px;
  width: 16px;
  height: 16px;
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong);
  background: var(--surface);
  transform: rotate(45deg);
}

.crm-acts-more.is-up .crm-acts-more__arrow {
  top: auto;
  bottom: -9px;
  transform: rotate(225deg);
}

.crm-acts-more__search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 12px;
}

/* MM1: the search icon and the item chevron (record-popups-hs.css:35-38, :410). */
.crm-acts-more__search .icon {
  position: absolute;
  right: 25px;
  color: var(--text-muted);
  pointer-events: none;
}

.crm-acts-more__search input::-webkit-search-cancel-button {
  display: none;
}

.crm-acts-more__chev {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex: none;
}

.crm-acts-more__search input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
}

.crm-acts-more__search input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.crm-acts-more__list {
  max-height: 260px;
  padding: 2px 0 6px;
  overflow-y: auto;
}

.crm-acts-more__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 18px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.crm-acts-more__item:hover:not(:disabled),
.crm-acts-more__item:focus-visible {
  outline: 0;
  background: var(--surface-hover);
}

.crm-acts-more__item:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.crm-acts-more__icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: none;
}

.crm-acts-more__icon svg {
  width: 20px;
  height: 20px;
}

.crm-acts-more__none {
  margin: 0;
  padding: 12px 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.crm-acts-more__foot {
  padding: 14px 18px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 14px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.crm-acts-more__foot:hover,
.crm-acts-more__foot:focus-visible {
  outline: 0;
  background: var(--surface-hover);
}

/* TK-7: an item's side menu beside More (HubSpot's ticket "Enroll in a sequence": which
   associated contact), a name and its email per row. */
.crm-acts-more--side {
  width: 280px;
}

.crm-acts-more__pick {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: normal;
}

.crm-acts-more__sub {
  color: var(--text-muted);
  font-size: 13px;
}

/* MM1: More's "Create a contract / payment link / quote / invoice" dialog
   (record-popups-hs.css:106 `.hx-modal--md`, :117 `--foot-left`, :208-213 `.hx-field`). */
#commerceCreateModal .modal {
  width: min(700px, 100%);
  max-width: none;
}

.crm-commerce {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crm-commerce__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crm-commerce__field label {
  font-size: 15px;
  font-weight: 700;
}

.crm-commerce__input {
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
}

.crm-commerce__input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.crm-commerce__input[aria-invalid='true'] {
  border-color: var(--danger);
}

.crm-commerce__err {
  margin: 0;
  color: var(--danger);
  font-size: 13.5px;
}

.crm-commerce__note {
  margin: 0;
}

#commerceCreateModal .crm-commerce__foot {
  justify-content: flex-start;
  padding-top: 0;
  border-top: 0;
}

/* Empty association cards */

.crm-empty-association {
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}

.crm-empty-association p {
  margin: 8px 0 0;
  line-height: 1.55;
}

/* R1: the design's empty-card illustration (record-tabs.js:45; 92×70, record-tabs.css:284). */
.crm-empty-association__art {
  width: 92px;
  height: 70px;
  flex: none;
}

.crm-empty-association__icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  opacity: 0.55;
}

.crm-empty-association__icon svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: #b7c8dc;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-empty-association--quote {
  min-height: 92px;
  align-items: flex-start;
  text-align: left;
}

.crm-empty-association--quote .crm-card-button {
  margin: 10px auto 0;
}

/* QA #364: the design only shows the disabled button; the live "Create quote" is a link. */
a.crm-card-button {
  width: fit-content;
  padding: 0 18px;
  line-height: 38px;
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  cursor: pointer;
}
a.crm-card-button:hover {
  background: var(--bg-hover);
}

/* Attribution */

.crm-attribution-content p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.55;
}

.crm-attribution-content a {
  display: inline-block;
}

@media (max-width: 767.98px) {
  .company-card-detail {
    white-space: normal;
  }

  .crm-deals-toolbar {
    justify-content: flex-start;
  }
}

/* =========================================================
   RIGHT SIDEBAR SVG ICON VISIBILITY / PRECISION
   Explicit sizing prevents inherited/global SVG rules from
   hiding or collapsing the icons in the right column.
   ========================================================= */

.crm-contact-layout__right svg {
  display: inline-block;
  visibility: visible;
  opacity: 1;
  overflow: visible;
  flex: 0 0 auto;
}

.crm-contact-layout__right .crm-inline-copy {
  display: inline-flex;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: -2px;
  color: var(--text-subtle);
}

.crm-contact-layout__right .crm-inline-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .crm-external-icon {
  width: 12px;
  height: 12px;
  margin-left: 3px;
  vertical-align: -1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .crm-deals-toolbar button svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .deal-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  vertical-align: -3px;
  margin-right: 4px;
}

.crm-contact-layout__right .deal-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .crm-empty-association__icon svg {
  display: block;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  fill: none;
  stroke: #b7c8dc;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .crm-lock-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  vertical-align: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-contact-layout__right .crm-attribution-content a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* =========================================================
   CONTACT ACTIONS DROPDOWN
   ========================================================= */
.crm-contact-actions-menu {
  position: fixed;
  z-index: 9999;
  display: none;
  min-width: 255px;
  max-width: 255px;
  padding: 8px 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.14),
    0 3px 10px rgba(0, 0, 0, 0.08);
  color: var(--text);
}
.crm-contact-actions-menu.is-open {
  display: block;
}
.crm-contact-actions-menu__search {
  position: relative;
  margin: 0 10px 8px;
}
.crm-contact-actions-menu__search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--border);
  border-radius: 28px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}
.crm-contact-actions-menu__search input::placeholder {
  color: #6f6f6f;
}
.crm-contact-actions-menu__search input:focus {
  border-color: var(--brand);
}
.crm-contact-actions-menu__search svg {
  position: absolute;
  left: 16px;
  top: 14px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.crm-contact-actions-menu__items {
  max-height: min(540px, calc(100vh - 90px));
  overflow-y: auto;
  padding: 0 0 5px;
}
.crm-contact-action-item {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0px 13px 0px 13px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.crm-contact-action-item:hover,
.crm-contact-action-item:focus-visible {
  background: var(--surface-hover);
  outline: 0;
}
.crm-contact-action-item__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  line-height: 0;
}
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}
.crm-contact-action-item__icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crm-contact-actions-menu--no-search .crm-contact-actions-menu__items {
  padding-top: 4px;
}
.crm-contact-action-item__icon--linkedin {
  color: #333;
}
.crm-contact-action-item__icon--linkedin svg rect {
  fill: currentColor;
  stroke: currentColor;
}
.crm-contact-action-item__icon--linkedin svg path {
  stroke: #fff;
  stroke-width: 1.8;
}
.crm-contact-action-item__label {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  line-height: 1.35;
}
.crm-contact-action-item__arrow {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #777;
}
.crm-contact-action-item__arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crm-contact-action-item__lock {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #888;
}
.crm-contact-action-item__lock svg {
  width: 18px;
  height: 17px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crm-contact-actions-menu__divider {
  height: 1px;
  margin: 6px 18px;
  background: var(--border);
}
.crm-contact-actions-submenu {
  max-width: 255px;
  position: fixed;
  z-index: 10000;
  display: none;
  padding: 8px 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.14),
    0 3px 10px rgba(0, 0, 0, 0.08);
}
.crm-contact-actions-submenu.is-open {
  display: block;
}
.crm-contact-actions-submenu .crm-contact-action-item {
  min-height: 36px;
  padding-left: 12px;
}
.crm-contact-action-item--linkedin {
  margin-top: 2px;
}
@media (max-width: 767.98px) {
  .crm-contact-actions-menu {
    min-width: 0;
    width: 100% !important;
    left: auto !important;
    right: 27px;
    border-radius: 16px;
    top: 156px !important;
  }
  .crm-contact-actions-submenu {
    width: min(255px, calc(100vw - 16px)) !important;
    left: auto !important;
    right: auto !important;
  }
  .crm-contact-action-item {
    min-height: 27px;
    padding-left: 15px;
    font-size: 13px;
  }
  .crm-contact-actions-submenu .crm-contact-action-item {
    min-height: 30px;
    padding-left: 12px;
  }
  .crm-contact-actions-menu__search input {
    height: 38px;
    font-size: 14px;
  }
  .crm-contact-actions-menu__search svg {
    left: 13px;
    top: 10px;
  }
}

/* =========================================================
   RESPONSIVE UTILITY-BASED THREE COLUMN LAYOUT
   Uses utilities(3).css: container / row / col
   Desktop  : 3 / 6 / 3
   <=1024px : 12 / 12 / 12
   ========================================================= */

.crm-contact-layout.crm-container-fluid {
  width: 100%;
  max-width: none;
  padding: 14px 0;
  height: calc(100vh - var(--header-h));
  min-height: 0;
  background: var(--bg);
  overflow: hidden;
}

.crm-contact-layout__row {
  /* Fill leftover space under the breadcrumb; constrain children so they scroll. */
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
  align-items: stretch;
  overflow: hidden;
  --crm-gutter-x: 0px;
  --crm-gutter-y: 0;
}

.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.crm-contact-layout__left {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 28px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.crm-contact-layout__center {
  overflow: hidden;
}

.crm-contact-layout__right {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 28px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

/* Desktop: HTML uses crm-col-12 crm-col-lg-3/6/3.
   At >= 992px the utility classes resolve to 3 / 6 / 3. */
@media (min-width: 1025px) {
  .crm-contact-layout__row {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  .crm-panel-collapse {
    right: calc(25% - 7px);
  }
}

/* Tablet + mobile: keep the actual column utility structure,
   but make every column a full-width utility column through 1024px. */
@media (max-width: 1024px) {
  .crm-contact-layout.crm-container-fluid {
    height: auto;
    min-height: calc(100vh - var(--header-h));
    padding: 10px 0;
    overflow: visible;
  }

  .crm-contact-layout__row {
    height: auto;
    --crm-gutter-x: 0px;
    --crm-gutter-y: 0px;
  }

  /* Override only the responsive utility width; markup remains col-12. */
  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    height: auto;
    overflow: visible;
  }

  .crm-contact-layout__left {
    max-height: none;
  }

  .crm-contact-layout__center {
    min-height: 680px;
  }

  .crm-contact-layout__right {
    display: block;
  }

  .crm-panel-collapse {
    display: none;
  }

  .crm-center-tabs,
  .crm-activity-tabs {
    overflow-x: auto;
  }
}

@media (max-width: 992px) {
  .crm-contact-actions-menu {
    min-width: 0;
    width: 100% !important;
    left: auto !important;
    right: 63px;
    border-radius: 16px;
    top: 156px !important;
  }
}

@media (max-width: 767.98px) {
  .crm-contact-layout.crm-container-fluid {
    padding: 8px 0;
  }

  .crm-contact-layout__row {
    --crm-gutter-x: 8px;
    --crm-gutter-y: 8px;
  }

  .crm-contact-layout__center {
    min-height: 560px;
  }

  .crm-contact-layout.is-right-collapsed .crm-contact-layout__right {
    display: none;
  }

  .crm-activity-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .crm-activity-search {
    width: 100%;
    flex: 1 1 100%;
  }

  .crm-activity-expand {
    margin-left: auto;
  }
}

@media (max-width: 575.98px) {
  .crm-contact-layout.crm-container-fluid {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .crm-contact-layout__row {
    --crm-gutter-x: 0px;
    --crm-gutter-y: 0px;
  }

  .crm-center-panel {
    border-radius: var(--radius-md, 12px);
  }

  .crm-center-tabs,
  .crm-activity-tabs {
    padding-left: 2px;
    padding-right: 2px;
  }

  .crm-center-tab {
    min-width: 108px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* =========================================================
   FINAL RESPONSIVE COLUMN OVERRIDE
   < 1200px  : 12 / 12 / 12
   1200-1399 : 3 / 9 / 12
   >= 1400px : 3 / 6 / 3
   ========================================================= */
.crm-contact-layout__row {
  width: 100%;
  min-width: 0;
}

.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 1199.98px) {
  .crm-contact-layout__row {
    flex-wrap: wrap !important;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
  }

  .crm-panel-collapse {
    display: none !important;
  }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  .crm-contact-layout__row {
    flex-wrap: wrap !important;
    height: auto;
  }

  .crm-contact-layout__left {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(75% - 6px) !important;
    width: calc(75% - 6px) !important;
    max-width: calc(75% - 6px) !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (min-width: 1400px) {
  .crm-contact-layout__row {
    flex-wrap: nowrap !important;
    height: 100%;
  }

  .crm-contact-layout__left {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(50% - 6px) !important;
    width: calc(50% - 6px) !important;
    max-width: calc(50% - 6px) !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 calc(25% - 6px) !important;
    width: calc(25% - 6px) !important;
    max-width: calc(25% - 6px) !important;
  }
}

/* Quick actions: utility-based flex instead of CSS Grid. */
.crm-contact-profile__quick-actions.crm-d-flex {
  display: flex !important;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2, 8px);
}

.crm-contact-profile__quick-actions.crm-d-flex > button {
  flex: 1 1 0;
  min-width: 0;
}

/* =========================================================
   FINAL RESPONSIVE LAYOUT FIX
   <1200   : 12 / 12 / 12
   1200-1399: 3 / 9 / 12
   >=1400  : 3 / 6 / 3
   The wrapper must scroll when the third column moves below.
   ========================================================= */
.crm-contact-layout.crm-container-fluid {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.crm-contact-layout__row {
  box-sizing: border-box;
  width: 100%;
  flex-wrap: wrap;
  height: auto;
  min-height: 0;
}

.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  box-sizing: border-box;
  min-width: 0;
}

/* < 1200px: all three stacked */
@media (max-width: 1199.98px) {
  .crm-contact-layout.crm-container-fluid {
    height: auto !important;
    min-height: calc(100vh - var(--header-h));
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .crm-contact-layout__row {
    height: auto !important;
    flex-wrap: wrap !important;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* 1200px - 1399.98px: 3 / 9 / 12 */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .crm-contact-layout.crm-container-fluid {
    height: auto !important;
    min-height: calc(100vh - var(--header-h));
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding-bottom: 24px;
  }

  .crm-contact-layout__row {
    height: auto !important;
    min-height: 0;
    flex-wrap: wrap !important;
    align-items: stretch;
  }

  .crm-contact-layout__left {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
    height: auto !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 75% !important;
    width: 75% !important;
    max-width: 75% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    margin-top: var(--crm-gutter-y, 14px);
  }

  .crm-panel-collapse {
    display: none !important;
  }
}

/* >= 1400px: normal 3 / 6 / 3 */
@media (min-width: 1400px) {
  .crm-contact-layout.crm-container-fluid {
    height: calc(100vh - var(--header-h));
    overflow: hidden;
  }

  .crm-contact-layout__row {
    height: 100%;
    flex-wrap: nowrap !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
    margin-top: 0;
  }
}

/* =========================================================
   FINAL CLEAN RESPONSIVE LAYOUT
   < 1200px  : 12 / 12 / 12
   1200-1399 : 3 / 9 / 12
   >= 1400px : 3 / 6 / 3
   No horizontal overflow / balanced viewport spacing.
   ========================================================= */

.crm-contact-layout.crm-container-fluid {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.crm-contact-layout__row {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  box-sizing: border-box;
  min-width: 0;
}

/* Mobile / tablet: 12 / 12 / 12 */
@media (max-width: 1199.98px) {
  .crm-contact-layout.crm-container-fluid {
    height: auto !important;
    min-height: calc(100vh - var(--header-h));
    padding: 0px !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .crm-contact-layout__row {
    height: auto !important;
    flex-wrap: wrap !important;
    gap: 8px;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .crm-panel-collapse {
    display: none !important;
  }
}

/* 1200px - 1399.98px: 3 / 9 / 12 */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .crm-contact-layout.crm-container-fluid {
    height: calc(100vh - 145px) !important;
    min-height: 0 !important;
    max-height: none !important;
    /*    padding: 14px 8px 24px !important;*/
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .crm-contact-layout__row {
    height: auto !important;
    min-height: 0 !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    column-gap: 12px !important;
    row-gap: 14px !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 6px) !important;
    width: calc(25% - 6px) !important;
    max-width: calc(25% - 6px) !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 75% !important;
    width: 75% !important;
    max-width: 75% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin-top: 14px;
    overflow: visible !important;
  }

  .crm-panel-collapse {
    display: none !important;
  }
}

/* >= 1400px: normal 3 / 6 / 3 */
@media (min-width: 1400px) {
  .crm-contact-layout.crm-container-fluid {
    height: calc(100vh - 145px) !important;

    overflow: hidden;
  }

  .crm-contact-layout__row {
    height: 100% !important;
    flex-wrap: nowrap !important;
    column-gap: 12px !important;
    row-gap: 0 !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 6px) !important;
    width: calc(25% - 6px) !important;
    max-width: calc(25% - 6px) !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 25% !important;
    width: 25% !important;
    max-width: 25% !important;
  }
}

/* Quick actions: utility-based flex layout. */
.crm-contact-profile__quick-actions.crm-d-flex {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: var(--sp-2, 8px);
}

.crm-contact-profile__quick-actions.crm-d-flex > button {
  flex: 1 1 0;
  min-width: 0;
}

/* =========================================================
   FINAL COLUMN GAP FIX
   The previous 25% + 75% widths plus a gap exceeded 100%,
   which forced the second column onto the next line.
   ========================================================= */
.crm-contact-layout__row {
  gap: 0;
}

@media (max-width: 1199.98px) {
  .crm-contact-layout__row {
    gap: 14px;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  .crm-contact-layout__row {
    gap: 14px;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 7px) !important;
    width: calc(25% - 7px) !important;
    max-width: calc(25% - 7px) !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(75% - 7px) !important;
    width: calc(75% - 7px) !important;
    max-width: calc(75% - 7px) !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (min-width: 1400px) {
  .crm-contact-layout__row {
    gap: 14px;
    flex-wrap: nowrap !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 9.333px) !important;
    width: calc(25% - 9.333px) !important;
    max-width: calc(25% - 9.333px) !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(50% - 9.333px) !important;
    width: calc(50% - 9.333px) !important;
    max-width: calc(50% - 9.333px) !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 calc(25% - 9.333px) !important;
    width: calc(25% - 9.333px) !important;
    max-width: calc(25% - 9.333px) !important;
  }
}

/* =========================================================
   QUICK ACTIONS - MOBILE / TABLET SPACING
   Give each action its own natural width so labels do not
   touch each other when the screen gets narrow.
   ========================================================= */
@media (max-width: 1199.98px) {
  .crm-contact-profile__quick-actions.crm-d-flex {
    justify-content: space-between !important;
    gap: 10px !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  .crm-contact-profile__quick-actions.crm-d-flex > button {
    flex: 0 1 auto !important;
    min-width: 34px;
    white-space: nowrap;
  }
}

@media (max-width: 575.98px) {
  .crm-contact-profile__quick-actions.crm-d-flex {
    gap: 7px !important;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* =========================================================
   QUICK ACTIONS - TABLET COMPACT SPACING
   Keep the six actions grouped instead of distributing the
   available tablet width with space-between.
   ========================================================= */
@media (min-width: 576px) and (max-width: 1199.98px) {
  .crm-contact-profile__quick-actions.crm-d-flex {
    justify-content: flex-start !important;
    gap: 18px !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  .crm-contact-profile__quick-actions.crm-d-flex > button {
    flex: 0 0 54px !important;
    width: 54px;
    min-width: 54px;
    max-width: 54px;
  }
}

/* Small mobile: keep actions compact while retaining readable labels. */
@media (max-width: 575.98px) {
  .crm-contact-profile__quick-actions.crm-d-flex {
    justify-content: space-between !important;
    gap: 7px !important;
  }

  .crm-contact-profile__quick-actions.crm-d-flex > button {
    flex: 1 1 0 !important;
    width: auto;
    min-width: 0;
    max-width: none;
  }
}

/* =========================================================
   ACTIONS DROPDOWN - RIGHT ANCHORED
   Always opens directly below the Actions trigger.
   JavaScript controls the exact viewport position.
   ========================================================= */
.crm-contact-actions-menu {
  position: fixed !important;
  right: auto !important;
  max-width: 255px;
}

@media (max-width: 767.98px) {
  .crm-contact-actions-menu {
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    border-radius: 16px;
  }
}

/* =========================================================
   ACTIONS SUBDROPDOWN
   Desktop/tablet: left of the main dropdown
   Mobile: below the item that owns the submenu
   ========================================================= */
.crm-contact-actions-submenu {
  position: fixed !important;
  z-index: 10000 !important;
  max-width: 255px;
}

@media (max-width: 767.98px) {
  .crm-contact-actions-submenu {
    max-width: calc(100vw - 16px);
  }
}

/* =========================================================
   FINAL DEVICE-SAFE RESPONSIVE OVERRIDES
   <1200       : 12 / 12 / 12
   1200-1399   : 3 / 9 / 12
   >=1400      : 3 / 6 / 3
   No horizontal overflow.
   ========================================================= */
.crm-contact-layout,
.crm-contact-layout__row,
.crm-contact-layout__left,
.crm-contact-layout__center,
.crm-contact-layout__right {
  box-sizing: border-box;
  min-width: 0;
}

.crm-contact-layout {
  width: 100%;
  max-width: 100%;
  padding-inline: 0;
  overflow-x: hidden !important;
}

.crm-contact-layout__row {
  width: 100%;
  margin-inline: 0 !important;
  gap: 14px;
  height: auto;
  flex-wrap: wrap !important;
}

/* < 1200px: all columns stacked */
@media (max-width: 1199.98px) {
  .crm-contact-layout {
    height: auto !important;
    min-height: calc(100vh - var(--header-h));
    overflow-x: hidden !important;
    overflow-y: visible !important;
    padding-inline: 0;
  }

  .crm-contact-layout__row {
    gap: 14px;
  }

  .crm-contact-layout__left,
  .crm-contact-layout__center,
  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* 1200-1399px: 3 / 9 / 12 */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .crm-contact-layout {
    height: calc(100vh - var(--header-h) - var(--sp-8) - var(--sp-12)) !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding-inline: 0;
    padding-bottom: 0;
  }

  .crm-contact-layout__row {
    gap: 14px;
    height: auto !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(30% - 7px) !important;
    width: calc(30% - 7px) !important;
    max-width: calc(30% - 7px) !important;
    height: auto !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(70% - 7px) !important;
    width: calc(70% - 7px) !important;
    max-width: calc(70% - 7px) !important;
    height: auto !important;
    overflow: visible !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
}

@media (min-width: 1920px) {
  .crm-contact-layout {
    height: calc(100vh - var(--header-h) - var(--sp-8) - var(--sp-12)) !important;
    overflow: hidden !important;
  }

  .crm-contact-profile__quick-actions.crm-d-flex {
    justify-content: space-between !important;
  }

  .crm-contact-layout__row {
    flex-wrap: nowrap !important;
    gap: 14px;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 10.5px) !important;
    width: calc(25% - 10.5px) !important;
    max-width: calc(25% - 10.5px) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 28px !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(50% - 7px) !important;
    width: calc(50% - 7px) !important;
    max-width: calc(50% - 7px) !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 calc(25% - 10.5px) !important;
    width: calc(25% - 10.5px) !important;
    max-width: calc(25% - 10.5px) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 28px !important;
  }
}

/* >= 1400px: 3 / 6 / 3 */
@media (min-width: 1400px) {
  .crm-contact-layout {
    height: calc(100vh - var(--header-h) - var(--sp-8) - var(--sp-12)) !important;
    overflow: hidden !important;
  }

  .crm-contact-profile__quick-actions.crm-d-flex {
    justify-content: space-between !important;
  }

  .crm-contact-layout__row {
    flex-wrap: nowrap !important;
    gap: 14px;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .crm-contact-layout__left {
    flex: 0 0 calc(25% - 10.5px) !important;
    width: calc(25% - 10.5px) !important;
    max-width: calc(25% - 10.5px) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 28px !important;
  }

  .crm-contact-layout__center {
    flex: 0 0 calc(50% - 7px) !important;
    width: calc(50% - 7px) !important;
    max-width: calc(50% - 7px) !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .crm-contact-layout__right {
    flex: 0 0 calc(25% - 10.5px) !important;
    width: calc(25% - 10.5px) !important;
    max-width: calc(25% - 10.5px) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 28px !important;
  }
}

/* Quick actions: compact, predictable spacing on every device. */
.crm-contact-profile__quick-actions.crm-d-flex {
  display: flex !important;
  align-items: flex-start !important;
  gap: 4px !important;
  flex-wrap: nowrap !important;
  min-width: 0;
  overflow: auto;
}

.crm-contact-profile__quick-actions.crm-d-flex > button {
  flex: 0 1 auto !important;
  min-width: 44px;
}

@media (max-width: 767.98px) {
  .crm-contact-profile__quick-actions.crm-d-flex {
    gap: 7px !important;
  }

  .crm-contact-profile__quick-actions.crm-d-flex > button {
    flex: 1 1 0 !important;
    min-width: 0;
  }
}

/* Actions main menu: always below trigger, right aligned. */
.crm-contact-actions-menu {
  max-width: min(350px, calc(100vw - 16px));
  box-sizing: border-box;
}

/* Submenu base: JS supplies exact coordinates. */
/*.crm-contact-actions-submenu {
  box-sizing: border-box;
  max-width: calc(100vw - 16px);
}
*/
@media (max-width: 767.98px) {
  /* Preserve mobile submenu as a dropdown below its parent item. */
  .crm-contact-actions-submenu {
    /* width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;*/
    right: auto !important;
  }
}

/* Communication subscriptions card and "Subscription status" drawer (CS1, as HubSpot) */
.crm-sidebar-info-card .crm-sub-note {
  display: flex;
  gap: 10px;
}
.crm-sub-note__dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-subtle);
}
.crm-sub-note__link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--brand);
  cursor: pointer;
}
.crm-sub-note__link:hover {
  text-decoration: underline;
}
.modal-backdrop--drawer .modal.crm-subs-drawer {
  /* CS2: HubSpot's drawer is 65% of the screen (1248px at 1920px); never narrower than 720px. */
  width: max(65vw, min(720px, 100vw));
  max-width: 100vw;
}
.crm-subs-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
}
.crm-subs-tabs__tab {
  padding: 10px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.crm-subs-tabs__tab.is-active {
  border-bottom-color: var(--text);
  font-weight: 600;
}
.crm-subs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.crm-subs-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--text);
  font-weight: 400;
  color: var(--text-muted);
  text-align: left;
}
.crm-subs-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.crm-subs-table__acts {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.crm-subs-pill {
  margin-left: 8px;
  padding: 4px 14px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  /* Opacity, not visibility, so the buttons stay in the tab order and focus shows them. */
  opacity: 0;
}
.crm-subs-table__row:hover,
.crm-subs-table__row:focus-within {
  background: var(--surface-hover);
}
.crm-subs-table__row:hover .crm-subs-pill,
.crm-subs-table__row:focus-within .crm-subs-pill {
  opacity: 1;
}
@media (hover: none) {
  .crm-subs-pill {
    opacity: 1;
  }
}
.crm-subs-pill:disabled {
  opacity: 0.6;
  cursor: default;
}
.crm-subs-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.crm-subs-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
}
.crm-subs-status__dot.is-subscribed {
  background: var(--success);
}
.crm-subs-status__dot.is-unsubscribed {
  background: var(--danger);
}
.crm-subs-status__info {
  display: inline-flex;
  color: var(--text-muted);
}
.crm-subs-table__empty {
  padding: 48px 14px;
  text-align: center;
}
.crm-subs-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* CS2: the History table scrolls sideways inside its own box, under the tabs, as HubSpot's. */
.crm-subs-scroll {
  overflow-x: auto;
}
.crm-subs-table--history {
  min-width: 1800px;
}
.crm-subs-table--history th,
.crm-subs-table--history td {
  white-space: nowrap;
}

/* G8 timeline pins */
/* Pinned activity on contact and company timelines (beyond the 28 Oct design, from HubSpot):
   a pale yellow card with a pin badge on its top edge, and a "Pin" / "Unpin" link in the header.
   Only cards with these classes change; Deals and custom objects never set them. */
.crm-activity-card.is-pinned,
.company-timeline-card.is-pinned {
  position: relative;
  border-color: color-mix(in srgb, #e0a43a 55%, var(--border));
  background: color-mix(in srgb, #f5c26b 14%, var(--surface));
}

.crm-pin-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid color-mix(in srgb, #e0a43a 55%, var(--border));
  border-radius: 50%;
  background: var(--surface);
  transform: translateX(-50%);
}

.crm-pin-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #c9821f;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-pin-end {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.crm-pin-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.crm-pin-toggle:hover:not(:disabled),
.crm-pin-toggle:focus-visible {
  text-decoration: underline;
}

.crm-pin-toggle:disabled {
  cursor: default;
  opacity: 0.5;
}

/* Room for the badge above the first pinned card, and space before the dated list. */
.crm-pins-list {
  padding-top: 12px;
  margin-bottom: 16px;
}

.crm-pins-error {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12px;
}

/* The company timeline's smaller cards: a smaller badge. "Pin" keeps the base 12px, the date's size
   there (company-details.css `.company-timeline-meta span`). */
.company-timeline-card.is-pinned .crm-pin-badge {
  top: -9px;
  width: 18px;
  height: 18px;
}

.company-timeline-meta .crm-pin-end {
  gap: 8px;
}

/* LD2: the record name as the 28 Oct design (record-page.css:8, :172-175): 20px, 18px at 480px
   and below. On the contact heading only (Deals shares .crm-contact-profile__name). */
.crm-contact-profile__name.crm-contact-profile__name--design { font-size: 20px; }
@media (max-width: 480px) {
  .crm-contact-profile__name.crm-contact-profile__name--design { font-size: 18px; }
}
/* LD2: the external-link icon after an Actions menu item that opens a new tab. */
.crm-contact-action-item__ext { flex: none; margin-left: auto; color: var(--text-muted); }
