body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 15px 10px;
    display: flex;
    justify-content: center;
}

.container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 900px;
    box-sizing: border-box; /* Evita que el padding rompa el ancho */
}

h1 {
    text-align: center;
    color: #1a1a1a;
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.form-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.form-row input, .form-row select {
    flex: 1;
    min-width: 0; /* Clave para que los inputs no se desborden en flexbox */
}

input, select {
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    background-color: #fff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

input:focus, select:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

button {
    padding: 12px;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.2s;
    width: 100%;
    max-width: 50%;
    align-self: center;
    margin-top: 5px;
}

button:hover {
    background-color: #004d99;
}

.table-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 10px;
}

#tablacuerpo {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 500px; /* Asegura que la tabla tenga buen espacio y active el scroll horizontal limpio si es necesario */
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

th {
    background-color: #f8f9fa;
    color: #444;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #ddd;
}

td {
    color: #333;
}

tr {
    transition: background-color 0.15s ease-in-out;
}

tr:hover {
    background-color: #f1f5f9;
}

.btn-eliminar {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-eliminar:hover {
    background-color: #ffe6e6;
}

#Total-container {
    margin-top: 20px;
    text-align: right;
    padding-right: 5px;
}

#Total-container h3 {
    color: #1a1a1a;
    font-size: 1.2rem;
}

#spanTotal {
    color: #0066cc;
}
/* Por defecto (PC y Tablets): Mostrar tabla, ocultar tarjetas */
.view-mobile {
    display: none !important;
}
.view-desktop {
    display: block !important;
}



/* ==========================================
   DISEÑO RESPONSIVO PARA TELÉFONOS MÓVILES
   ================================---------- */
@media (max-width: 768px) {
    body {
        padding: 10px 5px;
    }

    .container {
        padding: 15px 10px;
    }

    /* Convertimos todas las filas del formulario en columnas verticales */
    .form-row {
        flex-direction: column;
        gap: 12px;
    }

    h1 {
        font-size: 1.3rem;
    }
    .view-desktop {
        display: none !important;
    }
    .view-mobile {
        display: flex !important;
    }

/* Estilos de las tarjetas móviles */
.tarjetas-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.gasto-tarjeta {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tarjeta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px dashed #475569;
    padding-bottom: 8px;
}

.tarjeta-titulo {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f7f8f9;
    margin: 0;
}

.btn-eliminar-tarjeta{
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    opacity: 0.8;
    max-width: 30%;
}

.tarjeta-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

.tarjeta-linea {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
}

.tarjeta-linea span.valor-costo {
    font-weight: 700;
    font-size: 1.15rem;
    color: #22c55e;
}
}