:root {
  --support-bg: #07131d;
  --support-panel: #111b22;
  --support-panel-2: #17232b;
  --support-panel-3: #1d2d34;
  --support-card: rgba(17, 27, 34, 0.9);
  --support-border: rgba(140, 160, 190, 0.18);
  --support-violet: #7d5cf0;
  --support-violet-2: #5d41d2;
  --support-green: #1d634f;
  --support-green-soft: #d9fdd3;
  --support-text: #edf3ff;
  --support-text-soft: rgba(199, 216, 227, 0.78);
  --support-danger: #ef4565;
  --support-success: #31d17c;
  --support-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.support-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ed101c, #c93221);
  color: #fff;
  box-shadow: 0 14px 32px rgba(237, 16, 28, 0.24);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-launcher:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, #ff1e2b, #ed101c);
  box-shadow: 0 18px 38px rgba(237, 16, 28, 0.34);
}

.support-launcher-icon {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
}

.support-live-dot {
  position: absolute;
  right: -3px;
  top: -3px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--support-violet-2);
  border-radius: 50%;
  background: var(--support-success);
}

.support-launcher small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 600;
}

.support-direct-modal {
  --support-blue: var(--support-violet);
}

.support-direct-dialog {
  width: min(92vw, 1180px);
  max-height: min(82vh, 820px);
  min-height: min(62vh, 620px);
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--support-border);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(10, 17, 24, 0.96), rgba(7, 19, 29, 0.96));
  color: var(--support-text);
  box-shadow: 0 36px 130px rgba(0, 0, 0, 0.6);
  animation: support-dialog-in 0.24s ease both;
}

.support-direct-modal.active {
  display: grid;
  place-items: center;
}

.support-direct-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 40px 24px;
  background: linear-gradient(135deg, rgba(125, 92, 240, 0.18), rgba(29, 99, 79, 0.18));
  border-bottom: 1px solid var(--support-border);
}

.support-direct-head h2 {
  margin: 3px 0 0;
  font-size: 1.35rem;
}

.support-direct-kicker {
  color: rgba(212, 203, 255, 0.82);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-direct-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.support-direct-body {
  padding: 32px 40px 40px;
  overflow: auto;
  max-height: calc(82vh - 118px);
}

.support-bot-view {
  display: grid;
  gap: 18px;
  max-width: 680px;
  margin: 0 auto;
}

.support-bot-view[hidden] {
  display: none !important;
}

.support-bot-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--support-border);
}

.support-bot-avatar {
  display: inline-flex;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #ed101c;
  color: #ffffff;
}

.support-bot-header strong,
.support-bot-header small {
  display: block;
  margin: 0;
}

.support-bot-header small {
  margin-top: 3px;
  color: var(--support-text-soft);
  font-size: 0.75rem;
}

.support-bot-thread {
  display: grid;
  min-height: 92px;
  padding: 4px 2px;
  align-content: end;
}

.support-bot-bubble {
  width: fit-content;
  max-width: min(92%, 520px);
  padding: 13px 15px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(48, 60, 74, 0.92);
  color: var(--support-text);
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.support-bot-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.support-bot-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--support-border);
  border-radius: 14px;
  background: transparent;
  color: var(--support-text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.support-bot-option:hover,
.support-bot-option:focus-visible {
  border-color: rgba(237, 16, 28, 0.55);
  background: rgba(237, 16, 28, 0.12);
  outline: none;
}

.support-bot-option i {
  width: 20px;
  color: #ff5962;
  text-align: center;
}

.support-bot-agent-btn {
  width: 100%;
}

.support-direct-form {
  display: grid;
  gap: 20px;
}

.support-direct-form label {
  display: grid;
  gap: 7px;
  color: #c4d0db;
  font-size: 0.82rem;
  font-weight: 700;
}

.support-direct-form input,
.support-direct-form select,
.support-direct-form textarea,
.support-chat-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(140, 160, 190, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(20, 31, 40, 0.9);
  color: var(--support-text);
  font: inherit;
  outline: none;
}

.support-direct-form input:focus,
.support-direct-form select:focus,
.support-direct-form textarea:focus,
.support-chat-input:focus {
  border-color: var(--support-violet);
  box-shadow: 0 0 0 3px rgba(125, 92, 240, 0.14);
}

.support-direct-form textarea {
  min-height: 130px;
  resize: vertical;
}

.support-direct-status-message {
  margin: 0;
  color: #8ee5b4;
  font-size: 0.78rem;
}

.support-direct-status-message[data-error="true"] {
  color: #ff9d9d;
}

.support-direct-primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-width: 220px;
  max-width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #ed101c, #c93221);
  color: #ffffff;
  font: inherit;
  font-size: 0.96rem;
  font-weight: 900;
  cursor: pointer;
  margin-inline: auto;
}

@media (max-width: 620px) {
  .support-launcher,
  .home-support-enabled .support-launcher {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    right: 12px;
    bottom: 12px;
    min-height: 46px;
    padding: 0 13px;
    border-radius: 14px;
  }

  .support-launcher-copy {
    display: none;
  }

  .support-launcher-icon {
    width: 26px;
    height: 26px;
  }

  .support-direct-body {
    padding: 18px 12px 24px;
  }

  .support-chat-messages {
    min-height: 280px;
    max-height: 52vh;
  }

  .support-chat-composer {
    grid-template-columns: 38px 38px minmax(0, 1fr) 42px;
    gap: 5px;
  }

  .support-emoji-picker {
    grid-template-columns: repeat(5, 34px);
    left: 4px;
  }

  .support-emoji-option {
    width: 34px;
    height: 34px;
  }
}

.support-direct-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.support-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 14px;
  color: var(--support-text-soft);
  font-size: 0.78rem;
}

.support-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8ee5b4;
}

.support-chat-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #31d17c;
}

.support-resolve-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}

.support-chat-messages {
  display: grid;
  gap: 12px;
  align-content: start;
  align-items: start;
  min-height: 220px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 18px 14px 22px;
  background: #0b1720;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--support-border);
  border-radius: 18px 18px 10px 10px;
}

.support-chat-message {
  max-width: min(82%, 620px);
  padding: 10px 13px 8px;
  border-radius: 18px 18px 18px 5px;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.support-chat-message p {
  margin: 0;
  white-space: pre-wrap;
}

.support-chat-attachment {
  display: block;
  margin-top: 8px;
  color: #b7d9ff;
  font-size: 0.78rem;
  text-decoration: underline;
}

.support-chat-attachment img {
  display: block;
  width: min(260px, 100%);
  max-height: 220px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(16, 24, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.support-chat-message.is-client {
  justify-self: end;
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, #32d866, #16b94b);
  color: #ffffff;
}

.support-chat-message.is-agent {
  justify-self: start;
  border-bottom-left-radius: 4px;
  background: rgba(48, 60, 74, 0.92);
  color: #edf6ff;
}

.support-chat-message.is-system {
  justify-self: center;
  max-width: 100%;
  color: #c7d0db;
  font-size: 0.76rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}

.support-chat-composer {
  position: relative;
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  padding: 12px 10px 10px;
  margin-top: 0;
  border: 1px solid var(--support-border);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #101e28;
}

.support-chat-composer .support-direct-primary {
  min-height: 46px;
}

.support-chat-tool {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(140, 160, 190, 0.22);
  border-radius: 50%;
  background: transparent;
  color: var(--support-text);
  font-size: 1.15rem;
  cursor: pointer;
}

.support-chat-tool:hover,
.support-chat-tool:focus-visible {
  background: rgba(125, 92, 240, 0.16);
  outline: none;
}

.support-chat-composer .support-chat-input {
  height: 42px;
  padding: 10px 14px;
  border-radius: 22px;
  background: #1b2b36;
  border-color: rgba(140, 160, 190, 0.16);
}

.support-chat-composer > .support-direct-primary {
  min-width: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.support-emoji-picker {
  position: absolute;
  z-index: 8;
  left: 8px;
  bottom: 62px;
  display: grid;
  grid-template-columns: repeat(5, 38px);
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(140, 160, 190, 0.28);
  border-radius: 16px;
  background: #182631;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
  animation: support-picker-in 0.16s ease both;
}

.support-emoji-picker[hidden] {
  display: none;
}

.support-emoji-option {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
}

.support-emoji-option:hover,
.support-emoji-option:focus-visible {
  background: rgba(125, 92, 240, 0.22);
  outline: none;
}

@keyframes support-picker-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.support-attachment-preview {
  grid-column: 1 / -1;
  color: #8ee5b4;
  font-size: 0.74rem;
}

.support-chat-composer.is-drop-target {
  border-color: var(--support-violet);
  background: rgba(125, 92, 240, 0.06);
}

.support-typing {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--support-text-soft);
  font-size: 0.76rem;
}

.support-history {
  margin-top: 18px;
}

.support-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.support-history-table th,
.support-history-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border, #263746);
  text-align: left;
}

.support-history-table th {
  color: var(--text-soft, #9eafbd);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.support-history-table td:last-child {
  text-align: right;
}

.support-history-view {
  border: 1px solid rgba(125, 92, 240, 0.9);
  border-radius: 8px;
  padding: 7px 10px;
  background: transparent;
  color: #b9a8ff;
  cursor: pointer;
}

body[data-theme="light"] .support-direct-dialog {
  --support-border: rgba(76, 103, 155, 0.18);
  --support-text: #17233a;
  --support-text-soft: #667792;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
  color: #17233a;
  border-color: rgba(76, 103, 155, 0.18);
  box-shadow: 0 30px 90px rgba(50, 77, 119, 0.2);
}

body[data-theme="light"] .support-direct-head {
  background: linear-gradient(135deg, rgba(125, 92, 240, 0.1), rgba(37, 211, 102, 0.08));
  border-bottom-color: rgba(76, 103, 155, 0.16);
}

body[data-theme="light"] .support-direct-kicker {
  color: #6650c9;
}

body[data-theme="light"] .support-direct-close {
  color: #253653;
}

body[data-theme="light"] .support-bot-header {
  border-bottom-color: rgba(76, 103, 155, 0.16);
}

body[data-theme="light"] .support-bot-header small,
body[data-theme="light"] .support-typing,
body[data-theme="light"] .support-chat-meta,
body[data-theme="light"] .support-history-table th {
  color: #71819a;
}

body[data-theme="light"] .support-bot-bubble {
  background: #e4ebf5;
  color: #26364d;
  box-shadow: 0 4px 14px rgba(53, 79, 120, 0.08);
}

body[data-theme="light"] .support-bot-option {
  border-color: rgba(76, 103, 155, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: #26364d;
}

body[data-theme="light"] .support-bot-option:hover,
body[data-theme="light"] .support-bot-option:focus-visible {
  background: rgba(237, 16, 28, 0.08);
  border-color: rgba(237, 16, 28, 0.48);
}

body[data-theme="light"] .support-direct-form label {
  color: #42536d;
}

body[data-theme="light"] .support-direct-form input,
body[data-theme="light"] .support-direct-form select,
body[data-theme="light"] .support-direct-form textarea,
body[data-theme="light"] .support-chat-input {
  border-color: rgba(76, 103, 155, 0.22);
  background: #ffffff;
  color: #17233a;
}

body[data-theme="light"] .support-chat-messages {
  background: #edf3fa;
  background-image: radial-gradient(rgba(76, 103, 155, 0.12) 1px, transparent 1px);
  border-color: rgba(76, 103, 155, 0.16);
}

body[data-theme="light"] .support-chat-message.is-agent {
  background: #e0e9f4;
  color: #26364d;
}

body[data-theme="light"] .support-chat-message.is-system {
  background: rgba(76, 103, 155, 0.08);
  color: #667792;
}

body[data-theme="light"] .support-chat-composer {
  background: #f7faff;
  border-color: rgba(76, 103, 155, 0.16);
}

body[data-theme="light"] .support-chat-tool,
body[data-theme="light"] .support-resolve-btn {
  border-color: rgba(76, 103, 155, 0.2);
  color: #344967;
}

body[data-theme="light"] .support-chat-composer .support-chat-input {
  background: #ffffff;
  border-color: rgba(76, 103, 155, 0.18);
}

body[data-theme="light"] .support-emoji-picker {
  border-color: rgba(76, 103, 155, 0.2);
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(50, 77, 119, 0.18);
}

body[data-theme="light"] .support-history-table th,
body[data-theme="light"] .support-history-table td {
  border-bottom-color: rgba(76, 103, 155, 0.14);
}

@keyframes support-dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 620px) {
  .support-launcher,
  .home-support-enabled .support-launcher {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .support-launcher-copy {
    display: none;
  }

  .support-direct-dialog {
    width: min(100% - 20px, 420px);
    min-height: auto;
    max-height: min(84vh, 760px);
  }

  .support-direct-head {
    padding: 18px;
  }

  .support-direct-body {
    padding: 16px 14px 18px;
  }

  .support-bot-options {
    grid-template-columns: 1fr;
  }

  .support-bot-header {
    padding: 14px;
  }

  .support-bot-thread {
    min-height: 76px;
  }

  .support-direct-form {
    gap: 12px;
  }

  .support-direct-form textarea {
    min-height: 88px;
  }

  .support-direct-primary {
    width: 100%;
    min-height: 48px;
  }

  .support-chat-meta {
    padding: 8px 8px 12px;
  }

  .support-chat-messages {
    min-height: 190px;
    max-height: 290px;
    padding: 8px;
  }

  .support-chat-composer {
    grid-template-columns: 38px 38px minmax(0, 1fr) 42px;
    gap: 5px;
  }

  .support-emoji-picker {
    grid-template-columns: repeat(5, 34px);
    left: 4px;
  }

  .support-emoji-option {
    width: 34px;
    height: 34px;
  }

  .support-history-table th:nth-child(2),
  .support-history-table td:nth-child(2) {
    display: none;
  }

  .support-chat-message {
    max-width: 88%;
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

body[data-theme="light"] .support-direct-dialog {
  background: #f7fbff;
  color: #12202c;
}

body[data-theme="light"] .support-direct-form label {
  color: #405467;
}

body[data-theme="light"] .support-direct-form input,
body[data-theme="light"] .support-direct-form select,
body[data-theme="light"] .support-direct-form textarea,
body[data-theme="light"] .support-chat-input {
  background: #fff;
  color: #12202c;
  border-color: #c7d8e6;
}

body[data-theme="light"] .support-chat-message.is-agent {
  background: #e2edf5;
  color: #12202c;
}

body[data-theme="light"] .support-chat-composer {
  border-color: #d6e2eb;
}

