/* =====================================================
   ANOSTC - Sistema de Gerenciamento Esportivo
   ===================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --sidebar-bg: #ffffff;
    --sidebar-width: 280px;
    --sidebar-collapsed: 0px;
    --body-bg: #f1f5f9;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 10px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* =================== SIDEBAR =================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.sidebar-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 1px;
}

.sidebar-nav-global {
    padding: 8px 12px 4px;
    flex: 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-event {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #eef4ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

.sidebar-event img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.sidebar-event .event-info {
    flex: 1;
}

.sidebar-event .event-info strong {
    font-size: 0.92rem;
    display: block;
    color: var(--primary-dark);
    font-weight: 700;
}

.sidebar-event .event-info small {
    font-size: 0.76rem;
    color: var(--primary);
    font-weight: 500;
}

/* Botão seletor de evento */
.event-selector-btn {
    background: none;
    border: 1px solid #bfdbfe;
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.event-selector-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Modal seletor de evento */
.event-selector-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.event-selector-overlay.show {
    display: flex;
}

.event-selector-modal {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.event-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.event-selector-header strong {
    font-size: 1rem;
    color: var(--text-dark);
}

.event-selector-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.event-selector-close:hover {
    color: var(--danger);
    background: #fef2f2;
}

.event-selector-list {
    overflow-y: auto;
    padding: 8px;
}

.event-selector-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.event-selector-item:hover {
    background: #f1f5f9;
}

.event-selector-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.event-selector-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    padding: 4px;
    flex-shrink: 0;
}

.event-selector-item .event-item-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.event-selector-item .event-item-info {
    flex: 1;
}

.event-selector-item .event-item-info strong {
    display: block;
    font-size: 0.92rem;
    color: var(--text-dark);
}

.event-selector-item .event-item-info small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.event-selector-item .event-item-check {
    color: var(--primary);
    font-size: 1.2rem;
    display: none;
}

.event-selector-item.selected .event-item-check {
    display: block;
}

.event-item-status {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

.event-item-status.active {
    background: #dcfce7;
    color: #16a34a;
}

.event-item-status.inactive {
    background: #f1f5f9;
    color: #94a3b8;
}

.sidebar-nav {
    flex: 0;
    padding: 12px 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
}

.sidebar-nav a i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

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

.sidebar-nav a.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-footer small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =================== MAIN CONTENT =================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px;
}

.topbar-event-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--white);
    padding: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.topbar-user i {
    font-size: 1.5rem;
    color: var(--primary);
}

.btn-logout {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

.content-area {
    padding: 32px;
}

/* =================== CARDS =================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* =================== STATS GRID =================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--white);
}

.stat-icon.blue { background: var(--primary); }
.stat-icon.green { background: var(--success); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.red { background: var(--danger); }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =================== BUTTONS =================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* =================== FORMS =================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.92rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* =================== TABLES =================== */
.table-responsive {
    overflow-x: auto;
}

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

table th, table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

table th {
    background: var(--body-bg);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: #f8fafc;
}

/* =================== ALERTS =================== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* =================== SUMMARY BAR =================== */
.summary-bar {
    display: flex;
    background: #38bdf8;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.summary-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 6px 10px;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: var(--transition);
    border-right: 1px solid rgba(255,255,255,0.15);
    position: relative;
    gap: 1px;
    min-width: 0;
}

.summary-card:last-child {
    border-right: none;
}

.summary-card:hover {
    background: rgba(255,255,255,0.1);
}

.summary-card.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.summary-card i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.summary-number {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 2px;
    color: rgba(255,255,255,0.9);
    text-align: center;
    line-height: 1.2;
}

.summary-filter {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 4px;
    transition: var(--transition);
}

.summary-filter:hover {
    background: rgba(255,255,255,0.35);
}

.summary-card-warning {
    background: #f59e0b;
}

.summary-card-warning:hover {
    background: #d97706;
}

.summary-card-warning.active {
    background: #b45309;
}

.summary-card-excluidos {
    background: #ef4444;
}

.summary-card-excluidos:hover {
    background: #dc2626;
}

.summary-card-excluidos.active {
    background: #b91c1c;
}

@media (max-width: 768px) {
    .summary-bar {
        flex-wrap: wrap;
    }

    .summary-card {
        flex: 1 1 33%;
        min-width: 0;
        padding: 14px 8px 10px;
        border-bottom: 1px solid rgba(255,255,255,0.15);
    }

    .summary-number {
        font-size: 1.4rem;
    }

    .summary-label {
        font-size: 0.72rem;
    }
}

/* =================== CUSTOM SELECT =================== */
.cs-wrapper {
    position: relative;
    width: 100%;
}

.cs-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.92rem;
    min-height: 42px;
}

.cs-display:hover {
    border-color: #cbd5e1;
}

.cs-wrapper.open .cs-display {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cs-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dark);
}

.cs-value.cs-placeholder {
    color: var(--text-muted);
}

.cs-arrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
    margin-left: 8px;
    flex-shrink: 0;
}

.cs-dropdown {
    display: none;
    position: fixed;
    background: var(--white);
    border: 1px solid var(--primary);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 99999;
    overflow: hidden;
    flex-direction: column;
}

.cs-wrapper.open .cs-dropdown {
    display: flex;
}

.cs-wrapper.cs-dropup .cs-dropdown {
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
}

.cs-search-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.cs-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
    background: #f8fafc;
    color: var(--text-dark);
}

.cs-search:focus {
    border-color: var(--primary);
    background: var(--white);
}

.cs-list {
    max-height: none;
    overflow-y: auto;
    flex: 1;
}

.cs-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.cs-option:last-child {
    border-bottom: none;
}

.cs-option:hover,
.cs-option.highlighted {
    background: var(--primary-light);
    color: var(--primary);
}

.cs-option.selected {
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
}

.cs-option.selected:hover,
.cs-option.selected.highlighted {
    background: var(--primary-dark);
    color: var(--white);
}

.cs-empty {
    padding: 16px 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Scrollbar da lista */
.cs-list::-webkit-scrollbar {
    width: 6px;
}

.cs-list::-webkit-scrollbar-track {
    background: transparent;
}

.cs-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* =================== FILTERS BAR =================== */
.filters-bar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 16px;
}

.filters-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 160px;
}

.filter-search {
    position: relative;
    flex: 1.5;
}

.filter-search .form-control {
    padding-right: 48px;
}

.btn-search {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: var(--white);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-search:hover {
    background: var(--primary-dark);
}

/* =================== ACTIONS BAR =================== */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.actions-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.actions-right {
    display: flex;
    gap: 10px;
}

/* Inscrições: badge "Inscrições abertas até..." + botão Nova Pré-Inscrição.
   Em desktop: lado a lado. Em mobile: empilhados (badge em cima, botão em baixo). */
.insc-actions-right {
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-export {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    color: var(--white);
}

.btn-export-green {
    background: #0ea5e9;
}

.btn-export-green:hover {
    background: #0284c7;
}

.btn-export-red {
    background: #f97316;
}

.btn-export-red:hover {
    background: #ea580c;
}

/* =================== TABLE ATLETAS =================== */
.card-table {
    padding: 0;
    overflow: hidden;
}

.card-table .table-responsive {
    margin: 0;
}

/* Colunas ordenáveis */
th[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
}

th[data-sort]:hover {
    color: var(--primary);
}

th[data-sort]::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.3;
}

th[data-sort].sort-asc::after {
    content: '↑';
    opacity: 0.8;
    color: var(--primary);
}

th[data-sort].sort-desc::after {
    content: '↓';
    opacity: 0.8;
    color: var(--primary);
}

.card-table table th {
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    white-space: nowrap;
}

.card-table table td {
    padding: 12px 16px;
    vertical-align: middle;
}

.th-num { width: 50px; text-align: center; }
.th-atleta { min-width: 250px; }
.th-center { text-align: center; }
.td-num { text-align: center; color: var(--text-muted); font-weight: 500; }
.td-center { text-align: center; }

.td-loading, .td-empty {
    text-align: center;
    padding: 40px 16px !important;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* Atleta cell com avatar */
.atleta-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.atleta-nome {
    font-weight: 500;
    color: var(--text-dark);
}

/* Delegação com logo */
.deleg-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deleg-logo {
    border: none;
    background: none;
    padding: 0;
    border-radius: 0;
    flex-shrink: 0;
    object-fit: contain;
}

/* Badge situação */
.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
}

/* Botões de ação na tabela */
.td-acoes {
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    margin: 0 2px;
}

.btn-icon-info {
    color: #0ea5e9;
}

.btn-icon-info:hover {
    background: #e0f2fe;
}

.btn-icon-edit {
    color: #f59e0b;
}

.btn-icon-edit:hover {
    background: #fef3c7;
}

.btn-icon-delete {
    color: var(--danger);
}

.btn-icon-delete:hover {
    background: #fef2f2;
}

/* =================== PAGINATION =================== */
.pagination-bar {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

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

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.btn-page {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-page:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-page.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 0.88rem;
    color: var(--text-muted);
    user-select: none;
}

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

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* =================== MODAL =================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-overlay.show {
    display: flex;
}

/* Bloquear scroll do body quando modal aberto */
body.modal-open {
    overflow: hidden;
}

.modal-container {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
    overflow: hidden;
}

.modal-lg {
    max-width: 1020px;
}

.modal-sm {
    max-width: 500px;
    height: auto;
    max-height: calc(100vh - 48px);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header: Abas + Botão Fechar */
.modal-header {
    display: flex;
    align-items: stretch;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    padding-left: 12px;
}

.modal-tabs {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 4px;
    align-items: flex-end;
    padding-top: 8px;
}

.modal-tab {
    flex: 0 0 auto;
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
    border-radius: 10px 10px 0 0;
}

.modal-tab:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
}

.modal-tab.active {
    color: var(--white);
    background: var(--primary);
    border-radius: 10px 10px 0 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 16px 20px;
    transition: var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.modal-close-btn:hover {
    color: var(--danger);
    background: #fef2f2;
}

/* Body com scroll interno */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

/* Modal loading overlay */
.modal-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 12px;
    border-radius: 0 0 16px 16px;
}

.modal-loading i {
    font-size: 2rem;
    color: var(--primary);
}

.modal-loading span {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.modal-tab-content {
    display: none;
    padding: 32px;
}

.modal-tab-content.active {
    display: block;
}

/* Scrollbar do modal body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Layout foto + campos */
.form-atleta-layout {
    display: flex;
    gap: 32px;
}

.form-foto-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.foto-preview {
    width: 150px;
    height: 170px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    overflow: hidden;
}

.foto-preview i {
    font-size: 4rem;
    color: #cbd5e1;
}

.foto-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-alterar-foto {
    background: #f97316;
    color: var(--white);
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-alterar-foto:hover {
    background: #ea580c;
}

.form-fields-area {
    flex: 1;
    min-width: 0;
}

/* Form rows */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-row-1 > .form-group { flex: 1; width: 100%; }
.form-row-2 > .form-group { flex: 1; }
.form-row-3 > .form-group { flex: 1; }

.form-row .form-group {
    margin-bottom: 0;
}

/* Toggle switch */
.form-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 6px;
}

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

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

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

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

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

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

.toggle-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Modal footer */
.modal-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

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

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* Tab placeholder */
.tab-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.tab-placeholder i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.tab-placeholder p {
    font-size: 0.92rem;
}

/* =================== EVENTO PREVIEWS =================== */
.evento-logo-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    overflow: hidden;
    gap: 4px;
}

.evento-logo-preview i {
    font-size: 2rem;
    color: #cbd5e1;
}

.evento-logo-preview span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.evento-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.evento-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.evento-file-info i {
    font-size: 1.3rem;
    color: #dc2626;
}

.evento-file-info a {
    color: var(--primary);
    font-weight: 500;
}

.evento-file-info a:hover {
    text-decoration: underline;
}

/* Imagens do S3 */
.storage-img {
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 4px;
}

.storage-img-circle {
    border-radius: 50%;
    object-fit: cover;
    padding: 0;
}

.storage-placeholder {
    border-radius: 8px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    border: 1px solid var(--border-color);
}

.storage-placeholder-circle {
    border-radius: 50%;
}

/* =================== PERMISSÕES =================== */
.permissoes-user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.permissoes-user-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.permissoes-user-info .user-info-text strong {
    display: block;
    font-size: 1rem;
}

.permissoes-user-info .user-info-text small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.perfil-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.perfil-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.perfil-check-item:hover {
    background: #f8fafc;
}

.perfil-check-item.checked {
    background: var(--primary-light);
    border-color: var(--primary);
}

.perfil-check-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.perfil-check-item .perfil-info {
    flex: 1;
}

.perfil-check-item .perfil-info strong {
    font-size: 0.9rem;
    display: block;
}

.perfil-check-item .perfil-info small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.perfil-nivel {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e2e8f0;
    color: var(--text-muted);
    font-weight: 600;
}

.delegado-delegacoes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deleg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.deleg-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    background: var(--white);
}

.deleg-check-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.deleg-check-item.checked {
    background: var(--primary-light);
    border-color: var(--primary);
    font-weight: 600;
}

.deleg-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.deleg-check-nome {
    flex: 1;
    line-height: 1.3;
}

.deleg-select-actions .btn-sm {
    font-size: 0.75rem;
    padding: 4px 12px;
}

@media (max-width: 768px) {
    .deleg-grid {
        grid-template-columns: 1fr;
    }
}

/* Tabela de permissões por módulo */
.modulo-perm-table {
    width: 100%;
    border-collapse: collapse;
}

.modulo-perm-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 12px;
    background: #f8fafc;
    text-align: center;
}

.modulo-perm-table th:first-child {
    text-align: left;
}

.modulo-perm-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.88rem;
}

.modulo-perm-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.modulo-perm-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.perfis-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 1px 2px;
}

.perfis-badge-admin { background: #dbeafe; color: #1d4ed8; }
.perfis-badge-delegado { background: #fef3c7; color: #b45309; }
.perfis-badge-atleta { background: #dcfce7; color: #16a34a; }
.perfis-badge-financeiro { background: #ede9fe; color: #7c3aed; }

/* =================== RESPONSIVE ATLETAS =================== */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-left, .actions-right {
        justify-content: stretch;
    }

    .actions-left .btn-export,
    .actions-right .btn {
        flex: 1;
        justify-content: center;
    }

    /* Inscrições/Acompanhantes: badge + botão empilhados em mobile (não cabem lado a lado).
       Mesmo padrão usado em ambos os módulos via classe .insc-actions-right. */
    .insc-actions-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .insc-actions-right > span[id^="badge"] {
        justify-content: center;
        align-self: center;
        white-space: normal !important;
        text-align: center;
    }
    .insc-actions-right > button {
        width: 100%;
        justify-content: center;
        white-space: nowrap;
    }

    .th-atleta { min-width: 180px; }

    /* Modal responsivo */
    .modal-overlay {
        padding: 8px;
    }

    .modal-container {
        /* dvh = dynamic viewport height (iOS Safari respeita o tamanho real do viewport
           descontando barra de navegação). Fallback para 100vh em browsers antigos. */
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        border-radius: 12px;
    }

    .modal-header {
        border-radius: 12px 12px 0 0;
        padding-left: 6px;
        align-items: stretch;
        min-height: 48px;
    }

    /* Abas com scroll horizontal — evita que cortem o botão X em telas estreitas */
    .modal-tabs {
        gap: 2px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;       /* Firefox */
        -webkit-overflow-scrolling: touch;
    }
    .modal-tabs::-webkit-scrollbar { display: none; } /* Chrome/Safari */

    .modal-tab {
        padding: 10px 10px;
        font-size: 0.76rem;
        flex-shrink: 0;
    }

    .modal-tab i {
        display: none;
    }

    /* Botão fechar nunca encolhe nem é cortado pelas abas — fundo branco com sombra esquerda
       cria separação visual quando as abas extras passam por baixo (scroll horizontal) */
    .modal-close-btn {
        flex-shrink: 0;
        padding: 12px 14px;
        align-self: stretch;
        background: #f8fafc;
        position: relative;
        box-shadow: -8px 0 8px -6px rgba(0,0,0,0.08);
        z-index: 2;
    }
    .modal-close-btn:hover {
        background: #fef2f2;
    }

    /* form-row em 2 colunas — telas pequenas mas não muito (481-768px).
       Visual mais aproveitado do que coluna única; a regra de 1 coluna fica só
       em telas realmente estreitas (<481px), num breakpoint dedicado abaixo. */
    .form-row {
        flex-direction: row;
        gap: 12px;
    }
    .form-row .form-group {
        margin-bottom: 12px;
        flex: 1 1 0;
        min-width: 0;
    }
    .form-row-3 .form-group,
    .form-row-2 .form-group {
        flex: 1 1 0;
    }

    .form-atleta-layout {
        flex-direction: column;
        align-items: center;
    }

    .form-foto-area {
        margin-bottom: 8px;
    }

    .modal-tab-content {
        padding: 20px 16px;
    }

    .modal-footer {
        padding: 14px 16px;
    }

    .pagination {
        flex-direction: column;
        text-align: center;
    }
}

/* Telas realmente estreitas (smartphones em retrato) — agora sim, 1 campo por linha.
   Em 481-768px (tablet portrait / phablet) preferimos 2 colunas — mais aproveitamento visual. */
@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-row .form-group {
        margin-bottom: 14px;
    }
    .modal-tab {
        padding: 9px 8px;
        font-size: 0.72rem;
    }
    .modal-tab-content {
        padding: 16px 12px;
    }
}

/* =================== LOGIN PAGE =================== */
.login-container {
    min-height: 100vh;
    display: flex;
    background: var(--body-bg);
}

/* Painel esquerdo - branding */
.login-brand {
    flex: 0 0 45%;
    background: linear-gradient(160deg, #a8d4ff 0%, #c2e2ff 40%, #dceefb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.login-brand::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.login-brand-content {
    text-align: center;
    color: #0d2e5c;
    position: relative;
    z-index: 1;
}

.login-brand-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.2));
}

.login-brand-content h1 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.login-brand-content p {
    font-size: 1rem;
    font-weight: 500;
    opacity: 1;
    letter-spacing: 0.5px;
    color: #1a3d6e;
}

.login-brand-divider {
    width: 60px;
    height: 3px;
    background: rgba(13,46,92,0.25);
    border-radius: 2px;
    margin: 32px auto;
}

.login-brand-fullname {
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.6;
    opacity: 1;
    color: #1a3d6e;
    max-width: 340px;
    margin: 0 auto;
    text-align: center;
    letter-spacing: 0.2px;
}

/* Painel direito - formulário */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-mobile-header {
    display: none;
    text-align: center;
    margin-bottom: 32px;
}

.login-mobile-header img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 8px;
}

.login-mobile-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 2px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 28px;
}

.login-box .form-group {
    text-align: left;
}

.login-box .form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-box .form-group label i {
    font-size: 1rem;
    color: var(--primary);
}

.login-box .form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
}

.login-box .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Toggle senha */
.input-password-wrap {
    position: relative;
}

.input-password-wrap .form-control {
    padding-right: 48px;
}

.btn-toggle-pass {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 10px;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-toggle-pass:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* Botão login */
.btn-login {
    width: 100%;
    padding: 13px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 12px;
    border-radius: 10px;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* Loading genérico para qualquer botão */
.btn.loading,
.btn-login.loading {
    pointer-events: none;
    opacity: 0.75;
    position: relative;
}

.btn.loading span,
.btn-login.loading span {
    visibility: hidden;
}

.btn.loading i,
.btn-login.loading i {
    visibility: hidden;
}

.btn.loading::after,
.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
}

.btn-login {
    position: relative;
}

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

/* Toast notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    font-size: 0.9rem;
    transform: translateX(120%);
    animation: toastIn 0.3s ease forwards;
    border-left: 4px solid var(--primary);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast.toast-success i { color: var(--success); }
.toast.toast-error i { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }

@keyframes toastIn {
    to { transform: translateX(0); }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* Shake animation para erros */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.4s ease;
}

/* Footer mobile */
.login-footer-mobile {
    display: none;
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    justify-content: center;
}

.login-footer-mobile small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Alert com ícone */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* =================== 403 PAGE =================== */
.error-page {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--primary);
}

.error-page p {
    color: var(--text-muted);
    margin-top: 8px;
}

/* =================== OVERLAY MOBILE =================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .login-brand {
        flex: 0 0 40%;
        padding: 40px 30px;
    }

    .login-brand-logo {
        width: 90px;
        height: 90px;
    }

    .login-brand-content h1 {
        font-size: 2rem;
    }
}

/* Mobile landscape / tablet small */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .btn-toggle-sidebar {
        display: block;
    }

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-user span {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Login: esconder branding, mostrar mobile header */
    .login-brand {
        display: none;
    }

    .login-form-panel {
        background: linear-gradient(160deg, #1a3d6e 0%, #2563eb 100%);
        padding: 24px;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 50px;
    }

    .login-box {
        background: var(--white);
        border-radius: 20px;
        padding: 36px 28px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    }

    .login-mobile-header {
        display: block;
    }

    .login-mobile-header h1 {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }

    .login-footer-mobile {
        display: block;
    }

    /* Tabelas responsivas */
    table th, table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-form-panel {
        padding: 16px;
        padding-top: 40px;
    }

    .login-box {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 1.3rem;
    }

    .topbar-right {
        gap: 12px;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* =================== PRINT =================== */
.print-header {
    display: none;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 2px solid #1e293b;
    margin-bottom: 24px;
}

.print-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.print-event-info h1 {
    font-size: 1.4rem;
    margin: 0;
    color: #1e293b;
}

.print-event-info p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.95rem;
}

.print-event-info small {
    color: #94a3b8;
    font-size: 0.8rem;
}

@media print {
    /* Ocultar sidebar, topbar, botões */
    .sidebar, .sidebar-overlay, .topbar, .no-print, .btn-toggle-sidebar,
    .pagination-bar, .filters-bar, .actions-bar { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
    body { background: #fff !important; }

    /* Mostrar cabeçalho de impressão */
    .print-header { display: flex !important; }

    /* Cards de estatísticas */
    .stats-grid { gap: 8px; }
    .stat-card { box-shadow: none; border: 1px solid #e2e8f0; }

    /* Tabela */
    .card { box-shadow: none; border: 1px solid #e2e8f0; }

    /* Badges */
    .badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .stat-icon { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Lista acompanhantes do atleta no modal */
.acomp-list-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.acomp-list-row:hover {
    background: #f1f5f9;
}

.acomp-list-current {
    background: #dbeafe !important;
    font-weight: 600;
    cursor: default;
}

.acomp-list-readonly {
    cursor: default !important;
}

.acomp-list-readonly:hover {
    background: transparent !important;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.autocomplete-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

.autocomplete-item small {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-left: 6px;
}

.autocomplete-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.autocomplete-loading {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.autocomplete-wrapper .form-control.has-value {
    background: var(--primary-light);
    border-color: var(--primary);
    font-weight: 500;
}

.autocomplete-wrapper .form-control:disabled {
    opacity: 0.6;
}

/* =================== DROPDOWN MENU =================== */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    min-width: 280px;
    padding: 6px 0;
    margin-top: 4px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 0.88rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Fieldset agrupador no modal de Eventos (Datas do Evento / Datas das Inscrições) */
.evento-fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px 4px;
    margin-bottom: 14px;
}
.evento-fieldset legend {
    padding: 0 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Quebra de linha em nomes de anexo longos */
.anexo-link {
    word-break: break-all;
    max-width: 250px;
    display: inline-block;
}

