:root {
            --color-primario: #EFBF04;
            --color-primario-oscuro: #EFBF04;
            --color-fondo: #f3f4f6;
            --color-panel: #ffffff;
            --color-texto: #111827;
            --color-borde: #EFBF04;
            --color-error: #b91c1c;
            --color-ok: #15803d;
        }
        *{box-sizing:border-box}
        body{
            margin:0;
            font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
            background:var(--color-fondo);
            color:var(--color-texto);
        }
        img{max-width:100%}
        .hidden{display:none!important}

        .app-container{
            min-height:100vh;
            display:flex;
            flex-direction:column;
        }
        header.app-header{
            background:linear-gradient(135deg,#c99700 0%, #efbf04 55%, #f7d54a 100%);
            color:#111827;
            padding:.75rem 1rem;
            display:flex;
            align-items:center;
            justify-content:space-between;
            box-shadow:0 8px 20px rgba(146,64,14,.18);
        }
        .app-header-left{display:flex;align-items:center;gap:.75rem}
        .logo{
            width:40px;height:40px;border-radius:8px;
            background:rgba(255,255,255,.35);display:flex;align-items:center;justify-content:center;overflow:hidden;
            border:1px solid rgba(17,24,39,.12);
        }
        .logo img{width:100%;height:100%;object-fit:contain}
        .app-title{display:flex;flex-direction:column;gap:.15rem}
        .app-title-main{font-size:1rem;font-weight:600}
        .app-title-sub{font-size:.75rem;color:#6b4f00}
        .app-header-right{display:flex;align-items:center;gap:.75rem}
        .avatar-circle{
            width:40px;height:40px;border-radius:999px;
            background:#111827;color:#f9fafb;
            display:flex;align-items:center;justify-content:center;
            font-weight:700;font-size:1.1rem;
            box-shadow:0 4px 10px rgba(17,24,39,.18);
        }
        .user-info-text{display:flex;flex-direction:column;gap:.1rem}
        .user-name{font-size:.9rem;font-weight:600}
        .user-role-tag{
            display:inline-flex;align-items:center;justify-content:center;
            padding:.15rem .5rem;border-radius:999px;
            background:rgba(17,24,39,.10);font-size:.7rem;color:#111827;
            border:1px solid rgba(17,24,39,.12);
        }
        .btn-sm-outline{
            border-radius:999px;border:1px solid rgba(17,24,39,.18);padding:.25rem .7rem;
            background:rgba(255,255,255,.25);color:#111827;font-size:.75rem;cursor:pointer;
        }
        .btn-sm-outline:hover{border-color:rgba(17,24,39,.35);background:rgba(255,255,255,.4)}

        main.app-main{
            flex:1;padding:1rem;max-width:1200px;margin:0 auto;width:100%;
        }

        #login-section{
            max-width:400px;margin:4rem auto;background:var(--color-panel);
            border-radius:1rem;padding:2rem;
            box-shadow:0 15px 35px rgba(15,23,42,.12);
        }
        #login-section h2{margin:0 0 1rem;font-size:1.3rem}
        .form-group{margin-bottom:.9rem}
        .form-label{
            display:block;font-size:.8rem;font-weight:600;margin-bottom:.25rem;
        }
        .form-input,.form-select,.form-textarea{
            width:100%;padding:.45rem .6rem;border-radius:.5rem;
            border:1px solid var(--color-borde);font-size:.85rem;
        }
        .form-textarea{min-height:60px;resize:vertical}
        .form-input:focus,.form-select:focus,.form-textarea:focus{
            outline:2px solid var(--color-primario);border-color:var(--color-primario);
        }
        .btn-primary{
            background:var(--color-primario);border-radius:.75rem;border:none;
            color:#111827;font-weight:600;padding:.5rem 1rem;cursor:pointer;font-size:.85rem;
        }
        .btn-primary:hover{background:var(--color-primario-oscuro)}
        .btn-secondary{
            background:#e5e7eb;border-radius:.75rem;border:none;
            color:#111827;font-weight:500;padding:.5rem 1rem;cursor:pointer;font-size:.85rem;
        }
        .btn-secondary:hover{background:#d1d5db}
        .btn-small-primary{
            background:var(--color-primario);border-radius:999px;border:none;
            padding:.3rem .7rem;font-size:.75rem;cursor:pointer;font-weight:600;
        }
        .btn-small-primary:hover{background:var(--color-primario-oscuro)}
        .btn-small-danger{
            background:#fee2e2;color:#b91c1c;border-radius:999px;border:none;
            padding:.3rem .7rem;font-size:.75rem;cursor:pointer;font-weight:600;
        }
        .btn-small-danger:hover{background:#fecaca}
        .error-msg{margin-top:.5rem;color:var(--color-error);font-size:.78rem;display:none}

        #welcome-section{display:flex;flex-direction:column;gap:1rem}
        .welcome-header{
            display:flex;flex-wrap:wrap;gap:1rem;align-items:center;justify-content:space-between;
        }
        .welcome-left{display:flex;align-items:center;gap:.7rem}
        .welcome-text-block{display:flex;flex-direction:column;gap:.15rem}
        .welcome-title{font-size:1.05rem;font-weight:600}
        .welcome-subtitle{font-size:.8rem;color:#6b7280}
        .welcome-role-tag{
            display:inline-flex;align-items:center;justify-content:center;
            padding:.2rem .65rem;border-radius:999px;font-size:.7rem;
            background:#fbbf24;color:#92400e;font-weight:600;
        }

        .nav-grid{
            display:grid;
            grid-template-columns:repeat(auto-fit,minmax(130px,1fr));
            gap:.6rem;
        }
        .nav-btn{
            border-radius:.9rem;border:1px solid #e5e7eb;background:#fff;
            padding:.6rem .5rem;font-size:.8rem;font-weight:500;cursor:pointer;
            display:flex;flex-direction:column;gap:.1rem;text-align:left;
        }
        .nav-btn-main{font-weight:600}
        .nav-btn-sub{font-size:.7rem;color:#6b7280}
        .nav-btn:hover{border-color:var(--color-primario);box-shadow:0 8px 18px rgba(15,23,42,.06)}
        .nav-btn.danger{border-color:#fecaca;background:#fef2f2;color:#b91c1c}
        .permissions-panel{
            margin:.6rem 0;padding:.65rem;border:1px solid #e5e7eb;border-radius:.9rem;background:#f9fafb;
        }
        .permissions-title{font-size:.8rem;font-weight:700;margin-bottom:.25rem}
        .permissions-subtitle{font-size:.7rem;color:#6b7280;margin-bottom:.45rem}
        .permissions-grid{
            display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:.22rem .35rem;
        }
        .permission-item{
            display:flex;align-items:center;gap:.28rem;font-size:.72rem;background:#fff;border:1px solid #e5e7eb;
            padding:.24rem .34rem;border-radius:.5rem;line-height:1.1;min-height:28px;
        }
        .permission-item input{accent-color:var(--color-primario);margin:0;flex:0 0 auto}
        .permissions-actions{display:flex;gap:.3rem;flex-wrap:wrap;margin:.35rem 0}
        .permissions-actions .btn-secondary{padding:.32rem .55rem;font-size:.72rem}
        .perm-summary{font-size:.72rem;color:#4b5563;max-width:260px}

        .card{
            background:var(--color-panel);border-radius:1rem;padding:1rem;
            box-shadow:0 8px 20px rgba(15,23,42,.06);margin-top:.5rem;
        }
        .card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.6rem}
        .card-title{font-size:.95rem;font-weight:600}
        .card-subtitle{font-size:.8rem;color:#6b7280}
        .card-body{font-size:.82rem}

        table{width:100%;border-collapse:collapse;font-size:.8rem}
        thead{background:#f9fafb}
        th,td{padding:.4rem .5rem;border-bottom:1px solid #e5e7eb;text-align:left}
        th{font-weight:600;font-size:.75rem}
        tbody tr:hover{background:#f3f4f6}

        #mapa-afiliacion{
            width:100%;height:250px;border-radius:.75rem;
            overflow:hidden;border:1px solid #e5e7eb;margin-top:.5rem;
        }
        .ubicacion-actions{display:flex;flex-wrap:wrap;gap:.45rem;margin:.6rem 0 .35rem 0}
        .ubicacion-status{font-size:.76rem;color:#4b5563;background:#f9fafb;border:1px solid #e5e7eb;border-radius:.6rem;padding:.38rem .5rem;margin-top:.35rem}
        .map-fullscreen-overlay{
            position:fixed!important;inset:0!important;background:#fff;z-index:999999!important;display:flex;flex-direction:column;
            width:100vw!important;height:100vh!important;height:100dvh!important;overflow:hidden!important;
        }
        .map-fullscreen-header{
            flex:0 0 auto;display:flex;justify-content:space-between;align-items:center;gap:.75rem;padding:.7rem .9rem;
            min-height:66px;border-bottom:1px solid #e5e7eb;background:#ffffff;box-shadow:0 3px 14px rgba(15,23,42,.08);
        }
        .map-fullscreen-title{font-weight:700;font-size:.95rem}
        .map-fullscreen-subtitle{font-size:.76rem;color:#6b7280}
        .map-fullscreen-actions{display:flex;gap:.45rem;flex-wrap:wrap;justify-content:flex-end}
        #mapa-ubicacion-full{flex:1 1 auto;width:100%!important;height:calc(100vh - 66px)!important;height:calc(100dvh - 66px)!important;min-height:420px!important;background:#e5e7eb;position:relative!important;z-index:1}
        #mapa-ubicacion-full .leaflet-container{width:100%!important;height:100%!important}
        #mapa-ubicacion-full .leaflet-pane,#mapa-ubicacion-full .leaflet-tile-pane,#mapa-ubicacion-full .leaflet-map-pane{z-index:auto}
        .map-fullscreen-overlay.hidden{display:none!important}
        #mapa-beneficiarios{
            width:100%;height:calc(100vh - 220px);border-radius:.75rem;
            overflow:hidden;border:1px solid #e5e7eb;margin-top:.5rem;background:#e5e7eb;
        }
        .map-beneficiarios-panel{background:#fff;border-radius:.85rem;position:relative}
        .map-beneficiarios-panel:fullscreen{width:100vw;height:100vh;background:#fff;padding:1rem;box-sizing:border-box;display:flex;flex-direction:column;gap:.6rem;overflow:hidden}
        .map-beneficiarios-panel:-webkit-full-screen{width:100vw;height:100vh;background:#fff;padding:1rem;box-sizing:border-box;display:flex;flex-direction:column;gap:.6rem;overflow:hidden}
        .map-beneficiarios-panel:fullscreen .map-toolbar{flex:0 0 auto;background:#fff;border:1px solid #e5e7eb;border-radius:.85rem;padding:.65rem;box-shadow:0 4px 16px rgba(15,23,42,.08);z-index:5}
        .map-beneficiarios-panel:-webkit-full-screen .map-toolbar{flex:0 0 auto;background:#fff;border:1px solid #e5e7eb;border-radius:.85rem;padding:.65rem;box-shadow:0 4px 16px rgba(15,23,42,.08);z-index:5}
        .map-beneficiarios-panel:fullscreen #mapa-beneficiarios{height:calc(100vh - 128px)!important;flex:1 1 auto;margin-top:0}
        .map-beneficiarios-panel:-webkit-full-screen #mapa-beneficiarios{height:calc(100vh - 128px)!important;flex:1 1 auto;margin-top:0}
        .voto-switch{position:relative;display:inline-flex;align-items:center;gap:.4rem;font-size:.75rem;font-weight:600}
        .voto-switch input{display:none}
        .voto-slider{width:46px;height:24px;background:#d1d5db;border-radius:999px;position:relative;transition:.2s;box-shadow:inset 0 0 0 1px rgba(0,0,0,.06)}
        .voto-slider:before{content:"";position:absolute;width:20px;height:20px;left:2px;top:2px;background:#fff;border-radius:50%;transition:.2s;box-shadow:0 1px 4px rgba(0,0,0,.25)}
        .voto-switch input:checked + .voto-slider{background:#16a34a}
        .voto-switch input:checked + .voto-slider:before{transform:translateX(22px)}
        #mapa-riesgos{
            width:100%;height:520px;border-radius:.75rem;
            overflow:hidden;border:1px solid #e5e7eb;margin-top:.5rem;background:#e5e7eb;
        }
        .riesgo-layout{display:grid;grid-template-columns:minmax(280px,360px) 1fr;gap:.8rem;align-items:start}
        .riesgo-map-panel{position:relative;background:#fff;border-radius:.85rem}
        .riesgo-map-actions{display:flex;justify-content:flex-end;gap:.5rem;margin-bottom:.45rem;flex-wrap:wrap}
        .riesgo-map-panel:fullscreen{background:#fff;padding:1rem;width:100vw;height:100vh;box-sizing:border-box}
        .riesgo-map-panel:fullscreen #mapa-riesgos{height:calc(100vh - 72px)!important;border-radius:.75rem}
        .riesgo-map-panel:-webkit-full-screen{background:#fff;padding:1rem;width:100vw;height:100vh;box-sizing:border-box}
        .riesgo-map-panel:-webkit-full-screen #mapa-riesgos{height:calc(100vh - 72px)!important;border-radius:.75rem}
        .riesgo-badge{display:inline-flex;align-items:center;border-radius:999px;padding:.12rem .45rem;font-size:.68rem;font-weight:700;background:#fef3c7;color:#92400e}
        @media(max-width:850px){.riesgo-layout{grid-template-columns:1fr}#mapa-riesgos{height:420px}}
        .map-toolbar{display:flex;flex-wrap:wrap;gap:.5rem;align-items:flex-start}
        .map-toolbar select{max-width:170px}
        .map-toolbar select[multiple]{min-width:190px;max-width:230px;height:auto;min-height:92px}
        .map-help{display:block;font-size:.68rem;color:#6b7280;margin-top:.15rem}

        .overlay{
            position:fixed;inset:0;background:rgba(0,0,0,.35);
            display:flex;align-items:flex-start;justify-content:center;z-index:9999;
            padding:1rem;overflow-y:auto;
        }
        .modal{
            background:#fff;border-radius:1rem;padding:1rem 1.2rem;
            max-width:420px;width:100%;max-height:calc(100vh - 2rem);max-height:calc(100dvh - 2rem);
            overflow-y:auto;box-shadow:0 20px 40px rgba(15,23,42,.25);
        }
        #nuevo-usuario-modal,#editar-usuario-modal{align-items:stretch!important;padding:.35rem!important;overflow:hidden!important;z-index:60000!important}
        #nuevo-usuario-modal .modal,#editar-usuario-modal .modal{
            width:min(1180px,calc(100vw - .7rem))!important;max-width:none!important;height:calc(100vh - .7rem)!important;height:calc(100dvh - .7rem)!important;
            max-height:none!important;padding:.65rem .8rem!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;border-radius:.85rem!important;
        }
        #nuevo-usuario-modal .modal-body,#editar-usuario-modal .modal-body{margin-bottom:.2rem;overflow:auto!important;flex:1 1 auto!important;padding-right:.25rem}
        #nuevo-usuario-modal .form-group,#editar-usuario-modal .form-group{margin-bottom:.34rem}
        #nuevo-usuario-modal .modal-actions,#editar-usuario-modal .modal-actions{position:sticky;bottom:0;background:#fff;padding:.55rem 0 .1rem;border-top:1px solid #e5e7eb;flex:0 0 auto}
        #nuevo-usuario-modal .permissions-panel,#editar-usuario-modal .permissions-panel{padding:.45rem;margin:.35rem 0}
        #nuevo-usuario-modal .permissions-title,#editar-usuario-modal .permissions-title{margin-bottom:.18rem}
        #nuevo-usuario-modal .permissions-subtitle,#editar-usuario-modal .permissions-subtitle{margin-bottom:.28rem}
        #nuevo-usuario-modal .permissions-actions,#editar-usuario-modal .permissions-actions{margin:.18rem 0 .28rem}
        .modal-header{font-size:.95rem;font-weight:600;margin-bottom:.4rem}
        .modal-body{font-size:.82rem;margin-bottom:.6rem}
        .modal-actions{display:flex;justify-content:flex-end;gap:.4rem}

        .alert{
            padding:.35rem .5rem;border-radius:.5rem;font-size:.75rem;margin-top:.35rem;
        }
        .alert-ok{background:#dcfce7;color:#166534}
        .alert-error{background:#fee2e2;color:#b91c1c}

        .beneficios-opciones{display:flex;flex-wrap:wrap;gap:.4rem}
        .beneficios-opcion-item{
            display:inline-flex;align-items:center;gap:.2rem;
            padding:.2rem .4rem;border-radius:999px;background:#f3f4f6;font-size:.75rem;
        }
        .beneficios-opcion-item input{margin:0}
        .asistencia-list{list-style:none;padding-left:0;margin:0}
        .asistencia-list li{
            display:flex;justify-content:space-between;align-items:center;
            padding:.25rem .35rem;border-bottom:1px solid #e5e7eb;font-size:.78rem;
        }
        .asistencia-remove-btn{
            border:none;border-radius:999px;padding:.15rem .45rem;
            font-size:.7rem;background:#fee2e2;color:#b91c1c;cursor:pointer;
        }
        .asistencia-remove-btn:hover{background:#fecaca}
        .foto-preview{
            width:120px;height:120px;border-radius:.75rem;
            object-fit:cover;border:1px solid #e5e7eb;display:none;
        }
        .badge{display:inline-flex;align-items:center;padding:.2rem .5rem;border-radius:999px;font-size:.7rem}
        .ocr-panel{
            margin-top:.7rem;
            padding:.75rem;
            border:1px dashed #d6a400;
            border-radius:.9rem;
            background:#fff8df;
        }
        .ocr-panel-title{font-weight:700;color:#7a5a00;margin-bottom:.25rem}
        .ocr-help{font-size:.78rem;color:#6b7280;margin:.25rem 0 .55rem}
        .ocr-actions{display:flex;gap:.5rem;flex-wrap:wrap;align-items:center}
        .ocr-status{font-size:.78rem;color:#374151;margin-top:.45rem;white-space:pre-line}
        .ocr-raw{
            margin-top:.5rem;
            font-size:.72rem;
            max-height:120px;
            overflow:auto;
            background:#fff;
            border:1px solid #e5e7eb;
            border-radius:.6rem;
            padding:.5rem;
            color:#4b5563;
            display:none;
        }

        .badge-gold{background:#fef3c7;color:#92400e}
        .pill{
            display:inline-flex;align-items:center;padding:.15rem .45rem;
            border-radius:999px;background:#e5e7eb;font-size:.7rem;
        }
        .catalogo-card{
            border:1px solid #e5e7eb;border-radius:.9rem;padding:.8rem;background:#fff;
            box-shadow:0 8px 18px rgba(15,23,42,.04);
        }
        .catalogo-card table td{font-size:.78rem;}



        .header-user-chip{
            display:inline-flex;align-items:center;gap:.45rem;
            background:#ffffff;border:1px solid #e5e7eb;border-radius:999px;
            padding:.25rem .55rem;font-size:.78rem;box-shadow:0 4px 14px rgba(15,23,42,.06);
        }
        .avatar-mini{
            width:24px;height:24px;border-radius:999px;background:#92400e;color:#fff;
            display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:.75rem;
        }

        @media(max-width:768px){
            main.app-main{padding:.75rem}
            header.app-header{flex-direction:column;align-items:flex-start;gap:.4rem}
            .app-header-right{align-self:flex-end}
        }
    
        /* ===== Beneficiarios 4.0 · Responsive móvil ===== */
        html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
        body{overflow-x:hidden}
        button,input,select,textarea{font:inherit;max-width:100%}
        .table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
        .card,.catalogo-card,.map-beneficiarios-panel,.riesgo-map-panel{max-width:100%}
        .leaflet-container{touch-action:pan-x pan-y}
        @media(max-width:768px){
            body{font-size:15px}
            header.app-header{position:sticky;top:0;z-index:5000;padding:.55rem .65rem;flex-direction:row;align-items:center;gap:.5rem}
            .app-header-left{min-width:0;flex:1;gap:.5rem}.logo{width:34px;height:34px;flex:0 0 34px}.app-title{min-width:0}
            .app-title-main{font-size:.88rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.app-title-sub{display:none}
            .app-header-right{align-self:auto;gap:.35rem;flex:0 0 auto}.header-user-chip{max-width:135px;padding:.2rem .35rem}
            #nombre-usuario-texto{max-width:75px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-role-tag{display:none!important}
            .btn-sm-outline{min-height:38px;padding:.35rem .6rem}main.app-main{padding:.55rem;max-width:100%;overflow-x:hidden}
            #login-section{margin:1.5rem auto;padding:1.15rem;border-radius:.85rem}.welcome-header,.welcome-left{width:100%}.welcome-role-tag{display:none!important}
            .nav-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem}.nav-btn{min-height:68px;padding:.55rem;font-size:.78rem}.nav-btn-sub{font-size:.66rem;line-height:1.2}
            .card{padding:.7rem;border-radius:.8rem;margin-top:.35rem;overflow:hidden}.card-header{align-items:flex-start;gap:.55rem;flex-wrap:wrap}
            .form-group{margin-bottom:.7rem}.form-input,.form-select,.form-textarea{font-size:16px;min-height:44px;padding:.55rem .6rem}.form-textarea{min-height:82px}
            .btn-primary,.btn-secondary,.btn-small-primary,.btn-small-danger{min-height:40px;touch-action:manipulation}.permissions-grid{grid-template-columns:1fr}
            table{min-width:680px;font-size:.76rem}th,td{padding:.42rem .45rem;white-space:nowrap}.table-wrap,.card-body,.catalogo-card{overflow-x:auto;-webkit-overflow-scrolling:touch}
            .catalogo-card table{min-width:520px}.map-toolbar{display:grid;grid-template-columns:1fr;gap:.45rem;width:100%}.map-toolbar>*,.map-toolbar select,.map-toolbar select[multiple]{width:100%;max-width:none;min-width:0}
            .map-toolbar select{min-height:44px;font-size:16px}.map-toolbar select[multiple]{min-height:110px}#mapa-beneficiarios{height:58vh;height:58dvh;min-height:390px;margin-top:.45rem;border-radius:.65rem}
            #mapa-afiliacion{height:320px;min-height:320px}#mapa-riesgos{height:52vh;height:52dvh;min-height:360px}.riesgo-layout{grid-template-columns:1fr}
            .ubicacion-actions,.riesgo-map-actions{display:grid;grid-template-columns:1fr 1fr}.ubicacion-actions button,.riesgo-map-actions button{width:100%;min-height:42px}
            .overlay{padding:.35rem;align-items:flex-start}.modal{width:100%;max-width:none;max-height:calc(100dvh - .7rem);padding:.85rem;border-radius:.8rem}
            .foto-preview{width:100px;height:100px}.ocr-actions{display:grid;grid-template-columns:1fr}.ocr-actions button{width:100%}
            .leaflet-popup-content{margin:10px 12px;max-width:240px!important;font-size:.78rem}.leaflet-control-zoom a{width:36px!important;height:36px!important;line-height:36px!important}
        }
        @media(max-width:420px){
            main.app-main{padding:.42rem}.nav-grid{grid-template-columns:1fr 1fr}.nav-btn{min-height:64px;padding:.48rem}.nav-btn-sub{display:none}.header-user-chip{display:none!important}
            #mapa-beneficiarios{height:62vh;height:62dvh;min-height:360px}#mapa-riesgos{height:58vh;height:58dvh;min-height:340px}.ubicacion-actions,.riesgo-map-actions{grid-template-columns:1fr}.card{padding:.6rem}
        }
@media(max-width:700px){#form-evento{grid-template-columns:1fr!important}#eventos-page .card-body{padding:.65rem}}

.evento-municipios-picker{border:1px solid #d0d5dd;border-radius:14px;background:#f8fafc;padding:.75rem;min-height:92px;max-height:190px;overflow:auto}.evento-municipios-grid{display:flex;flex-wrap:wrap;gap:.45rem}.evento-municipio-chip{position:relative}.evento-municipio-chip input{position:absolute;opacity:0;pointer-events:none}.evento-municipio-chip span{display:inline-flex;align-items:center;gap:.35rem;padding:.55rem .72rem;border:1px solid #d0d5dd;border-radius:999px;background:#fff;cursor:pointer;font-size:.84rem;transition:.15s}.evento-municipio-chip input:checked+span{background:#172033;color:#fff;border-color:#172033}.evento-municipio-chip input:checked+span:before{content:"✓";font-weight:800}.evento-form-actions{display:flex;gap:.45rem;align-items:center}.evento-reg-edit{display:grid;grid-template-columns:1.4fr 1fr 1fr 1fr auto;gap:.5rem;align-items:end;padding:.7rem;background:#f8fafc;border-radius:12px;margin:.5rem 0}@media(max-width:760px){#form-evento{grid-template-columns:1fr!important}.evento-form-actions{width:100%}.evento-form-actions button{flex:1}.evento-reg-edit{grid-template-columns:1fr}}
.evento-qr-box{display:none;margin-top:.8rem;padding:1rem;border:1px solid #e5e7eb;border-radius:14px;background:#fff;text-align:center}.evento-qr-box.visible{display:block}.evento-qr-box>div[id^="qr-evento-"]{display:flex;justify-content:center;margin:.7rem auto}.evento-qr-box canvas,.evento-qr-box img{max-width:220px;width:100%;height:auto!important}.evento-qr-link{font-size:.78rem;word-break:break-all;color:#667085;margin:.55rem 0}

/* MODO MOVIL: al abrir un modulo se oculta el menu principal */
@media (max-width: 760px){
  #welcome-section.mobile-module-open > .nav-grid{display:none !important;}
  #welcome-section.mobile-module-open > .welcome-header{display:none !important;}
  #welcome-section.mobile-module-open{padding-top:0;}
  #welcome-section.mobile-module-open .card:not(.hidden),
  #welcome-section.mobile-module-open > div:not(.nav-grid):not(.welcome-header).card:not(.hidden){margin-top:0;}
  #inicio-btn{display:inline-flex;align-items:center;justify-content:center;}
}

        .offline-afiliar-status{
            position:fixed;right:12px;bottom:12px;z-index:99999;
            padding:8px 12px;border-radius:999px;background:#fff;
            border:1px solid #d1d5db;box-shadow:0 4px 16px rgba(0,0,0,.14);
            font:600 12px/1.2 Arial,sans-serif;display:none;color:#374151;
        }
        @media (max-width: 768px){
            .offline-afiliar-status{
                position:static;right:auto;bottom:auto;z-index:auto;
                width:max-content;max-width:100%;margin-top:2px;padding:2px 7px;
                border-radius:999px;box-shadow:none;font-size:10px;line-height:1.25;
                border-color:rgba(17,24,39,.14);
            }
            .app-title-sub{display:none;}
        }


.voto-links-panel{margin-bottom:1rem;padding:.9rem;border:1px solid #e5e7eb;border-radius:14px;background:#f8fafc}.voto-links-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:.7rem}.voto-link-card{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:.75rem}.voto-link-actions{display:flex;gap:.4rem;flex-wrap:wrap;margin-top:.55rem}.voto-qr-box{display:none;text-align:center;margin-top:.65rem}.voto-qr-box.visible{display:block}.voto-qr-box>div{display:flex;justify-content:center;margin:.5rem auto}.voto-evidencia-thumb{width:54px;height:54px;object-fit:cover;border-radius:8px;border:1px solid #d0d5dd;cursor:pointer}.voto-evidencia-vacia{font-size:.78rem;color:#98a2b3}.voto-public-link{font-size:.72rem;color:#667085;word-break:break-all;margin-top:.4rem}

        /* Menú adaptativo: en módulos queda visible en el encabezado. */
        header.app-header.con-menu-modulos{position:sticky;top:0;z-index:5000;flex-wrap:wrap;gap:.6rem;align-items:center}
        .menu-modulos-header{flex:1 1 100%;min-width:0;order:3}
        .menu-modulos-header .nav-grid{display:flex!important;gap:.45rem!important;flex-wrap:wrap!important;margin:0!important;grid-template-columns:none!important}
        .menu-modulos-header .nav-btn{display:inline-flex;flex-direction:row;align-items:center;min-height:0!important;
            padding:.48rem .7rem!important;flex:0 0 auto;border-radius:.65rem;background:#f4f4f5;color:#111827;
            box-shadow:none;font-size:.78rem;line-height:1.15;border:1px solid #d1d5db}
        .menu-modulos-header .nav-btn.hidden{display:none!important}
        .menu-modulos-header .nav-btn-sub{display:none!important}
        .menu-modulos-header .nav-btn.nav-activo{background:#f5e7aa;border-color:#bd991e}
        .menu-modulos-header .nav-btn.danger{background:#f1f1f1;color:#111827;border-color:#d1d5db}
        .menu-modulos-header .nav-btn:hover{background:#dedede}
        .bulk-importacion{background:#fffdf4;border:1px solid #e8d48a;border-radius:.8rem;padding:.9rem;margin:.75rem 0}
        .bulk-importacion-header{display:flex;justify-content:space-between;flex-wrap:wrap;align-items:center;gap:.65rem}
        .bulk-importacion-fila{display:grid;grid-template-columns:minmax(200px,1fr) auto;align-items:end;gap:.5rem;margin-top:.7rem}
        .bulk-importacion-fila label{grid-column:1/-1;margin:0}
        .bulk-download{display:inline-flex;align-items:center;text-decoration:none;padding:.55rem .8rem;border-radius:.65rem;
            border:1px solid #d1d5db;background:#e5e7eb;color:#111827;font-size:.83rem}
        .bulk-importacion-fila button{white-space:nowrap}
        .bulk-preview-stats{font-size:.82rem;font-weight:650}
        .bulk-preview-table{max-height:290px;overflow:auto;background:white;border:1px solid #e5e7eb;border-radius:.65rem}
        .bulk-preview-table td,.bulk-preview-table th{padding:.45rem;font-size:.77rem;vertical-align:top;text-align:left}
        .bulk-preview-actions{display:flex;justify-content:flex-end;margin-top:.65rem}

        /* Detección inteligente de duplicados en importación Excel. */
        .bulk-review-section{margin-top:1rem;padding:1rem;background:#fffcf0;border:1px solid #dfc76e;border-radius:.75rem}
        .bulk-review-section h4{margin:0 0 .35rem;font-size:.95rem}
        .bulk-review-section p{font-size:.82rem;color:#374151;margin:.3rem 0 .75rem}
        .bulk-review-table{overflow-x:auto;max-height:430px;overflow-y:auto;border:1px solid #ddd7bf;border-radius:.5rem;background:white}
        .bulk-review-table table{width:100%;min-width:780px;border-collapse:collapse}
        .bulk-review-table th{position:sticky;top:0;background:#f8ecc2;text-align:left;padding:.6rem;z-index:1;font-size:.82rem}
        .bulk-review-table td{border-top:1px solid #e5e7eb;padding:.5rem .6rem;font-size:.8rem;vertical-align:top}
        .bulk-coincidencia{padding:.3rem 0;border-bottom:1px solid #eef0f2;line-height:1.4}
        .bulk-coincidencia:last-child{border-bottom:0}
        .bulk-revision-select{min-width:185px!important;max-width:210px;width:100%!important;font-size:.8rem}
        #bulk-review-pending{font-weight:700;color:#111827;margin-top:.65rem}
        @media(max-width:760px){
            .menu-modulos-header{width:100%;overflow-x:auto;scrollbar-width:thin;flex:0 0 100%}
            .menu-modulos-header .nav-grid{flex-wrap:nowrap!important;width:max-content;max-width:none}
            .menu-modulos-header .nav-btn{white-space:nowrap;min-width:0}
            .bulk-importacion-fila{grid-template-columns:minmax(0,1fr)}
        }
        /* Directorio territorial: misma paleta y controles que el resto del sistema. */
        .personal-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem;align-items:end;padding:.75rem;border:1px solid #e5e7eb;border-radius:12px;background:#fffdf6}
        .personal-form .form-group{margin:0;min-width:0}
        .personal-form-actions{grid-column:1/-1;display:flex;gap:.5rem;flex-wrap:wrap}
        .personal-filtros{display:grid;grid-template-columns:minmax(220px,1fr) minmax(150px,240px);gap:.65rem;margin:1rem 0}
        .personal-tabla-wrap{width:100%;overflow-x:auto}
        .personal-tabla-wrap table{min-width:720px;width:100%}
        .personal-tabla-wrap td{vertical-align:middle;white-space:normal}
        .personal-tabla-wrap button{margin:0 .25rem .25rem 0}
        .personal-afiliar-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}
        .personal-afiliar-grid .form-group{min-width:0}
        @media(max-width:860px){.personal-form{grid-template-columns:repeat(2,minmax(0,1fr))}}
        @media(max-width:600px){.personal-form,.personal-afiliar-grid,.personal-filtros{grid-template-columns:1fr}}

/* Acceso visible a importación masiva en Afiliar. */
.afiliar-header-actions { display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;justify-content:space-between; }
.afiliar-header-actions #btn-abrir-carga-masiva { flex:0 0 auto;white-space:nowrap;padding:.65rem .9rem;border:1px solid #b6b6b6;background:#e5e7eb;color:#111827;border-radius:.6rem;font-weight:700;cursor:pointer; }
.afiliar-header-actions #btn-abrir-carga-masiva:hover { background:#d5d7da; }
#bulk-afiliar-super {scroll-margin-top:170px;}
@media(max-width:680px){.afiliar-header-actions #btn-abrir-carga-masiva {width:100%;}}


/* ===== Análisis de redes: aislado de estilos de mapas y formularios ===== */
.social-dashboard{display:flex;flex-direction:column;gap:16px;color:#111827}
.social-dashboard h3{font-size:1rem;margin:0 0 .7rem;color:#111827}
.social-dashboard .social-toolbar{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap}
.social-toolbar label{display:flex;flex-direction:column;gap:4px;font-size:.78rem;font-weight:600;min-width:140px}
.social-toolbar label input,.social-toolbar label select{min-width:140px}
.social-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.social-metric{background:#fffdf6;border:1px solid #e9dba4;border-radius:12px;padding:15px;display:grid;gap:6px}
.social-metric small{font-size:.76rem;color:#374151}.social-metric strong{font-size:1.5rem;color:#111827;font-weight:750}
.social-panels{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.social-pane{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:16px;min-width:0}
.social-nota{font-size:.82rem;color:#4b5563;line-height:1.5;margin:.5rem 0}
.social-inline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.social-inline-actions>*{flex:0 1 auto}.social-inline-actions input[type=file]{max-width:320px}
.social-aviso{font-size:.88rem;color:#3b3b3b;min-height:1.2em;white-space:pre-wrap}
.social-aviso.is-error{color:#991b1b}.social-aviso.is-ok{color:#166534}
.social-grafico{display:grid;gap:12px;font-size:.84rem}
.social-bar-item{display:grid;gap:3px}.social-bar-label{display:flex;justify-content:space-between;gap:10px}
.social-bar{height:12px;background:#f3f4f6;border-radius:20px;overflow:hidden}
.social-bar>span{display:block;height:100%;background:#e1c669;border-radius:20px}
.social-table-wrap{overflow-x:auto}.social-table-wrap table{min-width:720px}.social-table-wrap td{font-size:.83rem}
.social-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.social-form label{display:flex;flex-direction:column;gap:5px;font-size:.8rem;font-weight:650;min-width:0}
.social-wide{grid-column:1/-1}.social-post-link{word-break:break-word;max-width:400px;display:block}
.social-comments-table{max-width:700px;margin-top:10px}
@media(max-width:850px){.social-panels{grid-template-columns:1fr}.social-form{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.social-form{grid-template-columns:1fr}.social-toolbar label{width:100%}.social-inline-actions input[type=file]{width:100%}}

/* CIMAC: conexión de Meta accesible y explícita; nunca mostrar token por defecto */
.social-conectar-panel{margin-top:14px;padding:14px;border:1px solid #d1d5db;border-radius:12px;background:#f9fafb}
.social-conectar-panel[hidden]{display:none!important}
.social-conectar-panel h4{color:#111827;margin:0 0 8px;font-size:.97rem}
.social-conectar-panel form{display:grid;gap:12px}
.social-conectar-panel form label{display:flex;flex-direction:column;gap:6px;color:#111827;font-weight:700;font-size:.84rem;min-width:0}
.social-conectar-panel input{max-width:100%;min-width:0}
.social-conectar-panel .social-inline-actions{gap:9px}
.social-conectar-panel button{white-space:normal;overflow-wrap:anywhere}
.social-conectar-panel a{color:#1d4ed8;text-decoration:underline}


/* ===== Grupos y análisis por URL (noviembre 2026) ===== */
.social-panels-setup{align-items:start}
.social-group-form,.social-link-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.social-group-form label,.social-link-form label{display:flex;flex-direction:column;gap:5px;font-size:.8rem;font-weight:650;min-width:0}
.social-group-list{margin-top:12px;display:grid;gap:8px;max-height:260px;overflow:auto}
.social-group-entry{border:1px solid #e5e7eb;background:#fafafa;border-radius:9px;padding:10px;display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.social-group-entry .social-group-info{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}
.social-group-entry .social-group-info small{color:#4b5563}
.social-group-entry .social-inline-actions{gap:5px}
.social-group-entry button{padding:6px 9px;font-size:.78rem}
#social-link-result{margin-top:8px;font-size:.82rem}
#social-editar-metricas-panel[hidden],#social-grupo-cancelar[hidden]{display:none!important}
.social-post-action{white-space:nowrap;padding:7px 9px;font-size:.78rem}
.social-table-wrap table{min-width:850px}
@media(max-width:600px){.social-group-form,.social-link-form{grid-template-columns:1fr}.social-group-entry{align-items:flex-start}}
