* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;

    font-family: Arial, Helvetica, sans-serif;

    background: #f4f6f8;
    color: #263238;

    -webkit-tap-highlight-color: transparent;
}


/* ==========================
   CONTENEDOR
   ========================== */

.contenedor {
    width: 96%;
    max-width: 1500px;

    margin: 20px auto;
}


/* ==========================
   ENCABEZADO
   ========================== */

.encabezado {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 15px;

    margin-bottom: 20px;
}

.encabezado h1 {
    margin: 0;

    font-size: 28px;
    font-weight: 600;
}

.encabezado p {
    margin: 6px 0 0;

    color: #718096;

    font-size: 14px;
}


/* ==========================
   BOTONES
   ========================== */

.acciones {
    display: flex;
    gap: 10px;
}

.btn {
    min-height: 46px;

    padding: 10px 16px;

    border: none;
    border-radius: 8px;

    font-size: 14px;

    cursor: pointer;

    touch-action: manipulation;
}

.btn-principal {
    background: #2563eb;
    color: white;
}

.btn-principal:hover {
    background: #1d4ed8;
}

.btn-secundario {
    background: white;

    color: #374151;

    border: 1px solid #d1d5db;
}


/* ==========================
   RESUMEN
   ========================== */

.resumen {
    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 14px;

    margin-bottom: 18px;
}

.tarjeta {
    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 10px;

    padding: 16px 18px;

    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.tarjeta-titulo {
    display: block;

    margin-bottom: 8px;

    color: #6b7280;

    font-size: 13px;
}

.tarjeta strong {
    font-size: 22px;

    font-weight: 600;
}

.tarjeta-saldo {
    background: #eff6ff;

    border-color: #bfdbfe;
}


/* ==========================
   CONTROLES
   ========================== */

.barra-controles {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    padding: 12px 15px;

    background: white;

    border: 1px solid #e5e7eb;

    border-bottom: none;

    border-radius: 10px 10px 0 0;
}

.filtro-fecha {
    display: flex;

    align-items: center;

    gap: 8px;
}

.filtro-fecha label {
    color: #6b7280;

    font-size: 13px;
}

.filtro-fecha input,
.busqueda input {
    min-height: 42px;

    padding: 0 10px;

    border: 1px solid #d1d5db;

    border-radius: 7px;

    font-size: 14px;

    outline: none;
}

.filtro-fecha input:focus,
.busqueda input:focus {
    border-color: #3b82f6;
}

.busqueda input {
    width: 260px;
}


/* ==========================
   TABLA
   ========================== */

.tabla-contenedor {
    width: 100%;

    background: white;

    border: 1px solid #e5e7eb;

    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;

    min-width: 760px;

    border-collapse: separate;

    border-spacing: 0;

    table-layout: fixed;
}

thead {
    background: #f8fafc;
}

th {
    height: 48px;

    padding: 8px 10px;

    border-bottom: 1px solid #dfe3e8;

    color: #4b5563;

    text-align: left;

    font-size: 12px;

    font-weight: 600;

    text-transform: uppercase;

    white-space: nowrap;

    position: sticky;

    top: 0;

    z-index: 5;

    background: #f8fafc;
}

td {
    height: 58px;

    padding: 0;

    border-bottom: 1px solid #edf0f2;

    background: white;
}


/* ==========================
   ANCHOS
   ========================== */

.col-fecha {
    width: 140px;
}

.col-tipo {
    width: 120px;
}

.col-concepto {
    width: 330px;
}

.col-monto {
    width: 130px;

    text-align: right;
}

.col-saldo {
    width: 140px;

    text-align: right;
}

.col-accion {
    width: 55px;
}


/* ==========================
   CAMPOS
   ========================== */

td input,
td select {
    width: 100%;

    height: 57px;

    padding: 0 12px;

    border: none;

    outline: none;

    background: transparent;

    font-family: inherit;

    font-size: 15px;
}

td input:focus,
td select:focus {
    background: #eff6ff;

    box-shadow: inset 0 0 0 2px #3b82f6;
}


/* ==========================
   MONTO
   ========================== */

.celda-monto input {
    text-align: right;
}

.celda-saldo {
    padding: 0 12px;

    text-align: right;

    font-size: 15px;

    font-weight: 600;

    white-space: nowrap;
}


/* ==========================
   BOTÓN ELIMINAR
   ========================== */

.celda-accion {
    text-align: center;
}

.btn-eliminar {
    width: 44px;
    height: 44px;

    border: none;

    border-radius: 8px;

    background: transparent;

    color: #9ca3af;

    font-size: 24px;

    cursor: pointer;
}

.btn-eliminar:hover {
    background: #fee2e2;

    color: #dc2626;
}


/* ==========================
   FILAS
   ========================== */

tbody tr:hover td {
    background: #fafafa;
}


/* ==========================
   PIE
   ========================== */

.pie {
    display: flex;

    justify-content: space-between;
    align-items: center;

    padding: 12px 5px;

    color: #6b7280;

    font-size: 12px;
}


/* ==================================================
   TABLET
   ================================================== */

@media (max-width: 1000px) {

    .contenedor {
        width: 98%;

        margin: 12px auto;
    }

    .encabezado {
        flex-wrap: wrap;
    }

    .resumen {
        grid-template-columns: repeat(2, 1fr);
    }

    .barra-controles {
        flex-wrap: wrap;
    }
}


/* ==================================================
   CELULAR
   ================================================== */

@media (max-width: 700px) {

    .contenedor {
        width: 100%;

        margin: 0;
    }


    /* ENCABEZADO */

    .encabezado {
        display: block;

        padding: 15px;

        margin: 0;

        background: white;

        border-bottom: 1px solid #e5e7eb;
    }

    .encabezado h1 {
        font-size: 23px;
    }

    .encabezado p {
        font-size: 13px;
    }

    .acciones {
        display: grid;

        grid-template-columns: 1fr 2fr;

        gap: 8px;

        margin-top: 13px;
    }

    .btn {
        width: 100%;

        min-height: 50px;
    }


    /* RESUMEN */

    .resumen {
        grid-template-columns: repeat(2, 1fr);

        gap: 8px;

        padding: 10px;

        margin: 0;
    }

    .tarjeta {
        padding: 13px;

        border-radius: 9px;
    }

    .tarjeta-titulo {
        font-size: 12px;

        margin-bottom: 5px;
    }

    .tarjeta strong {
        font-size: 18px;
    }


    /* CONTROLES */

    .barra-controles {
        display: block;

        padding: 10px;

        border-radius: 0;

        border-left: none;
        border-right: none;
    }

    .filtro-fecha {
        display: grid;

        grid-template-columns: auto 1fr auto 1fr;

        gap: 6px;

        margin-bottom: 8px;
    }

    .filtro-fecha input {
        width: 100%;
    }

    .busqueda input {
        width: 100%;

        min-height: 46px;
    }


    /* TABLA */

    .tabla-contenedor {
        width: 100%;

        border-left: none;
        border-right: none;

        overflow-x: auto;

        overflow-y: visible;

        touch-action: pan-x pan-y;
    }

    table {
        width: 760px;

        min-width: 760px;
    }

    th {
        height: 52px;

        padding: 8px 12px;

        font-size: 12px;
    }

    td {
        height: 62px;
    }

    td input,
    td select {
        height: 61px;

        padding: 0 12px;

        font-size: 16px;
    }

    .btn-eliminar {
        width: 46px;
        height: 46px;
    }


    /* PIE */

    .pie {
        display: block;

        padding: 8px 15px 20px;

        text-align: center;
    }

    .pie span {
        display: block;

        margin-top: 5px;
    }
}

/* ==================================================
   BOTÓN ELIMINAR
   ================================================== */

.btn-eliminar {
    width: 42px;
    height: 42px;

    border: 1px solid #dc3545;
    border-radius: 8px;

    background-color: #fff1f2;
    color: #dc3545;

    font-size: 20px;
    font-weight: bold;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.15s ease;
}

/* Al pasar el mouse */
.btn-eliminar:hover {
    background-color: #dc3545;
    color: white;
}

/* Al tocar en teléfono/tablet */
.btn-eliminar:active {
    transform: scale(0.94);
    background-color: #c82333;
    color: white;
}