:root {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #142238;
    background: #f2f5f9;
    line-height: 1.5;
    --navy: #0d233f;
    --border: #dfe5ed;
    --muted: #536783;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 17rem minmax(0, 1fr); }
.sidebar { background: var(--navy); color: #fff; padding: 1.5rem; }
.brand { color: inherit; font-size: 1.4rem; font-weight: 700; text-decoration: none; }
.sidebar-menu { margin-top: 1rem; }
.sidebar-menu summary { color: #d4a72c; cursor: pointer; font-weight: 700; }
.sidebar nav ul { list-style: none; padding: 0; margin: .5rem 0; }
.sidebar nav .sidebar-menu ul { margin-inline-start: .7rem; }
.sidebar nav a { display: block; color: #fff; padding: .55rem .65rem; border-radius: .4rem; text-decoration: none; overflow-wrap: anywhere; }
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] { background: #1c4874; }

main { min-width: 0; padding: clamp(1rem, 2vw, 2rem); }
.topbar, .account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.topbar { margin-bottom: 1.75rem; }
.page-heading { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.page-heading img { display: block; flex: none; width: clamp(2.75rem, 8vw, 4.5rem); height: auto; border-radius: .35rem; }
.account { justify-content: flex-end; }
.account form { margin: 0; }
h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.2; margin: 0; font-weight: 750; overflow-wrap: anywhere; }
h2 { font-size: 1.35rem; margin: 0 0 1rem; }
.role { background: #e2e8f0; border-radius: 999px; padding: .2rem .6rem; font-size: .8rem; white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: .9rem; padding: 1.1rem; box-shadow: 0 2px 4px #1422380a; }
.metric { display: flex; flex-direction: column; gap: .35rem; }
.metric span { font-size: .9rem; color: var(--muted); }
.metric strong { font-size: 1.95rem; line-height: 1.2; }
.games { padding-top: 1.65rem; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.games table { min-width: 31rem; }
th, td { padding: .75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f4f6f8; }
.empty { color: var(--muted); }

.form { max-width: 32rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .9rem; }
input, select { display: block; color: inherit; padding: .65rem .75rem; border: 1px solid #8b9ab0; border-radius: .4rem; width: 100%; margin-top: .25rem; font: inherit; }
.menu-editor { max-width: 44rem; display: grid; gap: .75rem; }
.menu-editor summary { cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.menu-editor-form { margin-top: 1rem; }
.menu-editor-form button { margin: 0 .25rem .35rem 0; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { flex: none; width: 1rem; height: 1rem; margin: 0; }
button { color: #fff; padding: .6rem .85rem; background: #1c4874; border: 1px solid transparent; border-radius: .5rem; cursor: pointer; font: inherit; font-weight: 650; }
button:hover { background: #13395e; }
.secondary { color: #173654; background: #fff; border-color: #acb9cb; }
.secondary:hover { background: #e3ebf4; }
a { color: #164779; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #2971b8; outline-offset: 3px; }
.message { padding: .75rem 1rem; border-radius: .5rem; background: #e2eee8; }
.error { background: #f9e4e4; color: #742526; }

@media (max-width: 1050px) {
    body { grid-template-columns: 12rem minmax(0, 1fr); }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
}

@media (max-width: 680px) {
    body { display: block; }
    .sidebar { padding: .8rem 1rem; }
    .topbar { margin-bottom: 1.2rem; }
    .account { width: 100%; justify-content: flex-start; overflow-wrap: anywhere; }
    .account a { display: inline-flex; align-items: center; min-height: 44px; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
    .panel { padding: .85rem; }
}

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