/* =========================================================
   JR CUENTAS - UI RESTORE COMPLETA
   ========================================================= */

*{
    box-sizing:border-box;
}

body{
    margin:0;
    font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
    color:#172033;
    background:
        radial-gradient(circle at 10% 0%,rgba(47,111,235,.16),transparent 28%),
        linear-gradient(180deg,#f7fbff 0%,#eaf1fa 100%);
}

.container{
    padding:1px 18px 46px;
}

/* HEADER */
.jr-header{
    position:sticky;
    top:0;
    z-index:1000;
    background:linear-gradient(135deg,#142744,#23395d,#1e3a66);
    color:#fff;
    box-shadow:0 18px 42px rgba(15,23,42,.28);
}

.jr-header-container{
    max-width:1480px;
    margin:0 auto;
    padding:14px 28px;
    display:flex;
    align-items:center;
    gap:26px;
}

.jr-brand{
    display:flex;
    align-items:center;
    gap:14px;
    color:#fff;
    text-decoration:none;
    min-width:260px;
}

.jr-brand-logo{
    width:58px;
    height:58px;
    border-radius:18px;
    background:linear-gradient(135deg,#2f6feb,#153e75);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:950;
    font-size:24px;
    letter-spacing:-.04em;
    box-shadow:0 14px 30px rgba(47,111,235,.30);
}

.jr-brand-text{
    display:flex;
    flex-direction:column;
    line-height:1.1;
}

.jr-brand-text strong{
    font-size:26px;
    font-weight:950;
    letter-spacing:-.04em;
}

.jr-brand-text span{
    font-size:13px;
    color:rgba(255,255,255,.74);
    font-weight:700;
}

.jr-nav{
    flex:1;
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:8px;
}

.jr-nav-link,
.jr-logout{
    color:#fff;
    text-decoration:none;
    padding:11px 14px;
    border-radius:14px;
    font-weight:900;
    font-size:14px;
    transition:.18s ease;
}

.jr-nav-link:hover{
    background:rgba(255,255,255,.12);
}

.jr-logout{
    background:#d63a4f;
    box-shadow:0 10px 24px rgba(214,58,79,.25);
}

.jr-logout:hover{
    filter:brightness(1.05);
}

.jr-menu-toggle{
    display:none;
    border:0;
    background:rgba(255,255,255,.12);
    border-radius:14px;
    padding:9px;
    cursor:pointer;
}

.jr-menu-toggle span{
    display:block;
    width:28px;
    height:3px;
    background:#fff;
    margin:5px;
    border-radius:4px;
}

/* PANEL */
.panel{
    max-width:1220px;
    margin:34px auto;
    padding:28px;
    background:linear-gradient(180deg,#fff,#f8fbff);
    border:1px solid #c9d8ec;
    border-radius:30px;
    box-shadow:
        0 35px 80px rgba(30,58,102,.16),
        0 10px 28px rgba(30,58,102,.08);
}

.panel-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:18px;
    margin-bottom:22px;
    padding-bottom:18px;
    border-bottom:1px solid #e3ecf7;
}

.panel h1,
.panel-head h1{
    margin:0;
    font-size:36px;
    font-weight:950;
    letter-spacing:-.045em;
    color:#111827;
}

.muted{
    color:#64748b;
    font-size:16px;
    font-weight:650;
}

/* BOTONES */
.btn,
a.btn,
button.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,#17345d,#2f6feb);
    color:#fff;
    text-decoration:none;
    border:0;
    border-radius:18px;
    padding:14px 22px;
    min-height:50px;
    font-weight:950;
    cursor:pointer;
    box-shadow:0 15px 32px rgba(47,111,235,.24);
    transition:.15s ease;
}

.btn:hover{
    transform:translateY(-2px);
    box-shadow:0 22px 42px rgba(47,111,235,.32);
}

.btn.secondary,
a.btn.secondary{
    background:linear-gradient(135deg,#6b7280,#374151);
}

.full{
    width:100%;
}

/* CAJAS */
.hint{
    background:linear-gradient(135deg,#e8f1ff,#f8fbff);
    border:1px solid #bcd2f2;
    color:#1e3a66;
    padding:18px 20px;
    border-radius:20px;
    font-size:16px;
    font-weight:900;
    margin:16px 0;
}

/* FILTRO */
.filter-bar{
    display:flex;
    gap:12px;
    margin:16px 0 22px;
    background:#fff;
    border:1px solid #cad8ec;
    border-radius:22px;
    padding:16px;
    box-shadow:0 12px 28px rgba(30,58,102,.08);
}

.filter-bar select{
    flex:1;
}

/* INPUTS */
label{
    display:block;
    font-weight:900;
    margin-top:10px;
}

input,
select,
textarea{
    width:100%;
    padding:13px 15px;
    border:1px solid #c7d4e8;
    border-radius:16px;
    background:#f9fbff;
    font-size:16px;
    margin:7px 0 12px;
    outline:none;
}

input:focus,
select:focus,
textarea:focus{
    border-color:#2f6feb;
    box-shadow:0 0 0 4px rgba(47,111,235,.10);
}

/* RESUMEN */
.summary-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
    margin:22px 0;
}

.summary-grid > div{
    background:linear-gradient(145deg,#fff,#f5f9ff);
    border:1px solid #cbd9ec;
    border-left:7px solid #2f6feb;
    border-radius:24px;
    padding:22px;
    box-shadow:0 18px 38px rgba(30,58,102,.10);
}

.summary-grid > div:nth-child(2){
    border-left-color:#7c3aed;
}

.summary-grid .success-card,
.summary-grid > div:nth-child(3){
    background:linear-gradient(145deg,#daf8d2,#f5fff2);
    border-color:#9be58e;
    border-left-color:#16a34a;
}

.summary-grid .danger-card{
    background:linear-gradient(145deg,#ffe2e5,#fff6f7);
    border-color:#ffb6bf;
    border-left-color:#b4232f;
}

.summary-grid span{
    color:#64748b;
    font-weight:950;
    text-transform:uppercase;
    letter-spacing:.04em;
    font-size:12px;
}

.summary-grid strong{
    display:block;
    margin-top:8px;
    color:#0f172a;
    font-size:32px;
    font-weight:950;
    letter-spacing:-.045em;
}

.summary-grid small{
    color:#475569;
    font-weight:700;
}

/* PANEL MINI */
.panel-mini{
    background:#fff;
    border:1px solid #c7d8ee;
    border-radius:24px;
    padding:20px;
    box-shadow:0 20px 46px rgba(30,58,102,.10);
}

.panel-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-bottom:14px;
}

.panel-title h2{
    margin:0;
    font-size:24px;
    font-weight:950;
}

.panel-title span{
    color:#64748b;
    font-weight:800;
}

/* TABLAS */
.table-wrap,
.excel-like{
    border:1px solid #b9cce6;
    border-radius:24px;
    overflow:auto;
    background:#fff;
    box-shadow:0 22px 50px rgba(30,58,102,.12);
}

table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    background:#fff;
}

th{
    background:linear-gradient(135deg,#17345d,#31598f);
    color:#fff;
    padding:17px 18px;
    text-align:left;
    font-size:13px;
    font-weight:950;
    letter-spacing:.08em;
    text-transform:uppercase;
    border:0;
}

td{
    padding:18px;
    border-top:1px solid #dbe6f4;
    color:#172033;
    vertical-align:middle;
}

tbody tr:nth-child(even){
    background:#f8fbff;
}

tbody tr:hover{
    background:#eaf3ff;
}

tfoot td,
.total-row td{
    background:#fff1bd;
    font-weight:950;
    border-top:2px solid #e6cf78;
}

.free-row td{
    background:#dcf8d5;
    font-weight:950;
    border-top:2px solid #9be58e;
}

.total-horizontal{
    background:#e4efff !important;
    color:#17345d;
    font-weight:950;
    box-shadow:inset 4px 0 0 #2f6feb;
}

.excel-like td:first-child,
.excel-like th:first-child{
    position:sticky;
    left:0;
    z-index:3;
}

.excel-like td:first-child{
    background:#fff;
    font-weight:950;
    box-shadow:12px 0 22px rgba(30,58,102,.08);
}

.excel-like tbody tr:nth-child(even) td:first-child{
    background:#f8fbff;
}

.excel-like tbody tr:hover td:first-child{
    background:#eaf3ff;
}

/* BADGES Y MONTOS */
.badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:86px;
    padding:9px 14px;
    border-radius:999px;
    background:linear-gradient(135deg,#17345d,#2f6feb);
    color:#fff;
    font-size:12px;
    font-weight:950;
    box-shadow:0 10px 22px rgba(47,111,235,.22);
}

.amount-ok,
.positive-money{
    color:#0b8f4d !important;
    font-weight:950;
}

.amount-bad,
.negative-money{
    color:#b4232f !important;
    font-weight:950;
}

/* ACCIONES */
.actions-inline{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    align-items:center;
}

.btn-accion,
.mini-btn,
.btn-edit-ajax,
.btn-delete-ajax,
.btn-delete-row{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    padding:10px 18px;
    border-radius:12px;
    border:none !important;
    outline:none !important;
    font-size:14px;
    font-weight:850;
    cursor:pointer;
    transition:all .20s ease;
    text-decoration:none !important;
    box-shadow:none !important;
    line-height:1.2;
}

.btn-accion:focus,
.btn-accion:active,
.btn-accion:focus-visible,
.mini-btn:focus,
.btn-edit-ajax:focus,
.btn-delete-ajax:focus,
.btn-delete-row:focus{
    outline:none !important;
    box-shadow:none !important;
    border:none !important;
}

.btn-ver,
.mini-btn{
    background:#eef4ff !important;
    color:#24437a !important;
}

.btn-editar,
.btn-edit-ajax{
    background:#e9eefc !important;
    color:#1e3a6d !important;
}

.btn-eliminar,
.btn-delete-ajax,
.btn-delete-row{
    background:#ffdede !important;
    color:#9f1d1d !important;
}

.btn-editar:hover,
.btn-ver:hover,
.btn-eliminar:hover,
.btn-edit-ajax:hover,
.btn-delete-ajax:hover,
.btn-delete-row:hover,
.mini-btn:hover{
    transform:translateY(-1px);
    filter:brightness(.98);
}

/* MODAL */
.modal-rapida-overlay,
.modal-edit-overlay{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.55);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:9998;
    padding:18px;
}

.modal-rapida-overlay.open,
.modal-edit-overlay.open{
    display:flex;
}

.modal-rapida,
.modal-edit{
    width:100%;
    max-width:540px;
    background:#fff;
    border-radius:28px;
    border:1px solid #d5e2f3;
    padding:28px;
    box-shadow:0 40px 110px rgba(15,23,42,.38);
}

.modal-rapida-head,
.modal-edit-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:14px;
}

.modal-rapida-head h2,
.modal-edit-head h2{
    margin:0;
    font-size:28px;
    font-weight:950;
}

.modal-rapida-head button,
.modal-edit-head button{
    width:40px;
    height:40px;
    border:0;
    border-radius:14px;
    font-size:24px;
    background:#eef4ff;
    cursor:pointer;
}

.modal-actions{
    display:flex;
    gap:10px;
    margin-top:18px;
}

.modal-actions .btn{
    flex:1;
}

.ajax-status{
    position:fixed;
    right:18px;
    bottom:18px;
    display:none;
    background:#23395d;
    color:#fff;
    padding:12px 16px;
    border-radius:14px;
    z-index:9999;
    font-weight:900;
}

/* ALERTAS */
.alert-success,
.alert-error{
    border-radius:16px;
    padding:14px 16px;
    font-weight:900;
    margin:14px 0;
}

.alert-success{
    background:#dcf8d5;
    color:#14532d;
    border:1px solid #9be58e;
}

.alert-error{
    background:#ffdede;
    color:#9f1d1d;
    border:1px solid #ffb8b8;
}

/* LOGIN */
.login-body{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#17233b;
    padding:20px;
}

.login-card{
    width:min(430px,94vw);
    background:#fff;
    border-radius:28px;
    padding:32px;
    box-shadow:0 35px 80px rgba(0,0,0,.28);
}

.login-logo{
    width:62px;
    height:62px;
    border-radius:18px;
    background:linear-gradient(135deg,#2f6feb,#153e75);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:950;
    color:#fff;
    font-size:24px;
    margin-bottom:18px;
}


/* LOGIN - VALIDACIÓN JQUERY Y VER CONTRASEÑA */
.jr-password-wrap{
    position:relative;
}

.jr-password-wrap input{
    padding-right:92px;
}

.jr-toggle-password{
    position:absolute;
    right:8px;
    top:7px;
    min-width:74px;
    height:42px;
    border:0;
    border-radius:12px;
    background:linear-gradient(135deg,#17345d,#2f6feb);
    color:#fff;
    font-weight:900;
    cursor:pointer;
}

.jr-toggle-password:hover{
    filter:brightness(1.05);
}

.jr-field-error{
    display:block;
    min-height:18px;
    margin:-6px 0 10px;
    color:#b4232f;
    font-size:13px;
    font-weight:850;
}

.jr-input-error{
    border-color:#dc2626 !important;
    background:#fff7f7 !important;
    box-shadow:0 0 0 4px rgba(220,38,38,.10) !important;
}

/* RESPONSIVE */
@media(max-width:1100px){
    .panel{
        margin:18px 12px;
        padding:20px;
    }

    .summary-grid{
        grid-template-columns:1fr;
    }

    .table-wrap table,
    .excel-like table{
        min-width:980px;
    }

    .jr-menu-toggle{
        display:block;
        margin-left:auto;
    }

    .jr-nav{
        display:none;
        position:absolute;
        left:0;
        right:0;
        top:86px;
        background:#23395d;
        flex-direction:column;
        align-items:stretch;
        padding:16px;
    }

    .jr-nav.open{
        display:flex;
    }
}

@media(max-width:700px){
    .panel-head,
    .filter-bar,
    .modal-actions{
        flex-direction:column;
        align-items:stretch;
    }

    .panel h1,
    .panel-head h1{
        font-size:30px;
    }

    .btn,
    .filter-bar select{
        width:100%;
    }

    .actions-inline{
        flex-direction:column;
        align-items:stretch;
    }

    .btn-accion,
    .mini-btn,
    .btn-edit-ajax,
    .btn-delete-ajax,
    .btn-delete-row{
        width:100%;
    }
}

/* =========================================================
   JR CUENTAS - Cuentas AJAX, eliminar y totales
   ========================================================= */
.cuentas-totales{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
    margin:0 0 20px;
}
.cuenta-total-card{
    padding:18px 20px;
    border:1px solid #cfe0f5;
    border-radius:22px;
    background:linear-gradient(180deg,#ffffff,#edf5ff);
    box-shadow:0 12px 28px rgba(30,58,102,.08);
}
.cuenta-total-card span{
    display:block;
    color:#64748b;
    font-weight:850;
    font-size:13px;
    margin-bottom:6px;
}
.cuenta-total-card strong{
    display:block;
    color:#0f2f5f;
    font-size:26px;
    font-weight:950;
}
.cuentas-status{
    min-height:22px;
    margin:8px 0 14px;
    font-weight:850;
}
.cuentas-status.is-ok{color:#166534;}
.cuentas-status.is-error{color:#b91c1c;}
.cuentas-table tfoot td{
    background:#eaf2ff;
    border-top:2px solid #2f6feb;
}
.cuentas-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}
.mini-btn.danger,
button.mini-btn.danger{
    background:#fee2e2;
    color:#b91c1c;
}
.cuentas-modal-overlay{
    position:fixed;
    inset:0;
    z-index:2000;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(15,23,42,.45);
    padding:18px;
}
.cuentas-modal-overlay[hidden]{display:none;}
.cuentas-modal{
    width:min(520px,100%);
    background:#fff;
    border-radius:26px;
    border:1px solid #c9d8ec;
    box-shadow:0 32px 80px rgba(15,23,42,.28);
    padding:24px;
}
.cuentas-modal-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:16px;
}
.cuentas-modal-head h2{
    margin:0;
    font-size:28px;
    font-weight:950;
    color:#111827;
}
.cuentas-modal-head button{
    width:42px;
    height:42px;
    border:0;
    border-radius:14px;
    background:#fee2e2;
    color:#b91c1c;
    font-size:26px;
    font-weight:900;
    cursor:pointer;
}
#formCuenta label{
    display:block;
    margin:12px 0 6px;
    font-weight:900;
    color:#334155;
}
#formCuenta label span{color:#dc2626;}
#formCuenta input,
#formCuenta select{
    width:100%;
    height:48px;
    border:1px solid #cbd5e1;
    border-radius:14px;
    padding:0 14px;
    font-weight:750;
    outline:none;
}
#formCuenta input:focus,
#formCuenta select:focus{
    border-color:#2f6feb;
    box-shadow:0 0 0 4px rgba(47,111,235,.12);
}
.cuentas-modal-actions{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    margin-top:18px;
}
@media(max-width:760px){
    .cuentas-totales{grid-template-columns:1fr;}
    .cuentas-modal-actions{flex-direction:column;}
}


/* FIX LOGIN: permite ver claramente la contraseña al cambiar de password a text. */
.jr-password-wrap input,
.jr-password-wrap input[type="text"],
.jr-password-wrap input[type="password"]{
    color:#001b3f !important;
    background:#edf5ff;
    padding-right:104px;
    -webkit-text-fill-color:#001b3f;
}

/* RESERVAS AJAX */
.reservas-panel .cuentas-totales{
    grid-template-columns:repeat(2,minmax(0,1fr));
}

@media(max-width:700px){
    .reservas-panel .cuentas-totales{
        grid-template-columns:1fr;
    }
}

/* Bóveda segura y recuperación */
.alert-success{background:#e8f8ef;border:1px solid #8dd7aa;color:#17643a;padding:14px 16px;border-radius:14px;margin:14px 0;font-weight:800}.alert-error{background:#fff0f2;border:1px solid #ef9aaa;color:#9f2137;padding:14px 16px;border-radius:14px;margin:14px 0;font-weight:800}.auth-link{text-align:center;margin:18px 0 0}.auth-link a{color:#245db3;font-weight:800;text-decoration:none}.vault-panel{max-width:1320px}.vault-warning{background:#fff8df;border:1px solid #ecd17b;color:#684f00;padding:15px 17px;border-radius:16px;margin:14px 0 22px}.vault-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:16px}.vault-card{background:#fff;border:1px solid #d5e0ee;border-radius:20px;padding:18px;display:flex;gap:14px;align-items:flex-start;box-shadow:0 12px 28px rgba(30,58,102,.08)}.vault-card-icon{font-size:30px}.vault-card-body{flex:1;min-width:0}.vault-card h3{margin:0 0 5px}.vault-card p,.vault-card small{color:#64748b}.vault-actions{display:flex;flex-wrap:wrap;gap:7px}.vault-actions form{margin:0}.btn-small{min-height:36px!important;padding:8px 11px!important;border-radius:11px!important;font-size:12px}.btn.danger{background:linear-gradient(135deg,#b4233b,#dc3c55)}.empty-state{grid-column:1/-1;text-align:center;padding:45px;color:#64748b;border:2px dashed #cad8e8;border-radius:20px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.check-row{display:flex;align-items:center}.check-row input{width:auto;margin-right:8px}.secret-input{display:flex;gap:8px}.secret-input input{flex:1}.secret-input button,.reveal-secret,.copy-secret{border:0;border-radius:12px;padding:9px 12px;background:#e7eef9;color:#17345d;font-weight:800;cursor:pointer}.vault-modal{position:fixed;inset:0;z-index:3000;background:rgba(8,18,34,.62);padding:24px;display:flex;align-items:center;justify-content:center}.vault-modal[hidden]{display:none}.vault-modal-box{position:relative;width:min(620px,100%);max-height:85vh;overflow:auto;background:#fff;border-radius:24px;padding:26px;box-shadow:0 30px 90px rgba(0,0,0,.35)}.vault-close{position:absolute;right:15px;top:12px;border:0;background:transparent;font-size:30px;cursor:pointer}.vault-field{border-top:1px solid #e3eaf3;padding:13px 0}.vault-field strong{text-transform:capitalize;display:block;margin-bottom:7px}.vault-field>div{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.vault-value{flex:1;min-width:180px;background:#f5f8fc;padding:10px;border-radius:10px;word-break:break-all}.login-body .login-card{max-width:460px}
@media(max-width:700px){.form-grid{grid-template-columns:1fr}.vault-card{flex-direction:column}.vault-actions{width:100%}.vault-actions .btn,.vault-actions form,.vault-actions form button{flex:1;width:100%}.secret-input{flex-wrap:wrap}.secret-input input{flex-basis:100%}}
