:root {
  --bg: #0f0b17;
  --panel: rgba(24, 18, 35, 0.88);
  --panel-2: rgba(35, 26, 51, 0.9);
  --text: #f8f5ff;
  --muted: #b8afc8;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #b86cff;
  --accent-2: #ff68b7;
  --success: #62d8a7;
  --danger: #ff5d79;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(184, 108, 255, 0.2), transparent 34%),
    radial-gradient(circle at 85% 75%, rgba(255, 104, 183, 0.13), transparent 30%),
    linear-gradient(135deg, #0b0810 0%, #15101f 48%, #0b0811 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 85%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 44px 0;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 34px;
  align-items: center;
}

.brand-panel { padding: 26px 20px 26px 8px; }

.brand-mark {
  font-family: Manrope, sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 22px;
  margin-bottom: 78px;
}

.brand-mark span, .brand-copy h1 span { color: var(--accent); }

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: #d5aaff;
  font-size: 12px;
  font-weight: 700;
}

.brand-copy h1 {
  margin: 0;
  max-width: 560px;
  font-family: Manrope, sans-serif;
  font-size: clamp(46px, 6vw, 78px);
  line-height: .98;
  letter-spacing: -.055em;
}

.lead {
  max-width: 540px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.trust-row {
  margin-top: 58px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trust-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  color: #c9c1d5;
  font-size: 12px;
  background: rgba(255,255,255,.025);
}

.chat-card {
  height: min(760px, calc(100vh - 64px));
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(31, 23, 44, .96), rgba(19, 14, 28, .96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
}

.agent-identity { display: flex; align-items: center; gap: 13px; }

.avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(184,108,255,.09);
  border: 1px solid rgba(255,255,255,.14);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 26%;
  transform: scale(1.32);
}

.agent-name-row { display: flex; align-items: center; gap: 8px; }
.agent-name-row h2 { margin: 0; font-size: 18px; }
.agent-identity p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.ai-badge {
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  background: rgba(98,216,167,.12);
  color: var(--success);
  border: 1px solid rgba(98,216,167,.18);
}

.icon-button, .voice-button, .send-button {
  border: 0;
  cursor: pointer;
  color: var(--text);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255,255,255,.055);
  font-size: 18px;
  transition: background .18s ease, transform .18s ease;
}
.icon-button:hover { background: rgba(255,255,255,.09); transform: rotate(-8deg); }

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 22px 18px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 999px; }

.message { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 14px; }
.message-user { justify-content: flex-end; }

.message-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 26%;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

.message-bubble {
  max-width: min(82%, 540px);
  border-radius: 18px;
  padding: 13px 15px;
  font-size: 14px;
  line-height: 1.58;
}
.message-bubble p { margin: 0; }
.message-bubble p + p { margin-top: 8px; }

.message-assistant .message-bubble {
  border-top-left-radius: 6px;
  background: rgba(255,255,255,.065);
  border: 1px solid rgba(255,255,255,.06);
}

.message-user .message-bubble {
  border-top-right-radius: 6px;
  color: white;
  background: linear-gradient(135deg, #8f45e5, #a856d3);
}

.audio-label {
  display: block;
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  color: #d8c7e8;
  opacity: .82;
}

.message-user .audio-label { color: rgba(255,255,255,.82); }

.audio-player {
  display: block;
  width: min(100%, 360px);
  height: 36px;
  margin-top: 10px;
  accent-color: var(--accent);
}

.voice-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(184,108,255,.25);
  border-radius: 10px;
  color: #eadcff;
  background: rgba(184,108,255,.10);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.voice-replay:hover {
  background: rgba(184,108,255,.18);
  transform: translateY(-1px);
}

.status {
  min-height: 26px;
  padding: 0 22px 3px 58px;
  color: var(--muted);
  font-size: 12px;
}

.status.typing::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 6px;
  margin-left: 6px;
  background: radial-gradient(circle, currentColor 2px, transparent 3px) 0 50%/7px 7px repeat-x;
  animation: pulse 1.1s infinite linear;
}

@keyframes pulse { 50% { opacity: .35; } }

.composer {
  margin: 0 16px 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  align-items: end;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.composer:focus-within {
  border-color: rgba(184,108,255,.35);
  box-shadow: 0 0 0 3px rgba(184,108,255,.06);
}

.composer textarea {
  width: 100%;
  max-height: 128px;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
  border: 0;
  outline: 0;
  padding: 10px 8px;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  background: transparent;
}
.composer textarea::-webkit-scrollbar { display: none; }
.composer textarea::placeholder { color: #857b94; }

.voice-button, .send-button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.voice-button {
  background: rgba(255,255,255,.065);
  opacity: .9;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.voice-button:hover:not(:disabled) { background: rgba(255,255,255,.11); transform: translateY(-1px); }
.voice-button:disabled { opacity: .38; cursor: progress; }
.voice-button svg { width: 19px; height: 19px; fill: currentColor; }

.voice-button.recording {
  color: white;
  background: var(--danger);
  box-shadow: 0 0 0 7px rgba(255,93,121,.12);
  animation: recordingPulse 1.15s ease-in-out infinite;
}

@keyframes recordingPulse {
  50% { box-shadow: 0 0 0 12px rgba(255,93,121,.035); transform: scale(.98); }
}

.send-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform .18s ease, filter .18s ease;
}
.send-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.send-button:disabled { opacity: .5; cursor: progress; }

.privacy-note {
  margin: 0 20px 15px;
  color: #7f758c;
  font-size: 10px;
  text-align: center;
  line-height: 1.45;
}

.error-bubble {
  background: rgba(255, 94, 122, .08) !important;
  border-color: rgba(255, 94, 122, .2) !important;
  color: #ffc4d0;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(680px, calc(100% - 20px));
    grid-template-columns: 1fr;
    padding: 20px 0;
  }
  .brand-panel { display: none; }
  .chat-card { height: calc(100vh - 40px); min-height: 560px; }
}

@media (max-width: 520px) {
  .page-shell { width: 100%; padding: 0; }
  .chat-card { height: 100dvh; min-height: 100dvh; border-radius: 0; border: 0; }
  .chat-header { padding: 16px; }
  .messages { padding: 20px 14px 14px; }
  .composer { margin-inline: 10px; }
  .message-bubble { max-width: 88%; }
  .status { padding-left: 50px; }
}
