:root {
    color-scheme: light dark;
    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-2: #f0f0f7;
    --border: #e6e6f0;
    --fg: #17171f;
    --muted: #6b6b80;
    --accent: #7c3aed;
    --accent-2: #3b82f6;
    --danger: #e11d48;
    --danger-bg: rgba(225, 29, 72, .1);
    --positive: #059669;
    --positive-bg: rgba(5, 150, 105, .1);
    --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 10px 30px -12px rgba(20, 20, 40, .12);
    --radius-sm: .55rem;
    --radius-lg: 1.1rem;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c0c12;
        --surface: #15151f;
        --surface-2: #1c1c29;
        --border: #262636;
        --fg: #f1f1f6;
        --muted: #8f8fa6;
        --accent: #8b5cf6;
        --accent-2: #60a5fa;
        --danger: #fb7185;
        --danger-bg: rgba(251, 113, 133, .12);
        --positive: #34d399;
        --positive-bg: rgba(52, 211, 153, .12);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .6);
    }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font: 15px/1.55 -apple-system, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
    color: var(--fg);
    background: var(--bg);
}
a { color: inherit; }

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

.sidebar {
    width: 15.5rem; flex: none; display: flex; flex-direction: column;
    padding: 1.5rem 1.15rem; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; padding: 0 .35rem; }
.brand-mark {
    width: 2rem; height: 2rem; border-radius: .65rem; flex: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; box-shadow: var(--shadow);
}
.brand-name { font-weight: 650; letter-spacing: -.01em; }

.nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem;
    border-radius: var(--radius-sm); text-decoration: none; color: var(--muted);
    font-size: .9rem; font-weight: 500; transition: background-color .15s ease, color .15s ease;
}
.nav-item .icon { width: 1.05rem; height: 1.05rem; }
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.on { background: var(--surface-2); color: var(--accent); }

.signout { margin: 0; }
.signout .nav-item { width: 100%; border: none; background: none; font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 22rem; display: flex; flex-direction: column; gap: 1rem; padding: 1.75rem; }
.login-card .brand { margin-bottom: .5rem; }
.login-card label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; color: var(--muted); }
.login-card input {
    padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--fg); font: inherit; font-size: .95rem;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-button {
    margin-top: .25rem; padding: .65rem 1rem; border: none; border-radius: var(--radius-sm); cursor: pointer;
    font: inherit; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.login-error { margin: 0; padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .85rem; color: var(--danger); background: var(--danger-bg); }

.content { flex: 1; min-width: 0; padding: 2.75rem 3rem 4rem; max-width: 72rem; }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { margin: 0 0 .3rem; font-size: 1.55rem; letter-spacing: -.02em; }
.page-sub { margin: 0; color: var(--muted); font-size: .9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.35rem; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.35rem; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.card-header h2 { margin: 0; font-size: .82rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card-icon { display: flex; color: var(--accent); }
.card-icon .icon { width: 1.05rem; height: 1.05rem; }

.card-wide { grid-column: span 2; }
.muted { margin: 0; color: var(--muted); font-size: .88rem; }

.games { list-style: none; margin: 0; padding: 0; }
.games li { display: flex; align-items: center; gap: .85rem; padding: .6rem 0; }
.games li:not(:last-child) { border-bottom: 1px solid var(--border); }
.games img {
    display: block; width: 7.7rem; height: 2.9rem; object-fit: cover; flex: none;
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.game-info { display: flex; flex-direction: column; min-width: 0; }
.game-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.game-name:hover { color: var(--accent); }
.game-meta { color: var(--muted); font-size: .82rem; }
.games-total { margin: .75rem 0 0; color: var(--muted); font-size: .82rem; }
.games-synced { margin: .35rem 0 0; color: var(--muted); font-size: .75rem; opacity: .75; }

.section-title {
    margin: 2rem 0 .9rem; font-size: .82rem; font-weight: 650; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted);
}
.section-title:first-child { margin-top: 0; }

.badge {
    margin-left: auto; font-size: .7rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
    padding: .15rem .5rem; border-radius: 999px; color: var(--muted); background: var(--surface-2);
}
.badge.ok { color: var(--positive); background: var(--positive-bg); }
.badge.failed { color: var(--danger); background: var(--danger-bg); }

.facts { display: grid; grid-template-columns: fit-content(50%) 1fr; gap: .4rem 1rem; margin: 0; font-size: .86rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.runs { margin-top: 1.35rem; }
.split { display: grid; grid-template-columns: minmax(16rem, 1fr) 2fr; gap: 1.35rem; align-items: start; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .76rem; padding: 0 .75rem .5rem 0; }
td { padding: .5rem .75rem .5rem 0; border-top: 1px solid var(--border); vertical-align: top; }
td .badge { margin-left: 0; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { padding-right: .75rem; }
tfoot td { font-weight: 650; }


@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%; flex-direction: row; align-items: center;
        border-right: none; border-bottom: 1px solid var(--border); padding: .85rem 1rem;
    }
    .brand { margin-bottom: 0; }
    .nav { flex-direction: row; flex: none; margin-left: auto; gap: .1rem; }
    .nav-item span:last-child { display: none; }
    .signout .nav-item { width: auto; }
    .content { padding: 1.5rem 1rem 3rem; }
    .split { grid-template-columns: 1fr; }
    .card-wide { grid-column: auto; }
    .games img { width: 5.5rem; height: 2.1rem; }
}
