
.support-launch {
  position: relative;
}

/* The button sits just above the footer section, not in it: the footer is hidden on phones, the menu sheet is not. */
.support-dock {
  margin-top: auto;
  padding: 0 8px 6px;
}

.support-dock ~ .sidebar-footer {
  margin-top: 0;
}

/* The red count of replies from support not read yet, at the right end of the button; on the collapsed rail, at the icon's corner. */
.support-launch .support-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  flex: none;
  place-items: center;
  margin-left: auto;
  border-radius: 999px;
  background: var(--sell, #ff4d5e);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  padding: 0 5px;
}

.support-launch .support-badge[hidden] {
  display: none;
}

.sidebar.collapsed .support-launch .support-badge {
  position: absolute;
  top: 3px;
  left: 24px;
  height: 16px;
  min-width: 16px;
  margin-left: 0;
  font-size: 10px;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--surface, #0d131b);
}

.support-chat {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 130;
  display: flex;
  width: min(380px, calc(100vw - 24px));
  height: min(600px, calc(100vh - 24px));
  height: min(600px, calc(100dvh - 24px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
  color: var(--text);
}

.support-chat[hidden] {
  display: none;
}

.support-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent, #14f195) 7%, var(--surface));
  padding: 12px 14px;
}

.support-chat-logo {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}

.support-chat-title {
  min-width: 0;
  flex: 1;
}

.support-chat-title strong {
  display: block;
  font-size: 14px;
}

.support-chat-title span {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
}

.support-chat-close {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.support-chat-close:hover,
.support-chat-close:focus-visible {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
  outline: none;
}

.support-chat-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.support-chat-messages {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
}

.support-chat-day {
  align-self: center;
  margin: 8px 0 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.support-chat-message {
  display: flex;
  max-width: 82%;
  flex-direction: column;
  gap: 2px;
}

.support-chat-message.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.support-chat-message.is-theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.support-chat-bubble {
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  padding: 8px 12px;
  white-space: pre-wrap;
}

.support-chat-message.is-mine .support-chat-bubble {
  border-bottom-right-radius: 5px;
  background: var(--accent, #14f195);
  color: #04130c;
}

.support-chat-message.is-theirs .support-chat-bubble {
  border-bottom-left-radius: 5px;
  background: var(--surface-raised, #151d28);
  color: var(--text);
}

.support-chat-message.is-pending .support-chat-bubble {
  opacity: 0.6;
}

.support-chat-message.is-failed .support-chat-bubble {
  background: color-mix(in srgb, var(--sell, #ff5d6c) 30%, var(--surface));
  color: var(--text);
}

.support-chat-time {
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 0 4px;
}

.support-chat-empty {
  margin: auto;
  max-width: 260px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.support-chat-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 15px;
}

.support-chat-empty button {
  display: block;
  margin: 14px auto 0;
  border: 1px solid color-mix(in srgb, var(--accent, #14f195) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #14f195) 14%, transparent);
  color: var(--accent, #14f195);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
}

.support-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.support-chat-composer[hidden] {
  display: none;
}

.support-chat-input {
  max-height: 110px;
  min-height: 38px;
  min-width: 0;
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised, #151d28);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  padding: 9px 14px;
}

.support-chat-input:focus {
  border-color: color-mix(in srgb, var(--accent, #14f195) 55%, transparent);
  outline: none;
}

.support-chat-send {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #14f195);
  color: #04130c;
  cursor: pointer;
  padding: 0;
}

.support-chat-send:disabled {
  cursor: default;
  opacity: 0.45;
}

.support-chat-send svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1022px) {
  .support-dock {
    padding: 0 10px 8px;
  }
}

@media (max-width: 640px) {
  .support-chat {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 88vh;
    height: 88dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }
}
