:root {
  color: #033347;
  background: #f2f7f7;
  font-family: 'Lato', 'Segoe UI', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: #f2f7f7;
}

/* Embedded (client-site iframe): full-bleed, no page scrollbars. The shell
   owns internal scrolling; the body must never overflow the iframe. */
html, body { height: 100%; }
body.embed-mode {
  min-height: 0;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  display: block;
  background: #f2f7f7;
}

.widget-preview {
  width: min(420px, calc(100% - 48px));
  padding: 28px;
  border: 1px solid #d8e8ea;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(25, 45, 82, 0.12);
}

.eyebrow {
  margin: 0;
  color: #2a8e9e;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1 {
  margin: 8px 0;
  font-size: 1.45rem;
}

.chat-shell {
  width: min(444px, 100%);
  height: min(690px, calc(100vh - 48px));
  min-height: 530px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d8e8ea;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(34, 45, 67, 0.12);
}

/* Embed: the iframe is the viewport — shell fills it edge-to-edge with no
   outer border/shadow/rounding (the embed frame draws those). */
body.embed-mode .chat-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #e9f1f2;
  background: #ffffff;
}

.chat-header h1 {
  margin: 0;
  line-height: 1.2;
  color: #033347;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.assistant-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.assistant-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
  border-radius: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #63728a;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #eba937;
}

.status.ready {
  color: #12834a;
}

.status.ready i {
  background: #22c76d;
  box-shadow: 0 0 0 3px #e4f8ed;
}

.status.error {
  color: #be3449;
}

.status.error i {
  background: #e65060;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 14px;
  background: #ffffff;
}

/* Scrollbar hidden by default; slim brand-tinted line appears only while
   hovering the message list (scroll itself always works via wheel/touch). */
.messages {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.messages:hover {
  scrollbar-color: rgba(42, 142, 158, 0.4) transparent;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  border: none;
  border-radius: 999px;
  background: transparent;
}

.messages:hover::-webkit-scrollbar-thumb {
  background: rgba(42, 142, 158, 0.4);
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(42, 142, 158, 0.6);
}

.welcome-panel {
  margin: 0 auto 16px;
  max-width: 360px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.welcome-panel h2 {
  margin: 0;
  color: #20232a;
  font-size: 1.18rem;
  line-height: 1.25;
}

.welcome-panel p {
  margin: 0;
  color: #3e4350;
  font-size: 0.9rem;
  line-height: 1.42;
}

.quick-actions {
  margin: 0;
}

.quick-actions p {
  margin: 0 0 10px;
  color: #223250;
  font-size: 0.84rem;
  font-weight: 800;
}

.quick-action {
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #dce9eb;
  border-radius: 12px;
  background: #ffffff;
  color: #233653;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.quick-action:hover {
  border-color: #c8bdfd;
  box-shadow: 0 8px 18px rgba(124, 87, 247, 0.11);
  transform: translateY(-1px);
}

.quick-action strong {
  overflow-wrap: anywhere;
  display: block;
  color: #033347;
  font-size: 0.84rem;
}

.quick-action > span:not(.action-icon) {
  min-width: 0;
}

.quick-action small {
  overflow-wrap: anywhere;
  display: block;
  margin-top: 2px;
  color: #75849a;
  font-size: 0.72rem;
}

.quick-action b {
  color: #7b8aa2;
  font-size: 1rem;
  font-weight: 700;
}

.primary-action {
  grid-template-columns: 48px minmax(0, 1fr) 16px;
  min-height: 76px;
  border-color: #c9c0ff;
  background: #eceaff;
}

.primary-action strong {
  font-size: 0.9rem;
}

.primary-action small {
  color: #655f7a;
}

.action-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #eff5f5;
  color: #2a8e9e;
  font-size: 0.78rem;
  font-weight: 800;
}

.primary-action .action-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #2a8e9e;
  color: #ffffff;
}

.explore-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 30px 0;
  color: #707480;
  font-size: 0.78rem;
}

.explore-divider span {
  height: 1px;
  background: #eceff5;
}

.explore-divider em {
  font-style: normal;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(85px, 100%), 1fr));
  gap: 12px;
}

.explore-action {
  min-height: 88px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

[data-widget-actions][hidden], .explore-divider[hidden], .starter-questions[hidden], .initial-greeting[hidden] { display: none !important; }
.conversation-intro { display:flex; flex-direction:column; gap:10px; margin-block:24px 18px; min-width:0; }
.conversation-intro[hidden] { display:none !important; }
.conversation-intro .initial-greeting { margin:0; }
.conversation-intro .starter-questions { margin:0; }
.starter-questions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 10px 0 18px; width: 100%; }
.starter-question { width: min(100%, 290px); border: 1px solid var(--vlab-teal, #16798a); border-radius: 10px; padding: 10px 14px; background: var(--vlab-surface, white); color: var(--vlab-ink, #12333f); font: inherit; line-height: 1.45; text-align: start; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.starter-question:hover { background: var(--vlab-surface-2, #eaf5f7); }
.starter-question:focus-visible { outline: 2px solid var(--vlab-teal, #16798a); outline-offset: 3px; }
.starter-question:active { transform: translateY(1px); }
.message-pending { opacity: .75; }
.welcome-panel[hidden], .quick-actions[hidden], .self-service[hidden], [data-support-action][hidden], #support-toggle { display: none !important; }
[data-widget-actions="featured"] { display: grid; gap: 10px; }
.quick-action { text-decoration: none; }
.widget-footer-actions { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.widget-footer-action { display: inline-flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }
.self-service { flex-wrap: wrap; gap: 8px 14px; }

.explore-action .action-icon {
  margin: 0 auto;
  border-radius: 999px;
  background: #fff1e4;
}

.explore-action strong {
  font-size: 0.78rem;
  font-weight: 500;
}

.action-icon.match {
  color: #7444cc;
  background: #fff1e4;
}

.action-icon.migration {
  color: #087a70;
  background: #e3f6f2;
}

.action-icon.domain {
  color: #a86613;
  background: #fff2de;
}

.message {
  box-sizing: border-box;
  width: fit-content;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 86%;
  margin: 0 0 11px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 5px 14px rgba(38, 67, 113, 0.07);
}

.assistant-message {
  border-bottom-left-radius: 5px;
  border-color: #e1e9f8;
  background: #eef4ff;
  color: #183464;
}

.human-message {
  border-bottom-left-radius: 5px;
  border-color: #d8f0e4;
  background: #eaf8f1;
  color: #135d3b;
}

/* Sender names remain inside their message bubble, including long names. */
.msg-sender {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  margin-bottom: 3px;
  opacity: 0.75;
}

.visitor-message {
  margin-left: auto;
  margin-right: 0;
  border-bottom-right-radius: 5px;
  background: #2f65f5;
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(47, 101, 245, 0.18);
}

.system-message {
  margin-right: auto;
  padding: 8px 10px;
  border-color: #e6ebf4;
  border-radius: 10px;
  background: #ffffff;
  color: #61708a;
  font-size: 0.76rem;
  box-shadow: none;
}

.transcript-form {
  margin: 12px 0 14px;
  padding: 13px;
  border: 1px solid #dce9eb;
  border-radius: 13px;
  background: #fbfcff;
}

.transcript-form p {
  margin: 0 0 10px;
  color: #033347;
  font-size: 0.84rem;
  line-height: 1.35;
}

.transcript-form div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.transcript-form input {
  min-width: 0;
  border: 1px solid #d8e8ea;
  border-radius: 10px;
  padding: 10px 11px;
  color: #033347;
  font: inherit;
  font-size: 0.84rem;
  outline: none;
}

.transcript-form input:focus {
  border-color: #57a9b5;
  box-shadow: 0 0 0 3px #e0f1f2;
}

.transcript-form button {
  border: 0;
  border-radius: 10px;
  padding: 0 13px;
  background: #2a8e9e;
  color: #ffffff;
  font-weight: 800;
}

.transcript-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.transcript-form small {
  display: block;
  margin-top: 8px;
  color: #7e9aa1;
  font-size: 0.68rem;
  line-height: 1.35;
}

.transcript-confirmation {
  margin: 12px 0 14px;
  padding: 11px 13px;
  border: 1px solid #cdebd8;
  border-radius: 13px;
  background: #f0fbf4;
  color: #15803d;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
}

.rating-form {
  margin: 12px 0 14px;
  padding: 13px;
  border: 1px solid #dce9eb;
  border-radius: 13px;
  background: #fbfcff;
}

.rating-form p {
  margin: 0 0 10px;
  color: #033347;
  font-size: 0.84rem;
}

.rating-stars {
  display: flex;
  gap: 7px;
  margin-bottom: 10px;
}

.rating-stars button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d8e8ea;
  border-radius: 999px;
  background: #fff;
  color: #7e9aa1;
  cursor: pointer;
  font-weight: 800;
}

.rating-stars button.selected {
  border-color: #f0b429;
  background: #fff8e1;
  color: #9a6500;
}

.rating-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid #d8e8ea;
  border-radius: 10px;
  padding: 10px 11px;
  color: #033347;
  font: inherit;
  font-size: 0.84rem;
  outline: none;
}

.rating-submit {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px;
  background: #2a8e9e;
  color: #fff;
  font-weight: 800;
}

.rating-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  margin: 0;
  padding: 7px 17px 0;
  border-top: 1px solid #e9f2f3;
  background: #ffffff;
  color: #55745e;
  font-size: 0.76rem;
  font-style: italic;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #27a55e;
  animation: typing-dot 1.1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

.typing-indicator[hidden] {
  display: none;
}

.self-service {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 17px 0;
  border-top: 1px solid #e9f2f3;
  background: #ffffff;
}

.self-service a,
.self-service button {
  border: 0;
  background: none;
  color: #2a8e9e;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 750;
  text-decoration: none;
}

.self-service a {
  margin-right: auto;
}

.self-service button:disabled {
  color: #98a6bd;
  cursor: not-allowed;
}

.support-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  background: #eef3ff;
  color: #2a8e9e;
}

.support-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  animation: support-status-pulse 1.6s infinite;
}

.support-status.live {
  background: #e7f7ee;
  color: #15803d;
}

.support-status.live::before {
  background: #22c55e;
}

.support-status[hidden] {
  display: none;
}

@keyframes support-status-pulse {
  50% { opacity: 0.35; }
}

.message-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 11px 16px 8px;
  background: #ffffff;
}

.message-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 92px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 11px 13px;
  outline: none;
  color: #033347;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
}

.message-form textarea:focus {
  box-shadow: none;
}

.message-form button {
  display: grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0 12px;
  background: #f0f1f5;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
}

.message-form button span {
  color: #9096a3;
}

.message-form button:disabled {
  cursor: wait;
  opacity: 0.62;
}

/* Send button: gray/inactive while the input is empty, brand teal once the
   visitor has typed something. The .sending class marks an in-flight send. */
.message-form #send-button {
  background: #e9eef0;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.message-form #send-button:enabled {
  background: #2a8e9e;
  box-shadow: 0 3px 10px rgba(42, 142, 158, 0.32);
}

.message-form #send-button:enabled span {
  color: #ffffff;
}

.message-form #send-button:disabled {
  cursor: default;
  opacity: 1;
}

.message-form #send-button.sending {
  cursor: wait;
  opacity: 0.62;
}

.support-toggle {
  margin: 0 18px 10px;
  border: 0;
  background: none;
  color: #2a8e9e;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
}

.support-title {
  margin: 0 0 2px;
  color: #033347;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.support-title button {
  flex: none;
  border: 0;
  background: none;
  color: #64748b;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.support-title button:hover {
  color: #0f172a;
}

.support-form {
  display: grid;
  gap: 8px;
  margin: 0 17px 10px;
  padding: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
}

.support-form[hidden] {
  display: none;
}

.support-title {
  margin: 0 0 2px;
  color: #033347;
  font-weight: 800;
}

.support-form input,
.support-form textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
  font: inherit;
}

.support-form input:focus,
.support-form textarea:focus {
  border-color: #57a9b5;
  box-shadow: 0 0 0 3px #e0f1f2;
}

.support-form button {
  border: 0;
  border-radius: 10px;
  padding: 10px;
  background: #033347;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.consent {
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.35;
}

.privacy-note {
  overflow-wrap: anywhere;
  margin: 0;
  padding: 0 18px 14px;
  background: #ffffff;
  color: #7e9aa1;
  font-size: 0.68rem;
  line-height: 1.35;
}

/* --- Professional polish: subtle transitions + refined focus states --- */
.chat-shell { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.quick-action, .self-service a, .self-service button, .message-form button {
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.messages::-webkit-scrollbar { transition: background 0.2s ease; }

.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;
}

/* ---------- Incoming call overlay ---------- */
.call-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #033347e6;
  backdrop-filter: blur(3px);
}

.call-overlay[hidden] {
  display: none;
}

.call-card {
  width: min(280px, 100%);
  padding: 26px 22px 22px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 24px 64px #03334766;
  text-align: center;
}

.call-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
  animation: call-ring 1.3s infinite ease-in-out;
}

@keyframes call-ring {
  50% { transform: translateY(-4px); box-shadow: 0 16px 34px #2a8e9e40; }
}

.call-eyebrow {
  margin: 0 0 3px;
  color: #2a8e9e;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.call-card h3 {
  margin: 0 0 6px;
  color: #033347;
  font-size: 1.05rem;
}

.call-sub {
  margin: 0;
  color: #5a6b8c;
  font-size: 0.8rem;
  line-height: 1.45;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.call-actions button {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
}

#call-decline {
  background: #fdebee;
  color: #c22b49;
}

#call-accept {
  background: linear-gradient(135deg, #16a36a, #0f8a58);
  color: #ffffff;
}

/* ---------- Active call bar ---------- */
.active-call {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, #033347, #22355e);
  box-shadow: 0 14px 36px #03334755;
  color: #ffffff;
  font-size: 0.78rem;
}

.active-call[hidden] {
  display: none;
}

.active-call .call-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16a36a;
  box-shadow: 0 0 0 0 #16a36a66;
  animation: call-pulse 1.4s infinite;
}

.active-call strong {
  font-weight: 800;
}

#call-timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #9fc0ff;
}

.active-call button {
  border: 1px solid #ffffff33;
  border-radius: 9px;
  padding: 6px 10px;
  background: #ffffff14;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.active-call #call-end {
  border-color: #f3c2cb;
  background: #d9435f;
}

@keyframes call-pulse {
  70% { box-shadow: 0 0 0 10px #16a36a00; }
  100% { box-shadow: 0 0 0 0 #16a36a00; }
}

@keyframes typing-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* --- Start a new chat (clear conversation) --- */
.clear-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--vlab-ink, #033347);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.clear-chat-btn:hover {
  background: #eef1f5;
  color: #033347;
}

.clear-chat-btn[hidden] {
  display: none;
}

.clear-chat-btn:focus-visible {
  outline: 2px solid #033347;
  outline-offset: 2px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 24, 38, 0.45);
}

.modal-overlay[hidden] {
  display: none;
}

.new-chat-dialog {
  width: 100%;
  max-width: 340px;
  padding: 28px 24px 22px;
  border-radius: 16px;
  background: var(--vlab-surface, #ffffff);
  box-shadow: 0 18px 50px rgba(3, 51, 71, 0.2);
  text-align: center;
  font-family: inherit;
}

.new-chat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #e0f1f2;
  color: #2a8e9e;
}

.new-chat-dialog h3 {
  margin: 0 0 8px;
  color: var(--vlab-ink, #033347);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0;
}

.new-chat-dialog p {
  margin: 0 0 22px;
  color: var(--vlab-muted, #5b7a82);
  font-size: 0.9rem;
  line-height: 1.5;
}

.new-chat-actions {
  display: flex;
  gap: 10px;
}

.new-chat-actions button {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

#keep-chat-btn {
  border: 1px solid var(--vlab-line, #d8e8ea);
  background: var(--vlab-surface-2, #ffffff);
  color: var(--vlab-ink, #033347);
}

#keep-chat-btn:hover {
  background: #f2f7f7;
}

#start-new-chat-btn {
  border: 1px solid #033347;
  background: #033347;
  color: #ffffff;
}

#start-new-chat-btn:hover {
  background: #145c6a;
}

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .chat-shell {
    height: calc(100vh - 24px);
    min-height: 500px;
    border-radius: 18px;
  }

  .messages {
    padding: 14px;
  }

  .quick-action {
    grid-template-columns: 32px 1fr auto;
  }
  .quick-action.primary-action {
    grid-template-columns: 46px minmax(0, 1fr) 16px;
  }
}

/* Blinking "..." bubble while Vion is generating the reply. */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  min-width: 0;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2a8e9e;
  animation: typing-dot 1.1s infinite ease-in-out;
}

.ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Override .message padding for the typing indicator */
.ai-typing.message {
  padding: 8px 10px;
  max-width: fit-content;
  background: transparent;
  border: none;
  box-shadow: none;
}


/* --- i18n language selector --- */
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,0.08); color: inherit;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 8px;
  font: inherit; font-size: 12px; padding: 3px 18px 3px 8px;
  cursor: pointer; max-width: 92px;
}
.lang-select option { color: #111; }

/* --- Accessible widget controls: scoped to the existing widget only. --- */
.chat-shell { position: relative; }
.chat-header { position: relative; flex: 0 0 auto; gap: 8px; }
.widget-header-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.chat-header .clear-chat-btn, .chat-header .widget-icon-button { color: var(--vlab-ink, #033347); }
.chat-header .clear-chat-btn:hover, .chat-header .widget-icon-button:hover { background: var(--vlab-surface-2, #eaf5f7); color: var(--vlab-ink, #033347); }
.widget-icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 9px; padding: 0; color: var(--vlab-ink, #033347); background: transparent; cursor: pointer; flex: 0 0 44px; }
.widget-icon-button:hover { background: var(--vlab-surface-2, #eaf5f7); }
.widget-icon-button:focus-visible, .widget-popover button:focus-visible, .attach-button:focus-visible { outline: 2px solid var(--vlab-teal, #16798a); outline-offset: 2px; }
.widget-popover { position: absolute; z-index: 100; border: 1px solid var(--vlab-line, #cbdfe3); border-radius: 10px; background: var(--vlab-surface, white); color: var(--vlab-ink, #033347); box-shadow: 0 8px 24px #07263430; overflow-y: auto; max-height: calc(100dvh - 100px); }
.widget-menu { top: calc(100% - 4px); right: 8px; width: min(240px, calc(100vw - 24px)); padding: 6px; }
.widget-menu-item { display: block; width: 100%; min-height: 44px; border: 0; border-radius: 6px; padding: 10px 14px; text-align: start; font: inherit; color: inherit; background: transparent; cursor: pointer; }
.widget-menu-item:hover { background: var(--vlab-surface-2, #eaf5f7); }
.widget-name-panel { top: calc(100% - 4px); right: 8px; width: min(300px, calc(100vw - 24px)); padding: 14px; }
.widget-name-panel label { display: grid; gap: 8px; }
.widget-name-panel input { width: 100%; min-width: 0; border: 1px solid var(--vlab-line, #cbdfe3); border-radius: 7px; padding: 10px; color: inherit; background: var(--vlab-surface-2, #eaf5f7); font: inherit; }
.widget-name-panel button { min-height: 44px; border: 1px solid var(--vlab-line, #cbdfe3); padding: 8px 14px; border-radius: 7px; background: var(--vlab-surface-2, #eaf5f7); color: inherit; font: inherit; cursor: pointer; }
.widget-control-note, .widget-control-status, .visitor-alias-note { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.visitor-alias-note { margin: 0; padding: 4px 14px; flex-shrink: 0; color: var(--vlab-muted, #63728a); }
.message-form { position: relative; flex: 0 0 auto; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; padding: 8px; }
.widget-startup { padding:14px; display:flex; align-items:center; gap:10px; color:var(--vlab-muted, #63728a); font-size:14px; }
.widget-startup[hidden] { display:none; }
.widget-startup button { min-height:44px; padding:8px 14px; border:1px solid var(--vlab-line); border-radius:8px; background:var(--vlab-surface-2); color:var(--vlab-ink); }
.widget-startup button:focus-visible { outline:2px solid var(--vlab-teal); outline-offset:2px; }
.message-form textarea { min-width: 0; padding: 11px 4px; }
.message-form .widget-icon-button, .message-form .attach-button { width: 44px; height: 44px; min-width: 44px; padding: 0; display: grid; border-radius: 9px; color: var(--vlab-ink, #033347); background: transparent; }
.message-form #send-button { width: 44px; min-width: 44px; height: 44px; padding: 0; }
.attach-row { flex: 0 0 auto; }
.self-service, .privacy-note { flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .widget-popover, .widget-icon-button, .starter-question { transition: none; transform: none; } }

/* --- Attachments --- */
/* The clip button and the pending-file name live on their own row above the
   typing line, so the message input row stays clean. */
.attach-row {
  display: flex; align-items: center; gap: 8px;
  margin: 0 12px; padding: 4px 2px 2px; min-height: 30px;
}
.attach-row[hidden], .widget-popover[hidden], .visitor-alias-note[hidden] { display: none !important; }
.attach-button {
  background: none; border: none; color: #7e9aa1; cursor: pointer;
  padding: 6px; border-radius: 8px; display: inline-flex; align-items: center;
}
.attach-button:hover { background: #eef1f5; color: #033347; }
.attach-row-name {
  display: inline-flex; align-items: center; gap: 6px; max-width: 55%;
  padding: 4px 9px; border-radius: 10px; font-size: 12px; color: #47586b;
  background: #f2f6f8; border: 1px dashed #c3d4d8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-row-name[hidden] { display: none; }
.attach-row-remove {
  background: none; border: none; color: #7e9aa1; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px;
}
.attach-row-remove[hidden] { display: none; }
.attach-row-remove:hover { color: #be3449; }
.attachment-wrap { margin-top: 6px; }
.chat-attachment {
  display: block; max-width: 220px; max-height: 180px; border-radius: 10px;
  border: 1px solid #dce9eb; object-fit: cover;
}
a.chat-attachment.file {
  padding: 8px 12px; font-size: 12px; text-decoration: none;
  background: #eef4ff; color: #183464; word-break: break-all;
}
a.chat-attachment.file:hover { background: #e0ebfc; }

/* --- Proactive bubble --- */
.proactive-bubble {
  position: fixed; bottom: 96px; right: 20px; z-index: 99998;
  max-width: 300px; padding: 14px 16px; border-radius: 14px;
  background: #ffffff; color: #033347; border: 1px solid #c9dee3;
  box-shadow: 0 12px 32px rgba(3, 51, 71, 0.18);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
  font-family: inherit;
}
.proactive-bubble.visible { opacity: 1; transform: translateY(0); }
.proactive-bubble p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; }
.proactive-bubble .proactive-close {
  position: absolute; top: 6px; right: 8px; background: none; border: none;
  color: #7e9aa1; font-size: 16px; cursor: pointer; line-height: 1;
}
.proactive-actions { display: flex; gap: 8px; }
.proactive-actions button {
  font: inherit; font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.proactive-actions .proactive-start { background: #2a8e9e; color: #fff; border: none; }
.proactive-actions .proactive-later { background: transparent; color: #4a6572; border: 1px solid #c9dee3; }
[dir='rtl'] .proactive-bubble { right: auto; left: 20px; }
[dir='rtl'] .message { text-align: right; }

/* --- Attachment lightbox (WhatsApp-style view + × close) --- */
.vion-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 14, 18, 0.88);
  padding: 24px;
}
.vion-lightbox[hidden] { display: none; }
.vion-lightbox-body { max-width: min(860px, 94vw); max-height: 88vh; display: flex; align-items: center; justify-content: center; }
.vion-lightbox-body img {
  max-width: 100%; max-height: 88vh; border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5); object-fit: contain;
}
.vion-lightbox-body iframe {
  width: min(820px, 92vw); height: 86vh; border: 0; border-radius: 10px;
  background: #ffffff; box-shadow: 0 18px 60px rgba(0,0,0,0.5);
}
.vion-lightbox-close {
  position: absolute; top: 14px; right: 18px;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: #ffffff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.vion-lightbox-close:hover { background: rgba(255,255,255,0.24); }

/* --- System default theme ---
   Light is the designed default; when the OS/browser is in dark mode the
   widget follows it automatically (no manual toggle).
   EMBED: host page ka color-scheme postMessage se aata hai — 'html.force-dark'
   class un media queries ko override karti hai taaki widget host jaisa dikhe.
   (Dark styles @media ke andar hi hain, isliye force-dark unhe hamesha-on
   banane ke liye repeat karna hota hai — same declarations, do selectors.) */
html.force-dark { color-scheme: dark; }
@media (prefers-color-scheme: dark), html.force-dark {
  html.force-dark:root, :root { color-scheme: dark; }
  body { background: #0d1418; }
  .widget-preview,
  .chat-shell,
  .chat-header,
  .messages,
  .typing-indicator,
  .self-service,
  .message-form,
  .privacy-note,
  .new-chat-dialog { background: #0d2430; }
  .messages:hover { scrollbar-color: rgba(127, 208, 221, 0.45) transparent; }
  .messages:hover::-webkit-scrollbar-thumb { background: rgba(127, 208, 221, 0.45); }
  .chat-header { border-bottom-color: #17323e; }
  .chat-header h1, .welcome-panel h2, .transcript-form p, .rating-form p,
  .welcome-panel p { color: #a8bcc5; }
  .status { color: #8ba6b0; }
  .status.ready { color: #4ade80; }
  .quick-action, .system-message { background: #12303d; border-color: #1e4250; }
  .quick-action { color: #c9dde4; }
  .quick-action strong { color: #eaf4f7; }
  .quick-action small, .quick-action b { color: #8ba6b0; }
  .quick-action:hover { border-color: #5b8bd0; box-shadow: 0 8px 18px rgba(0,0,0,0.35); }
  .primary-action { background: #1d2b45; border-color: #3d5a8a; }
  .primary-action small { color: #9fb4d8; }
  .action-icon { background: #17414e; color: #62c4d4; }
  .explore-action .action-icon, .action-icon.match { background: #3d3350; color: #b79df5; }
  .action-icon.migration { background: #14453c; color: #4fd0b8; }
  .action-icon.domain { background: #4a3a20; color: #e8b25f; }
  .assistant-message { background: #16304a; border-color: #234a6b; color: #cfe3f5; }
  .human-message { background: #123a2c; border-color: #1f5c44; color: #b9ecd0; }
  .msg-sender { opacity: 0.85; }
  .visitor-message { background: #2f65f5; color: #ffffff; }
  .system-message { color: #93aabb; }
  .typing-indicator { border-top-color: #17323e; color: #7fb98f; }
  .self-service { border-top-color: #17323e; }
  .self-service a, .self-service button, .support-toggle { color: #62c4d4; }
  .self-service button:disabled { color: #5b7480; }
  .support-status { background: #16324a; color: #7fc8e0; }
  .support-status.live { background: #123a2c; color: #4ade80; }
  .message-form textarea { color: #e6f1f4; background: transparent; }
  .message-form button { background: #22384a; }
  .message-form button span { color: #8ba6b0; }
  .message-form #send-button { background: #22384a; }
  .message-form #send-button:enabled { background: #2a8e9e; }
  .message-form #send-button:enabled span { color: #ffffff; }
  .privacy-note { color: #6f8b95; }
  .attach-button { color: #7e9aa1; }
  .attach-button:hover { background: #1b3a46; color: #e6f1f4; }
  .attach-row-name { background: #16303a; border-color: #2c4a56; color: #a8bcc5; }
  .attach-row-remove { color: #7e9aa1; }
  .attach-row-remove:hover { color: #f28b9b; }
  .chat-attachment { border-color: #2c4a56; }
  a.chat-attachment.file { background: #16304a; color: #cfe3f5; }
  a.chat-attachment.file:hover { background: #1d3d5c; }
  .transcript-form, .rating-form { background: #10293a; border-color: #1e4250; }
  .transcript-form input, .rating-form textarea { background: #0d2430; border-color: #2c4a56; color: #e6f1f4; }
  .rating-stars button { background: #12303d; border-color: #2c4a56; color: #8ba6b0; }
  .rating-stars button.selected { background: #4a3a20; border-color: #e8b25f; color: #ffd479; }
  .rating-submit, .transcript-form button { background: #2a8e9e; color: #ffffff; }
  .transcript-confirmation { background: #123a2c; border-color: #1f5c44; color: #4ade80; }
  .clear-chat-btn { color: #8ba6b0; }
  .clear-chat-btn:hover { background: #1b3a46; color: #e6f1f4; }
  .clear-chat-btn:focus-visible { outline-color: #dceaef; }
  .modal-overlay { background: rgba(0, 0, 0, 0.55); }
  .new-chat-dialog p { color: #93aabb; }
  #keep-chat-btn { background: #12303d; border-color: #2c4a56; color: #e6f1f4; }
  #keep-chat-btn:hover { background: #17414e; }
  #start-new-chat-btn { background: #2a8e9e; border-color: #2a8e9e; color: #ffffff; }
  #start-new-chat-btn:hover { background: #36a3b4; }
  .new-chat-icon { background: #17414e; color: #62c4d4; }
  .support-form { background: #10293a; border-color: #1e4250; }
  .support-form input, .support-form textarea { background: #0d2430; border-color: #2c4a56; color: #e6f1f4; }
  .support-form button { background: #2a8e9e; }
  .support-title { color: #eaf4f7; }
  .support-title button { color: #8ba6b0; }
  .support-title button:hover { color: #e6f1f4; }
  .consent { color: #93aabb; }
  .lang-select { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
  .proactive-bubble { background: #10333f; color: #fff; border-color: rgba(42,142,158,0.6); box-shadow: 0 12px 32px rgba(0,0,0,0.35); }
  .proactive-bubble .proactive-close { color: rgba(255,255,255,0.7); }
  .proactive-actions .proactive-later { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.3); }
  .call-card { background: #0d2430; }
}

/* --- Rich text in messages (bold/italic/code/links) --- */
.message strong { font-weight: 700; }
.message em { font-style: italic; }
.message code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.07);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.86em;
}
.message a { color: inherit; text-decoration: underline; word-break: break-all; }

/* --- Read receipts --- */
.msg-receipt {
  display: inline-block;
  margin-inline-start: 6px;
  font-size: 0.68rem;
  opacity: 0.6;
  vertical-align: baseline;
}
.msg-receipt.seen { opacity: 1; color: #4ade80; font-weight: 700; }

/* --- Guided quick-reply chips --- */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 0 8px;
}
.quick-chip {
  padding: 7px 14px;
  border: 1.4px solid #2a8e9e;
  border-radius: 999px;
  background: #ffffff;
  color: #0b6b7a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.quick-chip:hover { background: #e8f5f7; transform: translateY(-1px); }
.quick-chip:active { transform: translateY(0); }

/* --- Embed mode: full-bleed widget inside the client-site iframe --- */
body.embed-mode .widget-preview {
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* --- Dark mode overrides for new elements --- */
@media (prefers-color-scheme: dark) {
  .message code { background: rgba(255, 255, 255, 0.1); }
  .quick-chip { background: #10293a; color: #7fd0dd; border-color: #2c4a56; }
  .quick-chip:hover { background: #17414e; }
  body.embed-mode { background: #0d2430; }
}
/* Embed force-dark: same overrides jab host page dark ho (class-driven). */
html.force-dark .message code { background: rgba(255, 255, 255, 0.1); }
html.force-dark .quick-chip { background: #10293a; color: #7fd0dd; border-color: #2c4a56; }
html.force-dark .quick-chip:hover { background: #17414e; }
html.force-dark body.embed-mode, body.embed-mode html.force-dark { background: #0d2430; }

/* Unread click-through: last unread agent message par open hone par soft pulse */
.message.unread-flash { animation: vionUnreadFlash 2.2s ease-out 1; border-radius: 12px; }
@keyframes vionUnreadFlash { 0% { box-shadow: 0 0 0 0 rgba(42, 142, 158, 0.55); background: rgba(42, 142, 158, 0.16); } 60% { box-shadow: 0 0 0 10px rgba(42, 142, 158, 0); background: rgba(42, 142, 158, 0.08); } 100% { box-shadow: 0 0 0 0 rgba(42, 142, 158, 0); background: transparent; } }

/* --- Guided bot flows (no-code builder) --- */
.bot-flow-launcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 8px 10px;
}
.bot-flow-btn {
  padding: 9px 16px;
  border: 1.4px solid #2a8e9e;
  border-radius: 12px;
  background: #e8f5f7;
  color: #0b6b7a;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.bot-flow-btn:hover { background: #d3edf1; transform: translateY(-1px); }
.bot-flow-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 8px 10px;
}
.bot-flow-option {
  padding: 8px 15px;
  border: 1.4px solid #2a8e9e;
  border-radius: 999px;
  background: #ffffff;
  color: #0b6b7a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.bot-flow-option:hover { background: #e8f5f7; }
.bot-flow-back {
  padding: 8px 12px;
  border: 1px dashed #9fc4c9;
  border-radius: 999px;
  background: transparent;
  color: #5b8a91;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.bot-flow-input-row {
  display: flex;
  gap: 8px;
  padding: 4px 8px 10px;
}
.bot-flow-input-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1.4px solid #9fc4c9;
  border-radius: 10px;
  font: inherit;
  font-size: 0.86rem;
  background: #ffffff;
  color: #12333a;
}
.bot-flow-input-row input:focus { outline: 2px solid #2a8e9e33; border-color: #2a8e9e; }
.bot-flow-send {
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: #2a8e9e;
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .bot-flow-btn { background: #123b42; color: #9adcE4; border-color: #2a8e9e; }
  .bot-flow-btn:hover { background: #17505a; }
  .bot-flow-option { background: #0e2e34; color: #b9e6ec; border-color: #2a8e9e; }
  .bot-flow-option:hover { background: #123b42; }
  .bot-flow-back { color: #7fa9af; border-color: #35565c; }
  .bot-flow-input-row input { background: #0e2e34; border-color: #35565c; color: #d9eef1; }
  .bot-flow-send { background: #2a8e9e; color: #ffffff; }
}

/* Match the VLAB customer dashboard while retaining the compact chat layout. */
:root{--vlab-bg:#f4f7f9;--vlab-surface:#fff;--vlab-surface-2:#f1f6f8;--vlab-ink:#071d2b;--vlab-muted:#687b88;--vlab-line:#d8e1e6;--vlab-brand:#0a4656;--vlab-teal:#2a95a4;--vlab-accent:#ff7a2f;color-scheme:light dark}
body,body.embed-mode{background:var(--vlab-bg);color:var(--vlab-ink)}
.widget-preview,.chat-shell,.chat-header,.messages,.typing-indicator,.self-service,.message-form,.privacy-note{background:var(--vlab-surface)}
.chat-shell{border-color:var(--vlab-line);border-radius:8px;box-shadow:0 12px 34px #0726341c}
.chat-header{min-height:64px;border-bottom-color:var(--vlab-line)}
.chat-header h1,.welcome-panel h2,.quick-action strong{color:var(--vlab-ink)}
.status,.welcome-panel p,.quick-action small,.privacy-note{color:var(--vlab-muted)}
.quick-action,.transcript-form,.rating-form,.support-form{border-color:var(--vlab-line);border-radius:7px;background:var(--vlab-surface);box-shadow:none}
.quick-action:hover{border-color:var(--vlab-teal);box-shadow:0 3px 10px #0a465616}
.primary-action{background:#eaf5f6;border-color:#b9dadd}
.primary-action .action-icon,.message-form #send-button:enabled,.rating-submit,.transcript-form button,.support-form button{background:var(--vlab-brand)}
.assistant-message{background:#e8f1f7;border-color:#d4e3ec;color:#145278}
.human-message{background:#edf6f2;border-color:#d5e9df;color:#185f42}
.visitor-message{background:var(--vlab-brand);box-shadow:none}
.message,.new-chat-dialog,.call-card{border-radius:7px}
.action-icon{border-radius:6px}
.proactive-bubble{border-radius:7px;border-color:var(--vlab-line);color:var(--vlab-ink)}
@media(prefers-color-scheme:dark){:root{--vlab-bg:#0b171d;--vlab-surface:#10242c;--vlab-surface-2:#152d36;--vlab-ink:#e5f0f3;--vlab-muted:#9bb0b8;--vlab-line:#29434d;--vlab-brand:#16798a;--vlab-teal:#43a8b7}.chat-header h1,.welcome-panel h2,.quick-action strong{color:var(--vlab-ink)}.status,.welcome-panel p,.quick-action small,.privacy-note{color:var(--vlab-muted)}.quick-action,.transcript-form,.rating-form,.support-form{background:var(--vlab-surface-2);border-color:var(--vlab-line)}.primary-action{background:#173640;border-color:#315966}.assistant-message{background:#173645;border-color:#285064;color:#cbe6f2}.human-message{background:#173b31;border-color:#28594a;color:#c6ead9}.visitor-message{background:#16798a}}
html.force-dark{--vlab-bg:#0b171d;--vlab-surface:#10242c;--vlab-surface-2:#152d36;--vlab-ink:#e5f0f3;--vlab-muted:#9bb0b8;--vlab-line:#29434d;--vlab-brand:#16798a;--vlab-teal:#43a8b7}

/* Resolve the confirmation surface from the same tokens as the active widget. */
.new-chat-dialog { background: var(--vlab-surface); color: var(--vlab-ink); border: 1px solid var(--vlab-line); padding: 22px 18px; max-height: 100%; overflow-y: auto; }
.new-chat-dialog h3 { color: var(--vlab-ink); }
.new-chat-dialog p { color: var(--vlab-muted); overflow-wrap: anywhere; }
.new-chat-dialog .new-chat-icon { background: var(--vlab-surface-2); color: var(--vlab-teal); }
.new-chat-actions { flex-wrap: wrap; }
.new-chat-actions button { min-width: 0; flex: 1 1 110px; white-space: normal; overflow-wrap: anywhere; border-radius: 7px; }
#keep-chat-btn, #keep-chat-btn:hover { background: var(--vlab-surface-2); color: var(--vlab-ink); border-color: var(--vlab-line); }
#start-new-chat-btn { background: var(--vlab-brand); border-color: var(--vlab-brand); color: #fff; }
.new-chat-actions button:focus-visible { outline: 2px solid var(--vlab-teal); outline-offset: 3px; }

.widget-tool { width:32px; height:32px; flex:0 0 32px; padding:7px; border:0; border-radius:5px; background:transparent; color:var(--vlab-muted); cursor:pointer; display:grid; place-items:center; }
.widget-tool:hover { background:var(--vlab-surface-2); }
.widget-tool:focus-visible { outline:2px solid var(--vlab-teal); outline-offset:2px; }
.widget-tool:disabled { opacity:.45; cursor:default; }
.widget-tool img { display:none; }
.widget-tool::before { content:''; width:18px; height:18px; background:currentColor; mask:center/contain no-repeat var(--tool-icon); }
#expand-chat { --tool-icon:url('icons/maximize-2.svg'); color:inherit; margin-left:auto; }
#expand-chat[aria-expanded="true"] { --tool-icon:url('icons/minimize-2.svg'); }
#screenshot-button { --tool-icon:url('icons/camera.svg'); }
.message-form { grid-template-columns:44px minmax(0,1fr) 44px; gap:5px; }
.message-form:has(#attach-button[hidden]) { grid-template-columns:minmax(0,1fr) 44px; }
.message-form #attach-button, .message-form #send-button { box-sizing:border-box; width:44px; min-width:44px; height:44px; flex:0 0 44px; margin:auto; padding:0; border-radius:50%; display:grid; place-items:center; }
.message-form #attach-button { background:var(--vlab-surface-2); color:var(--vlab-ink); }
.message-form #attach-button[hidden] { display:none !important; }
.message-form #attach-button span { color:inherit; font:400 28px/1 system-ui,sans-serif; }
.message-form #attach-button { position:relative; transition:background .15s ease,color .15s ease; }
.message-form #attach-button:hover,.message-form #attach-button:focus-visible { background:var(--vlab-line); color:var(--vlab-ink); }
.message-form #attach-button::after { content:attr(aria-label); position:absolute; bottom:calc(100% + 8px); left:0; z-index:30; padding:6px 9px; border-radius:4px; background:var(--vlab-ink); color:var(--vlab-surface); font:400 12px/1.4 system-ui,sans-serif; white-space:nowrap; pointer-events:none; opacity:0; }
.message-form #attach-button:not([aria-expanded="true"]):hover::after,.message-form #attach-button:not([aria-expanded="true"]):focus-visible::after { opacity:1; }
.message-form #send-button .send-enter-icon { display:block; width:19px; height:19px; background:currentColor; mask:url('icons/corner-down-left.svg') center/contain no-repeat; }
.attachment-menu { position:absolute; left:8px; bottom:calc(100% + 6px); z-index:20; width:190px; max-width:calc(100% - 16px); padding:4px; border:1px solid var(--vlab-line); border-radius:8px; background:var(--vlab-surface); box-shadow:0 4px 18px #0003; }
.attachment-menu[hidden] { display:none; }
.message-form .attachment-menu button { width:100%; min-width:0; height:48px; display:flex; align-items:center; gap:12px; padding:10px 12px; border:0; border-radius:4px; background:transparent; color:var(--vlab-ink); font:inherit; font-size:14px; line-height:1.3; text-align:left; white-space:normal; }
.message-form .attachment-menu button span { color:inherit; }
.message-form .attachment-menu button:hover,.message-form .attachment-menu button:focus-visible { background:var(--vlab-surface-2); outline:2px solid var(--vlab-teal); outline-offset:-2px; }
.message-form .attachment-menu #screenshot-button { --tool-icon:url('icons/camera.svg'); }
.attachment-menu .widget-tool::before { flex:0 0 18px; }
.attachment-menu #send-file-button img { width:18px; height:18px; flex:0 0 18px; }
html.force-dark .attachment-menu #send-file-button img { filter:invert(1); }
.message-form textarea { min-width:0; background:transparent; color:var(--vlab-ink); }
html.force-dark .assistant-message { background:#173645; border-color:#285064; color:#cbe6f2; }
html.force-dark .human-message { background:#173b31; border-color:#28594a; color:#c6ead9; }
html.force-dark .visitor-message { background:#16798a; }
html.force-dark .message-form #send-button:disabled { background:#22384a; }
html.force-dark .message-form #send-button:disabled span { color:#8ba6b0; }
body.chat-expanded:not(.embed-mode) .chat-shell { width:min(720px,100%); height:calc(100dvh - 48px); }
#screenshot-preview { width:96px; height:72px; object-fit:contain; background:var(--vlab-surface-2); border:1px solid var(--vlab-line); border-radius:4px; }
.attach-row { flex-shrink:0; max-height:130px; overflow:auto; align-items:center; }
.attach-row-name { overflow-wrap:anywhere; min-width:0; }
.screenshot-status { margin:0; padding:8px 14px; font-size:12px; color:var(--vlab-ink); background:var(--vlab-surface-2); }
@media(prefers-color-scheme:dark) { .system-message { background:var(--vlab-surface-2); border-color:var(--vlab-line); color:var(--vlab-muted); } }
html.force-dark .system-message { background:var(--vlab-surface-2); border-color:var(--vlab-line); color:var(--vlab-muted); }
html.force-dark .typing-indicator, html.force-dark .self-service { border-top-color:#17323e; }
html.force-dark .support-status { background:#16324a; color:#7fc8e0; }
html.force-dark .support-status.live { background:#123a2c; color:#4ade80; }
@media(max-width:380px) { .chat-header { gap:7px; padding-inline:12px; } .message-form { padding-inline:8px; gap:3px; } }

/* Host-selected dark mode must not depend on the browser's OS preference. */
html.force-dark .typing-indicator { color:#7fb98f; }
html.force-dark .transcript-form,
html.force-dark .rating-form,
html.force-dark .support-form { background:var(--vlab-surface-2); border-color:var(--vlab-line); }
html.force-dark .transcript-form p,
html.force-dark .rating-form p { color:#a8bcc5; }
html.force-dark .transcript-form input,
html.force-dark .rating-form textarea,
html.force-dark .support-form input,
html.force-dark .support-form textarea { background:#0d2430; border-color:#2c4a56; color:#e6f1f4; }
html.force-dark .rating-stars button { background:#12303d; border-color:#2c4a56; color:#8ba6b0; }
html.force-dark .rating-stars button.selected { background:#4a3a20; border-color:#e8b25f; color:#ffd479; }
html.force-dark .support-title { color:#eaf4f7; }
html.force-dark .support-title button { color:#8ba6b0; }
html.force-dark .support-title button:hover { color:#e6f1f4; }
html.force-dark .consent { color:#93aabb; }
html.force-dark .attach-row-name { background:#16303a; border-color:#2c4a56; color:#a8bcc5; }
html.force-dark .attach-row-remove { color:#7e9aa1; }
html.force-dark .attach-row-remove:hover { color:#f28b9b; }
html.force-dark .chat-attachment { border-color:#2c4a56; }
html.force-dark a.chat-attachment.file { background:#16304a; color:#cfe3f5; }
html.force-dark a.chat-attachment.file:hover { background:#1d3d5c; }
html.force-dark .transcript-confirmation { background:#123a2c; border-color:#1f5c44; color:#4ade80; }
html.force-dark .bot-flow-btn { background:#123b42; color:#9adce4; border-color:#2a8e9e; }
html.force-dark .bot-flow-btn:hover { background:#17505a; }
html.force-dark .bot-flow-option { background:#0e2e34; color:#b9e6ec; border-color:#2a8e9e; }
html.force-dark .bot-flow-option:hover { background:#123b42; }
html.force-dark .bot-flow-back { color:#7fa9af; border-color:#35565c; }
html.force-dark .bot-flow-input-row input { background:#0e2e34; border-color:#35565c; color:#d9eef1; }
html.force-dark .proactive-bubble { background:#10333f; color:var(--vlab-ink); border-color:var(--vlab-line); box-shadow:0 12px 32px rgba(0,0,0,.35); }
html.force-dark .proactive-bubble .proactive-close { color:rgba(255,255,255,.7); }
html.force-dark .proactive-actions .proactive-later { color:rgba(255,255,255,.8); border-color:rgba(255,255,255,.3); }
html.force-dark .call-card { background:#0d2430; }
