/*!
 * Convo — Conversational Lead Widget
 * widget.css — RTL-first, themeable, accessible chat widget styles.
 * All rules are scoped under #convo-root to avoid leaking into host themes.
 */

/* ------------------------------------------------------------------ *
 * Design tokens (overridable per-site via inline style on #convo-root)
 * ------------------------------------------------------------------ */
#convo-root {
  /* Brand */
  --cnv-accent: #84cc16;
  --cnv-accent-600: #65a30d;
  --cnv-accent-700: #4d7c0f;
  --cnv-accent-soft: rgba(132, 204, 22, 0.12);
  --cnv-on-accent: #10230a;

  /* Neutral surfaces (light) */
  --cnv-bg: #ffffff;
  --cnv-panel: #ffffff;
  --cnv-canvas: #f6f7f9;
  --cnv-bot-bubble: #f1f3f5;
  --cnv-bot-text: #1a1d21;
  --cnv-text: #1a1d21;
  --cnv-muted: #6b7280;
  --cnv-border: rgba(17, 24, 39, 0.08);
  --cnv-ring: rgba(132, 204, 22, 0.35);

  /* Geometry & depth */
  --cnv-radius: 22px;
  --cnv-radius-lg: 26px;
  --cnv-radius-sm: 14px;
  --cnv-bubble-radius: 20px;
  --cnv-shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.35),
                0 8px 20px -12px rgba(15, 23, 42, 0.25);
  --cnv-shadow-sm: 0 6px 16px -8px rgba(15, 23, 42, 0.28);
  --cnv-launcher-shadow: 0 14px 34px -10px rgba(101, 163, 13, 0.55);

  /* Typography */
  --cnv-font: 'Rubik', 'Assistant', 'Heebo', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --cnv-font-size: 15px;

  /* Layout */
  --cnv-z: 2147483000;              /* below max, above almost everything */
  --cnv-width: 384px;
  --cnv-height: 620px;
  --cnv-gap: 20px;                  /* distance from viewport edge */

  /* Motion */
  --cnv-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cnv-ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  z-index: var(--cnv-z);
  inset-block-end: var(--cnv-gap);
  /* Physical anchoring (default bottom-right) so the corner is unambiguous
     regardless of text direction. Internal layout still follows dir=rtl. */
  right: var(--cnv-gap);
  left: auto;
  font-family: var(--cnv-font);
  font-size: var(--cnv-font-size);
  line-height: 1.5;
  color: var(--cnv-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#convo-root[data-cnv-pos="left"] {
  right: auto;
  left: var(--cnv-gap);
}

/* Dark theme -------------------------------------------------------- */
#convo-root[data-cnv-theme="dark"] {
  --cnv-bg: #0f1216;
  --cnv-panel: #14181e;
  --cnv-canvas: #0f1216;
  --cnv-bot-bubble: #1e242c;
  --cnv-bot-text: #e8eaed;
  --cnv-text: #e8eaed;
  --cnv-muted: #9aa4b2;
  --cnv-border: rgba(255, 255, 255, 0.08);
  --cnv-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.7),
                0 8px 20px -12px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  #convo-root[data-cnv-theme="auto"] {
    --cnv-bg: #0f1216;
    --cnv-panel: #14181e;
    --cnv-canvas: #0f1216;
    --cnv-bot-bubble: #1e242c;
    --cnv-bot-text: #e8eaed;
    --cnv-text: #e8eaed;
    --cnv-muted: #9aa4b2;
    --cnv-border: rgba(255, 255, 255, 0.08);
    --cnv-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.7),
                  0 8px 20px -12px rgba(0, 0, 0, 0.6);
  }
}

/* Base reset within the widget only -------------------------------- */
#convo-root *,
#convo-root *::before,
#convo-root *::after { box-sizing: border-box; }

/* Safety net: an <svg> with no explicit size falls back to the browser
   default (300x150) and balloons huge. :where() keeps this at zero
   specificity so every per-icon size rule below still wins; this only
   catches an icon that nobody gave a specific size. */
:where(#convo-root) svg { inline-size: 1em; block-size: 1em; }

/* ID-scoped (not :where()) so this reliably beats the host theme's own
   generic `button` styling (many themes set a border/border-radius/background
   on every <button> site-wide). The specific component rules below
   (.cnv-launcher, .cnv-iconbtn, etc.) are themselves prefixed with
   #convo-root so they still win over this reset. */
#convo-root button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  margin: 0;
  padding: 0;
}

#convo-root :focus-visible {
  outline: 3px solid var(--cnv-ring);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ *
 * Launcher
 * ------------------------------------------------------------------ */
#convo-root .cnv-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 62px;
  block-size: 62px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  color: var(--cnv-on-accent);
  box-shadow: var(--cnv-launcher-shadow);
  transition: transform 0.28s var(--cnv-ease), box-shadow 0.28s var(--cnv-ease);
  position: relative;
  will-change: transform;
}
.cnv-launcher:hover { transform: translateY(-3px) scale(1.04); }
.cnv-launcher:active { transform: translateY(-1px) scale(0.98); }

.cnv-launcher svg { inline-size: 28px; block-size: 28px; display: block; }

.cnv-launcher .cnv-ic-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.6); transition: 0.3s var(--cnv-ease); }
.cnv-launcher .cnv-ic-open  { opacity: 1; transform: rotate(0) scale(1); transition: 0.3s var(--cnv-ease); }
#convo-root[data-cnv-open="true"] .cnv-launcher .cnv-ic-close { opacity: 1; transform: rotate(0) scale(1); }
#convo-root[data-cnv-open="true"] .cnv-launcher .cnv-ic-open  { opacity: 0; transform: rotate(90deg) scale(0.6); }

/* idle pulse ring */
.cnv-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--cnv-accent);
  opacity: 0.5;
  animation: cnv-pulse 2.6s var(--cnv-ease-out) infinite;
}
#convo-root[data-cnv-open="true"] .cnv-launcher::after { animation: none; opacity: 0; }

@keyframes cnv-pulse {
  0%   { box-shadow: 0 0 0 0 var(--cnv-ring); opacity: 0.55; }
  70%  { box-shadow: 0 0 0 16px rgba(132, 204, 22, 0); opacity: 0; }
  100% { box-shadow: 0 0 0 0 rgba(132, 204, 22, 0); opacity: 0; }
}

/* Unread / attention dot */
.cnv-launcher-badge {
  position: absolute;
  inset-block-start: -2px;
  inset-inline-end: -2px;
  min-inline-size: 20px;
  block-size: 20px;
  padding: 0 5px;
  border-radius: 12px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--cnv-bg);
}
.cnv-launcher-badge[data-show="true"] { display: inline-flex; }

/* Teaser bubble beside launcher */
.cnv-teaser {
  position: absolute;
  inset-block-end: 8px;
  right: 74px;
  left: auto;
  max-inline-size: 250px;
  background: var(--cnv-panel);
  color: var(--cnv-text);
  padding: 12px 15px;
  border-radius: var(--cnv-radius-sm);
  box-shadow: var(--cnv-shadow-sm);
  border: 1px solid var(--cnv-border);
  font-size: 14.5px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.4s var(--cnv-ease), transform 0.4s var(--cnv-ease);
}
#convo-root[data-cnv-pos="left"] .cnv-teaser { right: auto; left: 74px; transform-origin: bottom left; }
.cnv-teaser[data-show="true"] { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
#convo-root[data-cnv-open="true"] .cnv-teaser { opacity: 0 !important; pointer-events: none; }
.cnv-teaser-wave { display: inline-block; animation: cnv-wave 2s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes cnv-wave { 0%,60%,100%{transform:rotate(0)} 10%{transform:rotate(14deg)} 20%{transform:rotate(-8deg)} 30%{transform:rotate(14deg)} 40%{transform:rotate(-4deg)} 50%{transform:rotate(10deg)} }
#convo-root .cnv-teaser-close {
  position: absolute;
  inset-block-start: -8px;
  inset-inline-start: -8px;
  inline-size: 22px; block-size: 22px;
  border-radius: 50%;
  background: var(--cnv-bot-bubble);
  color: var(--cnv-muted);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--cnv-shadow-sm);
  font-size: 13px;
}
.cnv-teaser-close svg { inline-size: 12px; block-size: 12px; flex-shrink: 0; }

/* ------------------------------------------------------------------ *
 * Panel
 * ------------------------------------------------------------------ */
.cnv-panel {
  position: absolute;
  inset-block-end: 78px;
  right: 0;
  left: auto;
  inline-size: var(--cnv-width);
  max-inline-size: calc(100vw - 32px);
  block-size: var(--cnv-height);
  max-block-size: calc(100dvh - 110px);
  background: var(--cnv-panel);
  border-radius: var(--cnv-radius-lg);
  box-shadow: var(--cnv-shadow);
  border: 1px solid var(--cnv-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.32s var(--cnv-ease), transform 0.36s var(--cnv-ease);
}
#convo-root[data-cnv-pos="left"] .cnv-panel { right: auto; left: 0; transform-origin: bottom left; }
#convo-root[data-cnv-open="true"] .cnv-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.cnv-header {
  position: relative;
  padding: 20px 20px 18px;
  color: #fff;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255,255,255,0.18), rgba(255,255,255,0) 55%),
    linear-gradient(135deg, var(--cnv-accent-600), var(--cnv-accent-700));
  flex-shrink: 0;
  overflow: hidden;
}
.cnv-header::before {
  content: "";
  position: absolute;
  inset-block-start: -60%;
  inset-inline-end: -20%;
  inline-size: 220px; block-size: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 62%);
  pointer-events: none;
}
.cnv-header-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cnv-header-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cnv-avatar {
  inline-size: 46px; block-size: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.55);
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
}
.cnv-avatar .cnv-avatar-online {
  position: absolute;
  inline-size: 12px; block-size: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--cnv-accent-700);
  inset-block-end: 0; inset-inline-end: 0;
}
.cnv-avatar-wrap { position: relative; flex-shrink: 0; }
.cnv-title { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; line-height: 1.2; }
.cnv-subtitle { font-size: 13px; opacity: 0.92; margin-block-start: 2px; }
.cnv-header-actions { display: flex; gap: 4px; }
#convo-root .cnv-iconbtn {
  inline-size: 34px; block-size: 34px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  opacity: 0.9;
  transition: background 0.2s, opacity 0.2s;
}
#convo-root .cnv-iconbtn:hover { background: rgba(255,255,255,0.16); opacity: 1; }
.cnv-iconbtn svg { inline-size: 20px; block-size: 20px; }

/* Trust row */
.cnv-trust {
  display: flex; align-items: center; gap: 6px;
  margin-block-start: 14px;
  font-size: 12px;
  opacity: 0.92;
}
.cnv-trust svg { inline-size: 14px; block-size: 14px; }

/* Message log */
.cnv-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 18px 8px;
  background:
    radial-gradient(90% 60% at 100% 0%, var(--cnv-accent-soft), transparent 70%),
    var(--cnv-canvas);
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.cnv-log::-webkit-scrollbar { width: 8px; }
.cnv-log::-webkit-scrollbar-thumb { background: var(--cnv-border); border-radius: 8px; }
.cnv-log::-webkit-scrollbar-track { background: transparent; }

/* Row (bot or user) */
.cnv-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-block-start: 8px;
  max-inline-size: 100%;
}
.cnv-row-bot { flex-direction: row; }
.cnv-row-user { flex-direction: row-reverse; }

.cnv-row-avatar {
  inline-size: 30px; block-size: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--cnv-on-accent); font-weight: 700; font-size: 13px;
  align-self: flex-end;
}
.cnv-row-avatar.cnv-hidden-avatar { visibility: hidden; }

.cnv-bubble {
  max-inline-size: 78%;
  padding: 11px 15px;
  border-radius: var(--cnv-bubble-radius);
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  position: relative;
  animation: cnv-bubble-in 0.42s var(--cnv-ease) both;
}
.cnv-row-bot .cnv-bubble {
  background: var(--cnv-bot-bubble);
  color: var(--cnv-bot-text);
  border-start-start-radius: 6px;
}
.cnv-row-user .cnv-bubble {
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  color: var(--cnv-on-accent);
  border-start-end-radius: 6px;
  box-shadow: 0 6px 16px -10px var(--cnv-accent-600);
  font-weight: 600;
}
.cnv-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cnv-bubble p { margin: 0; }
.cnv-bubble p + p { margin-block-start: 8px; }

@keyframes cnv-bubble-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Timestamp under a group */
.cnv-time { font-size: 11px; color: var(--cnv-muted); margin: 2px 40px; }
.cnv-row-user + .cnv-time { text-align: start; }

/* Typing indicator */
.cnv-typing .cnv-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.cnv-dot {
  inline-size: 8px; block-size: 8px;
  border-radius: 50%;
  background: var(--cnv-muted);
  animation: cnv-typing 1.2s var(--cnv-ease-out) infinite;
}
.cnv-dot:nth-child(2) { animation-delay: 0.18s; }
.cnv-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes cnv-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Options (choice buttons), rendered inline after a bot message */
.cnv-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
  margin-inline-start: 38px; /* align under the bot bubble, past the avatar */
  animation: cnv-bubble-in 0.4s var(--cnv-ease) both;
  animation-delay: 0.08s;
}
#convo-root .cnv-option {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--cnv-panel);
  color: var(--cnv-accent-700);
  border: 1.5px solid var(--cnv-accent);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.2;
  transition: transform 0.16s var(--cnv-ease), background 0.16s, color 0.16s, box-shadow 0.16s;
  min-block-size: 42px;
  display: inline-flex; align-items: center; gap: 6px;
  /* Without a cap, a long label just grows the pill past the panel's
     width instead of wrapping (flex items default to their unwrapped
     max-content width). This forces the label span below to wrap. */
  max-inline-size: 100%;
  text-align: start;
}
#convo-root .cnv-option > span:not(.cnv-option-emoji) {
  white-space: normal;
  overflow-wrap: break-word;
}
#convo-root[data-cnv-theme="dark"] .cnv-option,
#convo-root[data-cnv-theme="auto"] .cnv-option { color: var(--cnv-accent); }
#convo-root .cnv-option:hover { background: var(--cnv-accent); color: var(--cnv-on-accent); transform: translateY(-2px); box-shadow: var(--cnv-shadow-sm); }
#convo-root .cnv-option:active { transform: translateY(0) scale(0.98); }
.cnv-option-emoji { font-size: 16px; }
.cnv-option svg { inline-size: 16px; block-size: 16px; flex-shrink: 0; }

/* Quick-reply "chips" variant lives in footer for input steps */
.cnv-footer {
  flex-shrink: 0;
  border-block-start: 1px solid var(--cnv-border);
  background: var(--cnv-panel);
  padding: 12px 14px;
  display: none;
}
.cnv-footer[data-mode="input"] { display: block; }

.cnv-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--cnv-canvas);
  border: 1.5px solid var(--cnv-border);
  border-radius: 16px;
  padding: 6px 6px 6px 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cnv-input-row:focus-within { border-color: var(--cnv-accent); box-shadow: 0 0 0 3px var(--cnv-accent-soft); }
.cnv-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--cnv-text);
  font-family: inherit;
  font-size: 15px;
  padding: 9px 10px;
  resize: none;
  max-block-size: 96px;
  outline: none;
}
.cnv-input::placeholder { color: var(--cnv-muted); }
#convo-root .cnv-send {
  inline-size: 40px; block-size: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  color: var(--cnv-on-accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.16s var(--cnv-ease), filter 0.16s;
}
.cnv-send:hover { transform: scale(1.06); }
.cnv-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.cnv-send svg { inline-size: 20px; block-size: 20px; }
.cnv-input-hint { font-size: 12px; color: var(--cnv-muted); margin: 6px 4px 0; min-height: 16px; }
.cnv-input-hint[data-error="true"] { color: #dc2626; }

/* Persistent privacy/consent disclaimer — shown throughout the conversation
   instead of a blocking checkbox. */
.cnv-disclaimer {
  padding: 9px 14px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--cnv-muted);
  background: var(--cnv-canvas);
  border-block-start: 1px solid var(--cnv-border);
  flex-shrink: 0;
}
.cnv-disclaimer a { color: var(--cnv-accent-700); text-decoration: underline; text-underline-offset: 2px; }
#convo-root[data-cnv-theme="dark"] .cnv-disclaimer a,
#convo-root[data-cnv-theme="auto"] .cnv-disclaimer a { color: var(--cnv-accent); }

/* Restart / end bar */
.cnv-endbar {
  display: none;
  padding: 12px 14px 8px;
  gap: 8px;
  flex-direction: column;
  align-items: stretch;
  background: var(--cnv-panel);
  border-block-start: 1px solid var(--cnv-border);
  flex-shrink: 0;
}
.cnv-endbar[data-show="true"] { display: flex; }
#convo-root .cnv-restart {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--cnv-accent-soft);
  color: var(--cnv-accent-700);
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.2s, transform 0.16s;
}
.cnv-restart svg { inline-size: 18px; block-size: 18px; flex-shrink: 0; }
#convo-root[data-cnv-theme="dark"] .cnv-restart,
#convo-root[data-cnv-theme="auto"] .cnv-restart { color: var(--cnv-accent); }
#convo-root .cnv-restart:hover { background: var(--cnv-accent); color: var(--cnv-on-accent); transform: translateY(-1px); }

/* Powered-by / footer credit */
.cnv-credit {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--cnv-muted);
  background: var(--cnv-panel);
  flex-shrink: 0;
}
.cnv-credit a { color: var(--cnv-muted); font-weight: 600; }

/* Welcome / start card (first screen) */
.cnv-welcome {
  padding: 22px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cnv-welcome-card {
  background: var(--cnv-panel);
  border: 1px solid var(--cnv-border);
  border-radius: var(--cnv-radius);
  padding: 18px;
  box-shadow: var(--cnv-shadow-sm);
  animation: cnv-bubble-in 0.5s var(--cnv-ease) both;
}
.cnv-welcome-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.cnv-welcome-card p { margin: 0; color: var(--cnv-muted); font-size: 14px; }
.cnv-welcome-agents { display: flex; align-items: center; gap: 8px; margin-block-start: 14px; }
.cnv-welcome-agents .cnv-mini-av {
  inline-size: 34px; block-size: 34px; border-radius: 50%;
  border: 2px solid var(--cnv-panel);
  margin-inline-start: -10px;
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--cnv-on-accent); font-weight: 700; font-size: 13px;
}
.cnv-welcome-agents .cnv-mini-av:first-child { margin-inline-start: 0; }
.cnv-start-btn {
  margin-block-start: 16px;
  inline-size: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--cnv-accent), var(--cnv-accent-600));
  color: var(--cnv-on-accent);
  font-weight: 800;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px -12px var(--cnv-accent-600);
  transition: transform 0.16s var(--cnv-ease), box-shadow 0.2s;
}
.cnv-start-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -14px var(--cnv-accent-600); }
.cnv-start-btn:active { transform: translateY(0) scale(0.99); }

/* Error / offline banner */
.cnv-banner {
  display: none;
  margin: 8px 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  border: 1px solid #fecaca;
  gap: 8px;
  align-items: center;
}
.cnv-banner[data-show="true"] { display: flex; }
.cnv-banner svg { inline-size: 18px; block-size: 18px; flex-shrink: 0; }

/* Screen-reader only */
.cnv-sr {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ *
 * Responsive — full-screen sheet on small viewports
 * ------------------------------------------------------------------ */
@media (max-width: 480px) {
  #convo-root { --cnv-gap: 14px; }
  .cnv-panel {
    position: fixed;
    inset: 0;
    right: 0;
    left: 0;
    inline-size: 100vw;
    max-inline-size: 100vw;
    block-size: 100dvh;
    max-block-size: 100dvh;
    border-radius: 0;
  }
  .cnv-teaser { max-inline-size: 60vw; }
  /* Larger touch targets on mobile — full-screen chat means the header
     buttons are the primary way to exit, so they need to meet the 44px
     minimum recommended touch-target size. */
  .cnv-iconbtn { inline-size: 44px; block-size: 44px; }
  .cnv-iconbtn svg { inline-size: 22px; block-size: 22px; }
  .cnv-send { inline-size: 44px; block-size: 44px; }
  .cnv-disclaimer { font-size: 12.5px; padding: 10px 16px; }
}

/* ------------------------------------------------------------------ *
 * Reduced motion & high contrast
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  #convo-root *,
  #convo-root *::before,
  #convo-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  #convo-root {
    --cnv-border: rgba(0,0,0,0.5);
    --cnv-bot-bubble: #e5e7eb;
    --cnv-muted: #374151;
  }
  .cnv-option { border-width: 2px; }
}
