.fase-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    overflow-x: auto;
    gap: 4px;
}

.fase-tab {
    padding: 10px 20px;
    text-decoration: none;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.fase-tab:hover {
    background: #e8e8e8;
    color: #333;
}

.fase-tab.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* =============================================
   PRONOSTICOS TABLE
   ============================================= */
.table-pronosticos .div-table-header {
    display: grid;
    grid-template-columns: 1fr 2fr 50px 24px 50px 2fr 80px;
    background: #ecf0f1;
    font-weight: bold;
}

.table-pronosticos .div-table-row {
    display: grid;
    grid-template-columns: 1fr 2fr 50px 24px 50px 2fr 80px;
    grid-template-areas: "fecha local gl sep gv visitante estado";
    align-items: center;
}

.table-pronosticos .div-table-row .div-cell {
    padding: 6px 8px;
    border-bottom: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
}

.table-pronosticos .cell-local,
.table-pronosticos .cell-visitante {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-pronosticos .score-input {
    width: 40px;
    text-align: center;
    padding: 3px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    -moz-appearance: textfield;
    appearance: textfield;
}

.table-pronosticos .score-input::-webkit-outer-spin-button,
.table-pronosticos .score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.table-pronosticos .score-display {
    font-weight: bold;
    font-size: 1rem;
}

@media (max-width: 600px) {
    .table-pronosticos .div-table-header {
        display: none;
    }

    .table-pronosticos .div-table-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "fecha fecha"
            "local gl"
            "visitante gv"
            "estado estado";
        gap: 6px 12px;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }

    .table-pronosticos .div-table-row .div-cell {
        border: none;
        padding: 4px 0;
    }

    .table-pronosticos .div-cell:before {
        content: attr(data-label);
        font-weight: bold;
        color: #7f8c8d;
        min-width: 80px;
        flex-shrink: 0;
    }

    .table-pronosticos .cell-fecha {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .table-pronosticos .cell-fecha:before {
        content: attr(data-label) ": ";
    }

    .table-pronosticos .cell-local,
    .table-pronosticos .cell-visitante {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .table-pronosticos .cell-gl,
    .table-pronosticos .cell-gv {
        justify-self: end;
    }

    .table-pronosticos .cell-sep {
        display: none;
    }

    .table-pronosticos .cell-estado {
        text-align: left !important;
        margin-top: 4px;
    }
}

@media (max-width: 600px) {
    #ranking-table .div-table-header {
        display: flex;
    }

    #ranking-table .div-table-row {
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }

    #ranking-table .div-cell {
        min-width: 0;
        word-break: break-word;
    }

    #ranking-table .div-cell:before {
        display: none;
    }
}

/* =============================================
   INDEX TABLE (recent matches)
   ============================================= */
.table-index .div-table-header {
    display: grid;
    grid-template-columns: 1fr 2fr 40px 24px 40px 2fr;
    background: #ecf0f1;
    font-weight: bold;
}

.table-index .div-table-row {
    display: grid;
    grid-template-columns: 1fr 2fr 40px 24px 40px 2fr;
    grid-template-areas: "fecha local gl sep gv visitante";
    align-items: center;
}

.table-index .div-table-row .div-cell {
    padding: 6px 8px;
    border-bottom: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
}

.table-index .cell-local,
.table-index .cell-visitante {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 600px) {
    .table-index .div-table-header { display: none; }

    .table-index .div-table-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "fecha fecha"
            "local gl"
            "visitante gv";
        gap: 6px 12px;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        background: white;
    }

    .table-index .div-table-row .div-cell {
        border: none;
        padding: 4px 0;
    }

    .table-index .div-cell:before {
        content: attr(data-label);
        font-weight: bold;
        color: #7f8c8d;
        min-width: 80px;
        flex-shrink: 0;
    }

    .table-index .cell-fecha {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    .table-index .cell-fecha:before {
        content: attr(data-label) ": ";
    }

    .table-index .cell-local,
    .table-index .cell-visitante {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .table-index .cell-gl,
    .table-index .cell-gv {
        justify-self: end;
        font-weight: bold;
    }

    .table-index .cell-sep { display: none; }
}

/* =============================================
   HISTORIAL TABLE
   ============================================= */
.table-historial .div-table-header {
    display: grid;
    grid-template-columns: 1fr 1.5fr 3fr 100px 100px;
    background: #ecf0f1;
    font-weight: bold;
}

.table-historial .div-table-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 3fr 100px 100px;
    grid-template-areas: "fecha usuario partido anterior nuevo";
    align-items: center;
}

.table-historial .div-table-row .div-cell {
    padding: 6px 8px;
    border-bottom: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
}

.table-historial .cell-partido {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-historial .cell-phdr {
    display: none;
}

.table-historial .cell-local-name,
.table-historial .cell-visitante-name,
.table-historial .cell-ant-label,
.table-historial .cell-anl,
.table-historial .cell-anv,
.table-historial .cell-nuevo-label,
.table-historial .cell-nul,
.table-historial .cell-nuv {
    display: none;
}

@media (max-width: 600px) {
    .table-historial .div-table-header { display: none; }

    .table-historial .div-table-row {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            "fecha    fecha    fecha"
            "usuario  usuario  usuario"
            "phdr     lname    vname"
            "alabel   anl      anv"
            "nlabel   nul      nuv";
        gap: 6px 12px;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        background: white;
    }

    .table-historial .div-table-row .div-cell {
        border: none;
        padding: 4px 0;
    }

    .table-historial .cell-fecha,
    .table-historial .cell-usuario {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    .table-historial .cell-fecha:before,
    .table-historial .cell-usuario:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #7f8c8d;
        min-width: 80px;
        flex-shrink: 0;
    }

    .table-historial .cell-local-name,
    .table-historial .cell-visitante-name,
    .table-historial .cell-anl,
    .table-historial .cell-anv,
    .table-historial .cell-nul,
    .table-historial .cell-nuv {
        display: block;
        text-align: center;
    }

    .table-historial .cell-phdr,
    .table-historial .cell-ant-label,
    .table-historial .cell-nuevo-label,
    .table-historial .cell-local-name,
    .table-historial .cell-visitante-name,
    .table-historial .cell-anl,
    .table-historial .cell-anv,
    .table-historial .cell-nul,
    .table-historial .cell-nuv {
        border-top: 1px solid #ddd;
        padding-top: 6px !important;
        margin-top: 4px;
    }

    .table-historial .cell-phdr,
    .table-historial .cell-ant-label,
    .table-historial .cell-nuevo-label {
        display: block;
        font-weight: bold;
        color: #7f8c8d;
        font-size: 0.85rem;
    }

    .table-historial .cell-partido,
    .table-historial .cell-anterior,
    .table-historial .cell-nuevo {
        display: none;
    }
}

/* =============================================
   FLOATING SAVE BUTTON
   ============================================= */
.save-float-wrapper {
    position: sticky;
    bottom: 24px;
    z-index: 999;
    display: flex;
    justify-content: flex-end;
}

.save-float-wrapper .btn {
    min-width: 200px;
    padding: 14px 32px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.p-3 {
    padding-bottom: 100px;
}

/* =============================================
   RESULTADOS TABLE
   ============================================= */
.table-resultados .div-table-header {
    display: grid;
    grid-template-columns: 1fr 2fr 40px 24px 40px 2fr 80px;
    background: #ecf0f1;
    font-weight: bold;
}

.table-resultados .partido-row {
    display: grid;
    grid-template-columns: 1fr 2fr 40px 24px 40px 2fr 80px;
    grid-template-areas: "fecha local gl sep gv visitante accion";
    align-items: center;
    cursor: pointer;
}

.table-resultados .partido-row .div-cell {
    padding: 6px 8px;
    border-bottom: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
}

.table-resultados .cell-local,
.table-resultados .cell-visitante {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle-detalle {
    padding: 4px 12px;
    border: 1px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-toggle-detalle:hover {
    background: #3498db;
    color: white;
}

.detalle-container {
    /* background: #f8f9fa; */
    padding: 12px 16px;
    border-bottom: 1px solid #dfdfdf;
}

.detalle-header {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detalle-spinner {
    /* color: #7f8c8d; */
    font-size: 0.85rem;
    font-weight: normal;
}

.detalle-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.search-input {
    flex: 1;
    max-width: 300px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

.detalle-total {
    font-size: 0.85rem;
    /* color: #7f8c8d; */
    white-space: nowrap;
}

.sub-table {
    margin-top: 0;
}

.sub-table .sub-table-header {
    display: flex;
    background: #e2e6ea;
    font-weight: bold;
}

.sub-table .sub-table-row {
    display: flex;
}

.sub-table .div-cell {
    padding: 5px 8px;
    font-size: 0.85rem;
}

.sub-table .sub-table-row:nth-child(even) {
    background: #f4f5f6;
}

.sub-table .sub-cell-usuario {
    flex: 2;
}

.sub-table .sub-cell-num,
.sub-table-header .sub-cell-num {
    display: none !important;
}

.sub-table .sub-cell-prons {
    flex: 0 0 80px;
    text-align: center;
}

.sub-table .sub-cell-puntos {
    flex: 0 0 60px;
    text-align: center;
}

.sub-table .sub-cell-acierto {
    flex: 0 0 90px;
    text-align: center;
}

.badge-acierto {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-exacto {
    background: #d4edda;
    color: #155724;
}

.badge-ganador {
    background: #cce5ff;
    color: #004085;
}

.badge-empate {
    background: #fff3cd;
    color: #856404;
}

.badge-incorrecto {
    background: #f8d7da;
    color: #721c24;
}

.detalle-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.btn-pag {
    padding: 4px 12px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-pag:hover:not(:disabled) {
    background: #ecf0f1;
}

.btn-pag:disabled {
    opacity: 0.4;
    cursor: default;
}

.pag-info {
    font-size: 0.85rem;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    .table-resultados .div-table-header {
        display: none;
    }

    .table-resultados .partido-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "fecha fecha"
            "local gl"
            "visitante gv"
            "accion accion";
        gap: 6px 12px;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        background: white;
    }

    .table-resultados .partido-row .div-cell {
        border: none;
        padding: 4px 0;
    }

    .table-resultados .cell-fecha {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    .table-resultados .cell-fecha:before {
        content: attr(data-label) ": ";
    }

    .table-resultados .cell-local,
    .table-resultados .cell-visitante {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .table-resultados .cell-gl,
    .table-resultados .cell-gv {
        justify-self: end;
        font-weight: bold;
    }

    .table-resultados .cell-sep {
        display: none;
    }

    .table-resultados .cell-accion {
        display: flex;
        justify-content: center;
        margin-top: 4px;
    }

    .btn-toggle-detalle {
        width: 100%;
        padding: 8px;
        font-size: 0.85rem;
    }

    .detalle-container {
        margin: -6px 0 10px 0;
        border-radius: 0 0 6px 6px;
        padding: 8px 10px;
    }

    .detalle-search {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: none;
    }

    .sub-table .sub-table-header {
        font-size: 0.7rem;
    }

    .sub-table .sub-table-header .div-cell {
        padding: 3px 4px;
    }

    .sub-table .sub-table-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 4px 4px;
        border-top: none;
        border-bottom: 1px solid #eee;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        margin-bottom: 0;
    }

    .sub-table .sub-table-row:nth-child(even) {
        background: #f4f5f6;
    }

    .sub-table .sub-table-row .div-cell {
        padding: 1px 3px;
        border: none;
        font-size: 0.75rem;
        display: block;
    }

    .sub-table .sub-table-row .div-cell:before {
        display: none;
        content: none;
    }

    .sub-table .sub-cell-usuario {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8rem;
        font-weight: 500;
    }

    .sub-table .sub-cell-acierto,
    .sub-table-header .sub-cell-acierto {
        display: none !important;
    }

    .sub-table .sub-cell-prons {
        flex: 0 0 50px !important;
        text-align: center;
    }

    .sub-table .sub-cell-puntos {
        flex: 0 0 40px !important;
        text-align: center;
    }

    .detalle-pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-pag {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .pag-info {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 4px;
    }
}

