:root {
    --app-bg: #f6f7fb;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --text: #172033;
    --text-strong: #0f172a;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --border: #dfe5ee;
    --border-strong: #cbd5e1;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #15803d;
    --success-soft: #ecfdf3;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fff1f2;
    --info-soft: #eff6ff;
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 5px 16px rgba(15, 23, 42, .035);
    --shadow-md: 0 16px 42px rgba(15, 23, 42, .08);
    --focus-ring: 0 0 0 4px rgba(79, 70, 229, .15);
    --control-height: 45px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    background: var(--app-bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 2000; padding: 9px 13px; border-radius: 8px; background: var(--text-strong); color: #fff; transform: translateY(-160%); transition: transform .15s ease; }
.skip-link:focus { color: #fff; transform: none; }
.text-secondary { color: var(--muted) !important; }

.btn {
    min-height: 43px;
    padding: .58rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 650;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn-sm { min-height: 34px; padding: .35rem .7rem; font-size: 13px; }
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: #3730a3;
    --bs-btn-active-border-color: #3730a3;
}
.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: #a5b4fc;
    --bs-btn-hover-bg: var(--primary-soft);
    --bs-btn-hover-border-color: #818cf8;
    --bs-btn-hover-color: var(--primary-hover);
    --bs-btn-active-bg: #e0e7ff;
    --bs-btn-active-color: var(--primary-hover);
}
.btn-outline-secondary {
    --bs-btn-color: #475569;
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: #f1f5f9;
    --bs-btn-hover-border-color: #94a3b8;
    --bs-btn-hover-color: var(--text-strong);
}

.form-label { margin-bottom: .45rem; color: #334155; font-size: 13.5px; font-weight: 650; }
.form-control,
.form-select {
    min-height: var(--control-height);
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text-strong);
    font-size: 15px;
}
textarea.form-control { min-height: auto; padding-top: .75rem; }
.form-control::placeholder { color: var(--muted-light); }
.form-control:hover:not(:disabled), .form-select:hover:not(:disabled) { border-color: #a5b4fc; }
.form-control:focus, .form-select:focus {
    border-color: #818cf8;
    box-shadow: var(--focus-ring);
}
.form-control:disabled, .form-select:disabled { background: #f1f5f9; color: var(--muted); }
.form-text { color: var(--muted); font-size: 12.5px; }
.form-check-input { width: 18px; height: 18px; margin-top: .15em; border-color: #94a3b8; }
.form-check-input:checked { border-color: var(--primary); background-color: var(--primary); }
.form-check-input:focus { border-color: #818cf8; box-shadow: var(--focus-ring); }
.form-switch .form-check-input { width: 42px; height: 23px; cursor: pointer; }

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.alert { border-width: 1px; border-radius: var(--radius); }
.alert-success { border-color: #bbf7d0; background: var(--success-soft); color: #166534; }
.alert-danger { border-color: #fecdd3; background: var(--danger-soft); color: #9f1239; }
.alert-warning { border-color: #fde68a; background: var(--warning-soft); color: #92400e; }
.badge { border-radius: 999px; padding: .48em .72em; font-size: 11px; font-weight: 700; letter-spacing: .025em; }
.status-DRAFT, .status-PENDING, .status-QUEUED { background: #fef3c7; color: #92400e; }
.status-OPEN, .status-VALID, .status-COMPLETED { background: #dcfce7; color: #166534; }
.status-CLOSED, .status-INVALID, .status-FAILED { background: #fee2e2; color: #991b1b; }
.status-EXCLUDED, .status-RUNNING { background: #dbeafe; color: #1e40af; }

/* Admin shell */
.admin-shell { min-height: 100vh; }
.login-wrap { max-width: 430px; }
.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 244px;
    padding: 26px 16px;
    overflow-y: auto;
    background: #111827;
    color: #cbd5e1;
}
.admin-brand { display: block; padding: 0 10px 24px; color: #fff; font-size: 19px; font-weight: 750; line-height: 1.25; text-decoration: none; }
.admin-brand:hover { color: #fff; }
.admin-brand small { display: block; margin-top: 6px; color: #94a3b8; font-size: 10.5px; font-weight: 500; line-height: 1.4; }
.admin-nav-label { margin: 12px 12px 7px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 41px;
    margin: 3px 0;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 550;
    text-decoration: none;
}
.admin-nav-icon { display: inline-flex; flex: 0 0 18px; align-items: center; justify-content: center; color: #94a3b8; }
.admin-nav a.active .admin-nav-icon, .admin-nav a:hover .admin-nav-icon { color: #c7d2fe; }
.admin-nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.admin-nav a.active { border-color: rgba(129,140,248,.2); background: rgba(79,70,229,.28); color: #fff; }
.admin-main { min-height: 100vh; margin-left: 244px; }
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    height: 62px;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
}
.admin-topbar-context { color: var(--muted); font-size: 12px; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.admin-user-name { color: #475569; font-size: 13px; font-weight: 600; }
.admin-sidebar-backdrop { display: none; }
.admin-user-editor { padding: 24px; }
.admin-user-list { padding: 0 20px; }
.admin-user-item { border-bottom: 1px solid #edf0f5; }
.admin-user-item:last-child { border-bottom: 0; }
.admin-user-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 14px 4px; color: var(--text-strong); cursor: pointer; list-style: none; }
.admin-user-item summary::-webkit-details-marker { display: none; }
.admin-user-item summary small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 450; }
.admin-user-chevron { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font-size: 16px; line-height: 1; }
.admin-user-item[open] .admin-user-chevron { color: var(--primary); transform: rotate(45deg); }
.admin-user-edit-form { margin: 0 0 18px; padding: 18px; border: 1px solid #e0e7ff; border-radius: 11px; background: #fafaff; }
.admin-content { width: 100%; max-width: 1500px; padding: 30px; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-title { margin: 0; color: var(--text-strong); font-size: 26px; font-weight: 750; letter-spacing: -.025em; }
.page-description { max-width: 760px; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.lifecycle-header-status { display: grid; justify-items: end; gap: 5px; }
.lifecycle-header-help { color: var(--muted); font-size: 12px; }
.lifecycle-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: -4px 0 24px; padding: 20px 22px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.lifecycle-panel.status-OPEN { border-left-color: var(--success); background: #fbfffc; }
.lifecycle-panel.status-CLOSED { border-left-color: var(--danger); background: #fffdfd; }
.lifecycle-panel.status-DRAFT { border-left-color: var(--warning); background: #fffefa; }
.lifecycle-panel h2 { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 700; }
.lifecycle-panel p { max-width: 720px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.lifecycle-kicker { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.lifecycle-panel form { display: flex; flex: 0 0 auto; align-items: center; gap: 14px; }
.lifecycle-secondary-action { color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.lifecycle-secondary-action:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.lifecycle-setting-current { display: flex; align-items: center; gap: 10px; min-height: 45px; color: var(--text-strong); font-size: 14px; }
.section-card-title { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 700; }
.section-card-description { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.metric-card { height: 100%; padding: 18px 20px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-value { margin-top: 4px; color: var(--text-strong); font-size: 29px; font-weight: 750; letter-spacing: -.03em; }
.metric-detail { margin-top: 3px; color: var(--muted); font-size: 12px; }

.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--text); font-size: 13.5px; }
.table > :not(caption) > * > * { padding: .8rem .9rem; border-color: #e8edf3; vertical-align: middle; }
.table thead th { border-bottom-width: 1px; background: #f8fafc; color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr { transition: background-color .14s ease; }
.table tbody tr:hover { background: #fafbff; }
.table-card { overflow: hidden; }
.table-card .table-responsive { margin: 0; }
.nav-tabs { gap: 4px; border-bottom-color: var(--border); }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.nav-tabs .nav-link:hover { color: var(--text-strong); }
.nav-tabs .nav-link.active { border-bottom-color: var(--primary); background: transparent; color: var(--primary); }
.dropdown-menu { padding: .45rem; border-color: var(--border); border-radius: 11px; box-shadow: var(--shadow-md); }
.dropdown-item { border-radius: 7px; font-size: 13px; }
.pagination { --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--primary); }
.empty-state { padding: 52px 22px !important; color: var(--muted); text-align: center; }
.sensitive-warning { padding: 14px 16px; border: 1px solid #fecdd3; border-left: 4px solid var(--danger); border-radius: 10px; background: var(--danger-soft); color: #9f1239; }

/* Admin settings and editor */
.settings-stack { display: grid; gap: 20px; }
.settings-card { padding: 24px; }
.settings-card-header { margin-bottom: 22px; padding-bottom: 17px; border-bottom: 1px solid #edf0f5; }
.settings-index { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; margin-right: 8px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 750; }
.setting-toggle { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; padding: 17px 0; border-bottom: 1px solid #edf0f5; }
.setting-toggle:last-child { border-bottom: 0; }
.setting-toggle-copy label { display: block; color: var(--text-strong); font-size: 14px; font-weight: 650; cursor: pointer; }
.setting-toggle-copy p { max-width: 590px; margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.setting-toggle .form-check { flex: 0 0 auto; padding-left: 0; }
.setting-toggle .form-check-input { float: none; margin-left: 0; }
.version-summary { display: grid; gap: 13px; }
.version-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.version-summary-row span:first-child { color: var(--muted); }
.version-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 920px; }
.version-choice-card { min-height: 250px; padding: 26px; }
.version-choice-card-primary { border-color: #c7d2fe; background: linear-gradient(145deg, #fff 35%, #f7f7ff); }
.version-choice-kicker { margin-bottom: 10px; color: var(--primary); font-size: 10.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }

.builder-workspace { align-items: flex-start; }
.builder-outline-card { position: sticky; top: 86px; max-height: calc(100vh - 112px); overflow: hidden; }
.builder-outline-scroll { max-height: calc(100vh - 280px); padding: 14px; overflow-y: auto; }
.builder-section { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #edf0f5; }
.builder-section:last-child { border-bottom: 0; }
.builder-section-heading { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; }
.builder-section-heading strong { flex: 1; color: var(--text-strong); font-size: 13px; }
.builder-item { display: block; margin-bottom: 6px; padding: 10px 11px; border: 1px solid transparent; border-radius: 9px; color: inherit; text-decoration: none; }
.builder-item:hover { border-color: var(--border); background: var(--surface-subtle); color: inherit; }
.builder-item.active { border-color: #c7d2fe; background: var(--primary-soft); }
.builder-item-type { color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }
.builder-item-label { margin-top: 3px; color: var(--text-strong); font-size: 13px; line-height: 1.35; }
.builder-editor { padding: 26px; }
.builder-editor-section { margin-top: 24px; padding-top: 23px; border-top: 1px solid #edf0f5; }
.research-config { margin-top: 24px; padding: 20px; border: 1px solid #c7d2fe; border-radius: 12px; background: #fafaff; }
.research-config-header { margin-bottom: 18px; }
.research-config-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.research-config-header p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.builder-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.builder-list { max-height: calc(100vh - 220px); overflow: auto; }

.chart-card { padding: 22px; }
.chart-card h2 { margin: 0; font-size: 14px; font-weight: 700; }
.chart-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.chart-wrap { height: 290px; margin-top: 16px; }
.chart-wrap-large { height: 360px; }
.run-select { max-width: 230px; }
.research-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--border); }
.research-summary-item { min-width: 0; padding: 14px 16px; background: var(--surface); }
.research-summary-label { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.research-summary-value { margin-top: 4px; overflow: hidden; color: var(--text-strong); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.threshold-cell { white-space: nowrap; }
.threshold-pass { color: var(--success); font-weight: 700; }
.threshold-fail { color: var(--danger); font-weight: 700; }
.table-sticky-first th:first-child, .table-sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.table-sticky-first thead th:first-child { z-index: 2; background: #f8fafc; }

/* Respondent experience */
.respondent-body { background: #f7f8fc; }
.respondent-brandbar { border-bottom: 1px solid rgba(223,229,238,.85); background: rgba(255,255,255,.86); backdrop-filter: blur(12px); }
.respondent-brandbar-inner { width: 100%; max-width: 780px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.respondent-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-strong); font-size: 14px; font-weight: 700; line-height: 1.15; text-decoration: none; }
.respondent-brand:hover { color: var(--text-strong); }
.respondent-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.respondent-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 15px; font-weight: 750; box-shadow: 0 5px 14px rgba(79,70,229,.22); }
.respondent-admin-link { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.respondent-admin-link:hover, .respondent-admin-link:focus-visible { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.respondent-page { min-height: calc(100vh - 63px); padding: 42px 20px 64px; }
.respondent-wrap { width: 100%; max-width: 760px; margin: 0 auto; }
.survey-intro { display: grid; gap: 24px; }
.survey-hero { padding: 8px 2px 4px; border-bottom: 1px solid #e7eaf1; }
.survey-eyebrow, .section-kicker, .confirmation-kicker { margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.survey-eyebrow span { color: var(--muted-light); font-weight: 600; letter-spacing: .02em; text-transform: none; }
.survey-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.survey-heading { margin: 0; color: var(--text-strong); font-size: clamp(29px, 5vw, 34px); font-weight: 750; line-height: 1.18; letter-spacing: -.035em; }
.survey-description { max-width: 660px; margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.survey-status { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; margin-top: 6px; padding: 7px 11px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.survey-status.status-OPEN { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.survey-status.status-DRAFT { border-color: #fde68a; background: #fffbeb; color: #a16207; }
.survey-status.status-CLOSED { border-color: #fecdd3; background: #fff1f2; color: #be123c; }
.survey-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.survey-status.status-OPEN .survey-status-dot { box-shadow: 0 0 0 3px #dcfce7; }
.survey-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 22px 0 3px; color: var(--muted); font-size: 12px; }
.survey-hero-meta span { position: relative; }
.survey-hero-meta span + span::before { position: absolute; top: 50%; left: -13px; width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; content: ''; transform: translateY(-50%); }
.consent-surface, .remembered-panel, .success-surface, .form-surface, .flat-surface {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.consent-surface { padding: 30px 32px; }
.consent-heading { padding-bottom: 18px; border-bottom: 1px solid #edf0f5; }
.consent-heading .section-kicker { margin-bottom: 6px; }
.consent-surface h2, .remembered-panel h2 { margin: 0; color: var(--text-strong); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.consent-copy { margin-top: 17px; color: #475569; font-size: 15px; line-height: 1.8; }
.consent-form { margin-top: 24px; }
.consent-question { margin: 0; padding: 0; border: 0; }
.consent-question-label { margin-bottom: 12px; color: var(--text-strong); font-size: 15px; font-weight: 700; line-height: 1.55; }
.consent-check { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-subtle); color: #334155; cursor: pointer; }
.consent-submit { display: inline-flex; align-items: center; gap: 18px; }
.consent-submit span { font-size: 19px; font-weight: 400; line-height: 1; }
.consent-check:hover { border-color: #a5b4fc; background: #fafaff; }
.consent-check .form-check-input { flex: 0 0 auto; margin: 2px 0 0; }
.remembered-panel { padding: 27px 30px; border-color: #c7d2fe; background: linear-gradient(145deg, #fff 45%, #f7f7ff); }
.remembered-panel-heading p { margin: 7px 0 0; color: var(--muted); }
.remembered-list { display: grid; gap: 9px; margin-top: 20px; }
.remembered-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid #e0e7ff; border-radius: 11px; background: rgba(255,255,255,.86); }
.remembered-item strong { display: block; color: var(--text-strong); font-size: 13px; }
.remembered-item span:not(.badge) { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.remembered-note { margin-top: 16px; color: var(--muted); font-size: 12.5px; }
.survey-closed-note { display: grid; gap: 4px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.survey-closed-note strong { color: var(--text-strong); }
.survey-closed-label { color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }

.form-error-summary { margin-bottom: 22px; padding: 18px 20px; border: 1px solid #fecdd3; border-radius: var(--radius); background: var(--danger-soft); color: #9f1239; }
.form-error-summary p { margin: 3px 0 8px; font-size: 13px; }
.form-error-summary ul { margin: 0; padding-left: 20px; font-size: 13px; }
.form-header { margin-bottom: 24px; padding: 8px 2px 0; }
.progress-meta { display: flex; justify-content: space-between; margin: 24px 0 7px; color: var(--muted); font-size: 11.5px; }
.progress-meta strong { color: #475569; }
.survey-progress { height: 6px; border-radius: 999px; background: #e8ebf3; }
.survey-progress .progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6366f1); transition: width .24s ease; }
.draft-recovery { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 15px 17px; border: 1px solid #bfdbfe; border-radius: var(--radius); background: var(--info-soft); color: #1e3a8a; }
.draft-recovery strong, .draft-recovery span { display: block; }
.draft-recovery span { margin-top: 2px; font-size: 12px; color: #3b5998; }
.survey-step { display: none; }
.survey-step.active { display: block; animation: step-in .18s ease; }
@keyframes step-in { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.form-surface { padding: 32px 34px 8px; }
.section-heading { margin-bottom: 10px; padding-bottom: 24px; border-bottom: 1px solid #edf0f5; }
.section-title { margin: 0; color: var(--text-strong); font-size: 23px; font-weight: 700; letter-spacing: -.025em; }
.section-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.question-list { padding-top: 8px; }
.question-block { padding: 24px 0 27px; border-bottom: 1px solid #edf0f5; }
.question-block:last-child { border-bottom: 0; }
.question-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.question-label { display: block; float: none; width: 100%; margin: 0 0 9px; color: var(--text-strong); font-size: 16.5px; font-weight: 650; line-height: 1.5; }
.question-help { margin: -3px 0 13px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.required-mark { margin-left: 2px; color: var(--danger); }
.content-block { padding: 2px 0; }
.content-block h3 { margin: 0 0 6px; color: var(--text-strong); font-size: 19px; font-weight: 700; }
.content-block div { color: var(--muted); }
.choice-list { display: grid; gap: 8px; }
.choice-option { display: flex; align-items: flex-start; gap: 11px; min-height: 44px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; color: #334155; cursor: pointer; }
.choice-option:hover { border-color: #e0e7ff; background: #fafaff; }
.choice-option:has(input:checked) { border-color: #c7d2fe; background: var(--primary-soft); color: #312e81; }
.choice-option .form-check-input { flex: 0 0 auto; margin-top: 2px; }
.field-error { margin-top: 9px; color: var(--danger); font-size: 12.5px; font-weight: 550; }
.is-invalid { border-color: #fb7185 !important; }

.linear-scale { width: 100%; max-width: 560px; margin: 18px auto 4px; }
.linear-scale-labels { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 11px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.linear-scale-labels span { max-width: 45%; }
.linear-scale-labels span:last-child { text-align: right; }
.linear-scale-options { display: flex; align-items: stretch; justify-content: center; gap: 4px; }
.linear-scale-choice { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; min-width: 44px; min-height: 66px; padding: 6px 3px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.linear-scale-choice:hover { border-color: #e0e7ff; background: #fafaff; }
.linear-scale-choice:has(input:checked) { border-color: #c7d2fe; background: var(--primary-soft); }
.linear-scale-number { margin-bottom: 5px; color: #475569; font-size: 13px; font-weight: 650; }
.linear-scale-choice input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.linear-scale-choice input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.question-grid-wrap { margin-top: 12px; border: 1px solid var(--border); border-radius: 11px; }
.question-grid .form-check-input { width: 20px; height: 20px; float: none; margin: 0; }
.form-navigation { display: flex; align-items: center; gap: 14px; padding: 22px 2px 0; }
.draft-state { min-width: 105px; color: var(--muted); font-size: 11.5px; }

.success-surface { max-width: 700px; margin: 20px auto 0; padding: 42px 40px; text-align: center; }
.success-mark { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; margin-bottom: 19px; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.success-mark svg { width: 28px; height: 28px; }
.success-copy { max-width: 550px; margin: 16px auto 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.success-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.edit-link-fallback { margin-top: 32px; padding-top: 22px; border-top: 1px solid #edf0f5; text-align: left; }
.edit-link-fallback summary { width: fit-content; margin: 0 auto; color: var(--primary); font-size: 13px; font-weight: 650; cursor: pointer; }
.edit-link-content { margin-top: 17px; padding: 17px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-subtle); }
.edit-link-content p { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }
.security-note { margin-top: 11px; color: #92400e; font-size: 11.5px; }
.copy-state { min-height: 18px; margin-top: 6px; color: var(--success); font-size: 11.5px; }

@media (max-width: 1199.98px) {
    .builder-outline-card { position: static; max-height: none; }
    .builder-outline-scroll { max-height: 440px; }
}

@media (max-width: 991.98px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
    .admin-sidebar.open { transform: none; }
    .admin-sidebar-backdrop { position: fixed; inset: 0; z-index: 1030; display: block; border: 0; background: rgba(15,23,42,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    .admin-sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }
    body.admin-sidebar-open { overflow: hidden; }
    .admin-main { margin-left: 0; }
    .admin-topbar { padding: 0 18px; }
    .admin-content { padding: 24px 18px; }
    .respondent-page { padding-top: 32px; }
    .research-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 575.98px) {
    .respondent-brandbar-inner { padding: 12px 16px; }
    .respondent-page { padding: 26px 14px 44px; }
    .survey-heading { font-size: 28px; }
    .survey-title-row { flex-direction: column; gap: 12px; }
    .survey-status { margin-top: 0; }
    .survey-hero-meta { gap: 6px 18px; line-height: 1.4; }
    .consent-surface, .remembered-panel, .success-surface { padding: 24px 20px; border-radius: 16px; }
    .form-surface { padding: 25px 20px 4px; border-radius: 16px; }
    .section-title { font-size: 21px; }
    .question-block { padding: 21px 0 24px; }
    .question-label { font-size: 16px; }
    .remembered-item { align-items: flex-start; flex-direction: column; }
    .remembered-item > div:last-child { width: 100%; justify-content: space-between; }
    .linear-scale { margin-top: 15px; }
    .linear-scale-labels { font-size: 11.5px; }
    .linear-scale-options { gap: 1px; }
    .linear-scale-choice { min-width: 40px; min-height: 64px; padding-inline: 1px; }
    .form-navigation { flex-wrap: wrap; }
    .draft-state { order: 3; width: 100%; min-height: 18px; text-align: right; }
    .success-surface { text-align: left; }
    .success-mark { margin-bottom: 16px; }
    .success-actions { justify-content: stretch; }
    .success-actions .btn { width: 100%; }
    .edit-link-fallback summary { margin-left: 0; }
    .edit-link-content .input-group { display: grid; gap: 8px; }
    .edit-link-content .input-group > * { width: 100%; border-radius: var(--radius-sm) !important; }
    .setting-toggle { gap: 14px; }
    .page-title { font-size: 23px; }
    .lifecycle-panel { align-items: flex-start; flex-direction: column; gap: 16px; }
    .lifecycle-panel form { width: 100%; justify-content: space-between; }
    .lifecycle-panel form .btn { flex: 1 1 auto; }
    .lifecycle-header-status { justify-items: start; }
    .research-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .research-summary-item:last-child { grid-column: 1 / -1; }
    .admin-user-list { padding-inline: 14px; }
    .admin-user-item summary { align-items: flex-start; }
    .version-choice-grid { grid-template-columns: 1fr; }
}

@media print {
    .admin-sidebar, .admin-topbar, .btn, .nav-tabs { display: none !important; }
    .admin-main { margin: 0; }
    .admin-content { max-width: none; padding: 0; }
    .card { box-shadow: none; }
}
