.network-pill.offline {
    background: #7b1f1f;
    color: #fff;
}

html {
    color-scheme: light;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font-size: max(16px, 1rem);
}

button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.button,
button,
.file-button,
summary {
    min-height: 44px;
}

.app-shell,
.admin-shell,
.legal-shell,
.claim-shell,
.display-shell {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
}

.claim-shell,
.display-shell {
    min-height: 100dvh;
    padding-top: max(clamp(22px, 6vw, 70px), env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.display-shell {
    padding-top: max(24px, env(safe-area-inset-top));
}

.display-grid {
    height: calc(100dvh - 130px);
}

.topbar,
.display-header,
.section-heading,
.button-row,
.admin-actions {
    flex-wrap: wrap;
}

.topbar > *,
.display-header > *,
.section-heading > *,
.admin-actions > * {
    min-width: 0;
}

.button-row .button,
.admin-actions .button {
    flex: 0 1 auto;
}

.toast {
    width: min(680px, calc(100vw - 32px));
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    z-index: 100;
}

dialog {
    width: min(620px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    overflow: auto;
    border: 0;
    border-radius: var(--radius);
    padding: 20px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(20, 18, 15, .35);
}

dialog::backdrop {
    background: rgba(20, 18, 15, .68);
}

dialog pre,
.admin-settings pre,
.guide-section pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.download-fallback {
    display: block;
    margin-top: 12px;
    text-align: center;
}

.client-release-blocker {
    background: #7f1d1d;
    color: #fff;
    font-weight: 700;
    padding: 12px 18px;
    text-align: center;
}

#camera-panel video,
#photo-preview {
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 14px;
    background: #000;
}

.capture-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #d8d0c4;
    border-radius: 14px;
}

.capture-item img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
}

.capture-item div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.capture-item span {
    color: var(--muted);
    font-size: .84rem;
}

.capture-item input {
    min-height: 44px;
    width: 100%;
    border: 1px solid #bcb2a5;
    border-radius: 9px;
    padding: 7px 9px;
}

.toast.visible {
    opacity: 1;
}

@media (max-width: 520px) {
    .display-grid {
        height: auto;
    }

    .capture-item {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .capture-item img {
        width: 60px;
        height: 60px;
    }

    .capture-item .button {
        grid-column: 1 / -1;
    }

    .app-shell,
    .admin-shell,
    .legal-shell,
    .claim-shell,
    .display-shell {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .panel,
    .claim-card {
        padding: 16px;
        border-radius: 16px;
    }

    .button-row,
    .admin-actions {
        align-items: stretch;
    }

    .button-row .button,
    .admin-actions .button {
        flex: 1 1 100%;
        width: 100%;
    }

    .table-wrap {
        overflow: visible;
    }

    .table-wrap table,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap td {
        display: block;
        width: 100%;
    }

    .table-wrap thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .table-wrap tr {
        margin: 12px 0;
        padding: 10px;
        border: 1px solid #d8d0c4;
        border-radius: 12px;
        background: #fff;
    }

    .table-wrap td {
        display: grid;
        grid-template-columns: minmax(90px, 38%) minmax(0, 1fr);
        gap: 10px;
        padding: 8px 4px;
        border-bottom: 1px solid #eee;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .table-wrap td::before {
        content: attr(data-label);
        font-weight: 800;
        color: var(--muted);
    }

    .table-wrap td:last-child {
        border-bottom: 0;
    }

    .admin-row-actions {
        display: flex !important;
        flex-wrap: wrap;
    }

    .admin-row-actions::before {
        flex: 0 0 100%;
    }
}
