/* Compact filter chips — hug content, no space-between stretch */
.crm-deals-page .filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

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

.crm-deals-page .filters-bar .companies-filter-select .custom-select__trigger {
  width: max-content;
  max-width: 220px;
  height: 36px;
  padding: 0 12px;
  gap: 6px;
}

.crm-deals-page .filters-bar .companies-filter-select .custom-select__value {
  margin-right: 0;
}

.crm-deals-page .crm-pipeline {
  height: calc(100vh - 395px);
}

/* ==========================================================================
   FILTER ITEM - Quick filter dropdown items with info icon
   ========================================================================== */
.filter-item {
  display: flex;
  align-items: center;
  border-radius: 7px;
  position: relative;
  transition: background-color var(--fast) var(--ease);
}

.filter-item:hover {
  background: var(--surface-hover);
}

.filter-item .dropdown__item {
  flex: 1;
  min-width: 0;
}

.filter-item .dropdown__item:hover {
  background: transparent;
}

/* Info icon - hidden by default, visible on row hover */
.filter-item__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-subtle);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--fast) var(--ease),
    visibility var(--fast) var(--ease),
    color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
  margin-right: 4px;
}

.filter-item:hover .filter-item__info {
  opacity: 1;
  visibility: visible;
}

.filter-item__info:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

/* Active / highlighted state when popover is open */
.filter-item.is-info-active {
  background: var(--accent-soft);
}

.filter-item.is-info-active .filter-item__info {
  opacity: 1;
  visibility: visible;
  color: var(--brand);
}

/* ==========================================================================
   FILTER INFO POPOVER
   ========================================================================== */
.filter-info-popover {
  position: fixed;
  z-index: 10001;
  width: 320px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateX(4px);
  transition:
    opacity var(--fast) var(--ease),
    visibility var(--fast) var(--ease),
    transform var(--fast) var(--ease);
  pointer-events: none;
}

.filter-info-popover::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 18px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

.filter-info-popover.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.filter-info-popover__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.filter-info-popover__desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.filter-info-popover__divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.filter-info-popover__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.filter-info-popover__row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.filter-info-popover__key {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.filter-info-popover__value {
  font-weight: 400;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-info-popover__value .icon {
  color: var(--text-subtle);
}

.filter-info-popover__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-ink);
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}

.filter-info-popover__link:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .filter-info-popover {
    width: min(280px, calc(100vw - 32px));
  }
}

/* Column Add Deal Button - visible when hovering over column */
.crm-pipeline__column .crm-pipeline__column-add-deal {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--fast) var(--ease),
    visibility var(--fast) var(--ease);
}

.crm-pipeline__column:hover .crm-pipeline__column-add-deal {
  opacity: 1;
  visibility: visible;
}

.crm-pointer-events-none {
  pointer-events: none;
}

label.dropdown__item {
  cursor: pointer;
  user-select: none;
}

.crm-pipeline__card,
[data-draggable-item],
.tab {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.crm-pipeline__deal-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
  transition:
    color var(--fast) var(--ease),
    text-decoration var(--fast) var(--ease);
}

.crm-pipeline__deal-link:hover,
.hover-underline:hover {
  text-decoration: underline !important;
  color: var(--brand) !important;
}

/* ==========================================================================
   DEAL DETAILS PAGE STYLES (NO INLINE CSS)
   ========================================================================== */

/* ==========================================================================
   DEAL DETAILS PAGE STYLES & TABS DESIGN SYSTEM
   ========================================================================== */

/* ==========================================================================
   DEAL DETAILS PAGE TABS DESIGN SYSTEM (EXACT SETTINGS-PROFILE MATCH)
   ========================================================================== */

.crm-deal-stage-bar,
.crm-activity-tabs,
.set-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 24px;
  padding: 0 20px !important;
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  user-select: none;
  min-width: auto;
}

.crm-deal-stage-bar::-webkit-scrollbar,
.crm-activity-tabs::-webkit-scrollbar,
.set-tabs::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* TAB ITEM BASE (FOR BOTH STAGE BAR & ACTIVITY TABS) */
.crm-deal-stage-bar .crm-activity-filter,
.crm-activity-tab,
.set-tab {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 4px !important;
  font-family: inherit !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -1px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: color var(--fast, 0.15s) ease !important;
  flex-shrink: 0 !important;
}
.set-tab {
  min-width: auto;
  padding: 12px 16px !important;
}

.crm-deal-stage-bar {
  min-width: auto;
}
.crm-deal-stage-bar .crm-activity-filter:hover,
.crm-activity-tab:hover,
.set-tab:hover {
  color: var(--text) !important;
  background: transparent !important;
}

/* ACTIVE STATE FOR ALL TABS (MATCHES SETTINGS-PROFILE ACTIVE TAB) */
.crm-deal-stage-bar .crm-activity-filter.active,
.crm-deal-stage-bar .crm-activity-filter.is-active,
.crm-deal-stage-bar .crm-activity-filter.is-stage-active,
.crm-activity-tab.active,
.crm-activity-tab.is-active,
.set-tab.active,
.set-tab.is-active {
  color: var(--brand) !important;
  font-weight: 600 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.crm-deal-stage-bar .crm-activity-filter.active::after,
.crm-deal-stage-bar .crm-activity-filter.is-active::after,
.crm-deal-stage-bar .crm-activity-filter.is-stage-active::after,
.crm-activity-tab.active::after,
.crm-activity-tab.is-active::after,
.set-tab.active::after,
.set-tab.is-active::after {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 3px !important;
  background: var(--brand) !important;
  border-radius: 3px 3px 0 0 !important;
  z-index: 10 !important;
}

/* ACTIVITY CARD EXPAND / COLLAPSE */
.crm-activity-card__top {
  cursor: pointer;
  user-select: none;
}

.crm-activity-card.is-collapsed .crm-activity-card__description {
  display: none !important;
}

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

/* STAGE WARNING ALERT BANNER STYLING */
.crm-deal-warning-wrapper {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}

.crm-deal-warning-alert {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(230, 140, 0, 0.08);
  border: 1px solid rgba(230, 140, 0, 0.25);
  color: var(--text);
  border-radius: var(--radius-md, 8px);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
}

.crm-deal-warning-icon {
  width: 18px;
  height: 18px;
  stroke: #d97706;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.crm-deal-profile-designation {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 6px;
}

.crm-deal-profile-close {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.crm-deal-profile-close-date {
  color: var(--danger);
  font-weight: 600;
}

.crm-deal-quick-actions {
  margin-top: 20px;
}

.crm-deal-contact-logo {
  background: var(--surface-2);
  color: var(--text-dark);
  font-weight: 700;
}

.crm-deal-brand-link {
  font-weight: 700;
  color: var(--brand);
}

.crm-deal-line-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crm-deal-line-item-label {
  font-size: 13px;
}

.crm-deal-line-item-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.crm-deal-line-item-divider {
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.crm-deal-total-label {
  font-size: 14px;
  color: var(--text-dark);
}

.crm-deal-total-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.crm-deal-quote-title {
  font-weight: 700;
  color: var(--brand);
  font-size: 14px;
}

.crm-deal-quote-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* DL2: Create deal (`.popup-drawer`, z-index 9999, create-popup.css) asks the Closed Lost reason
   when the deal is created straight into a lost stage, so the dialog draws above it, as the
   stage's required-properties prompt does (`.lp-modal-ov`, list-page.css:389). */
#dealClosedLostModal.modal-backdrop,
#dealClosedWonModal.modal-backdrop {
  z-index: 10040;
}

/* GL7 (go-live M5): the deal board card's status pill, score badge and contact avatars
   (beyond the design, the user's call, 27 Nov 2026). */
.lp-bcard__deal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.deal-status-pill,
.deal-score-badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; }
.deal-status-pill--open { background: var(--info-bg); color: var(--info); }
.deal-status-pill--won { background: var(--success-bg); color: var(--success); }
.deal-status-pill--lost { background: var(--danger-bg); color: var(--danger); }
.deal-score-badge { background: var(--surface-3); color: var(--text-muted); font-weight: 500; }
.deal-card-avatars { display: inline-flex; align-items: center; margin-left: auto; }
.deal-card-avatars > span + span { margin-left: -6px; }
.deal-card-avatars .lp-av { box-shadow: 0 0 0 2px var(--surface); }
.deal-card-avatars__more { margin-left: 4px !important; color: var(--text-subtle); font-size: 12px; }
.deal-tag-pill { display: inline-flex; align-items: center; max-width: 100%; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 500; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* GLM (go-live M1, HUB-70): the deal page on a 1280px laptop (1025-1399px). details.css wraps
   the right column under the page below 1400px (30 / 70 / 100) and stacks every column below
   1200px, so the associations went off screen. Here the page keeps one row: the right column
   starts collapsed behind the design's collapse toggle (record-page.js:29-47; the user's pick,
   as HubSpot's "Expand sidebar", 27 Nov 2026), left and centre take 33 / 67. Expanded, the
   columns are the design's 3 / 6 / 3, each scrolling on its own. Other record pages unchanged. */
@media (min-width: 1025px) and (max-width: 1399.98px) {
  .crm-contact-layout.crm-contact-layout--deal {
    position: relative;
    height: calc(100vh - var(--header-h) - var(--sp-8) - var(--sp-12)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .crm-contact-layout--deal .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--deal .crm-contact-layout__left,
  .crm-contact-layout--deal .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;
  }

  .crm-contact-layout--deal .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;
    overflow: hidden !important;
  }

  /* Collapsed (the default here): left 33% ("About this deal" fits), the centre the rest, beside the toggle. */
  .crm-contact-layout--deal.is-right-collapsed .crm-contact-layout__left {
    flex: 0 0 calc(33% - 7px) !important;
    width: calc(33% - 7px) !important;
    max-width: calc(33% - 7px) !important;
  }

  .crm-contact-layout--deal.is-right-collapsed .crm-contact-layout__center {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    margin-right: 44px;
  }

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

  /* Quick actions: always one row of six (design record-page.css:59-64), labels end with "…",
     instead of a row that scrolls sideways and hides More. */
  .crm-contact-layout--deal .crm-deal-quick-actions.crm-d-flex {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px !important;
    overflow: visible;
  }

  .crm-contact-layout--deal .crm-deal-quick-actions.crm-d-flex > * {
    min-width: 0 !important;
    width: 100%;
  }

  .crm-contact-layout--deal .crm-deal-quick-actions button > span:last-child {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The toggle, hidden elsewhere on master (details.css .crm-panel-collapse). */
  .crm-contact-layout--deal .crm-panel-collapse {
    display: grid !important;
  }
}
