:root{
    --pwa-ink:#111827;
    --pwa-ink-soft:#1f2937;
    --pwa-gold:#e4ab2b;
    --pwa-gold-deep:#b98210;
    --pwa-cream:#f5f1e8;
    --pwa-card:#ffffff;
    --pwa-line:#e7e1d7;
    --pwa-muted:#6b7280;
    --pwa-safe-top:env(safe-area-inset-top,0px);
    --pwa-safe-bottom:env(safe-area-inset-bottom,0px);
}

html{
    min-height:100%;
    background:var(--pwa-ink);
    -webkit-text-size-adjust:100%;
}
body{
    min-height:100%;
    overscroll-behavior-y:none;
    -webkit-tap-highlight-color:transparent;
}
button,a,input,select,textarea{
    touch-action:manipulation;
}

.pwa-mobile-header,
.pwa-bottom-nav,
.pwa-more-sheet,
.pwa-more-backdrop,
.pwa-network-banner,
.pwa-update-toast{
    display:none;
}

.pwa-install-dialog[hidden],
.pwa-more-backdrop[hidden],
.pwa-network-banner[hidden],
.pwa-update-toast[hidden]{
    display:none!important;
}

.pwa-install-dialog{
    position:fixed;
    inset:0;
    z-index:100000;
    display:grid;
    place-items:center;
    padding:22px;
    background:rgba(15,23,42,.58);
    backdrop-filter:blur(10px);
}
.pwa-install-dialog-card{
    position:relative;
    width:min(380px,100%);
    padding:30px 24px 24px;
    border:1px solid rgba(255,255,255,.3);
    border-radius:28px;
    background:#fff;
    box-shadow:0 28px 80px rgba(15,23,42,.3);
    text-align:center;
    font-family:Inter,system-ui,sans-serif;
}
.pwa-install-dialog-card>img{
    width:78px;
    height:78px;
    border-radius:22px;
    box-shadow:0 12px 28px rgba(15,23,42,.22);
}
.pwa-install-dialog-card h2{
    margin:16px 0 10px;
    color:var(--pwa-ink);
    font-size:22px;
}
.pwa-install-dialog-card p{
    margin:8px 0;
    color:#526071;
    font-size:14px;
    line-height:1.55;
}
.pwa-install-dialog-card ol{
    margin:16px 0 0;
    padding-left:22px;
    color:#374151;
    text-align:left;
    font-size:14px;
    line-height:1.65;
}
.pwa-install-primary{
    width:100%;
    margin-top:18px;
    min-height:46px;
    border:0;
    border-radius:15px;
    background:var(--pwa-ink);
    color:#fff;
    font-weight:850;
    cursor:pointer;
}
.pwa-dialog-close{
    position:absolute;
    top:12px;
    right:12px;
    width:36px;
    height:36px;
    border:0;
    border-radius:50%;
    background:#f1f5f9;
    color:#475569;
    font-size:25px;
    line-height:1;
    cursor:pointer;
}

/* Acceso */
body.pwa-login-page{
    margin:0;
    min-height:100svh;
    background:
        radial-gradient(circle at 15% 10%,rgba(228,171,43,.28),transparent 28%),
        radial-gradient(circle at 90% 80%,rgba(255,255,255,.08),transparent 32%),
        var(--pwa-ink);
    color:#fff;
    font-family:Inter,system-ui,sans-serif;
}
.pwa-login-shell{
    min-height:100svh;
    display:grid;
    place-items:center;
    padding:calc(26px + var(--pwa-safe-top)) 20px calc(26px + var(--pwa-safe-bottom));
    box-sizing:border-box;
}
.pwa-login-card{
    width:min(430px,100%);
    padding:30px;
    box-sizing:border-box;
    border:1px solid rgba(255,255,255,.14);
    border-radius:32px;
    background:rgba(255,255,255,.98);
    color:var(--pwa-ink);
    box-shadow:0 35px 90px rgba(0,0,0,.36);
}
.pwa-login-brand{
    display:flex;
    align-items:center;
    gap:13px;
}
.pwa-login-logo{
    width:58px;
    height:58px;
    display:grid;
    place-items:center;
    overflow:hidden;
    border-radius:18px;
    background:var(--pwa-ink);
    box-shadow:0 12px 25px rgba(15,23,42,.2);
}
.pwa-login-logo img{
    width:100%;
    height:100%;
    object-fit:contain;
}
.pwa-login-brand>div{
    display:grid;
    gap:1px;
}
.pwa-login-brand span{
    color:var(--pwa-gold-deep);
    font-size:11px;
    font-weight:900;
    letter-spacing:.18em;
}
.pwa-login-brand strong{
    font-size:22px;
    line-height:1;
}
.pwa-login-copy{
    margin:28px 0 22px;
}
.pwa-login-kicker{
    color:var(--pwa-gold-deep);
    font-size:11px;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
}
.pwa-login-copy h1{
    margin:8px 0 8px;
    font-size:31px;
    line-height:1.08;
    letter-spacing:-.035em;
}
.pwa-login-copy p{
    margin:0;
    color:#64748b;
    font-size:14px;
    line-height:1.55;
}
.pwa-login-error,.pwa-login-success{
    margin:0 0 18px;
    padding:12px 14px;
    border-radius:14px;
    font-size:13px;
    font-weight:700;
    line-height:1.45;
}
.pwa-login-error{background:#fff1f2;color:#be123c;border:1px solid #fecdd3}
.pwa-login-success{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0}
.pwa-login-form{
    display:grid;
    gap:16px;
}
.pwa-login-form>label>span{
    display:block;
    margin:0 0 7px;
    color:#334155;
    font-size:12px;
    font-weight:850;
}
.pwa-login-field{
    min-height:52px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:0 13px;
    border:1px solid #dce3ec;
    border-radius:16px;
    background:#f8fafc;
    transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
.pwa-login-field:focus-within{
    border-color:var(--pwa-gold);
    background:#fff;
    box-shadow:0 0 0 4px rgba(228,171,43,.15);
}
.pwa-login-field svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:#94a3b8;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}
.pwa-login-field input{
    min-width:0;
    flex:1;
    height:50px;
    padding:0;
    border:0!important;
    outline:0!important;
    background:transparent!important;
    box-shadow:none!important;
    font:600 15px Inter,system-ui,sans-serif;
    color:#111827;
}
.pwa-password-toggle{
    min-width:42px;
    height:34px;
    padding:0 8px;
    border:0;
    border-radius:10px;
    background:#eef2f7;
    color:#475569;
    font-size:11px;
    font-weight:850;
}
.pwa-remember-row{
    display:flex!important;
    align-items:flex-start;
    gap:10px;
    padding:4px 1px;
    cursor:pointer;
}
.pwa-remember-row input{
    width:19px!important;
    height:19px!important;
    flex:0 0 19px;
    margin:2px 0 0!important;
    accent-color:var(--pwa-gold-deep);
}
.pwa-remember-row>span{
    display:grid!important;
    gap:2px;
    margin:0!important;
}
.pwa-remember-row strong{
    color:#263244;
    font-size:13px;
}
.pwa-remember-row small{
    color:#7b8797;
    font-size:11px;
    line-height:1.35;
}
.pwa-login-submit{
    min-height:52px;
    border:0;
    border-radius:17px;
    background:linear-gradient(135deg,#111827,#253143);
    color:#fff;
    font:850 14px Inter,system-ui,sans-serif;
    box-shadow:0 15px 28px rgba(15,23,42,.2);
    cursor:pointer;
}
.pwa-login-submit:active{transform:translateY(1px)}
.pwa-login-install{
    width:100%;
    min-height:44px;
    margin-top:14px;
    border:1px solid #ded7c8;
    border-radius:15px;
    background:#fffaf0;
    color:#8a6410;
    font:800 12px Inter,system-ui,sans-serif;
}
.pwa-login-security{
    margin:14px 0 0;
    color:#94a3b8;
    text-align:center;
    font-size:10px;
}

@media(max-width:900px){
    body:not(.pwa-login-page){
        padding-top:calc(62px + var(--pwa-safe-top));
        padding-bottom:calc(76px + var(--pwa-safe-bottom));
        background:#f5f3ee;
        box-sizing:border-box;
    }

    .sidebar.light,
    body.sidebar-collapsed .sidebar.light{
        display:none!important;
    }

    .pwa-mobile-header{
        position:fixed;
        z-index:9900;
        top:0;
        left:0;
        right:0;
        height:calc(62px + var(--pwa-safe-top));
        display:flex;
        align-items:flex-end;
        justify-content:space-between;
        padding:var(--pwa-safe-top) 16px 9px;
        box-sizing:border-box;
        background:rgba(17,24,39,.96);
        border-bottom:1px solid rgba(255,255,255,.08);
        box-shadow:0 10px 25px rgba(15,23,42,.14);
        backdrop-filter:blur(18px);
    }
    .pwa-mobile-brand{
        min-width:0;
        display:flex;
        align-items:center;
        gap:10px;
        color:#fff;
        text-decoration:none;
    }
    .pwa-mobile-brand img{
        width:40px;
        height:40px;
        object-fit:contain;
        border-radius:12px;
        background:#fff;
    }
    .pwa-mobile-brand>span{
        min-width:0;
        display:grid;
        line-height:1;
    }
    .pwa-mobile-brand strong{
        color:#fff;
        font-size:14px;
        font-weight:950;
        letter-spacing:.08em;
    }
    .pwa-mobile-brand small{
        margin-top:4px;
        color:#d7ab48;
        font-size:10px;
        font-weight:750;
    }
    .pwa-mobile-header-actions{
        display:flex;
        gap:7px;
    }
    .pwa-mobile-header-actions button{
        width:39px;
        height:39px;
        display:grid;
        place-items:center;
        border:1px solid rgba(255,255,255,.11);
        border-radius:13px;
        background:rgba(255,255,255,.07);
        color:#fff;
        font-size:14px;
    }
    .pwa-header-install{
        color:#efc45d!important;
    }

    .pwa-bottom-nav{
        position:fixed;
        z-index:9900;
        left:0;
        right:0;
        bottom:0;
        height:calc(68px + var(--pwa-safe-bottom));
        display:grid;
        grid-template-columns:repeat(5,1fr);
        align-items:start;
        padding:7px 6px var(--pwa-safe-bottom);
        box-sizing:border-box;
        border-top:1px solid #e5e7eb;
        background:rgba(255,255,255,.97);
        box-shadow:0 -12px 30px rgba(15,23,42,.1);
        backdrop-filter:blur(18px);
    }
    .pwa-bottom-nav a,
    .pwa-bottom-nav button{
        min-width:0;
        height:54px;
        display:flex;
        flex-direction:column;
        align-items:center;
        justify-content:center;
        gap:4px;
        padding:0;
        border:0;
        border-radius:14px;
        background:transparent;
        color:#7a8493;
        text-decoration:none;
        font-family:Inter,system-ui,sans-serif;
    }
    .pwa-bottom-nav i{
        font-size:17px;
    }
    .pwa-bottom-nav span{
        max-width:100%;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
        font-size:9px;
        font-weight:800;
    }
    .pwa-bottom-nav a.active{
        background:#fff7e2;
        color:#a87408;
    }

    .pwa-more-backdrop{
        position:fixed;
        z-index:9980;
        inset:0;
        display:block;
        background:rgba(15,23,42,.52);
        backdrop-filter:blur(4px);
    }
    .pwa-more-sheet{
        position:fixed;
        z-index:9990;
        left:0;
        right:0;
        bottom:0;
        display:block;
        max-height:min(78svh,690px);
        padding:9px 18px calc(22px + var(--pwa-safe-bottom));
        border-radius:28px 28px 0 0;
        background:#fff;
        box-shadow:0 -28px 70px rgba(15,23,42,.28);
        transform:translateY(105%);
        transition:transform .25s ease;
        overflow:auto;
    }
    .pwa-more-sheet.open{transform:translateY(0)}
    .pwa-more-handle{
        width:42px;
        height:5px;
        margin:0 auto 14px;
        border-radius:99px;
        background:#d5dbe3;
    }
    .pwa-more-head{
        display:flex;
        align-items:center;
        justify-content:space-between;
        margin-bottom:16px;
    }
    .pwa-more-head>div{display:grid;gap:2px}
    .pwa-more-head span{
        color:#9a6d0d;
        font-size:10px;
        font-weight:900;
        letter-spacing:.09em;
        text-transform:uppercase;
    }
    .pwa-more-head strong{
        color:#172033;
        font-size:20px;
    }
    .pwa-more-head button{
        width:40px;
        height:40px;
        border:0;
        border-radius:13px;
        background:#f1f5f9;
        color:#475569;
    }
    .pwa-more-grid{
        display:grid;
        grid-template-columns:repeat(3,minmax(0,1fr));
        gap:10px;
    }
    .pwa-more-grid a,
    .pwa-more-grid button{
        min-width:0;
        min-height:88px;
        display:flex;
        flex-direction:column;
        align-items:flex-start;
        justify-content:space-between;
        gap:10px;
        padding:14px;
        border:1px solid #e8ebef;
        border-radius:18px;
        background:#f8fafc;
        color:#263244;
        text-align:left;
        text-decoration:none;
        font:800 11px Inter,system-ui,sans-serif;
    }
    .pwa-more-grid i{
        width:35px;
        height:35px;
        display:grid;
        place-items:center;
        border-radius:12px;
        background:#fff2cf;
        color:#9f720d;
        font-size:15px;
    }
    .pwa-more-grid .pwa-more-logout{
        color:#b42334;
        background:#fff5f5;
        border-color:#fee2e2;
    }
    .pwa-more-grid .pwa-more-logout i{
        background:#fee2e2;
        color:#b42334;
    }

    .pwa-network-banner{
        position:fixed;
        z-index:10020;
        top:calc(70px + var(--pwa-safe-top));
        left:14px;
        right:14px;
        display:block;
        padding:10px 13px;
        border-radius:13px;
        background:#9f1239;
        color:#fff;
        text-align:center;
        font:800 11px Inter,system-ui,sans-serif;
        box-shadow:0 12px 28px rgba(159,18,57,.24);
    }
    .pwa-update-toast{
        position:fixed;
        z-index:10020;
        left:14px;
        right:14px;
        bottom:calc(82px + var(--pwa-safe-bottom));
        display:flex;
        align-items:center;
        justify-content:space-between;
        gap:12px;
        padding:11px 12px 11px 15px;
        border-radius:16px;
        background:#111827;
        color:#fff;
        box-shadow:0 18px 45px rgba(15,23,42,.3);
        font:750 11px Inter,system-ui,sans-serif;
    }
    .pwa-update-toast button{
        min-height:34px;
        padding:0 13px;
        border:0;
        border-radius:11px;
        background:var(--pwa-gold);
        color:#352400;
        font-weight:900;
    }

    body.sidebar-collapsed .main-content,
    .main-content,
    .content,
    .page-content,
    .crm-content,
    .admin-content{
        width:auto!important;
        max-width:none!important;
        min-width:0!important;
        margin-left:0!important;
        padding-left:14px!important;
        padding-right:14px!important;
        box-sizing:border-box!important;
    }
    .main-content{
        padding-top:14px!important;
        padding-bottom:18px!important;
    }

    .meraki-home{
        width:auto!important;
        max-width:none!important;
        margin:0!important;
    }
    .home-hero{
        display:grid!important;
        grid-template-columns:1fr!important;
        gap:17px!important;
        padding:21px!important;
        border-radius:23px!important;
    }
    .home-hero-copy h1{
        font-size:29px!important;
        letter-spacing:-.04em!important;
    }
    .home-hero-copy p{
        max-width:32ch;
        font-size:13px!important;
        line-height:1.5!important;
    }
    .home-hero-actions{
        display:grid!important;
        grid-template-columns:repeat(2,minmax(0,1fr))!important;
        gap:8px!important;
    }
    .home-hero-actions .quick-action{
        min-height:44px!important;
        justify-content:center!important;
        padding:8px 10px!important;
        font-size:11px!important;
    }
    .home-hero-actions .quick-action:first-child{
        grid-column:1/-1;
    }

    .kpi-grid{
        grid-template-columns:repeat(2,minmax(0,1fr))!important;
        gap:9px!important;
    }
    .kpi-card{
        min-width:0!important;
        min-height:113px!important;
        padding:15px!important;
        border-radius:18px!important;
    }
    .kpi-card>span{font-size:10px!important}
    .kpi-card>strong{font-size:25px!important}
    .kpi-card>small{font-size:9px!important;line-height:1.35!important}

    .command-grid,
    .insight-grid,
    .liga-interna-grid,
    .report-grid,
    .dashboard-grid,
    .grid-2,
    .grid-3,
    .two-columns,
    .three-columns{
        grid-template-columns:1fr!important;
    }
    .panel,
    .dashboard-widget,
    .card{
        max-width:100%!important;
        min-width:0!important;
        border-radius:20px!important;
    }
    .panel-header{
        align-items:flex-start!important;
        gap:10px!important;
    }
    .panel-header h2{font-size:17px!important}
    .panel-link{font-size:10px!important}

    .tasks-dashboard-metrics{
        grid-template-columns:repeat(2,minmax(0,1fr))!important;
    }
    .tasks-dashboard-row{
        grid-template-columns:28px minmax(0,1fr)!important;
        gap:8px!important;
    }
    .tasks-dashboard-due,
    .tasks-dashboard-priority{
        grid-column:2!important;
        justify-self:start!important;
    }

    .table-responsive,
    .table-wrap,
    .responsive-table,
    .panel-table,
    .data-table-wrap{
        max-width:100%!important;
        overflow-x:auto!important;
        -webkit-overflow-scrolling:touch;
        border-radius:14px;
    }
    table{
        font-size:12px;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea{
        max-width:100%;
        font-size:16px!important;
    }
    button,
    .btn,
    .button{
        min-height:42px;
    }

    .modal,
    .modal-content,
    .dialog,
    [role="dialog"]{
        max-width:calc(100vw - 24px)!important;
    }

    body.pwa-sheet-open{
        overflow:hidden;
    }
}

@media(max-width:430px){
    .pwa-login-card{
        padding:25px 20px;
        border-radius:26px;
    }
    .pwa-login-copy h1{font-size:28px}
    .pwa-more-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
    .pwa-more-grid a,.pwa-more-grid button{padding:12px;min-height:82px}
}

