/* Conversations › Manual Actions and the Let's Start queue bar
   (public/manual-actions.js). GHL's page is `bg-gray-50`, the title its
   4xl bold gray-900, the table a bordered HighRise data table whose
   selects are 200px+ wide and 36px high. */

.mx-page, .mx-menu, .mx-mask, .mq-bar {
  --ma-blue: #155eef;
  --ma-blue-dark: #004eeb;
  --ma-blue-soft: #eff4ff;
  --ma-blue-disabled: #b2ccff;
  --ma-border: #d0d5dd;
  --ma-line: #eaecf0;
  --ma-text: #101828;
  --ma-text-2: #344054;
  --ma-muted: #475467;
  --ma-faint: #667085;
  --ma-red: #d92d20;
  --ma-green: #079455;
  --ma-green-soft: #dcfae6;
}
/* GHL's page is gray edge to edge under the module's tab row. */
.conv-host:has(> .mx-page) { padding: 0; }
.mx-page {
  color: var(--ma-text);
  background: #f9fafb;
  padding: 28px 40px 32px;
  min-height: calc(100vh - 150px);
}

/* ---------- header ---------- */
.mx-head { display: flex; align-items: center; gap: 10px; }
.mx-titles { flex: 1; min-width: 0; }
.mx-h1 { margin: 0; font-size: 28px; line-height: 36px; font-weight: 700; color: var(--ma-text); letter-spacing: -.01em; }
.mx-sub { font-size: 14px; line-height: 20px; color: var(--ma-muted); margin-top: 2px; }
.mx-gap { height: 16px; }

/* ---------- buttons ---------- */
.mx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 20px; white-space: nowrap;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--ma-border);
  background: #fff; color: var(--ma-text-2); cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.mx-btn:hover:not(:disabled) { background: #f9fafb; }
.mx-btn:disabled { cursor: not-allowed; opacity: .5; }
.mx-btn.loading { cursor: progress; }
.mx-btn.xs { padding: 8px 14px; }
.mx-btn.xxs { padding: 4px 10px; font-size: 12px; line-height: 18px; border-radius: 6px; font-weight: 500; }
.mx-btn.primary { background: var(--ma-blue); border-color: var(--ma-blue); color: #fff; }
.mx-btn.primary:hover:not(:disabled) { background: var(--ma-blue-dark); }
.mx-btn.primary:disabled { opacity: 1; background: var(--ma-blue-disabled); border-color: var(--ma-blue-disabled); }
.mx-btn.danger { background: var(--ma-red); border-color: var(--ma-red); color: #fff; }
.mx-btn.danger:hover:not(:disabled) { background: #b42318; }
.mx-btn.red-outline { color: #b42318; border-color: #fda29b; padding: 4px 10px; font-size: 13px; }
.mx-btn.red-outline:hover:not(:disabled) { background: #fef3f2; }
.mx-btn.text { border: 0; box-shadow: none; background: none; color: var(--ma-blue); padding: 4px 6px; font-size: 13px; }
.mx-btn.text:hover:not(:disabled) { background: var(--ma-blue-soft); }
.mx-btn.ghost { border: 0; box-shadow: none; background: none; color: var(--ma-faint); }
.mx-btn.icon { padding: 4px; border-radius: 6px; }
.mx-btn.ghost:hover:not(:disabled) { background: #f2f4f7; color: var(--ma-text-2); }
.mx-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 4px;
  border: 0; background: none; border-radius: 6px; color: var(--ma-faint); cursor: pointer;
}
.mx-icon-btn:hover:not(:disabled) { background: #f2f4f7; color: var(--ma-red); }
.mx-icon-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- the card ---------- */
.mx-card {
  background: #fff; border: 1px solid var(--ma-line); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); overflow: hidden;
}
.mx-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.mx-filters { display: flex; gap: 16px; flex-wrap: wrap; }
.mx-filter { width: 260px; max-width: 100%; }
.mx-sel-count { font-size: 14px; color: var(--ma-text-2); white-space: nowrap; }
.mx-sel-group { display: flex; align-items: center; }
.mx-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- selects ---------- */
.mx-select {
  position: relative; display: flex; align-items: center; gap: 8px; height: 36px;
  padding: 0 10px; border: 1px solid var(--ma-border); border-radius: 6px; background: #fff;
  cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.mx-select:hover { border-color: #98a2b3; }
.mx-select.open { border-color: #84adff; box-shadow: 0 0 0 4px #d1e0ff; }
.mx-select-search { color: var(--ma-faint); flex: none; }
.mx-select-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit;
  font-size: 15px; color: var(--ma-text); cursor: inherit; padding: 0;
  text-overflow: ellipsis;
}
.mx-select-input::placeholder { color: var(--ma-muted); }
.mx-select-chev { color: var(--ma-faint); flex: none; transition: transform .15s; }
.mx-select.open .mx-select-chev { transform: rotate(180deg); }
.mx-select-clear {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border: 0; border-radius: 50%; background: #d0d5dd; color: #fff; padding: 0; cursor: pointer; flex: none;
}
.mx-select-clear:hover { background: #98a2b3; }
.mx-select-clear[hidden] { display: none; }
.mx-menu {
  position: absolute; z-index: 1200; max-height: 280px; overflow-y: auto; background: #fff;
  border: 1px solid var(--ma-line); border-radius: 8px; padding: 4px;
  box-shadow: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
}
.mx-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px;
  font-size: 14px; color: var(--ma-text); cursor: pointer;
}
.mx-opt:hover { background: #f9fafb; }
.mx-opt.on { background: var(--ma-blue-soft); color: var(--ma-blue); font-weight: 500; }
.mx-opt-label, .mx-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-opt-person { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mx-menu-empty { padding: 10px; font-size: 13px; color: var(--ma-faint); text-align: center; }

/* ---------- the table ---------- */
.mx-table-wrap { position: relative; overflow: auto; max-height: calc(100vh - 330px); }
.mx-table-wrap.loading { opacity: .55; pointer-events: none; }
.mx-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; min-width: 860px; }
.mx-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 500; font-size: 15px;
  color: var(--ma-text-2); background: #f9fafb; padding: 14px 16px;
  border-top: 1px solid var(--ma-line); border-bottom: 1px solid var(--ma-line);
}
.mx-table td { padding: 12px 16px; color: var(--ma-muted); border-bottom: 1px solid var(--ma-line); vertical-align: middle; }
.mx-table th + th, .mx-table td + td { border-left: 1px solid var(--ma-line); }
.mx-table tbody tr:hover td { background: #f9fafb; }
.mx-table tbody tr.selected td { background: var(--ma-blue-soft); }
.mx-col-check { width: 52px; text-align: center !important; }
.mx-col-act { width: 52px; text-align: center !important; }
.mx-col-contact { width: 17%; }
.mx-col-as { width: 15%; }
.mx-col-wf { width: 22%; }
.mx-col-type { width: 9%; }
.mx-col-status { width: 13%; }
.mx-col-date { width: 18%; white-space: nowrap; }
.mx-check { width: 16px; height: 16px; margin: 0; accent-color: var(--ma-blue); cursor: pointer; vertical-align: middle; }
.mx-check:disabled { cursor: not-allowed; }
.mx-cell-person { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mx-link { cursor: pointer; color: var(--ma-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-link:hover { color: #2e90fa; text-decoration: underline; }
.mx-av {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 600; color: #fff; background: #7f56d9; overflow: hidden;
}
.mx-av.xs { width: 20px; height: 20px; font-size: 9px; }
.mx-av.link { cursor: pointer; }
.mx-av img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- empty and paging ---------- */
.mx-empty { display: flex; flex-direction: column; align-items: center; padding: 48px 16px 56px; text-align: center; }
.mx-empty-ico {
  width: 52px; height: 52px; border-radius: 50%; background: var(--ma-green-soft); color: var(--ma-green);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.mx-empty-title { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ma-text-2); }
.mx-empty-desc { font-size: 15px; line-height: 22px; color: var(--ma-muted); margin-top: 6px; }
.mx-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px 12px; }

/* ---------- modals ---------- */
.mx-mask {
  position: fixed; inset: 0; z-index: 1300; background: rgba(16, 24, 40, .5);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
}
.mx-modal {
  max-width: 100%; background: #fff; border-radius: 12px; padding: 20px 24px;
  box-shadow: 0 20px 24px -4px rgba(16, 24, 40, .08), 0 8px 8px -4px rgba(16, 24, 40, .03);
}
.mx-modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mx-modal-ico {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; flex: none; background: #f2f4f7; color: var(--ma-text-2);
}
.mx-modal-ico.red { background: #fee4e2; color: var(--ma-red); }
.mx-modal-ico.orange { background: #fef0c7; color: #dc6803; }
.mx-modal-title { flex: 1; font-size: 18px; line-height: 28px; font-weight: 600; color: var(--ma-text); }
.mx-modal-x { border: 0; background: none; color: var(--ma-faint); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.mx-modal-x:hover { background: #f2f4f7; }
.mx-modal-text { font-size: 14px; line-height: 20px; color: var(--ma-muted); }
.mx-modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.mx-confirm { margin-top: 16px; }
.mx-confirm-label { display: block; font-size: 14px; font-weight: 500; color: var(--ma-text-2); margin-bottom: 6px; }
.mx-input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--ma-border); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); color: var(--ma-text);
}
.mx-input:focus { outline: none; border-color: #84adff; box-shadow: 0 0 0 4px #d1e0ff; }
.mx-confirm.error .mx-input { border-color: #fda29b; }
.mx-confirm.success .mx-input { border-color: #75e0a7; }
.mx-confirm-fb { font-size: 13px; color: var(--ma-red); margin-top: 4px; min-height: 0; }

/* ---------- the queue bar (above a contact record) ---------- */
.mq-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center;
  margin: 0 0 12px; padding: 12px 16px; background: #fff; border: 1px solid #b2ccff;
  border-left: 4px solid var(--ma-blue); border-radius: 8px; color: var(--ma-text);
}
.mq-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mq-ico { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mq-ico.call { background: var(--ma-green-soft); color: var(--ma-green); }
.mq-ico.sms { background: var(--ma-blue-soft); color: var(--ma-blue); }
.mq-text { min-width: 0; }
.mq-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mq-sub { font-size: 13px; color: var(--ma-faint); margin-top: 1px; }
.mq-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mq-note, .mq-draft { grid-column: 1 / -1; }
.mq-note { font-size: 14px; color: var(--ma-muted); background: #f9fafb; border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; }
.mq-draft {
  font: inherit; font-size: 14px; line-height: 20px; padding: 8px 12px; border-radius: 8px; resize: vertical;
  border: 1px solid var(--ma-border); color: var(--ma-text); box-sizing: border-box; width: 100%;
}
.mq-draft:focus { outline: none; border-color: #84adff; box-shadow: 0 0 0 4px #d1e0ff; }
.mq-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.mq-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px;
  border: 1px solid #eaecf0; background: #f9fafb; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--ma-text-2); text-align: center;
  transition: border-color .15s, background .15s;
}
.mq-tile:hover, .mq-tile:focus-visible { border-color: #84adff; background: var(--ma-blue-soft); outline: none; }
.mq-tile.gray svg { color: #475467; }
.mq-tile.orange svg { color: #dc6803; }
.mq-tile.blue svg { color: #1570ef; }
.mq-tile.green svg { color: #16a34a; }

@media (max-width: 720px) {
  .mx-page { padding: 16px; }
  .mx-head { flex-wrap: wrap; }
  .mx-filter { width: 100%; }
  .mx-filters { width: 100%; }
  .mq-bar { grid-template-columns: 1fr; }
  .mq-actions { justify-content: flex-start; }
  .mq-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
