:root {
    --color-verde: #00a859;
    --color-verde-oscuro: #007f45;
    --color-azul: #005baa;
    --color-azul-oscuro: #003f7d;
    --color-fondo: #f3f7fb;
    --color-texto: #172033;
    --color-muted: #6b7280;
}

body {
    background: var(--color-fondo);
    color: var(--color-texto);
    font-family: "Segoe UI", system-ui, sans-serif;
}

.navbar {
    background: linear-gradient(90deg, var(--color-azul-oscuro), var(--color-azul), var(--color-verde)) !important;
    box-shadow: 0 8px 22px rgba(0, 63, 125, .18);
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: .2px;
}

.card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.card-header {
    border-bottom: 1px solid #edf2f7;
    padding: 16px 20px;
    font-weight: 700;
    color: var(--color-azul-oscuro);
}

.resumen {
    color: #fff;
    min-height: 128px;
    position: relative;
    overflow: hidden;
}

.resumen::after {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    right: -45px;
    top: -45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
}

.resumen p {
    margin: 0;
    font-size: 14px;
    opacity: .9;
}

.resumen h3 {
    margin-top: 10px;
    font-weight: 800;
}

.resumen.ingreso {
    background: linear-gradient(135deg, var(--color-verde), var(--color-verde-oscuro));
}

.resumen.egreso {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.resumen.balance {
    background: linear-gradient(135deg, var(--color-azul), #00a6d6);
}

.form-label {
    font-weight: 600;
    color: #344054;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #d8e0ea;
    padding: 11px 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-verde);
    box-shadow: 0 0 0 .22rem rgba(0, 168, 89, .16);
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-primary {
    background: linear-gradient(90deg, var(--color-azul), var(--color-verde));
    border: 0;
}

.btn-primary:hover {
    background: linear-gradient(90deg, var(--color-azul-oscuro), var(--color-verde-oscuro));
}

.btn {
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
}

.table thead th {
    color: var(--color-muted);
    font-size: 13px;
    text-transform: uppercase;
}

.badge {
    padding: 7px 10px;
    border-radius: 999px;
}

/* Login y registro */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(0, 168, 89, .20), transparent 34%),
        radial-gradient(circle at bottom right, rgba(0, 91, 170, .22), transparent 35%),
        linear-gradient(135deg, #f8fbff, #eef7f3);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, .92);
    padding: 34px;
    border-radius: 18px;
    box-shadow: 0 22px 55px rgba(15, 23, 42, .14);
    border: 1px solid rgba(255, 255, 255, .75);
}

.auth-card h3 {
    font-weight: 800;
    color: var(--color-azul-oscuro);
    margin-bottom: 6px;
}

.auth-card p {
    color: var(--color-muted);
}

.auth-card::before {
    content: "";
    display: block;
    width: 64px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-azul), var(--color-verde));
    margin-bottom: 22px;
}

.table-responsive {
    overflow-x: visible;
}

.tabla-movimientos {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.tabla-movimientos th,
.tabla-movimientos td {
    vertical-align: middle;
    padding: 12px 8px;
}

.tabla-movimientos th {
    font-size: 12px;
    color: #5b6472;
    text-transform: uppercase;
}

.col-fecha {
    width: 15%;
}

.col-tipo {
    width: 14%;
}

.col-categoria {
    width: 29%;
}

.col-monto {
    width: 16%;
}

.col-acciones {
    width: 26%;
}

.acciones-tabla {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.btn-accion {
    min-width: 68px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 16px rgba(15, 23, 42, .12);
}

.btn-editar {
    background: linear-gradient(135deg, #005baa, #00a6d6);
}

.btn-editar:hover {
    color: #fff;
    background: linear-gradient(135deg, #004b8f, #008fbd);
}

.btn-eliminar {
    background: linear-gradient(135deg, #ef4444, #c81e1e);
}

.btn-eliminar:hover {
    color: #fff;
    background: linear-gradient(135deg, #dc2626, #991b1b);
}

.tabla-movimientos td:nth-child(3) strong,
.tabla-movimientos td:nth-child(3) small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movimiento-detalle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
}

.movimiento-categoria {
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movimiento-descripcion {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabla-movimientos td {
    padding-top: 10px;
    padding-bottom: 10px;
}

@media (max-width: 768px) {
    .navbar {
        padding: 14px 16px !important;
    }

    .navbar-brand {
        font-size: 17px;
    }

    .navbar .ms-auto {
        gap: 8px !important;
    }

    .navbar .text-white {
        max-width: 115px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
    }

    main.container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .resumen {
        min-height: 108px;
    }

    .resumen h3 {
        font-size: 26px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .card-body {
        padding: 16px;
    }

    .tabla-movimientos,
    .tabla-movimientos thead,
    .tabla-movimientos tbody,
    .tabla-movimientos th,
    .tabla-movimientos td,
    .tabla-movimientos tr {
        display: block;
        width: 100%;
    }

    .tabla-movimientos colgroup,
    .tabla-movimientos thead {
        display: none;
    }

    .tabla-movimientos tbody {
        padding: 10px;
    }

    .tabla-movimientos tr {
        background: #fff;
        border: 1px solid #e5edf5;
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 12px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
    }

    .tabla-movimientos td {
        border: 0;
        padding: 6px 0;
        text-align: left !important;
    }

    .tabla-movimientos td:nth-child(1)::before {
        content: "Fecha";
    }

    .tabla-movimientos td:nth-child(2)::before {
        content: "Tipo";
    }

    .tabla-movimientos td:nth-child(3)::before {
        content: "Categoría";
    }

    .tabla-movimientos td:nth-child(4)::before {
        content: "Monto";
    }

    .tabla-movimientos td::before {
        display: block;
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
        color: #64748b;
        margin-bottom: 2px;
    }

    .acciones-tabla {
        justify-content: stretch;
        gap: 8px;
        margin-top: 8px;
    }

    .acciones-tabla .btn,
    .btn-accion {
        flex: 1;
        min-height: 40px;
    }

    .modal-dialog {
        margin: 12px;
    }
}

.dato-resumen {
    background: #f8fafc;
    border: 1px solid #e5edf5;
    border-radius: 12px;
    padding: 14px 16px;
}

.dato-resumen span {
    display: block;
    font-size: 13px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
}

.dato-resumen strong {
    display: block;
    color: #0f172a;
    font-size: 17px;
}

.titulo-panel {
    font-weight: 800;
    color: #003f7d;
}

.selector-mes {
    width: 210px;
}

.categoria-box {
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #e5edf5;
    background: #f8fafc;
}

.categoria-box h6 {
    font-weight: 800;
    margin-bottom: 14px;
}

.categoria-ingresos h6 {
    color: #008f4c;
}

.categoria-egresos h6 {
    color: #dc2626;
}

.categoria-linea {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e5edf5;
}

.categoria-linea:last-child {
    border-bottom: 0;
}

.categoria-linea span {
    font-weight: 700;
    color: #1f2937;
}

.categoria-linea strong {
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.categoria-vacia {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

@media (max-width: 768px) {
    .selector-mes {
        width: 100%;
    }
}

.modal-header-danger {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    color: #fff;
}

.modal-header-danger .btn-close {
    filter: brightness(0) invert(1);
}

.btn-eliminar-confirmar {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #fff;
    border: 0;
}

.btn-eliminar-confirmar:hover {
    color: #fff;
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
}

.toast-finanzas {
    background: linear-gradient(135deg, #005baa, #00a859);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(15, 23, 42, .22);
    font-weight: 700;
}

.btn-float-add {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #005baa, #00a859);
    color: #fff;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 18px 36px rgba(0, 91, 170, .32);
    z-index: 1040;
}

.btn-float-add:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 22px 42px rgba(0, 91, 170, .38);
}

@media (max-width: 768px) {
    .btn-float-add {
        right: 18px;
        bottom: 18px;
        width: 58px;
        height: 58px;
        font-size: 32px;
    }
}

.grafico-box {
    background: #f8fafc;
    border: 1px solid #e5edf5;
    border-radius: 14px;
    padding: 16px;
}

.grafico-box h6 {
    font-weight: 800;
    color: #003f7d;
    margin-bottom: 14px;
}

.grafico-contenedor {
    position: relative;
    height: 260px;
}

@media (max-width: 768px) {
    .grafico-contenedor {
        height: 230px;
    }
}

.btn-ver-historial {
    background: linear-gradient(135deg, #005baa, #00a859);
    color: #fff;
    border: 0;
    font-weight: 800;
    border-radius: 9px;
    padding: 8px 12px;
}

.btn-ver-historial:hover {
    color: #fff;
    background: linear-gradient(135deg, #004b8f, #008f4c);
}

@media (max-width: 768px) {
    .tabla-historial td:nth-child(4)::before {
        content: "Descripción";
    }

    .tabla-historial td:nth-child(5)::before {
        content: "Monto";
    }

    .tabla-historial td:nth-child(6)::before {
        content: "Acciones";
    }
}

.saldo-actual-card {
    background: linear-gradient(135deg, #003f7d, #005baa, #00a859);
    color: #fff;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(0, 63, 125, .22);
}

.saldo-actual-card span {
    font-size: 14px;
    font-weight: 700;
    opacity: .9;
}

.saldo-actual-card h2 {
    margin: 8px 0;
    font-size: 38px;
    font-weight: 900;
}

.saldo-actual-card p {
    margin: 0;
    opacity: .85;
}

.btn-config-saldo {
    width: 46px;
    height: 46px;
    min-width: 46px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-config-saldo i {
    font-size: 20px;
    line-height: 1;
}

.btn-config-saldo:hover {
    background: rgba(255, 255, 255, .26);
    color: #fff;
}

.btn-navbar-icon,
.btn-ver-saldo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-navbar-icon {
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .14);
    color: #fff;
}

.btn-navbar-icon:hover {
    background: rgba(255, 255, 255, .24);
    color: #fff;
}

.btn-ver-saldo {
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.btn-ver-saldo:hover {
    background: rgba(255, 255, 255, .26);
    color: #fff;
}

.btn-navbar-icon i,
.btn-ver-saldo i {
    font-size: 19px;
    line-height: 1;
}