.preview-stage {
  flex: 1; min-height: 0; width: 100%; position: relative;
  --phone-scale: .6;
}
.preview-stage > .preview-device {
  position: absolute; top: 0; left: 50%;
  width: 390px; height: 847.363636px; min-width: 0; max-width: none;
  flex: none; margin: 0; border: 6px solid #30343a; border-radius: 38px;
  transform: translateX(-50%) scale(var(--phone-scale));
  transform-origin: top center; background: #f7f7f7;
  box-shadow: 0 0 0 1px #82878e, 0 12px 32px #0003;
  overflow: hidden;
}
.preview-stage > .preview-device > #preview-host { height: 100%; }
.preview-column { padding-bottom: 16px; }
.preview-topline { flex-shrink: 0; }
.preview-stage .chat { border-radius: 30px; }
.preview-stage .chat-header { padding-top: 20px; }
.preview-stage .chat-composer { padding-bottom: 19px; }
.preview-stage .chat-name { font-size: 16px; }
.preview-stage .chat-status { font-size: 12px; }
.preview-stage .bubble, .preview-stage .chat-choice { font-size: 15px; }
.preview-stage .bubble-time { font-size: 10px; }
.preview-stage .composer-inner { min-height: 43px; }
.preview-stage .composer-inner input, .preview-stage .composer-placeholder { font-size: 15px; }

/* iOS-style conversation surfaces, with only the actions this funnel supports. */
.chat.whatsapp-light {
  --chatbg: #f3eee7; --chatheader: #fafafaf5; --chatheadtext: #151719;
  --bubble: #fff; --bubbletext: #171a1c; --user: #d8fdd2; --usertext: #142617;
  --inputbg: #f7f7f7f5; --inputfield: #fff; --inputtext: #697078; --accent: #087f52;
}
.chat.whatsapp {
  --chatbg: #0c1013; --chatheader: #171a1df5; --chatheadtext: #f7f9fa;
  --bubble: #22262b; --bubbletext: #f0f2f4; --user: #144b3b; --usertext: #f4fff6;
  --inputbg: #171a1df5; --inputfield: #282c31; --inputtext: #b7bec6; --accent: #20c47b;
}
.chat:is(.whatsapp-light,.whatsapp) .chat-header {
  border-bottom: 1px solid #81878d26; box-shadow: none; gap: 10px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.chat:is(.whatsapp-light,.whatsapp) .chat-header > div:not(.chat-header-actions) { min-width: 0; }
.chat:is(.whatsapp-light,.whatsapp) .chat-name { overflow-wrap: anywhere; }
.chat:is(.whatsapp-light,.whatsapp) .chat-status { color: var(--accent); opacity: 1; }
.chat:is(.whatsapp-light,.whatsapp) .chat-status .dot { background: var(--accent); }
.chat:is(.whatsapp-light,.whatsapp) .chat-header-actions button { color: var(--accent); opacity: 1; }
.chat:is(.whatsapp-light,.whatsapp) .bubble { border-radius: 13px; }
.chat:is(.whatsapp-light,.whatsapp) .bubble.user { border-radius: 13px; }
.chat:is(.whatsapp-light,.whatsapp) .business-label { background: #e5f4e7; color: #365744; box-shadow: none; border-radius: 9px; }
.chat.whatsapp .business-label { background: #1d3028; color: #c3dfd1; }
.chat:is(.whatsapp-light,.whatsapp) .chat-composer {
  gap: 0; border-top: 1px solid #81878d20;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.chat:is(.whatsapp-light,.whatsapp) .composer-inner { border: 1px solid #929aa338; padding: 4px 5px 4px 15px; }
.chat .composer-inner input { font-size: 16px; }
.chat .composer-placeholder { white-space: normal; line-height: 1.4; }
.chat .send-button { width: 34px; height: 34px; }
.chat .chat-header-actions { gap: 5px; }
.chat .chat-header-actions .icon-button { width: 28px; height: 30px; }
.public-chat { max-width: 440px; }
.chat-plans { display: grid; gap: 12px; width: 100%; }
.chat-plan-card { padding: 16px; border: 1px solid #89929b55; border-radius: 14px; background: var(--bubble, #fff); color: var(--bubbletext, #171a1c); }
.chat-plan-card h3 { margin: 0 0 9px; font-size: 16px; color: inherit; }
.chat-plan-card p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 13px; margin: 9px 0 14px; color: inherit; }
.chat-plan-price { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.chat-plan-price small { font-size: 12px; font-weight: 400; }
.chat-plan-card .chat-choice { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.public-chat .chat-header { padding-inline: 15px; }
.public-chat .chat-history { padding: 16px 14px 24px; }
.public-chat .chat-composer { padding-inline: 10px; }
.public-chat .bubble { max-width: 90%; }
.public-chat .bubble, .public-chat .chat-choice { font-size: 15px; }
.public-chat .composer-inner input { font-size: 16px; }
.public-chat .chat-status { font-size: 12px; }
@media (max-width: 800px) {
  .editor.mobile-preview .preview-column { padding: 10px 12px 12px; gap: 10px; }
  .editor.mobile-preview .preview-stage > .preview-device { border: 6px solid #30343a; border-radius: 38px; }
  .preview-stage .chat-history { padding-inline: 13px; }
}
@media (max-width: 520px) {
  .public-chat { max-width: none; }
  .public-chat .chat-header { padding-inline: 13px; }
}

/* Familiar WhatsApp iPhone chrome; the disabled controls are visual only. */
.chat .wa-system-bar { display: none; }
.preview-stage .wa-system-bar {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; flex-shrink: 0; height: 45px; padding: 10px 23px 4px;
  color: var(--chatheadtext); background: var(--chatheader);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.wa-system-time { font-size: 13px; font-weight: 650; padding-left: 5px; }
.wa-island { position: absolute; left: 50%; top: 9px; transform: translateX(-50%); width: 101px; height: 27px; border-radius: 20px; background: #050505; }
.wa-system-indicators { display: inline-flex; align-items: center; gap: 4px; }
.wa-system-indicators .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.wa-system-indicators .icon:last-child { width: 23px; height: 16px; }
.chat:is(.whatsapp-light,.whatsapp) .chat-header,
.preview-stage .chat:is(.whatsapp-light,.whatsapp) .chat-header {
  padding: 7px 9px 10px; gap: 7px; border: 0;
  background: var(--chatheader); min-height: 64px;
}
.chat .wa-decoration {
  display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0;
  border: 1px solid #a1a7ad35; border-radius: 50%; padding: 0;
  width: 34px; height: 36px; background: #ffffffbd; color: #262b30;
  box-shadow: 0 1px 3px #00000010; cursor: default;
}
.chat .wa-decoration:disabled { opacity: 1; cursor: default; }
.chat .wa-decoration .icon { width: 21px; height: 21px; stroke-width: 1.8; }
.chat .wa-back { width: 31px; height: 34px; }
.chat .wa-contact {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border: 1px solid #a1a7ad26; border-radius: 27px;
  background: #ffffffb3; box-shadow: 0 1px 4px #0000000b;
}
.chat .wa-contact .chat-avatar { width: 34px; height: 34px; font-size: 13px; }
.chat .wa-contact .chat-identity-text { flex: 1; min-width: 0; }
.chat .wa-contact .chat-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 650; }
.chat .wa-contact .chat-status { font-size: 10px; line-height: 1.3; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #57646d; }
.chat .wa-contact .chat-status .dot { width: 4px; height: 4px; }
.wa-contact-chevron { display: flex; color: #6b747c; }
.wa-contact-chevron .icon { width: 11px; height: 11px; }
.wa-call-controls { display: flex; gap: 5px; }
.wa-call-controls .wa-decoration { width: 31px; height: 34px; }
.wa-call-controls .icon { width: 18px; height: 18px; }
.chat.whatsapp .wa-decoration, .chat.whatsapp .wa-contact { background: #303439bf; color: #f6f7f9; border-color: #b6bec526; }
.chat.whatsapp .wa-contact .chat-status { color: #c5cbd0; }
.chat.whatsapp .wa-contact-chevron { color: #c5cbd0; }
.chat .wa-composer,
.chat:is(.whatsapp-light,.whatsapp) .wa-composer {
  align-items: center; gap: 6px; padding: 10px 9px calc(12px + env(safe-area-inset-bottom));
  background: var(--inputbg); border: 0;
}
.preview-stage .chat .wa-composer { padding-bottom: 26px; }
.chat:is(.whatsapp-light,.whatsapp) .wa-composer .composer-inner {
  min-height: 37px; padding: 3px 4px 3px 12px; border: 1px solid #a1a7ad46;
  background: var(--inputfield); border-radius: 26px;
  box-shadow: 0 1px 4px #0000000b;
}
.wa-composer .composer-placeholder { font-size: 13px; padding-block: 5px; }
.wa-composer .wa-decoration { background: var(--inputfield); }
.chat .wa-composer .wa-sticker { width: 25px; height: 27px; border: 0; box-shadow: none; background: transparent; }
.chat .wa-composer .wa-sticker .icon { width: 18px; height: 18px; }
.chat .wa-composer .wa-microphone { background: #22ca78; border-color: transparent; color: #062b1d; }
.chat .wa-composer .send-button { width: 34px; height: 36px; }
.chat .wa-composer .composer-inner input { min-width: 0; }
.chat [hidden] { display: none !important; }
.preview-stage .chat:is(.whatsapp-light,.whatsapp)::after {
  content: ''; position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 125px; height: 4px; border-radius: 8px; background: var(--chatheadtext); opacity: .8;
  pointer-events: none; z-index: 5;
}
