:root {
    --color-primary: #1e4d8c;
    --color-primary-dark: #143460;
    --color-accent: #e8a33d;
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-text: #1c2530;
    --color-muted: #5b6b7c;
    --color-border: #dde3ea;
    --color-success: #1f8a53;
    --color-error: #c0392b;
    --radius: 8px;
    --spacing: 1rem;
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.brand {
    display: block;
    width: 100%;
    text-align: center;
}

.brand-logo {
    width: 70%;
    height: auto;
    display: inline-block;
}

.brand-mobile {
    display: none;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
}

.brand-mobile-icon {
    height: 32px;
    width: auto;
    display: block;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    cursor: pointer;
    margin-top: 0;
}

.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    vertical-align: -3px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill .icon {
    vertical-align: middle;
}

.nav-toggle .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-toggle:hover {
    background: var(--color-bg);
}

/* Fills the remaining sidebar height below the topbar so .lang-switch's
   margin-top:auto (below) can push it all the way to the bottom, instead
   of sitting right after the logout link. Mobile overrides this back to
   a plain dropdown panel in the media query further down. */
.sidebar-nav-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-nav a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
}

.sidebar-nav a:hover {
    background: var(--color-bg);
}

.sidebar-nav a.active {
    background: var(--color-primary);
    color: #fff;
}

/* Nav icons and section labels exist in the markup for both themes but
   only render under matchday — keeps the classic look byte-for-byte the
   same as before this markup was added. */
.sidebar-nav a svg {
    display: none;
}

.nav-section-label {
    display: none;
}

.sidebar-nav .sidebar-section {
    margin: 0.5rem 0 0.1rem 0.6rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    font-weight: 600;
}

/* A plain block box in both layouts. width:100% keeps it on its own line
   even when .sidebar-nav is a wrapping row (mobile), instead of
   interleaving oddly with the pill links either side of it. The nested <a>
   tags pick up .sidebar-nav a's colors/padding via descendant selectors,
   but since they're no longer direct flex children of .sidebar-nav (one
   <details> deeper), they need display:block spelled out explicitly below
   or they render as unblocked inline text and visually overlap. */
.sidebar-section-collapsible {
    width: 100%;
}

.sidebar-section-collapsible summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
}

.sidebar-section-collapsible summary:hover {
    background: var(--color-bg);
}

.sidebar-section-collapsible summary::-webkit-details-marker {
    display: none;
}

.sidebar-section-collapsible summary::after {
    content: '\25BE';
    font-size: 0.7rem;
    color: var(--color-muted);
}

.sidebar-section-collapsible[open] summary::after {
    content: '\25B4';
}

.sidebar-section-collapsible a {
    display: block;
    padding-left: 1.2rem;
    margin-top: 0.15rem;
}

.sidebar-nav .sidebar-logout {
    margin-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
    color: var(--color-muted);
}

.lang-switch {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.lang-switch a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.lang-switch a.active {
    background: var(--color-primary);
    color: #fff;
}

.theme-switch {
    display: block;
    margin-top: 0.6rem;
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    border: 1px dashed var(--color-border);
    text-align: center;
}

.theme-switch:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-muted);
    font-size: 0.875rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.stat-tile {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1rem;
}

.stat-tile .stat-label {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin: 0 0 4px;
}

.stat-tile .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-primary-dark);
}

.activity-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.activity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

.activity-row:last-child {
    border-bottom: none;
}

.activity-row-meeting {
    background: rgba(108, 92, 231, 0.08);
    border-radius: var(--radius);
}

.activity-meeting-badge {
    background: #6c5ce7;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.activity-meeting-badge .icon {
    width: 13px;
    height: 13px;
}

.tier-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tier-filter a:not(.icon-btn) {
    display: inline-block;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
}

.tier-filter a:not(.icon-btn):hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tier-filter a.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.role-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    margin: 0 0.25rem 0.25rem 0;
    color: #fff;
}
.role-badge-admin { background: var(--color-error); }
.role-badge-team_member { background: #d9822b; }
.role-badge-parent { background: #6b46c1; }
.role-badge-player { background: var(--color-success); }
.role-badge-none { background: var(--color-border); color: var(--color-muted); }

.activity-tag {
    color: var(--color-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

h1, h2, h3 {
    color: var(--color-primary-dark);
}

label {
    display: block;
    font-weight: 500;
    margin: 0.75rem 0 0.25rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--color-surface);
    color: var(--color-text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.registration-form :required {
    border-color: var(--color-accent);
}

button, .button {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.6rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .button:hover {
    background: var(--color-primary-dark);
}

.button .icon {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-muted);
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible,
.password-toggle.is-visible {
    color: var(--color-muted);
    background: none;
    opacity: 1;
}

.password-toggle .icon {
    width: 15px;
    height: 15px;
    stroke-width: 1.75;
}

.password-toggle .icon-hide {
    display: none;
}

.password-toggle.is-visible .icon-show {
    display: none;
}

.password-toggle.is-visible .icon-hide {
    display: inline-flex;
}

button.secondary, .button.secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

button.btn-sm, .button.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    margin-top: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 2px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-muted);
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
}

.icon-btn:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.icon-btn.icon-btn-danger:hover {
    color: var(--color-error);
    border-color: var(--color-error);
}

.icon-btn .icon {
    width: 16px;
    height: 16px;
}

.icon-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.result-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.result-dot.result-win {
    background: var(--color-success);
}

.result-dot.result-tie {
    background: var(--color-muted);
}

.result-dot.result-loss {
    background: var(--color-error);
}

tr.result-row-win {
    background: rgba(31, 138, 83, 0.06);
}

tr.result-row-tie {
    background: rgba(91, 107, 124, 0.06);
}

tr.result-row-loss {
    background: rgba(192, 57, 43, 0.06);
}

tr:target {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.avatar-img {
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.avatar-placeholder {
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-placeholder .icon {
    width: 60%;
    height: 60%;
}

.welcome-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-grid-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 0.5rem;
    margin-bottom: 1.5rem;
}

.field-error {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.flash-success {
    background: #e5f5ec;
    color: var(--color-success);
    border: 1px solid #b9e3c9;
}

.flash-error {
    background: #fbeae8;
    color: var(--color-error);
    border: 1px solid #f1c3bd;
}

.notifications-off-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    background: #fdf1de;
    color: var(--color-accent);
    border: 1px solid #f4d9a6;
    font-weight: 600;
    font-size: 0.9rem;
}

.notifications-off-banner .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.sortable-table th[data-sort] {
    user-select: none;
}

.sortable-table th[data-sort]::after {
    content: '';
    display: inline-block;
    width: 0.6em;
}

.sortable-table th[data-sort][data-sort-dir="asc"]::after {
    content: '▲';
    font-size: 0.65em;
    margin-left: 0.35em;
}

.sortable-table th[data-sort][data-sort-dir="desc"]::after {
    content: '▼';
    font-size: 0.65em;
    margin-left: 0.35em;
}

.mini-pie {
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: conic-gradient(var(--color-primary) var(--pct, 0%), var(--color-border) 0);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem 1rem;
    align-items: end;
}

.form-grid label {
    margin: 0 0 0.25rem;
}

.form-grid input,
.form-grid select {
    margin: 0;
}

.form-hint {
    color: var(--color-muted);
    font-size: 0.8rem;
    margin: 0.15rem 0 0;
}

.child-row {
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.child-row > div {
    flex: 1;
}

@media (max-width: 700px) {
    /* Wide data tables become horizontally scrollable rather than
       overflowing the viewport or squashing every column unreadably. */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 880px) {
    /* Below tablet width, the sidebar collapses into a slim top bar (a
       small round icon + name, and a hamburger button) instead of the
       full portrait logo and the entire nav list rendered inline. The
       nav only appears, as a dropdown panel, once the button is tapped —
       see assets/js/main.js for the open/close behaviour. */
    .app-shell {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .brand {
        display: none;
    }
    .brand-mobile {
        display: flex;
    }
    .nav-toggle {
        display: flex;
    }
    .sidebar-nav-panel {
        display: none;
        flex-direction: column;
        flex: initial;
        gap: 1rem;
        margin-top: 0.75rem;
    }
    .sidebar-nav-panel.is-open {
        display: flex;
    }
    .sidebar-nav {
        flex-direction: column;
        gap: 0.15rem;
    }
    .sidebar-nav .sidebar-section {
        display: none;
    }
    .lang-switch {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .site-main {
        margin: 1rem auto;
    }
    .child-row {
        flex-direction: column;
        align-items: stretch;
    }
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.calendar-nav a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 600;
}

.calendar-grid-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
}

.calendar-weekday {
    background: var(--color-surface);
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0;
    color: var(--color-muted);
}

.calendar-day {
    background: var(--color-surface);
    height: 90px;
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow: hidden;
    position: relative;
}

.calendar-day:hover {
    height: auto;
    min-height: 90px;
    overflow: visible;
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.calendar-day:hover .calendar-event {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.calendar-day-empty {
    background: transparent;
}

.calendar-day-number {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.calendar-day-today {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.calendar-event {
    display: block;
    font-size: 0.7rem;
    line-height: 1.3;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

a.calendar-event:hover {
    filter: brightness(0.92);
    cursor: pointer;
}

.calendar-event-game {
    background: var(--color-primary);
    color: #fff;
}

.calendar-event-training {
    background: var(--color-primary-light, #d7e9f7);
    color: var(--color-primary-dark);
}

.calendar-event-tournament {
    background: #d9a441;
    color: #fff;
}

.calendar-event-meeting {
    background: #6c5ce7;
    color: #fff;
}

.calendar-event-cancelled {
    background: transparent;
    border: 1px solid var(--color-muted);
    color: var(--color-muted);
    text-decoration: line-through;
}

.calendar-event-time {
    font-weight: 600;
    margin-right: 0.25rem;
}

.calendar-grid-year {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.calendar-mini-month h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
}

.calendar-mini-month h3 a {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.calendar-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    font-size: 0.7rem;
    text-align: center;
}

.calendar-mini-grid span {
    padding: 0.15rem 0;
    border-radius: 3px;
}

.calendar-mini-day-has-event {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.calendar-mini-day-today {
    box-shadow: inset 0 0 0 1px var(--color-primary-dark);
}

.calendar-subscribe-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.calendar-subscribe-url {
    font-size: 0.85rem;
    color: var(--color-muted);
    word-break: break-all;
}

.result-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    margin: 0.75rem 0 1.25rem;
    width: fit-content;
}

.result-banner .result-dot {
    margin-right: 0;
    width: 12px;
    height: 12px;
}

.result-banner-win {
    background: rgba(31, 138, 83, 0.12);
    color: var(--color-success);
}

.result-banner-tie {
    background: rgba(91, 107, 124, 0.12);
    color: var(--color-muted);
}

.result-banner-loss {
    background: rgba(192, 57, 43, 0.12);
    color: var(--color-error);
}

.half-leaders {
    margin: 0 0 1.25rem;
    padding-left: 1.25rem;
    color: var(--color-text);
    font-size: 0.95rem;
}

.score-evolution {
    max-width: 480px;
}

.score-evolution-chart {
    width: 100%;
    height: auto;
    display: block;
}

.score-evolution-legend {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 0.75rem;
}

.legend-swatch:first-child {
    margin-left: 0;
}

.legend-us {
    background: var(--color-primary);
}

.legend-opponent {
    background: var(--color-error);
}

@media (max-width: 700px) {
    .calendar-grid-year {
        grid-template-columns: 1fr;
    }
    .calendar-day {
        height: 60px;
    }
    .calendar-day:hover {
        min-height: 60px;
    }
}

.profile-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.profile-header-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-header-main h1 {
    margin: 0;
}

.profile-birthday {
    flex: 1 1 260px;
    max-width: 340px;
}

.profile-birthday-summary {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.birthday-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.birthday-progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 999px;
}

.birthday-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 0.2rem;
}

@media (max-width: 600px) {
    .profile-birthday {
        max-width: none;
        flex-basis: 100%;
    }
}

.card-size-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.card-size-control label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
    white-space: nowrap;
}

.card-size-control input[type="range"] {
    width: 140px;
}

.player-cards {
    display: grid;
    grid-template-columns: repeat(var(--cards-per-row, 4), 1fr);
    gap: 1.25rem;
}

.player-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1.5625rem 0.9375rem 1.25rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
}

.player-card:hover {
    border-color: var(--color-primary);
}

.player-card-suspended {
    opacity: 0.6;
}

.player-card-badge {
    position: absolute;
    top: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
}

.player-card-badge-left {
    left: 0.625rem;
}

.player-card-badge-right {
    right: 0.625rem;
    background: var(--color-muted);
}

.player-card-name {
    margin: 0;
    font-weight: 600;
    font-size: 1.125rem;
}

.player-card-meta {
    margin: 0;
    font-size: 1rem;
    color: var(--color-muted);
}

.tier-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

a.tier-badge {
    text-decoration: none;
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill-confirmed {
    background: #d7f5e0;
    color: #17743a;
}

.status-pill-rejected {
    background: #fbdada;
    color: #a12b2b;
}

.status-pill-pending {
    background: #f0f0f0;
    color: var(--color-muted);
}

.status-pill-paid {
    background: #d7f5e0;
    color: #17743a;
}

.status-pill-unpaid {
    background: #fbe8c8;
    color: #92600b;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    appearance: none;
    -webkit-appearance: none;
    width: 2.4rem;
    height: 1.35rem;
    margin: 0;
    border-radius: 999px;
    background: var(--color-border);
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.toggle-switch input::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.35rem - 4px);
    height: calc(1.35rem - 4px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.toggle-switch input:checked {
    background: var(--color-success);
}

.toggle-switch input:checked::before {
    transform: translateX(1.05rem);
}

.toggle-switch input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.toggle-switch-label {
    font-size: 0.85rem;
    font-weight: 600;
}

a.tier-badge:hover {
    opacity: 0.85;
}

.table-name-link {
    color: inherit;
    text-decoration: none;
}

.table-name-link:hover {
    color: var(--color-primary);
}

.game-card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-card {
    background: var(--color-bg);
    margin-bottom: 0;
}

.game-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.game-card-header > .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-muted);
}

.game-card-meta {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: 0.4rem 0 0;
}

.filter-select {
    width: auto;
    display: inline-block;
    padding: 0.4rem 2rem 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b7c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 14px;
}

.filter-select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* =========================================================
   Opt-in "matchday" redesign — activated via [data-theme="matchday"]
   on <html> (see includes/bootstrap.php for the ?theme= cookie, and
   templates/header.php for the toggle link + logo swap). Everyone gets
   the existing look above unless they explicitly opt in.

   Palette: cool light-grey/blue background (a hue bias toward the ink-navy
   sidebar, not a warm cream), single ball-orange accent. Type: the same
   system font stack as the classic design throughout — an earlier pass
   used a condensed display face for headings/numerals, but that read as
   unpleasant rather than "scoreboard", so it was dropped in favor of
   plain bold weight on the regular body font.

   Note: --color-bg was originally a saturated warm parquet tan; changed
   to this cooler neutral both because it read as too close to a certain
   well-known AI-assistant cream, and because the token is reused for many
   secondary/nested panels app-wide (not just the page canvas), so a
   strong tint there made everything look pastel rather than just the
   background.
   ========================================================= */
:root[data-theme="matchday"] {
    --color-primary: #14213d;
    --color-primary-dark: #0d1730;
    --color-accent: #ff5a2d;
    --color-bg: #eef1f6;
    --color-surface: #ffffff;
    --color-text: #14213d;
    --color-muted: #6a6f85;
    --color-border: #dfe3ec;
    --color-success: #2f9e64;
    --color-error: #d0483f;
}

[data-theme="matchday"] h1,
[data-theme="matchday"] h2,
[data-theme="matchday"] h3,
[data-theme="matchday"] .stat-tile .stat-value,
[data-theme="matchday"] .tier-badge,
[data-theme="matchday"] .status-pill {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
}

[data-theme="matchday"] .stat-tile .stat-value {
    font-variant-numeric: tabular-nums;
}

[data-theme="matchday"] .sidebar {
    background: var(--color-primary);
    border-right: none;
}

/* .brand-logo's base rule (width:70%) assumes the wide wordmark; the
   square mark used here instead needs a fixed, much smaller size or it
   dominates the sidebar. */
[data-theme="matchday"] .brand-logo {
    width: 50%;
    height: auto;
}

[data-theme="matchday"] .sidebar-nav a,
[data-theme="matchday"] .sidebar-section-collapsible summary {
    color: #cdd4e6;
}

[data-theme="matchday"] .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

[data-theme="matchday"] .sidebar-nav a svg {
    display: block;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.85;
}

[data-theme="matchday"] .nav-section-label {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
    font-size: 0.72rem;
    color: #6b7593;
    padding: 0.7rem 0.6rem 0.2rem;
}

[data-theme="matchday"] .nav-section-label:first-child {
    padding-top: 0;
}

[data-theme="matchday"] .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.07);
}

[data-theme="matchday"] .sidebar-nav a.active {
    background: #1e2b4a;
    color: #fff;
    border-radius: 999px;
    position: relative;
}

[data-theme="matchday"] .sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: var(--color-accent);
}

/* Scoped to .sidebar specifically (not all .lang-switch/.theme-switch) —
   the welcome topbar below reuses these same components on a light
   background and needs the default (non-inverted) colors instead. */
[data-theme="matchday"] .sidebar .lang-switch a {
    color: #9aa3bc;
}

[data-theme="matchday"] .lang-switch a.active {
    background: var(--color-accent);
    color: #fff;
}

[data-theme="matchday"] .sidebar .theme-switch {
    border-color: rgba(255, 255, 255, 0.25);
    color: #cdd4e6;
}

/* Split-panel login (matchday only — pages/login.php swaps the plain .card
   for this markup when the theme is active). */
.login-shell {
    background: #14213d;
    border-radius: 16px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    overflow: hidden;
    min-height: 420px;
    margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
    .login-shell {
        grid-template-columns: 1fr;
    }
    .login-visual {
        display: none;
    }
}

.login-visual {
    /* Stretches to the grid row's full height (the default cross-axis
       behavior — no align-self override), so on a tall form like
       register.php the colored panel covers the whole left column
       instead of stopping partway and showing the page background
       underneath. position:sticky then keeps the quote pinned near the
       top of that tall box as the page scrolls. */
    position: sticky;
    top: 0;
    min-height: 420px;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 90, 45, 0.35), transparent 55%),
        linear-gradient(180deg, #1e2b4a 0%, #101a30 55%, #060a14 100%);
    padding: 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
}

.login-visual-mark {
    width: 44px;
    height: 44px;
    margin-bottom: 1.4rem;
}

.login-visual-quote {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.login-visual-credit {
    color: #9aa3bc;
    font-size: 0.85rem;
}

.login-panel {
    background: var(--color-surface);
    padding: 2.6rem 2.4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-panel h1 {
    margin-top: 0;
}

/* Welcome topbar — replaces the sidebar entirely on login/register/forgot/
   reset pages under matchday while signed out (see templates/header.php's
   $hide_sidebar). Lives at the top of .content-area instead. No logo here
   deliberately — the square mark is already shown once, inside the
   login-visual panel below, and repeating it here would be redundant. */
.welcome-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.2rem 1.5rem 0;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    flex-wrap: wrap;
}

.welcome-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.welcome-topbar-actions .lang-switch {
    margin-top: 0;
}

.welcome-topbar-actions .theme-switch {
    margin-top: 0;
}

[data-theme="matchday"] .theme-switch:hover {
    border-color: var(--color-accent);
    color: #fff;
}

[data-theme="matchday"] button,
[data-theme="matchday"] .button {
    background: var(--color-accent);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
}

/* Hover swaps the background to the sidebar's ink color rather than just
   darkening the orange — dark text/icons on orange were hard to read, and
   a darker orange on hover made that worse, not better. Text/icon color
   (white, via currentColor) stays the same in both states. */
[data-theme="matchday"] button:hover,
[data-theme="matchday"] .button:hover {
    background: var(--color-primary);
}

[data-theme="matchday"] button.secondary,
[data-theme="matchday"] .button.secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}


[data-theme="matchday"] .stat-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
}

[data-theme="matchday"] .stat-tile .stat-value {
    color: var(--color-primary);
}

/* Each dashboard stat tile gets a distinct tier-family color for its left
   rail, echoing the age-tier badge colors used throughout the app instead
   of a single repeated accent. Order matches dashboard.php's stat-grid
   markup: Games, Training, Announcements, Carpools, Tournaments, Meetings. */
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(1) { border-left-color: #2f6fed; }
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(2) { border-left-color: #f49715; }
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(3) { border-left-color: #2f9e64; }
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(4) { border-left-color: #14213d; }
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(5) { border-left-color: #8b5cf6; }
[data-theme="matchday"] .stat-grid .stat-tile:nth-child(6) { border-left-color: var(--color-accent); }

/* Two-column dashboard layout (matchday only — dashboard.php branches its
   events/store/birthdays markup into this instead of stacking them as
   separate full-width cards, matching the mockup). */
.two-col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

@media (max-width: 860px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

/* Store shortcut card — dashboard.php always adds the .store-card class,
   but it's only ever styled under matchday; classic stays a plain white
   card. Dark gradient over the jersey photo keeps the white button/icon
   (see button/.button rules above) readable regardless of where it lands
   on the image. */
[data-theme="matchday"] .store-card {
    background-image:
        linear-gradient(180deg, rgba(20, 33, 61, 0.55), rgba(20, 33, 61, 0.8)),
        url("../img/storebg.png");
    background-size: cover;
    background-position: center;
    padding: 2.2rem 1.5rem;
}

/* Scoreboard hero — only rendered by dashboard.php under the matchday
   theme, so no [data-theme] scoping needed here. */
.scoreboard-hero {
    background: linear-gradient(135deg, #14213d 0%, #1e2b4a 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.scoreboard-hero .sb-label {
    color: var(--color-accent);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    margin: 0 0 0.35rem;
}

.scoreboard-hero .sb-teams {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.01em;
}

.scoreboard-hero .sb-meta {
    color: #b7bfd6;
    font-size: 0.88rem;
    margin-top: 0.4rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.scoreboard-hero .sb-countdown {
    text-align: center;
    flex-shrink: 0;
}

.scoreboard-hero .sb-num {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 2.4rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.scoreboard-hero .sb-lbl {
    font-size: 0.7rem;
    color: #9aa3bc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
}

/* ---------------------------------------------------------------------
   games.php redesign (matchday only) — pages/games.php only renders this
   markup under matchday, so most of it doesn't need [data-theme] scoping,
   but a few shared class names (.chip-away, .icon) are scoped defensively.
   --------------------------------------------------------------------- */
[data-theme="matchday"] .game-card {
    background: transparent;
    border-left: 4px solid var(--tier, var(--color-accent));
}

.gc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.gc-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gc-chips {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.gc-chips .tier-badge.chip {
    font-size: 0.7rem;
}

[data-theme="matchday"] .chip-away {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-muted);
}

.chip-status-ok {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-success) 16%, white);
    color: var(--color-success);
}

.chip-status-pending {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent) 16%, white);
    color: #b8451e;
}

.gc-opponent {
    font-size: 1.1rem;
    font-weight: 700;
}

.gc-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.gc-meta {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 0;
    font-size: 0.86rem;
    color: var(--color-muted);
}

.gc-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.gc-meta .icon {
    width: 14px;
    height: 14px;
    opacity: 0.75;
}

.gc-meta b {
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.gc-notes {
    margin: 0.7rem 0 0;
    font-size: 0.86rem;
    color: var(--color-muted);
    padding: 0.55rem 0.7rem;
    background: var(--color-bg);
    border-radius: 8px;
}

.gc-toggles {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.9rem;
    flex-wrap: wrap;
}

.gc-details > summary.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    list-style: none;
    width: fit-content;
}

.gc-details > summary.toggle-btn::-webkit-details-marker {
    display: none;
}

.gc-details > summary.toggle-btn .icon {
    width: 13px;
    height: 13px;
    transition: transform 0.15s ease;
}

.gc-details[open] > summary.toggle-btn {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.gc-details[open] > summary.toggle-btn .icon {
    transform: rotate(180deg);
}

.lineup-panel {
    margin-top: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.9rem 1rem 1rem;
    width: 100%;
}

.lineup-panel h4 {
    margin: 0 0 0.7rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    font-weight: 700;
}

.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.roster-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--color-bg);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
}

.roster-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.roster-name {
    font-size: 0.83rem;
    font-weight: 600;
    line-height: 1.2;
}

.roster-pos {
    font-size: 0.72rem;
    color: var(--color-muted);
}

.edit-panel {
    margin-top: 0.6rem;
    background: color-mix(in srgb, var(--color-primary) 4%, white);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem 1.1rem 1.1rem;
    width: 100%;
}

.edit-panel h4 {
    margin: 0 0 0.8rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-panel h4 .icon {
    width: 13px;
    height: 13px;
}

.edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1rem;
}

.edit-grid .full {
    grid-column: 1 / -1;
}

.edit-grid label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 0.3rem;
}

.edit-grid input,
.edit-grid textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 7px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.88rem;
    font-family: inherit;
}

.edit-grid .checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-grid .checkbox-row input {
    width: auto;
}

.edit-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.2rem;
}

.edit-actions button {
    margin-top: 0;
    padding: 0.5rem 1rem;
    font-size: 0.86rem;
}
