* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #e9edf3;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-frame {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: #f4f6f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 30px rgba(0,0,0,0.08);
}

@media (min-width: 480px) {
  .phone-frame { height: 92vh; max-height: 850px; border-radius: 22px; margin-top: 4vh; }
}

/* ── Header ───────────────────────────────────────────────── */
.chat-header {
  background: #2563eb;
  color: #fff;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.header-title { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.header-name { font-weight: 600; font-size: 15px; }
.header-status { font-size: 11px; opacity: 0.85; display: flex; align-items: center; gap: 4px; }
.dot-online { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; display: inline-block; }

/* ── Body / scroll area ──────────────────────────────────── */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.msg-row { display: flex; gap: 8px; max-width: 100%; }
.msg-row.bot { align-self: flex-start; }
.msg-row.user { align-self: flex-end; flex-direction: row-reverse; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2563eb; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 78vw;
  word-wrap: break-word;
  white-space: pre-line;
}
.bot .bubble { background: #fff; color: #1f2430; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.user .bubble { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }

.typing .bubble { display: flex; gap: 4px; align-items: center; padding: 12px 16px; }
.typing .dot { width: 6px; height: 6px; background: #9aa3b2; border-radius: 50%; animation: blink 1.2s infinite; }
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.25} 40%{opacity:1} }

/* ── Quick reply buttons ─────────────────────────────────── */
.quick-reply-zone {
  padding: 0 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  max-height: 40vh;
  overflow-y: auto;
}
.qr-btn {
  background: #fff;
  border: 1.5px solid #2563eb;
  color: #2563eb;
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.qr-btn:active { background: #dbeafe; }
.qr-btn:disabled { opacity: .45; cursor: default; }
.qr-btn.full { width: 100%; text-align: left; border-radius: 12px; }
.qr-btn.skip { border-color: #9aa3b2; color: #6b7280; }

/* ── Document upload card ────────────────────────────────── */
.doc-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px dashed #c7cedb;
  border-radius: 10px;
  padding: 10px 12px;
  gap: 10px;
}
.doc-row.done { border-color: #22c55e; background: #f0fdf4; }
.doc-label { font-size: 13px; color: #1f2430; font-weight: 500; }
.doc-file-name { font-size: 11px; color: #16a34a; margin-top: 2px; word-break: break-all; }
.doc-upload-btn {
  background: #eff4ff; color: #2563eb; border: none;
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}
.doc-row.done .doc-upload-btn { background: #dcfce7; color: #16a34a; }
.doc-continue-btn {
  background: #2563eb; color: #fff; border: none; padding: 11px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.doc-continue-btn:disabled { background: #b9c3d4; cursor: not-allowed; }

/* ── Bottom text input ───────────────────────────────────── */
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e5e8ee;
  flex-shrink: 0;
}
.chat-input-bar input {
  flex: 1;
  border: 1px solid #dfe3ea;
  background: #f4f6f9;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 14px;
  outline: none;
}
.chat-input-bar button {
  width: 42px; height: 42px; border-radius: 50%;
  background: #2563eb; color: #fff; border: none; font-size: 16px; cursor: pointer;
  flex-shrink: 0;
}

.field-error { color: #dc2626; font-size: 12px; padding: 0 4px; }
