/* Design tokens from Figma / SVG reference */
:root {
  --intake-primary: #5546c0;
  --intake-periwinkle: #8896f4;
  --intake-text: #292c35;
  --intake-muted: #6b7280;
  --intake-success: #07c495;
  --intake-bubble-bg: #eceffa;
  --intake-page-wash: rgba(85, 70, 192, 0.1);
  --intake-promo-card: rgba(238, 237, 249, 0.2);
  --intake-white: #ffffff;
  --intake-shadow: 0 8px 32px rgba(41, 44, 53, 0.12);
  --intake-radius-panel: 16px;
  --intake-radius-bubble: 10px;
  --intake-radius-teaser: 15px;
  --intake-gradient: linear-gradient(180deg, #5546c0 0%, #8896f4 100%);
  --intake-font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--intake-font);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  color: var(--intake-text);
}

.intake-bubble-root {
  min-height: 100vh;
  background: transparent;
}

.intake-teaser-avatar-btn {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}

.intake-teaser-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.intake-bubble-host {
  min-height: 100vh;
}

.intake-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--intake-muted);
  font-size: 14px;
}

.intake-muted {
  color: var(--intake-muted);
}

/* —— Layout shells —— */
.intake-bubble-html,
.intake-bubble-body {
  margin: 0;
  min-height: 100%;
  background: transparent;
}

.intake-fullpage-body {
  margin: 0;
  min-height: 100vh;
  background: var(--intake-page-wash);
}

.intake-main-default {
  padding: 2rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Root "/" — same intent as Router NotFound (DocCollector-style): wrong or incomplete URL */
.intake-root-misroute {
  padding: 0.5rem 0 2rem;
}

.intake-root-misroute__lead {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--intake-text);
}

.intake-root-misroute__hint {
  margin: 0;
  line-height: 1.5;
  font-size: 0.9375rem;
}

.intake-root-misroute__code {
  font-size: 0.875rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: var(--intake-bubble-bg);
  color: var(--intake-text);
}

.intake-example-url {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(41, 44, 53, 0.1);
}

.intake-example-url__label {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
}

.intake-example-url__e164 {
  font-weight: 600;
  color: var(--intake-text);
}

.intake-example-url__list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.6;
}

.intake-example-url__list li {
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.intake-example-url__link {
  color: var(--intake-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.intake-example-url__link:hover {
  color: var(--intake-periwinkle);
}

.intake-example-url__note {
  font-size: 0.875rem;
}

/* —— Avatar —— */
.intake-avatar {
  position: relative;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--intake-gradient);
  display: grid;
  place-items: center;
  color: var(--intake-white);
  font-weight: 600;
  font-size: 12px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(41, 44, 53, 0.08);
}

.intake-avatar--sm {
  width: 44px;
  height: 44px;
  font-size: 11px;
}

/* Custom bot avatar (URL from chatIcon query) — matches sm initials avatar in header + message rows */
.intake-bot-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.intake-avatar--md {
  width: 56px;
  height: 56px;
}

.intake-avatar--lg {
  width: 74px;
  height: 74px;
  font-size: 14px;
}

.intake-avatar__dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--intake-success);
  border: 3px solid var(--intake-white);
}

/* —— Collapsed teaser —— */
.intake-teaser-row {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0 12px 12px;
}

.intake-teaser-bubble {
  position: relative;
  max-width: 301px;
  min-height: 57px;
  padding: 16px 20px;
  padding-right: 24px;
  border: none;
  outline: none;
  background: var(--intake-white);
  border-radius: var(--intake-radius-teaser);
  box-shadow: 0 2px 12px rgba(85, 70, 192, 0.12);
  font-size: 15px;
  line-height: 1.4;
  color: var(--intake-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.intake-teaser-bubble::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid var(--intake-white);
  filter: drop-shadow(2px 0 1px rgba(85, 70, 192, 0.06));
}

.intake-teaser-bubble__tint {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(85, 70, 192, 0.08), rgba(136, 150, 244, 0.12));
  pointer-events: none;
}

/* —— FAB —— */
.intake-fab {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--intake-periwinkle);
  color: var(--intake-white);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(136, 150, 244, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.intake-fab:hover {
  transform: scale(1.03);
}

.intake-fab:focus-visible {
  outline: 2px solid var(--intake-primary);
  outline-offset: 3px;
}

.intake-fab svg {
  width: 28px;
  height: 28px;
}

/* —— Bubble panel —— */
.intake-bubble-panel-wrap {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 96px;
  width: min(355px, calc(100vw - 24px));
  height: 60vh;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  filter: drop-shadow(var(--intake-shadow));
}

.intake-bubble-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--intake-radius-panel);
  overflow: hidden;
  background: var(--intake-white);
  flex: 1;
  min-height: 0;
}

.intake-bubble-panel__header {
  flex-shrink: 0;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(136, 150, 244, 0.22), rgba(85, 70, 192, 0.08));
}

.intake-bubble-panel__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: var(--intake-white);
}

.intake-bubble-panel__footer {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  background: var(--intake-white);
  border-top: 1px solid rgba(41, 44, 53, 0.06);
}

/* —— Header row —— */
.intake-header-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.intake-header-row__text {
  flex: 1;
  min-width: 0;
}

.intake-header-row__kicker {
  font-size: 12px;
  color: var(--intake-muted);
  margin: 0 0 2px;
}

.intake-header-row__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.intake-header-row__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--intake-muted);
}

.intake-header-row__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--intake-success);
}

.intake-icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--intake-text);
  opacity: 0.75;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.intake-icon-btn:hover {
  opacity: 1;
  background: rgba(41, 44, 53, 0.06);
}

/* —— Message row —— */
.intake-msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.intake-msg-row--user {
  justify-content: flex-end;
}

.intake-msg-content {
  max-width: 85%;
}

.intake-msg-content--user {
  margin-left: auto;
}

.intake-msg-bubble {
  max-width: 100%;
  padding: 14px 16px;
  border-radius: var(--intake-radius-bubble);
  background: var(--intake-bubble-bg);
  font-size: 14px;
  line-height: 1.5;
}

.intake-msg-meta {
  font-size: 11px;
  color: var(--intake-muted);
  margin-top: 6px;
  padding-left: 8px;
}

.intake-msg-meta--user {
  text-align: right;
  padding-left: 0;
  padding-right: 0;
}

/* —— Start Chat —— */
.intake-start-chat {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  background: var(--intake-primary);
  color: var(--intake-white);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.intake-start-chat:hover {
  background: #4739a9;
}

/* —— Composer (pill) —— */
.intake-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  border-radius: 21px;
  background: var(--intake-bubble-bg);
}

.intake-composer__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--intake-text);
}

.intake-composer__input::placeholder {
  color: #9ca3af;
}

.intake-composer__send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--intake-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.intake-composer__send:hover {
  background: rgba(85, 70, 192, 0.1);
}

/* —— Full page composer (bordered) —— */
.intake-composer--fullpage {
  border-radius: 12px;
  border: 1px solid rgba(85, 70, 192, 0.35);
  background: var(--intake-white);
  padding: 10px 12px;
}

/* —— Modal —— */
.intake-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: var(--intake-white);
  color: var(--intake-muted);
}

.intake-btn:hover {
  background: #f9fafb;
}

.intake-btn--primary {
  border-color: var(--intake-primary);
  background: var(--intake-primary);
  color: var(--intake-white);
}

.intake-btn--primary:hover {
  background: #4739a9;
}

.intake-btn--danger {
  border-color: #dc2626;
  background: #dc2626;
  color: var(--intake-white);
}

.intake-btn--danger:hover {
  background: #b91c1c;
}

/* Inline exit confirmation */
.intake-exit-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  height: 100%;
}

.intake-exit-confirm__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  color: #dc2626;
}

.intake-exit-confirm__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.intake-exit-confirm__sub {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--intake-muted);
  line-height: 1.5;
}

.intake-exit-confirm__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 280px;
}

/* —— Full page grid —— */
.intake-fullpage {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
}

.intake-fullpage__chat-card {
  flex: 1;
  min-height: 0;
  background: var(--intake-white);
  border-radius: 20px;
  box-shadow: var(--intake-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.intake-fullpage__chat-card .intake-bubble-panel__header {
  border-bottom: 1px solid rgba(41, 44, 53, 0.06);
}

.intake-fullpage__chat-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.intake-fullpage__chat-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(41, 44, 53, 0.06);
}

/* Typing indicator */
.intake-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  min-height: 40px;
}

.intake-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: intake-typing-bounce 1.4s infinite ease-in-out both;
}

.intake-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.intake-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.intake-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes intake-typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}



.intake-debug {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 8px;
  word-break: break-all;
}

.intake-sending {
  margin: 8px 4px 0;
  font-size: 12px;
  color: var(--intake-muted);
}

.intake-error {
  margin: 10px 2px 0;
  color: #cf3b36;
  font-size: 13px;
  line-height: 1.4;
}
