:root{
    --bg:#f3f6fb;
    --surface:#ffffff;
    --surface-soft:#f8fafc;
    --border:#dbe4ef;
    --text:#152033;
    --muted:#64748b;
    --sidebar:#0f1b2d;
    --sidebar-2:#13243c;
    --primary:#1f5eff;
    --primary-dark:#1647c7;
    --danger:#dc2626;
    --success:#0f8a5f;
    --warning:#b45309;
    --shadow:0 18px 45px rgba(15,23,42,.08);
    --shadow-soft:0 10px 26px rgba(15,23,42,.06);
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font-family:Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Login */
.login-page{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:32px;
    background:
        radial-gradient(circle at top left, rgba(31,94,255,.16), transparent 32%),
        linear-gradient(135deg,#eef4ff 0%,#f8fafc 42%,#edf2f7 100%);
}

.login-shell{
    width:min(1040px,100%);
    min-height:640px;
    display:grid;
    grid-template-columns:1.05fr .95fr;
    background:var(--surface);
    border:1px solid rgba(219,228,239,.85);
    border-radius:34px;
    overflow:hidden;
    box-shadow:0 30px 80px rgba(15,23,42,.14);
}

.login-panel{
    padding:56px;
}

.login-panel-info{
    flex-direction:column;
    justify-content:space-between;
    color:#fff;
    background:
        linear-gradient(160deg,rgba(15,27,45,.96),rgba(19,36,60,.98)),
        radial-gradient(circle at 15% 15%, rgba(31,94,255,.45), transparent 40%);
}

.login-eyebrow{
    color:#93c5fd;
    text-transform:uppercase;
    letter-spacing:.14em;
    font-size:.78rem;
    font-weight:700;
    margin-bottom:16px;
}

.login-panel-info h1{
    font-size:2.8rem;
    line-height:1.05;
    max-width:460px;
    margin-bottom:20px;
    font-weight:750;
}

.login-copy{
    color:#dbeafe;
    font-size:1.05rem;
    line-height:1.7;
    max-width:430px;
}

.login-footer-note{
    color:#bfdbfe;
    font-size:.95rem;
    border-top:1px solid rgba(255,255,255,.14);
    padding-top:22px;
}

.login-panel-form{
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
}

.login-card-modern{
    width:100%;
    max-width:420px;
}

.login-card-modern h2{
    font-weight:760;
    letter-spacing:-.03em;
}

.brand-mark{
    width:54px;
    height:54px;
    border-radius:18px;
    display:grid;
    place-items:center;
    font-weight:800;
    letter-spacing:.03em;
    color:#fff;
    background:linear-gradient(135deg,var(--primary),#0f1b2d);
    box-shadow:0 14px 28px rgba(31,94,255,.25);
}

.brand-mark-small{
    width:46px;
    height:46px;
    border-radius:15px;
    font-size:.9rem;
}

/* Layout */
.app-body{
    background:var(--bg);
}

.app-shell{
    min-height:100vh;
    display:grid;
    grid-template-columns:290px 1fr;
}

.sidebar{
    background:linear-gradient(180deg,var(--sidebar),#0b1220);
    color:#e5eefb;
    position:sticky;
    top:0;
    height:100vh;
    padding:18px;
}

.sidebar-inner{
    height:100%;
    display:flex;
    flex-direction:column;
    gap:20px;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:13px;
    padding:8px 6px 22px;
    border-bottom:1px solid rgba(255,255,255,.08);
}

.brand-title{
    font-size:1.1rem;
    font-weight:760;
    letter-spacing:-.02em;
}

.brand-title::after{
    content:' v6';
    color:#93c5fd;
    font-size:.74rem;
    font-weight:600;
    margin-left:5px;
}

.brand-subtitle{
    color:#9fb3cc;
    font-size:.82rem;
}

.sidebar-nav{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.nav-link-app{
    color:#cbd7e8;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 13px;
    text-decoration:none;
    border-radius:16px;
    transition:background .15s ease, color .15s ease, transform .15s ease;
}

.nav-link-app:hover,
.nav-link-app:focus{
    color:#fff;
    background:rgba(255,255,255,.08);
    transform:translateX(2px);
}

.nav-link-app.active{
    color:#fff;
    background:linear-gradient(135deg,rgba(31,94,255,.95),rgba(31,94,255,.68));
    box-shadow:0 12px 26px rgba(31,94,255,.22);
}

.nav-icon{
    width:30px;
    height:30px;
    border-radius:10px;
    display:grid;
    place-items:center;
    color:#dbeafe;
    background:rgba(255,255,255,.08);
    font-size:.78rem;
    font-weight:800;
}

.nav-link-app.active .nav-icon{
    background:rgba(255,255,255,.18);
    color:#fff;
}

.sidebar-user{
    margin-top:auto;
    display:flex;
    align-items:center;
    gap:12px;
    padding:14px;
    border-radius:18px;
    background:rgba(255,255,255,.07);
    border:1px solid rgba(255,255,255,.08);
}

.user-avatar{
    flex:0 0 42px;
    width:42px;
    height:42px;
    border-radius:14px;
    display:grid;
    place-items:center;
    background:#fff;
    color:var(--sidebar);
    font-weight:800;
}

.user-name{
    font-weight:700;
    color:#fff;
    max-width:170px;
}

.user-meta{
    font-size:.8rem;
    color:#9fb3cc;
    max-width:170px;
}

.logout-link{
    color:#cbd7e8;
    text-decoration:none;
    text-align:center;
    padding:12px;
    border-radius:14px;
    background:rgba(255,255,255,.05);
    transition:.15s ease;
}

.logout-link:hover{
    color:#fff;
    background:rgba(220,38,38,.25);
}

.app-main{
    min-width:0;
}

.topbar{
    min-height:88px;
    background:rgba(255,255,255,.92);
    backdrop-filter:blur(10px);
    border-bottom:1px solid var(--border);
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:20px 34px;
    position:sticky;
    top:0;
    z-index:10;
}

.topbar-label{
    color:var(--muted);
    text-transform:uppercase;
    letter-spacing:.12em;
    font-size:.72rem;
    font-weight:800;
    margin-bottom:3px;
}

.topbar h1{
    font-size:1.45rem;
    margin:0;
    font-weight:780;
    letter-spacing:-.03em;
}

.topbar-user{
    align-items:flex-end;
    flex-direction:column;
    color:var(--text);
}

.topbar-user span{
    font-weight:700;
}

.topbar-user small{
    color:var(--muted);
}

.content-area{
    padding:30px 34px 46px;
}

/* Components */
.card,
.modal-content{
    border:1px solid rgba(219,228,239,.85);
    border-radius:22px;
    box-shadow:var(--shadow-soft);
}

.card{
    background:var(--surface);
}

.stat-card{
    background:#fff;
    border:1px solid rgba(219,228,239,.85);
    border-radius:22px;
    padding:1.35rem;
    box-shadow:var(--shadow-soft);
    min-height:125px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}

.stat-card span{
    color:var(--muted);
    font-size:.94rem;
}

.stat-card strong{
    font-size:2.25rem;
    line-height:1;
    letter-spacing:-.04em;
}

.stat-card.danger{
    background:linear-gradient(180deg,#fff,#fff7f7);
}

.stat-card.danger strong{
    color:var(--danger);
}

.stat-card-hover strong{
    display:inline-block;
    width:max-content;
    border-bottom:2px dotted rgba(220,38,38,.45);
    cursor:help;
}

.btn{
    border-radius:13px;
    font-weight:650;
}

.btn-primary{
    background:var(--primary);
    border-color:var(--primary);
    box-shadow:0 10px 18px rgba(31,94,255,.15);
}

.btn-primary:hover,
.btn-primary:focus{
    background:var(--primary-dark);
    border-color:var(--primary-dark);
}

.form-control,
.form-select{
    border-radius:13px;
    border-color:var(--border);
}

.form-control:focus,
.form-select:focus{
    border-color:rgba(31,94,255,.45);
    box-shadow:0 0 0 .25rem rgba(31,94,255,.10);
}

.table{
    margin-bottom:0;
}

.table thead th{
    color:var(--muted);
    font-size:.78rem;
    text-transform:uppercase;
    letter-spacing:.055em;
    border-bottom:1px solid var(--border);
    background:#fbfdff;
}

.table td,
.table th{
    vertical-align:middle;
    padding:.85rem .8rem;
}

.table-hover tbody tr:hover td{
    background:#f8fbff;
}

.low td{
    background:#fff7ed !important;
}

.badge-soft{
    background:#eef4ff;
    color:#1d4ed8;
    border-radius:999px;
    padding:.45rem .65rem;
}

.status-recibida{
    background:#ecfdf5;
    color:#047857;
}

.status-pendiente{
    background:#eff6ff;
    color:#1d4ed8;
}

.status-cancelada{
    background:#fef2f2;
    color:#b91c1c;
}

.tooltip-inner{
    max-width:420px;
    text-align:left;
}

.table .text-bg-light{
    border:1px solid var(--border);
    color:#334155!important;
}

.alert{
    border:0;
    border-radius:16px;
}

.modal-header,
.modal-footer{
    border-color:var(--border);
}

@media (max-width:991px){
    .login-page{
        padding:18px;
    }

    .login-shell{
        display:block;
        min-height:auto;
        border-radius:26px;
    }

    .login-panel{
        padding:32px 24px;
    }

    .app-shell{
        display:block;
    }

    .sidebar{
        position:relative;
        height:auto;
        padding:14px;
    }

    .sidebar-inner{
        gap:12px;
    }

    .sidebar-brand{
        padding-bottom:12px;
    }

    .sidebar-nav{
        display:grid;
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .sidebar-user{
        display:none;
    }

    .topbar{
        position:relative;
        padding:20px;
    }

    .content-area{
        padding:20px;
    }
}

@media (max-width:575px){
    .sidebar-nav{
        grid-template-columns:1fr;
    }

    .login-card-modern h2{
        font-size:1.4rem;
    }
}
