/* ============================================
   FLEXFORMS — FORM RENDERER — style.css
   Dynamic form rendering with step-by-step UX.
   Colors overridden by schema via CSS variables.
   ============================================ */

/* === RESET & VARIABLES === */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    /* Defaults — overridden by schema settings.appearance */
    --ff-primary: #4F46E5;
    --ff-primary-dark: #3730A3;
    --ff-primary-light: #EEF2FF;
    --ff-secondary: #10B981;
    --ff-bg: #F9FAFB;
    --ff-card: #FFFFFF;
    --ff-text: #1F2937;
    --ff-text-muted: #6B7280;
    --ff-text-light: #9CA3AF;
    --ff-border: #E5E7EB;
    --ff-danger: #EF4444;
    --ff-danger-bg: #FEF2F2;
    --ff-warning: #F59E0B;
    --ff-warning-bg: #FFFBEB;
    --ff-success: #10B981;
    --ff-success-bg: #ECFDF5;
    --ff-info: #3B82F6;
    --ff-info-bg: #EFF6FF;
    --ff-radius: 8px;
    --ff-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ff-mono: 'JetBrains Mono', monospace;

    /* Shadows */
    --ff-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --ff-shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --ff-shadow-lg: 0 12px 40px rgba(0,0,0,.10);

    /* Transitions */
    --ff-t-fast: .15s ease;
    --ff-t-normal: .25s ease;
    --ff-t-slow: .35s cubic-bezier(.4,0,.2,1);
}

/* === BASE === */
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--ff-font);
    background: var(--ff-bg);
    color: var(--ff-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ============================================
   LOADING SCREEN
   ============================================ */
.screen-loading {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: var(--ff-bg);
}

.loader-ring {
    width: 44px; height: 44px;
    border: 3px solid var(--ff-border);
    border-top-color: var(--ff-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
    color: var(--ff-text-muted);
    font-size: .9rem;
    font-weight: 500;
}

/* ============================================
   ERROR SCREEN
   ============================================ */
.screen-error {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.error-card {
    text-align: center;
    background: var(--ff-card);
    border-radius: calc(var(--ff-radius) * 2);
    padding: 3rem 2.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--ff-shadow-md);
}
.error-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-card h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .5rem; }
.error-card p { color: var(--ff-text-muted); font-size: .9rem; line-height: 1.5; }

/* ============================================
   FORM APP — Main Layout
   ============================================ */
.form-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-wrap {
    padding: 1.25rem 0 .5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--ff-bg);
}

.progress-bar {
    height: 4px;
    background: var(--ff-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: .75rem;
}
.progress-fill {
    height: 100%;
    background: var(--ff-primary);
    border-radius: 4px;
    transition: width var(--ff-t-slow);
    width: 0%;
}

/* Segmented progress */
.progress-bar.segmented {
    display: flex;
    gap: 4px;
    background: transparent;
    overflow: visible;
}
.progress-bar.segmented .progress-segment {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--ff-border);
    transition: background var(--ff-t-normal);
}
.progress-bar.segmented .progress-segment.active {
    background: var(--ff-primary);
}
.progress-bar.segmented .progress-segment.completed {
    background: var(--ff-primary);
}

/* Dots progress */
.progress-bar.dots {
    height: auto;
    display: flex;
    justify-content: center;
    gap: 8px;
    background: transparent;
    overflow: visible;
}
.progress-bar.dots .progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ff-border);
    transition: all var(--ff-t-normal);
    cursor: default;
}
.progress-bar.dots .progress-dot.active {
    background: var(--ff-primary);
    transform: scale(1.3);
}
.progress-bar.dots .progress-dot.completed {
    background: var(--ff-primary);
    opacity: .6;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
}
.progress-step-label {
    font-size: .7rem;
    color: var(--ff-text-light);
    font-weight: 500;
    text-align: center;
    flex: 1;
    transition: color var(--ff-t-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.progress-step-label.active {
    color: var(--ff-primary);
    font-weight: 600;
}
.progress-step-label .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ff-border);
    color: var(--ff-text-muted);
    font-size: .65rem;
    font-weight: 700;
    margin-right: 4px;
    transition: all var(--ff-t-fast);
    vertical-align: middle;
}
.progress-step-label.active .step-num {
    background: var(--ff-primary);
    color: #fff;
}
.progress-step-label.completed .step-num {
    background: var(--ff-primary);
    color: #fff;
    opacity: .6;
}

/* ============================================
   STEP VIEWPORT — Animation container
   ============================================ */
.step-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.step-track {
    display: flex;
    transition: transform var(--ff-t-slow);
    will-change: transform;
}

.step-panel {
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    padding: 1rem 0 2rem;
    opacity: 0;
    transition: opacity var(--ff-t-normal);
    overflow: hidden;
}
.step-panel.active {
    opacity: 1;
}

/* Step Header */
.step-header {
    margin-bottom: 1.5rem;
    position: relative;
}
.step-logo {
    margin-bottom: 1rem;
}
.step-logo img {
    display: block;
    object-fit: contain;
}
.step-logo.pos-top-right {
    text-align: right;
}
.step-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ff-text);
    line-height: 1.25;
    letter-spacing: -.02em;
}
.step-subtitle {
    font-size: .95rem;
    color: var(--ff-text-muted);
    margin-top: .35rem;
    line-height: 1.4;
}
.step-description {
    font-size: .85rem;
    color: var(--ff-text-light);
    margin-top: .5rem;
    line-height: 1.5;
}

/* Step Grid */
.step-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
.step-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.step-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.question-wrap {
    grid-column: span 1;
    min-width: 0;
    overflow: hidden;
}
.question-wrap.col-span-2 { grid-column: span 2; }
.question-wrap.col-span-3 { grid-column: span 3; }

/* ============================================
   QUESTION — Common Field Styles
   ============================================ */
.q-label {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ff-text);
    margin-bottom: .35rem;
    line-height: 1.3;
}
.q-label .q-number {
    color: var(--ff-primary);
    font-weight: 700;
    margin-right: .25rem;
}
.q-required {
    color: var(--ff-danger);
    margin-left: 2px;
    font-weight: 400;
}
.q-description {
    font-size: .8rem;
    color: var(--ff-text-muted);
    margin-bottom: .5rem;
    line-height: 1.4;
}
.q-error {
    font-size: .78rem;
    color: var(--ff-danger);
    margin-top: .3rem;
    display: none;
    line-height: 1.3;
}
.q-error.visible { display: block; }

/* Text inputs */
.ff-input, .ff-textarea, .ff-select {
    width: 100%;
    padding: .65rem .85rem;
    font-family: var(--ff-font);
    font-size: .9rem;
    color: var(--ff-text);
    background: var(--ff-card);
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    outline: none;
    transition: all var(--ff-t-fast);
    appearance: none;
}
.ff-input:focus, .ff-textarea:focus, .ff-select:focus {
    border-color: var(--ff-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-primary) 15%, transparent);
}
.ff-input.error, .ff-textarea.error, .ff-select.error {
    border-color: var(--ff-danger);
}
.ff-input::placeholder, .ff-textarea::placeholder {
    color: var(--ff-text-light);
}
.ff-input:disabled, .ff-textarea:disabled {
    background: var(--ff-bg);
    color: var(--ff-text-muted);
    cursor: not-allowed;
}

.ff-textarea {
    resize: vertical;
    min-height: 80px;
}

.ff-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
}

/* Input with prefix/suffix */
.ff-input-wrap {
    display: flex;
    align-items: stretch;
}
.ff-input-wrap .ff-input {
    border-radius: 0;
    flex: 1;
}
.ff-input-prefix, .ff-input-suffix {
    display: flex;
    align-items: center;
    padding: 0 .65rem;
    background: var(--ff-bg);
    border: 1.5px solid var(--ff-border);
    font-size: .85rem;
    color: var(--ff-text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.ff-input-prefix {
    border-right: none;
    border-radius: var(--ff-radius) 0 0 var(--ff-radius);
}
.ff-input-suffix {
    border-left: none;
    border-radius: 0 var(--ff-radius) var(--ff-radius) 0;
}

/* Character counter */
.char-counter {
    text-align: right;
    font-size: .72rem;
    color: var(--ff-text-light);
    margin-top: .2rem;
}
.char-counter.over { color: var(--ff-danger); }

/* ============================================
   RADIO / CHECKBOX — Custom
   ============================================ */
.ff-options-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.ff-options-list.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}
.ff-options-list.cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.ff-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .85rem;
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    cursor: pointer;
    transition: all var(--ff-t-fast);
    user-select: none;
}
.ff-option:hover {
    border-color: var(--ff-primary);
    background: var(--ff-primary-light);
}
.ff-option.selected {
    border-color: var(--ff-primary);
    background: var(--ff-primary-light);
}
.ff-option input[type="radio"],
.ff-option input[type="checkbox"] {
    display: none;
}
.ff-option .ff-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ff-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--ff-t-fast);
}
.ff-option input[type="checkbox"] + .ff-check {
    border-radius: 4px;
}
.ff-option.selected .ff-check {
    border-color: var(--ff-primary);
    background: var(--ff-primary);
}
.ff-option.selected .ff-check::after {
    content: '✓';
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
}
.ff-option-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.ff-option-label {
    font-size: .88rem;
    color: var(--ff-text);
}

/* Button group style */
.ff-btn-group {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.ff-btn-option {
    padding: .55rem 1.1rem;
    border: 1.5px solid var(--ff-border);
    border-radius: 100px;
    font-size: .85rem;
    font-family: var(--ff-font);
    font-weight: 500;
    color: var(--ff-text);
    background: var(--ff-card);
    cursor: pointer;
    transition: all var(--ff-t-fast);
    user-select: none;
}
.ff-btn-option:hover {
    border-color: var(--ff-primary);
}
.ff-btn-option.selected {
    background: var(--ff-primary);
    border-color: var(--ff-primary);
    color: #fff;
}

/* ============================================
   YES/NO — Toggle & Pill
   ============================================ */
.ff-yesno-pill {
    display: inline-flex;
    background: var(--ff-bg);
    border-radius: 100px;
    padding: 3px;
    border: 1.5px solid var(--ff-border);
}
.ff-yesno-pill button {
    padding: .5rem 1.5rem;
    border: none;
    border-radius: 100px;
    font-family: var(--ff-font);
    font-size: .88rem;
    font-weight: 600;
    background: transparent;
    color: var(--ff-text-muted);
    cursor: pointer;
    transition: all var(--ff-t-fast);
}
.ff-yesno-pill button.active {
    background: var(--ff-primary);
    color: #fff;
    box-shadow: var(--ff-shadow-sm);
}

.ff-toggle-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.ff-toggle {
    width: 48px;
    height: 26px;
    background: var(--ff-border);
    border-radius: 26px;
    position: relative;
    cursor: pointer;
    transition: background var(--ff-t-fast);
    flex-shrink: 0;
}
.ff-toggle.on { background: var(--ff-primary); }
.ff-toggle .ff-toggle-dot {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--ff-t-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.ff-toggle.on .ff-toggle-dot {
    transform: translateX(22px);
}
.ff-toggle-label {
    font-size: .88rem;
    color: var(--ff-text);
    font-weight: 500;
}

/* ============================================
   RATING (Stars)
   ============================================ */
.ff-rating {
    display: flex;
    gap: .35rem;
    align-items: center;
}
.ff-rating-star {
    font-size: 2rem;
    cursor: pointer;
    transition: transform var(--ff-t-fast);
    user-select: none;
    line-height: 1;
}
.ff-rating-star:hover { transform: scale(1.15); }
.ff-rating-star.lg { font-size: 2.5rem; }
.ff-rating-star.sm { font-size: 1.5rem; }
.ff-rating-label {
    font-size: .82rem;
    color: var(--ff-text-muted);
    margin-left: .5rem;
    font-weight: 500;
}

/* ============================================
   NPS
   ============================================ */
.ff-nps {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.ff-nps-btn {
    width: 40px;
    height: 40px;
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ff-mono);
    font-size: .85rem;
    font-weight: 600;
    background: var(--ff-card);
    cursor: pointer;
    transition: all var(--ff-t-fast);
    color: var(--ff-text);
}
.ff-nps-btn:hover {
    border-color: var(--ff-primary);
    background: var(--ff-primary-light);
}
.ff-nps-btn.selected {
    color: #fff;
    border-color: transparent;
}
.ff-nps-labels {
    display: flex;
    justify-content: space-between;
    margin-top: .35rem;
    font-size: .72rem;
    color: var(--ff-text-light);
}

/* ============================================
   SLIDER
   ============================================ */
.ff-slider-wrap {
    padding: .5rem 0;
}
.ff-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--ff-border);
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}
.ff-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ff-primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    border: 3px solid #fff;
}
.ff-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ff-primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    border: 3px solid #fff;
}
.ff-slider-value {
    text-align: center;
    font-family: var(--ff-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ff-primary);
    margin-bottom: .5rem;
}
.ff-slider-marks {
    display: flex;
    justify-content: space-between;
    margin-top: .35rem;
    font-size: .7rem;
    color: var(--ff-text-light);
}

/* ============================================
   MATRIX (Likert)
   ============================================ */
.ff-matrix {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ff-matrix table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.ff-matrix th {
    padding: .6rem .5rem;
    font-weight: 600;
    color: var(--ff-text);
    text-align: center;
    font-size: .75rem;
    border-bottom: 2px solid var(--ff-border);
    position: sticky;
    top: 0;
    background: var(--ff-card);
}
.ff-matrix th:first-child { text-align: left; }
.ff-matrix td {
    padding: .6rem .5rem;
    text-align: center;
    border-bottom: 1px solid var(--ff-border);
}
.ff-matrix td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--ff-text);
    min-width: 140px;
}
.ff-matrix-radio {
    width: 18px;
    height: 18px;
    accent-color: var(--ff-primary);
    cursor: pointer;
}

/* Matrix mobile card layout */
.ff-matrix-cards { display: none; }

/* ============================================
   RANKING (Drag & Drop)
   ============================================ */
.ff-ranking-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.ff-ranking-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .85rem;
    background: var(--ff-card);
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    cursor: grab;
    user-select: none;
    transition: all var(--ff-t-fast);
}
.ff-ranking-item:active { cursor: grabbing; }
.ff-ranking-item.dragging {
    opacity: .5;
    border-color: var(--ff-primary);
}
.ff-ranking-item.drag-over {
    border-color: var(--ff-primary);
    background: var(--ff-primary-light);
}
.ff-ranking-pos {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ff-primary-light);
    color: var(--ff-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.ff-ranking-handle {
    color: var(--ff-text-light);
    font-size: .9rem;
    flex-shrink: 0;
    cursor: grab;
}
.ff-ranking-label {
    flex: 1;
    font-size: .88rem;
}
.ff-ranking-arrows {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.ff-rank-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--ff-border);
    border-radius: 4px;
    background: var(--ff-card);
    color: var(--ff-text-muted);
    font-size: .6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ff-t-fast);
    padding: 0;
    line-height: 1;
}
.ff-rank-btn:hover {
    background: var(--ff-primary-light);
    border-color: var(--ff-primary);
    color: var(--ff-primary);
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.ff-upload-area {
    border: 2px dashed var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--ff-t-fast);
    background: var(--ff-bg);
    position: relative;
}
.ff-upload-area:hover,
.ff-upload-area.dragover {
    border-color: var(--ff-primary);
    background: var(--ff-primary-light);
}
.ff-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.ff-upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.ff-upload-text { font-size: .85rem; color: var(--ff-text-muted); }
.ff-upload-text small {
    display: block;
    margin-top: .2rem;
    font-size: .72rem;
    color: var(--ff-text-light);
}
.ff-upload-previews {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}
.ff-upload-file {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .65rem;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    font-size: .78rem;
}
.ff-upload-file button {
    background: none;
    border: none;
    color: var(--ff-danger);
    cursor: pointer;
    font-size: .8rem;
    padding: 0 2px;
}

/* ============================================
   SIGNATURE
   ============================================ */
.ff-signature-canvas {
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    cursor: crosshair;
    touch-action: none;
    display: block;
    width: 100%;
    background: #fff;
}
.ff-signature-actions {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
}

/* ============================================
   COLOR PICKER
   ============================================ */
.ff-color-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.ff-color-swatch {
    width: 44px;
    height: 44px;
    border-radius: var(--ff-radius);
    border: 2px solid var(--ff-border);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}
.ff-color-swatch input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    padding: 0;
    margin: -8px;
    cursor: pointer;
}
.ff-color-presets {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}
.ff-color-preset {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--ff-t-fast);
}
.ff-color-preset:hover { transform: scale(1.15); }
.ff-color-preset.selected {
    border-color: var(--ff-text);
    box-shadow: 0 0 0 2px var(--ff-card);
}

/* ============================================
   ADDRESS
   ============================================ */
.ff-address-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
.ff-address-grid .col-span-2 { grid-column: span 2; }
.ff-address-grid .col-span-3 { grid-column: span 3; }

/* ============================================
   STATEMENT
   ============================================ */
.ff-statement {
    padding: 1rem 1.25rem;
    border-radius: var(--ff-radius);
    font-size: .88rem;
    line-height: 1.5;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}
.ff-statement.info { background: var(--ff-info-bg); color: var(--ff-info); border-left: 3px solid var(--ff-info); }
.ff-statement.warning { background: var(--ff-warning-bg); color: var(--ff-warning); border-left: 3px solid var(--ff-warning); }
.ff-statement.success { background: var(--ff-success-bg); color: var(--ff-success); border-left: 3px solid var(--ff-success); }
.ff-statement.error { background: var(--ff-danger-bg); color: var(--ff-danger); border-left: 3px solid var(--ff-danger); }
.ff-statement-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ============================================
   CONSENT
   ============================================ */
.ff-consent {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .75rem;
    border: 1.5px solid var(--ff-border);
    border-radius: var(--ff-radius);
    cursor: pointer;
    transition: border-color var(--ff-t-fast);
}
.ff-consent:hover { border-color: var(--ff-primary); }
.ff-consent.checked { border-color: var(--ff-primary); background: var(--ff-primary-light); }
.ff-consent-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ff-border);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: all var(--ff-t-fast);
}
.ff-consent.checked .ff-consent-check {
    background: var(--ff-primary);
    border-color: var(--ff-primary);
}
.ff-consent.checked .ff-consent-check::after {
    content: '✓';
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
}
.ff-consent-text {
    font-size: .85rem;
    color: var(--ff-text);
    line-height: 1.4;
}
.ff-consent-text a {
    color: var(--ff-primary);
    text-decoration: underline;
}

/* ============================================
   PASSWORD STRENGTH
   ============================================ */
.ff-password-wrap {
    position: relative;
}
.ff-password-toggle {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--ff-text-muted);
    padding: 4px;
}
.ff-strength-meter {
    height: 4px;
    border-radius: 4px;
    background: var(--ff-border);
    margin-top: .4rem;
    overflow: hidden;
}
.ff-strength-fill {
    height: 100%;
    border-radius: 4px;
    transition: all var(--ff-t-normal);
}
.ff-strength-label {
    font-size: .72rem;
    margin-top: .2rem;
    font-weight: 500;
}

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */
.form-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 0 2rem;
    position: sticky;
    bottom: 0;
    background: linear-gradient(transparent, var(--ff-bg) 30%);
    padding-top: 2rem;
}
.nav-spacer { flex: 1; }

.nav-btn {
    padding: .7rem 1.5rem;
    font-family: var(--ff-font);
    font-size: .9rem;
    font-weight: 600;
    border-radius: var(--ff-radius);
    cursor: pointer;
    transition: all var(--ff-t-fast);
    display: flex;
    align-items: center;
    gap: .4rem;
    border: none;
}
.nav-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.nav-btn-back {
    background: var(--ff-card);
    color: var(--ff-text-muted);
    border: 1.5px solid var(--ff-border);
}
.nav-btn-back:hover:not(:disabled) {
    background: var(--ff-bg);
    border-color: var(--ff-text-muted);
}
.nav-btn-next, .nav-btn-submit {
    background: var(--ff-primary);
    color: #fff;
}
.nav-btn-next:hover:not(:disabled),
.nav-btn-submit:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: var(--ff-shadow-sm);
}
.nav-arrow {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   SUCCESS SCREEN
   ============================================ */
.screen-success {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--ff-bg);
}
.success-card {
    text-align: center;
    background: var(--ff-card);
    border-radius: calc(var(--ff-radius) * 2);
    padding: 3rem 2.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--ff-shadow-md);
    animation: fadeInUp .5s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.success-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--ff-success);
}
.success-check svg {
    width: 100%;
    height: 100%;
    animation: checkDraw .6s ease .2s both;
}
@keyframes checkDraw {
    from { stroke-dasharray: 166; stroke-dashoffset: 166; }
    to { stroke-dashoffset: 0; }
}
.success-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .5rem;
}
.success-card p {
    color: var(--ff-text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: #f1f5f9;
    padding: .7rem 1.2rem;
    border-radius: var(--ff-radius);
    font-size: .85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .4rem;
    z-index: 999;
    box-shadow: var(--ff-shadow-md);
    opacity: 0;
    transition: all var(--ff-t-slow);
    white-space: nowrap;
    max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--ff-danger); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .form-app { padding: 0 .75rem; }
    .step-grid.cols-2,
    .step-grid.cols-3 { grid-template-columns: 1fr; }
    .question-wrap.col-span-2,
    .question-wrap.col-span-3 { grid-column: span 1; }
    .step-title { font-size: 1.25rem; }
    .ff-nps { gap: 3px; }
    .ff-nps-btn { width: 32px; height: 32px; font-size: .75rem; }
    .ff-address-grid {
        grid-template-columns: 1fr;
    }
    .ff-address-grid .col-span-2,
    .ff-address-grid .col-span-3 { grid-column: span 1; }

    /* Matrix → Card layout on mobile */
    .ff-matrix table { display: none; }
    .ff-matrix-cards {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }
    .ff-matrix-card {
        background: var(--ff-card);
        border: 1.5px solid var(--ff-border);
        border-radius: var(--ff-radius);
        padding: .85rem;
    }
    .ff-matrix-card-title {
        font-weight: 600;
        font-size: .88rem;
        margin-bottom: .5rem;
    }
    .ff-matrix-card-options {
        display: flex;
        flex-direction: column;
        gap: .3rem;
    }
    .ff-matrix-card-opt {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .4rem .5rem;
        border-radius: var(--ff-radius);
        cursor: pointer;
        font-size: .82rem;
    }
    .ff-matrix-card-opt:hover { background: var(--ff-bg); }
    .progress-step-label span:not(.step-num) { display: none; }
    .progress-step-label .step-num { margin-right: 0; }
}
