
:root {
  --tdi-bg: #0b0d12;
  --tdi-surface: #11151d;
  --tdi-surface-2: #171c26;
  --tdi-border: rgba(255,255,255,.08);
  --tdi-text: #f4f6f8;
  --tdi-muted: #aab3c2;
  --tdi-accent: #c8a96b;
  --tdi-accent-2: #8d6b33;
  --tdi-success: #19b46b;
  --tdi-shadow: 0 20px 60px rgba(0,0,0,.45);
  --tdi-radius: 18px;
}

#tdi-chatbot-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

#tdi-chatbot-root * {
  box-sizing: border-box;
}

#tdi-chatbot-root > * {
  pointer-events: auto;
}

.tdi-chatbot-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(200, 169, 107, .35);
  background: linear-gradient(180deg, #131720 0%, #0d1118 100%);
  color: var(--tdi-text);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--tdi-shadow);
  cursor: pointer;
  min-height: 56px;
}

.tdi-chatbot-toggle__icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(200, 169, 107, .14);
  color: var(--tdi-accent);
  font-size: 16px;
}

.tdi-chatbot-toggle__text {
  font-weight: 700;
  letter-spacing: .02em;
}

.tdi-chatbot-panel {
  width: min(360px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: linear-gradient(180deg, rgba(20,24,32,.98), rgba(8,10,14,.98));
  color: var(--tdi-text);
  border: 1px solid var(--tdi-border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--tdi-shadow);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  transform-origin: bottom right;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

#tdi-chatbot-root.is-open .tdi-chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.tdi-chatbot-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--tdi-border);
  background: rgba(255,255,255,.02);
}

.tdi-chatbot-brand {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
}

.tdi-chatbot-subtitle {
  font-size: 12px;
  color: var(--tdi-muted);
}

.tdi-chatbot-header-actions {
  display: flex;
  gap: 8px;
}

.tdi-header-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--tdi-border);
  background: var(--tdi-surface-2);
  color: var(--tdi-text);
  cursor: pointer;
  font-size: 14px;
}

.tdi-chatbot-messages {
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tdi-msg {
  max-width: 90%;
  padding: 11px 13px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-line;
}

.tdi-msg--bot {
  background: #141a22;
  border: 1px solid var(--tdi-border);
  color: var(--tdi-text);
  border-top-left-radius: 6px;
}

.tdi-msg--user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(200,169,107,.22), rgba(141,107,51,.22));
  border: 1px solid rgba(200,169,107,.22);
  color: var(--tdi-text);
  border-top-right-radius: 6px;
}

.tdi-chatbot-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}

.tdi-chip {
  appearance: none;
  border: 1px solid rgba(200,169,107,.25);
  background: rgba(200,169,107,.08);
  color: var(--tdi-text);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.tdi-chatbot-form {
  display: flex;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--tdi-border);
  background: rgba(255,255,255,.02);
}

#tdi-chatbot-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--tdi-border);
  background: var(--tdi-surface);
  color: var(--tdi-text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.tdi-chatbot-form button {
  border: 1px solid rgba(200,169,107,.4);
  background: linear-gradient(180deg, var(--tdi-accent), var(--tdi-accent-2));
  color: #0e1014;
  font-weight: 800;
  border-radius: 12px;
  padding: 0 15px;
  cursor: pointer;
  white-space: nowrap;
}

.tdi-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.tdi-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  text-decoration: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--tdi-border);
  color: var(--tdi-text);
  background: #141922;
}

.tdi-link-btn--wa {
  background: rgba(25,180,107,.14);
  border-color: rgba(25,180,107,.28);
}

@media (min-width: 1025px) {
  #tdi-chatbot-root {
    bottom: 22px;
    right: 22px;
  }

  .tdi-chatbot-panel {
    width: 350px;
    height: min(540px, calc(100vh - 140px));
  }
}

@media (max-width: 640px) {
  #tdi-chatbot-root {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
  }

  .tdi-chatbot-toggle {
    align-self: flex-end;
  }

  .tdi-chatbot-panel {
    width: 100%;
    height: min(68vh, 520px);
    transform-origin: bottom right;
  }
}
