:root {
    --text: #1f2933;
    --muted: #5f6c7b;
    --line: #d8dee7;
    --panel: #ffffff;
    --panel-alt: #f7f5f0;
    --brand: #29465b;
    --success: #1f7a45;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #eef2f5;
    overflow-x: hidden;
}

a {
    color: var(--brand);
}

code {
    font-family: Consolas, monospace;
}

.app-shell .topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem 2rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.public-shell {
    --brand: var(--brand-color, #29465b);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.82) 0, rgba(255, 255, 255, 0) 30rem),
        linear-gradient(180deg, var(--page-bg, #f7f4ee) 0%, #f5f1e8 100%);
    min-height: 100vh;
}

.container,
.public-container {
    width: min(1120px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.public-container {
    width: min(960px, calc(100vw - 1.25rem));
    padding-top: 1rem;
}

.public-shell-embed .public-container {
    width: min(100vw, 980px);
    padding-top: 0;
    padding-bottom: 0.75rem;
}

.brand {
    font-size: 1.35rem;
    font-weight: 700;
    text-decoration: none;
}

.topbar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-pill,
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    background: #e6eef4;
    color: var(--brand);
    font-size: 0.85rem;
}

.hero-panel,
.card,
.centered-card,
.stat-card,
.survey-hero {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 16px 35px rgba(22, 33, 45, 0.06);
}

.hero-panel,
.card,
.survey-hero {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.centered-card {
    max-width: 520px;
    margin: 6rem auto;
    padding: 2rem;
}

.narrow-card {
    max-width: 460px;
}

.card-header h1,
.hero-panel h1 {
    margin: 0.25rem 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.survey-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--brand);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.muted,
.muted-link {
    color: var(--muted);
}

.muted-link {
    text-decoration: none;
}

.stack {
    display: grid;
    gap: 1rem;
}

.field,
.field-block {
    display: grid;
    gap: 0.4rem;
}

.field input,
.field-block input,
.field-block select,
.field-block textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}

.field-block textarea {
    resize: vertical;
    min-height: 3.25rem;
}

.field-label {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    font-weight: 700;
}

.question-index,
.required {
    color: var(--brand);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.85rem 1.2rem;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.button-secondary {
    background: #dbe7ef;
    color: var(--brand);
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.alert {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #e5f6eb;
    color: var(--success);
}

.alert-error {
    background: #fdecea;
    color: var(--danger);
}

.stat-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.25rem;
}

.stat-card strong {
    display: block;
    margin-top: 0.4rem;
    font-size: 2rem;
}

.stat-label {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
 td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list {
    margin: 0;
    display: grid;
    gap: 0.9rem;
}

.detail-list div {
    display: grid;
    gap: 0.2rem;
}

.detail-list dt {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.detail-list dd {
    margin: 0;
}

.clean-list,
.question-list {
    margin: 0;
    padding-left: 1.1rem;
}

.clean-list {
    padding-left: 0;
    list-style: none;
}

.clean-list li,
.question-list li {
    margin-bottom: 0.75rem;
}

.compact {
    font-size: 0.95rem;
}

.credential-note {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
    font-size: 0.92rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.option-pill {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-alt);
}

.survey-form {
    background: rgba(255, 255, 255, 0.95);
}

.survey-hero {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    padding: 1.2rem 1.3rem 1.35rem;
    overflow: hidden;
}

.survey-hero::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: var(--brand);
}

.survey-hero-copy {
    display: grid;
    gap: 0.75rem;
    max-width: 42rem;
}

.survey-hero-copy p {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}

.survey-reference {
    display: inline-grid;
    gap: 0.18rem;
    min-width: 11rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: #f7f9fc;
    border: 1px solid var(--line);
}

.survey-reference strong {
    font-size: 1rem;
}

.survey-form-embed {
    padding: 0.2rem 0 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.embed-shell {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 24px 48px rgba(22, 33, 45, 0.1);
}

.embed-shell iframe {
    width: 1px;
    min-width: 100%;
    height: 539px;
    border: 0;
    display: block;
    background: #fff;
}

.embed-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.75rem 0.15rem 0;
}

.embed-button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

.embed-actions .muted,
.embed-meta {
    margin: 0;
}

.embed-meta {
    display: inline-grid;
    gap: 0.18rem;
}

.section-break {
    padding-top: 0.5rem;
    border-top: 1px dashed var(--line);
}

.section-break h2,
.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.9rem;
}

.is-hidden {
    display: none;
}

.thank-you-card,
.legal-card {
    background: rgba(255, 255, 255, 0.92);
}

@media (max-width: 760px) {
    .app-shell .topbar {
        padding: 1.25rem;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .hero-actions {
        width: 100%;
    }

    .container,
    .public-container {
        width: min(100vw - 0.75rem, 100%);
        padding: 0.45rem 0 1.4rem;
    }

    .public-shell-embed .public-container {
        width: 100vw;
        padding: 0;
    }

    .hero-panel,
    .card,
    .survey-hero,
    .centered-card {
        border-radius: 16px;
        padding: 1.1rem;
    }

    .hero-panel {
        flex-direction: column;
    }

    .survey-hero {
        align-items: flex-start;
        gap: 0.9rem;
    }

    .survey-hero h1 {
        font-size: clamp(1.9rem, 10vw, 2.5rem);
    }

    .survey-reference {
        min-width: 0;
        width: 100%;
    }

    .survey-form-embed {
        padding: 0;
    }

    .embed-shell {
        border-radius: 14px;
        border-left: 0;
        border-right: 0;
    }

    .embed-shell iframe {
        min-height: 78vh;
    }

    .embed-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem 0.1rem 0;
    }

    .embed-actions .button {
        width: 100%;
    }

    .embed-button-row {
        justify-content: stretch;
    }
}
