*{box-sizing:border-box}
:root{
    --bg1:#050b14;
    --bg2:#071827;
    --bg3:#082e4d;
    --green:#13c67a;
    --blue:#0d6efd;
    --text:#ffffff;
    --muted:#bcd7ff;
    --card:rgba(0,0,0,.34);
    --line:rgba(255,255,255,.13);
}
body{
    margin:0;
    min-height:100vh;
    font-family:Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(19,198,122,.16), transparent 30%),
        radial-gradient(circle at bottom right, rgba(13,110,253,.20), transparent 32%),
        linear-gradient(135deg,var(--bg1),var(--bg2),var(--bg3));
    color:var(--text);
}
a{text-decoration:none;color:inherit}
button,input,select,textarea{font-family:inherit}

/* LOGIN */
.login-wrap{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
}
.login-card{
    width:min(94%,430px);
    background:rgba(0,0,0,.42);
    border:1px solid rgba(255,255,255,.14);
    border-radius:26px;
    padding:30px;
    box-shadow:0 24px 70px rgba(0,0,0,.42);
}
.logo-box{
    width:82px;height:82px;
    display:flex;align-items:center;justify-content:center;
    border-radius:24px;
    background:linear-gradient(135deg,var(--green),var(--blue));
    font-size:42px;
    margin:0 auto 18px;
}
h1,h2,h3{margin-top:0}
.input{
    width:100%;
    padding:14px 15px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.08);
    color:white;
    outline:none;
    margin-bottom:13px;
}
.input::placeholder{color:#b8cce4}
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border:0;
    border-radius:14px;
    padding:13px 17px;
    background:linear-gradient(135deg,var(--green),var(--blue));
    color:white;
    font-weight:700;
    cursor:pointer;
}
.btn.full{width:100%}
.alert{
    padding:13px 14px;
    border-radius:14px;
    margin:12px 0;
    background:rgba(220,53,69,.18);
    border:1px solid rgba(220,53,69,.35);
    color:#ffd7dc;
}

/* LAYOUT DESPLEGABLE */
.layout{
    min-height:100vh;
}
.menu-toggle{
    position:fixed;
    top:18px;
    left:18px;
    z-index:1100;
    width:56px;
    height:56px;
    border:1px solid rgba(255,255,255,.18);
    border-radius:18px;
    background:rgba(0,0,0,.55);
    color:white;
    font-size:27px;
    cursor:pointer;
    box-shadow:0 14px 35px rgba(0,0,0,.35);
    backdrop-filter:blur(12px);
}
.menu-toggle:hover{
    background:rgba(255,255,255,.12);
}
.sidebar-backdrop{
    position:fixed;
    inset:0;
    z-index:1000;
    background:rgba(0,0,0,.62);
    opacity:0;
    pointer-events:none;
    transition:.22s ease;
}
.sidebar{
    width:310px;
    max-width:88vw;
    background:
        radial-gradient(circle at top left, rgba(19,198,122,.13), transparent 35%),
        linear-gradient(180deg,rgba(3,12,21,.96),rgba(4,16,28,.96));
    border-right:1px solid rgba(255,255,255,.12);
    padding:22px 16px;
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    z-index:1050;
    transform:translateX(-105%);
    transition:transform .24s ease;
    box-shadow:20px 0 60px rgba(0,0,0,.42);
    overflow-y:auto;
}
body.sidebar-open .sidebar{
    transform:translateX(0);
}
body.sidebar-open .sidebar-backdrop{
    opacity:1;
    pointer-events:auto;
}
.sidebar-close{
    position:absolute;
    right:14px;
    top:14px;
    width:42px;
    height:42px;
    border:1px solid rgba(255,255,255,.16);
    border-radius:14px;
    background:rgba(255,255,255,.08);
    color:#fff;
    font-size:22px;
    cursor:pointer;
}
.brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 52px 12px 10px;
    margin-bottom:20px;
}
.brand-icon{
    width:54px;
    height:54px;
    border-radius:17px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,var(--green),var(--blue));
    font-size:28px;
    box-shadow:0 12px 35px rgba(13,110,253,.30);
}
.brand strong{
    display:block;
    font-size:19px;
    letter-spacing:.2px;
}
.brand span{
    display:block;
    color:var(--muted);
    font-size:13px;
}
.menu-section-title{
    color:#85a7c9;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:1px;
    margin:18px 12px 8px;
}
.menu a{
    display:flex;
    align-items:center;
    gap:11px;
    padding:13px 13px;
    border-radius:15px;
    color:#dcecff;
    margin:5px 0;
    border:1px solid transparent;
}
.menu a:hover,.menu a.active{
    background:rgba(255,255,255,.10);
    border-color:rgba(255,255,255,.10);
}
.menu .ico{
    width:28px;
    display:inline-flex;
    justify-content:center;
    font-size:21px;
}
.user-box{
    margin-top:24px;
    padding:14px;
    border-radius:18px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.10);
}
.content{
    width:100%;
    min-height:100vh;
    padding:88px 26px 26px;
}
body.sidebar-open-desktop .content{
    margin-left:310px;
    width:calc(100% - 310px);
}
body.sidebar-open-desktop .menu-toggle{
    left:328px;
}
body.sidebar-open-desktop .sidebar{
    transform:translateX(0);
}
body.sidebar-open-desktop .sidebar-backdrop{
    opacity:0;
    pointer-events:none;
}
.topbar{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    margin-bottom:22px;
}
.card{
    background:var(--card);
    border:1px solid var(--line);
    border-radius:22px;
    padding:22px;
    box-shadow:0 18px 55px rgba(0,0,0,.25);
}
.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:15px;
}
.stat b{font-size:36px;display:block}
.stat span{color:var(--muted)}
.table-wrap{overflow:auto}
table{
    width:100%;
    border-collapse:collapse;
    min-width:760px;
}
th,td{
    padding:13px 10px;
    border-bottom:1px solid rgba(255,255,255,.10);
    text-align:left;
}
th{
    color:var(--muted);
    font-size:13px;
    text-transform:uppercase;
}
.badge{
    display:inline-flex;
    border-radius:999px;
    padding:6px 10px;
    font-size:12px;
    font-weight:700;
}
.badge.ok{background:rgba(19,198,122,.18);color:#70ffbd}
.badge.off{background:rgba(220,53,69,.18);color:#ffb6c1}
.badge.info{background:rgba(13,110,253,.22);color:#b7d5ff}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.small{font-size:13px;color:var(--muted)}

@media(max-width:900px){
    .content{
        padding:88px 18px 22px;
    }
    body.sidebar-open-desktop .content{
        margin-left:0;
        width:100%;
    }
    body.sidebar-open-desktop .menu-toggle{
        left:18px;
    }
    body.sidebar-open-desktop .sidebar{
        transform:translateX(-105%);
    }
    body.sidebar-open .sidebar{
        transform:translateX(0);
    }
    body.sidebar-open .sidebar-backdrop{
        opacity:1;
        pointer-events:auto;
    }
    .topbar{
        display:block;
    }
    h1{
        font-size:34px;
    }
    .card{
        padding:18px;
    }
}

/* FASE 4 - FORMULARIOS ADMIN */
.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:14px;
}
.form-group label{
    display:block;
    color:var(--muted);
    font-size:13px;
    margin:0 0 7px;
}
.select,
.textarea{
    width:100%;
    padding:14px 15px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.08);
    color:white;
    outline:none;
    margin-bottom:13px;
}
.select option{
    color:#111;
}
.textarea{
    min-height:88px;
    resize:vertical;
}
.btn.secondary{
    background:rgba(255,255,255,.10);
    border:1px solid rgba(255,255,255,.16);
}
.btn.danger{
    background:linear-gradient(135deg,#dc3545,#a51220);
}
.btn.warning{
    background:linear-gradient(135deg,#ffc107,#fd7e14);
    color:#1a1200;
}
.msg-ok{
    padding:13px 14px;
    border-radius:14px;
    margin:12px 0;
    background:rgba(19,198,122,.18);
    border:1px solid rgba(19,198,122,.35);
    color:#baffdf;
}
.msg-warn{
    padding:13px 14px;
    border-radius:14px;
    margin:12px 0;
    background:rgba(255,193,7,.16);
    border:1px solid rgba(255,193,7,.35);
    color:#ffe7a3;
}
.details-box{
    margin-top:14px;
    border-radius:18px;
    overflow:hidden;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.05);
}
.details-box summary{
    cursor:pointer;
    padding:15px 16px;
    font-weight:700;
    color:#fff;
}
.details-box .details-content{
    padding:0 16px 16px;
}
.kv{
    display:grid;
    grid-template-columns:150px 1fr;
    gap:8px 12px;
    font-size:14px;
}
.kv span{
    color:var(--muted);
}
.inline-form{
    display:inline;
}
@media(max-width:700px){
    .kv{grid-template-columns:1fr}
    .actions .btn{width:100%}
}

/* FASE 5 - MODULOS POR EMPRESA */
.module-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    gap:14px;
}
.module-card{
    border:1px solid rgba(255,255,255,.13);
    border-radius:18px;
    background:rgba(255,255,255,.055);
    padding:16px;
    display:flex;
    gap:13px;
    align-items:flex-start;
}
.module-card.active{
    border-color:rgba(19,198,122,.45);
    background:rgba(19,198,122,.10);
}
.module-card.inactive{
    border-color:rgba(220,53,69,.30);
    background:rgba(220,53,69,.07);
}
.module-icon{
    width:44px;
    height:44px;
    min-width:44px;
    border-radius:14px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(255,255,255,.10);
    font-size:24px;
}
.module-info{
    flex:1;
}
.module-info b{
    display:block;
    font-size:17px;
    margin-bottom:4px;
}
.module-info p{
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.35;
}
.module-switch{
    display:flex;
    align-items:center;
    gap:8px;
    margin-top:12px;
}
.switch{
    position:relative;
    display:inline-block;
    width:54px;
    height:30px;
}
.switch input{
    opacity:0;
    width:0;
    height:0;
}
.slider{
    position:absolute;
    cursor:pointer;
    inset:0;
    background:rgba(255,255,255,.18);
    transition:.2s;
    border-radius:999px;
    border:1px solid rgba(255,255,255,.16);
}
.slider:before{
    position:absolute;
    content:"";
    height:22px;
    width:22px;
    left:4px;
    bottom:3px;
    background:white;
    transition:.2s;
    border-radius:50%;
}
.switch input:checked + .slider{
    background:linear-gradient(135deg,var(--green),var(--blue));
}
.switch input:checked + .slider:before{
    transform:translateX(23px);
}
.module-category{
    margin:24px 0 12px;
    color:#fff;
    font-size:19px;
    font-weight:800;
}
.module-category span{
    color:var(--muted);
    font-size:13px;
    font-weight:400;
}

/* FASE 6 - CONFIG EMPRESA */
.preview-logo{
    width:96px;
    height:96px;
    border-radius:24px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.14);
    overflow:hidden;
    font-size:42px;
}
.preview-logo img{
    width:100%;
    height:100%;
    object-fit:cover;
}
.config-tabs{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-bottom:18px;
}
.config-tab{
    padding:10px 13px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    color:#dcecff;
    border:1px solid rgba(255,255,255,.12);
    font-size:13px;
}
.bank-card{
    border:1px solid rgba(255,255,255,.12);
    border-radius:18px;
    padding:16px;
    background:rgba(255,255,255,.055);
    margin-bottom:12px;
}
.color-row{
    display:flex;
    align-items:center;
    gap:10px;
}
.color-row input[type="color"]{
    width:54px;
    height:46px;
    border:0;
    padding:0;
    background:transparent;
}
.copy-box{
    background:rgba(0,0,0,.25);
    border:1px dashed rgba(255,255,255,.18);
    border-radius:14px;
    padding:12px;
    color:#dcecff;
    font-size:13px;
    word-break:break-word;
}

/* FASE 7 - USUARIOS */
.role-pill{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
    background:rgba(13,110,253,.18);
    color:#cfe2ff;
    border:1px solid rgba(13,110,253,.28);
}
.role-superadmin{
    background:rgba(255,193,7,.18);
    color:#ffe49b;
    border-color:rgba(255,193,7,.35);
}
.role-admin_isp{
    background:rgba(19,198,122,.18);
    color:#aaffd6;
    border-color:rgba(19,198,122,.35);
}
.password-box{
    background:rgba(255,193,7,.13);
    border:1px solid rgba(255,193,7,.35);
    color:#fff0bd;
    border-radius:16px;
    padding:14px;
    margin:12px 0;
    word-break:break-word;
}

/* FASE 9 - CLIENTES */
.client-name{
    font-weight:900;
    color:#fff;
}
.client-code{
    display:inline-flex;
    padding:4px 8px;
    border-radius:999px;
    background:rgba(255,255,255,.09);
    color:#cfe2ff;
    font-size:12px;
    margin-top:4px;
}
.status-activo{
    background:rgba(19,198,122,.18);
    color:#aaffd6;
    border-color:rgba(19,198,122,.35);
}
.status-suspendido{
    background:rgba(255,193,7,.18);
    color:#ffe49b;
    border-color:rgba(255,193,7,.35);
}
.status-retirado,
.status-inactivo{
    background:rgba(220,53,69,.18);
    color:#ffc9cf;
    border-color:rgba(220,53,69,.35);
}
.search-row{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:end;
}
.search-row .form-group{
    flex:1;
    min-width:220px;
}

/* FASE 9 - CLIENTES */
.client-name{
    font-weight:900;
    color:#fff;
}
.client-code{
    display:inline-flex;
    padding:4px 8px;
    border-radius:999px;
    background:rgba(255,255,255,.09);
    color:#cfe2ff;
    font-size:12px;
    margin-top:4px;
}
.status-activo{
    background:rgba(19,198,122,.18);
    color:#aaffd6;
    border-color:rgba(19,198,122,.35);
}
.status-suspendido{
    background:rgba(255,193,7,.18);
    color:#ffe49b;
    border-color:rgba(255,193,7,.35);
}
.status-retirado,
.status-inactivo{
    background:rgba(220,53,69,.18);
    color:#ffc9cf;
    border-color:rgba(220,53,69,.35);
}
.search-row{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:end;
}
.search-row .form-group{
    flex:1;
    min-width:220px;
}

/* FASE 10 - PLANES INTERNET */
.plan-card{
    border:1px solid rgba(255,255,255,.13);
    border-radius:20px;
    background:rgba(255,255,255,.055);
    padding:18px;
}
.plan-price{
    font-size:34px;
    font-weight:950;
    color:#fff;
    margin:8px 0;
}
.plan-speed{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin:10px 0;
}
.speed-pill{
    padding:7px 10px;
    border-radius:999px;
    background:rgba(13,110,253,.18);
    border:1px solid rgba(13,110,253,.30);
    color:#cfe2ff;
    font-size:13px;
    font-weight:800;
}
.plan-desc{
    color:var(--muted);
    font-size:14px;
    min-height:38px;
}

/* FASE 11 - SERVICIOS PPPOE */
.service-box{
    border:1px solid rgba(255,255,255,.13);
    border-radius:20px;
    background:rgba(255,255,255,.055);
    padding:18px;
    margin-bottom:14px;
}
.service-title{
    font-size:20px;
    font-weight:950;
    color:#fff;
}
.pppoe-user{
    display:inline-flex;
    padding:6px 10px;
    border-radius:999px;
    background:rgba(13,110,253,.18);
    border:1px solid rgba(13,110,253,.30);
    color:#cfe2ff;
    font-size:13px;
    font-weight:800;
    margin-top:6px;
}
.ip-pill{
    display:inline-flex;
    padding:6px 10px;
    border-radius:999px;
    background:rgba(19,198,122,.15);
    border:1px solid rgba(19,198,122,.30);
    color:#baffdf;
    font-size:13px;
    font-weight:800;
}
.sync-pill{
    display:inline-flex;
    padding:6px 10px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.15);
    color:#dcecff;
    font-size:12px;
    font-weight:800;
}

/* FASE 11B - CLIENTE + SERVICIO UNIFICADO */
.old-flow-title{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}
.old-flow-title span{
    font-size:14px;
    color:#bcd7ff;
    font-weight:500;
}
.pppoe-summary{
    border:1px solid rgba(19,198,122,.28);
    background:rgba(19,198,122,.08);
    border-radius:18px;
    padding:14px;
    margin:12px 0;
}
.pppoe-summary b{
    color:#fff;
}
.form-divider{
    margin:20px 0 14px;
    padding-top:14px;
    border-top:1px solid rgba(255,255,255,.12);
    color:#fff;
    font-weight:900;
    font-size:18px;
}

/* AJUSTE CLIENTES - CREAR AL FINAL */
html{
    scroll-behavior:smooth;
}
.anchor-card{
    scroll-margin-top:90px;
}
.quick-actions-top{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    justify-content:flex-end;
}
@media(max-width:700px){
    .quick-actions-top{
        justify-content:flex-start;
        width:100%;
    }
    .quick-actions-top .btn{
        width:100%;
        text-align:center;
    }
}
