/* League Admin — modern design system (Bootstrap 5.3+) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --league-primary: #4f46e5;
    --league-primary-dark: #4338ca;
    --league-primary-light: #eef2ff;
    --league-sidebar: #0f172a;
    --league-sidebar-hover: #1e293b;
    --league-sidebar-active: #334155;
    --league-accent: #06b6d4;
    --league-surface: #ffffff;
    --league-bg: #f1f5f9;
    --league-border: #e2e8f0;
    --league-text: #0f172a;
    --league-muted: #64748b;
    --league-radius: 0.75rem;
    --league-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
    --league-shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--league-bg);
    color: var(--league-text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 268px;
    background: linear-gradient(180deg, var(--league-sidebar) 0%, #1a1f35 100%);
    color: #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    z-index: 100;
}

.app-sidebar .brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-shrink: 0;
}

.app-sidebar .brand-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #fff;
}

.app-sidebar .brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--league-primary), var(--league-accent));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: #fff;
}

.app-sidebar .brand-mark-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: block;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(232, 161, 22, 0.25);
}

.app-sidebar .brand-text { font-weight: 700; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.03em; }
.app-sidebar .brand-sub { font-size: .7rem; color: #94a3b8; font-weight: 400; }

.app-sidebar .nav-section {
    padding: .5rem 1rem .25rem;
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}

.app-sidebar .nav-link {
    color: #cbd5e1;
    border-radius: .5rem;
    margin: .125rem .75rem;
    padding: .6rem .85rem;
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: all .15s ease;
    flex: 0 0 auto;
    max-width: calc(100% - 1.5rem);
}

.app-sidebar .nav-link i { font-size: 1.1rem; opacity: .85; }

.app-sidebar .nav-link:hover {
    background: var(--league-sidebar-hover);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--league-primary), #6366f1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}

.app-sidebar .nav-link.active i { opacity: 1; }

.app-sidebar > .nav {
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: flex-start;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1.25rem;
}

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-header {
    background: var(--league-surface);
    border-bottom: 1px solid var(--league-border);
    padding: .85rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 50;
    min-width: 0;
}

.app-header .header-left {
    min-width: 0;
    flex: 1 1 auto;
}

.app-header .page-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    color: var(--league-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-header .page-subtitle {
    font-size: .8rem;
    color: var(--league-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    flex-shrink: 0;
    min-width: 0;
}

.sidebar-toggle-btn,
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--league-border);
    border-radius: .6rem;
    background: #fff;
    color: var(--league-text);
    flex-shrink: 0;
    padding: 0;
}

.sidebar-toggle-btn i { font-size: 1.35rem; line-height: 1; }

.sidebar-close-btn {
    border-color: rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: #e2e8f0;
}

.sidebar-backdrop {
    display: none;
}

.app-content { padding: 1.75rem; flex: 1; }

/* ── App footer ── */
.app-footer {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--league-border);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.app-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .85rem 1.5rem;
    padding: .85rem 1.75rem 1rem;
}

.app-footer__copy {
    margin: 0;
    font-size: .78rem;
    color: var(--league-muted);
    line-height: 1.45;
}

.app-footer__sep {
    margin: 0 .35rem;
    opacity: .55;
}

.app-footer__note {
    color: #94a3b8;
}

.app-footer__upwise {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, opacity .15s ease;
}

.app-footer__upwise:hover {
    color: inherit;
    transform: translateY(-1px);
}

.app-footer__upwise-label {
    font-size: .68rem;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--league-muted);
    white-space: nowrap;
}

.app-footer__upwise-card {
    display: inline-flex;
    align-items: center;
    padding: .2rem;
    border-radius: .5rem;
    background: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .08);
    transition: box-shadow .15s ease;
}

.app-footer__upwise:hover .app-footer__upwise-card {
    box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}

.app-footer__upwise-card img {
    display: block;
    height: 34px;
    width: auto;
    border-radius: .35rem;
}

@media (max-width: 640px) {
    .app-footer__inner {
        flex-direction: column;
        align-items: flex-start;
        padding: .85rem 1.1rem 1rem;
    }

    .app-footer__upwise {
        width: 100%;
        justify-content: space-between;
    }
}

/* ── Cards ── */
.card-league {
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    box-shadow: var(--league-shadow);
}

.card-league .card-header {
    background: transparent;
    border-bottom: 1px solid var(--league-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
}

.card-league .card-body { padding: 1rem 1.1rem; }

/* ── Stat cards ── */
.stat-card {
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    padding: 1.25rem;
    box-shadow: var(--league-shadow);
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--league-shadow-lg); }

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
}

.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; color: var(--league-muted); font-weight: 500; }

/* ── Dashboard compact groups ── */
.dash-welcome__name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--league-ink, #0f172a);
}
.dash-welcome__meta {
    font-size: .85rem;
    color: var(--league-muted);
    margin-top: .2rem;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
    gap: 1rem;
    align-items: start;
}

@media (min-width: 1400px) {
    .dash-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1100px) and (max-width: 1399.98px) {
    .dash-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1099.98px) {
    .dash-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dash-group {
    max-width: none;
    background: var(--league-surface, #fff);
    border: 1px solid var(--league-border, #e2e8f0);
    border-radius: .65rem;
    overflow: hidden;
    height: 100%;
}

.dash-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .85rem;
    border-bottom: 1px solid var(--league-border, #e2e8f0);
    background: #f8fafc;
}

.dash-group__title {
    margin: 0;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--league-muted, #64748b);
}

.dash-group__count {
    font-size: .68rem;
    font-weight: 600;
    color: var(--league-muted, #64748b);
    background: #eef2f7;
    border-radius: 999px;
    padding: .1rem .45rem;
    line-height: 1.3;
}

.dash-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-link-list li + li {
    border-top: 1px solid var(--league-border, #e2e8f0);
}

.dash-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .85rem;
    text-decoration: none;
    color: inherit;
    transition: background .15s ease;
}

.dash-link:hover {
    background: #f8fafc;
    color: inherit;
}

.dash-link__icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: .4rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: .85rem;
    color: #475569;
    background: #f1f5f9;
}

.dash-link__text {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
    flex: 1;
}

.dash-link__label {
    font-size: .88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

.dash-link__hint {
    font-size: .72rem;
    color: var(--league-muted, #64748b);
    line-height: 1.3;
}

.dash-link__chevron {
    font-size: .75rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.dash-link:hover .dash-link__chevron {
    color: #64748b;
}

/* ── Tables ── */
.table-league { margin: 0; }
.table-league thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--league-border);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--league-muted);
    padding: .85rem 1rem;
    white-space: nowrap;
}
.table-league tbody td { padding: .85rem 1rem; vertical-align: middle; border-color: #f1f5f9; }
.table-league tbody tr:hover { background: #f8fafc; }
.table-sort { text-decoration: none; color: inherit; }
.table-sort:hover { color: var(--league-primary); }

/* ── Admin matches · status quick tabs ── */
.admin-status-tabs {
    display: inline-flex;
    gap: 0.15rem;
    margin: 0 0 1rem;
    padding: 0.18rem;
    background: #e8eef4;
    border-radius: 8px;
    width: auto;
    max-width: 100%;
}

.admin-status-tabs__item {
    flex: 0 1 auto;
    text-align: center;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 550;
    color: #5a6570;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.admin-status-tabs__item:hover {
    color: #152033;
    background: rgba(255, 255, 255, 0.65);
}

.admin-status-tabs__item.is-active {
    color: #152033;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 28, 46, 0.1);
    font-weight: 650;
}

/* ── Admin matches · minimal grouped list ── */
.admin-match-meta {
    margin: 0.35rem 0 1rem;
    font-size: 0.82rem;
    color: var(--league-muted, #64748b);
}

.admin-match-groups {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.admin-match-group__title {
    margin: 0 0 0.55rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(15, 28, 46, 0.12);
    font-size: 0.95rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: #152033;
}

.admin-match-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-match-row {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
}

.admin-match-row__main {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 5.5rem 1fr auto auto;
    gap: 0.35rem 0.75rem;
    align-items: center;
    padding: 0.4rem 0.7rem;
    background: #fff;
    border: 1px solid rgba(15, 28, 46, 0.1);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-match-row__main:hover {
    border-color: rgba(15, 28, 46, 0.22);
    box-shadow: 0 4px 14px rgba(15, 28, 46, 0.06);
    color: inherit;
}

.admin-match-row.is-played .admin-match-row__main {
    background: rgba(14, 124, 114, 0.055);
    border-color: rgba(14, 124, 114, 0.14);
}

.admin-match-row.is-played .admin-match-row__main:hover {
    background: rgba(14, 124, 114, 0.08);
    border-color: rgba(14, 124, 114, 0.28);
}

.table-league tbody tr.is-played > td {
    background: rgba(14, 124, 114, 0.06) !important;
}

.table-league tbody tr.is-played:hover > td {
    background: rgba(14, 124, 114, 0.1) !important;
}

.admin-match-row__meta {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
    font-size: 0.68rem;
    line-height: 1.2;
    color: #7b8698;
    font-weight: 550;
}

.admin-match-row__meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-match-row__teams {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #152033;
    min-width: 0;
}

.admin-match-row__vs {
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: lowercase;
}

.admin-match-row__result {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 2.5rem;
    text-align: right;
    color: #152033;
}

.admin-match-row__result.is-time {
    color: #b8860b;
}

.admin-match-row__status {
    justify-self: end;
}

.status-pill {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.18rem 0.42rem;
    border-radius: 999px;
    white-space: nowrap;
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.status-pill--scheduled {
    background: rgba(232, 185, 35, 0.16);
    color: #8b6d33;
}

.status-pill--played {
    background: rgba(15, 28, 46, 0.08);
    color: #334155;
}

.status-pill--forfeit,
.status-pill--walkover {
    background: rgba(180, 100, 40, 0.12);
    color: #9a5520;
}

.status-pill--cancelled {
    background: rgba(160, 40, 40, 0.1);
    color: #a02828;
}

.admin-match-row__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    border-radius: 10px;
    border: 1px solid rgba(15, 28, 46, 0.1);
    background: #fff;
    color: #64748b;
    text-decoration: none;
    flex-shrink: 0;
}

.admin-match-row__edit:hover {
    color: #152033;
    border-color: rgba(15, 28, 46, 0.22);
}

@media (max-width: 768px) {
    .admin-match-row__main {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "meta status"
            "teams teams"
            "result result";
    }

    .admin-match-row__meta { grid-area: meta; }
    .admin-match-row__teams { grid-area: teams; }
    .admin-match-row__result { grid-area: result; text-align: left; }
    .admin-match-row__status { grid-area: status; }
}

/* ── Buttons ── */
.btn-primary {
    background: var(--league-primary);
    border-color: var(--league-primary);
    font-weight: 500;
    border-radius: .5rem;
    padding: .45rem 1rem;
}
.btn-primary:hover { background: var(--league-primary-dark); border-color: var(--league-primary-dark); }

.btn-outline-primary {
    color: var(--league-primary);
    border-color: var(--league-primary);
    font-weight: 500;
    border-radius: .5rem;
}
.btn-outline-primary:hover { background: var(--league-primary); border-color: var(--league-primary); }

/* ── Forms (compact / sm by default) ── */
.form-control, .form-select {
    border-radius: .375rem;
    border-color: var(--league-border);
    font-size: .8125rem;
    padding: .25rem .55rem;
    min-height: calc(1.5em + .5rem + 2px);
    line-height: 1.5;
}
textarea.form-control {
    min-height: 4.5rem;
}
.form-control-lg, .form-select-lg {
    font-size: 1rem;
    padding: .5rem .85rem;
    min-height: calc(1.5em + 1rem + 2px);
}
.form-control:focus, .form-select:focus {
    border-color: var(--league-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .12);
}
.form-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--league-muted);
    margin-bottom: .2rem;
    letter-spacing: .01em;
}
.form-text { font-size: .72rem; }
.form-check-label { font-size: .8125rem; }
.form-check-input {
    width: .95em;
    height: .95em;
    margin-top: .2em;
}
.btn:not(.btn-sm):not(.btn-lg):not(.btn-link) {
    padding: .28rem .7rem;
    font-size: .8125rem;
    border-radius: .375rem;
}

/* Distinct form blocks inside a card */
.form-section {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--league-border);
}
.form-section--last {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}
.form-section__title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--league-muted);
    margin-bottom: .65rem;
}
.form-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .35rem;
}
.form-section__meta {
    font-size: .72rem;
    color: var(--league-primary);
    font-weight: 600;
}
.form-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.sticky-actions {
    position: sticky;
    bottom: .75rem;
    z-index: 5;
    padding: .65rem .85rem;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
    backdrop-filter: blur(6px);
}

/* Location multi-picker (scales to many places) */
.location-picker {
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    background: #f8fafc;
    overflow: hidden;
}
.location-picker__toolbar {
    display: flex;
    gap: .5rem;
    align-items: center;
    padding: .45rem .55rem;
    border-bottom: 1px solid var(--league-border);
    background: #fff;
}
.location-picker__toolbar .form-control {
    flex: 1 1 auto;
    min-width: 0;
}
.location-picker__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0;
    max-height: 11.5rem;
    overflow-y: auto;
}
.location-picker__item {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    padding: .4rem .65rem;
    font-size: .8125rem;
    cursor: pointer;
    border-bottom: 1px solid #eef2f7;
    border-right: 1px solid #eef2f7;
    background: #fff;
}
.location-picker__item:hover {
    background: #eef2ff;
}
.location-picker__item .form-check-input {
    margin-top: 0;
    flex-shrink: 0;
}
.location-picker__item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-panel {
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    padding: 1rem 1.15rem 1.15rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--league-shadow);
}

.filter-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: -.15rem 0 .95rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--league-border);
}

.filter-panel__title {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--league-muted);
}

.filter-panel__title i {
    font-size: .95rem;
    opacity: .85;
}

.filter-panel__clear {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .65rem;
    border-radius: .45rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--league-muted);
    font-size: .8rem;
    font-weight: 550;
    text-decoration: none;
    line-height: 1.2;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.filter-panel__clear:hover {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
    text-decoration: none;
}

.filter-panel__clear i {
    font-size: .85rem;
}

.filter-panel .btn-primary {
    min-height: calc(1.5em + .5rem + 2px);
    padding: .35rem .9rem;
    font-size: .85rem;
    font-weight: 600;
}

.hub-card {
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hub-card:hover {
    border-color: var(--league-primary);
    box-shadow: 0 4px 14px rgba(79, 70, 229, .12);
}

a.badge.bg-light:hover {
    background-color: var(--league-primary-light) !important;
    color: var(--league-primary) !important;
}

/* ── Badges ── */
.badge-scope { font-size: .7rem; font-weight: 500; padding: .3em .65em; border-radius: .35rem; }
.badge-scope-all { background: #dbeafe; color: #1d4ed8; }
.badge-scope-sport { background: #d1fae5; color: #047857; }
.badge-scope-team { background: #fef3c7; color: #b45309; }

.badge-system { background: #f1f5f9; color: #475569; font-size: .7rem; }
.badge-active { background: #d1fae5; color: #047857; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }

/* ── Alerts ── */
.alert { border-radius: .5rem; border: none; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* ── Pagination ── */
.pagination .page-link { border-radius: .4rem; margin: 0 .15rem; color: var(--league-text); border-color: var(--league-border); font-size: .85rem; }
.pagination .page-item.active .page-link { background: var(--league-primary); border-color: var(--league-primary); }

/* ── Profile dropdown ── */
.profile-btn {
    display: flex; align-items: center; gap: .6rem;
    background: #f8fafc; border: 1px solid var(--league-border);
    border-radius: 2rem; padding: .35rem .85rem .35rem .45rem;
    font-size: .875rem; font-weight: 500;
}
.profile-btn:hover { background: #f1f5f9; }
.profile-btn.sport-active {
    background: var(--league-primary-light);
    border-color: rgba(79, 70, 229, .25);
    color: var(--league-primary);
}
.profile-btn.location-active {
    background: #ecfdf5;
    border-color: rgba(16, 185, 129, .3);
    color: #047857;
}
.profile-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--league-primary), var(--league-accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .9rem;
}
.profile-avatar.sport-avatar {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.profile-avatar.location-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}
.header-actions .dropdown-menu form { margin: 0; }
.header-actions .dropdown-item {
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.header-actions .dropdown-item.active {
    background: var(--league-primary-light);
    color: var(--league-primary);
}

/* ── Guest / Login ── */
.guest-body {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
    display: flex; align-items: center; justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-x: clip;
}

.login-card {
    background: var(--league-surface);
    border-radius: 1rem;
    box-shadow: var(--league-shadow-lg);
    width: 100%; max-width: 420px;
    overflow: hidden;
}

.login-card .login-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    padding: 2rem;
    text-align: center; color: #fff;
}

.login-card .login-header .login-icon {
    width: 56px; height: 56px;
    background: rgba(255,255,255,.2);
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin-bottom: .75rem;
}

.login-card .login-header .login-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: block;
    margin: 0 auto .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.login-card .login-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.login-card .login-header p { font-size: .85rem; opacity: .85; margin: .35rem 0 0; }

.login-card .login-body { padding: 2rem; }

.login-card .form-control {
    font-size: 1rem;
    min-height: 2.75rem;
    padding: .55rem .75rem;
}

/* ── Public gate (no login link) ── */
.gate-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: #0b1220;
    color: #fff;
    overflow-x: clip;
}

.gate {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding:
        max(1rem, env(safe-area-inset-top))
        max(1rem, env(safe-area-inset-right))
        max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem))
        max(1rem, env(safe-area-inset-left));
}

.gate__media {
    position: absolute;
    inset: 0;
}

.gate__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.45) saturate(1.05);
}

.gate__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 55% at 50% 40%, rgba(15, 23, 42, 0.15), rgba(15, 23, 42, 0.72) 70%),
        linear-gradient(180deg, rgba(11, 18, 32, 0.25), rgba(11, 18, 32, 0.85));
}

.gate__panel {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 1.25rem 1rem;
    max-width: 100%;
    animation: gateIn 0.7s ease both;
}

.gate__logo {
    width: clamp(56px, 16vw, 72px);
    height: clamp(56px, 16vw, 72px);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    margin-bottom: 1rem;
}

.gate__brand {
    margin: 0;
    font-size: clamp(1.55rem, 7vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.gate__tag {
    margin: 0.45rem 0 0;
    font-size: clamp(0.85rem, 3.6vw, 0.95rem);
    color: rgba(255, 255, 255, 0.72);
    font-weight: 500;
    padding-inline: .5rem;
}

.gate__credit {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding:
        1rem
        max(1rem, env(safe-area-inset-right))
        max(0.85rem, env(safe-area-inset-bottom))
        max(1rem, env(safe-area-inset-left));
    background: linear-gradient(180deg, transparent, rgba(8, 12, 22, 0.78));
}

.gate__copy {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
}

.gate__upwise {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: inherit;
    max-width: 100%;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.gate__upwise:hover {
    color: inherit;
    opacity: 0.95;
    transform: translateY(-1px);
}

.gate__upwise-label {
    font-size: 0.65rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.gate__upwise-mark {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    flex-shrink: 0;
}

.gate__upwise:hover .gate__upwise-mark {
    border-color: rgba(255, 255, 255, 0.22);
}

.gate__upwise-mark img {
    display: block;
    height: 26px;
    width: auto;
    border-radius: 6px;
}

@media (max-width: 520px) {
    .gate__credit {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.55rem;
    }

    .gate__upwise-label {
        letter-spacing: 0.04em;
    }
}

@keyframes gateIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ── Tabs (group edit) ── */
.nav-tabs-league { border-bottom: 2px solid var(--league-border); gap: .25rem; }
.nav-tabs-league .nav-link {
    border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
    color: var(--league-muted); font-weight: 500; font-size: .9rem;
    padding: .65rem 1.1rem; border-radius: .5rem .5rem 0 0;
    white-space: nowrap;
}
.nav-tabs-league .nav-link:hover { color: var(--league-primary); background: var(--league-primary-light); }
.nav-tabs-league .nav-link.active {
    color: var(--league-primary); border-bottom-color: var(--league-primary);
    background: transparent; font-weight: 600;
}

@media (max-width: 768px) {
    .nav-tabs-league {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs-league::-webkit-scrollbar { display: none; }
    .nav-tabs-league .nav-link {
        padding: .55rem .85rem;
        font-size: .85rem;
    }
}

/* ── User picker (bulk assign) ── */
.user-picker {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    padding: .5rem;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.user-picker .form-check {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .65rem .75rem;
    margin: 0;
    border-radius: .4rem;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
    min-height: 2.5rem;
}
.user-picker .form-check:hover {
    background: #fff;
    border-color: var(--league-border);
}
.user-picker .form-check-input {
    float: none;
    margin: .2rem 0 0 0;
    flex-shrink: 0;
}
.user-picker .form-check-label {
    font-size: .875rem;
    line-height: 1.45;
    cursor: pointer;
    padding-left: 0;
    flex: 1;
}

/* ── Permission checkboxes ── */
.perm-module .form-check {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .4rem 0;
    margin-bottom: .15rem;
}
.perm-module .form-check-input {
    float: none;
    margin: .15rem 0 0 0;
    flex-shrink: 0;
}
.perm-module .form-check-label {
    line-height: 1.4;
    padding-left: 0;
}

/* ── Permission grid ── */
.perm-module {
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    padding: 1rem;
    background: #fafbfc;
    height: 100%;
}
.perm-module-title {
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--league-muted); margin-bottom: .75rem;
    padding-bottom: .5rem; border-bottom: 1px solid var(--league-border);
}

/* ── Role assignments on user profile ── */
.role-filter-bar {
    padding: .65rem .75rem;
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    background: #f8fafc;
}
.role-filter-bar__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-bottom: .25rem;
}
.role-filter-bar__count {
    margin-left: auto;
}
.role-assignment-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    max-height: min(28rem, 55vh);
    overflow-y: auto;
    padding-right: .15rem;
}
.role-assignment-card {
    border: 1px solid var(--league-border);
    border-radius: .5rem;
    padding: .75rem .85rem;
    background: #f8fafc;
}
.role-assignment-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .65rem;
}
.role-assignment-card__title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--league-muted);
}
.role-desc { min-height: 1.1rem; }
.role-perm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.role-perm-chip {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .72rem;
    font-weight: 500;
}

/* ── Access / roles overview ── */
.access-user-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.access-user-card {
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    box-shadow: var(--league-shadow);
    overflow: hidden;
}
.access-user-card__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--league-border);
}
.access-user-card__identity {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}
.access-user-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.access-user-card__avatar--placeholder {
    display: grid;
    place-items: center;
    background: #e2e8f0;
    color: #64748b;
    font-size: 1rem;
}
.access-user-card__name {
    font-weight: 650;
    font-size: .9rem;
    line-height: 1.25;
}
.access-user-card__meta {
    font-size: .72rem;
    color: var(--league-muted);
}
.access-user-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.access-role-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.access-role-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: .75rem 1.25rem;
    align-items: start;
    padding: .65rem 1rem;
    border-bottom: 1px solid #eef2f7;
}
.access-role-row:last-child { border-bottom: 0; }
.access-role-row__scope {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .65rem;
}
@media (max-width: 700px) {
    .access-role-row {
        grid-template-columns: 1fr;
        gap: .35rem;
    }
}

.role-card .card-body { padding: 1.15rem 1.25rem; }
.role-perm-details summary {
    cursor: pointer;
    color: var(--league-primary);
    font-weight: 500;
}
.role-perm-list {
    list-style: none;
    padding: 0;
    max-height: 12rem;
    overflow: auto;
}
.role-perm-list li {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .3rem 0;
    border-bottom: 1px solid var(--league-border);
    font-size: .8rem;
}
.role-perm-list li code {
    font-size: .68rem;
    color: var(--league-muted);
}

/* ── Settings page ── */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, .9fr);
    gap: 1rem 1.5rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--league-border);
}
.settings-row:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-row:first-child { padding-top: 0; }
.settings-key {
    display: inline-block;
    margin-top: .35rem;
    font-size: .68rem;
    color: var(--league-muted);
}
@media (max-width: 767.98px) {
    .settings-row { grid-template-columns: 1fr; }
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--league-muted); }
.empty-state i { font-size: 2.5rem; opacity: .4; margin-bottom: .75rem; }

/* ── Page actions bar ── */
.page-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.page-actions .breadcrumb-text { font-size: .8rem; color: var(--league-muted); }

/* Scope panels — hidden until selected */
.scope-fields [data-scope-panel].d-none { display: none !important; }

/* User picker header */
.user-picker-header { border-bottom: 1px solid var(--league-border); padding-bottom: .5rem; margin-bottom: .5rem; }

.form-check-inline-select {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
}
.form-check-inline-select .form-check-input {
    float: none;
    margin: 0;
}
.form-check-inline-select .form-check-label {
    padding-left: 0;
}

@media (max-width: 992px) {
    .sidebar-toggle-btn {
        display: inline-flex;
        position: relative;
        z-index: 1200;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .sidebar-close-btn {
        display: inline-flex;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .app-shell { position: relative; }

    .app-header {
        padding: .7rem .85rem;
        z-index: 200;
        gap: .5rem;
    }

    .app-header .page-title { font-size: 1rem; }
    .app-header .page-subtitle { font-size: .72rem; }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(300px, 86vw);
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        z-index: 1100;
        transform: translateX(-105%);
        transition: transform .25s ease, visibility .25s ease;
        box-shadow: none;
        overflow: hidden;
        visibility: hidden;
        pointer-events: none;
    }

    .app-shell.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(15, 23, 42, .28);
        visibility: visible;
        pointer-events: auto;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1050;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }

    .app-shell.sidebar-open .sidebar-backdrop:not([hidden]) {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .app-content {
        padding: 1rem;
        min-width: 0;
    }

    .header-actions {
        gap: .35rem !important;
    }

    .header-actions .profile-btn {
        padding: .3rem;
        gap: 0;
        border-radius: 999px;
    }

    .header-actions .profile-btn span {
        display: none;
    }

    .header-actions .profile-btn.dropdown-toggle::after {
        display: none;
    }

    .profile-avatar {
        width: 34px;
        height: 34px;
    }

    .app-footer__inner {
        padding: .85rem 1rem max(.85rem, env(safe-area-inset-bottom));
    }

    .page-actions {
        flex-wrap: wrap;
        gap: .75rem;
        align-items: flex-start;
    }

    /* Avoid iOS zoom on focus (needs ≥16px) */
    .form-control,
    .form-select,
    .login-card .form-control {
        font-size: 16px;
        min-height: 2.75rem;
        padding: .55rem .75rem;
    }

    textarea.form-control {
        min-height: 5.5rem;
    }
}

@media (max-width: 768px) {
    .app-shell { flex-direction: row; }

    .login-card .login-header,
    .login-card .login-body {
        padding: 1.35rem 1.15rem;
    }

    .sport-picker__grid {
        grid-template-columns: 1fr;
        max-width: 280px;
        margin-inline: auto;
    }

    .sport-picker__title {
        font-size: 1.4rem;
    }

    .sport-picker__lead {
        font-size: .92rem;
        margin-bottom: 1.25rem;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* ── API Manual / Docs ── */
.api-docs {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.api-docs-toc {
    position: sticky;
    top: 1rem;
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    padding: 1rem;
    box-shadow: var(--league-shadow);
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.api-docs-toc-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--league-muted);
    margin-bottom: .75rem;
}

.api-docs-toc nav {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.api-docs-toc a {
    color: var(--league-text);
    text-decoration: none;
    font-size: .82rem;
    padding: .3rem .45rem;
    border-radius: .4rem;
    line-height: 1.3;
}

.api-docs-toc a:hover {
    background: var(--league-primary-light);
    color: var(--league-primary-dark);
}

.api-docs-toc a.toc-sub {
    padding-left: 1rem;
    font-size: .78rem;
    color: var(--league-muted);
}

.api-docs-top {
    display: inline-block;
    margin-top: .85rem;
    font-size: .75rem;
    color: var(--league-muted);
    text-decoration: none;
}

.api-docs-body {
    background: var(--league-surface);
    border: 1px solid var(--league-border);
    border-radius: var(--league-radius);
    box-shadow: var(--league-shadow);
    padding: 1.5rem 1.75rem 2rem;
}

.api-docs-hero {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--league-border);
}

.api-docs-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--league-primary-dark);
    background: var(--league-primary-light);
    border-radius: 999px;
    padding: .25rem .65rem;
    margin-bottom: .75rem;
}

.api-section {
    scroll-margin-top: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--league-border);
}

.api-section:last-of-type { border-bottom: 0; }

.api-section h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .85rem;
}

.api-code {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: .65rem;
    padding: .9rem 1rem;
    font-size: .8rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: .5rem 0 0;
}

.api-code code {
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.api-callout {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    color: #155e75;
    border-radius: .65rem;
    padding: .85rem 1rem;
    margin-top: 1rem;
    font-size: .9rem;
}

.api-callout i { font-size: 1.1rem; margin-top: .1rem; }

.api-endpoint {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--league-border);
    border-radius: .65rem;
}

.api-endpoint-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}

.api-method {
    display: inline-block;
    background: #059669;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .2rem .5rem;
    border-radius: .35rem;
}

.api-key-wrap {
    font-size: .72rem;
    word-break: break-all;
}

.api-demo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--league-primary-dark);
    max-width: 100%;
}

.api-demo-link code {
    font-size: .72rem;
    word-break: break-all;
    color: inherit;
}

.api-demo-link:hover {
    text-decoration: underline;
}

.api-link-list {
    list-style: none;
    padding: 0;
    margin: .5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.api-link-list a {
    text-decoration: none;
    color: var(--league-primary-dark);
}

.api-link-list a code {
    font-size: .78rem;
    word-break: break-all;
    color: inherit;
}

.api-link-list a:hover {
    text-decoration: underline;
}

.api-checklist {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.api-checklist label {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    font-size: .9rem;
    cursor: pointer;
}

.api-docs-footer {
    display: flex;
    gap: .5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--league-border);
}

@media (max-width: 992px) {
    .api-docs { grid-template-columns: 1fr; }
    .api-docs-toc { position: static; max-height: none; }
}

/* ── Sport picker gate ── */
.app-content:has(.sport-picker) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-block: 1rem;
}

.sport-picker {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
}
.sport-picker__panel {
    width: min(720px, 100%);
    text-align: center;
}
.sport-picker__icon {
    width: 4rem; height: 4rem; margin: 0 auto 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #0b3d2e, #1a6b4f);
    color: #fff; display: grid; place-items: center;
    font-size: 1.75rem;
}
.sport-picker__title { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.sport-picker__lead { color: var(--league-muted); margin-bottom: 1.75rem; }
.sport-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.sport-picker__card {
    width: 100%;
    border: 1px solid var(--league-border);
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    display: flex; flex-direction: column; align-items: center; gap: .75rem;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.sport-picker__card:hover {
    border-color: #1a6b4f;
    box-shadow: 0 8px 24px rgba(11, 61, 46, .12);
    transform: translateY(-2px);
}
.sport-picker__card-icon {
    width: 3rem; height: 3rem; border-radius: .85rem;
    background: #eef6f2; color: #0b3d2e;
    display: grid; place-items: center; font-size: 1.35rem;
}
.sport-picker__card-name { font-weight: 600; }

/* —— Match notes (Quill) —— */
.match-notes-wrap .ql-toolbar.ql-snow {
    border-color: var(--league-border, #dee2e6);
    border-radius: var(--league-radius, .5rem) var(--league-radius, .5rem) 0 0;
    background: #f8f9fa;
}
.match-notes-wrap .ql-container.ql-snow {
    border-color: var(--league-border, #dee2e6);
    border-radius: 0 0 var(--league-radius, .5rem) var(--league-radius, .5rem);
    font-size: .95rem;
}
.match-notes-wrap .ql-editor {
    min-height: 9rem;
}
.match-notes-wrap .ql-editor.ql-blank::before {
    font-style: normal;
    color: #adb5bd;
}
.match-notes p:last-child { margin-bottom: 0; }
.match-notes ul,
.match-notes ol { margin: .35rem 0 .35rem 1.15rem; padding: 0; }
.match-notes a { text-decoration: underline; }

/* —— Match photos —— */
.match-photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}
.match-photo-tile {
    position: relative;
    margin: 0;
    width: 7.5rem;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid var(--league-border, #dee2e6);
    background: #f8f9fa;
}
.match-photo-tile img {
    display: block;
    width: 100%;
    height: 5.5rem;
    object-fit: cover;
}
.match-photo-tile__delete {
    position: absolute;
    top: .35rem;
    right: .35rem;
    padding: .15rem .35rem;
    background: rgba(255,255,255,.92);
}
.match-photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.match-photo-preview img {
    width: 4.5rem;
    height: 3.4rem;
    object-fit: cover;
    border-radius: .35rem;
    border: 1px solid var(--league-border, #dee2e6);
}

.match-links-editor__row + .match-links-editor__row {
    margin-top: .5rem;
}

.match-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.match-link-list li {
    padding: .35rem 0;
    border-bottom: 1px solid var(--league-border, #eee);
}
.match-link-list li:last-child { border-bottom: 0; }
.match-link-list a {
    font-weight: 600;
    text-decoration: none;
}
.match-link-list a:hover { text-decoration: underline; }

.user-photo-preview__btn {
    display: inline-block;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: .65rem;
    cursor: zoom-in;
    line-height: 0;
}
.user-photo-preview__btn:focus-visible {
    outline: 2px solid var(--league-primary);
    outline-offset: 2px;
}
.user-photo-preview img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: .65rem;
    border: 1px solid var(--league-border, #dee2e6);
    transition: opacity .15s ease, transform .15s ease;
}
.user-photo-preview__btn:hover img {
    opacity: .92;
    transform: scale(1.03);
}

.photo-litebox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .15s ease;
    cursor: zoom-out;
}
.photo-litebox.is-open { opacity: 1; }
.photo-litebox[hidden] { display: none !important; }
.photo-litebox__img {
    max-width: min(92vw, 42rem);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: .5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    cursor: default;
    transform: scale(.97);
    transition: transform .15s ease;
}
.photo-litebox.is-open .photo-litebox__img { transform: scale(1); }
.photo-litebox__close {
    position: absolute;
    top: .65rem;
    right: .85rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}
.photo-litebox__close:hover { background: rgba(255, 255, 255, .28); }
body.photo-litebox-open { overflow: hidden; }

/* ── Creative slots map ── */
.slots-flow {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    max-width: 520px;
}
.slots-flow__block {
    display: grid;
    gap: .15rem;
    padding: .7rem .85rem;
    border-radius: .65rem;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: inherit;
    text-decoration: none;
}
.slots-flow__block.is-page {
    border-style: solid;
    border-color: #e2e8f0;
    background: #fff;
    color: var(--league-muted);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.slots-flow__block.is-ad,
.slots-flow__block.is-sponsor {
    border-style: solid;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.slots-flow__block.is-ad {
    border-color: rgba(79, 70, 229, .35);
    background: linear-gradient(180deg, #eef2ff, #fff);
}
.slots-flow__block.is-sponsor {
    border-color: rgba(245, 158, 11, .4);
    background: linear-gradient(180deg, #fffbeb, #fff);
}
.slots-flow__block.is-filled {
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}
.slots-flow__block:hover {
    transform: translateY(-1px);
    color: inherit;
}
.slots-flow__block strong {
    font-size: .92rem;
}
.slots-flow__block span {
    font-size: .75rem;
    color: var(--league-muted);
}
.slots-flow__block em {
    font-style: normal;
    font-size: .72rem;
    font-weight: 650;
    color: #0f172a;
}



