    :root {
      /* Light Mode (Default) */
      --primary: #735274;  /* plum */
      --accent: #ffffff;   /* cream */
      --success: #40916c;
      --danger: #d00000;
      --warning: #f9c74f;
      --bg-primary: #ffffff;
      --bg-secondary: #ffffff;
      --text-primary: #3b2c3d;
      --text-secondary: #666;
      --border-color: #eee;
      --shadow-color: rgba(115, 82, 116, 0.2);
    }

    [data-theme="dark"] {
      /* Dark Mode */
      --primary: #735274;  /* keep plum */
      --accent: #f4f4f4;   /* light gray text */
      --success: #40916c;
      --danger: #b00020;
      --warning: #f9c74f;
      --bg-primary: #1c1c1c;
      --bg-secondary: #2a2a2a;
      --text-primary: #f4f4f4;
      --text-secondary: #b0b0b0;
      --border-color: #404040;
      --shadow-color: rgba(0, 0, 0, 0.3);
    }

    * {
      transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, border-color 0.3s ease-in-out;
    }

    body {
      font-family: 'Inter', sans-serif;
      background-color: transparent;
      color: var(--text-primary);
      margin: 0;
      padding: 0;
    }


    .container {
      max-width: 720px;
      margin: 40px auto;
      padding: 0 20px;
    }

    .content-header {
      margin-bottom: 30px;
      text-align: center;
    }

    .content-header h1 {
      color: var(--primary);
      margin: 0 0 10px 0;
      font-weight: 600;
      font-size: 2rem;
    }

    .breadcrumb {
      margin-bottom: 30px;
    }

    .breadcrumb a {
      color: var(--primary);
      text-decoration: none;
      font-weight: 500;
    }

    .breadcrumb a:hover {
      text-decoration: underline;
    }

    .form-container {
      background: var(--bg-secondary);
      padding: 40px;
      border-radius: 12px;
      box-shadow: 0 6px 24px var(--shadow-color);
    }

    /* Wizard Progress Bar */
    .wizard-progress {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 40px;
      padding: 0 20px;
    }

    .progress-step {
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      flex: 1;
    }

    .progress-step:not(:last-child)::after {
      content: '';
      position: absolute;
      top: 20px;
      left: calc(50% + 20px);
      width: calc(100% - 40px);
      height: 2px;
      background: var(--border-color);
      z-index: 1;
    }

    .progress-step.completed::after {
      background: var(--primary);
    }

    .step-circle {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--border-color);
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 14px;
      z-index: 2;
      position: relative;
      transition: all 0.3s ease;
    }

    .progress-step.active .step-circle {
      background: var(--primary);
      color: white;
    }

    .progress-step.completed .step-circle {
      background: var(--success);
      color: white;
    }

    .step-label {
      margin-top: 8px;
      font-size: 12px;
      text-align: center;
      color: var(--text-secondary);
      font-weight: 500;
    }

    .progress-step.active .step-label {
      color: var(--primary);
      font-weight: 600;
    }

    /* Wizard Steps */
    .wizard-step {
      display: none;
    }

    .wizard-step.active {
      display: block;
    }

    .step-header {
      margin-bottom: 30px;
      text-align: center;
    }

    .step-title {
      font-size: 1.8rem;
      font-weight: 600;
      color: var(--primary);
      margin-bottom: 10px;
    }

    .step-description {
      color: var(--text-secondary);
      font-size: 1rem;
      line-height: 1.5;
    }

    /* Wizard Navigation */
    .wizard-navigation {
      display: flex;
      justify-content: space-between;
      margin-top: 40px;
      padding-top: 20px;
      border-top: 1px solid var(--border-color);
    }

    .btn-wizard {
      background-color: var(--primary);
      color: white;
      border: none;
      padding: 12px 24px;
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      font-size: 1rem;
      font-family: inherit;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .btn-wizard:hover:not(:disabled) {
      background-color: #5e425d;
      transform: translateY(-1px);
    }

    .btn-wizard:disabled {
      background-color: #c0c0c0;
      color: #666;
      cursor: not-allowed;
      transform: none;
    }

    .btn-wizard.secondary {
      background-color: transparent;
      color: var(--text-secondary);
      border: 1px solid var(--border-color);
    }

    .btn-wizard.secondary:hover:not(:disabled) {
      background-color: var(--bg-primary);
      color: var(--primary);
      border-color: var(--primary);
    }

    /* Tooltips */
    .field-with-tooltip {
      position: relative;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tooltip-icon {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: var(--primary);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 600;
      cursor: help;
      position: relative;
    }

    .tooltip-content {
      position: absolute;
      bottom: 125%;
      left: 50%;
      transform: translateX(-50%);
      background: var(--text-primary);
      color: var(--bg-secondary);
      padding: 10px 14px;
      border-radius: 6px;
      font-size: 13px;
      line-height: 1.4;
      white-space: normal;
      max-width: 400px;
      min-width: 200px;
      z-index: 10000;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
      pointer-events: none;
    }

    .tooltip-content::after {
      content: '';
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent;
      border-top-color: var(--text-primary);
    }

    .tooltip-icon:hover .tooltip-content {
      opacity: 1;
      visibility: visible;
    }

    /* Required Field Indicators */
    .required-field {
      color: var(--danger);
      margin-left: 4px;
    }

    /* Step Cards */
    .step-card {
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 25px;
      margin-bottom: 20px;
    }

    .card-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 20px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--border-color);
    }

    .card-icon {
      font-size: 1.5rem;
    }

    .card-title {
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--primary);
      margin: 0;
    }

    /* Collapsible Steps for Power Users */
    .step-header.collapsible {
      cursor: pointer;
      user-select: none;
      transition: all 0.2s;
    }

    .step-header.collapsible:hover {
      background: var(--bg-primary);
      padding: 10px;
      margin: -10px;
      border-radius: 6px;
    }

    .collapse-indicator {
      display: inline-block;
      transition: transform 0.2s;
      margin-left: 8px;
      font-size: 0.8rem;
      color: var(--text-secondary);
    }

    .step-content.collapsed {
      display: none !important;
    }

    .step-header.collapsed .collapse-indicator {
      transform: rotate(-90deg);
    }

    .form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 20px;
    }

    .form-group {
      display: flex;
      flex-direction: column;
    }

    .form-group.full-width {
      grid-column: 1 / -1;
    }

    label {
      font-weight: 600;
      margin-bottom: 8px;
      color: var(--primary);
    }

    input, select {
      padding: 12px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-family: inherit;
      font-size: 1rem;
      width: 100%;
      box-sizing: border-box;
    }

    input:focus, select:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(115, 82, 116, 0.2);
    }

    .btn {
      background-color: var(--primary);
      color: var(--accent);
      border: none;
      padding: 15px 30px;
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      font-size: 1rem;
      font-family: inherit;
      transition: background-color 0.2s;
    }

    .btn:hover {
      background-color: #5e425d;
    }

    @media (max-width: 768px) {
      .container {
        margin: 16px auto;
        padding: 0 12px;
      }

      .content-header h1 {
        font-size: 1.4rem;
      }

      .form-container {
        padding: 20px 16px;
      }

      .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
      }

      .wizard-progress {
        padding: 0 4px;
        margin-bottom: 24px;
        gap: 4px;
      }

      .step-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
      }

      .step-label {
        font-size: 10px;
        margin-top: 4px;
      }

      .progress-step:not(:last-child)::after {
        top: 16px;
        left: calc(50% + 16px);
        width: calc(100% - 32px);
      }

      .step-title {
        font-size: 1.3rem;
      }

      .step-description {
        font-size: 0.9rem;
      }

      .wizard-navigation {
        margin-top: 24px;
        gap: 12px;
      }

      .btn-wizard {
        padding: 10px 18px;
        font-size: 0.9rem;
      }

      .thank-you-container {
        padding: 30px 20px;
      }

      .thank-you-container h1 {
        font-size: 24px;
      }

      .thank-you-container .message {
        font-size: 15px;
      }

      .success-icon {
        font-size: 60px;
      }
    }

    @media (max-width: 480px) {
      .step-label {
        display: none;
      }

      .wizard-progress {
        padding: 0;
      }

      .form-container {
        padding: 16px 12px;
      }
    }

    /* Loading Spinner Styles */
    .spinner-overlay {
      position: fixed;
      top: 0; 
      left: 0;
      width: 100vw; 
      height: 100vh;
      background: rgba(255, 255, 255, 0.7);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 9999;
      display: none;
    }

    .spinner {
      border: 8px solid #e6e6e6;
      border-top: 8px solid var(--primary); /* EZ Rates Plum */
      border-radius: 50%;
      width: 60px;
      height: 60px;
      animation: spin 1s linear infinite;
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    /* Thank You Section Styles */
    #thank-you-section {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 40px 20px;
      min-height: auto;
    }

    .thank-you-container {
      background: var(--bg-secondary);
      border-radius: 16px;
      padding: 60px 40px;
      max-width: 600px;
      width: 100%;
      text-align: center;
      box-shadow: 0 20px 60px var(--shadow-color);
    }

    .success-icon {
      font-size: 80px;
      margin-bottom: 20px;
      animation: scaleIn 0.5s ease-out;
      color: var(--success);
    }

    @keyframes scaleIn {
      from {
        transform: scale(0);
      }
      to {
        transform: scale(1);
      }
    }

    .thank-you-container h1 {
      color: var(--primary);
      font-size: 32px;
      margin-bottom: 20px;
      font-weight: 600;
    }

    .thank-you-container .message {
      color: var(--text-secondary);
      font-size: 18px;
      line-height: 1.6;
      margin-bottom: 30px;
    }
    
    /* Section Headers */
    .section-header {
      grid-column: 1 / -1;
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--primary);
      margin: 20px 0 10px 0;
      padding-bottom: 8px;
      border-bottom: 2px solid var(--primary);
    }
    
    /* Conditional Fields */
    .loan-type-fields {
      grid-column: 1 / -1;
      display: none;
    }
    
    .loan-type-fields.show {
      display: block;
    }
    
    .loan-type-fields .form-group {
      margin: 15px 0;
    }
    
    /* Checkbox styling */
    .form-group input[type="checkbox"] {
      width: auto;
      margin-right: 8px;
    }
    
    .checkbox-label {
      font-size: 0.9rem;
      color: var(--text-secondary);
    }

    /* ===== EMBED MODE STYLES ===== */
    body.embed-mode {
      background: transparent !important;
      margin: 0;
      padding: 0;
      min-height: auto;
    }

    body.embed-mode .container {
      max-width: 800px;
      margin: 0 auto;
      padding: 10px 20px;
    }

    body.embed-mode .branded-header {
      padding: 10px 0;
      margin-bottom: 5px;
    }

    body.embed-mode .content-header {
      padding: 15px 0 10px 0;
    }

    body.embed-mode .form-container {
      box-shadow: none;
      border: none;
      border-radius: 0;
    }

    body.embed-mode .powered-by {
      font-size: 0.7rem;
      margin-top: 10px;
      padding-top: 10px;
    }

    body.embed-mode #thank-you-section {
      min-height: auto !important;
    }

    body.embed-mode #thank-you-section .thank-you-container {
      padding: 30px 20px;
    }

    /* ===== EMBED-HIDDEN: hide new branded sections in embed mode ===== */
    body.embed-mode .embed-hidden {
      display: none !important;
    }

    /* Task #257: in embed mode, hide global chrome that isn't partner-relevant —
       global nav/headers/footers, the AI Application Assistant bar, the powered-by
       line, and anything the copilot widget may inject.
       NOTE: the multi-step form itself (.content-header / .form-container /
       .wizard-progress) is NO LONGER hidden here — a real borrower embed
       (?embed=true on a lender's site) must show the live form. The card-only
       (form-hidden) layout now lives under .preview-mode below and is gated to the
       branding-settings preview (?embed=true&preview=true). */
    body.embed-mode nav,
    body.embed-mode header.site-header,
    body.embed-mode .site-header,
    body.embed-mode .top-nav,
    body.embed-mode .main-nav,
    body.embed-mode .navbar,
    body.embed-mode .app-header,
    body.embed-mode .global-header,
    body.embed-mode .site-footer,
    body.embed-mode .global-footer,
    body.preview-mode #ai-assistant-inline,
    body.preview-mode .ai-assistant-bar,
    body.preview-mode #copilot-widget,
    body.preview-mode .copilot-widget,
    body.preview-mode .copilot-fab,
    body.embed-mode .powered-by,
    body.embed-mode .branded-powered-by {
      display: none !important;
    }

    /* preview-mode = branding-settings card-only preview (?embed=true&preview=true).
       Here we additionally hide the live form + wizard progress so the partner sees
       just their brand card. A real borrower embed (?embed=true, no preview flag)
       keeps the form visible. */
    body.preview-mode .content-header,
    body.preview-mode .form-container,
    body.preview-mode .wizard-progress {
      display: none !important;
    }

    body.embed-mode .branded-about-section {
      margin-top: 0;
    }

    /* Task #262: dismissible "Preview only" notice shown inside the embed
       iframe so partners viewing their branding settings understand that the
       multi-step application form is intentionally hidden in this preview. */
    .embed-preview-notice {
      display: none;
    }
    body.preview-mode .embed-preview-notice {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      max-width: 800px;
      margin: 12px auto 0;
      padding: 10px 14px;
      background: #eff6ff;
      border: 1px solid #bfdbfe;
      border-left: 3px solid #3b82f6;
      border-radius: 6px;
      color: #1e3a8a;
      font-size: 0.85rem;
      line-height: 1.4;
    }
    body.embed-mode .embed-preview-notice__icon {
      font-size: 1rem;
      line-height: 1.4;
      flex-shrink: 0;
    }
    body.embed-mode .embed-preview-notice__text {
      flex: 1;
    }
    body.embed-mode .embed-preview-notice__close {
      background: transparent;
      border: 0;
      color: #1e3a8a;
      font-size: 1.1rem;
      line-height: 1;
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 4px;
      flex-shrink: 0;
    }
    body.embed-mode .embed-preview-notice__close:hover {
      background: rgba(30, 58, 138, 0.08);
    }

    /* ===== VALUE PROP STRIP ===== */
    .value-prop-strip {
      display: flex;
      justify-content: center;
      gap: 24px;
      padding: 18px 20px;
      margin-bottom: 20px;
      background: var(--bg-secondary);
      border-radius: 10px;
      box-shadow: 0 2px 10px var(--shadow-color);
    }

    .value-prop-item {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1;
      min-width: 0;
    }

    .value-prop-icon {
      font-size: 1.6rem;
      flex-shrink: 0;
    }

    .value-prop-text {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-primary);
      line-height: 1.3;
    }

    @media (max-width: 600px) {
      .value-prop-strip {
        flex-direction: column;
        gap: 14px;
      }
      .value-prop-item {
        justify-content: flex-start;
      }
    }

    /* ===== ABOUT US SECTION ===== */
    .branded-about-section {
      margin-top: 28px;
      max-width: 760px;
      margin-left: auto;
      margin-right: auto;
    }

    .branded-about-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 10px;
      padding: 24px 28px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px var(--shadow-color);
    }

    .branded-about-card h3 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--primary);
      margin: 0 0 12px 0;
      padding-bottom: 10px;
      border-bottom: 2px solid var(--border-color);
    }

    .branded-about-description {
      font-size: 0.95rem;
      color: var(--text-primary);
      line-height: 1.65;
      margin-bottom: 14px;
    }

    .branded-about-meta {
      display: flex;
      gap: 24px;
      flex-wrap: wrap;
    }

    .branded-about-meta-item {
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    .branded-about-meta-item strong {
      color: var(--text-primary);
    }

    /* ===== SPECIALTY / GEOGRAPHIC CHIPS ===== */
    .branded-chips-section {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 10px;
      padding: 20px 28px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px var(--shadow-color);
    }

    .branded-chips-section h4 {
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin: 0 0 12px 0;
    }

    .branded-chips-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .branded-chip {
      display: inline-block;
      padding: 5px 14px;
      border-radius: 999px;
      font-size: 0.8rem;
      font-weight: 600;
      background: var(--bg-primary);
      border: 1.5px solid var(--primary);
      color: var(--primary);
      white-space: nowrap;
    }

    /* ===== BRANDED CONTACT FOOTER ===== */
    .branded-contact-footer {
      margin-top: 32px;
      border-radius: 10px;
      overflow: hidden;
      max-width: 760px;
      margin-left: auto;
      margin-right: auto;
    }

    .branded-footer-bar {
      padding: 20px 28px;
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      align-items: center;
      justify-content: center;
    }

    .branded-footer-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.88rem;
      font-weight: 500;
      color: #fff;
    }

    .branded-footer-item a {
      color: #fff;
      text-decoration: none;
    }

    .branded-footer-item a:hover {
      text-decoration: underline;
    }

    .branded-footer-icon {
      font-size: 1rem;
      flex-shrink: 0;
    }

    .branded-powered-by {
      text-align: center;
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-top: 8px;
      padding: 10px 0 6px 0;
      border-top: 1px solid var(--border-color);
    }

    @media (max-width: 600px) {
      .branded-footer-bar {
        flex-direction: column;
        gap: 14px;
        align-items: flex-start;
        padding: 16px 20px;
      }
    }

    /* ===== BRANDED TAGLINE ===== */
    .branded-company-tagline {
      font-size: 0.95rem;
      color: var(--text-secondary);
      margin: 4px 0 0 0;
      font-style: italic;
    }
