:root {
  --brand: #0b5bc1;
  --brand-dark: #08468f;
  --bg: #eef3f9;
  --surface: #ffffff;
  --bubble-bot: #f1f3f6;
  --text: #1d2733;
  --muted: #5f6b7a;
  --border: #dde3ea;
  --error: #b42318;
  --radius: 16px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.demo-page {
  max-width: 720px;
  padding: 48px 24px;
}
@media (min-width: 521px) {
  /* keep the demo text clear of the open chat panel */
  .demo-page { margin-right: 440px; }
}
.demo-page h1 { margin: 0 0 8px; font-size: 1.6rem; color: var(--brand-dark); }
.demo-page p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.demo-badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff4d6;
  color: #7a5200;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Launcher */
.launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 24px rgba(11, 91, 193, 0.35);
  cursor: pointer;
}
.launcher svg { width: 28px; height: 28px; }

/* Panel */
.panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 400px;
  height: min(680px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(16, 24, 40, 0.18);
  overflow: hidden;
}
.panel[hidden], .launcher[hidden] { display: none; }

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--brand);
  color: #fff;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}
.title { flex: 1; min-width: 0; }
.title strong { display: block; font-size: 1rem; }
.title span { font-size: 0.8rem; opacity: 0.85; }
.icon-button {
  border: 0;
  background: transparent;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.icon-button:hover { background: rgba(255, 255, 255, 0.15); }

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.bubble.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--bubble-bot);
  border-bottom-left-radius: 4px;
}
.bubble.error { color: var(--error); }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ol, .bubble ul { margin: 4px 0 8px; padding-left: 20px; }
.bubble li { margin: 2px 0; }
.bubble h4 { margin: 8px 0 4px; font-size: 0.95rem; }
.bubble code {
  background: rgba(11, 91, 193, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
.bubble a { color: var(--brand); }
.bubble .shot { display: block; margin: 6px 0; }
.bubble .shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.bubble.typing { display: flex; gap: 4px; padding: 14px; }
.bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

/* Suggestions */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}
.suggestions[hidden] { display: none; }
.chip {
  border: 1px solid var(--brand);
  background: #fff;
  color: var(--brand);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip:hover { background: rgba(11, 91, 193, 0.06); }

/* Composer */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  max-height: 120px;
  overflow-y: hidden;
}
.composer textarea:focus { outline: 2px solid rgba(11, 91, 193, 0.35); border-color: var(--brand); }
.send {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  width: 44px;
  height: 42px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.send:disabled { opacity: 0.5; cursor: default; }
.send svg { width: 20px; height: 20px; }
.disclaimer {
  padding: 0 16px 10px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 520px) {
  .panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .launcher { right: 16px; bottom: 16px; }
  .demo-page { padding: 24px 16px; }
}
