/*
 * Inbox (HUB-366): the page is the design's `.ix` (public/crm/assets/css/inbox-hs.css, used as it
 * is). Here only what the design's static page does not have or styles from its own script.
 */

/* a recipient box's suggested addresses, under the box */
.ix .ix-suggest {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 60;
  max-height: 220px;
  overflow-y: auto;
}

/* the design writes the views' counts in <b>; its rows are buttons that can be turned off here */
.ix .ix-views button[disabled] {
  background: none;
  opacity: 0.45;
  cursor: not-allowed;
}
.ix-pop .ix-mi[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.ix .ix-tools .ix-icon[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* a line above the editor: forwarding, a chosen template, Limited Features */
.ix .ix-comp__note {
  margin: 8px 16px 0;
  color: var(--ix-muted);
  font-size: 13px;
}

/* a real email's HTML can be wider than the card */
.ix .ix-msg__body img,
.ix .ix-quote img {
  max-width: 100%;
  height: auto;
}
.ix .ix-msg__body,
.ix .ix-quote {
  overflow-x: auto;
}

/* Track opens sits beside Send */
.ix .ix-send--email {
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

/* the comment box is a text area (it completes @mentions), styled as the design's note */
.ix .ix-comp.is-comment textarea {
  width: calc(100% - 24px);
  min-height: 72px;
  margin: 8px 12px 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--ix-note);
  color: var(--ix-ink);
  font: inherit;
  resize: vertical;
}

/* a hidden left menu is out of reach of the keyboard too (the design empties it instead) */
.ix.is-rail-off:not(.is-fold) .ix-rail {
  visibility: hidden;
}

/*
 * A full reply box (Cc, Bcc, From, Subject, a long text) on a short screen: it scrolls, and Send
 * stays at its foot. Not for comments, whose @mention list opens outside the box.
 */
.ix .ix-comp:not(.is-comment) {
  flex-shrink: 1;
  min-height: 150px;
  overflow-y: auto;
}
/* the emails give up their space first, so the column never grows past the inbox */
.ix .ix-msgs {
  min-height: 40px;
}
.ix .ix-thread {
  min-height: 0;
}
/* the design's grip sits above the box's edge, where a scrolling box would cut it off */
.ix .ix-comp:not(.is-comment) > .ix-comp__grip {
  top: 0;
  z-index: 3;
  height: 10px;
}
.ix .ix-comp:not(.is-comment) > * {
  flex-shrink: 0;
}
.ix .ix-comp > .ix-send--email {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--surface);
}

/*
 * Phones: one pane at a time, as this page did before (the design's static page squeezes two
 * columns to about 150px each). `is-reading`: the opened conversation; Back returns to the list.
 */
.ix .ix-back {
  display: none;
}
@media (max-width: 767.98px) {
  .ix.ix.ix {
    grid-template-columns: minmax(0, 1fr) !important;
    height: calc(100dvh - var(--header-h) - var(--mobile-nav-h) - 48px);
    min-height: 480px;
  }
  .ix .ix-list,
  .ix .ix-thread {
    grid-column: 1 !important;
  }
  .ix .ix-thread {
    display: none;
  }
  .ix.is-reading:not(.is-bulk) .ix-list,
  .ix.is-reading:not(.is-bulk) .ix-searchbar {
    display: none;
  }
  .ix.is-reading:not(.is-bulk) .ix-thread {
    display: flex;
  }
  .ix.is-reading .ix-back {
    display: inline-grid;
    flex: none;
  }
  /* the contact panel only ever slides over the conversation */
  .ix:not(.is-side-peek) .ix-side {
    display: none;
  }
  .ix.is-search .ix-searchbar {
    grid-column: 1;
  }
  /* selected conversations: their actions above the list, which stays to select more */
  .ix.is-bulk {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .ix.is-bulk .ix-thread {
    display: flex;
    grid-row: 1;
  }
  .ix.is-bulk .ix-list {
    grid-row: 2;
  }
  .ix.is-bulk .ix-empty--bulk {
    display: none;
  }
  .ix.is-bulk .ix-th__acts {
    flex-wrap: wrap;
  }
}

/* HUB-366: a conversation's status, response-time target and owner on its row */
.ix .ix-row__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.ix .ix-sla.is-late {
  border-color: var(--danger, #d92d20);
  color: var(--danger, #d92d20);
}
.ix .ix-row__owner {
  margin-left: auto;
}
/* the status picker beside the owner */
.ix .ix-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ix .ix-status select {
  padding: 2px 6px;
  border: 1px solid var(--ix-line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ix-ink);
  font: inherit;
  font-weight: 600;
}
/* search: status and dates under the box */
.ix .ix-sfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.ix .ix-sfilters label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ix-muted);
  font-size: 13px;
}
.ix .ix-sfilters .input {
  width: auto;
  height: 30px;
  min-height: 0;
  padding-top: 2px;
  padding-bottom: 2px;
}
.ix .ix-away {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--ix-note);
}
/* "#shortcut" snippets, under the editor */
.ix .ix-hash {
  max-height: 180px;
  margin: 0 12px;
  overflow-y: auto;
  border: 1px solid var(--ix-line);
  border-radius: 8px;
  background: var(--surface);
}
.ix .ix-cx__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 16px;
  border-top: 1px solid var(--ix-line);
}
.ix .ix-th--bulk {
  height: auto;
}
/* the design keeps these at their full width, which ran over the list and the left menu */
.ix .ix-th--bulk .ix-th__acts {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

/* team inboxes: who else has the conversation open */
.ix .ix-presence {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 16px;
  font-size: 12px;
  color: #7a4f00;
  background: #fff6e0;
  border-bottom: 1px solid #f0dcaa;
}
.ix .ix-inboxbtn {
  min-width: 0;
}
.ix .ix-inboxbtn__t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ix .ix-caution {
  margin: 0;
  padding: 8px 16px;
  font-size: 12px;
  color: #7a4f00;
  background: #fff6e0;
}

/* what happened to a sent email, and who sees a comment: wrapped, never cut off */
.ix .ix-msg__state {
  color: var(--ix-muted);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.ix .ix-msg--note .ix-msg__to {
  white-space: normal;
}

/*
 * Recipients in a narrow conversation column: the box keeps a usable width (Cc, Bcc and the
 * menu move under it), a chip never leaves it, and the typing space after a chip is small
 * enough not to add a line.
 */
.ix .ix-comp__to {
  flex-wrap: wrap;
  /* narrower sides than the design's, so an everyday address shows in full */
  padding-left: 10px;
}
.ix .ix-comp__to > .ix-chips {
  flex: 1 1 180px;
  padding-right: 28px;
  padding-left: 6px;
}
.ix .ix-comp__after {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
@media (max-width: 767.98px) {
  .ix.ix .ix-comp__to > .ix-chips {
    flex-basis: 220px;
  }
}
/* room is left for the typing space, so it stays on the chip's line */
.ix .ix-chip {
  max-width: calc(100% - 14px);
}
/* the list arrow keeps to the box's corner instead of taking a line of its own */
.ix .ix-chips--box > .ix-chips__chv {
  position: absolute;
  right: 4px;
  bottom: 6px;
}
.ix .ix-chip__t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ix .ix-chip ~ .ix-chips__in {
  min-width: 8px;
}
.ix .ix-chip ~ .ix-chips__in.is-typing {
  min-width: 120px;
}

/* the expanded reply box takes more of the column, and always leaves room to write */
.ix .ix-comp.is-expanded {
  height: 84%;
}
.ix .ix-comp.is-expanded .ix-ed {
  min-height: 128px;
}

/* tracking and "Log to CRM": one quiet button beside Send */
.ix .ix-sendopt,
.ix-compose .ix-sendopt {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ix-muted);
  font-size: 13px;
  cursor: pointer;
}
.ix .ix-sendopt:hover,
.ix-compose .ix-sendopt:hover {
  background: var(--ix-hover);
  color: var(--ix-ink);
}
.ix .ix-sendopt__t,
.ix-compose .ix-sendopt__t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ix .ix-send--email {
  column-gap: 10px;
  row-gap: 4px;
  padding-bottom: 10px;
}
.ix .ix-send__sig {
  margin-left: auto;
}

/* the subject moves to its own line rather than being squeezed to a letter */
.ix .ix-owner {
  flex-wrap: wrap;
  row-gap: 4px;
}
.ix .ix-owner__sub {
  flex: 1 1 220px;
}

/*
 * A received email is often built from fixed-width tables (600px and more). They shrink to the
 * conversation instead of being cut off; what still can't fit scrolls sideways.
 */
.ix .ix-msg__body table,
.ix .ix-quote table {
  max-width: 100% !important;
  min-width: 0 !important;
}
.ix .ix-msg__body table[width],
.ix .ix-msg__body table[style*='width'],
.ix .ix-quote table[width],
.ix .ix-quote table[style*='width'] {
  width: 100% !important;
}
.ix .ix-msg__body :is(td, th, div, p, pre),
.ix .ix-quote :is(td, th, div, p, pre) {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere;
}
.ix .ix-msg__body pre,
.ix .ix-quote pre {
  white-space: pre-wrap;
}
/* in a narrow column the email uses the card's full width */
@container (max-width: 620px) {
  .ix .ix-msg__body {
    margin-left: 0;
  }
  .ix .ix-msgs {
    padding-right: 10px;
    padding-left: 10px;
  }
}

/*
 * The contact panel: its own hide button, and a narrow strip with a show button while hidden
 * (like the left menu's), so it is clear where it went.
 */
.ix .ix-side__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 8px 2px 16px;
  border-bottom: 1px solid var(--ix-line);
  background: var(--surface);
}
.ix .ix-side__title {
  color: var(--ix-muted);
  font-size: 13px;
  font-weight: 600;
}
.ix .ix-card {
  padding-top: 12px;
  padding-bottom: 12px;
}
.ix.is-snug .ix-card .ix-av--lg {
  width: 44px;
  height: 44px;
  font-size: 14px;
}
@media (min-width: 768px) {
  .ix.ix.is-side-off:not(.is-nothread) .ix-side {
    display: block;
    overflow: hidden;
  }
  .ix.ix.is-side-off:not(.is-nothread) .ix-side > :not(.ix-side__bar),
  .ix.ix.is-side-off:not(.is-nothread) .ix-side__title {
    display: none;
  }
  .ix.ix.is-side-off:not(.is-nothread) .ix-side__bar {
    justify-content: center;
    padding: 8px 4px;
    border-bottom: 0;
  }
  .ix.ix.is-side-off:not(.is-nothread) .ix-thread {
    border-right: 1px solid var(--ix-line);
  }
  .ix.ix.is-side-off:not(.is-nothread) {
    grid-template-columns: 220px 280px minmax(0, 1fr) 44px;
  }
  .ix.ix.is-rail-off.is-side-off:not(.is-nothread) {
    grid-template-columns: 0 280px minmax(0, 1fr) 44px;
  }
}

/* a laptop with the app's menu open: the side columns give the conversation more room */
@media (min-width: 768px) {
  .ix.ix.is-snug:not(.is-fold):not(.is-nothread):not(.is-side-off) {
    grid-template-columns: 196px 256px minmax(0, 1fr) 256px;
  }
  .ix.ix.is-snug:not(.is-fold):not(.is-side-off):not(.is-nothread) .ix-thread > .ix-th {
    margin-right: -257px;
  }
  .ix.ix.is-snug.is-rail-off:not(.is-fold):not(.is-nothread):not(.is-side-off) {
    grid-template-columns: 0 256px minmax(0, 1fr) 256px;
  }
  .ix.ix.is-snug:not(.is-fold):not(.is-nothread).is-side-off {
    grid-template-columns: 196px 268px minmax(0, 1fr) 44px;
  }
  .ix.ix.is-snug.is-rail-off:not(.is-fold):not(.is-nothread).is-side-off {
    grid-template-columns: 0 268px minmax(0, 1fr) 44px;
  }
  .ix.ix.is-fold.is-side-off:not(.is-nothread):not(.is-compact) {
    grid-template-columns: 0 250px minmax(0, 1fr) 44px;
  }
  .ix.ix.ix.is-squeeze.is-side-off:not(.is-compact):not(.is-nothread) {
    grid-template-columns: 0 210px minmax(0, 1fr) 44px !important;
  }
  .ix.ix.ix.is-squeeze2.is-side-off:not(.is-compact):not(.is-nothread) {
    grid-template-columns: 0 196px minmax(0, 1fr) 44px !important;
  }
}
/* the narrower left menu keeps both footer buttons inside it */
.ix.is-snug .ix-rail__btns {
  gap: 6px;
  padding-right: 8px;
  padding-left: 8px;
}
.ix.is-snug .ix-rail__btns .ix-pill {
  padding-right: 12px;
  padding-left: 12px;
}

/*
 * A narrow inbox (laptop with the app's menu open): the views menu, when shown, takes a column
 * of its own and the list moves over. Laid on top it hid every conversation (go-live QA).
 * Phones and the narrowest widths keep the overlay: there is no room for another column.
 */
@media (min-width: 768px) {
  .ix.ix.ix.is-fold.is-rail-peek:not(.is-compact) .ix-rail {
    position: static;
    grid-column: 1;
    width: auto;
    box-shadow: none;
  }
  .ix.ix.ix.is-fold.is-rail-peek:not(.is-compact) {
    grid-template-columns: 196px 226px minmax(0, 1fr) 44px !important;
  }
  .ix.ix.ix.is-fold.is-rail-peek:not(.is-compact):not(.is-side-off):not(.is-nothread) {
    grid-template-columns: 198px 196px minmax(0, 1fr) 216px !important;
  }
  .ix.ix.ix.is-fold.is-rail-peek:not(.is-compact):not(.is-side-off):not(.is-nothread)
    .ix-thread
    > .ix-th {
    margin-right: -217px;
  }
  .ix.ix.ix.is-fold.is-rail-peek.is-nothread:not(.is-compact) {
    grid-template-columns: 196px 226px minmax(0, 1fr) 0 !important;
  }
}
/* its "Hide sidebar" tip opens beside the button, not over "You're available" */
.ix .ix-rail__top .ix-tip[data-tip]:hover::after,
.ix .ix-rail__top .ix-tip[data-tip]:focus-visible::after {
  top: 50%;
  left: calc(100% + 6px);
  transform: translateY(-50%);
}
/* on short screens the views sit closer, so Spam and Trash stay in sight */
@media (max-height: 860px) {
  .ix .ix-views button {
    min-height: 31px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
}
.ix.ix.is-fold.is-rail-peek:not(.is-compact) .ix-list .ix-seg button {
  padding-right: 10px;
  padding-left: 10px;
}

/* the Owner picker lists teams after people: it grows with the screen so they are in sight */
.ix-pop--owner .ix-own {
  max-height: min(460px, calc(100vh - 220px));
}
.ix-pop.ix-pop--owner {
  max-height: calc(100vh - 16px);
}

/*
 * A dropdown with the design's own arrow never shows the browser's (or the form style's) arrow
 * as well, whatever the browser or the order the styles load in (go-live QA).
 */
.ix-select select,
.ib-select-wrap select,
.ib-select-wrap select.input {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
}

/*
 * A received email is laid out on its own: its nested tables are not measured again when the
 * page around it changes (opening New email, typing), and nothing in it can be drawn over the
 * CRM.
 */
.ix .ix-msg__body,
.ix .ix-quote {
  contain: content;
}

/* New email: dragged by its title bar */
@media (min-width: 768px) {
  .ix .ix-compose:not(.is-big) .ix-cx__h {
    cursor: move;
    touch-action: none;
    user-select: none;
  }
}

/*
 * Send sits at the bottom of the inbox, where messages normally appear: while a message box is
 * on screen they appear at the top, so they never cover it (go-live QA).
 */
body:has(.ix-comp, .ix-compose) .toast-region {
  top: 12px;
  bottom: auto;
}

/* New email: the attached files sit clear of the message box */
.ix-compose .ix-atts--draft {
  margin-top: 8px;
}
