@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --ink: #090b10;
    --panel: #11151c;
    --panel-raised: #171c24;
    --paper: #f2f0e9;
    --muted: #9298a4;
    --accent: #c8ff39;
    --line: rgba(242, 240, 233, .12);
    --display: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
    --body: "DM Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.dashboard-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 3;
    display: flex;
    width: 244px;
    flex-direction: column;
    padding: 28px 18px 20px;
    border-right: 1px solid var(--line);
    background: #0c0f14;
}

.wordmark {
    display: inline-block;
    width: fit-content;
    color: var(--paper);
    font-family: var(--display);
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -.06em;
}

.wordmark span, h1 span { color: var(--accent); }
.sidebar-label, .eyebrow {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .18em;
}

.sidebar-label { margin: 43px 10px 12px; }
.side-nav { display: grid; gap: 5px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 43px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #b7bbc3;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    transition: background .15s ease, color .15s ease;
}

.nav-item span { width: 18px; color: #888e98; font-size: 16px; text-align: center; }
.nav-item:hover, .nav-item.active { background: rgba(200, 255, 57, .08); color: var(--paper); }
.nav-item.active { border-color: rgba(200, 255, 57, .2); }
.nav-item.active span { color: var(--accent); }

.sidebar-bottom {
    display: grid;
    grid-template-columns: 10px 1fr;
    align-items: center;
    gap: 4px 8px;
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid var(--line);
    color: #b7bbc3;
    font-size: 10px;
}

.sidebar-bottom a { grid-column: 2; margin-top: 9px; color: var(--muted); }
.sidebar-bottom a:hover, .text-button:hover, .back-link:hover { color: var(--accent); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(200, 255, 57, .5); }

.main-content { max-width: 1600px; margin-left: 244px; padding: 0 5.2% 70px; }
.topbar { display: flex; min-height: 92px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h2 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 600; text-transform: uppercase; }
.user-area { display: flex; align-items: center; gap: 10px; color: #c5c8cf; font-size: 11px; }
.user-area img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.quiet-button, .secondary-button, .text-button {
    border: 1px solid var(--line);
    background: transparent;
    color: #c7c9ce;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.quiet-button { margin-left: 6px; padding: 8px 11px; font-size: 10px; }
.quiet-button:hover, .secondary-button:hover { border-color: var(--accent); color: var(--accent); }
.welcome-row, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 35px 0 22px; }
.welcome-row .eyebrow, .section-heading .eyebrow { margin: 0 0 6px; }
h1, h3 { margin: 0; font-family: var(--display); text-transform: uppercase; }
.welcome-row h1, .section-heading h1 { font-size: clamp(36px, 4vw, 52px); font-weight: 700; line-height: .96; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { min-height: 104px; padding: 17px 18px; border: 1px solid var(--line); background: linear-gradient(145deg, #151a22, #101319); }
.stat-card span { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 10px; font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; }

.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-heading .eyebrow { margin: 0 0 4px; }
.panel-heading h3 { font-size: 23px; font-weight: 600; }
.text-button { padding: 0; border: 0; color: var(--muted); font-size: 10px; }
.count-pill { padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 10px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); align-items: start; gap: 15px; }
.stack { display: grid; gap: 15px; }
.match-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-section { display: none; padding-top: 1px; }
.page-section.active { display: block; }
.loading-state { padding: 30px 0; color: var(--muted); font-size: 12px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 11px 9px; border-bottom: 1px solid rgba(242, 240, 233, .07); color: #d3d5d9; font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.team-name { color: var(--paper); font-weight: 600; }
.team-id { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.empty-state { padding: 22px 10px; color: var(--muted); font-size: 11px; text-align: center; }
.table-actions { display: flex; gap: 6px; }
.small-button { padding: 6px 8px; border: 1px solid var(--line); background: transparent; color: #c8cad0; cursor: pointer; font-size: 9px; white-space: nowrap; }
.small-button:hover { border-color: var(--accent); color: var(--accent); }
.small-button.danger:hover { border-color: #ff685c; color: #ff8078; }

.form-stack { display: grid; gap: 13px; }
label { display: grid; gap: 6px; color: #c5c8cf; font-size: 10px; font-weight: 600; }
input, select, textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 2px;
    outline: none;
    background: #0c1016;
    color: var(--paper);
    font-size: 11px;
}
input:focus, select:focus, textarea:focus { border-color: rgba(200, 255, 57, .7); box-shadow: 0 0 0 2px rgba(200, 255, 57, .08); }
input::placeholder, textarea::placeholder { color: #656b76; }
textarea { resize: vertical; }
.primary-button, .secondary-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 17px; padding: 0 13px; font-size: 10px; font-weight: 700; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: var(--ink); cursor: pointer; }
.primary-button:hover { background: #d6ff72; }
.secondary-button { min-height: 34px; padding: 0 11px; }
.discord-button { min-height: 46px; }
.optional, .field-help { color: var(--muted); font-size: 9px; font-weight: 400; }
.field-help { margin: -4px 0 0; line-height: 1.6; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }

.league-list { display: grid; gap: 9px; }
.league-card { padding: 13px; border: 1px solid var(--line); background: #0e1218; }
.league-card.active-league { border-color: rgba(200, 255, 57, .4); }
.league-card-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.league-card h4 { margin: 0; color: var(--paper); font-family: var(--display); font-size: 20px; font-weight: 600; text-transform: uppercase; }
.league-meta { margin: 5px 0 12px; color: var(--muted); font-size: 9px; }
.league-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.league-tools { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 10px; }
.league-tools input { padding: 7px 8px; }

.fixture-games { display: grid; gap: 6px; }
.fixture-game { display: grid; grid-template-columns: 26px 1fr 1fr; align-items: center; gap: 7px; }
.fixture-game span { color: var(--muted); font-size: 9px; }
.fixture-game select { padding: 8px 7px; font-size: 10px; }
.pool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 16px 0; }
.pool-row { display: grid; grid-template-columns: 22px 1fr 1fr; align-items: center; gap: 7px; }
.pool-row span { color: var(--muted); font-size: 9px; }
.pool-row input { padding: 8px; }

.notice { position: sticky; z-index: 2; top: 12px; margin: 14px 0 -7px; padding: 11px 14px; border: 1px solid rgba(200, 255, 57, .35); background: #171f10; color: var(--paper); font-size: 11px; }
.notice.error { border-color: rgba(255, 104, 92, .45); background: #241311; }
.notice a { text-decoration: underline; }
.notice[hidden] { display: none; }
.login-view { display: grid; min-height: 100vh; place-items: center; padding: 25px; background: radial-gradient(ellipse at 70% 20%, #20252b 0, var(--ink) 52%); }
.login-card { width: min(440px, 100%); padding: 34px; border: 1px solid var(--line); background: rgba(17, 21, 28, .94); box-shadow: 0 30px 90px rgba(0, 0, 0, .35); }
.login-card .eyebrow { margin: 48px 0 9px; }
.login-card h1 { margin-bottom: 17px; font-size: 56px; line-height: .86; }
.login-copy { margin-bottom: 23px; color: #a7abb4; font-size: 12px; line-height: 1.7; }
.login-card .primary-button { width: 100%; }
.login-message { min-height: 16px; margin: 13px 0 3px; color: #ff928a; font-size: 10px; }
.back-link { color: var(--muted); font-size: 10px; }

@media (max-width: 1050px) {
    .sidebar { width: 205px; }
    .main-content { margin-left: 205px; padding-right: 3.5%; padding-left: 3.5%; }
    .content-grid { grid-template-columns: minmax(0, 1.15fr) minmax(250px, .85fr); }
    .match-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .sidebar { position: sticky; top: 0; width: 100%; height: auto; padding: 10px 13px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar .wordmark { font-size: 26px; }
    .sidebar-label, .sidebar-bottom { display: none; }
    .side-nav { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
    .nav-item { width: auto; min-width: max-content; min-height: 34px; gap: 6px; padding: 0 9px; font-size: 10px; }
    .nav-item span { font-size: 12px; }
    .main-content { margin: 0; padding: 0 14px 45px; }
    .topbar { min-height: 66px; }
    .topbar .eyebrow { font-size: 7px; }
    .topbar h2 { font-size: 20px; }
    .user-area { gap: 6px; font-size: 9px; }
    .user-area img { width: 23px; height: 23px; }
    .quiet-button { padding: 6px 7px; font-size: 9px; }
    .welcome-row, .section-heading { align-items: start; margin-top: 25px; }
    .welcome-row h1, .section-heading h1 { font-size: 38px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat-card { min-height: 84px; padding: 13px; }
    .stat-card strong { font-size: 25px; }
    .content-grid, .match-grid { grid-template-columns: 1fr; }
    .panel { padding: 15px; }
    .panel-heading h3 { font-size: 20px; }
    .pool-grid { grid-template-columns: 1fr; }
    .two-col { gap: 7px; }
    .two-col label { font-size: 9px; }
}
