.survey-page-heading,
.survey-builder-hero,
.survey-response-shell,
.survey-success-card,
.survey-form-section,
.survey-lifecycle-panel,
.survey-result-card,
.survey-public-card {
    --survey-accent: #158a62;
    --survey-accent-dark: #0f684b;
    --survey-accent-soft: #e8f6f0;
    --survey-ink: #18332a;
    --survey-muted: #65776f;
    --survey-line: #dce7e2;
    --survey-surface: #fff;
}

.survey-page-heading .button,
.survey-builder-actions .button,
.survey-heading-actions .button {
    gap: .45rem;
    white-space: nowrap;
}

.survey-page-heading .button svg,
.survey-builder-actions .button svg,
.survey-heading-actions .button svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.survey-heading-actions,
.survey-builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
}

.survey-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.2rem 0;
    padding: .85rem;
    border: 1px solid var(--survey-line, #dce7e2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .88);
}

.survey-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, auto) auto auto;
    align-items: center;
    gap: .65rem;
    width: min(100%, 820px);
    position: relative;
}

.survey-filter-form input,
.survey-filter-form select {
    min-height: 42px;
    border: 1px solid #ccd9d3;
    border-radius: 10px;
    background: #fff;
    padding: .65rem .8rem;
    color: #20362e;
    font: inherit;
}

.survey-filter-form input { padding-left: 2.55rem; }
.survey-search-icon {
    position: absolute;
    left: .8rem;
    top: 50%;
    translate: 0 -50%;
    display: grid;
    width: 1rem;
    color: #70827a;
}
.survey-search-icon svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.survey-reset { color: #4f6e62; font-size: .86rem; font-weight: 600; }
.survey-result-count { display: flex; gap: .35rem; margin: 0; color: #687a73; font-size: .84rem; white-space: nowrap; }
.survey-result-count strong { color: #18382c; }

.survey-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
    gap: 1rem;
}

.survey-card {
    display: flex;
    flex-direction: column;
    min-height: 300px;
    overflow: visible;
    border: 1px solid var(--survey-line, #dce7e2);
    border-radius: 16px;
    background: var(--survey-surface, #fff);
    box-shadow: 0 12px 28px rgba(20, 58, 44, .06);
}

.survey-card-header,
.survey-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.survey-card-header { align-items: flex-start; flex-wrap: wrap; padding: 1rem 1rem 0; }
.survey-card-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: var(--survey-accent-soft, #e8f6f0);
    color: var(--survey-accent, #158a62);
    font-weight: 700;
}
.survey-card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.survey-badge-row { display: flex; min-width: 0; flex: 1; flex-wrap: wrap; gap: .35rem; align-items: center; }
.survey-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: #edf2f0;
    color: #53675f;
    font-size: .69rem;
    font-weight: 650;
    letter-spacing: .02em;
}
.survey-badge--published { background: #dff5e9; color: #0a7148; }
.survey-badge--draft { background: #fff4d7; color: #895a00; }
.survey-badge--closed { background: #eceff1; color: #556169; }
.survey-badge--audience { background: #e7f0fb; color: #285e91; }
.survey-card-body { flex: 1; padding: 1rem; }
.survey-scope { margin: 0 0 .35rem; color: var(--survey-accent, #158a62); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.survey-card-body h2 { margin: 0; color: var(--survey-ink, #18332a); font-size: 1.08rem; line-height: 1.35; }
.survey-card-body > p:last-child { margin: .55rem 0 0; color: var(--survey-muted, #65776f); font-size: .86rem; line-height: 1.55; }
.survey-card-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 0; background: var(--survey-line, #dce7e2); border-top: 1px solid var(--survey-line, #dce7e2); border-bottom: 1px solid var(--survey-line, #dce7e2); }
.survey-card-metrics div { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .65rem .9rem; background: #f9fbfa; }
.survey-card-metrics dt { color: #718179; font-size: .72rem; }
.survey-card-metrics dd { margin: 0; color: #243b32; font-size: .95rem; font-weight: 700; }
.survey-card-footer { padding: .7rem .9rem; }
.survey-date { color: #77867f; font-size: .75rem; }

.survey-empty-state {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.35rem;
    border: 1px dashed #b8cec4;
    border-radius: 16px;
    background: #f8fcfa;
}
.survey-empty-state > span { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 15px; background: #e5f5ee; color: #16815d; }
.survey-empty-state svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.survey-empty-state div { flex: 1; }
.survey-empty-state h2 { margin: 0; color: #19392d; font-size: 1rem; }
.survey-empty-state p { margin: .3rem 0 0; color: #697a72; font-size: .86rem; }

.survey-settings-form,
.survey-question-form { display: grid; gap: 1rem; }
.survey-form-section,
.survey-question-form {
    padding: 1.15rem;
    border: 1px solid var(--survey-line, #dce7e2);
    border-radius: 16px;
    background: var(--survey-surface, #fff);
}
.survey-form-section > header { display: flex; gap: .85rem; align-items: flex-start; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid #e8eeeb; }
.survey-form-section > header > span { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: var(--survey-accent-soft, #e8f6f0); color: var(--survey-accent, #158a62); font-size: .73rem; font-weight: 700; }
.survey-form-section h2 { margin: 0; color: #203a30; font-size: .98rem; }
.survey-form-section header p { margin: .22rem 0 0; color: #718078; font-size: .8rem; }
.survey-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.survey-form-span { grid-column: 1 / -1; }
.survey-settings-form .form-field,
.survey-question-form .form-field { display: grid; gap: .4rem; align-content: start; }
.survey-settings-form .form-field > label:not(.switch-row),
.survey-question-form .form-field > label:not(.switch-row) { color: #31483f; font-size: .78rem; font-weight: 650; }
.survey-settings-form input:not([type="checkbox"]),
.survey-settings-form select,
.survey-settings-form textarea,
.survey-question-form input:not([type="checkbox"]),
.survey-question-form select,
.survey-question-form textarea {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    border: 1px solid #c9d7d1;
    border-radius: 10px;
    background: #fff;
    padding: .65rem .75rem;
    color: #233a31;
    font: inherit;
}
.survey-settings-form textarea,
.survey-question-form textarea { resize: vertical; }
.survey-settings-form small,
.survey-question-form small { color: #75847d; font-size: .73rem; line-height: 1.4; }
.survey-switch-field { align-self: stretch; }
.switch-row { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem; border: 1px solid #dce6e1; border-radius: 11px; background: #f9fbfa; cursor: pointer; }
.switch-row .switch-input { margin-top: .16rem; }
.switch-row span { display: grid; gap: .2rem; }
.switch-row strong { color: #2c4339; font-size: .82rem; }
.switch-row small { font-weight: 400; }
.field-error,
.survey-field-errors p,
.survey-form-errors p { margin: 0; color: #a23434; font-size: .77rem; }
.survey-form-errors { padding: .8rem; border: 1px solid #efcaca; border-radius: 10px; background: #fff3f3; }
.form-field.has-errors input,
.form-field.has-errors select,
.form-field.has-errors textarea { border-color: #c85d5d; }

.survey-builder-hero {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 1.35rem;
    border-radius: 18px;
    color: #eefbf6;
    background: var(--survey-accent-dark, #0f684b);
}
.survey-builder-hero h1 { margin: .65rem 0 .35rem; color: #fff; font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 500; }
.survey-builder-hero p { margin: 0; color: rgba(244,255,250,.78); font-size: .88rem; line-height: 1.55; }
.survey-builder-hero .survey-builder-actions { align-self: flex-start; }
.survey-builder-hero .button-secondary { border-color: rgba(255,255,255,.38); color: #fff; background: rgba(255,255,255,.1); }
.survey-lifecycle-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--survey-line, #dce7e2); border-radius: 14px; background: #fff; }
.survey-lifecycle-panel > div:not(.survey-lifecycle-actions) { display: grid; gap: .25rem; }
.survey-lifecycle-panel strong { color: #667a71; font-size: .69rem; text-transform: uppercase; letter-spacing: .06em; }
.survey-lifecycle-panel span { color: #243c32; font-size: .82rem; }
.survey-lifecycle-actions form { margin: 0; }
.survey-section-heading { display: flex; justify-content: space-between; align-items: end; margin: 1.5rem 0 .8rem; }
.survey-section-heading p { margin: 0; }
.survey-section-heading h2 { margin: .15rem 0 0; font-size: 1.08rem; color: #263e34; }
.survey-section-heading > strong { display: grid; place-items: center; min-width: 38px; height: 32px; border-radius: 999px; background: #e7f4ee; color: #147052; }
.survey-question-list { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.survey-builder-question { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: .9rem; align-items: start; padding: 1rem; border: 1px solid #dce7e2; border-radius: 14px; background: #fff; }
.survey-builder-question-order { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: #edf7f3; color: #167654; font-size: .76rem; font-weight: 700; }
.survey-builder-question-meta { display: flex; gap: .35rem; flex-wrap: wrap; }
.survey-builder-question-meta span { padding: .18rem .45rem; border-radius: 999px; background: #eff3f1; color: #62746c; font-size: .65rem; font-weight: 650; }
.survey-builder-question-content h3 { margin: .48rem 0 0; color: #213b30; font-size: .94rem; line-height: 1.45; }
.survey-builder-question-content > p { margin: .3rem 0 0; color: #6e7e77; font-size: .78rem; }
.survey-option-preview { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.survey-option-preview li { padding: .28rem .5rem; border: 1px solid #dce5e1; border-radius: 7px; color: #536860; font-size: .72rem; }
.survey-question-actions { display: flex; flex-wrap: nowrap; }
.survey-question-actions form { margin: 0; }
.survey-builder-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid #dce6e1; }
.button-danger { background: #a43c3c; color: #fff; border-color: #a43c3c; }
.button-danger:disabled { opacity: .45; cursor: not-allowed; }

.survey-response-shell { width: min(100%, 850px); margin: 0 auto; }
.survey-response-header { margin-bottom: 1rem; padding: 1.35rem; border-radius: 17px; background: var(--survey-accent-dark, #0f684b); color: #fff; }
.survey-response-header h1 { margin: .25rem 0 .45rem; color: #fff; font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 500; }
.survey-response-header > p:not(.section-label):not(.public-kicker):not(.survey-privacy-note) { color: rgba(255,255,255,.78); font-size: .87rem; line-height: 1.55; }
.survey-response-header .survey-badge-row { margin-top: .75rem; }
.survey-response-form { display: grid; gap: .75rem; }
.survey-response-fields { display: grid; gap: .75rem; }
.survey-question-card { min-width: 0; margin: 0; padding: 1rem; border: 1px solid #dce6e1; border-radius: 14px; background: #fff; }
.survey-question-card legend { display: flex; align-items: center; gap: .55rem; width: 100%; padding: 0; color: #243c32; font-size: .91rem; font-weight: 600; line-height: 1.45; }
.survey-question-number { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; background: #e8f5ef; color: #137352; font-size: .66rem; }
.survey-required { margin-left: auto; color: #8c5b19; font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; }
.survey-question-help { margin: .4rem 0 .7rem 2.9rem; color: #728079; font-size: .76rem; }
.survey-answer-control > input:not([type="radio"]):not([type="checkbox"]),
.survey-answer-control > select,
.survey-answer-control > textarea { width: 100%; min-height: 43px; box-sizing: border-box; border: 1px solid #c9d7d1; border-radius: 10px; padding: .7rem .8rem; background: #fff; color: #243c32; font: inherit; }
.survey-answer-control textarea { resize: vertical; }
.survey-answer-control > div { display: grid; gap: .45rem; }
.survey-answer-control > div > div label { display: flex; align-items: center; gap: .55rem; padding: .58rem .7rem; border: 1px solid #dde6e2; border-radius: 9px; color: #3e544a; font-size: .82rem; cursor: pointer; }
.survey-answer-control input[type="radio"],
.survey-answer-control input[type="checkbox"] { accent-color: #158a62; }
.survey-question-card.has-errors { border-color: #d58b8b; background: #fffafa; }
.survey-success-card { display: grid; justify-items: center; width: min(100%, 640px); margin: 4vh auto; padding: 2rem; border: 1px solid #d8e8e0; border-radius: 20px; background: #fff; text-align: center; box-shadow: none; }
.survey-success-card > span { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: #e3f6ec; color: #118056; font-size: 1.8rem; }
.survey-success-card svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.survey-success-card h1 { margin: .4rem 0; color: #1c3a2f; font-size: 1.45rem; }
.survey-success-card > p:not(.section-label):not(.public-kicker) { color: #667a71; line-height: 1.55; }

.survey-privacy-note { margin: 1rem 0; padding: .75rem .9rem; border-left: 3px solid #4c8fbf; border-radius: 0 8px 8px 0; background: #eff7fc; color: #365a72; font-size: .8rem; line-height: 1.5; }
.survey-scope-summary { margin: 1rem 0; padding: 1rem; border: 1px solid #dce7e2; border-radius: 15px; background: #fff; }
.survey-scope-summary h2 { margin: .15rem 0 0; color: #263e34; font-size: 1rem; }
.survey-scope-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .6rem; margin-top: .85rem; }
.survey-scope-summary-grid article { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem .75rem; border-radius: 10px; background: #f3f8f5; color: #52675e; font-size: .78rem; }
.survey-scope-summary-grid strong { color: #147553; font-size: 1rem; }
.survey-results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 1rem; }
.survey-result-card { padding: 1rem; border: 1px solid #dce7e2; border-radius: 15px; background: #fff; }
.survey-result-card > header { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: .7rem; align-items: start; }
.survey-result-card > header > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #e8f5ef; color: #147553; font-size: .65rem; font-weight: 700; }
.survey-result-card header p { margin: 0; color: #718078; font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; }
.survey-result-card h2 { margin: .2rem 0 0; color: #243c32; font-size: .9rem; line-height: 1.4; }
.survey-result-card header > strong { color: #137452; font-size: 1.05rem; }
.survey-bars { display: grid; gap: .7rem; margin-top: 1rem; }
.survey-bar-row > div { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .25rem; color: #52675e; font-size: .75rem; }
.survey-bar-track { display: block; height: 7px; overflow: hidden; border-radius: 999px; background: #e8eeeb; }
.survey-bar-track > span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--survey-accent, #158a62); }
.survey-rating-average { display: flex; align-items: baseline; gap: .3rem; margin: 1rem 0 0; color: #6c7d75; }
.survey-rating-average strong { color: #147553; font-size: 1.65rem; font-weight: 500; }
.survey-aggregate-note { margin: 1rem 0 0; padding: .7rem; border-radius: 9px; background: #f4f7f5; color: #66776f; font-size: .76rem; }
.survey-response-table { overflow-x: auto; }
.survey-anonymous-label { display: inline-flex; padding: .25rem .5rem; border-radius: 999px; background: #eef2f0; color: #65756e; font-size: .7rem; }
.survey-pagination { display: flex; justify-content: center; gap: 1rem; align-items: center; margin-top: 1rem; color: #64776e; font-size: .8rem; }
.survey-pagination a { color: #147553; font-weight: 600; }
.survey-answer-detail { display: grid; gap: .7rem; margin: 0; }
.survey-answer-detail > div { padding: 1rem; border: 1px solid #dce6e1; border-radius: 13px; background: #fff; }
.survey-answer-detail dt { display: flex; align-items: center; gap: .55rem; color: #31483f; font-size: .82rem; font-weight: 650; }
.survey-answer-detail dt span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #eaf5f0; color: #147553; font-size: .62rem; }
.survey-answer-detail dd { margin: .65rem 0 0 2.85rem; color: #53675e; font-size: .85rem; line-height: 1.55; }

.survey-public-hero { margin-bottom: 1.2rem; padding: clamp(1.2rem, 4vw, 2.2rem); border-radius: 20px; background: #f8fcfa; border: 1px solid #d9e9e1; }
.survey-public-hero h1 { margin: .25rem 0 .45rem; color: #163d2e; font-size: clamp(1.65rem, 4vw, 2.3rem); font-weight: 400; }
.survey-public-hero > p:last-child { max-width: 720px; margin: 0; color: #60746b; line-height: 1.6; }
.survey-public-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.survey-public-card { display: flex; flex-direction: column; padding: 1.15rem; border: 1px solid #dce7e2; border-radius: 16px; background: #fff; box-shadow: none; }
.survey-public-card h2 { margin: .35rem 0; color: #1d3b30; font-size: 1.08rem; }
.survey-public-card > p:not(.survey-scope) { flex: 1; color: #687a72; font-size: .85rem; line-height: 1.55; }
.survey-public-footer { display: flex; justify-content: space-between; gap: .75rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid #e6ece9; }
.survey-public-footer > span { color: #667870; font-size: .72rem; }
.survey-public-footer .public-primary-action { padding: .55rem .75rem; font-size: .77rem; }
.survey-response-shell--public { margin-top: 1rem; }
.survey-response-shell--public .survey-response-header { background: var(--survey-accent-dark, #0f684b); }
.survey-success-card--public { margin-block: 7vh; }

@media (max-width: 900px) {
    .survey-toolbar,
    .survey-builder-hero { align-items: stretch; flex-direction: column; }
    .survey-filter-form { grid-template-columns: 1fr 1fr auto; }
    .survey-filter-form input { grid-column: 1 / -1; }
    .survey-search-icon { top: 21px; translate: 0 -50%; }
    .survey-lifecycle-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .survey-filter-form,
    .survey-form-grid,
    .survey-lifecycle-panel { grid-template-columns: 1fr; }
    .survey-filter-form .button,
    .survey-filter-form select { width: 100%; }
    .survey-form-span { grid-column: auto; }
    .survey-builder-question { grid-template-columns: 38px minmax(0, 1fr); }
    .survey-builder-question-order { width: 36px; height: 36px; }
    .survey-question-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .survey-builder-footer,
    .survey-public-footer { align-items: stretch; flex-direction: column; }
    .survey-heading-actions { width: 100%; }
}
