:root {
    --ink: #2d2a26;
    --muted: #706a62;
    --paper: #fffaf5;
    --panel: #ffffff;
    --rose: #b76573;
    --rose-dark: #7f3545;
    --sage: #6e806d;
    --gold: #b8893b;
    --line: #eadfd4;
    --danger: #a23c35;
    --shadow: 0 24px 70px rgba(82, 63, 49, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Instrument Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--paper);
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

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

.page {
    min-height: 100vh;
    background:
        linear-gradient(140deg, rgba(183, 101, 115, 0.12), transparent 36%),
        linear-gradient(320deg, rgba(110, 128, 109, 0.16), transparent 42%),
        var(--paper);
}

.guest-shell,
.auth-shell {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 28px 18px 44px;
}

.guest-hero {
    padding: 32px 4px 26px;
    text-align: center;
}

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

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2.6rem, 12vw, 5.4rem);
    line-height: 0.96;
}

.admin-topbar h1,
.tv-side h2,
.panel-heading h2,
.photo-section h2,
.auth-panel h1,
.thank-you-panel h1 {
    font-family: "Playfair Display", Georgia, serif;
}

.event-date {
    margin-top: 16px;
    color: var(--gold);
    font-weight: 700;
}

.hero-copy {
    max-width: 560px;
    margin: 18px auto 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.upload-panel,
.auth-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-heading h2,
.photo-section h2,
.auth-panel h1,
.thank-you-panel h1 {
    font-size: 2rem;
    line-height: 1.1;
}

.panel-heading p,
.section-heading p,
.empty-state p {
    color: var(--muted);
}

.upload-form {
    display: grid;
    gap: 18px;
}

.file-drop-meta,
.selected-files,
.field em {
    color: var(--muted);
    font-size: 0.92rem;
}

.selected-files {
    margin-top: -8px;
}

.filepond-wrap {
    display: grid;
    gap: 8px;
}

.filepond--root {
    margin-bottom: 0;
    font-family: inherit;
}

.filepond--panel-root {
    border: 1.5px dashed rgba(127, 53, 69, 0.42);
    border-radius: 8px;
    background: #fff6f3;
}

.filepond--drop-label {
    min-height: 168px;
    color: var(--ink);
}

.filepond--drop-label label {
    font-weight: 800;
}

.filepond--label-action {
    color: var(--rose-dark);
    text-decoration-color: rgba(127, 53, 69, 0.42);
}

.filepond--item-panel {
    border-radius: 8px;
    background-color: var(--rose-dark);
}

.filepond--file-action-button {
    cursor: pointer;
}

.filepond--file-status,
.filepond--file-info {
    font-size: 0.86rem;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 700;
}

.field span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 13px 14px;
    outline: 0;
}

.field textarea {
    min-height: 104px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    border-color: rgba(183, 101, 115, 0.65);
    box-shadow: 0 0 0 4px rgba(183, 101, 115, 0.12);
}

.consent {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

.consent input {
    width: 20px;
    height: 20px;
    accent-color: var(--rose-dark);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.primary-button {
    color: #fff;
    background: var(--rose-dark);
}

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

.secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: #fff;
}

.secondary-button.compact {
    min-height: 36px;
    padding-inline: 12px;
}

.ghost-button {
    color: var(--muted);
    background: transparent;
}

.danger-button {
    min-height: 36px;
    color: #fff;
    background: var(--danger);
}

.secondary-link {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    color: var(--rose-dark);
    font-weight: 800;
    text-decoration: none;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 24px;
}

.alert {
    margin-bottom: 18px;
    border: 1px solid rgba(110, 128, 109, 0.24);
    border-radius: 8px;
    background: rgba(110, 128, 109, 0.12);
    padding: 13px 14px;
    color: var(--ink);
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.alert-error {
    border-color: rgba(162, 60, 53, 0.24);
    background: rgba(162, 60, 53, 0.10);
}

.async-status {
    min-height: 1.3em;
    color: var(--sage);
    font-size: 0.95rem;
    font-weight: 700;
}

.async-status.is-error {
    color: var(--danger);
}

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

.thank-you-panel,
.auth-panel {
    text-align: center;
}

.pin-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
    text-align: left;
}

.setup-command {
    display: inline-block;
    margin-top: 18px;
    border-radius: 8px;
    background: #302f2b;
    color: #fff;
    padding: 10px 12px;
}

.admin-page {
    background: #fbf7f1;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 245, 0.94);
    padding: 16px max(18px, calc((100vw - 1180px) / 2));
    backdrop-filter: blur(12px);
}

.admin-topbar h1 {
    font-size: 2rem;
    line-height: 1;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.admin-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 42px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.stats-grid article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.stats-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
}

.stats-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 1.55rem;
}

.photo-section {
    margin-top: 26px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.photo-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #efe6dc;
}

.photo-card.is-removed img {
    filter: grayscale(1);
    opacity: 0.58;
}

.photo-card-body {
    display: grid;
    gap: 12px;
    padding: 13px;
}

.photo-card-body p {
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.45;
}

.photo-meta,
.photo-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.photo-meta span {
    color: var(--muted);
    font-size: 0.86rem;
}

.status-pill {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-pill.active {
    color: #2f5a3c;
    background: rgba(110, 128, 109, 0.16);
}

.status-pill.removed {
    color: var(--danger);
    background: rgba(162, 60, 53, 0.12);
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    padding: 26px;
}

.pagination-wrap {
    margin-top: 20px;
}

.pagination-wrap nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-wrap a,
.pagination-wrap span {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 8px 11px;
    text-decoration: none;
}

.tv-page {
    overflow: hidden;
    background: #11100f;
    color: #fff;
}

.tv-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    width: 100vw;
    height: 100vh;
}

.tv-stage {
    position: relative;
    display: grid;
    overflow: hidden;
    place-items: center;
    background: #060606;
}

.tv-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    transition: opacity 400ms ease;
}

.tv-stage img.is-changing {
    opacity: 0;
}

.tv-empty {
    max-width: 620px;
    padding: 40px;
    text-align: center;
}

.tv-empty h1 {
    font-size: clamp(3rem, 8vw, 7rem);
}

.tv-empty p {
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 1.2rem;
}

.tv-caption {
    position: absolute;
    left: 32px;
    right: 232px;
    bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.54);
    padding: 14px 18px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.tv-caption span {
    color: rgba(255, 255, 255, 0.82);
}

.tv-side {
    display: grid;
    align-content: center;
    gap: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    background: #201b18;
    padding: 32px;
}

.tv-side h2 {
    font-size: 2.4rem;
    line-height: 1;
}

.tv-side p:last-child {
    overflow-wrap: anywhere;
    color: rgba(255, 255, 255, 0.74);
    line-height: 1.5;
}

.tv-qr-card {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 5;
    width: 172px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    padding: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.tv-qr-card p {
    margin-bottom: 8px;
    color: var(--rose-dark);
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
}

.tv-qr-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

@media (max-width: 860px) {
    .panel-heading,
    .section-heading,
    .admin-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions {
        justify-content: flex-start;
    }

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

    .tv-shell {
        grid-template-columns: 1fr;
    }

    .tv-side {
        display: none;
    }

    .tv-caption {
        right: 224px;
    }
}

@media (min-width: 680px) {
    .form-grid {
        grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
    }
}

@media (max-width: 520px) {
    .guest-shell,
    .auth-shell {
        padding-inline: 14px;
    }

    .upload-panel,
    .auth-panel {
        padding: 18px;
    }

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

    .admin-actions form {
        width: 100%;
    }

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

    .tv-caption {
        left: 16px;
        right: 16px;
        bottom: 196px;
    }

    .tv-qr-card {
        right: 16px;
        bottom: 16px;
        width: 152px;
    }
}
