.dh-chat {
  --dh-chat-orange: #ea580c;
  --dh-chat-orange-dark: #c2410c;
  --dh-chat-ink: #0f172a;
  --dh-chat-muted: #475569;
  --dh-chat-line: #e2e8f0;
  --dh-chat-soft: #f8fafc;
  --dh-chat-white: #fff;
  --dh-chat-r-sm: 8px;
  --dh-chat-r-md: 12px;
  --dh-chat-r-lg: 16px;
  --dh-chat-font: Manrope, ui-sans-serif, system-ui, sans-serif;
  position: fixed;
  inset: auto 20px 20px auto;
  z-index: 99990;
  font-family: var(--dh-chat-font);
  color: var(--dh-chat-ink);
}

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

.dh-chat.is-open .dh-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dh-chat.is-open .dh-chat__launcher {
  transform: scale(0.92);
}

.dh-chat__launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border: 0;
  border-radius: var(--dh-chat-r-lg);
  background: var(--dh-chat-orange);
  color: var(--dh-chat-white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(234, 88, 12, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}

.dh-chat__launcher:hover {
  background: var(--dh-chat-orange-dark);
}

.dh-chat__launcher-label {
  font-size: 0.95rem;
}

.dh-chat__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--dh-chat-white);
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-lg);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dh-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--dh-chat-soft);
  border-bottom: 1px solid var(--dh-chat-line);
}

.dh-chat__kicker {
  margin: 0 0 2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dh-chat-orange);
}

.dh-chat__title {
  margin: 0;
  font-size: 1.1rem;
}

.dh-chat__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--dh-chat-r-sm);
  background: transparent;
  color: var(--dh-chat-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.dh-chat__messages {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--dh-chat-white);
}

.dh-chat__msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--dh-chat-r-md);
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}

.dh-chat__msg--user {
  align-self: flex-end;
  background: var(--dh-chat-orange);
  color: var(--dh-chat-white);
}

.dh-chat__msg--assistant,
.dh-chat__msg--agent {
  align-self: flex-start;
  background: var(--dh-chat-soft);
  border: 1px solid var(--dh-chat-line);
}

.dh-chat__msg--system {
  align-self: center;
  max-width: 100%;
  background: transparent;
  color: var(--dh-chat-muted);
  font-size: 0.85rem;
  text-align: center;
}

.dh-chat__msg--typing {
  opacity: 0.7;
}

.dh-chat__products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.dh-chat__product {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-sm);
  background: var(--dh-chat-white);
  text-decoration: none;
  color: inherit;
}

.dh-chat__product img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--dh-chat-r-sm);
}

.dh-chat__product strong {
  display: block;
  font-size: 0.85rem;
}

.dh-chat__product span {
  font-size: 0.8rem;
  color: var(--dh-chat-muted);
}

.dh-chat__footer {
  border-top: 1px solid var(--dh-chat-line);
  background: var(--dh-chat-soft);
  padding: 12px;
}

.dh-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.dh-chat__composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-sm);
  font: inherit;
}

.dh-chat__send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--dh-chat-r-sm);
  background: var(--dh-chat-orange);
  color: var(--dh-chat-white);
  cursor: pointer;
}

.dh-chat__live-link {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dh-chat-orange);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.dh-chat__footer-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.dh-chat__footer-links .dh-chat__live-link {
  width: auto;
  margin-top: 0;
}

.dh-chat__track-form {
  padding: 12px 16px;
  border-top: 1px solid var(--dh-chat-line);
  background: var(--dh-chat-white);
}

.dh-chat__track-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dh-chat__track-form-head p {
  margin: 0;
}

.dh-chat__track-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--dh-chat-r-sm);
  background: transparent;
  color: var(--dh-chat-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dh-chat__track-hint {
  margin: 6px 0 10px;
  font-size: 0.85rem;
  color: var(--dh-chat-muted);
}

.dh-chat__track-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.dh-chat__track-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-sm);
  font: inherit;
}

.dh-chat__track-error {
  margin: 0 0 10px;
  color: #b91c1c;
  font-size: 0.85rem;
}

.dh-chat__shipments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.dh-chat__shipment {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-sm);
  background: var(--dh-chat-white);
  text-decoration: none;
  color: inherit;
  font-size: 0.85rem;
}

.dh-chat__shipment strong {
  display: block;
}

.dh-chat__shipment span {
  color: var(--dh-chat-muted);
}

.dh-chat__live-form {
  padding: 12px 16px;
  border-top: 1px solid var(--dh-chat-line);
  background: var(--dh-chat-white);
}

.dh-chat__live-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.dh-chat__live-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--dh-chat-line);
  border-radius: var(--dh-chat-r-sm);
  font: inherit;
}

.dh-chat__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--dh-chat-r-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dh-chat__btn-primary {
  background: var(--dh-chat-orange);
  color: var(--dh-chat-white);
  width: 100%;
}

@media (max-width: 640px) {
  .dh-chat {
    inset: auto 12px 12px auto;
  }

  .dh-chat__panel {
    width: calc(100vw - 24px);
    height: min(72vh, 560px);
  }

  .dh-chat__launcher-label {
    display: none;
  }
}
