/* ------------------------------------------------------------------ */
/* AI SIGNUP WIZARD (ai_signup.html)                                   */
/* ------------------------------------------------------------------ */

.ai-signup-wrapper {
    padding: 3rem 0 5rem;
    min-height: calc(100vh - 80px);
    position: relative;
    background-size: cover;
    background-position: center;
}

.ai-signup-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    pointer-events: none;
}

.ai-signup-wrapper .container {
    position: relative;
}

/* Progress bar */
.ai-progress-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto 2.5rem;
}

.ai-progress-track {
    flex: 1;
    height: 4px;
    background: var(--border-stroke);
    border-radius: 2px;
    overflow: hidden;
}

.ai-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.ai-progress-fill[data-step="1"] { width: 16.66%; }
.ai-progress-fill[data-step="2"] { width: 33.33%; }
.ai-progress-fill[data-step="3"] { width: 50%; }
.ai-progress-fill[data-step="4"] { width: 66.66%; }
.ai-progress-fill[data-step="5"] { width: 83.33%; }
.ai-progress-fill[data-step="6"] { width: 100%; }

.ai-progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-text);
    white-space: nowrap;
}

/* Step card — matches signup-card but slightly wider */
.ai-step-card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--main-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    padding: 2.5rem;
}

/* Wide variant for step 5 which has more content */
.ai-step-card--wide {
    max-width: 760px;
}

.ai-step-header {
    margin-bottom: 2rem;
}

.ai-step-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin: 0.5rem 0 0.75rem;
}

.ai-step-intro {
    color: var(--secondary-color);
    font-size: 0.975rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.ai-step-body {
    margin-bottom: 2rem;
}

/* Description textarea — taller than default form-control */
.ai-description-area {
    resize: vertical;
    min-height: 140px;
    font-size: 0.9375rem;
    line-height: 1.65;
}

/* Hint block beneath the textarea */
.ai-prompt-hints {
    background: var(--alt-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}

.ai-hints-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.6rem;
}

.ai-hints-list {
    margin: 0;
    padding-left: 1.1rem;
    list-style: disc;
}

.ai-hints-list li {
    font-size: 0.875rem;
    color: var(--secondary-color);
    line-height: 1.6;
    padding: 0.15rem 0;
}

/* Step footer — back/continue row */
.ai-step-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-stroke);
}

/* On mobile: equal-width side-by-side buttons, no space-between gap */
@media (max-width: 575.98px) {
    .ai-step-footer {
        gap: 0.5rem;
        justify-content: stretch;
    }
    .ai-step-footer > .btn,
    .ai-step-footer > a.btn {
        flex: 1 1 0;
        min-width: 0;
        text-align: center;
    }
}

/* Preview loading progress bar */
.ai-preview-progress {
    width: 100%;
    max-width: 320px;
    height: 6px;
    background: var(--border-stroke);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.75rem auto 0;
}

.ai-preview-progress-bar {
    height: 100%;
    background: var(--primary-colour, #0f172a);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}

/* Character counter — shared with cms-dashboard, replicated here */
.char-counter {
    font-size: 0.72rem;
    color: var(--muted-text);
}

/* Text expand modal — matches edit_site.html pattern */
.text-expand-trigger {
    cursor: pointer;
    background-color: var(--alt-bg);
    border-radius: var(--sharp-radius);
    transition: background-color 0.15s ease;
}

.text-expand-trigger:focus {
    background-color: var(--main-bg);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.modal-expand-area {
    min-height: 220px;
    font-size: 0.95rem;
    border-radius: var(--sharp-radius);
    border: 1px solid var(--border-stroke);
    padding: 0.75rem;
    width: 100%;
    resize: vertical;
}

.modal-expand-area:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
    border-color: var(--accent-color);
}

.modal-header-editor {
    border-bottom: 1px solid var(--border-stroke);
}

.modal-footer-editor {
    border-top: 1px solid var(--border-stroke);
}

/* ------------------------------------------------------------------ */
/* STEP 2 — CHOICE CARDS (ai_signup_layout.html)                       */
/* ------------------------------------------------------------------ */

/* Group wrapper — label + hint + grid */
.ai-choice-group {
    border: none;
    padding: 0;
    margin: 0 0 2rem;
}

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

.ai-choice-legend {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.35rem;
    padding: 0;
    float: none;
    width: 100%;
}

.ai-choice-hint {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* Two-column grid of cards */
.ai-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Individual choice card — label wraps everything */
.ai-choice-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
    background: var(--main-bg);
    border: 1.5px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ai-choice-card:hover {
    border-color: var(--secondary-color);
}

/* Selected state — driven by JS adding .ai-choice-selected */
.ai-choice-card.ai-choice-selected {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.ai-choice-card.ai-choice-selected .ai-choice-icon {
    color: rgba(255, 255, 255, 0.85);
}

.ai-choice-card.ai-choice-selected .ai-choice-title {
    color: white;
}

.ai-choice-card.ai-choice-selected .ai-choice-body {
    color: rgba(255, 255, 255, 0.7);
}

/* Hide the native radio — selection is visual only */
.ai-choice-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ai-choice-icon {
    font-size: 1.4rem;
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: 0.1rem;
}

.ai-choice-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
}

.ai-choice-body {
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.5;
}

@media (max-width: 480px) {
    .ai-choice-grid {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------------ */
/* STEP 3 — IMAGE UPLOAD WIDGETS (ai_signup_upload.html)               */
/* ------------------------------------------------------------------ */

.ai-upload-group {
    margin-bottom: 1.75rem;
}

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

.ai-upload-label-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.ai-upload-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
}

.ai-upload-hint {
    font-size: 0.8125rem;
    color: var(--secondary-color);
}

.ai-upload-widget {
    border: 2px dashed var(--border-stroke);
    border-radius: var(--sharp-radius);
    padding: 0;
    background: var(--main-bg);
    transition: border-color 0.2s ease, background-color 0.2s ease;
    overflow: hidden;
}

.ai-upload-widget.ai-upload-dragover {
    border-color: var(--accent-color);
    background-color: var(--alt-bg);
}

.ai-upload-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1.5rem;
    color: var(--muted-text);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ai-upload-empty:hover {
    background-color: var(--alt-bg);
}

.ai-upload-empty-icon {
    font-size: 2rem;
    opacity: 0.4;
}

.ai-upload-empty-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

.ai-upload-empty-subtext {
    font-size: 0.75rem;
    opacity: 0.7;
}

.ai-upload-preview {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    display: block;
}

.ai-upload-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border-stroke);
    background: var(--alt-bg);
}

.ai-upload-status {
    font-size: 0.8rem;
    padding: 0 0.75rem 0.5rem;
    min-height: 1.2em;
}

.ai-upload-status.text-success { color: #28a745 !important; }
.ai-upload-status.text-danger  { color: #dc3545 !important; }

.ai-upload-spinner {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

/* Fade-in animation for step 2 choice groups */
@keyframes ai-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-choice-group {
    animation: ai-fade-up 0.35s ease both;
}

.ai-choice-group:nth-child(1) { animation-delay: 0s; }
.ai-choice-group:nth-child(2) { animation-delay: 0.1s; }
.ai-choice-group:nth-child(3) { animation-delay: 0.2s; }

/* Fade-in for step 3 upload groups */
.ai-upload-group {
    animation: ai-fade-up 0.35s ease both;
}

.ai-upload-group:nth-child(1) { animation-delay: 0s; }
.ai-upload-group:nth-child(2) { animation-delay: 0.1s; }

/* ------------------------------------------------------------------ */
/* STEP 4 — AI RECOMMENDATIONS (ai_signup_palette.html)                */
/* ------------------------------------------------------------------ */

/* Loading state */
.ai-analyse-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1.25rem;
}

.ai-analyse-spinner {
    color: var(--primary-color);
}

.ai-analyse-loading-text {
    font-size: 0.9375rem;
    color: var(--secondary-color);
    text-align: center;
    margin: 0;
}

/* Section labels within step body */
.ai-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.75rem;
}

/* Template grid — 3 columns */
.ai-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 560px) {
    .ai-template-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual template card */
.ai-template-card {
    border: 2px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
    background: var(--main-bg);
}

.ai-template-card:hover {
    border-color: var(--secondary-color);
}

.ai-template-card.ai-template-selected {
    border-color: var(--primary-color);
}

.ai-template-card.ai-template-recommended {
    position: relative;
}

.ai-template-badge {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-color);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    z-index: 1;
}

.ai-template-thumb-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--alt-bg);
}

.ai-template-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ai-template-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: 0.5rem 0.6rem 0.4rem;
    margin: 0;
}

/* Palette grid — 3 columns */
.ai-palette-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 560px) {
    .ai-palette-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual palette card */
.ai-palette-card {
    border: 2px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
    background: var(--main-bg);
}

.ai-palette-card:hover {
    border-color: var(--secondary-color);
}

.ai-palette-card.ai-palette-selected {
    border-color: var(--primary-color);
}

.ai-palette-swatches {
    display: flex;
    height: 48px;
}

.ai-palette-swatch {
    flex: 1;
}

.ai-palette-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    display: block;
}

/* Custom colour escape hatch */
.ai-colour-custom {
    margin-top: 1rem;
}

.ai-colour-custom-toggle {
    font-size: 0.8125rem;
    color: var(--muted-text);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.ai-colour-custom-toggle:hover {
    color: var(--primary-color);
}

.ai-colour-custom-fields {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--alt-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
}

.ai-colour-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 560px) {
    .ai-colour-row {
        grid-template-columns: 1fr;
    }
}

.ai-colour-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.35rem;
}

/* Font grid */
.ai-font-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Font option — reuses font-picker-option from cms-dashboard but here
   we apply font-family via JS data attribute to avoid inline styles */
.ai-font-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border: 1.5px solid var(--border-stroke);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    background: var(--main-bg);
}

.ai-font-option:hover {
    border-color: var(--secondary-color);
}

.ai-font-option.ai-font-selected {
    border-color: var(--primary-color);
    background-color: var(--alt-bg);
}

.ai-font-name {
    flex: 1;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

.ai-font-sample {
    font-size: 1.25rem;
    color: var(--muted-text);
}

/* ------------------------------------------------------------------ */
/* STEP 5 — CONTENT + ACCOUNT DETAILS (ai_signup_content.html)         */
/* ------------------------------------------------------------------ */

/* Content sections — grouped with top border and label */
.ai-content-section {
    padding-top: 1.75rem;
    margin-top: 1.75rem;
    border-top: 1px solid var(--border-stroke);
}

.ai-content-section:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.ai-content-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.35rem;
}

.ai-content-section-hint {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Individual field wrapper */
.ai-content-field-group {
    margin-bottom: 1.25rem;
}

.ai-content-field-group:last-child {
    margin-bottom: 0;
}

/* Inline variant for highlights — label + short input side by side */
.ai-content-field-group--inline {
    flex: 0 0 auto;
    min-width: 0;
}

.ai-content-field-group--grow {
    flex: 1 1 auto;
}

/* Highlights row — heading + body side by side on wider screens */
.ai-content-highlights-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.ai-content-highlights-row:last-child {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .ai-content-highlights-row {
        flex-direction: column;
    }
    .ai-content-field-group--inline {
        width: 100%;
    }
}

/* Field labels */
.ai-content-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.35rem;
}

.ai-content-label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

/* Content fields — same as form-control but slightly smaller text */
.ai-content-field {
    font-size: 0.9rem;
    line-height: 1.55;
}

/* Textarea height variants */
.ai-content-textarea--short  { min-height: 80px;  resize: vertical; }
.ai-content-textarea--medium { min-height: 110px; resize: vertical; }
.ai-content-textarea--tall   { min-height: 150px; resize: vertical; }

/* Account details section — slightly distinct background */
.ai-account-section {
    padding: 1.75rem;
    margin: 1.75rem -2.5rem -2.5rem;
    background: var(--alt-bg);
    border-top: 1px solid var(--border-stroke);
    border-radius: 0 0 var(--sharp-radius) var(--sharp-radius);
}

/* Account inputs — full-size form-control, no extra overrides needed */
.ai-account-input {
    font-size: 0.9375rem;
}

/* Password strength bar */
.ai-password-strength {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-password-progress {
    flex: 1;
    height: 4px;
    background: var(--border-stroke);
    border-radius: 2px;
    overflow: hidden;
}

/* Consent checkboxes */
.ai-consent-group {
    padding: 1rem;
    background: var(--main-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    margin-bottom: 1rem;
    margin-top: 1.25rem;
}

/* Terms note */
.ai-terms-note {
    margin-bottom: 1.25rem;
}

/* Global submit error */
.ai-submit-error {
    padding: 0.75rem 1rem;
    background: #fff5f5;
    border: 1px solid #fca5a5;
    border-radius: var(--sharp-radius);
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

@media (max-width: 600px) {
    .ai-account-section {
        margin: 1.75rem -1.5rem -1.5rem;
        padding: 1.5rem;
    }
}

/* ------------------------------------------------------------------ */
/* STEP 1 — CHIP-BASED AGENCY INPUTS (ai_signup.html v2)              */
/* ------------------------------------------------------------------ */

/* Field section wrapper — consistent spacing between each input group */
.ai-field-section {
    margin-bottom: 1.5rem;
}

.ai-field-section:last-child {
    margin-bottom: 0;
}

/* Label — same visual weight as ai-choice-legend */
.ai-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.ai-field-label-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
    color: var(--muted-text);
    margin-left: 0.35rem;
}

/* Hint text beneath inputs */
.ai-field-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted-text);
    margin-top: 0.35rem;
    line-height: 1.5;
}

/* Text input — matches form-control sizing, slightly subdued background */
.ai-field-input {
    font-size: 0.9rem;
    background-color: var(--alt-bg);
    border-color: var(--border-stroke);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ai-field-input:focus {
    background-color: var(--main-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.ai-field-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

/* Chip grid */
.ai-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Individual chip — button element for accessibility */
.ai-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--secondary-color);
    background: var(--alt-bg);
    border: 1px solid var(--border-stroke);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
    line-height: 1.4;
}

.ai-chip:hover {
    border-color: var(--secondary-color);
    color: var(--primary-color);
}

.ai-chip.ai-chip--selected {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* Live description preview */
.ai-built-hint {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--alt-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.6;
}

.ai-built-hint.ai-built-hint--visible {
    display: block;
}

.ai-built-hint-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.35rem;
}

/* ------------------------------------------------------------------ */
/* STEP 2 — LAYOUT CARDS (ai_signup_layout.html v2)                   */
/* ------------------------------------------------------------------ */

/* Group wrapper — replaces ai-choice-group for new layout step */
.ai-layout-group {
    border: none;
    padding: 0;
    margin: 0 0 2rem;
}

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

.ai-layout-legend {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
    margin-bottom: 0.35rem;
    padding: 0;
    float: none;
    width: 100%;
}

.ai-layout-hint {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* ── Photo question: two-column simple cards ── */
.ai-photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.ai-photo-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.1rem 1rem 2.5rem;
    background: var(--main-bg);
    border: 1.5px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s ease;
}

.ai-photo-card:hover {
    border-color: var(--secondary-color);
}

.ai-photo-card--selected {
    border-color: var(--primary-color);
}

/* Radio dot indicator */
.ai-photo-dot {
    position: absolute;
    top: 1.1rem;
    left: 1rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-stroke);
    background: var(--main-bg);
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ai-photo-card--selected .ai-photo-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.ai-choice-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ai-photo-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
}

.ai-photo-body {
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.5;
}

/* ── Page structure: two-column with SVG preview ── */
.ai-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.ai-layout-card {
    display: flex;
    flex-direction: column;
    background: var(--main-bg);
    border: 1.5px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.ai-layout-card:hover {
    border-color: var(--secondary-color);
}

.ai-layout-card--selected {
    border-color: var(--primary-color);
}

.ai-layout-thumb {
    background: var(--alt-bg);
    line-height: 0;
}

.ai-layout-svg {
    width: 100%;
    height: auto;
    display: block;
}

.ai-layout-label {
    padding: 0.75rem 1rem 0.85rem 2.5rem;
    border-top: 1px solid var(--border-stroke);
    position: relative;
}

.ai-layout-dot {
    position: absolute;
    top: 0.9rem;
    left: 1rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-stroke);
    background: var(--main-bg);
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ai-layout-card--selected .ai-layout-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.ai-layout-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.ai-layout-desc {
    display: block;
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.5;
}

/* ── Title section treatment: three-column with SVG preview ── */
.ai-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.75rem;
}

.ai-hero-card {
    display: flex;
    flex-direction: column;
    background: var(--main-bg);
    border: 1.5px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.ai-hero-card:hover {
    border-color: var(--secondary-color);
}

.ai-hero-card--selected {
    border-color: var(--primary-color);
}

.ai-hero-thumb {
    background: var(--alt-bg);
    line-height: 0;
}

.ai-hero-label {
    padding: 0.6rem 0.75rem 0.75rem 2rem;
    border-top: 1px solid var(--border-stroke);
    position: relative;
}

.ai-hero-dot {
    position: absolute;
    top: 0.75rem;
    left: 0.65rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid var(--border-stroke);
    background: var(--main-bg);
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ai-hero-card--selected .ai-hero-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.ai-hero-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.ai-hero-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-color);
    line-height: 1.45;
}

/* ── SVG fill classes — neutral greyscale, no colour references ── */
/* These keep the "structure not colour" message visually honest      */
.ai-svg-page         { fill: #f8fafc; }
.ai-svg-nav          { fill: #e2e8f0; }
.ai-svg-nav-on-hero  { fill: rgba(0,0,0,0.1); }
.ai-svg-rule         { fill: #e2e8f0; }
.ai-svg-logo         { fill: #94a3b8; }
.ai-svg-logo-on-dark { fill: rgba(255,255,255,0.7); }
.ai-svg-navlink      { fill: #94a3b8; }
.ai-svg-cta          { fill: #94a3b8; }
.ai-svg-hero         { fill: #cbd5e1; }
.ai-svg-hero-band    { fill: #cbd5e1; }
.ai-svg-hero-tall    { fill: #94a3b8; }
.ai-svg-body         { fill: #f8fafc; }
.ai-svg-alt          { fill: #e2e8f0; }
.ai-svg-headline     { fill: #64748b; }
.ai-svg-headline-dark { fill: #334155; }
.ai-svg-headline-on-band { fill: #475569; }
.ai-svg-headline-on-dark { fill: rgba(255,255,255,0.88); }
.ai-svg-subtext      { fill: #94a3b8; }
.ai-svg-subtext-mid  { fill: #94a3b8; }
.ai-svg-subtext-on-band { fill: #64748b; }
.ai-svg-subtext-on-dark { fill: rgba(255,255,255,0.55); }
.ai-svg-btn          { fill: #64748b; }
.ai-svg-btn-dark     { fill: #334155; }
.ai-svg-btn-on-band  { fill: #475569; }
.ai-svg-btn-on-dark  { fill: rgba(255,255,255,0.88); }
.ai-svg-heading      { fill: #cbd5e1; }
.ai-svg-heading-alt  { fill: #94a3b8; }
.ai-svg-text         { fill: #e2e8f0; }
.ai-svg-text-alt     { fill: #cbd5e1; }
.ai-svg-text-light   { fill: #e2e8f0; }
.ai-svg-text-lighter { fill: #e8edf2; }
.ai-svg-card         { fill: #e2e8f0; }

@media (max-width: 560px) {
    .ai-hero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ai-photo-grid,
    .ai-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Fade-in animation for new layout groups — matches existing ai-choice-group pattern */
.ai-layout-group {
    animation: ai-fade-up 0.35s ease both;
}

.ai-layout-group:nth-child(1) { animation-delay: 0s; }
.ai-layout-group:nth-child(2) { animation-delay: 0.1s; }
.ai-layout-group:nth-child(3) { animation-delay: 0.2s; }

/* ------------------------------------------------------------------ */
/* STEP 3 — TEAM PHOTO TIP (ai_signup_upload.html v2)                 */
/* ------------------------------------------------------------------ */

/* Candidate buy-in hint shown above the team photo upload widget */
.ai-upload-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.6rem;
    background: var(--alt-bg);
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.5;
}

.ai-upload-tip-icon {
    font-size: 0.875rem;
    color: var(--accent-color);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* ------------------------------------------------------------------ */
/* STEP 5 — LIVE PREVIEW (ai_signup_preview.html)                      */
/* ------------------------------------------------------------------ */

/* Wider card for the preview step — overrides the default 640px max */
.ai-step-card--preview {
    max-width: 900px;
}

/* Toolbar row above the preview frame */
.ai-preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* Belt-and-braces: hide toolbar on mobile via CSS so it never flashes
   even if the JS hide runs slightly late. JS also adds d-none. */
@media (max-width: 767px) {
    .ai-preview-toolbar {
        display: none !important;
    }
}

.ai-preview-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Loading spinner — centred placeholder shown before iframe reports load */
.ai-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    background: var(--alt-bg);
    margin-bottom: 1.5rem;
}

.ai-preview-loading-text {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin: 0;
}

/* Outer frame — JS sets explicit width + height for the transform approach.
   overflow:hidden clips the layout overflow from the scaled iframe.
   max-height is a belt-and-braces cap; the primary blank-space fix is the
   CSS override injected in ai_signup_preview_render (min-height:0 on body).
   transition:width gives a smooth size-switch animation.                   */
.ai-preview-frame-outer {
    border: 1px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    overflow: hidden;
    background: var(--alt-bg);
    margin-bottom: 1.5rem;
    max-height: 700px;
    transition: width 0.25s ease, height 0.25s ease;
}

/* Tablet and mobile centre in the card — JS sets the explicit narrower width */
.ai-preview-frame-outer.preview-tablet,
.ai-preview-frame-outer.preview-mobile {
    margin-left: auto;
    margin-right: auto;
}

/* The iframe itself — JS overrides width/height/transform via inline styles.
   100% width here is the fallback before JS applies the transform sizing.   */
.ai-preview-iframe {
    width: 100%;
    height: 560px;
    border: none;
    display: block;
    transition: none; /* transform applied by JS, no CSS transition needed */
}

/* Inline hint shown in step 1 footer when sector or location is too short */
.ai-continue-hint {
    font-size: 0.8125rem;
    color: var(--muted-text);
    text-align: center;
    flex: 1;
    padding: 0 0.75rem;
    line-height: 1.4;
}

/* ── Photo area placeholder in step 2 layout SVGs ── */
.ai-svg-photo { fill: #94a3b8; }

/* ── Q4 two-column hero style grid ── */
.ai-hero-grid--2col { grid-template-columns: 1fr 1fr; }

/* ── Font recommendation card (step 4) ── */
.ai-font-rec {
    border: 1px solid var(--border-colour, #e2e8f0);
    border-radius: var(--border-radius-card, 0.75rem);
    padding: 1.25rem 1.5rem;
    background: var(--card-bg, #fff);
}

.ai-font-rec-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ai-font-rec-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-colour, #0f172a);
    line-height: 1.2;
}

.ai-font-rec-sample {
    font-size: 1rem;
    color: var(--body-colour, #334155);
    font-style: italic;
    line-height: 1.5;
}

.ai-font-rec-reason {
    font-size: 0.875rem;
    color: var(--muted-text, #64748b);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.ai-font-rec-note {
    font-size: 0.8125rem;
    color: var(--muted-text, #64748b);
    display: block;
}

/* ── Palette section hint ── */
.ai-section-hint {
    font-size: 0.875rem;
    color: var(--muted-text, #64748b);
    margin: -0.5rem 0 1rem;
    line-height: 1.5;
}
/* ------------------------------------------------------------------ */
/* STEP 4 — PALETTE GRID (structural fixes)                            */
/* ------------------------------------------------------------------ */

/* Section headings span all three palette columns so the cards below
   them always line up regardless of heading text length.              */
.ai-palette-section-label {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted-text);
    margin: 0.75rem 0 0.1rem;
}

.ai-palette-section-label:first-child {
    margin-top: 0;
}

/* Section hint paragraphs inserted by buildPaletteGrid() also need to
   span all columns — same reason as the section headings above.       */
.ai-palette-grid .ai-section-hint {
    grid-column: 1 / -1;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

/* Source badge for image-derived palette cards — sits above the swatches
   and identifies which upload (logo or hero photo) the colours came from. */
.ai-palette-source {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-color, #0f172a);
    opacity: 0.65;
    padding: 0.45rem 0.6rem 0;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* Cards are now direct grid children — flex column keeps the swatch
   bar at the top and the label flush to the bottom of each card.     */
.ai-palette-card {
    display: flex;
    flex-direction: column;
}

.ai-palette-label {
    flex: 1;
    display: flex;
    align-items: flex-end;
}

/* ------------------------------------------------------------------ */
/* STEP 4 — FONT RECOMMENDATION CARDS                                  */
/* ------------------------------------------------------------------ */

.ai-font-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ai-font-card {
    position: relative;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-stroke);
    border-radius: var(--sharp-radius);
    cursor: pointer;
    background: var(--main-bg);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ai-font-card:hover {
    border-color: var(--secondary-color);
}

.ai-font-card.ai-font-card--selected {
    border-color: var(--primary-color);
    background: var(--alt-bg);
}

.ai-font-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-color);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

/* Font name and sample rendered in the typeface itself via JS inline style */
.ai-font-card .ai-font-name {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.ai-font-card .ai-font-sample {
    display: block;
    font-size: 0.95rem;
    color: var(--muted-text);
    font-style: italic;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.ai-font-card .ai-font-reason {
    display: block;
    font-size: 0.8125rem;
    color: var(--secondary-color);
    line-height: 1.5;
}

.ai-font-rec-note {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted-text);
    margin-top: 0.6rem;
}

/* ── Palette card footer — label + reason stacked ── */
.ai-palette-footer {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.6rem 0.55rem;
    flex: 1;
}

.ai-palette-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    padding: 0;
}

.ai-palette-reason {
    font-size: 0.72rem;
    color: var(--muted-text);
    line-height: 1.45;
    display: block;
}

/* ── Preview page sticky conversion bar ──────────────────────────────────────
   Revealed by JS (ai-signup.js step 5) once the preview renders — desktop
   after the iframe load event, mobile immediately on page load.
   z-index 1040 sits above page content and below Bootstrap's modal (1055)
   so the signup modal correctly overlays the bar.                            */
.ai-preview-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #0f172a;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    padding: 0.875rem 1.5rem;
}

.ai-preview-sticky-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
    gap: 1rem;
}

.ai-preview-sticky-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ai-preview-sticky-headline {
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.3;
}

.ai-preview-sticky-sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
}

.ai-preview-sticky-btn {
    white-space: nowrap;
    padding: 0.5rem 1.75rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

/* Mobile: stack text above full-width button */
@media (max-width: 575.98px) {
    .ai-preview-sticky-bar {
        padding: 0.875rem 1rem;
    }
    .ai-preview-sticky-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .ai-preview-sticky-text {
        text-align: center;
    }
    .ai-preview-sticky-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* Bottom padding added by JS when sticky bar is revealed, so the bar never
   obscures the step-footer Back button at the bottom of the step card.    */
.ai-has-sticky-bar {
    padding-bottom: 80px;
}

@media (max-width: 575.98px) {
    .ai-has-sticky-bar {
        padding-bottom: 130px;
    }
}