/* =========================================================================
   ACTIVITY COMPOSER
   The Contact record's Note / Email / Call / Task / Schedule windows, from
   components/activity-composer.css and popup-window.css in the 28 Oct design.
   Everything sits under .acx, so the centered .activity-popup is untouched.
   ========================================================================= */

.acx {
  position: fixed;
  right: 24px;
  bottom: 24px;
  /* Over the top bar (1000), under modals (1050) and popovers (1200). The design's 1300 would
     hide the app's popovers behind the window. */
  z-index: 1040;
  width: min(580px, calc(100vw - 32px));
  min-width: 380px;
  min-height: 220px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  border: 1px solid #cbd6e2;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(20, 20, 20, .08), 0 12px 32px rgba(16, 24, 40, .12);
  resize: both;
  overflow: hidden;
}
.acx[style*='left'] { right: auto; bottom: auto; }
.acx.is-min { resize: none; min-height: 0; height: auto !important; }
.acx.is-min .acx__body,
.acx.is-min .acx__foot { display: none; }
.acx.pw-dragging { transition: none !important; }
.acx.pw-max {
  top: 16px !important;
  left: 16px !important;
  right: 16px !important;
  bottom: 16px !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  resize: none;
  box-shadow: 0 0 0 100vmax rgba(16, 24, 40, .35), 0 24px 48px rgba(16, 24, 40, .18) !important;
}

.acx__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 12px 14px 12px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: move;
  touch-action: none;
  user-select: none;
}
.acx.pw-max .acx__head { cursor: default; }
.acx.is-min .acx__head { border-bottom: 0; }
.acx__head button { cursor: pointer; }
.acx__grip {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 30px;
  height: 6px;
  transform: translateX(-50%);
  background-image: radial-gradient(circle, var(--text-subtle) 1.1px, transparent 1.3px);
  background-size: 5px 3px;
  opacity: .9;
}
.acx__title { flex: 1; margin: 0 0 0 14px; font-size: 16px; font-weight: 600; color: var(--text); }
.acx__icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
}
.acx__icon:hover { background: var(--surface-hover); }
.acx__icon:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.acx.is-min .acx__head .acx__icon:first-of-type svg { transform: rotate(-90deg); }

.acx__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.acx__body > * { flex-shrink: 0; }
.acx__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---------------------------------------------------------- buttons */
.acx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 26px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.acx-btn:hover { background: var(--surface-hover); }
.acx-btn--sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.acx-btn--danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.acx-btn--danger:hover { background: var(--danger); filter: brightness(.95); }
.acx-btn--call { height: 46px; padding: 0 30px; border-color: var(--success); background: var(--success); color: #fff; }
.acx-btn--call:disabled { border-color: var(--surface-3); background: var(--surface-3); color: var(--text-subtle); cursor: not-allowed; }

.acx__foot .btn-crm--primary { height: 44px; padding: 0 26px; font-size: 15px; font-weight: 600; }
.acx__foot .btn-crm--primary:disabled {
  border-color: var(--surface-3);
  background: var(--surface-3);
  color: var(--text-subtle);
  opacity: 1;
  cursor: not-allowed;
}
.acx-split { display: inline-flex; }
.acx-split > .btn-crm:first-child { border-radius: var(--radius-sm, 8px) 0 0 var(--radius-sm, 8px); }
.acx__foot .acx-split__more {
  width: 40px;
  padding: 0;
  border-left-color: var(--border);
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
}

/* -------------------------------------------------------- shared bits */
.acx-caret { width: 16px; height: 16px; flex: 0 0 auto; }
.acx-static { padding: 8px 0; font-size: 15px; font-weight: 600; }
.acx-pad { padding: 14px 22px 4px; }
.acx-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: 0;
}
.acx-input:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.acx-input:disabled { background: var(--surface-2, var(--surface-hover)); color: var(--text); }
.acx-input--bare { height: 36px; padding: 0; border: 0; box-shadow: none !important; font-size: 15px; }
.acx-input--title { height: 46px; font-size: 16px; border-radius: var(--radius); }

.acx-track,
.acx-follow .activity-followup__row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.acx-track input[type='checkbox'],
.acx-follow input[type='checkbox'],
.acx .task-compose__check input[type='checkbox'] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--text);
}

/* ------------------------------------------------------------- fields */
.acx-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 32px;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.acx-fields--2 > .acx-field { flex: 1 1 200px; }
.acx-fields--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.acx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.acx-field--grow { flex: 1 1 260px; }
.acx-field--wide { grid-column: 1 / -1; }
.acx-field__label { font-size: 14px; color: var(--text-muted); }
.acx-field--row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--border);
}
.acx-field--row .acx-field__label { width: 64px; flex: 0 0 64px; }
.acx-field--row > :nth-child(2) { flex: 1; min-width: 0; }
.acx-stack { display: flex; flex-direction: column; }

.acx-dt {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 15px;
}
.acx-dt input { flex: 0 0 auto; width: 15.5em; min-width: 15.5em; padding-right: 2px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; outline: 0; }
.acx-dt:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.acx-dt__tz { flex: 0 0 auto; color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.acx-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.acx-select__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acx-select:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: 6px; }
.acx-select:disabled { color: var(--text-muted); cursor: not-allowed; }
.acx-select--link { min-height: 36px; padding: 0 0 6px; border-bottom: 1px solid var(--border-strong); border-radius: 0; }
.acx-select--link:not(:disabled):hover { border-bottom-color: var(--text); }
.acx-select--link[aria-expanded='true'] { border-bottom: 2px solid var(--brand); }
.acx-select--box {
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}
.acx-select--box:disabled { background: var(--surface-2, var(--surface-hover)); }
.acx-select--box[aria-expanded='true'] { border-color: var(--brand); box-shadow: var(--focus-ring); }

.acx-assoc-link {
  max-width: 260px;
  min-height: 36px;
  padding: 0 0 6px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.acx-assoc-link:hover { border-bottom-color: var(--text); }
.acx-assoc-link.is-placeholder { color: var(--text-muted); font-weight: 500; }
.acx-attendee { display: flex; align-items: center; gap: 6px; min-height: 28px; font-size: 15px; }
.acx-attendee button:not(.acx-assoc-link) { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer; }
.acx-attendee button:not(.acx-assoc-link):hover { background: var(--surface-hover); color: var(--text); }

.acx-for { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--border); font-size: 14px; }
.acx-for__chip {
  padding: 3px 8px;
  border: 1px solid #7c98b6;
  border-radius: 3px;
  background: #eaf0f6;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 15px;
  cursor: pointer;
}
.acx-for__chip:hover { background: #dfe7ef; border-color: #516f90; }
/* The pale chip would hide the dark theme's light text. */
[data-theme="dark"] .acx-for__chip { background: var(--surface-3); border-color: var(--border); }
[data-theme="dark"] .acx-for__chip:hover { background: var(--surface-hover); }
/* Dark theme: a dark account email colour is shown in the theme's text colour. Only on screen;
   the sent email keeps the account colour. */
[data-theme="dark"] .activity-compose__body[data-dark-ink] { color: var(--text) !important; }

/* ------------------------------------------------------------- rows */
.acx-row { display: flex; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.acx .assoc-panel { margin: 0; }
.acx .assoc-panel__trigger {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.acx .assoc-panel__trigger:hover { text-decoration: underline; }
.acx .assoc-panel__trigger span { font-size: 0; }
.acx .assoc-panel__trigger span::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  vertical-align: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.acx-follow { margin: 0; gap: 4px; font-size: 14px; }
.acx-follow .activity-followup__text { white-space: nowrap; }
.acx-follow .activity-followup__trigger {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.acx-follow .activity-followup__trigger:disabled { color: var(--text); opacity: 1; }
.acx-follow .activity-followup__trigger:hover .acx-caret { color: var(--brand); }

/* ------------------------------------------------------------ editor */
.acx .activity-compose {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.acx .activity-compose__body {
  flex: 1 0 auto;
  padding: 24px 24px 8px;
  border: 0;
  font-size: 14.67px;
  line-height: 22px;
  outline: 0;
}
.acx.pw-max .activity-compose__body { min-height: 260px !important; }
.acx .activity-compose__bar {
  gap: 4px;
  padding: 8px 24px 10px 30px;
  border: 0;
  background: transparent;
  overflow: visible;
  flex-wrap: wrap;
}
.acx .activity-compose__tool:disabled { opacity: .45; cursor: not-allowed; }

.acx .note-attachments { padding: 0 22px; margin: 0; }
.acx .note-attachments:has(> .note-attachments__list) { padding-block: 8px; border-bottom: 1px solid var(--border); }
.acx .activity-popup__attachments { margin: 0; padding: 8px 22px; border-bottom: 1px solid var(--border); }
.acx .crm-fs-8.crm-mb-0 { padding: 8px 22px; }

/* -------------------------------------------------------- email bits */
.acx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; cursor: text; }
.acx-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2, var(--surface-hover));
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.acx-chip button { display: inline-grid; flex: 0 0 auto; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; }
.acx-chip button:hover { background: var(--surface-3); color: var(--text); }
.acx-chips__input { flex: 1; min-width: 140px; height: 30px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; outline: 0; }
.acx-chips__input[aria-invalid='true'] { color: var(--danger); }
.acx-cc { display: inline-flex; gap: 10px; flex: 0 0 auto !important; }
.acx-cc button { border: 0; background: transparent; color: var(--brand); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }

.acx .activity-popup__insert {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 8px 22px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2, var(--surface-hover));
}
.acx .activity-popup__insert-btn { height: 30px; padding: 0 2px; border: 0; background: transparent; color: var(--brand); font-size: 14px; font-weight: 600; }
.acx .activity-popup__insert-btn.is-locked { color: var(--text-muted); }

/* ------------------------------------------------------------ dialer */
.acx-dialer { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 22px; text-align: center; }
.acx-dialer .acx-fields { width: 100%; padding: 0; border: 0; text-align: left; }
.acx-dialer__who { font-size: 18px; }

/* -------------------------------------------------------- task, meeting */
.acx .task-compose { display: flex; flex-direction: column; gap: 0; }
.acx .task-compose .activity-compose { margin: 0; }
.acx .task-compose__title { width: calc(100% - 44px); height: 46px; margin: 14px 22px 4px; font-size: 16px; }
.acx .task-compose__section { padding: 16px 22px; border-bottom: 1px solid var(--border); }
.acx .task-compose__meta { display: flex; flex-wrap: wrap; gap: 14px 36px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.acx .task-compose__label { white-space: nowrap; }
.acx .meeting-popup__form { display: flex; flex-direction: column; gap: 0; }
.acx .meeting-popup__form > * { flex-shrink: 0; }
.acx .meeting-popup__layout.is-maximized { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(0, 1fr); gap: 0; flex: 1 1 auto; min-height: 0; }

/* The quick "Call": who to ring, above the Log call form. */
.acx-callnum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--surface)); }
.acx-callnum a { font-weight: 600; color: var(--brand-ink); }
.acx-callnum span { color: var(--text-muted); }
.acx-callnum p { flex: 1 0 100%; margin: 0; font-size: 13px; color: var(--text-muted); }

/* ---------------------------------------------------- discard bar */
/* Its own row above the footer: over it, the bar hid "Create note" (go-live QA). */
.acx-confirm {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--warning-bg);
  font-size: 14px;
}
.acx-confirm p { flex: 1 1 200px; margin: 0; }

/* ------------------------------------------- popovers opened from a window */
.acx-pop--list { padding: 10px 0 6px; }
.acx-list__items { max-height: 280px; overflow-y: auto; scrollbar-width: thin; }
.acx-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.acx-list__item:hover,
.acx-list__item:focus-visible { background: var(--surface-hover); outline: 0; }
.acx-list__item.is-selected { background: var(--surface-3); font-weight: 600; }
.acx-list__empty { padding: 12px 18px; color: var(--text-subtle); font-size: 14px; }
.acx-search { position: relative; display: block; margin: 0 12px 8px; }
.acx-search input {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: 0;
}

@media (max-width: 767px) {
  .acx {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    width: auto;
    min-width: 0;
    max-height: calc(100vh - 16px);
    resize: none;
  }
  .acx__grip { display: none; }
  .acx__head { cursor: default; touch-action: auto; }
  .acx-fields { gap: 12px 20px; padding: 14px 16px; }
  .acx-fields--grid { grid-template-columns: 1fr; }
  .acx-for, .acx-row, .acx-pad, .acx__foot { padding-left: 16px; padding-right: 16px; }
  .acx-field--row { padding: 8px 16px; }
  .acx-follow .activity-followup__text { white-space: normal; }
}
