:root {
    --bg: #f4f7f3;
    --surface: #ffffff;
    --surface-muted: #edf3ee;
    --border: #d5e0d8;
    --text: #20322b;
    --muted: #5f7269;
    --primary: #547c68;
    --primary-strong: #355a48;
    --danger-bg: #fdecec;
    --danger-text: #8e2f2f;
    --success-bg: #eaf6ed;
    --success-text: #2f6a42;
    --info-bg: #edf5fb;
    --info-text: #315d7b;
    --shadow: 0 18px 45px rgba(40, 67, 55, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(130, 171, 148, 0.24), transparent 32%),
        linear-gradient(180deg, #f9fbf8 0%, var(--bg) 100%);
}

a {
    color: var(--primary-strong);
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
    flex: 1;
}

.card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

.hero {
    margin-bottom: 1rem;
}

.survey-form,
.stack-sm {
    display: grid;
    gap: 1rem;
}

fieldset.card {
    margin: 0 0 1rem;
}

legend {
    padding: 0 0.7rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-strong);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin-bottom: 0.75rem;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-strong);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.intro,
.section-copy,
.muted {
    color: var(--muted);
}

.field {
    display: grid;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(213, 224, 216, 0.8);
}

.field:first-of-type {
    border-top: 0;
    padding-top: 0.5rem;
}

.field label,
.field-label {
    font-weight: 600;
    margin: 0;
}

input[type="number"] {
    width: min(220px, 100%);
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid #b8c9bf;
    background: #fcfdfc;
    font-size: 1rem;
}

input[type="password"] {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid #b8c9bf;
    background: #fcfdfc;
    font-size: 1rem;
}

input[type="number"]:focus,
input[type="password"]:focus,
input[type="radio"]:focus {
    outline: 2px solid rgba(84, 124, 104, 0.2);
    outline-offset: 2px;
}

.radio-group,
.radio-grid {
    display: grid;
    gap: 0.65rem;
}

.radio-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: var(--surface-muted);
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0.9rem;
    font-weight: 500;
}

.radio-option:hover {
    border-color: #a9c0b3;
}

.radio-option input {
    margin-top: 0.2rem;
}

.radio-option-compact {
    min-height: 100%;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.actions-spread {
    justify-content: space-between;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.35rem;
    font-size: 0.98rem;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    cursor: pointer;
}

.button:hover {
    filter: brightness(1.04);
}

.button-secondary {
    color: var(--primary-strong);
    background: #e4eee8;
}

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

.alert ul {
    margin: 0.5rem 0 0 1rem;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #f7caca;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #c5e4cc;
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: #c9dfef;
}

.stats-card {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: 16px;
    background: #eff6f1;
    border: 1px solid var(--border);
}

.stats-label {
    font-size: 0.88rem;
    color: var(--muted);
}

.stats-value {
    font-size: 2rem;
    line-height: 1;
    color: var(--primary-strong);
}

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

.stats-value-sm {
    font-size: 1.05rem;
    line-height: 1.35;
}

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

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-grid-halves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

.chart-card {
    min-width: 0;
}

.chart-card-plain {
    padding: 0;
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.donut-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.25rem;
    align-items: center;
}

.donut-chart {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}

.donut-chart::after {
    content: "";
    position: absolute;
    inset: 24%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 0 0 1px rgba(213, 224, 216, 0.85);
}

.chart-legend {
    display: grid;
    gap: 0.8rem;
}

.legend-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.legend-item strong,
.legend-item span {
    display: block;
}

.legend-item span {
    color: var(--muted);
    font-size: 0.92rem;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-top: 0.3rem;
    flex: 0 0 auto;
}

.bar-chart-list {
    display: grid;
    gap: 0.95rem;
}

.chart-row {
    display: grid;
    gap: 0.45rem;
}

.chart-row__header {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.93rem;
}

.chart-row__header strong {
    white-space: nowrap;
}

.chart-track {
    width: 100%;
    height: 12px;
    background: #e6efe9;
    border-radius: 999px;
    overflow: hidden;
}

.chart-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #7cad92 0%, #3f6954 100%);
}

.chart-fill-accent {
    background: linear-gradient(90deg, #d4a676 0%, #a76f3e 100%);
}

.chart-fill-soft {
    background: linear-gradient(90deg, #8aa8bb 0%, #446779 100%);
}

.login-card {
    max-width: 560px;
    margin: 5rem auto 0;
}

.field-no-border {
    border-top: 0;
    padding-top: 0;
}

.inline-form {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
}

th,
td {
    padding: 0.85rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e4ece7;
    font-size: 0.92rem;
}

th {
    position: sticky;
    top: 0;
    background: #eaf1ec;
    color: var(--primary-strong);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.thank-you-card {
    text-align: center;
    max-width: 720px;
    margin: 4rem auto 0;
}

.site-footer {
    padding: 1rem;
    border-top: 1px solid rgba(213, 224, 216, 0.9);
    background: rgba(242, 247, 243, 0.92);
}

.site-footer__inner {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: center;
    justify-content: center;
}

.site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: center;
}

.footer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: #e3eee7;
    color: var(--primary-strong);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

.footer-action-secondary {
    background: #f0f5f1;
}

.footer-powered {
    width: 100%;
    text-align: center;
    color: #6a8578;
    text-decoration: none;
    font-size: 0.95rem;
}

.footer-powered:hover,
.footer-action:hover {
    color: var(--primary-strong);
}

@media (max-width: 768px) {
    .container {
        width: min(100% - 1rem, 100%);
        padding-top: 1rem;
    }

    .card {
        padding: 1rem;
        border-radius: 16px;
    }

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

    .admin-grid,
    .admin-grid-halves,
    .donut-layout {
        grid-template-columns: 1fr;
    }

    .donut-chart {
        width: 190px;
        height: 190px;
    }

    .actions,
    .actions-spread {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }

    .radio-grid {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 1000px;
    }

    .site-footer__inner {
        width: min(100% - 1rem, 100%);
    }
}
