.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.startup-loader-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    background: #f4f7fb;
}

:root[data-theme="dark"] .startup-loader-shell {
    background: #0f1724;
}

.startup-loader-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: startup-pulse 1.4s ease-in-out infinite;
}

.startup-loader-text {
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #6b7b93;
    text-transform: uppercase;
}

:root[data-theme="dark"] .startup-loader-text {
    color: #92a4bd;
}

.startup-loader-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.startup-progress {
    width: min(260px, 72vw);
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.startup-progress-bar {
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: inherit;
    transition: width 0.12s ease-out;
}

:root[data-theme="dark"] .startup-progress-bar {
    background: linear-gradient(90deg, #7cb0ff 0%, #a9caff 100%);
}

.startup-progress-value {
    font-size: 0.85rem;
    color: #6b7b93;
    font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .startup-progress-value {
    color: #92a4bd;
}

.startup-progress-value::after {
    content: var(--blazor-load-percentage, "0%");
}

@keyframes startup-pulse {
    0% {
        opacity: 0.35;
        transform: scale(0.94);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0.35;
        transform: scale(0.94);
    }
}

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --sidebar-surface: linear-gradient(180deg, #dff1f4 0%, #cfe6ef 52%, #d8d7ef 100%);
    --topbar-surface: #4f8fa8;
    --border: #e2e6ea;
    --text: #1a1f24;
    --muted: #6b7480;
    --accent: #1f3b5b;
    --accent-weak: #e6edf5;
    --danger: #b21d1d;
}

:root[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #171d24;
    --sidebar-surface: linear-gradient(180deg, #13232c 0%, #183443 52%, #2a2841 100%);
    --topbar-surface: #214455;
    --border: #2a3441;
    --text: #e6edf5;
    --muted: #a7b3c2;
    --accent: #9ec4ef;
    --accent-weak: #1b2a3c;
    --danger: #ff8c8c;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.login-shell {
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.app-sidebar {
    width: 240px;
    background: var(--sidebar-surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.sidebar-brand-logo {
    display: block;
    max-width: 100%;
    height: 44px;
    width: auto;
    object-fit: contain;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav a {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
}

.nav-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.2rem 0.3rem 0.4rem;
}

.nav-group summary {
    cursor: pointer;
    padding: 0.45rem 0.5rem;
    font-weight: 600;
    color: var(--accent);
}

.nav-subgroup {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.nav a.active {
    background: var(--accent-weak);
    color: var(--accent);
    font-weight: 600;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--topbar-surface);
}

.app-title {
    font-weight: 600;
    color: #f4fbff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.user-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    color: #f4fbff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.85rem;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    cursor: pointer;
}

.user-menu-popover {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    z-index: 30;
    min-width: 240px;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.user-menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.user-menu-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.user-menu-action {
    width: 100%;
    justify-content: flex-start;
}

.app-content {
    padding: 1.5rem;
}

.app-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 35, 0.34);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.app-busy-card {
    min-width: min(360px, 92vw);
    max-width: 420px;
    padding: 1.2rem 1.35rem;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
    background: color-mix(in srgb, var(--surface) 92%, white 8%);
    box-shadow: 0 20px 48px rgba(8, 18, 30, 0.24);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    text-align: center;
}

.app-busy-spinner {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 4px solid rgba(31, 59, 91, 0.14);
    border-top-color: var(--accent);
    animation: app-busy-spin 0.9s linear infinite;
}

.app-busy-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.app-busy-text {
    color: var(--muted);
    font-size: 0.92rem;
}

@keyframes app-busy-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.page-header h1 {
    margin: 0 0 0.3rem 0;
    font-size: 1.6rem;
}

.muted {
    color: var(--muted);
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

/* Non-dashboard widget cards (Home uses `.metric-card` — unaffected): shrink padding and
   the big number so per-page metrics take less vertical space. */
.grid > .card {
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
}

.grid > .card .metric-value {
    font-size: clamp(1.05rem, 1.3vw, 1.35rem);
    margin-top: 0.3rem;
    letter-spacing: -0.02em;
}

.grid > .card .card-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.grid > .card .metric-note {
    margin-top: 0.3rem;
    font-size: 0.78rem;
}

.grid > .card .metric-label {
    font-size: 0.72rem;
}

.grid + .panel,
.grid + .filter-panel,
.grid + details.filter-panel {
    margin-top: 1rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1rem;
    width: 100%;
    align-items: stretch;
}

.games-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.games-tab-strip {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.games-tab-strip .btn.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border-color: transparent;
}

.games-pagination-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.games-pagination-actions {
    display: inline-flex;
    gap: 0.5rem;
}

.game-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border) 88%);
    border-radius: 16px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(31, 59, 91, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    isolation: isolate;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.06),
        0 16px 40px rgba(31, 59, 91, 0.12);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
}

.game-card.is-clickable {
    cursor: pointer;
}

.game-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.30;
    filter: blur(12px) saturate(1.2);
    border-radius: 16px;
    /* blur spreads pixels ~12px past the element; clip-path forces the filtered
       output (not just the element box) to the rounded card shape so the yellow
       halo doesn't bleed past the card corners. */
    clip-path: inset(0 round 16px);
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

video.game-card-bg {
    /* First-frame-only for video backgrounds — no autoplay */
    background: var(--surface-muted);
}

.game-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card-content {
    position: relative;
    z-index: 1;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1;
    min-height: 0;
}

.game-card-description {
    margin-top: auto;
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
}

.game-card-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.game-card-header-title .card-title {
    font-size: 1.1rem;
    margin: 0;
}

.game-card-info {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    min-width: 0;
}

.game-card-image-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    width: 148px;
}

.game-card-image-wrap {
    position: relative;
    width: 148px;
    height: 148px;
}

.game-card-image-wrap .game-status-badge {
    position: absolute;
    top: -8px;
    left: -4px;
    z-index: 2;
    padding: 0.15rem 0.45rem;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

a.game-card-play,
button.game-card-play,
.btn.game-card-play {
    width: 100%;
    height: 2rem;
    min-height: 2rem;
    max-height: 2rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-align: center;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

a.game-card-play {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: #3d2a0a;
    border: 1px solid rgba(217, 119, 6, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.35) inset,
        0 2px 8px rgba(217, 119, 6, 0.3);
}

a.game-card-play:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 4px 12px rgba(217, 119, 6, 0.4);
}

a.game-card-play:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

button.game-card-play:disabled {
    background: var(--surface-muted);
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

:root[data-theme="dark"] a.game-card-play {
    background: linear-gradient(135deg, #fde047 0%, #fbbf24 50%, #f59e0b 100%);
    color: #1e1405;
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 2px 10px rgba(251, 191, 36, 0.25);
}

.game-card-id-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    overflow-wrap: anywhere;
    margin-bottom: 0.15rem;
}

.game-card-id {
    font-size: 0.9rem;
}

.game-card-alias {
    color: var(--muted);
    font-size: 0.85rem;
}

.game-card-reskin-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    margin-bottom: 0.35rem;
    border-radius: 8px;
    background: color-mix(in srgb, #f59e0b 12%, var(--surface) 88%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    font-size: 0.82rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.game-card-reskin-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #d97706;
    background: rgba(245, 158, 11, 0.15);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    flex-shrink: 0;
}

:root[data-theme="dark"] .game-card-reskin-badge {
    color: #fbbf24;
}

.game-card-field {
    font-size: 0.88rem;
}

.game-card-controls {
    display: inline-flex;
    gap: 0.35rem;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.game-card:hover .game-card-controls {
    opacity: 1;
}

.game-card-edit {
    min-width: 0;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
}

.game-card-favorite {
    min-width: 0;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
}

.game-card-favorite.is-active {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
}

.game-card-image {
    width: 148px;
    height: 148px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border) 90%);
    background: var(--surface-soft);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.game-card:hover .game-card-image {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Queue-loaded card images: hidden until imageQueue marks them as loaded, so the
   catalog doesn't flash with broken-image icons while requests drip through. */
.game-card-image.is-pending,
.game-card-bg.is-pending {
    opacity: 0;
}

.game-card-image.is-loaded,
.game-card-bg.is-loaded {
    transition: opacity 0.3s ease;
}

/* Mascot fallback for missing artwork — dim so operators see at a glance that the
   card has no real cover yet without the image disappearing entirely. Image itself is
   capped at the desktop card-image size (148px) so the mascot doesn't scale up to fill
   responsive wrappers that stretch to 100%. */
.game-card-image.is-fallback {
    opacity: 0.45;
    object-fit: contain;
    box-sizing: border-box;
    width: 148px;
    height: 148px;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    padding: 0.75rem;
    background: var(--surface-soft);
}

.game-form-preview-image.is-fallback {
    opacity: 0.45;
    object-fit: contain;
    padding: 1rem;
}

.game-card-bg.is-fallback {
    opacity: 0.18;
    object-fit: contain;
}

.game-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
}

.game-card-meta strong {
    color: var(--muted);
    font-weight: 600;
}

.game-card-label-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.game-card-type {
    color: var(--muted);
    font-size: 0.92rem;
}

.game-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.game-status-badge-hot {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.6);
}

.game-status-badge-new {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.6);
}

.game-status-badge-top {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    border: 1px solid rgba(59, 130, 246, 0.6);
}

.game-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-height: 1.75rem;
}

.game-card-feature-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.game-card-feature-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.game-feature-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent-weak) 80%, var(--surface) 20%);
    border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border) 88%);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-strong, var(--accent));
    transition: background 0.15s ease;
}

.game-feature-tag:hover {
    background: color-mix(in srgb, var(--accent-weak) 100%, white 0%);
}

.game-card-description {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
    min-height: 2.8rem;
    overflow-wrap: anywhere;
}

.game-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-start;
}

@media (max-width: 720px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-card-image-wrap {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        max-height: 260px;
    }

    .game-card-image-wrap .game-card-image {
        width: 100%;
        height: 100%;
    }

    .games-pagination-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-card-info {
        grid-template-columns: 1fr;
    }

    .game-card-image-col {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.panel-title {
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-grid-modal {
    margin-bottom: 1rem;
}

.game-form-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.game-form-preview {
    min-width: 0;
    position: sticky;
    top: 0;
}

.game-form-preview-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--surface-muted);
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.game-form-layout .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.game-form-layout .form-row-full {
    grid-column: 1 / -1;
}

.game-form-layout .form-actions {
    grid-column: 1 / -1;
    margin-top: 0.3rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
}

.input {
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.input-end-value {
    width: 160px;
    max-width: 100%;
}

.input-amount {
    width: 96px;
    max-width: 100%;
}

.input-requirement-id {
    width: 180px;
    max-width: 100%;
}

.input-requirement-text {
    width: 160px;
    max-width: 100%;
}

.input-requirement-number {
    width: 96px;
    max-width: 100%;
}

.input-requirement-json {
    width: 220px;
    max-width: 100%;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn.ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}

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

.btn-inline {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.requirements-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.login-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.login-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.login-card h1 {
    margin-top: 0;
}

.login-card-header h1 {
    margin-bottom: 0.25rem;
}

.login-divider {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

.login-divider span {
    padding: 0 0.65rem;
}

.error {
    margin-top: 0.8rem;
    color: var(--danger);
}

.mono {
    font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 24, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1.5rem;
    box-sizing: border-box;
}

.modal {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: min(980px, 100%);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Game preview modal — iframe-based demo launcher with device-mode toggles. */
.game-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 24, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 1.25rem;
    box-sizing: border-box;
}

.game-preview-modal {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: min(1400px, 100%);
    height: min(920px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.game-preview-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.game-preview-title {
    font-weight: 600;
    font-size: 1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.game-preview-modes {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.game-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    line-height: 30px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 3;
}

.game-preview-close:hover {
    background: var(--surface-muted);
}

.game-preview-stage {
    flex: 1;
    min-height: 0;
    background: #0b0e12;
    overflow: hidden;
    position: relative;
    display: block;
}

.game-preview-frame {
    border: 0;
    display: block;
    /* width/height/transform/margins are driven by gamePreview.observe JS helper.
       Defaults here just avoid flicker before the first resize observation fires. */
    width: 1280px;
    height: 720px;
    transform-origin: top left;
}

/* Mobile (<=700px wide): modal goes full-viewport, chrome hides, only a floating
   close button remains. Device-mode toggles are meaningless on a phone — the user
   rotates the device physically. */
@media (max-width: 700px) {
    .game-preview-overlay {
        padding: 0;
    }

    .game-preview-modal {
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .game-preview-header {
        display: none;
    }

    .game-preview-stage {
        width: 100%;
        height: 100%;
    }

    .game-preview-frame {
        width: 100% !important;
        height: 100% !important;
        transform: none !important;
        margin: 0 !important;
    }

    .game-preview-close {
        background: rgba(9, 16, 24, 0.7);
        color: #fff;
        border-color: transparent;
        width: 36px;
        height: 36px;
        line-height: 32px;
        font-size: 1.5rem;
    }
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow: auto;
}

.modal-footer {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.endpoint-switcher {
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.endpoint-switcher.compact {
    min-width: 220px;
}

.endpoint-switcher-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.endpoint-switcher-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.endpoint-switcher-select {
    min-width: 0;
    flex: 1;
    background: var(--surface);
    color: var(--text);
}

.endpoint-switcher-caption {
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-word;
}

.endpoint-pill {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f4fbff;
}

.quest-editor-requirements {
    margin-top: 0.5rem;
}

@media (max-width: 900px) {
    .game-form-layout {
        grid-template-columns: 1fr;
    }

    .game-form-layout .form-grid {
        grid-template-columns: 1fr;
    }

    .game-form-preview-image {
        max-height: 240px;
        aspect-ratio: auto;
        height: auto;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .app-content {
        padding: 1rem;
    }

    .login-card-header {
        flex-direction: column;
    }

    .endpoint-switcher,
    .endpoint-switcher.compact {
        width: 100%;
        min-width: 0;
    }

    .user-menu-popover {
        right: auto;
        left: 0;
        min-width: min(240px, calc(100vw - 2rem));
    }

}

/* Backoffice redesign baseline */

:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-soft: #eef3f8;
    --sidebar-surface: #1f2b3d;
    --sidebar-surface-alt: #243247;
    --topbar-surface: rgba(255, 255, 255, 0.88);
    --border: #e5ebf3;
    --border-strong: #d5deea;
    --text: #1e293b;
    --muted: #6b7b93;
    --accent: #3b82f6;
    --accent-strong: #1d4ed8;
    --accent-weak: #eff6ff;
    --success: #12966f;
    --danger: #cc4b4b;
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 48px rgba(15, 23, 42, 0.12);
}

:root[data-theme="dark"] {
    --bg: #0f1724;
    --surface: #111c2d;
    --surface-muted: #162235;
    --surface-soft: #1b2940;
    --sidebar-surface: #0b1220;
    --sidebar-surface-alt: #132038;
    --topbar-surface: rgba(11, 18, 32, 0.84);
    --border: #22324a;
    --border-strong: #2d4260;
    --text: #e8eef8;
    --muted: #92a4bd;
    --accent: #7cb0ff;
    --accent-strong: #a9caff;
    --accent-weak: #15253b;
    --success: #44c191;
    --danger: #ff8a8a;
    --shadow-sm: 0 16px 40px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 24px 56px rgba(0, 0, 0, 0.32);
}

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

body {
    margin: 0;
    font-family: "Manrope", "IBM Plex Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 24%),
        linear-gradient(180deg, #f7f9fc 0%, var(--bg) 18%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.5;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(124, 176, 255, 0.08), transparent 22%),
        linear-gradient(180deg, #0d1522 0%, var(--bg) 22%, var(--bg) 100%);
}

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

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    position: relative;
}

.login-shell {
    align-items: stretch;
    justify-content: center;
    padding: 2rem;
}

.shell-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 28, 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 90;
}

.shell-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

.app-sidebar {
    width: 276px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 24%),
        linear-gradient(180deg, var(--sidebar-surface) 0%, var(--sidebar-surface-alt) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    padding: 1.35rem 1rem 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand-block {
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 0;
}

.sidebar-brand-logo {
    width: 64px;
    height: 64px;
    padding: 0.65rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.sidebar-brand-title {
    color: #f8fbff;
    font-weight: 800;
    font-size: 1.08rem;
    line-height: 1.1;
}

.sidebar-brand-subtitle {
    margin-top: 0.2rem;
    color: rgba(225, 234, 245, 0.7);
    font-size: 0.85rem;
}

.sidebar-close,
.shell-nav-toggle {
    display: none !important;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.nav-section-label {
    margin-top: 0.7rem;
    padding: 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(225, 234, 245, 0.45);
}

.nav a {
    display: flex;
    align-items: center;
    min-height: 2.8rem;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    color: rgba(240, 246, 255, 0.84);
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    transform: translateX(1px);
}

.nav a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.08));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(124, 176, 255, 0.2);
    font-weight: 700;
}

.nav-group {
    border: none;
    border-radius: 16px;
    padding: 0.15rem 0;
    background: rgba(255, 255, 255, 0.03);
}

.nav-group summary {
    list-style: none;
    cursor: pointer;
    padding: 0.8rem 0.9rem 0.55rem;
    font-weight: 700;
    color: #f8fbff;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-subgroup {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.45rem 0.45rem;
}

.nav-subgroup a {
    min-height: 2.45rem;
    padding-left: 0.95rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--topbar-surface);
    border-bottom: 1px solid rgba(213, 222, 234, 0.85);
    backdrop-filter: blur(16px);
}

:root[data-theme="dark"] .app-topbar {
    border-bottom-color: rgba(45, 66, 96, 0.8);
}

.topbar-primary {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.topbar-eyebrow {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.app-title {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.user-pill {
    min-height: 2.55rem;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.user-menu-popover {
    top: calc(100% + 0.75rem);
    min-width: 260px;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.app-content {
    padding: 1.6rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.35rem;
}

.page-header-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 70rem;
}

.page-kicker,
.auth-eyebrow,
.auth-card-kicker,
.dashboard-card-kicker {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.page-header h1,
.login-card h1,
.auth-copy h1 {
    margin: 0.2rem 0 0.4rem;
    font-size: clamp(1.8rem, 2vw, 2.45rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.muted {
    color: var(--muted);
}

.panel,
.card,
.login-card,
.metric-card,
.modal {
    background: color-mix(in srgb, var(--surface) 92%, white 8%);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.panel {
    padding: 1.15rem 1.2rem;
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.panel-subtitle {
    margin-top: 0.18rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.card {
    padding: 1.1rem;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-title {
    font-weight: 800;
    margin: 0.35rem 0;
    letter-spacing: -0.02em;
}

.card-body {
    color: var(--muted);
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    padding: 1.1rem 1.15rem;
}

.metric-card-accent {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0.03) 68%), var(--surface);
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

.metric-value {
    margin-top: 0.55rem;
    font-size: clamp(1.5rem, 2vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.metric-note {
    margin-top: 0.45rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.action-compact-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.85rem;
    min-height: 0;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.action-compact-card .card-title {
    margin-top: 0.35rem;
}

.action-compact-actions {
    margin-top: 0;
}

.dashboard-card-grid,
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.dashboard-gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    align-items: start;
}

.dashboard-home-panel {
    min-width: 0;
    overflow: hidden;
}

.dashboard-home-panel .panel-header > div,
.dashboard-home-panel .dashboard-gauge-summary {
    min-width: 0;
}

.dashboard-home-panel .panel-subtitle,
.dashboard-home-panel .metric-note {
    overflow-wrap: anywhere;
}

.dashboard-widget-loading {
    min-height: 148px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.dashboard-metric-loading {
    margin-top: 0.8rem;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.dashboard-widget-spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(31, 59, 91, 0.14);
    border-top-color: var(--accent);
    animation: app-busy-spin 0.9s linear infinite;
    flex: 0 0 auto;
}

.dashboard-card {
    min-height: 164px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 25%, var(--border) 75%);
    box-shadow: var(--shadow-md);
}

.games-metrics {
    margin-top: -0.15rem;
}

/* Metric card colored left border variants */
.metric-card-bordered {
    border-left: 4px solid var(--border);
}

.metric-card-blue {
    border-left-color: #3b82f6;
}

.metric-card-purple {
    border-left-color: #8b5cf6;
}

.metric-card-green {
    border-left-color: #10b981;
}

.metric-card-orange {
    border-left-color: #f59e0b;
}

/* Gauge panel */
.dashboard-gauge-panel {
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 30%),
        linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.dashboard-gauge-wrap {
    display: grid;
    grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.dashboard-gauge-summary {
    min-width: 0;
}

.dashboard-gauge-value {
    font-size: clamp(1.6rem, 2.2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--text);
}

.dashboard-gauge-status {
    display: inline-flex;
    align-items: center;
    margin-top: 0.45rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-gauge-status-good {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
}

.dashboard-gauge-status-warning {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.dashboard-gauge-status-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.dashboard-gauge-status-muted {
    background: rgba(148, 163, 184, 0.14);
    color: #475569;
}

/* Circular donut gauge */
.dashboard-donut-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.dashboard-donut {
    width: 100%;
    max-width: 140px;
    height: auto;
    display: block;
}

.dashboard-donut-track {
    fill: none;
    stroke: rgba(148, 163, 184, 0.18);
    stroke-width: 10;
}

.dashboard-donut-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}

.dashboard-donut-good {
    stroke: #059669;
}

.dashboard-donut-warning {
    stroke: #d97706;
}

.dashboard-donut-danger {
    stroke: #dc2626;
}

.dashboard-donut-muted {
    stroke: rgba(148, 163, 184, 0.4);
}

.dashboard-donut-value {
    fill: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.dashboard-donut-label {
    fill: var(--muted);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Charts grid */
.dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Bar chart */
.dashboard-bar-chart {
    width: 100%;
    height: auto;
    display: block;
}

.dashboard-bar {
    opacity: 0.85;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dashboard-bar-positive {
    fill: var(--accent);
}

.dashboard-bar-negative {
    fill: #e16a6a;
}

.dashboard-bar:hover {
    opacity: 1;
}

.dashboard-bar-axis {
    stroke: color-mix(in srgb, var(--border) 82%, var(--text) 18%);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.dashboard-bar-value {
    fill: var(--text);
    font-size: 0.58rem;
    font-weight: 700;
}

.dashboard-bar-label {
    fill: var(--muted);
    font-size: 0.62rem;
    font-weight: 600;
}

.dashboard-trend-summary {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.65rem;
}

.dashboard-trend-summary-item {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.dashboard-trend-summary-label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-trend-summary-value {
    margin-top: 0.32rem;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
}

/* Pie/donut chart */
.dashboard-pie-wrap {
    display: grid;
    grid-template-columns: minmax(100px, 140px) minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.dashboard-pie-chart {
    width: 100%;
    max-width: 140px;
    height: auto;
    display: block;
}

.dashboard-pie-segment {
    fill: none;
    stroke-width: 10;
}

.dashboard-pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.dashboard-pie-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.dashboard-pie-legend-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-weight: 600;
}

.dashboard-pie-legend-pct {
    font-weight: 800;
    color: var(--muted);
    flex-shrink: 0;
}

/* Stat cards grid */
.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-stat-panel {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.dashboard-stat-header {
    margin-bottom: 0.35rem;
}

.dashboard-stat-value {
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
}

.dashboard-stat-trend {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.dashboard-trend-up {
    color: #059669;
}

.dashboard-trend-down {
    color: #dc2626;
}

.dashboard-trend-muted {
    color: var(--muted);
}

/* Sparkline */
.dashboard-sparkline {
    width: 100%;
    max-width: 120px;
    height: 32px;
    margin-top: 0.55rem;
    display: block;
}

.dashboard-sparkline-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-sparkline-accent {
    stroke: #f59e0b;
}

.dashboard-sparkline-green {
    stroke: #10b981;
}

.dashboard-sparkline-purple {
    stroke: #8b5cf6;
}

/* Stat card layout with mini donut */
.dashboard-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dashboard-mini-donut {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.dashboard-mini-donut .dashboard-donut-track {
    stroke-width: 6;
}

.dashboard-mini-donut .dashboard-donut-fill {
    stroke-width: 6;
}

/* Alert stat panel */
.dashboard-stat-alert {
    border-left: 4px solid #dc2626;
}

.dashboard-stat-value-danger {
    color: #dc2626;
}

:root[data-theme="dark"] .dashboard-stat-value-danger {
    color: #ff8a8a;
}

.utility-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.utility-card {
    padding: 1.1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.utility-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.utility-actions {
    margin-top: 0.9rem;
}

.filter-panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
    overflow: hidden;
}

.filter-panel summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
}

.filter-panel summary::-webkit-details-marker {
    display: none;
}

.filter-panel-toggle {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.filter-panel-body {
    padding: 0 1.05rem 1.05rem;
    border-top: 1px solid var(--border);
}

.filter-actions {
    align-items: flex-end;
}

.compact-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.8rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-card .card-title {
    font-size: 1.05rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-grid-modal {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-row label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.assignment-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.assignment-card {
    /* Grid items already stretch vertically via default align-items: stretch; an explicit
       min-height: 100% against an implicit parent height caused a layout feedback loop that
       grew the card on scroll inside collapsible panels. */
    align-self: stretch;
}

.assignment-chip-actions,
.assignment-actions {
    margin-top: 1rem;
}

.selection-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.selection-summary-label {
    margin-bottom: 0.7rem;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.selection-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.selection-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.55rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.selection-chip:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
    background: var(--surface-soft);
    transform: translateY(-1px);
}

.selection-chip-remove {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.assignment-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.toggle-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
    cursor: pointer;
}

.toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.toggle-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.toggle-description {
    color: var(--muted);
    font-size: 0.88rem;
}

.checkbox-input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.15rem 0 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.casino-inline-note {
    margin-top: 0.9rem;
}

.toolbar {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-management-tab-strip {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.user-management-tab-strip .btn {
    min-width: max-content;
}

.user-management-tab-strip .btn.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border-color: transparent;
}

.user-management-search {
    min-width: min(24rem, 100%);
    flex: 1 1 18rem;
}

.user-management-import-bar {
    margin-bottom: 0.75rem;
}

.user-management-inline-actions {
    margin-top: 0.55rem;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.table-sort-button:hover {
    color: var(--accent-strong);
}

.user-management-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.7rem;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
}

.user-management-toggle input[type="checkbox"] {
    margin: 0;
    accent-color: var(--accent);
}

.user-management-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.selection-list {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.55rem;
    max-height: 20rem;
    overflow: auto;
    padding: 0.25rem;
}

.selection-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.8rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
}

.selection-item input[type="checkbox"] {
    margin-top: 0.15rem;
    accent-color: var(--accent);
}

.danger-text {
    color: var(--danger);
}

.user-management-grant-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.user-management-grant-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: end;
    padding: 0.95rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.user-management-grant-row .form-row {
    min-width: 0;
}

.user-management-grant-row-action {
    justify-content: end;
}

@media (max-width: 960px) {
    .user-management-grant-row {
        grid-template-columns: 1fr;
    }

    .user-management-grant-row-action {
        justify-content: stretch;
    }

    .user-management-grant-row-action .btn {
        width: 100%;
    }
}

.analytics-tab-strip {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.analytics-tab-strip .btn {
    min-width: max-content;
}

.analytics-toolbar {
    margin-top: 1rem;
}

.analytics-filter-summary {
    margin-top: 0.75rem;
    line-height: 1.55;
}

.analytics-insight-grid {
    margin-bottom: 1rem;
}

.analytics-insight-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.analytics-insight-card-accent {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0.03) 68%), var(--surface);
}

.analytics-summary-grid {
    margin-bottom: 1rem;
}

.analytics-summary-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.analytics-summary-value {
    margin-top: 0.55rem;
    font-size: clamp(1.2rem, 1.9vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    overflow-wrap: anywhere;
}

.analytics-insight-value {
    margin-top: 0.55rem;
    font-size: clamp(1.1rem, 1.9vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    overflow-wrap: anywhere;
}

.analytics-feedback-block {
    margin-top: 0.75rem;
    white-space: pre-wrap;
}

.analytics-chart-note {
    margin-bottom: 0.5rem;
}

.analytics-chart-wrap {
    width: 100%;
    min-height: 300px;
    overflow: auto hidden;
}

.analytics-chart {
    width: 100%;
    min-width: 720px;
    height: 300px;
    display: block;
}

.analytics-chart-bar {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.analytics-chart-bar:hover {
    opacity: 0.85;
}

/* Analytics widget charts */
.analytics-widget-chart {
    width: 100%;
    max-width: 460px;
    height: auto;
    display: block;
}

.analytics-widget-chart-wide {
    max-width: 100%;
}

.analytics-widget-bar {
    fill: var(--accent, #3b82f6);
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.analytics-widget-bar:hover {
    opacity: 1;
}

.analytics-widget-bar-green {
    fill: #10b981;
}

.analytics-widget-bar-purple {
    fill: #8b5cf6;
}

.analytics-widget-label {
    fill: var(--muted, #6b7b93);
    font-size: 0.55rem;
    font-weight: 600;
}

.analytics-retention-dot {
    fill: var(--accent, #3b82f6);
}

.analytics-retention-value {
    fill: var(--text, #1e293b);
    font-size: 0.65rem;
    font-weight: 700;
}

.analytics-selected-point-card {
    margin-top: 1rem;
}

.analytics-selected-point-body {
    padding: 0;
}

.analytics-selected-point-actions {
    margin-top: 0.75rem;
}

.analytics-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.85rem;
}

.analytics-detail-item {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.08);
}

.analytics-detail-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.analytics-detail-value {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: anywhere;
}

.analytics-scope-grid {
    margin-top: 1rem;
}

.input {
    min-height: 2.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    box-sizing: border-box;
    width: 100%;
}

.input:hover {
    border-color: var(--border-strong);
}

.input:focus,
input.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border) 45%);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent 86%);
}

textarea.input {
    min-height: 7rem;
    resize: vertical;
}

select.input,
.endpoint-switcher-select {
    appearance: none;
    padding-right: 2.8rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.page-size-select {
    width: auto;
    min-width: 5.25rem;
    flex: 0 0 5.25rem;
    padding-right: 2.2rem;
}

.btn {
    min-height: 2.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white 8%), var(--accent));
    color: #ffffff;
    border: 1px solid transparent;
    padding: 0.65rem 1rem;
    border-radius: 14px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.18);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(59, 130, 246, 0.22);
}

.btn.secondary,
.btn.ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
}

.btn.secondary {
    color: var(--accent-strong);
    border-color: color-mix(in srgb, var(--accent) 20%, var(--border) 80%);
    background: color-mix(in srgb, var(--accent-weak) 40%, var(--surface) 60%);
}

.btn.ghost:hover:not(:disabled),
.btn.secondary:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
    background: var(--surface-soft);
    box-shadow: none;
}

.btn-inline,
.icon-btn {
    min-width: 2.7rem;
    padding-inline: 0.7rem;
}

.icon-btn {
    padding: 0.55rem 0.7rem;
}

.btn-sm {
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 10px;
}

.btn-icon {
    min-height: 2rem;
    min-width: 2rem;
    padding: 0.35rem;
    font-size: 0.85rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Panel header toolbar (right-aligned compact actions) */
.panel-header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-shrink: 0;
}

/* Column settings side drawer */
.column-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 24, 0.35);
    z-index: 1200;
    backdrop-filter: blur(4px);
}

.column-settings-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    z-index: 1201;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.column-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.column-settings-actions {
    display: flex;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.column-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.65rem 1.1rem;
}

.column-settings-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--text);
}

.column-settings-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
    overflow: hidden;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table th,
.table td {
    text-align: left;
    padding: 0.9rem 0.8rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table-toggle-cell {
    vertical-align: middle;
}

.table-actions {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pill-positive {
    background: color-mix(in srgb, var(--success) 12%, var(--surface) 88%);
    border-color: color-mix(in srgb, var(--success) 32%, var(--border) 68%);
    color: #166534;
}

.status-pill-muted {
    background: color-mix(in srgb, var(--surface-muted) 70%, var(--surface) 30%);
    color: var(--muted);
}

.table tbody tr:hover td {
    background: color-mix(in srgb, var(--accent-weak) 35%, transparent 65%);
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

.table-detail-row td {
    background: color-mix(in srgb, var(--surface-muted) 72%, var(--surface) 28%);
}

.login-shell {
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 28%),
        radial-gradient(circle at bottom right, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 40%),
        var(--bg);
}

.auth-shell {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 460px);
    gap: 1.4rem;
    align-items: stretch;
}

.auth-copy {
    padding: 2rem 1rem 2rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-copy p {
    max-width: 48ch;
    color: var(--muted);
    font-size: 1rem;
    margin: 0;
}

.auth-feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-top: 1.3rem;
}

.auth-feature-card {
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 75%, transparent);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    color: var(--text);
}

.auth-feature-card .muted {
    color: var(--muted);
}

.auth-feature-title {
    margin-bottom: 0.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-card {
    padding: 1.6rem;
    align-self: center;
}

.auth-card-header {
    margin-bottom: 1rem;
}

.auth-actions {
    margin-top: 0.6rem;
}

.auth-card-footer {
    margin-top: 1rem;
    font-size: 0.84rem;
}

.error {
    margin-top: 0.8rem;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--danger) 10%, var(--surface) 90%);
    border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border) 80%);
    color: var(--danger);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 24, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1.25rem;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
}

.modal {
    width: min(1040px, 100%);
    max-height: min(88vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
}

.modal-title {
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.modal-body {
    padding: 1rem 1.2rem 1.2rem;
    overflow: auto;
    background: color-mix(in srgb, var(--surface) 95%, var(--surface-muted) 5%);
}

.endpoint-switcher-label,
.user-menu-label {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.endpoint-pill {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

@media (max-width: 1200px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .dashboard-gauge-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .login-shell {
        padding: 1.25rem;
    }

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

    .auth-copy {
        padding: 0;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 320px);
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow-md);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-close,
    .shell-nav-toggle {
        display: inline-flex !important;
    }

    .app-topbar {
        padding: 0.95rem 1rem;
    }

    .app-content {
        padding: 1rem;
    }

    .panel {
        padding: 1rem;
    }

    .panel-header,
    .page-header,
    .games-pagination-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid,
    .assignment-layout,
    .assignment-toggle-grid,
    .dashboard-card-grid,
    .dashboard-secondary-grid,
    .grid,
    .games-grid,
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .toolbar,
    .games-pagination-actions,
    .analytics-tab-strip {
        width: 100%;
    }

    .filter-panel summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions .btn,
    .toolbar .btn,
    .games-pagination-actions .btn,
    .table-actions .btn {
        flex: 1 1 180px;
    }

    .modal {
        width: 100%;
        max-height: 100vh;
        height: auto;
        border-radius: 18px;
    }

    .modal-body {
        padding-bottom: 1.3rem;
    }

    .user-menu-popover {
        left: auto;
        right: 0;
        min-width: min(260px, calc(100vw - 2rem));
    }

    .dashboard-gauge-wrap {
        grid-template-columns: 1fr;
    }

    .dashboard-donut {
        margin: 0 auto;
    }

    .dashboard-pie-wrap {
        grid-template-columns: 1fr;
    }

    .dashboard-pie-chart {
        margin: 0 auto;
    }

    .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-topbar {
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-chip {
        order: 2;
    }

    .user-menu {
        margin-left: auto;
    }

    .auth-card {
        padding: 1.25rem;
    }

    .metric-card,
    .card,
    .panel {
        border-radius: 18px;
    }

    .table {
        font-size: 0.86rem;
    }

    .analytics-tab-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .analytics-tab-strip .btn {
        flex: 0 0 auto;
    }

    .analytics-chart {
        min-width: 880px;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.65rem;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .responsive-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.9rem;
    }

    .responsive-table tr {
        border: 1px solid var(--border);
        border-radius: 18px;
        background: color-mix(in srgb, var(--surface) 94%, var(--surface-muted) 6%);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .responsive-table td {
        border-bottom: 1px solid var(--border);
        padding: 0.8rem 0.9rem;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.35rem;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .responsive-table td[colspan]::before,
    .responsive-table td[data-label=""]::before {
        display: none;
    }

    .responsive-table .table-actions {
        width: 100%;
    }

    .responsive-table .table-actions .btn,
    .responsive-table .table-actions a.btn {
        flex: 1 1 140px;
    }

    .responsive-table .table-toggle-cell {
        padding-bottom: 0.6rem;
    }

    .responsive-table .table-toggle-cell::before {
        margin-bottom: 0.2rem;
    }

    .table-detail-row {
        margin-top: -0.35rem;
    }

.table-detail-row td {
    padding-top: 0.35rem;
}

.audit-log-value {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
}

.audit-log-value-details {
    width: 100%;
}

.audit-log-value-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    list-style: none;
}

.audit-log-value-details summary::-webkit-details-marker {
    display: none;
}

.audit-log-value-details[open] summary {
    margin-bottom: 0.5rem;
}

.table-subvalue {
    margin-top: 0.2rem;
    font-size: 0.74rem;
    color: var(--muted);
    word-break: break-word;
}

.table-subvalue-selectable {
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}
}

.audit-log-value {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
}

.audit-log-value-details {
    width: 100%;
}

.audit-log-value-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    list-style: none;
}

.audit-log-value-details summary::-webkit-details-marker {
    display: none;
}

.audit-log-value-details[open] summary {
    margin-bottom: 0.5rem;
}
