:root{--bg:#f5f7fb;--sidebar:#111827;--primary:#2563eb;--text:#172033;--muted:#6b7280}*{box-sizing:border-box}body{margin:0;background:var(--bg);font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif;color:var(--text)}a{text-decoration:none}.sidebar{position:fixed;inset:0 auto 0 0;width:245px;background:var(--sidebar);color:#fff;padding:24px 16px}.brand{font-size:20px;font-weight:800;padding:0 10px 25px}.nav a{display:block;color:#cbd5e1;padding:12px 14px;border-radius:10px;margin:4px 0}.nav a:hover,.nav a.active{background:#1f2937;color:#fff}.main{margin-left:245px;padding:28px;min-height:100vh}.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}.card{background:#fff;border-radius:16px;padding:20px;box-shadow:0 4px 18px rgba(15,23,42,.06)}.label{color:var(--muted);font-size:13px}.value{font-size:27px;font-weight:800;margin-top:8px}.panel{background:#fff;border-radius:16px;padding:20px;margin-top:18px;box-shadow:0 4px 18px rgba(15,23,42,.06)}table{width:100%;border-collapse:collapse}th,td{padding:12px;border-bottom:1px solid #e5e7eb;text-align:left;font-size:14px}th{color:#6b7280}.btn{display:inline-block;border:0;border-radius:9px;padding:10px 14px;background:var(--primary);color:#fff;cursor:pointer}.btn.secondary{background:#e5e7eb;color:#111827}.btn.danger{background:#dc2626}.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.field label{display:block;font-size:13px;margin-bottom:6px;color:#4b5563}.field input,.field select,.field textarea{width:100%;padding:11px;border:1px solid #d1d5db;border-radius:9px}.login{min-height:100vh;display:grid;place-items:center}.login-box{width:390px;background:#fff;padding:32px;border-radius:18px;box-shadow:0 12px 40px rgba(0,0,0,.1)}.login-box h1{margin-top:0}.alert{padding:12px;border-radius:9px;background:#fee2e2;color:#991b1b;margin-bottom:15px}.badge{padding:5px 8px;border-radius:999px;font-size:12px;background:#e5e7eb}.ok{background:#dcfce7;color:#166534}.warn{background:#fef3c7;color:#92400e}@media(max-width:900px){.sidebar{width:245px}.main{margin-left:190px}.cards{grid-template-columns:repeat(2,1fr)}}










.flow-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:16px;
    margin-top:16px;
}

.flow-card{
    background:#f8fafc;
    border:1px solid #e5e7eb;
    border-radius:14px;
    padding:18px;
}

.flow-title{
    font-size:15px;
    font-weight:800;
    margin-bottom:14px;
}

.flow-steps{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:7px;
    line-height:1.6;
}

.flow-steps span{
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:6px 9px;
    font-size:12px;
    font-weight:600;
}

.flow-steps b{
    color:#6b7280;
    font-size:14px;
}

.quick-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-top:20px;
}

@media(max-width:900px){
    .flow-grid{
        grid-template-columns:1fr;
    }
}


.dashboard-stats{
    align-items:stretch;
}

.dashboard-stats-secondary{
    margin-top:20px !important;
    padding-top:0;
}

.stat-card{
    position:relative;
    overflow:hidden;
    min-height:105px;
}

.stat-icon{
    font-size:24px;
    line-height:1;
    margin-bottom:10px;
}

.stat-card .value{
    font-size:25px;
    line-height:1.1;
    margin-top:6px;
}

.stat-description{
    margin-top:6px;
    color:var(--muted);
    font-size:12px;
}

/* ============================================================
   RESPONSIVE MOVIL - BASE GENERAL
   ============================================================ */

@media(max-width:700px){

    .sidebar{
        position:relative;
        width:100%;
        min-height:auto;
        padding:16px 12px;
    }

    .brand{
        padding:4px 8px 14px;
        font-size:19px;
    }

    .nav{
        display:flex;
        flex-wrap:wrap;
        gap:5px;
    }

    .nav a{
        display:block;
        margin:0;
        padding:9px 10px;
        font-size:13px;
    }

    .main{
        margin-left:0;
        padding:16px;
        min-height:auto;
    }

    .top{
        display:flex;
        flex-direction:column;
        align-items:flex-start;
        gap:10px;
        margin-bottom:18px;
    }

    .cards{
        grid-template-columns:1fr;
        gap:12px;
    }

    .card{
        padding:16px;
    }

    .dashboard-stats{
        grid-template-columns:1fr;
    }

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

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

    .quick-actions{
        flex-direction:column;
    }

    .quick-actions .btn{
        width:100%;
        text-align:center;
    }

    table{
        display:block;
        width:100%;
        overflow-x:auto;
        white-space:nowrap;
    }

    .panel{
        padding:16px;
        overflow:hidden;
    }

    .login-box{
        width:calc(100% - 30px);
        padding:24px;
    }

    .stat-card{
        min-height:auto;
    }

}

/* ============================================================
   MENU MOVIL COMPACTO
   ============================================================ */

@media(max-width:700px){

    .sidebar{
        width:100%;
        padding:10px;
    }

    .brand{
        padding:2px 6px 8px;
        font-size:18px;
    }

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

    .nav a{
        margin:0;
        padding:8px 6px;
        font-size:12px;
        text-align:center;
        white-space:normal;
        line-height:1.2;
    }

    .main{
        padding:12px;
    }

}


/* ============================================================
   TARJETAS DASHBOARD - MOVIL
   ============================================================ */

@media(max-width:700px){

    .dashboard-stats{
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:10px;
    }

    .dashboard-stats .stat-card{
        min-height:120px;
        padding:14px;
    }

    .dashboard-stats .stat-icon{
        font-size:21px;
        margin-bottom:7px;
    }

    .dashboard-stats .label{
        font-size:12px;
        line-height:1.2;
    }

    .dashboard-stats .value{
        font-size:21px;
        margin-top:6px;
    }

    .dashboard-stats .stat-description{
        font-size:11px;
        line-height:1.2;
        margin-top:5px;
    }

}

/* ============================================================
   FLUJO DE FACTURACION - MOVIL
   ============================================================ */

@media(max-width:700px){

    .flow-grid{
        gap:10px;
        margin-top:10px;
    }

    .flow-card{
        padding:12px;
    }

    .flow-title{
        font-size:14px;
        margin-bottom:9px;
    }

    .flow-steps{
        gap:5px;
        line-height:1.3;
    }

    .flow-steps span{
        padding:5px 7px;
        font-size:11px;
    }

    .quick-actions{
        display:grid;
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:8px;
        margin-top:12px;
    }

    .quick-actions .btn{
        width:100%;
        padding:9px 6px;
        font-size:12px;
        text-align:center;
    }

}

/* ============================================================
   FLUJO DE FACTURACION - ANCHO COMPLETO MOVIL
   ============================================================ */

@media(max-width:700px){

    .flow-grid{
        grid-template-columns:1fr;
        width:100%;
    }

    .flow-card{
        width:100%;
    }

}

/* ============================================================
   FLUJOS LADO A LADO - MOVIL
   ============================================================ */

@media(max-width:700px){

    .flow-grid{
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:8px;
    }

    .flow-card{
        padding:10px;
    }

    .flow-title{
        font-size:13px;
        margin-bottom:7px;
    }

    .flow-steps{
        gap:4px;
    }

    .flow-steps span{
        padding:4px 5px;
        font-size:10px;
    }

    .flow-steps b{
        font-size:11px;
    }

}

