:root {
    --bg: #edf5fb;
    --bg-soft: #f6fbff;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-strong: #ffffff;
    --surface-alt: #f3f8fd;
    --line: #d6e3ef;
    --line-strong: #bdd1e4;
    --text: #17324a;
    --muted: #5c6f82;
    --heading: #15324d;
    --accent: #6f96bc;
    --accent-strong: #2f638f;
    --accent-deep: #214a6f;
    --accent-soft: #dbe9f5;
    --success: #2f7a5d;
    --error: #a14e55;
    --support: #2f6f99;
    --undecided: #91a8bc;
    --oppose: #d2dde7;
    --shadow: 0 16px 40px rgba(26, 60, 95, 0.08);
    --shadow-soft: 0 8px 22px rgba(26, 60, 95, 0.06);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.background-blur {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.86), transparent 38%),
        linear-gradient(180deg, rgba(255,255,255,0.48), rgba(237,245,251,0.42)),
        url('justice-bg.jpg') center/cover no-repeat;
    opacity: 0.08;
    filter: grayscale(0.2) saturate(0.5);
    pointer-events: none;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 32px;
}

.page-public {
    display: grid;
    gap: 22px;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.88);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.masthead,
.content-card,
.form-card,
.stats-card,
.admin-card {
    padding: 32px;
}

.eyebrow,
.section-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent-strong);
}

h1,
h2,
h3 {
    font-family: 'Source Serif 4', serif;
    color: var(--heading);
    line-height: 1.12;
    margin: 0;
}

h1 {
    font-size: clamp(2.35rem, 5vw, 4rem);
    margin-top: 12px;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    margin-top: 8px;
}

h3 {
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    margin-top: 8px;
}

p {
    margin: 0;
    line-height: 1.72;
}

.lead,
.muted-copy,
.form-intro,
.option-subtitle,
.session-note,
.page-footer,
.stat-box p,
.direction-card p {
    color: var(--muted);
}

.masthead {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,249,253,0.96));
}

.masthead-inner,
.header-actions,
.top-nav,
.masthead-notes,
.section-head,
.split-head,
.form-actions,
.page-footer,
.admin-actions,
.inline-wrap,
.progress-row,
.sidebar-title-row {
    display: flex;
    gap: 16px;
}

.masthead-inner,
.split-head,
.progress-row,
.sidebar-title-row {
    align-items: flex-start;
    justify-content: space-between;
}

.header-actions,
.top-nav,
.masthead-notes,
.form-actions,
.page-footer,
.admin-actions,
.inline-wrap {
    flex-wrap: wrap;
}

.masthead-copy {
    max-width: 760px;
}

.lead {
    margin-top: 16px;
    font-size: 1.06rem;
}

.header-actions {
    margin-top: 22px;
}

.top-nav {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.top-nav a,
.masthead-notes span,
.meta-badge,
.notice-pill,
.status-badge,
.badge-neutral {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.86);
    text-decoration: none;
}

.top-nav a {
    color: var(--accent-deep);
    font-weight: 600;
}

.masthead-notes {
    margin-top: 18px;
}

.masthead-notes span,
.meta-badge {
    color: var(--muted);
    font-size: 0.95rem;
}

.section-head {
    margin-bottom: 18px;
    align-items: end;
}

.section-head > div,
.split-head > div {
    max-width: 700px;
}

.stats-grid,
.fields-grid,
.stance-grid,
.admin-stats-grid,
.two-up,
.info-list,
.directions-grid {
    display: grid;
    gap: 16px;
}

.primary-stats {
    grid-template-columns: 1.2fr 1fr 1fr;
}

.engagement-stats,
.admin-stats-grid.wide-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stance-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fields-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-list,
.directions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
}

.stat-box,
.stance-stat,
.direction-card,
.info-item,
.mini-stat,
.checkbox-card,
.already-submitted,
.safety-note,
.admin-warning,
.table-shell,
.callout-card,
.muted-card {
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 18px;
}

.stat-box,
.direction-card,
.info-item,
.callout-card,
.muted-card,
.checkbox-card,
.already-submitted,
.safety-note,
.admin-warning {
    padding: 20px;
}

.stat-box.prominent {
    background: linear-gradient(180deg, #fbfdff, #eff6fc);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.95rem;
}

.stat-box strong,
.mini-stat strong,
.stance-stat strong {
    display: block;
    margin-top: 6px;
    font-family: 'Source Serif 4', serif;
    color: var(--accent-deep);
}

.stat-box strong {
    font-size: clamp(2rem, 4vw, 2.8rem);
}

.progress-block {
    margin-top: 18px;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(248,251,255,0.95), rgba(240,247,253,0.95));
}

.progress-row {
    align-items: center;
    margin-bottom: 12px;
}

.progress-row span {
    color: var(--muted);
}

.progress-row strong {
    font-family: 'Source Serif 4', serif;
    font-size: 1.4rem;
    color: var(--accent-deep);
}

.progress-track {
    height: 14px;
    border-radius: 999px;
    background: #dfeaf4;
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    width: 0;
    transition: width 0.3s ease;
}

.stance-stat {
    display: grid;
    gap: 8px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.stance-stat > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stance-label {
    font-weight: 700;
}

.stance-stat small {
    color: var(--muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.support,
.badge-support {
    background: var(--support);
}

.legend-dot.undecided,
.badge-undecided {
    background: var(--undecided);
}

.legend-dot.oppose,
.badge-oppose {
    background: var(--oppose);
}

.feature-list {
    margin: 16px 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.feature-list li {
    margin-bottom: 10px;
}

.direction-card strong,
.info-item,
.option-title,
.field-label {
    color: var(--heading);
}

.direction-card,
.info-item {
    line-height: 1.66;
}

.muted-card {
    background: linear-gradient(180deg, rgba(248,251,255,0.95), rgba(243,248,253,0.95));
}

.callout-card {
    background: linear-gradient(180deg, #f7fbff, #edf5fb);
}

.interest-form {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-block {
    display: grid;
    gap: 12px;
}

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

.option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px 18px 54px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f7fbff);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.option-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.option-card input {
    position: absolute;
    opacity: 0;
}

.option-card::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 22px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: #fff;
}

.option-card:has(input:checked) {
    border-color: rgba(47, 99, 143, 0.36);
    box-shadow: 0 12px 26px rgba(47, 99, 143, 0.1);
}

.option-card:has(input:checked)::before {
    background: var(--accent-strong);
    box-shadow: inset 0 0 0 4px #fff;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.text-input {
    width: 100%;
    padding: 14px 15px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: rgba(47, 99, 143, 0.48);
    box-shadow: 0 0 0 4px rgba(111, 150, 188, 0.14);
}

.textarea-input {
    min-height: 130px;
    resize: vertical;
}

.check-row,
.consent-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.checkbox-card {
    display: grid;
    gap: 12px;
}

.alert {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 600;
}

.alert.success {
    background: rgba(47, 122, 93, 0.1);
    color: var(--success);
    border: 1px solid rgba(47, 122, 93, 0.18);
}

.alert.error {
    background: rgba(161, 78, 85, 0.1);
    color: var(--error);
    border: 1px solid rgba(161, 78, 85, 0.16);
}

.primary-button,
.secondary-button,
.danger-button,
.secondary-link {
    appearance: none;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.secondary-link:hover {
    transform: translateY(-1px);
}

.primary-button {
    color: #fff;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    box-shadow: 0 12px 24px rgba(47, 99, 143, 0.18);
}

.secondary-button,
.secondary-link {
    color: var(--accent-deep);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--line);
}

.danger-button {
    color: #fff;
    background: linear-gradient(180deg, #c46b72, #a14e55);
    box-shadow: 0 12px 24px rgba(161, 78, 85, 0.18);
}

.mini-stat {
    padding: 18px;
    text-align: left;
}

.mini-stat strong {
    font-size: 1.7rem;
}

.session-note {
    margin-top: 18px;
    font-size: 0.95rem;
}

.page-footer {
    justify-content: space-between;
    font-size: 0.96rem;
    padding: 0 4px;
}

.page-footer a {
    color: var(--accent-strong);
    font-weight: 700;
}

.admin-shell {
    min-height: 100vh;
}

.admin-card {
    width: 100%;
}

.admin-form {
    margin-top: 24px;
    display: grid;
    gap: 14px;
}

.admin-form.narrow {
    max-width: 420px;
}

.admin-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 22px;
    background: rgba(161, 78, 85, 0.08);
    border-color: rgba(161, 78, 85, 0.16);
}

.table-shell {
    margin-top: 22px;
    overflow: auto;
}

.submissions-table {
    width: 100%;
    min-width: 940px;
    border-collapse: collapse;
}

.submissions-table th,
.submissions-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 0.95rem;
}

.submissions-table th {
    position: sticky;
    top: 0;
    background: rgba(243,248,253,0.98);
    color: var(--accent-deep);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
}

.status-badge,
.badge-neutral {
    color: var(--text);
}

@media (max-width: 900px) {
    .primary-stats,
    .engagement-stats,
    .stance-stats,
    .two-up,
    .info-list,
    .directions-grid,
    .admin-stats-grid.wide-grid {
        grid-template-columns: 1fr 1fr;
    }

    .masthead-inner,
    .split-head,
    .section-head,
    .progress-row,
    .sidebar-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100%, calc(100% - 18px));
        padding-top: 16px;
        padding-bottom: 20px;
    }

    .masthead,
    .content-card,
    .form-card,
    .stats-card,
    .admin-card {
        padding: 22px;
    }

    .primary-stats,
    .engagement-stats,
    .stance-stats,
    .fields-grid.cols-2,
    .two-up,
    .info-list,
    .directions-grid,
    .admin-stats-grid.wide-grid {
        grid-template-columns: 1fr;
    }

    .page-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}


/* Charts and aggregate dashboard */
.summary-strip {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.summary-metric {
    flex: 1 1 240px;
    padding: 20px 22px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.summary-metric span {
    display: block;
    color: var(--muted);
    font-size: 0.95rem;
}

.summary-metric strong {
    display: block;
    margin-top: 10px;
    font-family: 'Source Serif 4', serif;
    font-size: clamp(1.9rem, 2.8vw, 2.6rem);
    color: var(--accent-deep);
}

.summary-metric.accent {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    border-color: transparent;
}

.summary-metric.accent span,
.summary-metric.accent strong {
    color: #fff;
}

.chart-card {
    margin-top: 22px;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.chart-copy {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.chart-copy h3 {
    margin-top: 0;
}

.chart-shell,
.admin-chart-grid {
    display: grid;
    gap: 22px;
    align-items: center;
    margin-top: 20px;
}

.chart-shell {
    grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

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

.pie-canvas {
    min-height: 290px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff, #eef5fd);
    border: 1px solid var(--line);
    overflow: hidden;
}

.pie-canvas.small {
    min-height: 240px;
}

.pie-svg {
    width: 100%;
    height: auto;
    display: block;
}

.pie-total-label {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 16px;
    fill: #6a7f95;
}

.pie-total-value {
    font-family: 'Source Serif 4', serif;
    font-size: 44px;
    fill: #13283d;
}

.chart-legend {
    display: grid;
    gap: 12px;
}

.legend-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfdff;
}

.legend-main {
    display: flex;
    gap: 12px;
}

.legend-main strong {
    display: block;
    color: var(--heading);
}

.legend-main small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.55;
}

.legend-values {
    text-align: right;
    white-space: nowrap;
}

.legend-values strong {
    display: block;
    font-size: 1.2rem;
    color: var(--heading);
}

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

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-top: 5px;
    flex: 0 0 14px;
}

.legend-swatch.support {
    background: #4f7cff;
}

.legend-swatch.undecided {
    background: #f2a93b;
}

.legend-swatch.oppose {
    background: #e16259;
}

.legend-swatch.engagement-updates {
    background: #3f8f8c;
}

.legend-swatch.engagement-active {
    background: #6f63ff;
}

.legend-swatch.engagement-founder {
    background: #2f6fb4;
}

.note-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.86);
    color: var(--muted);
    white-space: nowrap;
}

.empty-chart {
    width: calc(100% - 24px);
    margin: 12px;
    text-align: center;
    color: var(--muted);
    background: rgba(255,255,255,0.82);
}

@media (max-width: 900px) {
    .chart-shell,
    .admin-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .chart-copy,
    .legend-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend-values {
        text-align: left;
    }
}
