:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    --nav: #086d95;
    --nav-dark: #075c81;
    --primary: #0879a8;
    --primary-hover: #065e86;
    --ink: #12344a;
    --muted: #4f6b7b;
    --line: #c6dfeb;
    --canvas: #e6f2f8;
    --paper: #fff;
    background: var(--canvas);
    color: var(--ink);
    font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 3px solid #3ca9dd; outline-offset: 3px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.brand-icon { display: block; width: 40px; height: 40px; flex: none; }
.initial-loading { display: grid; min-height: 100vh; place-items: center; color: var(--primary); font-weight: 650; }

.admin-shell { display: grid; min-height: 100vh; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; background: linear-gradient(160deg, var(--nav), var(--nav-dark)); color: #fff; --slider-fill: var(--nav); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 82px; padding: 12px 20px; color: #fff; border-bottom: 1px solid #ffffff2e; }
.brand-icon { color: #e1f5ff; }
.brand-type { font-size: 22px; font-weight: 750; letter-spacing: -.6px; line-height: 1.1; }
.brand-type small { display: block; margin-top: 5px; color: #cfeefa; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.sidebar-nav { display: grid; align-content: start; gap: 4px; padding: 17px 11px; overflow: auto; }
.sidebar-nav a, .sidebar-bottom a, .sidebar-bottom button { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 9px 11px; border: 1px solid transparent; border-radius: 8px; color: #eef9ff; font-size: 14px; font-weight: 600; white-space: nowrap; }
.sidebar-nav a .icon, .sidebar-bottom .icon { width: 18px; height: 18px; color: #d5f0fb; }
.sidebar-nav a:hover, .sidebar-bottom a:hover, .sidebar-bottom button:hover { background: #ffffff19; }
.sidebar-nav [aria-current="page"] { border-color: #8ed5ee59; color: #fff; background: #03476682; box-shadow: inset 3px 0 #9ce7ff; }
.sidebar-nav [aria-current="page"] .icon { color: #fff; }
.sidebar-bottom { margin-top: auto; padding: 12px 11px; border-top: 1px solid #ffffff24; }
.sidebar-bottom button { width: 100%; text-align: left; background: transparent; }

.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; padding: 0 30px; background: #087da7; color: white; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.breadcrumb span { color: #f1fbff; }
.breadcrumb .icon { width: 14px; height: 14px; color: #dbf3fc; }
.account { display: flex; align-items: center; gap: 9px; min-width: 0; text-align: right; }
.account strong, .account small { display: block; line-height: 1.2; }
.account strong { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account small { margin-top: 2px; color: #e0f6ff; font-size: 11px; }
.avatar { display: grid; flex: none; width: 37px; height: 37px; place-items: center; border: 1px solid #b3e7f6; border-radius: 100%; background: #035779; color: white; font-size: 14px; font-weight: 750; }
.main-content { max-width: 1680px; min-height: calc(100vh - 62px); margin: 0 auto; padding: 28px 30px 48px; }
.main-content:focus { outline: none; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 22px; }
h1, h2, h3, p { margin: 0; }
h1 { color: #0a3c56; font-size: clamp(26px, 3.4vw, 33px); font-weight: 760; letter-spacing: -.025em; line-height: 1.15; }
h2 { color: #123e56; font-size: 17px; letter-spacing: -.015em; }
.page-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; border: 1px solid #aed3e6; border-radius: 8px; padding: 8px 13px; background: var(--paper); color: #076b96; font-size: 13px; font-weight: 680; line-height: 1.25; white-space: nowrap; }
.button:hover, .icon-button:hover { border-color: #7abedb; background: #f1faff; }
.button .icon, .icon-button .icon { width: 17px; height: 17px; }
.button-primary { border-color: var(--primary); background: var(--primary); color: white; }
.button-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.button-small { min-height: 34px; padding: 5px 9px; }
.icon-button { width: 36px; min-height: 36px; padding: 0; }
.text-link { display: inline-flex; align-items: center; gap: 3px; color: #076b96; font-size: 13px; font-weight: 700; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.text-link .icon { width: 15px; height: 15px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: 0 2px 5px #16577908; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; min-height: 115px; gap: 8px; padding: 16px; }
.metric-label { align-self: center; color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-value { grid-column: 1; align-self: end; overflow-wrap: anywhere; color: #075c85; font-size: 30px; font-weight: 740; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-icon { display: grid; grid-column: 2; grid-row: 1 / span 2; align-self: start; width: 38px; height: 38px; place-items: center; border: 1px solid #d9ebf3; border-radius: 8px; background: #eef8fc; color: #0879a8; --slider-fill: #eef8fc; }
.metric-icon .icon { width: 19px; height: 19px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 63px; padding: 13px 16px; }
.panel-head p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.table-scroll { overflow: auto; border-radius: 0 0 11px 11px; }
table { width: 100%; border-spacing: 0; text-align: left; font-size: 13px; }
th { border-top: 1px solid #d8eaf2; border-bottom: 1px solid #d8eaf2; background: #f0f8fb; color: #446878; font-size: 11px; font-weight: 730; letter-spacing: .04em; line-height: 1.3; text-transform: uppercase; }
th, td { padding: 10px 14px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 17px; }
th:last-child, td:last-child { padding-right: 17px; }
td { height: 53px; border-bottom: 1px solid #e2edf2; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fbfdfe; }
tbody tr:hover { background: #f1faff; }
.table-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.team-pair, .team-side, .competition-name { display: inline-flex; align-items: center; gap: 7px; }
.team-side { min-width: 0; color: #19425b; }
.team-side strong { font-weight: 670; }
.team-versus { color: #658294; font-size: 10px; font-weight: 550; }
.crest { position: relative; display: inline-grid; flex: none; width: 30px; height: 30px; place-items: center; overflow: hidden; border: 1px solid #c9dee9; border-radius: 7px; background: #f2f8fc; color: #315c76; font-size: 9px; font-weight: 800; }
.crest-image { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: contain; opacity: 0; }
.crest-image.is-loaded { opacity: 1; }
.crest-image.is-loaded + .crest-initials { visibility: hidden; }
.competition-name .crest { width: 20px; height: 20px; border-radius: 4px; font-size: 7px; }
.editor .team-pair { flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 5px; max-width: max-content; border-radius: 20px; padding: 4px 8px; background: #edf5fa; color: #315d76; font-size: 11px; font-weight: 720; white-space: nowrap; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-live, .status-lost, .status-disabled { background: #fcecf0; color: #a4274a; }
.status-finished, .status-won, .status-enabled, .status-configured { background: #e5f6ee; color: #126745; }
.status-pending, .status-partial, .status-suspended, .status-paused { background: #fff2dc; color: #7e5716; }
.table-action { text-align: right; }
.numeric { font-variant-numeric: tabular-nums; }
.empty { padding: 28px 18px; color: var(--muted); font-size: 14px; text-align: center; }
.table-filter { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid #e2eff5; }
.table-filter .search-field { display: flex; position: relative; width: min(330px, 100%); }
.table-filter .search-field .icon { position: absolute; top: 12px; left: 10px; width: 16px; height: 16px; color: #668899; pointer-events: none; }
.table-filter input[type="search"] { padding-left: 35px; }
.table-filter select { width: auto; }
.pager { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: 1px solid #e2edf2; color: var(--muted); font-size: 12px; }
.pager-controls { display: flex; gap: 6px; }
.pager-controls button:disabled { cursor: default; }
.feed-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 18px 16px; border-top: 1px solid #e3eef4; }
.feed-details dt { color: var(--muted); font-size: 12px; }
.feed-details dd { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--ink); font-size: 14px; font-weight: 660; }
.feed-note { padding: 14px 16px; border-top: 1px solid #e3eef4; color: var(--muted); font-size: 13px; line-height: 1.5; }

.editor { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: auto; border: 1px solid #add2e3; border-radius: 13px; background: white; color: var(--ink); box-shadow: 0 18px 55px #07384932; }
.editor::backdrop { background: #0a344c88; }
.editor-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 19px; border-bottom: 1px solid #dbeaf0; }
.editor-body { display: grid; gap: 13px; padding: 19px; }
.editor-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 19px; border-top: 1px solid #dbeaf0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-stack { display: grid; gap: 14px; }
label { display: block; min-width: 0; color: #234a60; font-size: 13px; font-weight: 650; }
label > input, label > select, label > textarea { margin-top: 5px; }
input, select, textarea { display: block; width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #b6d1df; border-radius: 7px; background: white; color: var(--ink); font-size: 14px; }
input[type="checkbox"] { display: inline-block; width: 16px; min-height: 16px; margin: 0; accent-color: var(--primary); }
.check-field { display: flex; align-items: center; gap: 7px; }
.field-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-error { border-radius: 7px; padding: 9px 11px; background: #fff0f3; color: #982141; font-size: 13px; line-height: 1.45; }
.editor .form-error { margin: 0 19px 13px; }
.toast { position: fixed; z-index: 2; left: 50%; bottom: 20px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); padding: 12px 16px; border-radius: 9px; background: #123d54; color: white; font-size: 13px; box-shadow: 0 6px 20px #18374934; }
.toast[data-type="error"] { background: #8a2341; }

.login-screen { position: relative; display: grid; min-height: 100vh; place-items: center; padding: 80px 18px 35px; background: radial-gradient(circle at 70% 18%, #117a9e, transparent 48%), linear-gradient(135deg, #065373, #0b7396); }
.login-back { position: absolute; top: 20px; left: 20px; display: inline-flex; align-items: center; gap: 8px; color: white; font-size: 14px; font-weight: 680; }
.login-back:hover { text-decoration: underline; }
.login-back .icon { width: 16px; height: 16px; }
.login-card { width: min(100%, 400px); border: 1px solid #d8eef6; border-radius: 15px; padding: 28px; background: white; box-shadow: 0 18px 55px #0032443b; }
.login-card .brand-icon { margin-bottom: 18px; color: #b7e8fc; }
.login-card h1 { font-size: 27px; }
.login-card p:not(.form-error) { margin: 7px 0 21px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-card button { margin-top: 4px; }
.bet-details { display: grid; gap: 10px; margin: 0; padding: 0; list-style-type: none; }
.bet-details li { display: grid; gap: 5px; padding: 10px 12px; border: 1px solid #dbeaf1; border-radius: 7px; background: #f8fcfe; font-size: 13px; }

@media (max-width: 1100px) {
    .admin-shell { grid-template-columns: 192px minmax(0, 1fr); }
    .topbar { padding-inline: 20px; }
    .main-content { padding-inline: 20px; }
}

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

@media (max-width: 650px) {
    .admin-shell { display: block; }
    .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; height: auto; }
    .brand { min-height: 62px; padding: 8px 14px; border: 0; }
    .brand .brand-icon { width: 35px; height: 35px; }
    .brand-type { font-size: 18px; }
    .brand-type small { margin-top: 4px; font-size: 8px; }
    .sidebar-nav { order: 2; grid-column: 1 / -1; display: flex; gap: 4px; padding: 6px 10px 9px; border-top: 1px solid #ffffff24; }
    .sidebar-nav a { min-height: 38px; padding: 7px 9px; font-size: 12px; }
    .sidebar-nav a .icon { width: 15px; height: 15px; }
    .sidebar-bottom { display: flex; align-self: center; gap: 1px; margin: 0; padding: 0 8px 0 0; border: 0; }
    .sidebar-bottom a, .sidebar-bottom button { gap: 5px; min-height: 36px; padding: 6px; font-size: 11px; }
    .sidebar-bottom .icon { width: 14px; height: 14px; }
    .topbar { min-height: 42px; padding: 0 13px; }
    .account small, .breadcrumb span, .breadcrumb .icon { display: none; }
    .avatar { width: 26px; height: 26px; font-size: 11px; }
    .account strong, .breadcrumb { font-size: 12px; }
    .main-content { min-height: auto; padding: 19px 12px 30px; }
    .page-heading { flex-wrap: wrap; margin-bottom: 16px; }
    .page-actions .button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
    .stats-grid { margin-bottom: 15px; gap: 8px; }
    .metric { min-height: 95px; padding: 11px; }
    .metric-icon { width: 29px; height: 29px; }
    .metric-icon .icon { width: 16px; height: 16px; }
    .metric-value { font-size: 24px; }
    .metric-label { font-size: 12px; }
    .table-filter .search-field { width: 100%; }
    .feed-details { grid-template-columns: 1fr; }
}
