.mkt-chat-root {
  --mkt-primary: #2563eb;
  --mkt-bg: #0f172a;
  --mkt-surface: #0b1220;
  --mkt-text: #f1f5f9;
  --mkt-muted: #94a3b8;
  --mkt-border: #334155;
  --mkt-inbound: #1e293b;
  --mkt-system: #172554;
  --mkt-field-bg: #111827;
  --mkt-hover: rgba(255, 255, 255, 0.06);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--mkt-text);
}

.mkt-chat-toggle {
  position: relative;
  z-index: 3;
  border: none;
  background: var(--mkt-primary);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, width 0.15s ease, height 0.15s ease,
    border-radius 0.15s ease, padding 0.15s ease;
  height: 44px;
  min-width: 44px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  gap: 8px;
}

.mkt-chat-root[data-open="true"] .mkt-chat-toggle {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
}

.mkt-chat-toggle:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
}

.mkt-chat-toggle-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s ease;
}

.mkt-chat-root[data-open="true"] .mkt-chat-toggle-inner {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.mkt-chat-toggle-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.mkt-chat-toggle-icon--close {
  position: absolute;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.mkt-chat-root[data-open="true"] .mkt-chat-toggle-icon--close {
  opacity: 1;
}

.mkt-chat-panel {
  position: absolute;
  right: 0;
  bottom: 60px;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: min(520px, calc(100vh - 100px));
  background: var(--mkt-bg);
  border: 1px solid var(--mkt-border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mkt-chat-root[data-open="true"] .mkt-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mkt-chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--mkt-border);
  background: var(--mkt-bg);
  flex-shrink: 0;
}

.mkt-chat-header-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--mkt-text);
}

.mkt-chat-header-close,
.mkt-chat-back {
  border: none;
  background: transparent;
  color: var(--mkt-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mkt-chat-header-close:hover,
.mkt-chat-back:hover {
  background: var(--mkt-hover);
  color: var(--mkt-text);
}

.mkt-chat-back {
  visibility: hidden;
}

.mkt-chat-intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 20px 24px;
  background: var(--mkt-surface);
  overflow-y: auto;
}

.mkt-chat-root[data-profile="complete"] .mkt-chat-intro {
  display: none;
}

.mkt-chat-body {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  background: var(--mkt-surface);
}

.mkt-chat-root[data-profile="complete"] .mkt-chat-body {
  display: flex;
}

.mkt-chat-intro-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--mkt-text);
}

.mkt-chat-intro-subtitle {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--mkt-muted);
}

.mkt-chat-intro-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mkt-chat-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mkt-chat-field-label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.mkt-chat-field-input {
  width: 100%;
  border: 1px solid var(--mkt-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--mkt-text);
  background: var(--mkt-field-bg);
  box-sizing: border-box;
  box-shadow: none;
}

.mkt-chat-field-input::placeholder {
  color: #64748b;
}

.mkt-chat-field-input:focus,
.mkt-chat-field-input:focus-visible {
  outline: none;
  border-color: #64748b;
  box-shadow: none;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

.mkt-chat-intro-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #f87171;
}

.mkt-chat-intro-submit {
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--mkt-primary);
  cursor: pointer;
}

.mkt-chat-intro-submit:hover:not(:disabled) {
  filter: brightness(1.08);
}

.mkt-chat-intro-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mkt-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: var(--mkt-surface);
}

.mkt-chat-faq {
  flex-shrink: 0;
  padding: 0 14px 10px;
  background: var(--mkt-surface);
}

.mkt-chat-faq-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mkt-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mkt-chat-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mkt-chat-faq-btn {
  border: 1px solid var(--mkt-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--mkt-field-bg);
  color: var(--mkt-text);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mkt-chat-faq-btn:hover {
  border-color: #64748b;
  background: var(--mkt-inbound);
}

.mkt-chat-faq-btn:focus,
.mkt-chat-faq-btn:focus-visible {
  outline: none;
  border-color: var(--mkt-primary);
  box-shadow: none;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

.mkt-chat-row {
  display: flex;
  margin-bottom: 12px;
}

.mkt-chat-row--buyer {
  justify-content: flex-end;
}

.mkt-chat-row--system {
  justify-content: flex-start;
}

.mkt-chat-stack {
  max-width: 85%;
}

.mkt-chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--mkt-muted);
}

.mkt-chat-row--buyer .mkt-chat-meta {
  justify-content: flex-end;
}

.mkt-chat-sender {
  font-weight: 600;
  color: #cbd5e1;
}

.mkt-chat-msg {
  padding: 10px 14px;
  border-radius: 18px;
  word-break: break-word;
  white-space: pre-wrap;
}

.mkt-chat-msg--buyer {
  background: var(--mkt-primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.mkt-chat-msg--system {
  background: var(--mkt-system);
  color: #e2e8f0;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-bottom-left-radius: 6px;
}

.mkt-chat-notice {
  margin: 0;
  padding: 8px 16px 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--mkt-muted);
  text-align: center;
  flex-shrink: 0;
  background: var(--mkt-surface);
}

.mkt-chat-form {
  padding: 8px 12px 14px;
  flex-shrink: 0;
  background: var(--mkt-bg);
  border-top: 1px solid var(--mkt-border);
}

.mkt-chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--mkt-border);
  border-radius: 12px;
  padding: 6px 8px 6px 14px;
  background: var(--mkt-field-bg);
}

.mkt-chat-input-wrap:focus-within {
  border-color: #64748b;
}

.mkt-chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--mkt-text);
  min-width: 0;
  box-shadow: none;
}

.mkt-chat-input:focus,
.mkt-chat-input:focus-visible {
  outline: none;
  box-shadow: none;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

.mkt-chat-send:focus,
.mkt-chat-send:focus-visible {
  outline: none;
  box-shadow: none;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

.mkt-chat-input::placeholder {
  color: #64748b;
}

.mkt-chat-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #60a5fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mkt-chat-send:hover:not(:disabled) {
  background: var(--mkt-hover);
}

.mkt-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mkt-chat-status {
  font-size: 12px;
  color: var(--mkt-muted);
  text-align: center;
  padding: 0 16px 8px;
}

@media (max-width: 480px) {
  .mkt-chat-root {
    right: 12px;
    bottom: 12px;
  }

  .mkt-chat-panel {
    width: calc(100vw - 24px);
    bottom: 60px;
  }
}
