:root {
  --brand: #ea9001;
  --brand-dark: #c67a00;
  --brand-soft: rgba(234, 144, 1, 0.10);
  --ink: #190504;
  --ink-60: rgba(25, 5, 4, 0.6);
  --ink-40: rgba(25, 5, 4, 0.4);
  --paper: #faf6f0;
  --card: #fff;
  --bubble-bot: #f4eee6;
  --bubble-user: #ea9001;
  --bubble-user-ink: #fff;
  --head-bg: linear-gradient(180deg, rgba(234, 144, 1, 0.10), transparent 85%);
  --head-ink: #190504;
  --head-sub: rgba(25, 5, 4, 0.6);
  --composer-bg: transparent;
  --input-bg: #fdfcfa;
  --line: rgba(25, 5, 4, 0.08);
  --radius: 18px;
  --focus-ring: 0 0 0 3px rgba(234, 144, 1, 0.18);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(234, 144, 1, 0.12), transparent 70%),
    radial-gradient(40% 35% at 85% 90%, rgba(234, 144, 1, 0.07), transparent 70%),
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 100vh;
  overflow-x: clip;
}

/* ---------- Card shell ---------- */
.demo-card {
  width: 100%;
  max-width: 1180px;
  min-width: 0;
  height: calc(100vh - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 10px);
  box-shadow: 0 24px 60px -24px rgba(25, 5, 4, 0.25), 0 4px 16px -8px rgba(25, 5, 4, 0.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@supports (height: 100dvh) {
  .demo-card { height: calc(100dvh - 32px); }
}

/* ---------- Header ---------- */
.demo-head {
  padding: calc(14px + var(--sat)) calc(24px + var(--sar)) 12px calc(24px + var(--sal));
  border-bottom: 1px solid var(--line);
  background: var(--head-bg);
}
.head-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-wrap { position: relative; flex: 0 0 auto; }
.logo {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  box-shadow: 0 6px 14px -4px rgba(234, 144, 1, 0.55);
}
.presence {
  position: absolute; right: -2px; bottom: -2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #2fae4e;
  border: 2.5px solid var(--card);
}
.head-text { min-width: 0; }
.head-text h1 {
  font-size: 17px; font-weight: 700; letter-spacing: -0.2px;
  color: var(--head-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.head-text p { font-size: 13px; color: var(--head-sub); margin-top: 1px; }
.head-side {
  margin-left: auto; flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
}
.head-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid rgba(234, 144, 1, 0.35);
  border-radius: 999px;
  padding: 6px 11px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.head-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #2fae4e;
  box-shadow: 0 0 0 3px rgba(47, 174, 78, 0.18);
}
/* EN | বাং segmented control */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 2px;
  gap: 2px;
}
.lang-switch button {
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-60);
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 999px;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--ink); color: #fff;
}
.lang-switch button:focus-visible {
  box-shadow: var(--focus-ring);
}
.channels {
  margin-top: 10px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-40);
}
.channel-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-60);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.channel-pill svg { width: 12px; height: 12px; stroke: var(--brand-dark); flex: 0 0 auto; }
.channel-pill:hover { border-color: var(--brand); }
.channel-pill:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.channel-pill.hot { background: var(--brand); border-color: var(--brand); color: #fff; }
.channel-pill.hot svg { stroke: #fff; }

/* ---------- Offline banner ---------- */
.offline-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #3a2a12; color: #ffe9c4;
  font-size: 13px; font-weight: 600;
  padding: 9px 16px;
}
.offline-banner[hidden] { display: none; }

/* ---------- Messages ---------- */
.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
  padding: 20px 32px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.date-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-40); font-size: 12px; font-weight: 600;
}
.date-divider::before, .date-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.date-divider span {
  background: var(--bubble-bot);
  border-radius: 999px;
  padding: 3px 12px;
}
/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px;
  padding: 36px 16px 20px;
  color: var(--ink-60);
}
.empty-state[hidden] { display: none; }
.empty-state .bot-avatar {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
  box-shadow: 0 8px 18px -6px rgba(234, 144, 1, 0.55);
}
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state p { font-size: 14px; max-width: 44ch; }

/* Bubbles: 4px gap inside a group, 16px between groups */
.msg-row { display: flex; flex-direction: column; max-width: 70%; min-width: 0; }
.msg-row.bot { align-self: flex-start; align-items: flex-start; }
.msg-row.user { align-self: flex-end; align-items: flex-end; }
.msgs > .msg-row.grouped { margin-top: -12px; }
.bubble {
  padding: 12px 14px;
  max-width: min(100%, 65ch);
  min-width: 0;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  word-spacing: 0.05em;
}
.msg-row.bot .bubble { background: var(--bubble-bot); color: var(--ink); }
.msg-row.user .bubble {
  background: var(--bubble-user);
  color: var(--bubble-user-ink);
  box-shadow: 0 4px 10px -4px rgba(234, 144, 1, 0.5);
}
/* 4px tail on the first bubble of a group only */
.msg-row.bot.first .bubble { border-bottom-left-radius: 4px; }
.msg-row.user.first .bubble { border-bottom-right-radius: 4px; }
.msg-row.bot.grouped .bubble { border-radius: 14px; }
.msg-row.user.grouped .bubble { border-radius: 14px; }
.bubble a {
  color: var(--brand-dark);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(234, 144, 1, 0.4);
  text-underline-offset: 3px;
}
.msg-row.user .bubble a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.6); }
.bubble a:hover { text-decoration-color: currentColor; }
.bubble strong { font-weight: 700; }
.bubble .fmt-head {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin: 10px 0 6px;
}
.bubble > span { display: block; }
.bubble > span > .fmt-head:first-child { margin-top: 0; }
.bubble br { display: block; margin: 2px 0; }
.bubble br + br { margin-top: 8px; }

/* Single image bubbles: image sizes the bubble (WhatsApp pattern) */
.msg-row:has(> .bubble > img.msg-img) { width: min(300px, 100%); }
.msg-row:has(> .bubble > img.msg-img) > .bubble { width: 100%; overflow: hidden; }
.bubble img.msg-img {
  display: block;
  width: calc(100% + 28px);
  max-width: 300px;
  height: auto;
  min-height: 160px;
  max-height: 320px;
  object-fit: cover;
  margin: -12px -14px 10px;
  border-radius: 12px 12px 0 0;
  cursor: zoom-in;
  font-size: 13px;
  color: var(--ink-40);
  background: linear-gradient(110deg, #f0ebe4 8%, #f7f2eb 18%, #f0ebe4 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.bubble img.msg-img + img.msg-img { margin-top: 0; }
.bubble img.msg-img:only-child { border-radius: 12px; }
.bubble img.msg-img.loaded { animation: none; background: none; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- Product cards (images[] -> cards, not stacked walls) ---------- */
.pcards {
  display: flex; gap: 8px;
  overflow-x: auto;
  margin: 2px -4px 8px;
  padding: 4px;
  scrollbar-width: thin;
}
.pcard {
  flex: 0 0 168px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.msg-row.user .pcard { background: rgba(255, 255, 255, 0.16); border-color: transparent; }
.pcard img {
  width: 100%; height: 96px;
  object-fit: cover;
  display: block;
  background: #f0ebe4;
}
.pcard-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.pcard-name { font-size: 13px; font-weight: 600; line-height: 1.35; }
.pcard-actions { display: flex; gap: 6px; }
.pcard-actions a, .pcard-actions button {
  flex: 1;
  font: inherit; font-size: 12px; font-weight: 700;
  text-align: center; text-decoration: none;
  border-radius: 999px;
  padding: 8px 6px;
  min-height: 36px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pcard-actions a {
  border: 1px solid rgba(234, 144, 1, 0.45);
  color: var(--brand-dark);
  background: #fff;
}
.pcard-actions button {
  border: none;
  background: var(--brand); color: #fff;
}
.pcard-actions button:hover { background: var(--brand-dark); }

/* ---------- Voice-message player ---------- */
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 232px; }
.voice-play {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.28); color: #fff;
}
.msg-row.bot .voice-play { background: var(--brand); color: #fff; }
.voice-bars { flex: 1; display: flex; align-items: center; gap: 2px; height: 32px; cursor: pointer; }
.voice-bars i { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: currentColor; opacity: 0.35; }
.voice-bars i.on { opacity: 1; }
.voice-time { flex: 0 0 auto; font-size: 11px; opacity: 0.85; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }

/* Meta: one timestamp per group + quiet receipts (user only) */
.msg-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-40);
  display: flex; gap: 6px; align-items: baseline;
  padding: 0 4px;
}
.msg-meta .receipt { font-weight: 600; }
/* Internal pipeline meta stays out of the customer view */
details.debug { font-size: 12px; color: var(--ink-40); margin-top: 2px; padding: 0 4px; }
details.debug summary {
  cursor: pointer;
  font-size: 12px;
  min-height: 32px;
  display: inline-flex; align-items: center;
}
details.debug summary:focus-visible { box-shadow: var(--focus-ring); border-radius: 6px; }

/* Inline error row with Resend */
.send-error {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #9a3412;
  background: #fef3e6;
  border: 1px solid rgba(234, 144, 1, 0.4);
  border-radius: 12px;
  padding: 8px 12px;
  margin-top: 6px;
}
.send-error button {
  font: inherit; font-size: 13px; font-weight: 700;
  color: var(--brand-dark);
  background: none; border: none; cursor: pointer;
  padding: 8px 10px; min-height: 44px;
  text-decoration: underline; text-underline-offset: 3px;
}

/* Typing indicator */
.typing .bubble {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-60);
  font-size: 13px;
  background: var(--bubble-bot);
}
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  animation: blink 1.2s infinite ease-in-out;
}
.typing .dots i:nth-child(2) { animation-delay: 0.15s; }
.typing .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- Composer ---------- */
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--composer-bg);
  padding: 8px calc(24px + var(--sar)) calc(16px + var(--sab)) calc(24px + var(--sal));
}
.composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--input-bg);
  padding: 12px 18px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  max-height: 150px;
}
.composer textarea:focus { border-color: var(--brand); }
.composer textarea:focus-visible { box-shadow: var(--focus-ring); }
.icon-btn {
  flex: 0 0 auto;
  height: 44px; width: 44px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--input-bg);
  color: var(--brand-dark);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--brand-soft); }
.icon-btn:focus-visible { box-shadow: var(--focus-ring); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.recording {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-size: 13px; font-weight: 700;
}
.preview-strip {
  display: none;
  align-items: center; gap: 10px;
  padding: 0 24px 8px;
}
.preview-strip.show { display: flex; }
.preview-strip img {
  max-width: 96px; max-height: 96px;
  border-radius: 10px; border: 1px solid var(--line);
}
.preview-strip button {
  border: 1px solid var(--line); border-radius: 10px;
  background: #fdfcfa; cursor: pointer; padding: 6px 10px;
  min-height: 44px; min-width: 44px;
  font-size: 14px;
}
.send-btn {
  flex: 0 0 auto;
  height: 44px; width: 44px;
  border: none; border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  box-shadow: 0 6px 14px -6px rgba(234, 144, 1, 0.6);
}
.send-btn:hover { background: var(--brand-dark); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { background: #d9c9ae; box-shadow: none; cursor: default; opacity: 0.7; }
.send-btn:focus-visible { box-shadow: var(--focus-ring); }
.send-btn svg { width: 18px; height: 18px; }

.foot {
  padding: 0 24px calc(12px + var(--sab));
  text-align: center;
  font-size: 11px;
  color: var(--ink-40);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.toast {
  position: absolute;
  left: 50%; bottom: 88px;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 600;
  border-radius: 999px;
  padding: 10px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100% - 48px);
  text-align: center;
  z-index: 5;
}
.toast.show { opacity: 1; }

/* ---------- Mobile: full-bleed sheet ---------- */
@media (max-width: 640px) {
  body { padding: 0; }
  .demo-card {
    max-width: none;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .demo-head { padding: calc(12px + var(--sat)) calc(16px + var(--sar)) 10px calc(16px + var(--sal)); }
  .head-text h1 { font-size: 15px; }
  .head-badge { display: none; }
  .head-badge.mini { display: inline-flex; }
  .channels { margin-top: 8px; }
  .msgs { padding: 16px 16px 8px; gap: 16px; }
  .msg-row { max-width: 85%; }
  .composer { padding: 8px calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal)); }
  .composer textarea { font-size: 16px; }
  .preview-strip { padding: 0 12px 8px; }
  .foot { padding: 0 12px calc(10px + var(--sab)); }
}
@supports (height: 100dvh) {
  @media (max-width: 640px) {
    .demo-card { height: 100dvh; }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .msgs { scroll-behavior: auto; }
}

/* ---------- Channel skins (web/demo/DESIGN.md §3) ----------
   body[data-channel] overrides the :root tokens above; web (default) is
   untouched. Bubble entry motion is stateful (≤180ms) and scoped to the
   channel skins; reduced-motion above still silences it. */
body[data-channel]:not([data-channel="web"]) .msg-row {
  animation: msgIn 0.16s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ----- Messenger: light, blue accent ----- */
body[data-channel="messenger"] {
  --brand: #006AFF;
  --brand-dark: #0052CC;
  --brand-soft: rgba(0, 106, 255, 0.12);
  --ink: #050505;
  --ink-60: rgba(5, 5, 5, 0.6);
  --ink-40: rgba(5, 5, 5, 0.4);
  --paper: #FFFFFF;
  --card: #FFFFFF;
  --bubble-bot: #F0F0F0;
  --bubble-user: linear-gradient(135deg, #00B2FF, #006AFF);
  --bubble-user-ink: #fff;
  --head-bg: #FFFFFF;
  --head-ink: #050505;
  --head-sub: #65676B;
  --composer-bg: #FFFFFF;
  --input-bg: #F0F0F0;
  --line: rgba(5, 5, 5, 0.10);
  --focus-ring: 0 0 0 3px rgba(0, 106, 255, 0.25);
  background: #FFFFFF;
}
body[data-channel="messenger"] .msgs { background: #FFFFFF; }
body[data-channel="messenger"] .logo { background: var(--brand); box-shadow: 0 6px 14px -4px rgba(0, 106, 255, 0.55); }
body[data-channel="messenger"] .empty-state .bot-avatar { background: var(--brand); box-shadow: 0 8px 18px -6px rgba(0, 106, 255, 0.55); }
body[data-channel="messenger"] .msg-row.user .bubble { box-shadow: 0 4px 10px -4px rgba(0, 106, 255, 0.5); }
body[data-channel="messenger"] .msg-meta { color: #65676B; }
body[data-channel="messenger"] .bubble a { color: var(--brand-dark); text-decoration-color: rgba(0, 106, 255, 0.4); }
body[data-channel="messenger"] .msg-row.user .bubble a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.6); }
body[data-channel="messenger"] .send-btn { box-shadow: 0 6px 14px -6px rgba(0, 106, 255, 0.6); }
body[data-channel="messenger"] .send-btn:disabled { background: #bcc9d6; }
body[data-channel="messenger"] .typing .dots i { background: var(--brand); }

/* ----- WhatsApp: teal header, beige doodle wallpaper, green ticks ----- */
body[data-channel="whatsapp"] {
  --brand: #00A884;
  --brand-dark: #008069;
  --brand-soft: rgba(0, 168, 132, 0.14);
  --ink: #111B21;
  --ink-60: rgba(17, 27, 33, 0.6);
  --ink-40: rgba(17, 27, 33, 0.4);
  --paper: #D9DBD4;
  --card: #FFFFFF;
  --bubble-bot: #FFFFFF;
  --bubble-user: #DCF8C6;
  --bubble-user-ink: #111B21;
  --head-bg: linear-gradient(180deg, #075E54, #128C7E);
  --head-ink: #FFFFFF;
  --head-sub: rgba(255, 255, 255, 0.85);
  --composer-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --radius: 12px;
  --line: rgba(17, 27, 33, 0.10);
  --focus-ring: 0 0 0 3px rgba(0, 168, 132, 0.25);
  background: #D9DBD4;
}
body[data-channel="whatsapp"] .msgs {
  background-color: #ECE5DD;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg fill='none' stroke='%23111B21' stroke-opacity='0.055' stroke-width='2'%3E%3Ccircle cx='20' cy='22' r='8'/%3E%3Cpath d='M60 28l10 10-10 10-10-10z'/%3E%3Ccircle cx='112' cy='68' r='6'/%3E%3Cpath d='M18 102q10-10 20 0t20 0'/%3E%3Crect x='82' y='102' width='16' height='16' rx='4'/%3E%3Ccircle cx='52' cy='76' r='3'/%3E%3Cpath d='M100 16q8 8 0 16'/%3E%3C/g%3E%3C/svg%3E");
}
body[data-channel="whatsapp"] .head-row::before {
  content: ""; flex: 0 0 auto;
  width: 10px; height: 10px; margin-right: -2px;
  border-left: 2.5px solid var(--head-ink); border-bottom: 2.5px solid var(--head-ink);
  transform: rotate(45deg);
}
body[data-channel="whatsapp"] .logo { background: rgba(255, 255, 255, 0.18); box-shadow: none; }
body[data-channel="whatsapp"] .presence { border-color: #0b6b60; }
body[data-channel="whatsapp"] .head-badge { color: #fff; background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.3); }
body[data-channel="whatsapp"] .lang-switch { background: rgba(255, 255, 255, 0.15); border-color: transparent; }
body[data-channel="whatsapp"] .lang-switch button { color: rgba(255, 255, 255, 0.85); }
body[data-channel="whatsapp"] .lang-switch button[aria-pressed="true"] { background: #fff; color: #075E54; }
body[data-channel="whatsapp"] .channels { color: rgba(255, 255, 255, 0.75); }
body[data-channel="whatsapp"] .channel-pill { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.55); color: #fff; }
body[data-channel="whatsapp"] .channel-pill svg { stroke: #fff; }
body[data-channel="whatsapp"] .channel-pill:hover { background: rgba(255, 255, 255, 0.24); border-color: #fff; }
body[data-channel="whatsapp"] .channel-pill.hot { background: #fff; border-color: #fff; color: #075E54; }
body[data-channel="whatsapp"] .channel-pill.hot svg { stroke: #075E54; }
body[data-channel="whatsapp"] .date-divider span { background: #FFFFFF; }
body[data-channel="whatsapp"] .msg-row.bot.first .bubble { border-bottom-left-radius: var(--radius); border-top-left-radius: 4px; }
body[data-channel="whatsapp"] .msg-row.user.first .bubble { border-bottom-right-radius: var(--radius); border-top-right-radius: 4px; }
body[data-channel="whatsapp"] .msg-row.user .bubble { box-shadow: 0 1px 1px rgba(17, 27, 33, 0.15); }
body[data-channel="whatsapp"] .msg-row.bot .bubble { box-shadow: 0 1px 1px rgba(17, 27, 33, 0.12); }
body[data-channel="whatsapp"] .msg-meta { color: #667781; }
body[data-channel="whatsapp"] .msg-row.user .receipt { font-size: 0; }
body[data-channel="whatsapp"] .msg-row.user .receipt::after {
  content: "\2713\2713";
  font-size: 13px; font-weight: 700; letter-spacing: -3px; margin-right: 3px;
  color: #53BDEB;
}
body[data-channel="whatsapp"] .bubble a { color: var(--brand-dark); text-decoration-color: rgba(0, 128, 105, 0.4); }
body[data-channel="whatsapp"] .msg-row.user .bubble a { color: #111B21; text-decoration-color: rgba(17, 27, 33, 0.5); }
body[data-channel="whatsapp"] .composer { border-top: 1px solid var(--line); }
body[data-channel="whatsapp"] .send-btn { box-shadow: 0 6px 14px -6px rgba(0, 168, 132, 0.6); }
body[data-channel="whatsapp"] .send-btn:disabled { background: #a8c4bc; }
body[data-channel="whatsapp"] .typing .dots i { background: var(--brand); }
body[data-channel="whatsapp"] .empty-state .bot-avatar { background: var(--brand); box-shadow: 0 8px 18px -6px rgba(0, 168, 132, 0.55); }

/* ----- Instagram: white, gradient outgoing, story-ring avatar ----- */
body[data-channel="instagram"] {
  --brand: #DD2A7B;
  --brand-dark: #B01E63;
  --brand-soft: rgba(221, 42, 123, 0.12);
  --ink: #000000;
  --ink-60: rgba(0, 0, 0, 0.6);
  --ink-40: rgba(0, 0, 0, 0.4);
  --paper: #FFFFFF;
  --card: #FFFFFF;
  --bubble-bot: #EFEFEF;
  --bubble-user: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF);
  --bubble-user-ink: #fff;
  --head-bg: #FFFFFF;
  --head-ink: #000000;
  --head-sub: #737373;
  --composer-bg: #FFFFFF;
  --input-bg: #EFEFEF;
  --line: rgba(0, 0, 0, 0.10);
  --focus-ring: 0 0 0 3px rgba(221, 42, 123, 0.25);
  background: #FFFFFF;
}
body[data-channel="instagram"] .msgs { background: #FFFFFF; }
body[data-channel="instagram"] .logo-wrap {
  padding: 3px; border-radius: 17px;
  background: conic-gradient(#FEDA75, #FA7E1E, #D62976, #962FBF, #4F5BD5);
}
body[data-channel="instagram"] .logo { background: #000; box-shadow: none; }
body[data-channel="instagram"] .presence { right: 1px; bottom: 1px; }
body[data-channel="instagram"] .head-text h1::after {
  content: "\2713";
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #0095F6; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  margin-left: 6px; vertical-align: 2px;
}
body[data-channel="instagram"] .head-row::before {
  content: ""; flex: 0 0 auto;
  width: 10px; height: 10px; margin-right: -2px;
  border-left: 2.5px solid var(--head-ink); border-bottom: 2.5px solid var(--head-ink);
  transform: rotate(45deg);
}
body[data-channel="instagram"] .empty-state .bot-avatar {
  background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF);
  box-shadow: 0 8px 18px -6px rgba(221, 42, 123, 0.55);
}
body[data-channel="instagram"] .msg-row.user .bubble { box-shadow: 0 4px 12px -4px rgba(221, 42, 123, 0.45); }
body[data-channel="instagram"] .bubble a { color: var(--brand-dark); text-decoration-color: rgba(221, 42, 123, 0.4); }
body[data-channel="instagram"] .msg-row.user .bubble a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.6); }
body[data-channel="instagram"] #attach {
  background: linear-gradient(135deg, #7B2FF7, #C13584);
  border-color: transparent; color: #fff;
}
body[data-channel="instagram"] .send-btn {
  background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF);
  box-shadow: 0 6px 14px -6px rgba(221, 42, 123, 0.6);
}
body[data-channel="instagram"] .send-btn:disabled { background: #d8b9c6; }
body[data-channel="instagram"] .typing .dots i { background: var(--brand); }
