.lab-main { max-width: calc(100% - 470px); padding-top: clamp(35px, 7vh, 80px); }
.lab-lead { max-width: 570px; }
.rex__window { width: min(450px, calc(100vw - 32px)); height: min(760px, calc(100svh - 125px)); max-height: calc(100svh - 125px); }
/* Transcript updates must settle immediately: a smooth scroll can leave the
   next snapshot thinking the visitor is reading old messages. */
.rex__messages { flex: 1 1 auto; min-height: 80px; max-height: none; padding: 18px; scroll-behavior: auto; }
.rex__header { padding: 14px 18px; }
.rex__lab-controls { padding: 8px 16px; }
.rex__mode { min-height: 36px; }
.rex__provider-status, .rex__refresh { font-size: 12px; }
.rex__lab-notice { padding: 7px 14px; font-size: 11px; }
.rex__input { font-size: 15px; }
.rex__feedback { font-size: 12px; line-height: 1.5; padding: 10px 16px; }
.rex-product-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 6px; border-top: 1px solid #ffffff12; }
.rex-product-button, .rex-product-chip { border: 1px solid #00f6ff40; color: #d5f9fa; background: #00f6ff08; border-radius: 8px; padding: 8px 10px; min-height: 38px; font: 600 12px/1.3 var(--font-body); }
.rex-product-button:hover, .rex-product-chip:hover { background: #00f6ff17; border-color: #00f6ff80; }
.rex-product-button:disabled { cursor: not-allowed; }
.rex-product-connection { flex: 0 0 auto; padding: 0 16px; margin: 5px 0 10px; font-size: 11px; line-height: 1.5; color: #bbcbd7; }
.rex-product-intro { color: #e1edf5; font-size: 14px; line-height: 1.6; }
.rex-product-intro p { margin-top: 0; }
.rex-product-services { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rex-product-chip { text-align: left; font-weight: 500; }
.rex-product-chip[aria-pressed="true"] { border-color: var(--cyan); background: #00f6ff20; }
.rex-product-chip:disabled { cursor: not-allowed; opacity: 0.55; }
.rex-product-service-menu { position: relative; flex: 0 0 auto; margin-left: auto; color: #ccecf1; }
.rex-product-service-menu > summary { cursor: pointer; padding: 8px; min-height: 36px; font-size: 12px; }
.rex-product-service-menu > .rex-product-services { position: absolute; right: 0; top: 100%; z-index: 4; width: min(290px, calc(100vw - 76px)); padding: 12px; margin: 4px 0 0; border: 1px solid #00f6ff55; border-radius: 10px; background: #0d2038; box-shadow: 0 12px 28px #0006; }
.rex-product-service-menu .rex-product-chip { width: 100%; }
.rex-product-service-menu .rex-product-human-contact { flex: 1 1 100%; min-width: 0; max-width: 100%; padding: 8px 0 0; }
.rex-product-journey { margin: 14px 0 4px; padding: 14px; border: 1px solid #00f6ff35; border-radius: 12px; background: #092037; color: #e1edf5; font-size: 13px; line-height: 1.5; }
.rex-product-journey[hidden], .rex-product-service-menu[hidden] { display: none; }
.rex-product-journey-title { margin: 0 0 8px; color: #e9f7fb; font: 650 14px/1.4 var(--font-body); }
.rex-product-journey p { margin: 8px 0 12px; overflow-wrap: anywhere; }
.rex-product-journey .rex-product-services { margin: 12px 0; gap: 6px; }
.rex-product-journey-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rex-product-journey .rex-product-field { margin: 11px 0; gap: 5px; font-size: 12px; }
.rex-product-journey .rex-product-field input { padding: 8px 10px; }
.rex-product-journey .rex-product-check { margin: 14px 0; font-size: 12px; line-height: 1.5; }
.rex-product-journey .rex-product-form-feedback { color: #ffe0a7; font-size: 12px; }
.rex-product-journey .rex-product-text-button { text-align: left; }
.rex-product-brief { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-left: 2px solid #00f6ff75; border-radius: 0 8px 8px 0; background: #061827; color: #e7f0f7; }
.rex-product-question-help, .rex-product-brief-details { margin: 10px 0; }
.rex-product-question-help > summary, .rex-product-brief-details > summary { cursor: pointer; color: #83e9ee; padding: 6px 0; min-height: 32px; }
.rex-product-question-help p { padding: 4px 0; color: #c8dbe5; }
.rex-product-journey :is(input, button, summary):focus-visible, .rex-product-service-menu :is(button, summary):focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.rex-product-recover { flex: 0 0 auto; margin: 0 16px 10px; background: #e9bd75; color: #152338; border: 0; border-radius: 8px; padding: 10px; font-size: 12px; font-weight: 700; }
.rex-product-pane { position: absolute; inset: 0; z-index: 5; padding: 18px; overflow-y: auto; overscroll-behavior: contain; background: #0d2038; color: #e4eef6; border-radius: inherit; }
.rex-product-pane-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.rex-product-pane h2 { font-size: 20px; line-height: 1.3; font-family: var(--font-head); letter-spacing: -0.025em; margin: 3px 0 0; }
.rex-product-pane p { font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.rex-product-text-button { min-height: 36px; background: none; border: 0; padding: 6px; color: #80f5f9; font: inherit; font-size: 13px; }
.rex-product-muted { color: #b3c5d5; }
.rex-product-field { display: flex; flex-direction: column; gap: 7px; margin: 16px 0; color: #d4e2ec; font-size: 13px; line-height: 1.4; }
.rex-product-field input, .rex-product-field select, .rex-product-field textarea { border: 1px solid #8297ac75; border-radius: 8px; background: #071829; color: #fff; font: inherit; font-size: 16px; line-height: 1.5; padding: 10px; width: 100%; min-width: 0; }
.rex-product-field textarea { resize: vertical; min-height: 85px; max-height: 240px; }
.rex-product-field input::placeholder { color: #879bae; }
.rex-product-field textarea:disabled { opacity: 0.55; }
.rex-product-check { display: flex; align-items: flex-start; gap: 10px; color: #dce9f1; font-size: 13px; line-height: 1.6; margin: 20px 0; }
.rex-product-check input { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; accent-color: var(--cyan); }
.rex-product-submit { width: 100%; border: 0; border-radius: 9px; min-height: 44px; padding: 12px 16px; background: var(--cyan); color: #0a1931; font: 750 14px/1.4 var(--font-body); }
.rex-product-submit:hover { background: #6bfaff; }
.rex-product-pane .rex-product-form-feedback { color: #ffe0a7; font-size: 13px; margin: 12px 0; }
.rex-product-form-feedback:empty { display: none; }
.rex-product-summary { margin: 16px 0 22px; padding: 14px; border: 1px solid #00f6ff26; border-radius: 10px; background: #071829; }
.rex-product-summary dt { color: #8babbf; font-size: 11px; margin: 12px 0 4px; }
.rex-product-summary dt:first-child { margin-top: 0; }
.rex-product-summary dd { margin: 0; color: #e5f0f7; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.rex-product-pane :is(input, textarea, select, button):focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.rex-product-pane > .rex-product-button { margin: 0 8px 12px 0; }
.rex-product-booking-status { border-left: 3px solid var(--cyan); padding-left: 12px; }
.rex-product-slot-results { margin-top: 20px; }
.rex-product-slots { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; padding: 4px; }
.rex-product-slot { text-align: left; border: 1px solid #00f6ff40; border-radius: 8px; background: #071829; color: #d5f9fa; font: 500 13px/1.5 var(--font-body); padding: 12px; min-height: 44px; }
.rex-product-slot:hover { background: #00f6ff15; border-color: var(--cyan); }
.rex-product-pane .rex-product-text-button { margin-top: 10px; }
@media (max-width: 1050px) { .lab-main { max-width: calc(100% - 445px); padding-left: 5vw; } h1 { font-size: clamp(32px, 4.5vw, 58px); } }
@media (max-width: 800px) { .lab-main { max-width: 100%; padding: 38px 7vw 120px; } .rex__window { width: min(450px, calc(100vw - 32px)); } }
@media (max-width: 480px) {
  .rex { bottom: 16px; right: 16px; }
  .rex__window { bottom: 76px; width: calc(100vw - 32px); height: calc(100svh - 112px); max-height: calc(100svh - 112px); }
  .rex-product-actions { gap: 5px; padding-inline: 10px; }
  .rex-product-button { padding: 8px; font-size: 11px; flex: 1 1 auto; }
  .rex-product-pane { padding: 16px; }
  .rex__input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .rex__messages { scroll-behavior: auto; } }

.lab-human-contact { margin-top: 24px; padding: 16px; border: 1px solid #6e96ad66; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.lab-human-contact p { margin: 0 0 6px; }
.lab-human-contact a, .rex-product-human-contact a { color: #80f5f9; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; }
.lab-human-contact a:focus-visible, .rex-product-human-contact a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.rex-product-human-contact { flex: 0 0 auto; margin: 0; padding: 6px 16px; color: #d4e2ec; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.rex-product-pane .rex-product-human-contact { padding: 8px 0; font-size: 13px; }

/* Conversation-first candidate: secondary surfaces never consume transcript height. */
.rex__window { width: min(540px, calc(100vw - 32px)); height: min(820px, calc(100dvh - 40px)); max-height: calc(100dvh - 40px); bottom: 0; }
.rex:has(.rex__window.open) > .rex__toggle { visibility: hidden; }
.rex__messages { min-height: 0; padding: 20px; gap: 18px; overflow-y: auto; }
.rex__messages > * { flex-shrink: 0; }
.rex-msg { max-width: 94%; font-size: 15px; line-height: 1.65; }
.rex-msg--bot { background: transparent; border: 0; padding: 0; }
.rex-msg--user { padding: 12px 16px; }
.rex__window[data-rex-enhanced] > .rex-product-human-contact { display: none; }
.rex-product-actions { padding: 4px 16px; justify-content: space-between; flex-wrap: nowrap; }
.rex-product-actions .rex-product-text-button { font-size: 12px; padding: 4px; }
.rex-product-journey { margin: 0; padding: 0; border: 0; background: transparent; }
.rex-product-connection { margin: 0; padding: 6px 16px; }
.rex-product-typing { margin: 0; color: #aebfcc; font-size: 13px; }
.rex-product-new-messages { align-self: center; flex-shrink: 0; border: 1px solid #00f6ff50; border-radius: 16px; background: #102b42; color: #d5f9fa; padding: 6px 14px; font-size: 12px; }
.rex__input-area { align-items: flex-end; padding: 12px 16px 16px; }
.rex__input { display: block; resize: none; min-height: 52px; max-height: 144px; overflow-y: auto; font: 400 16px/1.5 var(--font-body); }
.rex__header { gap: 8px; }
.rex__header-info { min-width: 0; }
.rex__status { font-size: 11px; }
.lab-test-settings { margin-top: 24px; max-width: 480px; color: #bbcbd7; font-size: 13px; }
.lab-test-settings > summary { cursor: pointer; padding: 8px 0; }
.lab-main { max-width: calc(100% - 550px); }
@media (max-width: 900px) { .lab-main { max-width: 100%; } }
@media (max-width: 600px), (max-height: 560px) {
  html:has(.rex__window.open), body:has(.rex__window.open) { overflow: hidden; }
  .rex__window { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .rex__messages { padding: 16px; }
  .rex__input-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .rex__header { padding: 10px 14px; }
}

/* Message processing belongs beside the visitor's text, not in a modal. */
.rex-product-message-status { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; color: #c3d1dc; white-space: normal; }
.rex-product-summary-processing { padding: 10px 12px; border-left: 3px solid #efcb84; color: #f3dba9; font-size: 13px; line-height: 1.5; }

/* A shared page must not expose primary branding/contact before secondary routing is verified. */
html[data-rex-business-loading] .lab-brand,
html[data-rex-business-loading] .lab-lead,
html[data-rex-business-loading] .lab-notice p,
html[data-rex-business-loading] .rex__status { visibility: hidden; }
html[data-rex-business-loading] [data-rex-human-contact],
html[data-rex-business-loading] .lab-human-contact,
html[data-rex-business-loading] .rex-product-human-contact { display: none !important; }

.rex-product-review-fieldset { min-width: 0; margin: 14px 0; padding: 8px 12px; border: 1px solid #8297ac75; border-radius: 8px; }
.rex-product-review-fieldset legend { max-width: 100%; overflow-wrap: anywhere; padding: 0 4px; font-size: 13px; }
