:root {
    --bg: #f4efe6;
    --panel: #fffdf8;
    --panel-strong: #fff7e8;
    --ink: #1e1d1a;
    --muted: #665f53;
    --line: #ddd1bd;
    --accent: #bf5a2a;
    --accent-dark: #8f3f1d;
    --success-bg: #ebf8ef;
    --success-text: #21663d;
    --error-bg: #fdecec;
    --error-text: #8a2f2f;
    --shadow: 0 18px 50px rgba(69, 44, 20, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(191, 90, 42, 0.16), transparent 28%),
        linear-gradient(180deg, #f8f1e7 0%, var(--bg) 50%, #efe8dc 100%);
    min-height: 100vh;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr 0.9fr;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

h1,
h2,
h3 {
    margin: 0 0 0.75rem;
    font-weight: 700;
}

h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.95;
    max-width: 10ch;
}

h2 {
    font-size: 1.3rem;
}

h3 {
    font-size: 1.1rem;
}

.subhead,
.help-text,
label,
td,
th,
input,
textarea,
button,
select {
    font-family: "Trebuchet MS", Arial, sans-serif;
}

.subhead,
.help-text {
    color: var(--muted);
    line-height: 1.5;
}

.hero-card,
.flyer-card,
.card,
.flash {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(221, 209, 189, 0.9);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
    background:
        linear-gradient(140deg, rgba(255, 247, 232, 0.98), rgba(255, 253, 248, 0.9)),
        var(--panel);
}

.flyer-card {
    padding: 0.85rem;
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 320px;
    overflow: hidden;
}

.flyer-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.flyer-placeholder {
    width: 100%;
    min-height: 100%;
    border: 1px dashed var(--line);
    border-radius: 16px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 247, 232, 0.45);
    color: var(--muted);
}

.flyer-placeholder span {
    display: block;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-weight: 700;
    color: var(--accent-dark);
    margin-bottom: 0.5rem;
}

.flyer-placeholder p {
    margin: 0;
    font-family: "Trebuchet MS", Arial, sans-serif;
    line-height: 1.5;
}

.metric {
    padding: 0.95rem 1rem;
    background: var(--panel);
    border-radius: 16px;
    border: 1px solid var(--line);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.metric strong {
    font-size: 1.4rem;
}

.flash {
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
}

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

.grid-top {
    align-items: start;
}

.card {
    padding: 1.25rem;
}

form {
    display: grid;
    gap: 0.8rem;
}

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

input,
textarea,
button,
.button,
select {
    width: 100%;
    border-radius: 12px;
}

input,
textarea,
select {
    border: 1px solid var(--line);
    padding: 0.8rem 0.9rem;
    font-size: 1rem;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

button,
.button {
    border: 0;
    background: var(--accent);
    color: #fff8f1;
    padding: 0.85rem 1rem;
    font-size: 0.98rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-secondary {
    background: transparent;
    color: var(--accent-dark);
    border: 1px solid rgba(143, 63, 29, 0.3);
}

.button-row {
    display: flex;
    gap: 0.75rem;
}

.export-form {
    margin-top: 1rem;
}

.show-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.show-summary p {
    margin: 0 0 0.75rem;
    font-family: "Trebuchet MS", Arial, sans-serif;
    color: var(--muted);
    line-height: 1.5;
}

.ledger {
    padding: 1.4rem;
}

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

.ledger-grid {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.ledger-form {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 247, 232, 0.55);
}

.payment-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.payment-summary span {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    background: var(--panel-strong);
    border-radius: 999px;
    border: 1px solid var(--line);
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 0.9rem;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Trebuchet MS", Arial, sans-serif;
}

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

th {
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

tfoot th {
    color: var(--ink);
}

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

.button-link {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 700;
    background: none;
    border: 0;
    padding: 0;
    width: auto;
}

.button-link.danger {
    color: #8a2f2f;
}

.empty-state {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 960px) {
    .hero,
    .grid,
    .ledger-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        max-width: none;
    }
}

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

    .card,
    .hero-card,
    .flyer-card,
    .ledger,
    .ledger-form {
        border-radius: 18px;
    }

    .button-row,
    .ledger-header {
        flex-direction: column;
    }

    th,
    td {
        min-width: 120px;
    }
}
