:root {
    --bg: #f5efe4;
    --bg-accent: #ead8b6;
    --surface: rgba(255, 252, 246, 0.88);
    --surface-strong: #fffdf8;
    --text: #1f1b16;
    --muted: #665f56;
    --line: rgba(88, 66, 38, 0.16);
    --primary: #9f321d;
    --primary-dark: #7a2414;
    --secondary: #194b45;
    --danger: #b13c2f;
    --shadow: 0 22px 60px rgba(64, 41, 16, 0.16);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 241, 210, 0.92), transparent 34%),
        radial-gradient(circle at bottom right, rgba(174, 213, 204, 0.42), transparent 32%),
        linear-gradient(160deg, #f9f2e8 0%, #efe5d1 52%, #f6f0e9 100%);
}

a {
    color: inherit;
}

code {
    font-family: "SFMono-Regular", "Consolas", monospace;
    font-size: 0.95em;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.surface {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero,
.sub-hero,
.petition-panel,
.form-panel,
.auth-card,
.stat-card,
.admin-grid > .surface,
.table-wrap,
.surface {
    animation: rise-in 0.55s ease both;
}

.hero,
.sub-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 24px;
    padding: 36px;
}

.hero-copy h1,
.sub-hero h1,
.petition-panel h2,
.form-panel h2,
.auth-card h2,
.surface h2 {
    margin: 0;
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    line-height: 1.04;
    letter-spacing: -0.03em;
}

.hero-copy h1,
.sub-hero h1 {
    font-size: clamp(2.4rem, 4.8vw, 4.5rem);
    max-width: 13ch;
}

.lead {
    margin: 14px 0 0;
    max-width: 58ch;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.hero-actions,
.button-row,
.stacked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    font-size: 0.96rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    color: #fff7f0;
    background: linear-gradient(135deg, #b13d22 0%, #8b2918 100%);
    box-shadow: 0 10px 22px rgba(159, 50, 29, 0.24);
}

.btn-secondary {
    color: #f5fcfa;
    background: linear-gradient(135deg, #1b5c56 0%, #123e3a 100%);
    box-shadow: 0 10px 22px rgba(25, 75, 69, 0.2);
}

.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(25, 75, 69, 0.18);
}

.btn-danger {
    color: #fff4f2;
    background: linear-gradient(135deg, #c54a3d 0%, #9b2e24 100%);
    box-shadow: 0 10px 22px rgba(177, 60, 47, 0.24);
}

.hero-card,
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    background: linear-gradient(165deg, rgba(255, 248, 236, 0.96), rgba(247, 236, 214, 0.72));
    border-radius: calc(var(--radius-lg) - 6px);
    border: 1px solid rgba(159, 50, 29, 0.12);
}

.stat-value,
.stat-big {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: clamp(2.6rem, 5vw, 4rem);
    line-height: 1;
}

.stat-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.74rem;
    font-weight: 700;
}

.stat-small {
    font-size: clamp(1.2rem, 2.3vw, 1.55rem);
    line-height: 1.2;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 24px;
    margin-top: 24px;
}

.petition-panel,
.form-panel,
.auth-card,
.admin-grid > .surface,
.surface {
    padding: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.pdf-frame {
    border-radius: 22px;
    overflow: hidden;
    min-height: 680px;
    border: 1px solid rgba(25, 75, 69, 0.16);
    background: linear-gradient(180deg, rgba(245, 239, 228, 0.92), rgba(255, 255, 255, 0.88));
}

.pdf-frame iframe {
    width: 100%;
    min-height: 680px;
    border: 0;
    background: #ffffff;
}

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

label {
    font-size: 0.92rem;
    font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(88, 66, 38, 0.18);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

.signature-pad-wrap {
    position: relative;
    border-radius: 22px;
    border: 1px solid rgba(88, 66, 38, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 244, 235, 0.96)),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 31px,
            rgba(25, 75, 69, 0.08) 31px,
            rgba(25, 75, 69, 0.08) 32px
        );
    overflow: hidden;
}

.signature-pad-wrap.is-disabled {
    opacity: 0.55;
}

.signature-pad {
    display: block;
    width: 100%;
    min-height: 220px;
    touch-action: none;
    cursor: crosshair;
}

.signature-pad-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

input:focus,
textarea:focus {
    outline: 2px solid rgba(25, 75, 69, 0.26);
    outline-offset: 1px;
}

.form-note,
.muted,
.warning-note {
    color: var(--muted);
    line-height: 1.6;
}

.form-note,
.warning-note {
    margin: 18px 0 0;
}

.warning-note {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 236, 213, 0.82);
    border: 1px solid rgba(159, 50, 29, 0.16);
}

.recent-block {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(88, 66, 38, 0.12);
}

.recent-block h3 {
    margin: 0 0 14px;
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 1.22rem;
}

.signature-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.signature-list li {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(88, 66, 38, 0.1);
}

.signature-list span {
    color: var(--muted);
    white-space: nowrap;
}

.flash {
    margin-top: 18px;
    padding: 15px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.flash-success {
    background: rgba(211, 237, 226, 0.92);
    border: 1px solid rgba(25, 75, 69, 0.16);
}

.flash-error {
    background: rgba(255, 231, 225, 0.94);
    border: 1px solid rgba(177, 60, 47, 0.2);
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 14px;
    min-height: 280px;
    text-align: center;
    padding: 24px;
    border-radius: 24px;
    border: 1px dashed rgba(88, 66, 38, 0.18);
    background: rgba(255, 255, 255, 0.48);
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding: 0 6px;
    color: var(--muted);
}

.footer a {
    text-decoration: none;
    font-weight: 700;
}

.narrow-card {
    width: min(520px, 100%);
    margin: 28px auto 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

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

.top-gap {
    margin-top: 18px;
}

.table-wrap {
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(88, 66, 38, 0.12);
}

.signature-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.72);
}

.signature-table th,
.signature-table td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(88, 66, 38, 0.1);
}

.signature-table th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.signature-table tbody tr:last-child td {
    border-bottom: 0;
}

.signature-preview {
    display: block;
    max-width: 190px;
    max-height: 70px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(88, 66, 38, 0.12);
    padding: 6px;
}

.comment-cell {
    min-width: 220px;
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.signature-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(88, 66, 38, 0.1);
}

.signature-summary strong {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 2.1rem;
    line-height: 1;
}

.signature-summary span {
    color: var(--muted);
    font-weight: 600;
}

@media (max-width: 980px) {
    .hero,
    .sub-hero,
    .content-grid,
    .admin-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .pdf-frame,
    .pdf-frame iframe {
        min-height: 480px;
    }
}

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

    .hero,
    .sub-hero,
    .petition-panel,
    .form-panel,
    .auth-card,
    .admin-grid > .surface,
    .surface {
        padding: 22px;
    }

    .section-header,
    .footer,
    .signature-list li,
    .signature-summary,
    .signature-pad-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .signature-list span {
        white-space: normal;
    }
}
