/* First-party customer chat and the Wax Om staff inbox. */

.wax-chat [hidden], .wax-chat[hidden], .wax-inbox [hidden] { display: none !important; }

.wax-chat, .wax-inbox {
  --support-wine: var(--wine, #401622);
  --support-paper: var(--canvas, #fff9f1);
  --support-ink: #312329;
  --support-border: #d9c3be;
  --support-blush: #f7e9e3;
  font-family: var(--sans, system-ui, sans-serif);
  color: var(--support-ink);
}

.wax-chat {
  position: fixed;
  inset: auto max(1.15rem, env(safe-area-inset-right)) max(1.15rem, env(safe-area-inset-bottom)) auto;
  z-index: 30;
}

.wax-chat__launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.95rem;
  gap: .65rem;
  padding: .65rem 1.05rem;
  border: 1px solid #6b3e47;
  border-radius: 99rem;
  background: var(--support-wine);
  color: #fff8f2;
  font: 650 .91rem/1.15 var(--sans, system-ui, sans-serif);
  box-shadow: 0 .4rem 1.15rem #3a14243b;
  cursor: pointer;
}

.wax-chat__launcher:hover { background: #642e3e; }
.wax-chat__bubble {
  display: inline-block;
  width: 1.05rem;
  height: .84rem;
  position: relative;
  border: .093rem solid currentColor;
  border-radius: .28rem;
}
.wax-chat__bubble::after {
  content: '';
  position: absolute;
  inset: auto auto -.22rem .19rem;
  width: .28rem;
  height: .28rem;
  border-left: .08rem solid currentColor;
  border-bottom: .08rem solid currentColor;
  background: inherit;
  transform: skewY(-43deg);
}

.wax-chat__panel {
  position: absolute;
  right: 0;
  bottom: 3.65rem;
  width: min(24rem, calc(100vw - 2.3rem));
  max-height: min(36rem, calc(100vh - 6rem));
  max-height: min(36rem, calc(100dvh - 6rem));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--support-border);
  border-radius: 1.12rem;
  background: var(--support-paper);
  box-shadow: 0 1.1rem 3rem #40162235;
}

.wax-chat__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.04rem 1.15rem;
  border-bottom: 1px solid #712d3a;
  background: linear-gradient(120deg, #4a1b2e, var(--support-wine) 64%, #61283d);
  color: #fff8f2;
}

.wax-chat__header h2 { margin: 0; font-size: 1.94rem; color: inherit; }
.wax-chat__close {
  display: grid;
  place-items: center;
  flex: 0 0 2.03rem;
  height: 2.03rem;
  border: 1px solid #ffffff78;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: 1.5rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.wax-chat__close:hover { background: #ffffff20; }

.wax-chat__body {
  min-height: min(10rem, 25vh);
  padding: .95rem 1rem;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}
.wax-chat__welcome { margin: .25rem .12rem .55rem; font-size: .97rem; }
.wax-chat__transcript { display: grid; gap: .65rem; min-width: 0; margin: 0; padding: 0; list-style: none; }
.wax-chat__message {
  max-width: min(94%, 34rem);
  justify-self: start;
  padding: .49rem .7rem;
  border: 1px solid #e9d9d2;
  border-radius: .66rem .66rem .66rem .12rem;
  background: #f8efe7;
  overflow-wrap: anywhere;
}
.wax-chat__message--customer {
  justify-self: end;
  border-radius: .66rem .66rem .12rem .66rem;
  border-color: #e3cbc9;
  background: #efd9da;
}
.wax-chat__message--staff { border-color: #cdb4aa; background: #f5e6dd; }
.wax-chat__speaker { display: block; color: var(--support-wine); font-size: .74rem; font-weight: 750; }
.wax-chat__copy { margin: .17rem 0; font-size: .92rem; line-height: 1.4; white-space: pre-wrap; }
.wax-chat__links { display: flex; flex-wrap: wrap; gap: .3rem .65rem; padding: .25rem 0 .1rem; list-style: none; }
.wax-chat__links a { font-size: .82rem; font-weight: 650; }
.wax-chat__status { margin: .53rem .12rem 0; font-size: .8rem; color: #694453; }
.wax-chat__status:empty { display: none; }

.wax-chat__footer { padding: .75rem 1rem .85rem; border-top: 1px solid #e5d5cc; background: #fffbf7; }
.wax-chat__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .54rem; }
.wax-chat__form textarea, .wax-inbox__login input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 2.65rem;
  padding: .49rem .6rem;
  border: 1px solid #cbb3ad;
  border-radius: .36rem;
  background: #fffdf9;
  color: var(--support-ink);
  font: .95rem/1.35 var(--sans, system-ui, sans-serif);
}
.wax-chat__form textarea { resize: vertical; max-height: 8rem; }
.wax-chat__form .button { min-height: 2.65rem; padding: .48rem .75rem; border-radius: .36rem; }
.wax-chat__form button:disabled { cursor: not-allowed; opacity: .62; }
.wax-chat__footer-links { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem .7rem; padding-top: .24rem; }
.wax-chat__footer-links a { padding-block: .29rem; font-size: .81rem; }
.wax-chat__text-button {
  display: inline-block;
  padding: .33rem .05rem;
  border: 0;
  background: transparent;
  color: var(--support-wine);
  font: 650 .84rem/1.2 var(--sans, system-ui, sans-serif);
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}
.wax-chat__text-button:disabled { text-decoration: none; cursor: default; opacity: .68; }
.wax-chat__privacy { margin: .14rem 0 0; color: #765964; font-size: .74rem; line-height: 1.35; }
.wax-chat__sr {
  overflow: hidden;
  clip-path: inset(50%);
  position: absolute;
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

.wax-inbox { padding-top: clamp(1.7rem, 4vw, 3.4rem); padding-bottom: 4rem; }
.wax-inbox__header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1.5rem; }
.wax-inbox h1 { margin: 0; color: var(--support-wine); font-size: clamp(2.75rem, 6vw, 4.6rem); }
.wax-inbox h2 { margin: 0; color: var(--support-wine); font-size: clamp(1.5rem, 3vw, 1.88rem); }
.wax-inbox__status { min-height: 1.38rem; max-width: 46rem; color: #704553; margin: .65rem 0 1.1rem; }
.wax-inbox__login, .wax-inbox__queue, .wax-inbox__conversation { padding: 1.05rem 1.18rem; border: 1px solid var(--support-border); background: #fffaf6; }
.wax-inbox__login { display: grid; gap: .67rem; max-width: 28rem; }
.wax-inbox__login label { font-weight: 700; }
.wax-inbox__login button { justify-self: start; min-height: 2.6rem; }
.wax-inbox__workspace { display: grid; grid-template-columns: minmax(15rem, .74fr) minmax(0, 1.55fr); gap: 1.22rem; align-items: start; }
.wax-inbox__queue-header, .wax-inbox__thread-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem .85rem; }
.wax-inbox__filters { display: flex; gap: .36rem; margin: .68rem 0; flex-wrap: wrap; }
.wax-inbox__filters button {
  padding: .28rem .6rem;
  border: 1px solid #cbb3ad;
  border-radius: 99rem;
  background: #fffaf6;
  color: var(--support-wine);
  font: 650 .82rem/1.25 var(--sans, system-ui, sans-serif);
  cursor: pointer;
}
.wax-inbox__filters button[aria-pressed="true"] { background: var(--support-wine); color: #fff8f2; border-color: var(--support-wine); }
.wax-inbox__threads { display: grid; gap: .44rem; max-height: 32rem; margin: 0; padding: .15rem; list-style: none; overflow: auto; }
.wax-inbox__thread {
  display: grid;
  gap: .18rem;
  width: 100%;
  padding: .56rem .62rem;
  border: 1px solid #e3cfca;
  border-radius: .25rem;
  background: #fffdf9;
  color: var(--support-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.wax-inbox__thread:hover, .wax-inbox__thread[aria-current="true"] { border-color: #986577; background: var(--support-blush); }
.wax-inbox__thread-label { display: flex; gap: .3rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.wax-inbox__badge { border-radius: 99rem; padding: .17rem .4rem; color: #553b43; background: #eee2db; font-size: .7rem; font-weight: 700; }
.wax-inbox__badge[data-state="waiting"] { color: #651c37; background: #f1d5db; }
.wax-inbox__excerpt { font-size: .85rem; overflow-wrap: anywhere; }
.wax-inbox__date, .wax-inbox__empty { color: #6f555d; font-size: .79rem; }
.wax-inbox__empty { margin: .6rem 0; font-size: .92rem; }
.wax-inbox__thread-header p { margin: 0 0 .2rem; color: #785260; font-size: .79rem; font-weight: 650; }
.wax-inbox__conversation .wax-chat__transcript { max-height: 31rem; overflow: auto; margin: .75rem 0; padding: .38rem .1rem; }
.wax-inbox__reply { padding-top: .7rem; border-top: 1px solid #e3cfca; }
.wax-inbox__back { display: none; }
#wax-inbox-queue, #wax-inbox-current { scroll-margin-top: 1rem; }

.wax-staff__status { color: #704553; }
.wax-staff__status:empty { margin: 0; }
.wax-staff__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}
.wax-staff__card {
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: 1.2rem;
  border: 1px solid var(--support-border);
  background: #fffaf6;
}
.wax-staff__card a { margin-top: auto; font-weight: 680; }
.wax-staff__badge {
  margin-block: .55rem 0;
  padding: .19rem .52rem;
  border-radius: 99rem;
  background: var(--support-blush);
  color: var(--support-wine);
  font-size: .8rem;
  font-weight: 700;
}
.wax-staff__tools { margin-top: 1.7rem; display: grid; gap: .65rem; }
.wax-staff__panel { padding: .8rem 1rem; border: 1px solid var(--support-border); }
.wax-staff__panel summary { cursor: pointer; font-weight: 700; }
.wax-staff__panel form { margin-top: .7rem; }
.wax-staff__people { list-style: none; display: grid; gap: .55rem; margin: .75rem 0 0; padding: 0; }
.wax-staff__person { display: grid; gap: .35rem; border-top: 1px solid var(--support-border); padding: .65rem 0; }
.wax-staff__person-summary { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.wax-staff__person-summary + button { justify-self: start; }

@media (max-width: 760px) {
  .wax-inbox__workspace { grid-template-columns: 1fr; }
  .wax-inbox__threads { max-height: 15rem; }
  .wax-inbox__back { display: inline-flex; align-items: center; min-height: 2.75rem; }
}

@media (max-width: 460px) {
  .wax-chat { right: max(.7rem, env(safe-area-inset-right)); bottom: max(.7rem, env(safe-area-inset-bottom)); }
  .wax-chat__panel { width: calc(100vw - max(.7rem, env(safe-area-inset-right)) - max(.7rem, env(safe-area-inset-left))); }
  .wax-chat__form textarea, .wax-inbox__login input { font-size: 1rem; }
  .wax-inbox__reply { grid-template-columns: 1fr; }
}
