:root {
    color-scheme: light dark;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f5f6;
    color: #202124;
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    background: #f4f5f6;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    min-height: 74px;
    padding: max(.8rem, env(safe-area-inset-top)) 1rem .8rem;
    color: #fff;
    background: #202020;
    border-bottom: 2px solid var(--accent, #CF7B0B);
}

.app-header h1 {
    margin: 0;
    color: var(--accent, #CF7B0B);
    font-size: clamp(1.15rem, 4.5vw, 1.9rem);
    text-align: center;
}

.brand {
    overflow: hidden;
    color: var(--accent, #CF7B0B);
    font-size: clamp(.8rem, 3vw, 1.2rem);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection {
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    justify-self: end;
    align-items: center;
    gap: .6rem;
}

.online-app-link {
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .2rem;
}

.connection.online {
    color: #073b1b;
    background: #8fe5ac;
}

.connection.offline {
    color: #fff;
    background: #6d7178;
}

main {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 1rem;
}

.offline-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 1rem;
    max-width: 720px;
    margin: 1rem auto;
}

.menu-tile {
    display: grid;
    min-height: 220px;
    padding: 1.25rem;
    color: inherit;
    font: inherit;
    text-align: center;
    background: #fff;
    border: 2px solid var(--accent, #CF7B0B);
    border-radius: 18px;
    box-shadow: 0 10px 28px #0002;
    cursor: pointer;
    place-content: center;
    justify-items: center;
}

.menu-tile:focus-visible {
    outline: 3px solid var(--accent, #CF7B0B);
    outline-offset: 3px;
}

.menu-icon {
    width: 86px;
    height: 86px;
    margin-bottom: 1rem;
    fill: none;
    stroke: var(--accent, #CF7B0B);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.menu-title {
    color: var(--accent, #CF7B0B);
    font-size: 1.25rem;
    font-weight: 750;
}

.menu-description {
    max-width: 18rem;
    margin-top: .45rem;
    color: #62666d;
    font-size: .9rem;
    line-height: 1.4;
}

.back-button {
    margin-bottom: 1rem;
    padding: .65rem .9rem;
    color: #fff;
    font: inherit;
    font-weight: 700;
    background: #4a4e54;
    border: 1px solid #757a81;
    border-radius: .6rem;
    cursor: pointer;
}

.sync-info {
    margin: 0 0 1rem;
    color: #62666d;
    font-size: .86rem;
    text-align: center;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1rem;
}

.member-card {
    display: grid;
    justify-items: center;
    gap: .8rem;
    padding: 1rem;
    overflow: hidden;
    background: #fff;
    border: 2px solid var(--accent, #CF7B0B);
    border-radius: 18px;
    box-shadow: 0 10px 28px #0002;
}

.holder {
    display: flex;
    flex-direction: column;
    justify-self: stretch;
    min-height: 4.4rem;
    line-height: 1.35;
}

.card-title {
    color: var(--accent, #CF7B0B);
    font-size: 1.15rem;
    font-weight: 750;
}

.qr-code {
    display: grid;
    width: min(72vw, 250px);
    aspect-ratio: 1;
    padding: .5rem;
    place-items: center;
    background: #fff;
    border-radius: 10px;
}

.qr-code svg {
    display: block;
    width: 100%;
    height: 100%;
}

.card-number {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.expiration {
    color: #62666d;
    font-size: .9rem;
}

.expiration.expired {
    color: #bc1c22;
    font-weight: 700;
}

.empty-state {
    display: grid;
    min-height: 60vh;
    padding: 2rem;
    text-align: center;
    place-content: center;
    justify-items: center;
}

.empty-state h1,
.empty-state h2 {
    margin-bottom: .5rem;
}

.empty-state p {
    max-width: 34rem;
    line-height: 1.55;
}

.empty-state.compact {
    min-height: 45vh;
}

.button {
    display: inline-block;
    margin-top: .75rem;
    padding: .75rem 1.1rem;
    color: #fff;
    background: #4a4e54;
    border-radius: .6rem;
    font-weight: 700;
    text-decoration: none;
}

.spinner {
    width: 2.4rem;
    height: 2.4rem;
    border: .3rem solid #aaa6;
    border-top-color: #CF7B0B;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    padding: .8rem;
    color: #fff;
    background: #9b1c23;
    text-align: center;
}

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

@media (max-width: 560px) {
    .app-header {
        grid-template-columns: 1fr auto;
    }

    .app-header h1 {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .online-app-link {
        display: none;
    }

    main {
        padding: .75rem;
    }
}

@media (prefers-color-scheme: dark) {
    :root,
    body {
        color: #f1f3f5;
        background: #101112;
    }

    .member-card {
        background: #2d3034;
        box-shadow: 0 10px 28px #0008;
    }

    .menu-tile {
        background: #2d3034;
        box-shadow: 0 10px 28px #0008;
    }

    .sync-info,
    .expiration,
    .menu-description {
        color: #bec3ca;
    }

    .expiration.expired {
        color: #ff8b91;
    }
}
