:root {
  --chat-primary: #0b5ed7;
  --chat-primary-dark: #084298;
  --chat-bg: #eef3f9;
}

[x-cloak] { display: none !important; }

.chat-body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 0%, rgba(13, 110, 253, .18), transparent 40%),
    linear-gradient(160deg, #f3f7fc 0%, #e8eff8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-shell {
  width: 100%;
  max-width: 900px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 18px 60px rgba(16, 42, 80, .16);
}

@media (min-width: 860px) {
  .chat-body { padding: 24px; }
  .chat-shell { height: min(92dvh, 900px); border-radius: 22px; overflow: hidden; }
}

.chat-header {
  background: linear-gradient(135deg, var(--chat-primary-dark), var(--chat-primary));
  color: #fff;
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chat-logo {
  width: 58px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 4px 6px;
}
.chat-logo img { max-width: 100%; height: auto; }

.chat-step {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, .22);
}

.chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: .9rem 1rem 1rem;
  background: var(--chat-bg);
}

.chat-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: .35rem .25rem 0;
  scroll-behavior: smooth;
}

.chat-row { display: flex; margin-bottom: .6rem; }
.chat-row.yo { justify-content: flex-end; }
.chat-bubble {
  max-width: min(78%, 620px);
  padding: .65rem .9rem;
  border-radius: 17px;
  background: #fff;
  border: 1px solid #dbe4f0;
  color: #132238;
  box-shadow: 0 2px 8px rgba(16, 42, 80, .05);
}
.chat-row.yo .chat-bubble {
  background: var(--chat-primary);
  border-color: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-row.bot .chat-bubble { border-bottom-left-radius: 5px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-meta { font-size: .72rem; color: #6b7a90; margin-top: .3rem; }
.chat-row.yo .chat-meta { color: rgba(255, 255, 255, .75); }
.chat-upload-note {
  margin-top: .45rem;
  font-size: .78rem;
  color: #084298;
  background: #e7f1ff;
  border-radius: 8px;
  padding: .3rem .45rem;
}

.chat-bubble.error {
  background: #fff5f5;
  border-color: #f1aeb5;
  color: #842029;
}

.typing { display: flex; gap: .25rem; align-items: center; padding: .8rem 1rem; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #7c8ba1; display: inline-block;
  animation: chat-bounce 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .12s; }
.typing span:nth-child(3) { animation-delay: .24s; }
@keyframes chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-options {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  padding: .5rem 0 .25rem;
}
.chat-option {
  border: 1px solid #b6cbe4;
  background: #fff;
  color: #084298;
  border-radius: 999px;
  padding: .42rem .8rem;
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s ease-in-out, transform .15s ease-in-out;
}
.chat-option:hover, .chat-option:focus-visible {
  background: #e7f1ff;
  transform: translateY(-1px);
}

.upload-panel {
  background: #fff;
  border: 1px dashed #b6cbe4;
  border-radius: 14px;
  padding: .7rem .8rem;
  margin: .35rem 0 .55rem;
}
.upload-panel.required {
  border-color: var(--chat-primary);
  background: #f4f9ff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .08);
}
.upload-title { font-weight: 700; font-size: .88rem; color: #17365d; margin-bottom: .45rem; }

.chat-form { display: flex; gap: .5rem; padding-top: .35rem; }
.chat-form .form-control { border-radius: 12px; padding: .7rem .85rem; }
.chat-form .btn { border-radius: 12px; width: 48px; }

.chat-privacy {
  margin: .5rem 0 0;
  font-size: .72rem;
  color: #61718a;
  text-align: center;
}

@media (max-width: 520px) {
  .chat-main { padding: .6rem .65rem .75rem; }
  .chat-bubble { max-width: 88%; }
  .chat-header { padding: .8rem; }
}
