a.nav-btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.club-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.club-switcher__prefix {
    white-space: nowrap;
}

.clubs-modal {
    max-width: 720px;
    width: calc(100% - 32px);
}

.clubs-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.clubs-modal__header h2 {
    text-align: left;
    color: var(--primary, #336e78);
}

.club-switcher__select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary, #336e78);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 30px;
    padding: 9px 36px 9px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    max-width: min(240px, 42vw);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23336e78' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.club-switcher__select:disabled {
    opacity: 0.75;
    cursor: default;
}

.club-switcher__select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 2px;
}

.app-panel {
    max-width: 960px;
    margin: 28px auto;
    background: #fff;
    padding: 28px 32px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.app-panel h1 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.6rem;
}

.app-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.app-toolbar #page-title {
    flex: 1 1 auto;
    min-width: 0;
}

.app-toolbar-back {
    flex: 0 0 auto;
    margin-left: auto;
}

.app-panel.tournament-view .app-toolbar {
    margin-bottom: 0;
    flex-wrap: nowrap;
    align-items: flex-start;
}

.app-panel.tournament-view .app-toolbar #page-title {
    font-size: 1.35rem;
    line-height: 1.35;
}

.app-panel.tournament-view .app-meta {
    display: none;
    margin: 0;
    min-height: 0;
}

.app-panel.tournament-view #form-error:empty {
    display: none;
    margin: 0;
    min-height: 0;
    padding: 0;
}

.app-panel.tournament-view #view-actions {
    margin-top: 0 !important;
    margin-bottom: 0;
}

.app-panel.tournament-view #view-actions:not(:empty) {
    margin-bottom: 8px;
}

.app-panel.tournament-view #view-actions .work-btn {
    margin: 2px 6px 2px 0;
    padding: 8px 16px;
    font-size: 14px;
}

.app-panel.tournament-view #standings.pairings-board {
    margin-top: 0;
}

.app-panel.tournament-view #pairings.pairings-board,
.tournament-view #pairings.pairings-board {
    margin-top: 12px;
}

.app-panel.tournament-view .round-block,
.tournament-view .round-block {
    margin-top: 14px;
}

.app-panel.tournament-view .round-block:first-child,
.tournament-view .round-block:first-child {
    margin-top: 0;
}

.app-panel.tournament-view .round-block h2,
.tournament-view .round-block h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.app-toolbar .spacer {
    flex: 1;
}

.app-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.data-table th {
    color: var(--primary);
    font-weight: 700;
}

.data-table tr:hover td {
    background: #f7fbfd;
}

.data-table .actions {
    white-space: nowrap;
    text-align: right;
}

.btn-sm {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    margin: 0 2px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.btn-sm.danger {
    background: #e74c3c;
}

.btn-sm.secondary {
    background: #5d6d7e;
}

.btn-sm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.player-check-list {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 8px 0 14px;
}

.player-check-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    cursor: pointer;
    font-weight: normal;
}

.player-check-list label:hover {
    background: #f0f7fa;
}

.pairings-board {
    margin-top: 18px;
}

.pairings-board h2 {
    color: var(--primary);
    font-size: 1.2rem;
}

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: #e8f4f6;
    color: var(--primary);
}

.status-pill.inprogress {
    background: #e8f8e8;
    color: #1e7a2e;
}

.status-pill.finished {
    background: #eee;
    color: #555;
}

.empty-hint {
    color: #777;
    padding: 24px 0;
    text-align: center;
}

.result-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.btn-result {
    background: #eef3f5;
    color: #333;
    border: 1px solid #c5d5da;
    border-radius: 12px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.btn-result:hover {
    background: #dceaf0;
}

.btn-result.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.result-cell {
    min-width: 160px;
}

.ct-wrap {
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    width: 100%;
}

.crosstable {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    font-size: 13px;
    background: #fff;
}

.crosstable th {
    background: #2d2d30;
    color: #fff;
    font-weight: 700;
    padding: 5px 2px;
    text-align: center;
    white-space: nowrap;
    border: 1px solid #1f1f22;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crosstable td {
    border: 1px solid #e0e0e0;
    text-align: center;
    padding: 3px 1px;
    vertical-align: middle;
    height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crosstable tr.ct-alt td {
    background: #f8f8f8;
}

.crosstable .ct-place {
    width: 28px;
}

.crosstable .ct-name {
    text-align: left !important;
    font-weight: 700;
    font-size: 13px;
    padding-left: 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crosstable thead .ct-name {
    text-align: center !important;
    font-size: 12px;
}

.crosstable .ct-num {
    width: 36px;
}

.crosstable .ct-opp,
.crosstable .ct-cell {
    width: 28px;
    font-weight: 600;
    font-size: 12px;
}

.crosstable .ct-diag {
    background: #3c3c3c !important;
    color: #3c3c3c !important;
}

.crosstable .ct-diag.ct-diag-bye {
    color: #fff !important;
    font-weight: 700;
}

.crosstable .ct-black {
    background: #bebebe !important;
}

.crosstable tr.ct-alt .ct-black {
    background: #b0b0b0 !important;
}

.crosstable .ct-pending {
    background: #ffeca0 !important;
    color: #503200 !important;
    font-size: 12px;
    font-weight: 700;
}

.crosstable .ct-bold {
    font-weight: 700;
}

.crosstable .ct-delta-up {
    color: #2e7d32;
}

.crosstable .ct-delta-down {
    color: #c62828;
}

.ct-legend {
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #643c00;
    background: #fff8dc;
    border-radius: 4px;
}

.stats-page {
    max-width: 1200px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.stats-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 14px 16px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    min-width: 0;
}

.stats-card h2 {
    margin: 0 0 12px;
    color: var(--primary, #336e78);
    font-size: 1.05rem;
}

.stats-card--h2h {
    grid-row: 1 / span 2;
    grid-column: 2;
}

.stats-card--tournaments {
    grid-column: 1;
}

.chart-wrap {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

#rating-chart {
    display: block;
    width: 100%;
    height: 320px;
}

.chart-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #777;
    min-height: 1.4em;
}

.h2h-summary {
    font-weight: 700;
    font-size: 15px;
    margin: 4px 0 12px;
    color: #333;
}

#opponent-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

tr.clickable {
    cursor: pointer;
}

tr.clickable:hover td {
    background: #eef6f8;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stats-card--h2h,
    .stats-card--tournaments {
        grid-column: 1;
        grid-row: auto;
    }
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.inline-form .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form input[type="date"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.players-sort {
    appearance: auto;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    min-width: 150px;
    cursor: pointer;
}

.club-switcher__name {
    color: #fff;
    font-weight: 700;
    max-width: min(280px, 46vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-tree {
    margin-top: 8px;
}

.browse-tree__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.browse-tree__children {
    display: none;
    padding-left: 18px;
    margin-top: 2px;
    border-left: 1px solid #e2e8ea;
}

.browse-tree__item.is-open > .browse-tree__children {
    display: block;
}

.browse-tree__toggle,
.browse-tree__club-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #244;
    font: inherit;
    text-decoration: none;
}

.browse-tree__toggle:hover,
.browse-tree__club-link:hover {
    background: #f3f7f8;
}

.browse-tree__marker {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid #6a8f96;
    flex: 0 0 auto;
    transition: transform 0.15s ease;
}

.browse-tree__item.is-open > .browse-tree__toggle > .browse-tree__marker {
    transform: rotate(90deg);
}

.browse-tree__label {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
}

.browse-tree__meta {
    flex: 0 0 auto;
    color: #7a8a8e;
    font-size: 13px;
    font-weight: 500;
}

.browse-tree__clubs {
    border-left-color: #d5e2e5;
}

.browse-tree__club-link .browse-tree__label {
    color: var(--primary, #336e78);
}

.browse-tree__club-link::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9bb7bc;
    flex: 0 0 auto;
}

.browse-tree__club-link.is-selected {
    background: #e7f2f4;
    outline: 1px solid #9bb7bc;
}

.browse-tree__club-link.is-selected::before {
    background: var(--primary, #336e78);
}
