/* The page's own chat box (chat.js). Nothing here comes from Heilo's widget. */

.hc {
  --hc-accent: #2f6fed;
  --hc-accent-deep: #1f55c4;
  --hc-accent-soft: #e8efff;
  --hc-bg: #f7f8fb;
  --hc-paper: #ffffff;
  --hc-ink: #161b26;
  --hc-muted: #667085;
  --hc-line: #e4e7ef;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--hc-ink);
}

.hc svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hc button {
  font: inherit;
}

.hc [hidden] {
  display: none !important;
}

/* launcher */

.hc-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-left: auto;
  border: 0;
  border-radius: 20px;
  background: var(--hc-accent);
  color: #fff;
  box-shadow: 0 10px 24px rgb(31 85 196 / 0.28);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

.hc-launcher:hover {
  background: var(--hc-accent-deep);
  transform: translateY(-2px);
}

.hc-launcher:focus-visible {
  outline: 3px solid rgb(47 111 237 / 0.4);
  outline-offset: 3px;
}

.hc-launcher svg {
  width: 28px;
  height: 28px;
}

.hc-launcher-icon svg {
  fill: #fff;
  stroke: none;
}

.hc-launcher-icon,
.hc-launcher-close {
  grid-area: 1 / 1;
  display: grid;
  transition: transform 0.2s, opacity 0.2s;
}

.hc-launcher-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.hc[data-open='true'] .hc-launcher-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.hc[data-open='true'] .hc-launcher-close {
  opacity: 1;
  transform: none;
}

.hc-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  box-shadow: 0 0 0 3px var(--hc-paper);
}

/* panel */

.hc-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: min(620px, 100vh - 120px);
  border-radius: 22px;
  background: var(--hc-bg);
  box-shadow: 0 20px 50px rgb(22 27 38 / 0.18), 0 0 0 1px rgb(22 27 38 / 0.04);
  overflow: hidden;
  transform-origin: bottom right;
  animation: hc-in 0.18s ease-out;
}

.hc-panel[hidden] {
  display: none;
}

@keyframes hc-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.hc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px 16px 18px;
  background: var(--hc-paper);
  box-shadow: 0 1px 0 var(--hc-line);
}

.hc-team {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hc-avatars {
  display: flex;
  flex: none;
}

.hc-avatars > * {
  width: 38px;
  height: 38px;
  margin-left: -10px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--hc-paper);
}

.hc-avatars > :first-child {
  margin-left: 0;
}

.hc-avatars span {
  display: grid;
  place-items: center;
  background: var(--hc-accent-soft);
  color: var(--hc-accent-deep);
  font-size: 13px;
  font-weight: 700;
}

.hc-who {
  min-width: 0;
}

.hc-title {
  margin: 0;
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hc-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  color: var(--hc-muted);
  font-size: 13px;
}

.hc-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4c9d4;
}

.hc-sub[data-online='true'] .hc-dot {
  background: #1f9d63;
}

.hc-icon-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--hc-muted);
  cursor: pointer;
}

.hc-icon-btn:hover {
  background: var(--hc-bg);
  color: var(--hc-ink);
}

.hc-banner {
  margin: 0;
  padding: 8px 16px;
  background: #fdf3dc;
  color: #8a5a12;
  font-size: 13px;
  text-align: center;
}

.hc-banner[hidden] {
  display: none;
}

/* messages */

.hc-body {
  flex: 1;
  padding: 16px 14px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hc-more {
  display: block;
  margin: 0 auto 12px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--hc-paper);
  color: var(--hc-muted);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.hc-msg.hc-first {
  margin-top: 10px;
}

.hc-list > :first-child {
  margin-top: 0;
}

.hc-mine {
  justify-content: flex-end;
}

.hc-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 78%;
}

.hc-mine .hc-stack {
  align-items: flex-end;
}

.hc-name {
  margin-left: 4px;
  color: var(--hc-muted);
  font-size: 12px;
}

.hc-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hc-accent-soft);
  color: var(--hc-accent-deep);
  font-size: 11px;
  font-weight: 700;
  object-fit: cover;
}

.hc-av-space {
  visibility: hidden;
}

.hc-bubble {
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hc-theirs .hc-bubble {
  background: var(--hc-paper);
  box-shadow: 0 0 0 1px var(--hc-line);
  border-bottom-left-radius: 6px;
}

.hc-mine .hc-bubble {
  background: var(--hc-accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.hc-bubble a {
  color: inherit;
  text-decoration: underline;
}

.hc-pending .hc-bubble,
.hc-pending .hc-atts {
  opacity: 0.6;
}

.hc-failed .hc-bubble {
  background: #fde8e7;
  color: #8f2d29;
}

.hc-time {
  margin: 0 4px;
  color: var(--hc-muted);
  font-size: 11px;
}

.hc-retry {
  padding: 0;
  border: 0;
  background: none;
  color: var(--hc-accent-deep);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.hc-system {
  margin: 10px auto 2px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--hc-paper);
  color: var(--hc-muted);
  font-size: 12px;
  text-align: center;
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-atts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hc-img img {
  display: block;
  max-width: 220px;
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--hc-paper);
  color: var(--hc-ink);
  text-decoration: none;
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-file span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hc-file b {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hc-file small {
  color: var(--hc-muted);
  font-size: 11px;
}

/* typing */

.hc-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 36px;
  color: var(--hc-muted);
  font-size: 12px;
}

.hc-typing[hidden] {
  display: none;
}

.hc-dots {
  display: inline-flex;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--hc-paper);
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa3b5;
  animation: hc-dot 1.2s infinite;
}

.hc-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.hc-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes hc-dot {
  30% {
    transform: translateY(-3px);
    background: var(--hc-accent);
  }
}

/* quick replies, cards */

.hc-quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.hc-quick:empty {
  display: none;
}

.hc-quick button {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--hc-paper);
  color: var(--hc-accent-deep);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #c6d5fb;
}

.hc-quick button:hover {
  background: var(--hc-accent-soft);
}

.hc-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 14px;
  border-radius: 16px;
  background: var(--hc-paper);
  box-shadow: 0 0 0 1px var(--hc-line);
}

.hc-card[hidden],
.hc-comment[hidden] {
  display: none;
}

.hc-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.hc-card-text {
  margin: 0;
  color: var(--hc-muted);
  font-size: 13px;
}

.hc-card input,
.hc-card textarea {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--hc-bg);
  color: var(--hc-ink);
  font: inherit;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--hc-line);
  resize: none;
}

.hc-card input:focus,
.hc-card textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--hc-accent);
}

.hc-comment {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hc-btn {
  align-self: flex-start;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--hc-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.hc-btn:disabled {
  opacity: 0.6;
}

.hc-thumbs {
  display: flex;
  gap: 8px;
}

.hc-thumbs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--hc-bg);
  color: var(--hc-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--hc-line);
}

.hc-thumbs .hc-down svg {
  transform: scaleY(-1);
}

.hc-thumbs button[aria-pressed='true'] {
  background: var(--hc-accent-soft);
  color: var(--hc-accent-deep);
  box-shadow: inset 0 0 0 2px var(--hc-accent);
}

/* composer */

.hc-composer {
  padding: 10px 12px 12px;
  background: var(--hc-paper);
  box-shadow: 0 -1px 0 var(--hc-line);
}

.hc-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.hc-files[hidden] {
  display: none;
}

.hc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--hc-bg);
  font-size: 12px;
  box-shadow: inset 0 0 0 1px var(--hc-line);
}

.hc-chip svg {
  width: 14px;
  height: 14px;
}

.hc-chip > span {
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hc-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hc-muted);
  cursor: pointer;
}

.hc-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.hc-row textarea {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  padding: 9px 12px;
  border: 0;
  border-radius: 14px;
  background: var(--hc-bg);
  color: var(--hc-ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  box-shadow: inset 0 0 0 1px var(--hc-line);
}

.hc-row textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--hc-accent);
}

.hc-attach {
  height: 40px;
}

.hc-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: var(--hc-accent);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}

.hc-send:hover {
  background: var(--hc-accent-deep);
}

.hc-send:disabled {
  opacity: 0.4;
  cursor: default;
}

/* phones: the panel takes the screen */

@media (max-width: 519px) {
  .hc {
    right: 16px;
    bottom: 16px;
  }

  .hc-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
  }

  .hc[data-open='true'] .hc-launcher {
    display: none;
  }

  .hc-row textarea {
    font-size: 16px; /* no zoom on focus in iOS Safari */
  }
}

@media (prefers-reduced-motion: reduce) {
  .hc-panel,
  .hc-dots i {
    animation: none;
  }
}
