:root {
    color-scheme: light;
    --background: #f7f4ef;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #5f6b76;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --border: #d9dee3;
    --danger: #b42318;
    --warning: #a15c07;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent);
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 48px auto;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
}

h1 {
    margin: 0 0 12px;
    font-size: 32px;
    letter-spacing: 0;
}

p {
    margin: 0 0 12px;
    color: var(--muted);
}

pre {
    overflow: auto;
    padding: 12px;
    background: #111827;
    color: #f9fafb;
    border-radius: 6px;
}

.stack {
    display: grid;
    gap: 20px;
}

.auth-panel {
    max-width: 440px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-weight: 600;
}

label span {
    font-size: 14px;
}

input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
    resize: vertical;
}

select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.checkbox input {
    width: auto;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-strong);
}

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

.button-secondary:hover {
    background: #f3f4f6;
}

.button-warning {
    border-color: var(--warning);
    background: var(--warning);
}

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

.button-large {
    min-height: 56px;
    padding: 14px 18px;
    font-size: 18px;
}

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

.flash,
.alert {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.flash-success {
    border-color: #9ad5c5;
    background: #edfdf7;
}

.flash-error,
.alert {
    border-color: #f3b3aa;
    background: #fff3f1;
    color: var(--danger);
}

.flash-info {
    border-color: #b8c7f0;
    background: #f2f6ff;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 13px;
    color: var(--muted);
}

.nowrap {
    white-space: nowrap;
}

.details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.details div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
}

.details dt {
    color: var(--muted);
    font-weight: 700;
}

.details dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.qr-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.qr-block img {
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.stats-placeholder {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
}

.stats-placeholder h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 800;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-muted {
    background: #e5e7eb;
    color: #374151;
}

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

.stats-grid div {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfc;
}

.stats-grid strong {
    display: block;
    font-size: 22px;
}

.stats-grid span {
    color: var(--muted);
    font-size: 13px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}

.filters label {
    min-width: 180px;
}

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

.media-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.media-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: #eef2f4;
}

.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-weight: 900;
}

.media-body {
    padding: 0 12px;
}

.media-body h2 {
    margin: 0 0 8px;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.media-actions {
    padding: 0 12px 12px;
}

.guest-panel {
    max-width: 680px;
    margin: 0 auto;
}

.guest-panel h1 {
    font-size: clamp(28px, 7vw, 44px);
    line-height: 1.1;
}

.guest-form {
    gap: 18px;
}

.note {
    color: var(--text);
    font-weight: 700;
}

.file-picker {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 18px;
    background: #fbfcfc;
}

.file-picker input {
    border: 0;
    padding: 12px 0 0;
    background: transparent;
}

.file-summary {
    min-height: 44px;
    border-radius: 8px;
    padding: 12px;
    background: #f3f4f6;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.progress-wrap {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dbe4e7;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 160ms ease;
}

.alert h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

@media (max-width: 640px) {
    .shell {
        margin: 24px auto;
    }

    .page-header,
    .details div {
        display: grid;
        grid-template-columns: 1fr;
    }

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

    .button {
        width: 100%;
    }
}
