:root {
    --bg: #f5f1e6;
    --ink: #1f2937;
    --muted: #5f6b7a;
    --paper: rgba(255, 252, 244, 0.92);
    --paper-strong: #fffaf0;
    --line: rgba(31, 41, 55, 0.1);
    --accent: #b85c38;
    --accent-deep: #8b3f24;
    --accent-soft: rgba(184, 92, 56, 0.12);
    --green: #1f7a4d;
    --amber: #b2761f;
    --shadow: 0 24px 60px rgba(31, 41, 55, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Aptos", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(184, 92, 56, 0.18), transparent 30%),
        radial-gradient(circle at bottom left, rgba(26, 85, 84, 0.12), transparent 25%),
        linear-gradient(180deg, #f8f4ea 0%, #f1ebdd 100%);
}

.page-halo {
    position: fixed;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.page-halo-a {
    top: 2rem;
    right: 6rem;
    width: 16rem;
    height: 16rem;
    background: rgba(184, 92, 56, 0.24);
}

.page-halo-b {
    bottom: 4rem;
    left: 5rem;
    width: 20rem;
    height: 20rem;
    background: rgba(34, 94, 98, 0.14);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.topbar,
.shell {
    position: relative;
    z-index: 1;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem clamp(1rem, 2vw, 2rem);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    min-width: 3.5rem;
    min-height: 3.5rem;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), #d98a5f);
    color: white;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.brand-copy {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.shell {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    gap: 1.25rem;
    padding: 0 clamp(1rem, 2vw, 2rem) 2rem;
}

.public-mode .shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1120px;
    margin: 0 auto;
}

.sidebar,
.content > * {
    animation: slide-up 0.45s ease both;
}

.sidebar {
    align-self: start;
    position: sticky;
    top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 250, 240, 0.76);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.sidebar-block {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

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

.sidebar-user {
    margin-top: 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
    margin-top: 1rem;
}

.sidebar-link {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    color: var(--muted);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: white;
    color: var(--ink);
    transform: translateX(4px);
}

.content {
    display: grid;
    gap: 1.25rem;
}

.hero-card,
.panel-card,
.form-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--paper);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.hero-card,
.panel-card,
.form-shell,
.sidebar {
    overflow: hidden;
}

.hero-card {
    padding: clamp(1.4rem, 3vw, 2.5rem);
}

.hero-card h1,
.section-heading h1,
.form-intro h1 {
    margin: 0.2rem 0 0.7rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.04;
}

.lead,
.form-intro p {
    max-width: 56rem;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.65;
}

.hero-stats,
.metric-grid,
.panel-grid,
.leader-grid,
.detail-grid {
    display: grid;
    gap: 1rem;
}

.hero-stats,
.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    margin-top: 1.5rem;
}

.panel-grid {
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.panel-grid-tight {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.leader-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.metric-card,
.leader-card,
.detail-box {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(31, 41, 55, 0.06);
}

.metric-label,
.leader-stats,
.muted,
.field-hint,
.lead-inline {
    color: var(--muted);
}

.metric-card strong,
.detail-box strong {
    display: block;
    margin-top: 0.3rem;
    font-size: clamp(1.55rem, 2vw, 2rem);
}

.leader-rank {
    display: inline-block;
    margin-bottom: 0.8rem;
    color: var(--accent);
    font-weight: 800;
}

.leader-card h3 {
    margin: 0;
    font-size: 1.3rem;
}

.leader-card p {
    margin: 0.35rem 0 1rem;
    color: var(--muted);
}

.leader-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.panel-card,
.form-shell {
    padding: 1.35rem;
}

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

.panel-header h2,
.panel-card h2,
.form-intro h1 {
    margin-top: 0;
}

.form-shell {
    max-width: 58rem;
}

.public-mode .form-shell {
    margin-inline: auto;
}

.vote-shell {
    max-width: 52rem;
}

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

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field span {
    font-weight: 700;
}

.field input,
.field textarea,
.field select,
.inline-form input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(31, 41, 55, 0.12);
    border-radius: 14px;
    background: white;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.inline-form input:focus {
    border-color: rgba(184, 92, 56, 0.55);
    box-shadow: 0 0 0 4px rgba(184, 92, 56, 0.12);
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted);
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 1.15rem;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: white;
    box-shadow: 0 14px 28px rgba(184, 92, 56, 0.28);
}

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

.ghost-button {
    background: white;
    border-color: var(--line);
}

.small-button {
    padding: 0.55rem 0.8rem;
    font-size: 0.88rem;
}

.status-chip,
.vote-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--line);
    font-size: 0.88rem;
}

.status-chip-soft {
    background: rgba(255, 255, 255, 0.84);
}

.status-green {
    color: var(--green);
    background: rgba(31, 122, 77, 0.12);
}

.status-amber {
    color: var(--amber);
    background: rgba(178, 118, 31, 0.12);
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
}

.flash {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
}

.flash-success {
    border-color: rgba(31, 122, 77, 0.2);
}

.flash-error {
    border-color: rgba(184, 92, 56, 0.25);
}

.accordion-list {
    display: grid;
    gap: 0.85rem;
}

.accordion-item {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
}

.accordion-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    cursor: pointer;
}

.accordion-item summary::-webkit-details-marker {
    display: none;
}

.accordion-item summary span {
    color: var(--muted);
}

.accordion-body {
    padding: 0 1.1rem 1.1rem;
}

.detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

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

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

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

.inline-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-form input {
    flex: 1 1 18rem;
}

.event-list {
    display: grid;
    gap: 0.8rem;
}

.event-row {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(31, 41, 55, 0.06);
}

.event-row time {
    color: var(--muted);
    font-size: 0.9rem;
}

.candidate-picks {
    display: grid;
    gap: 0.85rem;
}

.vote-option {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
}

.vote-option input {
    width: 1.2rem;
    height: 1.2rem;
}

.vote-option strong {
    display: block;
    margin-bottom: 0.2rem;
}

.vote-option small {
    color: var(--muted);
}

.flat-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    line-height: 1.65;
}

code {
    padding: 0.15rem 0.35rem;
    border-radius: 8px;
    background: rgba(31, 41, 55, 0.06);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 640px) {
    .topbar,
    .shell {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .panel-grid,
    .field-grid,
    .leader-grid,
    .hero-stats,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .panel-header,
    .topbar {
        flex-direction: column;
        align-items: start;
    }
}
