/* ==========================================================================
   Prague Lions Ranking - Minimalist Blue Theme
   ========================================================================== */

/* Import font - Open Sans (same as Ultiworld) */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,600;1,700&display=swap');

/* Color palette - shades of blue only */
:root {
    --blue-900: #1e3a5f;
    --blue-800: #234b7a;
    --blue-700: #2a5d96;
    --blue-600: #3572b0;
    --blue-500: #4a90d9;
    --blue-400: #7eb3eb;
    --blue-300: #a8cef2;
    --blue-200: #d1e5f9;
    --blue-100: #e8f2fc;
    --blue-50: #f4f9fe;

    --gray-900: #1a1a2e;
    --gray-700: #4a4a5a;
    --gray-500: #6b6b7a;
    --gray-400: #9090a0;
    --gray-300: #c0c0cc;
    --gray-200: #e0e0e8;
    --gray-100: #f0f0f4;
    --gray-50: #f8f8fa;

    --white: #ffffff;
}

/* Reset & Base
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--white);
    color: black;
    min-height: 100vh;
    line-height: 1.5;
    font-size: 16px;
}

@media only screen and (max-width: 500px) {
    body {
        font-size: 14px;
    }
}

/* Layout
   ========================================================================== */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.container--wide {
    max-width: 900px;
}

.container--narrow {
    max-width: 600px;
}

/* Header
   ========================================================================== */
.header {
    background: var(--blue-900);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-btn {
    color: var(--blue-200);
    text-decoration: none;
    padding: 0.5rem 0.875rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.header-btn.btn-primary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.header-btn.btn-home {
    color: var(--white);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.header-btn.btn-home:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.header-btn.btn-secondary {
    color: var(--blue-300);
}

.logout-btn {
    color: var(--blue-300);
    text-decoration: none;
    padding: 0.5rem 0.875rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

/* Card
   ========================================================================== */
.card {
    background: var(--white);
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gray-900);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.card p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-loading,
.chart-empty {
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 2rem 0;
    text-align: center;
}

.match-popup {
    position: absolute;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    font-size: 0.8125rem;
    z-index: 10;
    min-width: 150px;
    pointer-events: auto;
}

.popup-date {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--gray-100);
}

.popup-match {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.15rem 0;
    color: var(--gray-700);
}

.popup-match a {
    color: var(--blue-600);
    text-decoration: none;
}

.popup-match a:hover {
    text-decoration: underline;
}

.delta-pos { color: #2e7d32; font-weight: 600; }
.delta-neg { color: #c62828; font-weight: 600; }

.match-delta {
    font-size: 0.8rem;
    font-weight: 600;
}

.match-delta.delta-pos { color: #2e7d32; }
.match-delta.delta-neg { color: #c62828; }

.calc-ratings-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.calc-note {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Buttons
   ========================================================================== */
button {
    padding: 0.5rem 1rem;
    background: var(--blue-600);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover {
    background: var(--blue-700);
}

button[type="submit"] {
    padding: 0.625rem 1.25rem;
}

.btn-back {
    background: transparent;
    color: var(--blue-600);
    border: 1px solid var(--blue-200);
}

.btn-back:hover {
    background: var(--blue-50);
}

.btn-new {
    padding: 0.5rem 1rem;
    background: var(--blue-600);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-new:hover {
    background: var(--blue-700);
}

.btn-cancel {
    padding: 0.625rem 1.25rem;
    background: transparent;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--gray-300);
}

.btn-cancel:hover {
    background: var(--gray-100);
}

.btn-view {
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: var(--blue-600);
    border: 1px solid var(--blue-200);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-view:hover {
    background: var(--blue-50);
}

.btn-score {
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: var(--blue-600);
    border: 1px solid var(--blue-200);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn-score:hover {
    background: var(--blue-50);
}

.btn-reset {
    padding: 0.375rem 0.625rem;
    background: transparent;
    color: var(--blue-600);
    border: 1px solid var(--blue-200);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.5rem;
}

.btn-reset:hover {
    background: var(--blue-50);
}

.btn-delete {
    padding: 0.375rem 0.625rem;
    background: transparent;
    color: var(--blue-800);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-delete:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.btn-delete--large {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.nav-link {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background: var(--blue-600);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    margin-right: 0.5rem;
}

.nav-link:hover {
    background: var(--blue-700);
}

.nav-section {
    margin-bottom: 1.5rem;
}

/* Forms
   ========================================================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group--large {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue-500);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.form-actions--center {
    justify-content: center;
}

/* Alerts
   ========================================================================== */
.error {
    background: var(--blue-100);
    color: var(--blue-900);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--blue-600);
    font-size: 0.875rem;
}

.success {
    background: var(--blue-50);
    color: var(--blue-900);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--blue-500);
    font-size: 0.875rem;
}

.success strong {
    display: block;
    margin-bottom: 0.375rem;
}

/* Login Page
   ========================================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
}

.login-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    width: 100%;
    max-width: 360px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
    font-size: 1.25rem;
    font-weight: 600;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    padding: 0.625rem 0.75rem;
}

.login-container button {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
}

/* Tables
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.actions {
    white-space: nowrap;
}

/* TBD placeholder
   ========================================================================== */
.tbd {
    color: var(--gray-400);
    font-weight: 400;
    font-size: 0.8125rem;
}

/* Role Badges
   ========================================================================== */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.role-admin {
    background: var(--blue-100);
    color: var(--blue-800);
}

.role-user {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Password Display
   ========================================================================== */
.password-display {
    display: inline-block;
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.8125rem;
    word-break: break-all;
    max-width: 100%;
    vertical-align: middle;
}

/* Match Timeline
   ========================================================================== */
.timeline {
    position: relative;
}

.match-item {
    position: relative;
    padding: 1.125rem 1.5rem;
    background: var(--white);
    border-radius: 6px;
    margin-bottom: 0.625rem;
    border-left: 3px solid var(--blue-500);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.match-item.no-score {
    border-left-color: var(--blue-200);
}

.match-date {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-bottom: 0.625rem;
    letter-spacing: 0.02em;
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.team {
    flex: 1;
    min-width: 150px;
}

.team-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    margin-bottom: 0.375rem;
}

.team-players {
    font-weight: 500;
    color: var(--gray-900);
    font-size: 0.9375rem;
}

.vs {
    font-weight: 700;
    color: var(--gray-300);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.match-score {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    padding: 0 1rem;
    font-variant-numeric: tabular-nums;
}

.match-score--pending {
    font-size: 0.875rem;
    color: var(--gray-400);
    font-weight: 500;
}

.match-notes {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
    font-style: italic;
}

.match-actions {
    margin-top: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.insert-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px dashed var(--gray-300);
    border-radius: 4px;
    color: var(--gray-400);
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.15s;
    text-decoration: none;
    text-align: center;
    font-size: 0.8125rem;
}

.insert-btn:hover {
    border-color: var(--blue-400);
    color: var(--blue-600);
    background: var(--blue-50);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Inline Score Form (match list)
   ========================================================================== */
.score-form-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.score-form-inline input[type="number"] {
    width: 50px;
    padding: 0.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    text-align: center;
    font-family: inherit;
    font-size: 0.875rem;
}

.score-form-inline button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* Match Form - Teams
   ========================================================================== */
.teams-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.team-section {
    background: var(--gray-50);
    border-radius: 4px;
    padding: 1rem;
    border-left: 3px solid var(--blue-400);
}

.team-section h3 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.team-section.team-a {
    border-left-color: var(--blue-500);
}

.team-section.team-b {
    border-left-color: var(--blue-700);
}

/* Player Search
   ========================================================================== */
.player-search {
    position: relative;
    margin-bottom: 1rem;
}

.player-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.search-result-item:hover {
    background: var(--blue-50);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item--empty {
    color: var(--gray-400);
    cursor: default;
}

.search-result-item--empty:hover {
    background: transparent;
}

/* Selected Players
   ========================================================================== */
.selected-players {
    min-height: 50px;
}

.player-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--blue-100);
    color: var(--blue-800);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.player-tag .remove-btn {
    background: none;
    border: none;
    color: var(--blue-600);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0;
}

.player-tag .remove-btn:hover {
    color: var(--blue-900);
}

.no-players {
    color: var(--gray-400);
    font-style: italic;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

/* Match Detail
   ========================================================================== */
.match-info {
    margin-bottom: 1.5rem;
}

.match-info .match-date {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.match-info .match-notes {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 4px;
    font-style: italic;
    color: var(--gray-600);
    margin-bottom: 1rem;
    margin-top: 0;
    font-size: 0.875rem;
}

.match-date-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.teams-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.team-box {
    background: var(--gray-50);
    border-radius: 4px;
    padding: 1rem;
}

.team-avg-before {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.team-box .team-players {
    font-weight: 500;
}

.team-box .team-players li {
    list-style: none;
    padding: 0.25rem 0;
    color: var(--gray-900);
}

.score-display {
    text-align: center;
    padding-top: 1.5rem;
}

.score-display .score {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

.score-display .no-score {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Score Form (detail page)
   ========================================================================== */
.score-form {
    background: var(--gray-50);
    border-radius: 4px;
    padding: 1rem;
}

.score-form h3 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.score-input-group {
    text-align: center;
}

.score-input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.score-input-group input {
    width: 70px;
    padding: 0.625rem;
    font-size: 1.25rem;
    text-align: center;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
}

.score-separator {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-500);
}

/* Match filter bar
   ========================================================================== */
.match-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-player-input {
    width: 160px;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--gray-900);
    background: var(--white);
}

.filter-player-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.filter-relation {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
}

.filter-relation:focus {
    outline: none;
    border-color: var(--blue-500);
}

.filter-outcomes {
    gap: 0.25rem;
}

.filter-outcome-btn {
    padding: 0.3rem 0.75rem;
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.filter-outcome-btn:hover {
    border-color: var(--blue-400);
    color: var(--blue-700);
    background: var(--blue-50);
}

.filter-outcome-btn.active {
    background: var(--blue-600);
    color: var(--white);
    border-color: var(--blue-600);
}

.filter-date-input {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background: var(--white);
}

.filter-date-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.filter-date-sep {
    color: var(--gray-400);
    font-size: 0.8125rem;
}

.filter-reset-btn {
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}

.filter-reset-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

@media (max-width: 599px) {
    .match-filter-bar {
        gap: 0.625rem;
        padding: 0.875rem 0 1.125rem;
    }

    .filter-outcomes,
    .filter-dates {
        width: 100%;
    }

    .filter-player-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.375rem;
    }

    #player-datalist {
        display: none;
    }

    .filter-player-input {
        width: 100%;
        min-width: 0;
    }

    .filter-outcomes {
        gap: 0.375rem;
        justify-content: space-between;
    }

    .filter-outcome-btn {
        flex: 1;
        text-align: center;
        padding: 0.45rem 0;
    }

    .filter-date-input {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
    }

    .filter-reset-btn {
        width: 100%;
        padding: 0.5rem;
    }
}

/* Leaderboard responsive table
   ========================================================================== */
.lb-detail-row { display: none; }

@media (max-width: 599px) {
    .lb-extra { display: none; }

    .lb-name {
        color: var(--blue-600);
        cursor: pointer;
        border-bottom: 1px dotted var(--blue-400);
    }

    .lb-detail-row.lb-detail-open { display: table-row; }

    .lb-detail-row td {
        padding: 0.375rem 0.75rem 0.625rem;
        background: var(--blue-50);
    }

    .lb-detail-content {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .lb-detail-content span {
        background: var(--white);
        border: 1px solid var(--blue-200);
        border-radius: 3px;
        padding: 0.2rem 0.5rem;
        font-size: 0.8rem;
        color: var(--gray-700);
    }
}

/* Outcome Badges (Win / Loss / Draw)
   ========================================================================== */
.outcome-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.outcome-win {
    background: #e8f5e9;
    color: #1b5e20;
}

.outcome-loss {
    background: #fdecea;
    color: #b71c1c;
}

.outcome-draw {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Team avg stats (inside score-display in match_detail)
   ========================================================================== */
.team-avg-stats {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.team-avg-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.15rem 0;
}

.team-avg-label {
    color: var(--gray-500);
}

.team-avg-value {
    font-weight: 600;
    color: var(--gray-900);
}

/* Rating Change section (match_detail)
   ========================================================================== */
.rating-change-section {
    background: var(--gray-50);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.rating-change-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.rating-change-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.rating-change-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rating-change-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rating-change-value {
    font-size: 1rem;
    font-weight: 600;
}

/* Teammate Stats
   ========================================================================== */
.teammate-section {
    margin-bottom: 1.25rem;
}

.teammate-section:last-child {
    margin-bottom: 0;
}

.teammate-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.teammate-note {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-400);
    font-size: 0.75rem;
}

.teammate-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.teammate-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.625rem;
    background: var(--gray-50);
    border-radius: 4px;
    font-size: 0.875rem;
}

.teammate-name {
    flex: 1;
    font-weight: 500;
    color: var(--gray-900);
}

.teammate-games {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

.teammate-winpct {
    font-weight: 600;
    font-size: 0.8125rem;
    min-width: 5rem;
    text-align: right;
}

/* Mobile hamburger nav
   ========================================================================== */

/* Hidden on desktop */
.nav-toggle {
    display: none;
}

@media (max-width: 599px) {
    .header {
        position: relative;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 26px;
        height: 19px;
        background: transparent;
        border: none;
        padding: 0;
        cursor: pointer;
        flex-shrink: 0;
    }

    .nav-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--white);
        border-radius: 2px;
    }

    /* Nav hidden by default on mobile */
    .header-actions {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--blue-900);
        flex-direction: column;
        padding: 0.375rem 0;
        z-index: 200;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .header-actions.nav-open {
        display: flex;
    }

    .header-actions .header-btn,
    .header-actions .logout-btn {
        padding: 0.75rem 1.5rem;
        border-radius: 0;
        border: none;
        width: 100%;
        display: block;
        text-align: left;
    }
}

/* Expandable user rows (Team/Dashboard)
   ========================================================================== */
.user-row {
    cursor: pointer;
}

.user-row:hover {
    background: var(--blue-50);
}

.user-row-open {
    background: var(--blue-50);
}

.user-expand-name {
    color: var(--blue-600);
    border-bottom: 1px dotted var(--blue-400);
}

.user-detail-row {
    display: none;
}

.user-detail-row.user-detail-open {
    display: table-row;
}

.user-detail-row td {
    background: var(--blue-50);
    padding: 0.75rem 1rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.user-detail-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--blue-200);
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    min-width: 4.5rem;
}

.user-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.125rem;
}

.user-stat-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Welcome greeting
   ========================================================================== */
.welcome-greeting {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    padding: 0.25rem 0;
    margin-bottom: 1.25rem;
}

/* About page
   ========================================================================== */
.card--plain {
    border: none;
    background: transparent;
}

.card--plain h2 {
    border-bottom: none;
    padding-bottom: 0;
}

.about-subtitle {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--blue-700);
    margin-bottom: 0.75rem !important;
}

.about-params {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin: 0.75rem 0 1rem;
}

.about-param {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--blue-50);
    border: 1px solid var(--blue-200);
    border-radius: 4px;
    padding: 0.625rem 0.875rem;
}

.about-param-symbol {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--blue-700);
    line-height: 1.3;
    min-width: 1.25rem;
    text-align: center;
}

.about-param div {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.about-link {
    color: var(--blue-600);
    text-decoration: none;
    border-bottom: 1px solid var(--blue-300);
}

.about-link:hover {
    color: var(--blue-800);
    border-bottom-color: var(--blue-600);
}

.about-literature {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.about-literature li {
    font-size: 0.875rem;
    padding-left: 1rem;
    position: relative;
}

.about-literature li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--blue-400);
}

/* Danger Zone
   ========================================================================== */
.danger-zone {
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
}

.danger-zone h2 {
    color: var(--gray-700);
    border-bottom-color: var(--gray-200);
}

/* Balancer page
   ========================================================================== */
.balance-desc {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.balance-settings {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.balance-settings .form-group {
    margin-bottom: 0;
}

.balance-num-input {
    width: 9rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.15s;
}

.balance-num-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.balance-label-note {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 0.8125rem;
}

.balance-pool-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.balance-pool-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

.balance-pool-hint {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

.balance-player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* Hide the real checkbox, style the label as a chip */
.balance-player-chip {
    cursor: pointer;
}

.balance-player-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.balance-chip-inner {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background: var(--white);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    user-select: none;
}

.balance-player-chip input[type="checkbox"]:checked + .balance-chip-inner {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: var(--white);
}

.balance-chip-name {
    font-weight: 500;
}

.balance-chip-skill {
    font-size: 0.75rem;
    opacity: 0.75;
}

.balance-chip-skill--unrated {
    opacity: 0.5;
}

/* Results */
.balance-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.balance-result-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.balance-objective-badge {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
}

.balance-objective-note {
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-bottom: 1.25rem;
}

.balance-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.balance-team-card {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.balance-team-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--blue-700);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--gray-100);
}

.balance-team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: 0.875rem;
}

.balance-team-player {
    color: var(--gray-900);
}

.balance-team-avg {
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8125rem;
    color: var(--gray-500);
    text-align: right;
}

/* Matchup quality bars */
.balance-pairs h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.625rem;
}

.balance-pair-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.balance-pair-label {
    font-size: 0.8125rem;
    color: var(--gray-700);
    min-width: 10rem;
}

.balance-gap-value {
    font-size: 0.8125rem;
    font-weight: 600;
}

.balance-quality--good { color: #2e7d32; }
.balance-quality--ok   { color: var(--gray-700); }
.balance-quality--poor { color: #c62828; }

/* Personal stats summary
   ========================================================================== */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.625rem 1.25rem;
    min-width: 5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.2rem;
}

.stat-sublabel {
    font-size: 0.6875rem;
    color: var(--gray-400);
}

/* Match type
   ========================================================================== */
.match-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--gray-500);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    vertical-align: middle;
    margin-left: 0.4rem;
}

.filter-types {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.filter-type-btn {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-type-btn:hover {
    background: var(--gray-100);
}

.filter-type-btn.active {
    background: var(--blue-600);
    color: var(--white);
    border-color: var(--blue-600);
}

.match-type-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.match-type-row select,
.match-type-row input[type="text"] {
    flex: 1;
}

/* Player network graph
   ========================================================================== */
#network-graph-container {
    position: relative;
    width: 100%;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

#network-svg {
    display: block;
    width: 100%;
}

.network-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 0;
}

.network-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.network-control-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.network-slider {
    width: 130px;
    accent-color: var(--blue-600);
    cursor: pointer;
}

.network-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-edge {
    width: 32px;
    background: var(--gray-500);
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-edge--thin  { height: 2px; }
.legend-edge--thick { height: 7px; }

.network-player-pool {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.network-tooltip {
    position: fixed;
    display: none;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    line-height: 1.55;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
}

/* ==========================================================================
   Pods
   ========================================================================== */

.pod-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pod-item {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.875rem 1rem;
    background: var(--white);
}

.pod-item--temp {
    border-left: 3px solid var(--blue-300);
    background: var(--blue-50);
}

.pod-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pod-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pod-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.pod-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.pod-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pod-rename-form {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.pod-rename-input {
    width: 11rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
}

.pod-rename-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.pod-players {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

/* Match-form pod loader */
.pod-load-row {
    margin-bottom: 0.5rem;
}

.pod-select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    color: var(--gray-700);
    background: var(--white);
}

.pod-select:focus {
    outline: none;
    border-color: var(--blue-500);
}
