:root {
    --paper: #fbfaf7;
    --ink: #26302d;
    --muted: #5e6a64;
    --line: #d9d5cb;
    --field: #fffefb;
    --sage: #687d70;
    --sage-dark: #3f574a;
    --cardinal: #9f332f;
    --error: #8c1d18;
    --error-bg: #fff1ef;
    --focus: #204f8a;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 18px;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.55;
}

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

a {
    color: var(--sage-dark);
}

.page-shell {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 42px 20px 56px;
}

.memorial-header {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 34px;
    align-items: center;
    padding: 18px 0 38px;
    border-bottom: 1px solid var(--line);
}

.memorial-photo {
    margin: 0;
    aspect-ratio: 4 / 5;
    border: 1px solid var(--line);
    background: var(--field);
    overflow: hidden;
}

.memorial-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.small-label {
    margin: 0 0 10px;
    color: var(--sage-dark);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-weight: 400;
    line-height: 1.12;
}

h1 {
    font-size: clamp(2.25rem, 8vw, 4.35rem);
}

h2 {
    font-size: 2.15rem;
}

.dates {
    margin: 16px 0 22px;
    color: var(--muted);
    font-size: 1.18rem;
}

.cardinal-mark {
    width: 74px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cardinal), rgba(159, 51, 47, 0.08));
}

.form-section {
    padding-top: 38px;
}

.welcome {
    max-width: 680px;
    margin: 14px 0 30px;
    color: var(--muted);
    font-size: 1.08rem;
}

.guest-form,
.admin-form {
    display: grid;
    gap: 22px;
}

.field {
    display: grid;
    gap: 8px;
}

label {
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
}

.required {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--ink);
    padding: 13px 14px;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.split-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.privacy-note {
    margin: -4px 0 0;
    padding: 14px 16px;
    border-left: 4px solid var(--sage);
    background: rgba(104, 125, 112, 0.1);
    color: #334039;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.95rem;
}

.primary-button,
.secondary-button,
.danger-button,
.quiet-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    border: 0;
    border-radius: 6px;
    padding: 13px 22px;
    color: #fff;
    background: var(--sage-dark);
    cursor: pointer;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 700;
    text-decoration: none;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.primary-button:hover,
.secondary-button:hover {
    background: #2f463b;
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.secondary-button {
    background: var(--sage);
}

.danger-button {
    background: #8c1d18;
}

.quiet-button {
    border: 1px solid var(--line);
    color: var(--sage-dark);
    background: transparent;
}

.quiet-button:hover {
    background: rgba(104, 125, 112, 0.1);
}

.link-button {
    margin-top: 22px;
}

.notice,
.field-error {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.notice {
    margin: 0 0 22px;
    padding: 14px 16px;
    border-radius: 6px;
}

.error,
.field-error {
    color: var(--error);
}

.error {
    border: 1px solid rgba(140, 29, 24, 0.28);
    background: var(--error-bg);
}

.field-error {
    margin: 0;
    font-size: 0.92rem;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.thank-you-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.thank-you-panel {
    width: min(100%, 680px);
    text-align: center;
}

.thank-you-panel p:not(.small-label) {
    color: var(--muted);
    font-size: 1.15rem;
}

.admin-page {
    background: #f7f7f4;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 28px 18px 54px;
}

.admin-topbar {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.admin-topbar h1,
.admin-login h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-login {
    width: min(100%, 460px);
    margin: 10vh auto 0;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.entry-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    background: #fff;
}

.entry-table {
    width: 100%;
    min-width: 1060px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.entry-table th,
.entry-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.entry-table th {
    background: #ecefe9;
    color: #202722;
    font-weight: 700;
}

.message-cell,
.address-cell,
.agent-cell {
    max-width: 280px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.empty-state {
    padding: 38px 16px;
    color: var(--muted);
    text-align: center;
}

.inline-form {
    display: inline;
}

@media (max-width: 760px) {
    html {
        font-size: 17px;
    }

    .page-shell {
        padding: 26px 16px 42px;
    }

    .memorial-header {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .memorial-photo {
        width: min(220px, 70vw);
    }

    .split-fields {
        grid-template-columns: 1fr;
    }

    .primary-button,
    .secondary-button,
    .danger-button,
    .quiet-button {
        width: 100%;
    }

    .admin-topbar {
        align-items: stretch;
        flex-direction: column;
    }
}
