.db-chat {
  --db-coral: #e65100;
  --db-coral-soft: #ff7a1a;
  --db-coral-dark: #bf360c;
  --db-ink: #111827;
  --db-muted: #64748b;
  --db-bg: #f8fafc;
  --db-surface: #ffffff;
  --db-border: #e5e7eb;
  --db-shadow: 0 26px 72px rgba(15, 23, 42, 0.24);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  color: var(--db-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.db-chat * {
  box-sizing: border-box;
}

.db-chat__button {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--db-coral) 0%, var(--db-coral-soft) 100%);
  color: #fff;
  box-shadow: 0 18px 46px rgba(230, 81, 0, 0.36);
  cursor: pointer;
  display: grid;
  place-items: center;
  outline: none;
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.db-chat__button::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(230, 81, 0, 0.28);
  border-radius: inherit;
  opacity: 0.9;
}

.db-chat__button:hover {
  transform: translateY(-3px);
  filter: saturate(1.08);
  box-shadow: 0 22px 56px rgba(230, 81, 0, 0.42);
}

.db-chat__button:active {
  transform: translateY(-1px) scale(0.98);
}

.db-chat__button:focus-visible,
.db-chat__iconbtn:focus-visible,
.db-chat__send:focus-visible,
.db-chat__input:focus-visible,
.db-chat__footerline a:focus-visible {
  outline: 3px solid rgba(230, 81, 0, 0.24);
  outline-offset: 3px;
}

.db-chat__button svg {
  width: 29px;
  height: 29px;
}

.db-chat--open .db-chat__button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.92);
}

.db-chat__panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(420px, calc(100vw - 32px));
  height: min(660px, calc(100vh - 118px));
  min-height: 540px;
  background: var(--db-surface);
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 24px;
  box-shadow: var(--db-shadow);
  display: none;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
}

.db-chat--open .db-chat__panel {
  animation: dbChatIn 180ms ease forwards;
  display: flex;
  flex-direction: column;
}

@keyframes dbChatIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.db-chat__header {
  min-height: 88px;
  padding: 18px;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 255, 255, 0.3) 0, transparent 34%),
    linear-gradient(135deg, var(--db-coral) 0%, #f56d18 48%, var(--db-coral-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.db-chat__brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.db-chat__mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.db-chat__mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.db-chat__title {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: 0;
}

.db-chat__subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  margin-top: 5px;
  text-transform: uppercase;
}

.db-chat__actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.db-chat__iconbtn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 160ms ease, transform 160ms ease;
}

.db-chat__iconbtn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.db-chat__iconbtn svg {
  width: 17px;
  height: 17px;
}

.db-chat__close {
  font-size: 24px;
  line-height: 1;
  padding-bottom: 3px;
}

.db-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 10px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.48), rgba(255, 255, 255, 0.96)),
    var(--db-bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.34) transparent;
}

.db-chat__messages::-webkit-scrollbar {
  width: 8px;
}

.db-chat__messages::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.28);
  border-radius: 999px;
}

.db-chat__message {
  max-width: 90%;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 21px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  position: relative;
}

.db-chat__message::before {
  content: attr(data-label);
  display: block;
  color: #748197;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.db-chat__message--assistant {
  background: #fff;
  color: var(--db-ink);
  border: 1px solid rgba(15, 23, 42, 0.075);
  border-top-left-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.db-chat__message--user {
  margin-left: auto;
  background: linear-gradient(135deg, #172033, #243047);
  color: #fff;
  border-top-right-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.13);
}

.db-chat__message--user::before {
  color: rgba(255, 255, 255, 0.62);
}

.db-chat__quickstart {
  padding: 0 18px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fff);
}

.db-chat__quickstart[hidden] {
  display: none;
}

.db-chat__quicktitle {
  color: #475569;
  font-size: 12px;
  font-weight: 760;
  margin: 2px 0 10px;
}

.db-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.db-chat__chip {
  border: 1px solid rgba(230, 81, 0, 0.22);
  border-radius: 999px;
  background: #fff;
  color: #78350f;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.1;
  padding: 9px 11px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.db-chat__chip:hover {
  border-color: rgba(230, 81, 0, 0.42);
  background: #fff7ed;
  color: var(--db-coral-dark);
  transform: translateY(-1px);
}

.db-chat__chip:focus-visible {
  outline: 3px solid rgba(230, 81, 0, 0.18);
  outline-offset: 2px;
}

.db-chat__status {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--db-muted);
  font-size: 12px;
  font-weight: 650;
  min-height: 34px;
  padding: 0 18px 10px;
  background: #fff;
}

.db-chat__status--visible {
  display: flex;
}

.db-chat__typing {
  display: inline-flex;
  gap: 4px;
}

.db-chat__typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--db-coral);
  animation: dbChatPulse 900ms ease-in-out infinite;
}

.db-chat__typing i:nth-child(2) {
  animation-delay: 120ms;
}

.db-chat__typing i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes dbChatPulse {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.db-chat__form {
  border-top: 1px solid var(--db-border);
  padding: 15px;
  background: #fff;
}

.db-chat__inputrow {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1.5px solid rgba(230, 81, 0, 0.32);
  border-radius: 20px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.db-chat__inputrow:focus-within {
  border-color: var(--db-coral);
  box-shadow: 0 0 0 4px rgba(230, 81, 0, 0.1), 0 14px 34px rgba(15, 23, 42, 0.08);
}

.db-chat__input {
  flex: 1;
  max-height: 120px;
  min-height: 44px;
  resize: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 9px 11px 11px;
  background: transparent;
  color: var(--db-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.42;
  outline: none;
}

.db-chat__input::placeholder {
  color: #94a3b8;
}

.db-chat__send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--db-coral), var(--db-coral-dark));
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.db-chat__send:hover {
  filter: brightness(1.04) saturate(1.05);
  transform: translateY(-1px);
}

.db-chat__send:active {
  transform: translateY(0) scale(0.98);
}

.db-chat__send:disabled,
.db-chat__input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.db-chat__send svg {
  width: 18px;
  height: 18px;
}

.db-chat__footerline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--db-muted);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 10px;
}

.db-chat__footerline a {
  color: var(--db-coral-dark);
  font-weight: 800;
  border-bottom: 1px solid rgba(191, 54, 12, 0.3);
  text-decoration: none;
  white-space: nowrap;
}

.db-chat__footerline a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .db-chat__button,
  .db-chat__iconbtn,
  .db-chat__send,
  .db-chat__panel,
  .db-chat__typing i {
    animation: none;
    transition: none;
  }
}

@media (max-width: 560px) {
  .db-chat {
    right: 12px;
    bottom: 12px;
  }

  .db-chat__button {
    width: 58px;
    height: 58px;
  }

  .db-chat__panel {
    right: 0;
    bottom: 0;
    width: calc(100vw - 24px);
    height: calc(100vh - 48px);
    min-height: 0;
    border-radius: 22px;
  }

  .db-chat__header {
    min-height: 82px;
    padding: 15px;
  }

  .db-chat__mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .db-chat__title {
    font-size: 17px;
  }

  .db-chat__subtitle {
    font-size: 10px;
  }

  .db-chat__messages {
    padding: 18px 14px 8px;
  }

  .db-chat__message {
    max-width: 92%;
    font-size: 13.5px;
  }

  .db-chat__quickstart {
    padding: 0 14px 14px;
  }

  .db-chat__chip {
    font-size: 11.5px;
    padding: 8px 10px;
  }

  .db-chat__form {
    padding: 13px 12px 14px;
  }

  .db-chat__inputrow {
    border-radius: 19px;
    padding: 7px;
  }

  .db-chat__input {
    min-height: 46px;
    padding-left: 10px;
  }

  .db-chat__send {
    width: 43px;
    height: 43px;
  }

  .db-chat__footerline {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    margin-top: 9px;
  }
}
