:root {
    color-scheme: light;
    --ink: #172a26;
    --muted: #71817c;
    --green: #123c35;
    --green-dark: #0e302b;
    --green-soft: #e8f1ed;
    --gold: #d3a650;
    --paper: #f5f7f5;
    --line: #e8ece8;
    --white: #fff;
    --shadow: 0 18px 60px rgba(25, 53, 44, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.site-header {
    height: 74px;
    padding: 0 max(6vw, calc((100vw - 1200px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid rgba(22, 54, 45, .07);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--green);
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    color: var(--white);
    background: var(--green);
    border-radius: 11px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 18px;
}

.brand-year { color: #a58342; }
.header-link { color: #596c65; font-size: 13px; font-weight: 600; text-decoration: none; }
.header-link:hover, .auth-back:hover { color: var(--green); text-decoration: underline; }

.page-shell { width: min(840px, calc(100% - 36px)); margin: 52px auto 42px; }
.intro { padding: 0 10px 24px; }
.eyebrow { margin: 0 0 8px; color: #a27a36; font-size: 10px; font-weight: 700; letter-spacing: .15em; }
h1, h2, h3, p { margin-top: 0; }
.intro h1, .dashboard-heading h1 { margin: 0; font-family: 'Segoe UI', sans-serif; font-size: clamp(30px, 5vw, 43px); font-weight: 800; letter-spacing: -.05em; line-height: 1.15; }
.intro-copy { margin: 8px 0 20px; color: var(--muted); font-size: 16px; }

.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 15px;
    color: #426057;
    background: var(--green-soft);
    border: 1px solid #dce9e2;
    border-radius: 11px;
}
.privacy-note p { margin: 0; font-size: 12px; }
.privacy-icon { color: #367360; font-size: 21px; line-height: 1; }
.sync-note { margin-top: 10px; padding: 11px 14px; color: #315e49; background: #edf6ef; border: 1px solid #d5e8d9; border-radius: 9px; font-size: 12px; }
.sync-note.is-warning { color: #775820; background: #fcf6e8; border-color: #ede0bb; }

.survey-card, .auth-card, .result-card, .stat-card, .success-card {
    background: var(--white);
    border: 1px solid rgba(21, 54, 44, .07);
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.survey-card { padding: 32px 38px; }
.form-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-heading .eyebrow { margin-bottom: 3px; }
.form-heading h2 { margin: 0; font-family: 'Segoe UI', sans-serif; font-size: 22px; letter-spacing: -.03em; }
.time-badge { padding: 6px 10px; color: #567168; background: #f2f6f3; border-radius: 20px; font-size: 11px; font-weight: 600; }

.question-section { padding-top: 25px; }
.section-heading { display: flex; align-items: flex-start; gap: 13px; margin: 2px 0 19px; }
.section-number { flex: 0 0 35px; height: 35px; display: grid; place-items: center; color: #86672f; background: #faf4e9; border-radius: 10px; font-size: 11px; font-weight: 700; }
.section-heading h3 { margin: 0 0 2px; font-family: 'Segoe UI', sans-serif; font-size: 17px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.question { min-width: 0; margin: 0; padding: 17px 0 19px; border: 0; border-bottom: 1px solid #eef0ed; }
.question-invalid { padding-right: 10px; padding-left: 10px; background: #fff8f6; border-bottom-color: #e4a59b; border-radius: 9px; }
.question legend { width: 100%; padding: 0; font-size: 14px; font-weight: 600; line-height: 1.55; }
.question-title { font-size: 14px; font-weight: 600; }
.question-number { display: inline-grid; width: 22px; height: 22px; margin-right: 5px; place-items: center; color: #70837b; background: #f2f5f2; border-radius: 7px; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.question-hint { margin: 5px 0 10px 31px; color: var(--muted); font-size: 12px; }
.options { display: flex; flex-wrap: wrap; gap: 8px; margin: 11px 0 0 29px; }
.options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; display: inline-flex; min-height: 42px; align-items: center; gap: 9px; padding: 9px 12px; color: #53635e; background: #fafbfa; border: 1px solid #edf0ed; border-radius: 9px; cursor: pointer; font-size: 12px; transition: background .15s, border-color .15s, color .15s; }
.choice:hover { background: #f3f7f4; border-color: #c9d9cf; }
.choice:has(input:checked) { color: var(--green); background: #eef5f0; border-color: #75a18b; }
.choice input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--green); }
.choice:focus-within { outline: 3px solid rgba(67, 133, 100, .2); outline-offset: 2px; }

.candidate-list { display: grid; gap: 9px; margin: 12px 0 0 29px; }
.candidate-row { display: grid; grid-template-columns: minmax(125px, .7fr) 1fr; gap: 6px 12px; align-items: center; padding: 12px; background: #fafbfa; border: 1px solid #edf0ed; border-radius: 10px; }
.candidate-row > strong { font-size: 12px; }
.candidate-row .options { margin: 0; }
.candidate-row .choice { min-height: 35px; padding: 6px 9px; background: var(--white); font-size: 11px; }
.candidate-opinion { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.opinion-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.candidate-opinion .options { flex: 1; }

.text-fields { display: grid; gap: 8px; margin: 13px 0 0 29px; }
.text-label { display: flex; justify-content: space-between; color: #465850; font-size: 12px; font-weight: 600; }
.text-label span { color: #92a19a; font-size: 10px; font-weight: 400; }
.text-fields input, .stacked-form input { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: #fcfdfc; border: 1px solid #dfe6e0; border-radius: 9px; outline: none; }
.text-fields input:focus, .stacked-form input:focus { border-color: #7da68e; box-shadow: 0 0 0 3px rgba(67, 133, 100, .13); }
.text-fields input::placeholder { color: #a5b0aa; }

.consent-box { margin-top: 22px; padding: 15px; background: #f8f8f4; border: 1px solid #efecdf; border-radius: 10px; }
.consent-choice { display: flex; align-items: flex-start; gap: 10px; color: #5e655a; cursor: pointer; font-size: 12px; }
.consent-choice input { width: 17px; height: 17px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--green); }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 22px; }
.submit-row p { margin: 0; color: var(--muted); font-size: 11px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 700; text-decoration: none; transition: background .15s, transform .15s; }
.button:disabled { opacity: .65; cursor: wait; }
.button-primary { color: var(--white); background: var(--green); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.button-secondary { color: var(--green); background: var(--white); border-color: #dce5de; }
.button-secondary:hover { background: #f5f8f5; }
.button-quiet { color: #617069; background: transparent; }
.button-quiet:hover { background: #f1f5f1; }
.form-alert { margin-top: 16px; padding: 12px 14px; color: #8d3434; background: #fff2f0; border: 1px solid #f1d4d0; border-radius: 9px; font-size: 12px; }

.success-card { max-width: 590px; margin: 30px auto; padding: 45px 35px; text-align: center; }
.success-icon { width: 52px; height: 52px; display: grid; margin: 0 auto 17px; place-items: center; color: #fff; background: #3d8264; border-radius: 50%; font-size: 24px; }
.success-card .eyebrow { margin-bottom: 7px; }
.success-card h2 { margin-bottom: 8px; font-family: 'Segoe UI', sans-serif; font-size: 26px; letter-spacing: -.04em; }
.success-card p:not(.eyebrow) { max-width: 390px; margin: 0 auto 22px; color: var(--muted); font-size: 13px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; padding: 18px 8px; color: #8b9690; font-size: 10px; }

.admin-page { min-height: 100vh; }
.admin-shell { width: min(1160px, calc(100% - 36px)); margin: 48px auto; }
.auth-card { width: min(450px, 100%); margin: 50px auto; padding: 34px; }
.auth-symbol { width: 44px; height: 44px; display: grid; margin-bottom: 21px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 13px; font-size: 22px; }
.auth-card h1 { margin: 0 0 7px; font-family: 'Segoe UI', sans-serif; font-size: 25px; letter-spacing: -.04em; line-height: 1.25; }
.auth-description { margin: 0 0 19px; color: var(--muted); font-size: 12px; }
.stacked-form { display: grid; gap: 9px; }
.stacked-form label { margin-top: 4px; color: #45554e; font-size: 12px; font-weight: 600; }
.stacked-form .button { margin-top: 9px; }
.full-button { width: 100%; }
.field-hint { margin: -4px 0 3px; color: var(--muted); font-size: 11px; }
.auth-back { display: inline-block; margin-top: 21px; color: #71817b; font-size: 11px; text-decoration: none; }

.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.dashboard-heading h1 { font-size: clamp(27px, 4vw, 37px); }
.dashboard-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.dashboard-actions { display: flex; align-items: center; gap: 7px; }
.dashboard-actions .button { min-height: 40px; }
.stats-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.stat-card { min-width: 0; padding: 20px; }
.stat-primary { color: var(--white); background: var(--green); }
.stat-primary .stat-label, .stat-primary .stat-note { color: rgba(255,255,255,.68); }
.stat-label { display: block; color: #87948e; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.stat-value { display: block; overflow: hidden; margin-top: 7px; font-family: 'Segoe UI', sans-serif; font-size: 31px; font-weight: 800; letter-spacing: -.05em; line-height: 1.2; text-overflow: ellipsis; }
.stat-text { font-size: 17px; letter-spacing: -.03em; }
.stat-note { display: block; margin-top: 5px; color: #8b9690; font-size: 10px; }
.results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.result-card { min-width: 0; padding: 20px; }
.result-card-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.result-card-heading .eyebrow { margin-bottom: 5px; }
.result-card h2 { margin: 0; font-family: 'Segoe UI', sans-serif; font-size: 15px; letter-spacing: -.02em; line-height: 1.4; }
.bar-chart { display: grid; gap: 12px; }
.bar-labels { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; color: #5d6b65; font-size: 10px; }
.bar-name { overflow-wrap: anywhere; }
.bar-value { flex: 0 0 auto; color: #74847c; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; overflow: hidden; background: #eef2ee; border-radius: 5px; }
.bar-fill { height: 100%; display: block; background: linear-gradient(90deg, #337a60, #80aa8b); border-radius: inherit; transition: width .4s ease; }
#question-results .result-card:nth-child(even) .bar-fill { background: linear-gradient(90deg, #a58445, #d6bc84); }
.location-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.location-list { display: grid; gap: 0; }
.location-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eff2ef; font-size: 11px; }
.location-row:last-child { border-bottom: 0; }
.location-name { overflow-wrap: anywhere; }
.location-count { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty-state { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-footnote { margin: 17px 2px; color: #89958e; font-size: 10px; }

@media (max-width: 700px) {
    .site-header { height: 62px; padding: 0 18px; }
    .brand { gap: 8px; font-size: 14px; }
    .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
    .header-link { font-size: 11px; }
    .page-shell { width: min(100% - 22px, 600px); margin: 30px auto 20px; }
    .intro { padding: 0 4px 17px; }
    .intro h1 { font-size: 33px; }
    .privacy-note { padding: 11px 12px; }
    .survey-card { padding: 22px 18px; border-radius: 13px; }
    .form-heading h2 { font-size: 19px; }
    .question legend, .question-title { font-size: 13px; }
    .options { margin-left: 0; gap: 7px; }
    .options-grid { grid-template-columns: 1fr; }
    .choice { min-height: 42px; }
    .candidate-list, .text-fields { margin-left: 0; }
    .candidate-row { grid-template-columns: 1fr; gap: 8px; }
    .candidate-opinion { grid-column: 1; }
    .candidate-row .options { flex-wrap: wrap; }
    .candidate-row .choice { min-height: 38px; }
    .question-hint { margin-left: 0; }
    .submit-row { align-items: stretch; flex-direction: column; }
    .submit-row .button { width: 100%; }
    .submit-row p { order: 1; text-align: center; }
    .page-footer { flex-direction: column; text-align: center; }
    .admin-shell { width: min(100% - 22px, 600px); margin: 27px auto; }
    .auth-card { margin: 24px auto; padding: 26px 21px; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; }
    .dashboard-actions { width: 100%; }
    .dashboard-actions .button:first-child { flex: 1; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { padding: 15px; }
    .stat-card:first-child { grid-column: 1 / -1; }
    .stat-value { font-size: 27px; }
    .results-grid, .location-grid { grid-template-columns: 1fr; gap: 10px; }
    .result-card { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
