:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --paper: #ffffff;
    --wash: #f4f7f9;
    --navy: #19324a;
    --teal: #1f7a7a;
    --gold: #d79b35;
    --rose: #a13e63;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 18px 42px rgba(25, 50, 74, .10);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

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

a {
    color: inherit;
}

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

.shell {
    min-height: 100vh;
}

.main-surface {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 56px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 22px;
    align-items: center;
    min-height: 68px;
    padding: 0 max(18px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(25, 50, 74, .12);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
}

.brand,
.main-nav {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    color: var(--navy);
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-size: .78rem;
    letter-spacing: 0;
}

.main-nav {
    gap: 6px;
}

.main-nav a {
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}

.main-nav a.active {
    background: #e9f3f1;
    color: var(--teal);
}

.home-band,
.auth-layout,
.guest-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
    gap: 44px;
    align-items: center;
    min-height: calc(100vh - 160px);
    padding: 28px 0 42px;
}

.home-copy,
.auth-layout > div:first-child {
    max-width: 680px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--teal);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

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

h1 {
    max-width: 820px;
    margin-bottom: 18px;
    color: var(--navy);
    font-size: clamp(2.35rem, 6vw, 5.4rem);
    line-height: .96;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 14px;
    color: var(--navy);
    font-size: 1.35rem;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 8px;
    color: var(--navy);
    font-size: 1.05rem;
}

.lede {
    max-width: 650px;
    color: #465362;
    font-size: 1.08rem;
    line-height: 1.65;
}

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

.actions.vertical {
    display: grid;
}

.button {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

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

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

.button.secondary {
    border-color: var(--line);
    background: #fff;
    color: var(--navy);
}

.button.ghost {
    border-color: transparent;
    background: #eef4f5;
    color: var(--navy);
}

.button.compact {
    min-height: 36px;
    padding: 7px 12px;
    font-size: .92rem;
}

.button.full {
    width: 100%;
}

.button:disabled {
    cursor: progress;
    opacity: .65;
    transform: none;
}

.button.is-loading::before,
.loading-inline::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.loading-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-weight: 800;
}

.phone-preview {
    justify-self: center;
    width: min(360px, 100%);
    min-height: 620px;
    padding: 18px;
    border: 1px solid rgba(25, 50, 74, .18);
    border-radius: 28px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.preview-top {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px 18px;
}

.preview-top span,
.preview-title,
.preview-upload,
.preview-grid span {
    display: block;
    border-radius: 8px;
    background: #e7eef2;
}

.preview-top span:first-child {
    width: 82px;
    height: 12px;
}

.preview-top span:last-child {
    width: 42px;
    height: 12px;
    background: var(--gold);
}

.preview-title {
    height: 98px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--navy), var(--teal));
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preview-grid span {
    aspect-ratio: 1;
}

.preview-grid span:nth-child(2),
.preview-grid span:nth-child(5) {
    background: #ead7dd;
}

.preview-grid span:nth-child(3),
.preview-grid span:nth-child(6) {
    background: #f1ddaf;
}

.preview-upload {
    height: 88px;
    margin-top: 14px;
    border: 1px dashed var(--teal);
    background: #edf8f6;
}

.feature-band {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 22px 0;
}

.feature-band > div,
.panel,
.auth-panel,
.event-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 10px 28px rgba(25, 50, 74, .06);
}

.feature-band > div {
    padding: 22px;
}

.feature-band p:last-child,
.panel p:last-child,
.event-card p:last-child {
    margin-bottom: 0;
}

.auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
}

.auth-panel,
.panel {
    padding: 24px;
}

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

label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-size: .93rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(31, 122, 122, .14);
}

.check-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.form-row,
.color-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-row.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.color-row {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
}

.moment-list {
    display: grid;
    gap: 10px;
}

.moment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #b7d8d4;
    border-radius: 8px;
    background: #edf8f6;
    color: #145c5c;
    font-weight: 700;
}

.notice.danger {
    border-color: #f3b4aa;
    background: #fff2f0;
    color: var(--danger);
}

.page-heading,
.section-title-row {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-heading h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 5vw, 4rem);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.event-list {
    display: grid;
    gap: 14px;
}

.event-card {
    display: grid;
    gap: 24px;
    padding: 20px;
    border-top: 5px solid var(--event-accent);
}

.event-card h2 {
    margin-bottom: 6px;
}

.event-card-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.status-pill {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #fff7e6;
    color: #946200;
    font-size: .82rem;
    font-weight: 800;
}

.status-pill.ready {
    background: #ecfdf3;
    color: var(--success);
}

.event-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 20px;
    align-items: start;
}

.side-panel {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 16px;
}

.qr-frame {
    display: grid;
    place-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.qr-frame img {
    width: min(100%, 280px);
    aspect-ratio: 1;
}

.drive-box {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.recent-panel {
    margin-top: 20px;
}

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

.guest-hero {
    grid-template-columns: minmax(0, 760px);
    min-height: 42vh;
    padding: 46px 0 30px;
}

.guest-hero h1 {
    color: var(--event-primary);
}

.host-line {
    color: var(--event-primary);
    font-weight: 800;
}

.guest-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding-bottom: 60px;
}

.upload-panel {
    border-top: 5px solid var(--event-accent);
}

.file-drop {
    min-height: 112px;
    place-items: center;
    padding: 18px;
    border: 1px dashed var(--event-primary);
    border-radius: 8px;
    background: #f7fbfb;
    cursor: pointer;
    text-align: center;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    opacity: 0;
}

.file-drop span {
    color: var(--event-primary);
    font-weight: 900;
}

.file-drop small {
    color: var(--muted);
    font-weight: 700;
}

.selected-files {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.selected-files[hidden] {
    display: none;
}

.selected-files-header,
.selected-files li {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.selected-files ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.selected-files li {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f6f8fb;
}

.selected-files li span {
    min-width: 0;
    overflow: hidden;
    color: var(--navy);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-files small,
.selected-files-header span {
    flex: 0 0 auto;
    color: var(--muted);
    font-weight: 800;
}

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

.upload-status {
    min-height: 22px;
    color: var(--success);
    font-weight: 800;
}

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

.upload-status.success {
    color: var(--success);
}

.gallery-zone {
    min-width: 0;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    max-width: 100%;
    margin-bottom: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.moment-chip {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 800;
}

.moment-chip.active {
    border-color: var(--event-primary, var(--teal));
    background: var(--event-primary, var(--teal));
    color: #fff;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.admin-media {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.media-tile {
    position: relative;
    overflow: hidden;
    min-height: 160px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f172a;
}

.media-tile img,
.media-tile video {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 160px;
    aspect-ratio: 1;
    object-fit: cover;
}

.media-tile > div {
    display: grid;
    gap: 4px;
    padding: 10px;
    background: #fff;
}

.media-tile > .media-meta {
    gap: 2px;
}

.media-tile strong {
    overflow: hidden;
    color: var(--navy);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-tile span {
    color: var(--muted);
    font-size: .86rem;
}

.download-link {
    position: absolute;
    right: 8px;
    top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: var(--navy);
    font-size: .82rem;
    font-weight: 900;
    text-decoration: none;
}

.empty-state {
    display: grid;
    place-items: start;
    max-width: 680px;
    margin: 54px auto;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.empty-state.compact {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px;
    box-shadow: none;
}

#blazor-error-ui {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    display: none;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 8px;
    background: #7a271a;
    color: #fff;
    box-shadow: var(--shadow);
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    margin-left: 12px;
    color: #fff;
    font-weight: 800;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .app-header {
        grid-template-columns: 1fr auto;
        gap: 10px;
        padding: 10px 16px;
    }

    .main-nav {
        grid-column: 1 / -1;
        order: 3;
    }

    .home-band,
    .auth-layout,
    .admin-grid,
    .event-editor,
    .guest-workspace,
    .feature-band {
        grid-template-columns: 1fr;
    }

    .home-band,
    .auth-layout {
        min-height: auto;
    }

    .phone-preview {
        min-height: 520px;
    }

    .side-panel {
        position: static;
    }
}

@media (max-width: 620px) {
    .main-surface,
    .guest-page {
        width: min(100% - 22px, 1180px);
        padding-top: 18px;
    }

    h1 {
        font-size: 2.2rem;
        line-height: 1.02;
    }

    .page-heading,
    .section-title-row,
    .event-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .form-row,
    .form-row.three,
    .color-row,
    .moment-row {
        grid-template-columns: 1fr;
    }

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