/* ====== VARIABLES ====== */
:root {
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --bg: #0f0f1a;
    --bg-primary: #0f0f1a;
    --card-bg: #1a1a2e;
    --text: #eee;
    --text-muted: #888;
    --border: #2d2d44;
    --sidebar-w: 260px;
}

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

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

/* ====== MOBILE HEADER (visible < 768px) ====== */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 150;
}

.mobile-title {
    font-size: 1.1rem;
    color: var(--highlight);
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

body.sidebar-open .hamburger span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
body.sidebar-open .hamburger span:nth-child(2) { opacity: 0; }
body.sidebar-open .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

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

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

/* ====== SIDEBAR (mobile: off-canvas drawer) ====== */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--primary);
    border-right: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    display: none; /* hidden on mobile, shown on desktop */
}

.sidebar-header h1 {
    font-size: 1.3rem;
    color: var(--highlight);
    letter-spacing: 2px;
}

.sidebar-header p {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.nav-menu {
    flex: 1;
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.92rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(233, 69, 96, 0.1);
    color: var(--text);
    border-left-color: var(--highlight);
}

.nav-item .icon {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-section {
    padding: 16px 20px 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* ====== MAIN CONTENT (mobile: full width) ====== */
.main-content {
    padding: 72px 12px 24px; /* top: header(56) + gap(16) */
    min-height: 100vh;
}

/* ====== PAGE HEADER ====== */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

/* ====== STAT CARDS ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card.danger .value { color: var(--danger); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.info .value { color: var(--info); }

/* ====== TABLES ====== */
.table-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

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

.table-header h3 { font-size: 0.95rem; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* enables horizontal scroll on mobile */
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    white-space: nowrap;
}

th {
    background: rgba(15, 52, 96, 0.3);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    position: sticky;
    top: 0;
}

tr:hover { background: rgba(233, 69, 96, 0.05); }

/* ====== BADGES ====== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: rgba(0, 184, 148, 0.2); color: var(--success); }
.badge-danger { background: rgba(225, 112, 85, 0.2); color: var(--danger); }
.badge-warning { background: rgba(253, 203, 110, 0.2); color: var(--warning); }
.badge-info { background: rgba(116, 185, 255, 0.2); color: var(--info); }
.badge-pending { background: rgba(136, 136, 136, 0.2); color: var(--text-muted); }
.badge-secondary { background: #636e72; color: white; }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: #1a4a7a; }
.btn-danger { background: var(--highlight); }
.btn-danger:hover { background: #c73a50; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #009b7d; }
.btn-warning { background: #e67e22; }
.btn-warning:hover { background: #d35400; }
.btn-sm { padding: 6px 10px; font-size: 0.78rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--highlight); color: var(--highlight); }

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px; /* prevents iOS zoom on focus */
}

.form-control:focus {
    outline: none;
    border-color: var(--highlight);
}

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='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ====== FILTERS BAR ====== */
.filters-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.filters-bar .form-group {
    margin-bottom: 0;
    width: 100%;
}

/* ====== MODAL ====== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 300;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0;
    width: 100%;
    min-height: 100vh;
    max-height: none;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
}

.modal-header h3 {
    font-size: 1rem;
}

.modal-body { padding: 16px; }
.modal-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

/* ====== LOADING ====== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--highlight);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 400;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 15px;
    color: #fff;
}

.loading-overlay.active { display: flex; }

.loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ====== ALERTS ====== */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    border-left: 4px solid;
}

.alert-danger { background: rgba(225,112,85,0.1); border-color: var(--danger); color: var(--danger); }
.alert-success { background: rgba(0,184,148,0.1); border-color: var(--success); color: var(--success); }
.alert-warning { background: rgba(253,203,110,0.1); border-color: var(--warning); color: var(--warning); }
.alert-info { background: rgba(116,185,255,0.1); border-color: var(--info); color: var(--info); }

/* ====== JSON VIEWER ====== */
.json-viewer {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    max-height: 300px;
    overflow: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ====== JUGADA CARD (ticket detail modal) ====== */
.jugada-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.jugada-card.ganadora { border-left: 4px solid var(--success); }
.jugada-card.perdedora { border-left: 4px solid var(--danger); }
.jugada-card.pendiente { border-left: 4px solid var(--text-muted); }

.jugada-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.jugada-teams {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    min-width: 0;
}

.track-flag {
    font-size: 1.1rem;
}

.jc-league-badge {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: rgba(15, 52, 96, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Matchup with logos */
.jc-matchup {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.jc-team {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.jc-team span {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jc-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}

.jc-logo + .team-logo-placeholder,
.jc-matchup .team-logo-placeholder {
    width: 24px;
    height: 24px;
    font-size: 0.5rem;
}

.jc-score {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 20px;
    text-align: center;
}

.jc-at {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.jugada-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.jugada-detail-item strong {
    color: var(--text);
}

/* ====== TABS ====== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--highlight);
    border-bottom-color: var(--highlight);
}

/* ====== PAGINATION ====== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.pagination .btn { min-width: 36px; padding: 8px 10px; }
.pagination .btn-primary { background: var(--highlight); border-color: var(--highlight); color: white; }
.pagination .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.pagination-dots { color: var(--text-muted); padding: 0 4px; }
.pagination-info { color: var(--text-muted); font-size: 0.8rem; width: 100%; text-align: center; margin-top: 6px; }

/* ====== MANUAL ENTRY ====== */
.manual-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.manual-mode-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.manual-mode-btn.active {
    background: var(--highlight);
    color: #fff;
}

.manual-mode-btn:hover:not(.active) {
    background: rgba(233, 69, 96, 0.15);
    color: var(--text);
}

.manual-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.manual-actions .btn {
    width: 100%;
}

/* Entry cards */
.entry-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--text-muted);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    transition: border-color 0.3s;
}

.entry-card.ganadora { border-left-color: var(--success); }
.entry-card.perdedora { border-left-color: var(--danger); }
.entry-card.en-curso { border-left-color: var(--info); }
.entry-card.pendiente { border-left-color: var(--text-muted); }

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.entry-actions {
    margin-top: 10px;
}

/* Entry result inline */
.entry-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    transition: all 0.3s;
}

.entry-result:empty { display: none; }

.entry-result.verificando { background: rgba(116, 185, 255, 0.1); border: 1px solid var(--info); color: var(--info); }
.entry-result.ganadora { background: rgba(0, 184, 148, 0.1); border: 1px solid var(--success); color: var(--success); }
.entry-result.perdedora { background: rgba(225, 112, 85, 0.1); border: 1px solid var(--danger); color: var(--danger); }
.entry-result.no-encontrado { background: rgba(253, 203, 110, 0.1); border: 1px solid var(--warning); color: var(--warning); }
.entry-result.en-curso { background: rgba(116, 185, 255, 0.1); border: 1px solid var(--info); color: var(--info); }

.horses-container { margin-top: 5px; }

/* ====== VERIFY RESULT CARD ====== */
.vr-card { border-radius: 8px; overflow: hidden; }
.vr-badge { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.5px; margin-bottom: 8px; }
.vr-matchup { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

.vr-team {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.vr-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.vr-team-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vr-team-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-abbr { font-size: 0.68rem; color: var(--text-muted); }
.vr-score { font-size: 1.3rem; font-weight: 700; font-family: 'Courier New', monospace; min-width: 36px; text-align: right; }
.vr-vs { text-align: center; color: var(--text-muted); font-size: 0.72rem; padding-left: 42px; }
.vr-detail { font-size: 0.78rem; color: inherit; opacity: 0.85; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 8px; margin-top: 4px; }
.vr-source { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; }

.vr-horse-result { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.vr-horse-pos { font-size: 1.4rem; flex-shrink: 0; min-width: 36px; text-align: center; }
.vr-horse-detail { font-size: 0.82rem; line-height: 1.4; }

/* ====== FOOTER ====== */
.site-footer {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: 30px;
}

.site-footer .heart { color: var(--highlight); font-size: 1rem; }
.site-footer strong { color: var(--text); }
.site-footer .footer-link { color: inherit; text-decoration: none; transition: color 0.2s; }
.site-footer .footer-link:hover { color: var(--highlight); }

/* ====== RESULTADOS EN VIVO ====== */

/* Sport sub-tabs */
.resultados-sport-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    -webkit-overflow-scrolling: touch;
}

.resultados-sport-tabs::-webkit-scrollbar { height: 4px; }
.resultados-sport-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sport-tab-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.sport-tab-btn:hover { border-color: var(--highlight); color: var(--text); }
.sport-tab-btn.active { background: var(--highlight); color: #fff; border-color: var(--highlight); }

/* Resultados grid */
.resultados-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Scorecard */
.resultado-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    border-left: 4px solid var(--text-muted);
    transition: transform 0.2s;
}

.resultado-card:hover { transform: translateY(-2px); }
.resultado-card.live { border-left-color: var(--danger); }
.resultado-card.final { border-left-color: var(--success); }
.resultado-card.scheduled { border-left-color: var(--text-muted); }

.res-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.res-card-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.res-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.res-status-badge.live { background: rgba(225, 112, 85, 0.2); color: var(--danger); }
.res-status-badge.final { background: rgba(0, 184, 148, 0.2); color: var(--success); }
.res-status-badge.scheduled { background: rgba(136, 136, 136, 0.2); color: var(--text-muted); text-transform: none; font-weight: 400; }

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.res-league { font-size: 0.7rem; color: var(--text-muted); }

/* Matchup */
.resultado-matchup { display: flex; flex-direction: column; gap: 5px; }

.res-team {
    display: flex;
    align-items: center;
    gap: 8px;
}

.res-team-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-separator {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 0 0 0 36px;
}

.team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.team-logo-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.team-score {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 30px;
    text-align: right;
}

/* Horse racing sections */
.track-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.track-name { font-size: 0.95rem; margin-bottom: 10px; }

.race-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.race-tab-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.race-tab-btn:hover { border-color: var(--highlight); color: var(--text); }
.race-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.race-tab-btn.has-results { color: var(--success); }

.race-results-table { width: 100%; border-collapse: collapse; }
.race-results-table th,
.race-results-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.race-results-table th { background: rgba(15, 52, 96, 0.3); font-size: 0.72rem; text-transform: uppercase; }

/* ====== ODDS / LINEAS ====== */
.odds-section { border-top: 1px solid var(--border); margin-top: 8px; }

.odds-toggle {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.odds-toggle:hover { color: var(--text); }
.odds-provider { font-size: 0.62rem; opacity: 0.6; }

.odds-details { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.odds-details.open { max-height: 200px; }

.odds-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.odds-table th { font-size: 0.62rem; text-transform: uppercase; color: var(--text-muted); padding: 3px 4px; text-align: center; border-bottom: 1px solid var(--border); }
.odds-table td { padding: 4px; text-align: center; font-family: 'Roboto Mono', monospace; font-size: 0.78rem; }
.odds-table td:first-child { text-align: left; font-family: inherit; font-weight: 600; }

.odds-macho { color: var(--highlight); }
.odds-hembra { color: var(--success); }
.odds-ou-cell { color: var(--warning); vertical-align: middle; }


/* ============================================================
   DESKTOP BREAKPOINT (768px+)
   ============================================================ */
@media (min-width: 768px) {

    /* Hide mobile header */
    .mobile-header { display: none; }
    .sidebar-overlay { display: none !important; }

    /* Sidebar: always visible */
    .sidebar {
        top: 0;
        transform: translateX(0);
        transition: none;
    }

    .sidebar-header {
        display: block;
    }

    /* Main content: offset by sidebar */
    .main-content {
        margin-left: var(--sidebar-w);
        padding: 24px 28px;
    }

    /* Page header: row layout */
    .page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 25px;
        padding-bottom: 15px;
    }

    .page-header h2 { font-size: 1.5rem; }

    /* Stats: auto-fit 3+ cols */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        margin-bottom: 25px;
    }

    .stat-card { padding: 20px; }
    .stat-card .label { font-size: 0.8rem; }
    .stat-card .value { font-size: 2rem; }

    /* Tables: no horizontal scroll needed */
    table { min-width: auto; }
    th, td { padding: 12px 15px; font-size: 0.85rem; }

    /* Filters: row layout */
    .filters-bar {
        flex-direction: row;
        align-items: flex-end;
        flex-wrap: wrap;
    }

    .filters-bar .form-group {
        min-width: 150px;
        width: auto;
    }

    /* Form row: multi-column */
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }

    .form-control { font-size: 0.9rem; }

    /* Modal: centered card */
    .modal-overlay { padding-top: 50px; }

    .modal {
        width: 90%;
        max-width: 900px;
        max-height: 85vh;
        min-height: auto;
        border-radius: 12px;
        margin-bottom: 50px;
    }

    .modal-header { position: static; }
    .modal-footer { position: static; }
    .modal-header h3 { font-size: 1.1rem; }

    /* Manual entry: row actions */
    .manual-mode-toggle { width: fit-content; }
    .manual-mode-btn { flex: none; padding: 10px 24px; font-size: 0.9rem; }
    .manual-actions { flex-direction: row; }
    .manual-actions .btn { width: auto; }

    /* Jugada details: more columns */
    .jugada-details {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
        font-size: 0.82rem;
    }

    .jugada-card { padding: 15px; }
    .jc-logo { width: 28px; height: 28px; }
    .jc-team span { font-size: 0.9rem; }
    .jc-score { font-size: 1.1rem; }

    /* VR cards */
    .vr-logo { width: 36px; height: 36px; }
    .vr-score { font-size: 1.5rem; min-width: 40px; }
    .vr-team-name { font-size: 0.9rem; }

    /* Footer */
    .site-footer { margin-left: var(--sidebar-w); }

    /* Resultados: multi-column grid */
    .resultados-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 12px;
    }

    .resultado-card { padding: 14px; }
    .team-logo, .team-logo-placeholder { width: 32px; height: 32px; }
    .team-score { font-size: 1.3rem; min-width: 36px; }
    .res-team-name { font-size: 0.88rem; }
    .res-separator { padding-left: 42px; }

    /* Pagination */
    .pagination-info { width: auto; margin-left: 10px; margin-top: 0; }
}

/* ============================================================
   LARGE DESKTOP (1200px+)
   ============================================================ */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .main-content { padding: 24px 36px; }

    .resultados-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }
}
