@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  font-family: "Salesforce Sans", Arial, sans-serif;
  background: #f5f7fa;
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  color: #4f4f4f;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: linear-gradient(135deg, #2a94d6 0%, #47b4ea 100%);
  color: white;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  flex-shrink: 0;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.header-logo {
  height: 60px;
  width: auto;
}

.header-text {
  text-align: left;
}

header h1 {
  font-family: "Open Sans", sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
}

header p {
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 16px;
  opacity: 0.95;
  margin: 0;
}

/* Secondary Navigation Bar */
.component-control-bar {
  background: #efefef;
  padding: 20px 40px;
  border-bottom: 3px solid #2a94d6;
  margin: 0;
  width: 100%;
  flex-shrink: 0;
}

.control-bar-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.control-bar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.control-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.component-select-label {
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #4f4f4f;
  white-space: nowrap;
  margin: 0;
}

.component-select-dropdown {
  font-family: "Salesforce Sans", Arial, sans-serif;
  flex: 1;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid #2a94d6;
  border-radius: 6px;
  background: white;
  color: #4f4f4f;
  cursor: pointer;
  transition: all 0.2s ease;
}

.component-select-dropdown:hover {
  border-color: #1a7ab8;
  box-shadow: 0 2px 6px rgba(42, 148, 214, 0.2);
}

.component-select-dropdown:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.1);
}

/* Two-Column Generator Layout */
.generator-container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Left Column: Configuration Panel — unified control sizing tokens */
.config-panel {
  --config-input-min-height: 2.75rem;
  --config-radius: 10px;
  --config-border: 1px solid #d1d5db;
  --config-focus-ring: 0 0 0 3px rgba(42, 148, 214, 0.15);
  --config-input-pad-y: 0.65rem;
  --config-input-pad-x: 0.875rem;
  flex: 0 0 400px;
  width: 400px;
  min-width: 300px;
  max-width: 800px;
  min-height: 0;
  height: 100%;
  background: white;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.resizer {
  width: 8px;
  flex-shrink: 0;
  background-color: #f3f4f6;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  z-index: 10;
}

.resizer:hover,
.resizer.dragging {
  background-color: #2a94d6;
}

.resizer-handle {
  width: 2px;
  height: 24px;
  background-color: #c9c9c9;
  border-radius: 2px;
}

.resizer:hover .resizer-handle,
.resizer.dragging .resizer-handle {
  background-color: #ffffff;
}

.instruction-banner {
  margin: 20px 24px 16px;
  padding: 14px 16px;
  background: #e8f4fc;
  color: #16325c;
  border: 1px solid #b8d9f0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.instruction-banner strong {
  font-weight: 600;
  color: #032d60;
}

.config-header {
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid #e8eaed;
  background: #f8f9fa;
}

.config-header h2 {
  font-family: "Open Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #2a94d6;
  margin-bottom: 8px;
}

.config-header p {
  font-size: 13px;
  color: #5f6368;
  margin: 0;
}

body.experience-adaptive .config-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06);
}

body.experience-adaptive .config-header h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 10px;
}

body.experience-adaptive .config-header-adaptive-lead {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #475569;
  max-width: 34rem;
  margin: 0;
}

body.experience-adaptive .config-panel {
  background: #f1f5f9;
}

.config-header-adaptive-extra {
  margin-top: 10px;
  margin-bottom: 0;
}

.config-header-link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #2a94d6;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.config-header-link-btn:hover {
  color: #1a7ab8;
}

body.experience-adaptive .config-header-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  padding: 0.65rem 1.25rem;
  min-height: 2.75rem;
  border: none;
  border-radius: 999px;
  font-family: "Open Sans", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2a94d6 0%, #1a7ab8 100%);
  box-shadow: 0 4px 14px rgba(42, 148, 214, 0.35);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

body.experience-adaptive .config-header-cta-btn:hover {
  box-shadow: 0 6px 20px rgba(42, 148, 214, 0.42);
  transform: translateY(-1px);
}

body.experience-adaptive .config-header-cta-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(42, 148, 214, 0.35),
    0 4px 14px rgba(42, 148, 214, 0.35);
}

.config-form {
  padding: 24px;
  padding-bottom: 40px;
  flex: 1;
}

.config-tab-bar {
  display: flex;
  gap: 6px;
  margin: 0 0 20px;
  padding-bottom: 0;
  border-bottom: 1px solid #e8eaed;
}

.config-tab-btn {
  flex: 1;
  padding: 10px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  color: #5f6368;
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.config-tab-btn:hover {
  color: #032d60;
  background: #e8f0fe;
}

.config-tab-btn.is-active {
  color: #032d60;
  background: #fff;
  border-color: #e8eaed;
  box-shadow: 0 1px 0 #fff;
  position: relative;
  z-index: 1;
  margin-bottom: -1px;
  padding-bottom: 11px;
}

#configForm[data-active-config-tab="configure"] .config-tab-section[data-config-tab="demo"],
#configForm[data-active-config-tab="configure"] .config-tab-section[data-config-tab="copilot"] {
  display: none !important;
}

#configForm[data-active-config-tab="demo"] .config-tab-section[data-config-tab="configure"],
#configForm[data-active-config-tab="demo"] .config-tab-section[data-config-tab="copilot"] {
  display: none !important;
}

#configForm[data-active-config-tab="copilot"] .form-section:not(.config-tab-copilot-only) {
  display: none !important;
}

/* Email / SMS / WhatsApp: no tab panels — show all sections in one scroll.
   Exclude .email-only / .messaging-only or display:block !important wins over
   body.experience-messaging .email-only (e.g. Subject Line on SMS/WhatsApp). */
body:not(.experience-adaptive)
  #configForm
  .config-tab-section[data-config-tab]:not(.email-only):not(.messaging-only):not(.adaptive-only):not(.rcs-only):not(.sms-only):not(.whatsapp-only) {
  display: block !important;
}

.matrix-card-heading {
  font-size: 14px;
  font-weight: 600;
  color: #032d60;
  margin: 16px 0 12px;
  padding-top: 8px;
  border-top: 1px dashed #dadce0;
}

.adaptive-matrix-card-block:first-of-type .matrix-card-heading {
  border-top: none;
  padding-top: 0;
}

.matrix-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.matrix-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.matrix-checkbox-label input {
  width: auto;
  margin: 0;
}

/* Form Sections */
.form-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e8eaed;
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 16px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 8px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  transition: all 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.1);
}

.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  transition: all 0.2s ease;
  resize: vertical;
  min-height: 100px;
}

.form-group input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  cursor: pointer;
}

.upload-status {
  display: block;
  font-size: 12px;
  color: #00ac5b;
  margin-top: 8px;
  font-weight: 500;
}

.form-group small {
  display: block;
  font-size: 12px;
  color: #5f6368;
  margin-top: 4px;
}

/* Color Input Group */
.color-input-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.banner-gradient-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
}

.banner-gradient-stop {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banner-gradient-stop-label {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
}

/* Adaptive Web configure tab — collapsible wizard (<details>) */
details.wizard-section {
  margin-bottom: 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

details.wizard-section summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #202124;
  background: #f8f9fa;
  border-bottom: 1px solid transparent;
}

details.wizard-section[open] summary {
  border-bottom-color: #e8eaed;
}

details.wizard-section summary::-webkit-details-marker {
  display: none;
}

.wizard-section-body {
  padding: 16px 14px 8px;
}

.color-picker {
  width: 60px;
  height: 40px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.color-input-group input[type="text"] {
  flex: 1;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
}

/* Download Section */
.download-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #e8eaed;
}

.download-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #00ac5b 0%, #00965e 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 172, 91, 0.3);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 172, 91, 0.4);
  background: linear-gradient(135deg, #009350 0%, #007d48 100%);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn svg {
  flex-shrink: 0;
}

.download-note {
  font-size: 12px;
  color: #5f6368;
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}

/* Upload Button (Top Right) */
.upload-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #2a94d6 0%, #1a7ab8 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(42, 148, 214, 0.3);
  white-space: nowrap;
}

.upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 148, 214, 0.4);
  background: linear-gradient(135deg, #1a7ab8 0%, #0f5a8a 100%);
}

.upload-btn:active {
  transform: translateY(0);
}

.upload-btn svg {
  flex-shrink: 0;
}

/* Right Column: Preview Panel */
.preview-panel {
  flex: 1;
  min-width: 300px;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f6f8fc;
  overflow: hidden;
}

.preview-header {
  padding: 24px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.preview-header h2 {
  font-family: "Open Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #2a94d6;
  margin-bottom: 4px;
}

.preview-header p {
  font-size: 13px;
  color: #5f6368;
  margin: 0;
}

/* Preview container fills whatever vertical space is available inside the
   preview panel (which is a flex column: header + this). Previously a hard
   height: 800px cap left gray space below on taller monitors. */
.preview-container {
  flex: 1 1 auto;
  position: relative; /* anchor for preview chrome; iframe content handles its own scroll */
  width: 100%;
  min-height: 0;      /* allow flex child to shrink below intrinsic content size */
  background: white;
  overflow: hidden;
}

.preview-sim-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#previewIframe {
  width: 100%;
  min-height: 100%;
  height: 100%;
  min-width: 100%;
  border: none;
  display: block;
  vertical-align: top;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #2a94d6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay p {
  margin-top: 16px;
  font-size: 14px;
  color: #5f6368;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: white;
  padding: 20px 40px;
  text-align: center;
  flex-shrink: 0;
}

.footer p {
  margin: 4px 0;
  font-size: 13px;
}

.footer-note {
  opacity: 0.7;
  font-size: 12px;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .generator-container {
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  .resizer {
    display: none;
  }

  .config-panel {
    width: 100% !important;
    max-width: none !important;
    flex: 1 1 auto !important;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .preview-panel {
    flex: 1 1 auto;
    min-height: min(70vh, 900px);
  }
}

@media (max-width: 768px) {
  header {
    padding: 24px 20px;
  }

  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  .header-logo {
    height: 50px;
  }

  .header-text {
    text-align: center;
  }

  header h1 {
    font-size: 24px;
  }

  header p {
    font-size: 14px;
  }

  .component-control-bar {
    padding: 16px 20px;
  }

  .control-bar-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .control-bar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .component-select-dropdown {
    max-width: 100%;
  }

  .config-panel {
    padding: 16px;
  }

  .instruction-banner {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
  }

  .config-form {
    padding: 16px;
  }

  .preview-header {
    padding: 16px;
  }

  .footer {
    padding: 16px 20px;
  }
}

@media (max-width: 480px) {
  .header-logo {
    height: 40px;
  }

  header h1 {
    font-size: 20px;
  }

  .download-btn {
    padding: 14px 20px;
    font-size: 14px;
  }
}

/* Toggle with body.experience-email / body.experience-messaging / body.experience-rcs / body.experience-adaptive (see script.js) */

/* Hide messaging-only (but not shared email-messaging) in email mode */
body.experience-email .messaging-only:not(.email-only) {
  display: none !important;
}

/* Hide email-only (but not shared email-messaging) in messaging mode */
body.experience-messaging .email-only:not(.messaging-only) {
  display: none !important;
}

/* Hide both in adaptive mode */
body.experience-adaptive .email-only,
body.experience-adaptive .messaging-only {
  display: none !important;
}

body:not(.experience-adaptive) .adaptive-only {
  display: none !important;
}

body.experience-adaptive .email-messaging-shared {
  display: none !important;
}

/* RCS visibility rules
   RCS uses experience-messaging + experience-rcs body classes together.
   - .rcs-only sections show ONLY when experience-rcs is set.
   - .messaging-only sections that are NOT also .rcs-shared hide in RCS mode. */
body:not(.experience-rcs) .rcs-only {
  display: none !important;
}
/* SMS-only fields (e.g. Appearance toggle) — visible ONLY on the SMS simulator. */
body:not(.experience-sms) .sms-only {
  display: none !important;
}
/* WhatsApp-only fields (e.g. Appearance toggle) — visible ONLY on the WhatsApp simulator. */
body:not(.experience-whatsapp) .whatsapp-only {
  display: none !important;
}
body.experience-rcs .messaging-only:not(.rcs-shared):not(.rcs-only):not(.email-only) {
  display: none !important;
}
body.experience-rcs .rcs-hide {
  display: none !important;
}
body.experience-rcs .email-only:not(.rcs-shared) {
  display: none !important;
}
body.experience-adaptive .rcs-only {
  display: none !important;
}

/* ============================================================
   Co-Pilot Simulator — full-width iframe takeover.
   Co-Pilot ships as a standalone SPA under /copilot/. When active,
   hide the parent config panel + resizer + preview header so the
   embedded SPA (which has its own left panel + preview + download)
   fills the whole area. Zero effect on the other 5 experiences.
   ============================================================ */
body.experience-copilot .config-panel,
body.experience-copilot .resizer,
body.experience-copilot .preview-header,
body.experience-copilot .instruction-banner,
body.experience-copilot .component-control-bar .control-bar-right,
body.experience-copilot .footer {
  display: none !important;
}
body.experience-copilot .preview-panel {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.experience-copilot .preview-container {
  padding: 0 !important;
}
body.experience-copilot .preview-sim-inner {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
}
body.experience-copilot #previewIframe {
  border: none !important;
  border-radius: 0 !important;
  background: #fff !important;
}

/* Modern Adaptive Web styling */
body.experience-adaptive .wizard-step-badge {
  background: linear-gradient(135deg, #0176d3 0%, #00ac5b 100%);
  box-shadow: 0 2px 8px rgba(1, 118, 211, 0.2);
}

body.experience-adaptive .wizard-section[open] > summary .wizard-step-badge {
  transform: scale(1.1);
}

body.experience-adaptive .wizard-subsection-title {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #6b7280 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 16px !important;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.messaging-builder-wrap {
  margin-top: 8px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e8eaed;
}

.messaging-builder-heading {
  font-size: 16px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 8px;
}

.sms-builder-hint {
  font-size: 13px;
  color: #706e6b;
  margin: 0 0 12px;
  line-height: 1.45;
}

.msg-builder-row-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 12px;
}

.msg-builder-row:last-child .msg-builder-row-inner {
  border-bottom: none;
  margin-bottom: 0;
}

.msg-builder-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-builder-field label {
  font-size: 12px;
  font-weight: 600;
  color: #3e3e3c;
}

.msg-sender-wrap {
  flex: 0 0 160px;
}

.msg-sender-wrap .msg-sender-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #dddbda;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}

.msg-text-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.msg-text-container {
  position: relative;
}

.msg-text-wrap .msg-text {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid #dddbda;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.msg-link-popup {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 6px;
  border: 1px solid #0176d3;
  border-radius: 4px;
  background: #fff;
  color: #0176d3;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.msg-link-popup:hover {
  background: #0176d3;
  color: #fff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.msg-link-popup:active {
  transform: scale(0.95);
}

.msg-media-wrap {
  flex: 1 1 220px;
  min-width: 180px;
}

.msg-media-wrap .msg-media-file {
  font-size: 13px;
  max-width: 100%;
}

.msg-media-wrap .msg-media-status {
  font-size: 12px;
  margin-top: 4px;
}

.msg-clear-image-btn {
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #dddbda;
  border-radius: 4px;
  background: #fff;
  color: #3e3e3c;
  cursor: pointer;
  align-self: flex-start;
}

.msg-clear-image-btn:hover:not(:disabled) {
  background: #f3f3f3;
}

.msg-clear-image-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.msg-actions {
  flex: 0 0 auto;
  align-self: flex-end;
  padding-top: 22px;
}

.msg-delete-btn {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid #c23934;
  border-radius: 4px;
  background: #fff;
  color: #c23934;
  cursor: pointer;
}

.msg-delete-btn:hover:not(:disabled) {
  background: #fef1f1;
}

.msg-delete-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Shared "pill button" style — used everywhere we want a clean, matching
   secondary action (Add Message, Clear all, Restore default, message-builder
   toolbar helpers). Uses SFDC blue outline, hover fills lightly. */
.add-message-btn,
.msg-move-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #2a94d6;
  border-radius: 6px;
  background: #fff;
  color: #2a94d6;
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
  line-height: 1;
}
.add-message-btn:hover,
.msg-move-btn:hover {
  background: #f3f9fc;
}
.add-message-btn:focus-visible,
.msg-move-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.2);
}
/* Secondary variant — for lower-emphasis actions like "Clear all" that
   shouldn't compete visually with the primary Add. */
.msg-move-btn {
  border-color: #d1d5db;
  color: #374151;
}
.msg-move-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Native <input type="file"> is browser-default ugly. Style the ::file-selector-button
   to match our secondary pill. Applies everywhere across the app. */
input[type="file"] {
  font-family: inherit;
  font-size: 13px;
  color: #4b5563;
}
input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
  display: inline-block;
  padding: 7px 14px;
  margin-right: 10px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Native <select> chevron polish — matches the outline aesthetic and rounds
   the corners so it doesn't look like a 2003 form control. */
select:not(.component-select-dropdown):not(.config-select-modern):not(.rcs-type-select):not(.rcs-sender-select) {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b7280' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  color: #202124;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
select:not(.component-select-dropdown):not(.config-select-modern):not(.rcs-type-select):not(.rcs-sender-select):hover {
  border-color: #9ca3af;
}
select:not(.component-select-dropdown):not(.config-select-modern):not(.rcs-type-select):not(.rcs-sender-select):focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.15);
}

/* —— Modern generator controls (Tailwind-like: gray-50 fields, rounded-lg, custom chevrons) —— */
.component-select-wrap {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.component-select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.component-select-dropdown {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  max-width: none;
  padding: 10px 40px 10px 14px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.component-select-dropdown:hover {
  border-color: #9ca3af;
  box-shadow: none;
}

.component-select-dropdown:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.12);
}

.config-select-wrap {
  position: relative;
}

.config-select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.config-select-modern {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: var(--config-input-min-height, 2.75rem);
  padding: var(--config-input-pad-y, 0.65rem) 2.5rem var(--config-input-pad-y, 0.65rem) var(--config-input-pad-x, 0.875rem);
  font-size: 0.9375rem;
  font-family: "Salesforce Sans", Arial, sans-serif;
  border: var(--config-border, 1px solid #d1d5db);
  border-radius: var(--config-radius, 10px);
  background-color: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-select-modern:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: var(--config-focus-ring, 0 0 0 3px rgba(42, 148, 214, 0.15));
}

.config-input-modern,
.config-textarea-modern {
  width: 100%;
  min-height: var(--config-input-min-height, 2.75rem);
  padding: var(--config-input-pad-y, 0.65rem) var(--config-input-pad-x, 0.875rem);
  font-size: 0.9375rem;
  font-family: "Salesforce Sans", Arial, sans-serif;
  border: var(--config-border, 1px solid #d1d5db);
  border-radius: var(--config-radius, 10px);
  background-color: #f9fafb;
  color: #374151;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-textarea-modern {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.45;
}

.config-input-modern:focus,
.config-textarea-modern:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: var(--config-focus-ring, 0 0 0 3px rgba(42, 148, 214, 0.15));
}

.hero-url-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.hero-url-field-row .config-input-modern {
  flex: 1 1 180px;
  min-width: 0;
  min-height: var(--config-input-min-height, 2.75rem);
}

.cloudinary-upload-btn {
  flex: 0 0 auto;
  min-height: var(--config-input-min-height, 2.75rem);
  padding: 0 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: "Salesforce Sans", Arial, sans-serif;
  color: #032d60;
  background: #fff;
  border: 1px solid #00ac5b;
  border-radius: var(--config-radius, 10px);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cloudinary-upload-btn:hover {
  background: #ecfdf5;
  color: #047857;
}

/* Adaptive section: align persona + brand fields with modern styling */
body.experience-adaptive .adaptive-only .form-group input[type="text"],
body.experience-adaptive .adaptive-only .form-group input[type="url"],
body.experience-adaptive .adaptive-only .form-group input[type="email"],
body.experience-adaptive .adaptive-only .form-group input[type="tel"] {
  min-height: var(--config-input-min-height, 2.75rem);
  padding: var(--config-input-pad-y, 0.65rem) var(--config-input-pad-x, 0.875rem);
  font-size: 0.9375rem;
  border: var(--config-border, 1px solid #d1d5db);
  border-radius: var(--config-radius, 10px);
  background-color: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.experience-adaptive .adaptive-only .form-group input[type="text"]:focus,
body.experience-adaptive .adaptive-only .form-group input[type="url"]:focus,
body.experience-adaptive .adaptive-only .form-group input[type="email"]:focus,
body.experience-adaptive .adaptive-only .form-group input[type="tel"]:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: var(--config-focus-ring, 0 0 0 3px rgba(42, 148, 214, 0.15));
}

body.experience-adaptive .adaptive-only .form-group textarea:not(.config-textarea-modern) {
  min-height: 5.5rem;
  padding: var(--config-input-pad-y, 0.65rem) var(--config-input-pad-x, 0.875rem);
  border: var(--config-border, 1px solid #d1d5db);
  border-radius: var(--config-radius, 10px);
  background-color: #f9fafb;
  font-size: 0.9375rem;
}

body.experience-adaptive .adaptive-only .form-group textarea:not(.config-textarea-modern):focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: var(--config-focus-ring, 0 0 0 3px rgba(42, 148, 214, 0.15));
}

/* ── Adaptive Web configure: Step 1 (UX) — typography & hierarchy only ──
   Scoped to experience-adaptive + configure tab so email/SMS are unchanged. */
body.experience-adaptive
  #configForm
  .form-section.adaptive-only.config-tab-section[data-config-tab="configure"]
  > h3 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #181818;
  margin-bottom: 0.5rem;
}

body.experience-adaptive
  #configForm
  .form-section.adaptive-only.config-tab-section[data-config-tab="configure"]
  > p.sms-builder-hint:first-of-type {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #3e3e3c;
  margin: 0 0 1.25rem;
  max-width: 36rem;
}

body.experience-adaptive details.wizard-section {
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 6px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

body.experience-adaptive details.wizard-section[open] {
  border-color: #cbd5e1;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 10px 32px rgba(15, 23, 42, 0.08);
}

body.experience-adaptive details.wizard-section summary {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  padding: 16px 18px;
  color: #0f172a;
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
  border-bottom: 1px solid transparent;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.15s ease;
  list-style: none;
}

body.experience-adaptive details.wizard-section summary::-webkit-details-marker {
  display: none;
}

body.experience-adaptive details.wizard-section[open] summary {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

body.experience-adaptive .wizard-section-body {
  padding: 1.35rem 1.25rem 1.25rem;
  animation: wizBodyIn 0.28s ease-out;
}

@keyframes wizBodyIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.experience-adaptive .wizard-section-body {
    animation: none;
  }

  body.experience-adaptive details.wizard-section {
    transition: none;
  }

  body.experience-adaptive details.wizard-section summary {
    transition: none;
  }
}

body.experience-adaptive details.wizard-section .form-group {
  margin-bottom: 1.25rem;
}

body.experience-adaptive details.wizard-section .form-group label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #202124;
  margin-bottom: 0.4rem;
}

body.experience-adaptive details.wizard-section .form-group small {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #5f6368;
  margin-top: 0.35rem;
}

body.experience-adaptive details.wizard-section .sms-builder-hint {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #3e3e3c;
  font-weight: 600;
  margin: 1.25rem 0 0.875rem;
}

body.experience-adaptive details.wizard-section .sms-builder-hint:first-child {
  margin-top: 0;
}

body.experience-adaptive details.wizard-section .config-input-modern,
body.experience-adaptive details.wizard-section .config-textarea-modern,
body.experience-adaptive details.wizard-section .config-select-modern {
  font-size: 0.9375rem;
}

body.experience-adaptive details.wizard-section .cloudinary-upload-btn {
  font-size: 0.9375rem;
}

body.experience-adaptive details.wizard-section .messaging-builder-heading {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

body.experience-adaptive details.wizard-section .matrix-card-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

/* Step 2 UX: subsections inside wizard steps (Step 3 & 4) */
body.experience-adaptive details.wizard-section .wizard-subsection {
  margin: 0 0 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid #eceff3;
}

body.experience-adaptive details.wizard-section .wizard-subsection:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

body.experience-adaptive details.wizard-section .wizard-subsection-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #181818;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

body.experience-adaptive details.wizard-section .wizard-subsection-desc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #5f6368;
  font-weight: 400;
  margin: 0 0 1rem;
  max-width: 38rem;
}

body.experience-adaptive details.wizard-section .wizard-subsection .matrix-card-heading {
  margin-top: 0.75rem;
}

/* Adaptive wizard — “studio” shell, progress rail, step badges */
body.experience-adaptive .adaptive-wizard-shell {
  padding: 1rem 1rem 0.25rem;
  margin-bottom: 0.5rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(232, 244, 252, 0.65) 0%, rgba(255, 255, 255, 0.95) 42%, rgba(240, 253, 250, 0.5) 100%);
  border: 1px solid rgba(42, 148, 214, 0.12);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.04);
}

body.experience-adaptive .adaptive-wizard-tagline {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #475569;
  margin: 0 0 0.875rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(42, 148, 214, 0.22);
}

body.experience-adaptive .wiz-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 2px;
  margin-bottom: 1.1rem;
  padding: 0 0.25rem;
}

body.experience-adaptive .wiz-track-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
  color: #64748b;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e2e8f0;
  cursor: default;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}

body.experience-adaptive .wiz-track-dot.is-current {
  color: #fff;
  background: linear-gradient(135deg, #2a94d6 0%, #47b4ea 100%);
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(42, 148, 214, 0.4);
  transform: scale(1.08);
}

body.experience-adaptive .wiz-track-connector {
  width: 10px;
  height: 2px;
  background: linear-gradient(90deg, #cbd5e1, #e2e8f0);
  border-radius: 2px;
  flex-shrink: 0;
}

body.experience-adaptive details.wizard-section summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  padding-right: 2.25rem;
  border-radius: 0;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

body.experience-adaptive details.wizard-section summary:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

body.experience-adaptive details.wizard-section summary::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

body.experience-adaptive details.wizard-section[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 0;
}

body.experience-adaptive .wizard-step-badge {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #2a94d6 0%, #5eb8f0 100%);
  box-shadow: 0 2px 10px rgba(42, 148, 214, 0.35);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

body.experience-adaptive details.wizard-section[open] .wizard-step-badge {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
  box-shadow: 0 2px 12px rgba(5, 150, 105, 0.35);
}

body.experience-adaptive details.wizard-section summary:hover .wizard-step-badge {
  transform: scale(1.05);
}

body.experience-adaptive .wizard-step-summary-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  line-height: 1.35;
}

body.experience-adaptive details.wizard-section {
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.035);
  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}

body.experience-adaptive details.wizard-section:hover {
  border-color: rgba(42, 148, 214, 0.2);
}

body.experience-adaptive details.wizard-section[open] {
  border-color: rgba(42, 148, 214, 0.28);
  box-shadow: 0 8px 28px rgba(42, 148, 214, 0.08);
}

body.experience-adaptive details.wizard-section[open] summary {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

body.experience-adaptive .wizard-section-body {
  animation: wiz-body-in 0.35s ease-out;
}

@keyframes wiz-body-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.experience-adaptive .wizard-section-body {
    animation: none;
  }
  body.experience-adaptive .wiz-track-dot,
  body.experience-adaptive details.wizard-section summary::after,
  body.experience-adaptive .wizard-step-badge {
    transition: none;
  }
}

/* ── Adaptive Web full-screen onboarding ── */
body.adaptive-onboarding-open {
  overflow: hidden;
}

.adaptive-onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  box-sizing: border-box;
}

.adaptive-onboarding-overlay.hidden {
  display: none;
}

.adaptive-onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.82) 0%, rgba(30, 58, 95, 0.75) 50%, rgba(15, 118, 110, 0.35) 100%);
  backdrop-filter: blur(6px);
}

.adaptive-onboarding-modal {
  position: relative;
  width: 100%;
  max-width: min(46rem, 100%);
  max-height: min(92vh, 52rem);
  overflow: auto;
  padding: 2rem 2.25rem 1.75rem;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.adaptive-onboarding-progress {
  margin-bottom: 1.5rem;
}

.adaptive-onboarding-progress-track {
  height: 8px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}

.adaptive-onboarding-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2a94d6, #34d399);
  transition: width 0.35s ease;
}

.adaptive-onboarding-title {
  font-family: "Open Sans", sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin: 0 0 0.65rem;
  line-height: 1.2;
}

.adaptive-onboarding-subtitle {
  font-size: 1rem;
  line-height: 1.55;
  color: #64748b;
  margin: 0 0 1.35rem;
}

.adaptive-onboarding-body {
  min-height: 10rem;
  margin-bottom: 1.25rem;
}

.adaptive-onboarding-error {
  font-size: 0.875rem;
  color: #b91c1c;
  margin: 0 0 0.75rem;
}

.adaptive-onboarding-error.hidden {
  display: none;
}

.adaptive-onboarding-field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #475569;
  margin: 0.75rem 0 0.35rem;
}

.adaptive-onboarding-field-label:first-of-type {
  margin-top: 0;
}

.adaptive-onboarding-form-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.adaptive-onboarding-field-hint {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #64748b;
}

.adaptive-onboarding-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
}

.adaptive-onboarding-input-grow {
  flex: 1 1 12rem;
  min-width: 0;
}

.adaptive-onboarding-upload-row .adaptive-onboarding-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.adaptive-onboarding-color-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.adaptive-onboarding-hex-input {
  flex: 1 1 8rem;
  min-width: 7rem;
  max-width: 10rem;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
}

.adaptive-onboarding-color-swatch {
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
}

.adaptive-onboarding-color-swatch:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.15);
}

.adaptive-onboarding-gradient-stop-label {
  display: block;
  margin-top: 0.65rem;
  margin-bottom: 0.2rem;
  font-size: 0.8125rem;
}

.adaptive-onboarding-sublabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.adaptive-onboarding-persona-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.adaptive-onboarding-persona-grid .adaptive-onboarding-input {
  margin-bottom: 0.15rem;
}

.adaptive-onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

#adaptiveOnboardingBack:not(.hidden) {
  margin-right: auto;
}

.adaptive-onboarding-actions-trailing {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  justify-content: flex-end;
  flex: 1 1 12rem;
  min-width: 0;
}

.adaptive-onboarding-actions--first-step .adaptive-onboarding-actions-trailing {
  flex: 1 1 100%;
  justify-content: stretch;
}

.adaptive-onboarding-actions--first-step .adaptive-onboarding-actions-trailing > .adaptive-onboarding-btn {
  flex: 1 1 0;
  min-width: 0;
}

.adaptive-onboarding-btn {
  min-height: 3rem;
  padding: 0 1.35rem;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Salesforce Sans", Arial, sans-serif;
  cursor: pointer;
  border: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.adaptive-onboarding-btn:active {
  transform: scale(0.98);
}

.adaptive-onboarding-btn-primary {
  background: linear-gradient(135deg, #2a94d6 0%, #47b4ea 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 148, 214, 0.4);
}

.adaptive-onboarding-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(42, 148, 214, 0.45);
}

.adaptive-onboarding-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.adaptive-onboarding-btn-secondary:hover {
  background: #e2e8f0;
}

.adaptive-onboarding-btn.hidden {
  display: none;
}

.adaptive-onboarding-chips {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.adaptive-onboarding-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.adaptive-onboarding-chip:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.adaptive-onboarding-chip.is-selected {
  border-color: #2a94d6;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
  box-shadow: 0 0 0 1px rgba(42, 148, 214, 0.2);
}

.adaptive-onboarding-chip-sub {
  display: block;
  margin-top: 0.2rem;
  font-weight: 400;
  color: #64748b;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.adaptive-onboarding-input {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  font-size: 1.0625rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.adaptive-onboarding-input:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .adaptive-onboarding-progress-fill,
  .adaptive-onboarding-btn,
  .adaptive-onboarding-chip {
    transition: none;
  }
}

/* ==============================================================
   RCS builder — copilot-sim style: wrap-flex header, tone accents.
   ============================================================== */
.rcs-msg-row {
  container-type: inline-size;
  container-name: rcsrow;
  margin-bottom: 14px;
}
.rcs-msg-row .msg-builder-row-inner {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5e5e5;
  border-left: 4px solid var(--rcs-tone-accent, #2a94d6);
  border-radius: 10px;
  background: var(--rcs-tone-bg, #fff);
  /* override generic .msg-builder-row-inner spacing so it doesn't fight us */
  margin-bottom: 0;
  padding-bottom: 14px;
  transition: box-shadow 200ms ease;
}
.rcs-msg-row.is-focused .msg-builder-row-inner {
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.2), 0 4px 16px rgba(42, 148, 214, 0.12);
}
.rcs-msg-row .rcs-row-body {
  align-self: stretch;
  width: 100%;
}

/* Top line: numbered badge · type select · sender select · Delete */
.rcs-row-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.rcs-row-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rcs-tone-accent, #2a94d6);
  color: #fff;
  font-family: "Open Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rcs-type-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--rcs-tone-accent, #dadce0);
  color: var(--rcs-tone-accent, #5f6368);
  flex-shrink: 0;
  padding: 3px;
}
.rcs-type-thumb svg { width: 100%; height: 100%; display: block; }
.rcs-row-topline .rcs-type-select {
  padding: 8px 10px;
  border: 1px solid var(--rcs-tone-accent, #dadce0);
  border-radius: 6px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--rcs-tone-label, #202124);
  background: #fff;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}
.rcs-row-topline .rcs-sender-select {
  padding: 8px 10px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 13px;
  color: #3c4043;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.rcs-row-topline .rcs-row-delete {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid #c23934;
  border-radius: 6px;
  background: #fff;
  color: #c23934;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease;
}
.rcs-row-topline .rcs-row-delete:hover { background: #fef1f1; }
.rcs-row-topline .rcs-row-delete:disabled { opacity: 0.35; cursor: not-allowed; }

/* Drag-reorder grip. Small, unobtrusive; hidden on follow-up rows so
   coupled pairs move as a unit driven by the parent's grip. */
.rcs-row-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 26px;
  background: transparent;
  border: 0;
  color: var(--rcs-tone-label, #6b7280);
  cursor: grab;
  font-size: 14px;
  letter-spacing: -2px;
  user-select: none;
  padding: 0;
  margin-right: 2px;
}
.rcs-row-grip:hover { color: #202124; }
.rcs-row-grip:active { cursor: grabbing; }
.rcs-msg-row:has(.rcs-triggered-banner) .rcs-row-grip { visibility: hidden; }
.rcs-msg-row.is-dragging { opacity: 0.4; }
.rcs-drop-indicator {
  height: 3px;
  margin: 4px 0;
  background: #2a94d6;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(42, 148, 214, 0.5);
  pointer-events: none;
}

/* While a drag is active, collapse every row to just its topline so the
   SE can see the whole thread at a glance and pick a drop slot. Mirrors
   the MCN Demo Builder's subtopic reorder pattern. Snaps rather than
   animates — matches the reference and avoids drop-target thrash. */
#messagesContainer.is-reordering .rcs-row-body { display: none; }
#messagesContainer.is-reordering .msg-builder-row {
  margin-bottom: 4px;
  padding: 6px 10px;
}
#messagesContainer.is-reordering .msg-builder-row .rcs-row-topline {
  gap: 8px;
}

/* Body area sits inside a white card so tinted parent stays a visual frame */
.rcs-row-body {
  background: #ffffff;
  border: 1px solid #eceef2;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rcs-row-body .msg-builder-field { margin: 0; min-width: 0; }
.rcs-row-body > .msg-builder-field > label,
.rcs-chips-wrap > label,
.rcs-card-editor .msg-builder-field > label,
.rcs-carousel-card .msg-builder-field > label {
  display: block;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 6px;
}

/* Every RCS-scoped input/select/textarea stretches full width */
.rcs-msg-row input[type="text"],
.rcs-msg-row input[type="url"],
.rcs-msg-row input[type="email"],
.rcs-msg-row textarea,
.rcs-row-body select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 14px;
  color: #202124;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.rcs-msg-row input:focus,
.rcs-msg-row textarea:focus,
.rcs-msg-row select:focus {
  outline: none;
  border-color: #2a94d6;
  box-shadow: 0 0 0 3px rgba(42, 148, 214, 0.15);
}
.rcs-msg-row textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}
.rcs-row-body small,
.rcs-row-body .rcs-help-text {
  display: block;
  font-size: 12px;
  color: #5f6368;
  margin-top: 4px;
  line-height: 1.5;
}

/* Nested chip / button lists in an inset panel */
.rcs-chips-wrap {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 12px;
}
.rcs-chip-list,
.rcs-btn-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.rcs-chip-item,
.rcs-btn-item {
  background: #fff;
  border: 1px solid #e0e3e6;
  border-radius: 8px;
  padding: 12px;
  position: relative;
}
.rcs-chip-item.is-primary,
.rcs-btn-item.is-primary {
  border-color: #2a94d6;
  box-shadow: 0 0 0 1px #2a94d6, 0 1px 3px rgba(42, 148, 214, 0.15);
}
.rcs-chip-item.is-primary::before,
.rcs-btn-item.is-primary::before {
  content: "★ Primary";
  position: absolute;
  top: -9px;
  left: 10px;
  background: #2a94d6;
  color: #fff;
  font-family: "Open Sans", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
  pointer-events: none;
}

/* Radio + explanation row at the top of each chip/button editor. Clicking
   anywhere on the label toggles the underlying radio (browser default). */
.rcs-primary-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 10px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 12px;
  color: #5f6368;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px dashed #e0e3e6;
  margin-bottom: 10px;
}
.rcs-primary-toggle input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: #2a94d6;
  flex-shrink: 0;
}
.rcs-chip-item.is-primary .rcs-primary-toggle,
.rcs-btn-item.is-primary .rcs-primary-toggle {
  color: #2a94d6;
  font-weight: 600;
}
.rcs-chip-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: end; /* everything sits on the same baseline (input bottom edge) */
}
.rcs-chip-fields .msg-builder-field { flex: 1 1 140px; min-width: 0; }
/* Full-width rows: chip/button label, target, and the (multiline) response
   bubble textarea. Keeping Action select at flex-1 lets it sit next to nothing
   on its own row (natural width) so wrapping stays clean. */
.rcs-chip-fields .msg-builder-field:nth-child(1),
.rcs-chip-fields .msg-builder-field.rcs-chip-target-wrap,
.rcs-chip-fields .msg-builder-field.rcs-btn-target-wrap,
.rcs-chip-fields .msg-builder-field.rcs-chip-response-wrap,
.rcs-chip-fields .msg-builder-field.rcs-btn-response-wrap {
  flex-basis: 100%;
}
.rcs-chip-fields textarea { min-height: 90px; resize: vertical; line-height: 1.4; }

/* "Triggers a rich card…" pill inside a chip/button editor */
.rcs-triggered-tag {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  background: #eef4fb;
  border: 1px solid #cfe1f2;
  border-radius: 6px;
  font-size: 12px;
  color: #16548b;
  line-height: 1.4;
}
/* Respect the [hidden] attribute — CSS display would otherwise override it */
.rcs-triggered-tag[hidden] { display: none; }
.rcs-triggered-tag-icon {
  color: #2a94d6;
  font-weight: 700;
}
.rcs-response-type-row {
  margin-bottom: 8px;
}
.rcs-response-type-row select {
  width: 100%;
}

/* "Triggered by tap on X" banner inside a card editor whose parent message
   was auto-inserted as a chip/button response */
.rcs-triggered-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: #f0f6fc;
  border: 1px solid #cfe1f2;
  border-radius: 6px;
  font-size: 12px;
  color: #16548b;
}
.rcs-triggered-banner strong { color: #202124; }
.rcs-chip-fields label {
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
/* Response-bubble label is a sentence, not a form-field mini-label, so keep it readable */
.rcs-chip-fields .rcs-chip-response-wrap > label,
.rcs-chip-fields .rcs-btn-response-wrap > label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: #202124;
}
.rcs-chip-actions {
  flex-basis: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}
.rcs-chip-actions label { display: none; }
.rcs-chip-delete,
.rcs-btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #dadce0;
  color: #5f6368;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  transition: all 120ms ease;
}
.rcs-chip-delete svg,
.rcs-btn-delete svg {
  flex-shrink: 0;
  stroke: currentColor;
}
.rcs-chip-delete:hover,
.rcs-btn-delete:hover {
  background: #fce8e6;
  color: #c5221f;
  border-color: #f6b9b6;
}
.rcs-chip-delete:focus-visible,
.rcs-btn-delete:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 34, 31, 0.15);
  border-color: #c5221f;
}

/* Inline hint inside a field's <label> — small, muted, non-bolded */
.rcs-field-hint-inline {
  font-weight: 400;
  color: #80868b;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  margin-left: 2px;
}

/* Space the add / clear / restore row away from the last message card,
   and let the three buttons flow onto multiple lines at narrow widths. */
.msg-builder-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Ghost + buttons */
.rcs-add-chip-btn,
.rcs-add-cardbtn-btn,
.rcs-add-card-btn {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  color: #2a94d6;
  border: 1px dashed #2a94d6;
  border-radius: 8px;
  font-family: "Open Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}
.rcs-add-chip-btn:hover,
.rcs-add-cardbtn-btn:hover,
.rcs-add-card-btn:hover {
  background: rgba(42, 148, 214, 0.08);
  border-style: solid;
}
.rcs-add-chip-btn:disabled,
.rcs-add-cardbtn-btn:disabled,
.rcs-add-card-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Rich-card editor and carousel cards */
.rcs-card-editor,
.rcs-carousel-card {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rcs-card-editor .rcs-card-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rcs-carousel-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 10px;
}
.rcs-carousel-card { border-left: 3px solid #2a94d6; }
.rcs-carousel-card-header {
  display: flex; align-items: center; justify-content: space-between;
}
.rcs-carousel-card-header strong {
  font-family: "Open Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #202124;
}
.rcs-card-delete {
  background: transparent;
  border: 1px solid #dadce0;
  color: #5f6368;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}
.rcs-card-delete:hover:not(:disabled) { background: #fce8e6; color: #c5221f; border-color: #f6b9b6; }
.rcs-card-delete:disabled { opacity: 0.3; cursor: not-allowed; }

/* Verified checkbox row */
.rcs-verified-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.rcs-verified-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Salesforce Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  cursor: pointer;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}
.rcs-verified-label input[type="checkbox"] {
  width: 16px; height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: #2a94d6;
}
.rcs-verified-hint {
  display: block;
  font-size: 12px;
  color: #5f6368;
  margin-left: 24px;
  line-height: 1.4;
}
/* When iOS is selected, dim the whole toggle to signal it has no effect. */
.rcs-verified-wrap.is-ios-disabled .rcs-verified-label {
  opacity: 0.45;
  cursor: not-allowed;
}
.rcs-verified-wrap.is-ios-disabled .rcs-verified-label input[type="checkbox"] {
  cursor: not-allowed;
}
.rcs-card-media-file { display: block; margin-top: 8px; font-size: 12px; }
.rcs-card-media-status.upload-status {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #5f6368;
}

/* RCS section headings */
body.experience-rcs .form-section.rcs-only h3 {
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  margin-bottom: 16px;
}
.rcs-msg-row .form-group { margin-bottom: 0; }
body.experience-rcs #messagesContainer { display: block; }
body.experience-rcs #messagesContainer > .rcs-msg-row { width: 100%; }

