/* =====================================================
   RefereeNow Admin — CSS
   ===================================================== */

:root {
    --primary: #1E3A5F;
    --primary-light: #2E6DA4;
    --accent: #F59E0B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #F3F4F6;
    --white: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
}

/* =====================================================
   LAYOUT
   ===================================================== */

.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =====================================================
   SIDEBAR
   ===================================================== */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-title {
    color: var(--white);
    font-weight: 600;
    font-size: 16px;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 16px 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

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

.nav-link.active {
    background: var(--primary-light);
    color: var(--white);
    font-weight: 500;
}

.badge-nav {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

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

/* =====================================================
   HEADER
   ===================================================== */

.admin-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* =====================================================
   PAGE HEADER
   ===================================================== */

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* =====================================================
   CARDS & KPI
   ===================================================== */

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.card-kpi {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-kpi-alert {
    border-left: 3px solid var(--danger);
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =====================================================
   REAL-TIME INDICATOR
   ===================================================== */

.realtime-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-left: auto;
}

.realtime-indicator.connected { color: var(--success); }
.realtime-indicator.disconnected { color: var(--text-secondary); }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* =====================================================
   BADGES
   ===================================================== */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-active { background: #D1FAE5; color: #065F46; }
.badge-inactive { background: #FEE2E2; color: #991B1B; }
.badge-completed { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.ms-2 { margin-left: 8px; }

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, background 0.15s;
    white-space: nowrap;
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { opacity: 0.85; }

.btn-secondary { background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* =====================================================
   FORMS
   ===================================================== */

.form-group {
    margin-bottom: 16px;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--white);
    transition: border-color 0.15s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(46, 109, 164, 0.15);
}

.form-textarea { resize: vertical; }

.required { color: var(--danger); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-input { max-width: 260px; }

/* =====================================================
   TABLE
   ===================================================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--white);
}

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

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #F9FAFB; }

.action-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.comment-cell {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    padding: 48px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* =====================================================
   PAGINATION
   ===================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */

.loading-spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px;
}

.loading-spinner-icon {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.auth-loading {
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   MODAL
   ===================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    min-width: 360px;
    max-width: 480px;
    box-shadow: var(--shadow-md);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   ALERTS
   ===================================================== */

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
}

.alert-close:hover { opacity: 1; }

/* =====================================================
   DETAIL VIEW
   ===================================================== */

.detail-card {
    max-width: 700px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

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

.detail-label {
    min-width: 160px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.action-bar {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    font-size: 20px;
    font-weight: 700;
    border-radius: 14px;
    margin-bottom: 12px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* =====================================================
   TOGGLE
   ===================================================== */

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* =====================================================
   RESPONSIVE
   ===================================================== */

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary, #1a1a1a);
    padding: 8px;
    margin-right: auto;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.mobile-menu-btn:active {
    background: var(--border, #e5e7eb);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

    .admin-layout.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .admin-layout.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .sports-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   CERTIFICATION FORM
   ===================================================== */

.cert-form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.cert-form-header {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: 1.125rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
}

.cert-form-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.15);
    border-radius: 8px;
    flex-shrink: 0;
}

.cert-form-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.cert-form-subtitle {
    margin: .1rem 0 0;
    font-size: .75rem;
    color: rgba(255,255,255,.7);
}

.cert-form-close {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}

.cert-form-close:hover:not(:disabled) {
    background: rgba(255,255,255,.25);
}

.cert-form-body {
    padding: 1.5rem;
}

.cert-form-section {
    margin-bottom: 1.5rem;
}

.cert-form-section-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.cert-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.required-star {
    color: var(--danger);
    font-weight: 700;
}

.field-error {
    display: block;
    font-size: .78rem;
    color: var(--danger);
    margin-top: .25rem;
}

.cert-file-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1.75rem 1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-align: center;
}

.cert-file-zone:hover {
    border-color: var(--primary-light);
    background: #f0f7ff;
}

.cert-file-name {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.cert-file-hint {
    font-size: .78rem;
    color: var(--text-secondary);
}

.cert-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .75rem;
    padding-top: 1.25rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.cert-form-actions .btn {
    display: inline-flex;
    align-items: center;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .cert-form-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   SPORTS
   ===================================================== */

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

.sport-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    box-shadow: var(--shadow);
}

.sport-card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sport-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sport-card-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: .5rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   MODALS
   ===================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border);
}

/* ── Configuration tabs ───────────────────────────── */
.tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: .6rem 1.1rem;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -2px;
}
.tab-btn:hover { color: var(--primary-light); }
.tab-active {
    color: var(--primary-light) !important;
    border-bottom-color: var(--primary-light) !important;
}

.form-hint {
    display: block;
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: .25rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .875rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: border-color .15s;
}
.radio-option input[type="radio"] { display: none; }
.radio-selected { border-color: var(--primary-light); color: var(--primary-light); }

.btn-icon-overlay {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: .2rem;
}

.alert-warning {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: var(--radius);
    color: #92400E;
}

/* =====================================================
   AVAILABILITY TOGGLE (referee dashboard)
   ===================================================== */
.availability-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--border);
}

.availability-card.is-available { border-left-color: #16a34a; }
.availability-card.is-unavailable { border-left-color: #dc2626; }

.availability-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.availability-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.is-available .availability-status-dot { background: #16a34a; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15); }
.is-unavailable .availability-status-dot { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }

.availability-title { display: block; font-weight: 600; }
.availability-subtitle { display: block; font-size: 0.82rem; color: var(--text-secondary, #6b7280); }

.switch { position: relative; display: inline-block; width: 52px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 28px;
    transition: background 0.2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .switch-slider { background: #16a34a; }
.switch input:checked + .switch-slider::before { transform: translateX(24px); }
.switch input:disabled + .switch-slider { opacity: 0.6; cursor: wait; }

@media (max-width: 640px) {
    .availability-card { flex-wrap: wrap; }
}

/* ===================== Statistiques ===================== */
.page-subtitle { margin: .25rem 0 0; color: var(--text-secondary); font-size: .9rem; }

.stats-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 2rem 0 .85rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--border);
}
.stats-section-title:first-of-type { margin-top: .5rem; }

.kpi-sub { display: block; margin-top: .3rem; font-size: .75rem; color: var(--text-secondary); }

.chart-title { margin: 0 0 1rem; font-size: .95rem; font-weight: 600; }
.stats-empty { color: var(--text-secondary); font-size: .875rem; text-align: center; padding: 1.5rem 0; margin: 0; }
.stats-hint { margin: .85rem 0 0; font-size: .75rem; color: var(--text-secondary); }

.stats-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .stats-two-col { grid-template-columns: 1fr; } }

/* --- Histogramme vertical --- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: .4rem;
    height: 220px;
    padding-top: 1.25rem;
}
.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    min-width: 0;
}
.bar-group { display: flex; align-items: flex-end; gap: 2px; width: 100%; height: 100%; justify-content: center; }
.bar {
    width: 100%;
    max-width: 34px;
    min-height: 2px;
    background: linear-gradient(180deg, #4f46e5, #6366f1);
    border-radius: 4px 4px 0 0;
    transition: opacity .15s;
}
.bar-col:hover .bar { opacity: .8; }
.bar-ref { background: linear-gradient(180deg, #4f46e5, #6366f1); }
.bar-team { background: linear-gradient(180deg, #0ea5e9, #38bdf8); }
.bar-value { font-size: .62rem; color: var(--text-secondary); margin-bottom: .2rem; white-space: nowrap; }
.bar-label {
    font-size: .65rem;
    color: var(--text-secondary);
    margin-top: .4rem;
    white-space: nowrap;
    transform: rotate(-45deg);
    transform-origin: center;
    height: 1.4rem;
}

.chart-legend { display: flex; gap: 1.25rem; font-size: .78rem; color: var(--text-secondary); margin-bottom: .5rem; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }
.legend-ref { background: #6366f1; }
.legend-team { background: #38bdf8; }

/* --- Barres horizontales --- */
.hbar-list { display: flex; flex-direction: column; gap: .6rem; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: .75rem; }
.hbar-label { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, #4f46e5, #818cf8); border-radius: 6px; min-width: 2px; }
.hbar-count { font-size: .82rem; font-weight: 600; min-width: 2ch; text-align: right; }

@media (max-width: 600px) {
    .hbar-row { grid-template-columns: minmax(70px, 100px) 1fr auto; gap: .5rem; }
    .bar-chart { height: 180px; }
    .bar-value { display: none; }
}

/* ===================== Demandes de sport ===================== */
.request-list { display: flex; flex-direction: column; gap: 1rem; }
.request-card { padding: 1.25rem; }
.request-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.request-title { margin: 0; font-size: 1rem; font-weight: 600; }
.request-meta { margin: .25rem 0 0; font-size: .78rem; color: var(--text-secondary); }
.request-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem 1.25rem;
    font-size: .85rem;
}
.request-label { display: block; font-size: .72rem; color: var(--text-secondary); margin-bottom: .1rem; }
.request-comment {
    margin-top: 1rem;
    padding: .65rem .85rem;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    font-size: .82rem;
}
.request-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; }
@media (max-width: 600px) { .request-head { flex-direction: column; } }

/* ===================== Catégories de sport ===================== */
.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    margin: 1rem;
    box-shadow: var(--shadow-md);
}
.form-check { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.form-check input { width: 16px; height: 16px; }

.cat-group { padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.cat-group-title { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.cat-list { display: flex; flex-direction: column; gap: .5rem; }
.cat-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .65rem .85rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.cat-row-inactive { opacity: .6; background: var(--bg); }
.cat-info { display: flex; align-items: baseline; gap: .75rem; }
.cat-name { font-weight: 600; }
.cat-count { font-size: .78rem; color: var(--text-secondary); }
.cat-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 600px) {
    .cat-row { flex-direction: column; align-items: stretch; }
    .cat-actions { justify-content: flex-end; }
}

/* ===================== Éditeur riche ===================== */
.rte { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.rte-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
    padding: 6px 8px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.rte-toolbar button {
    min-width: 32px; height: 30px; padding: 0 8px;
    border: 1px solid transparent; border-radius: 5px;
    background: transparent; cursor: pointer; font-size: .85rem;
    color: var(--text-primary);
}
.rte-toolbar button:hover { background: var(--white); border-color: var(--border); }
.rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.rte-content {
    min-height: 220px; max-height: 500px; overflow-y: auto;
    padding: 14px 16px; font-size: .92rem; line-height: 1.6; outline: none;
}
.rte-content:focus { background: #fff; }
.rte-content h3 { font-size: 1.15rem; font-weight: 700; margin: .75rem 0 .4rem; }
.rte-content h4 { font-size: 1rem; font-weight: 600; margin: .6rem 0 .3rem; }
.rte-content p { margin: .4rem 0; }
.rte-content ul, .rte-content ol { margin: .4rem 0 .4rem 1.5rem; }
.rte-content a { color: var(--primary); text-decoration: underline; }

/* ===================== Onglets contenu ===================== */
.content-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.content-tab {
    padding: .5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--white); cursor: pointer; font-size: .9rem; font-weight: 500;
    color: var(--text-secondary);
}
.content-tab:hover { border-color: var(--border-dark); }
.content-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Demandes de contact ── */
.contact-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-chip {
    padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text-secondary); cursor: pointer;
    font-size: .85rem; transition: all .15s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip-on { background: var(--primary); color: #fff; border-color: var(--primary); }

.contact-card { margin-bottom: 1rem; border-left: 3px solid var(--border); }
.contact-card.status-new { border-left-color: #2563eb; }
.contact-card.status-progress { border-left-color: #d97706; }
.contact-card.status-resolved { border-left-color: #16a34a; }

.contact-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.contact-card-id { display: flex; align-items: center; gap: .6rem; }
.contact-ticket { font-family: monospace; font-weight: 600; font-size: .9rem; color: var(--text-primary); }
.contact-badge { padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.contact-badge.status-new { background: #dbeafe; color: #1d4ed8; }
.contact-badge.status-progress { background: #fef3c7; color: #b45309; }
.contact-badge.status-resolved { background: #dcfce7; color: #15803d; }
.contact-date { font-size: .82rem; color: var(--text-secondary); }

.contact-card-body { margin-bottom: .9rem; }
.contact-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .88rem; color: var(--text-secondary); margin-bottom: .5rem; }
.contact-meta a { color: var(--primary); text-decoration: none; }
.contact-subject { font-weight: 600; color: var(--text-primary); margin-bottom: .4rem; }
.contact-message { white-space: pre-wrap; color: var(--text-secondary); margin: 0; line-height: 1.5; }

.contact-card-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: .75rem; }
.contact-actions-label { font-size: .82rem; color: var(--text-secondary); margin-right: .25rem; }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }

/* ── Demandes de tournoi ── */
.contact-badge.status-rejected, .contact-card.status-rejected { }
.contact-card.status-rejected { border-left-color: #dc2626; }
.contact-badge.status-rejected { background: #fee2e2; color: #b91c1c; }
.tournament-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem; margin: .75rem 0;
}
.tournament-grid > div { display: flex; flex-direction: column; }
.tg-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); }
.tournament-block { margin-top: .75rem; }
.tournament-block .tg-label { display: block; margin-bottom: .25rem; }

/* ── Ligues par sport ── */
.league-list { display: flex; flex-direction: column; gap: .5rem; max-height: 320px; overflow-y: auto; }
.league-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; }

/* Onglets de langue dans l'éditeur de contenu */
.lang-edit-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.lang-edit-tab { padding: .5rem 1rem; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-pill); font-size: .85rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.lang-edit-tab.on { background: var(--primary, #166534); border-color: var(--primary, #166534); color: #fff; }

/* Aperçu de notification (admin) */
.notif-preview { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; background: #fff; }
.notif-preview-title { font-weight: 700; margin-bottom: .5rem; }
.notif-preview-body { line-height: 1.6; }
.notif-preview-body img { max-width: 100%; height: auto; border-radius: 6px; }

/* --- Stats charts (Chart.js canvases) --- */
.chart-canvas-wrap { position: relative; height: 320px; width: 100%; }
.chart-canvas-doughnut { height: 280px; }
.chart-title { font-size: 1rem; font-weight: 700; color: var(--text-primary, #1a1a2e); margin: 0 0 1rem; }
.stats-section-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary, #1a1a2e); margin: 2rem 0 1rem; padding-bottom: .5rem; border-bottom: 2px solid rgba(22,101,52,.12); }
.kpi-sub { display:block; font-size:.78rem; color: var(--text-secondary,#6b7280); margin-top:.35rem; }
.stats-empty { color: var(--text-secondary,#6b7280); font-style: italic; padding: 1.5rem 0; text-align:center; }
