/* Tema claro/oscuro de a2pasos. Usa los tokens de tokens.css. */

/* La promoción vive en el menú; evita el botón flotante heredado sobre el mapa. */
body.mapa #abrirPromociones{display:none!important}
.a2-bar-row .a2-bar-fill{display:block}
.a2-chip .bi{display:none}

/* ---------- Selector de tema ---------- */
.a2-theme-toggle{position:relative}
.a2-rail .a2-theme-toggle:focus-visible{background:transparent!important;color:var(--ink)!important;outline:3px solid var(--focus);outline-offset:2px}
.a2-theme-choices{display:grid;gap:8px;width:100%;padding:12px 0 4px;border-top:1px solid var(--line)}
.a2-theme-label{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:600;color:var(--ink)}
.a2-theme-label .bi{font-size:17px}
.a2-theme-options{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.a2-theme-options button{border:1px solid var(--line-strong);background:transparent;color:var(--ink);border-radius:8px;padding:8px 6px;font-size:12.5px;font-weight:600;line-height:1.2}
.a2-theme-options button:hover{background:var(--brand-soft)}
.a2-theme-options button.is-active{background:var(--brand-soft);border-color:var(--primary);color:var(--primary)}

/* ---------- Base ---------- */
[data-theme="dark"]{--a2-select-bg:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23F3F1EA' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e")}
[data-theme="dark"] body{background:var(--surface);color:var(--ink)}
[data-theme="dark"] body.mapa{background:var(--surface-sunken)}
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,[data-theme="dark"] h4,[data-theme="dark"] h5{color:var(--ink)}
[data-theme="dark"] a{color:var(--link)}
[data-theme="dark"] .text-dark{color:var(--ink)!important}
[data-theme="dark"] .text-muted{color:var(--ink-muted)!important}
[data-theme="dark"] .bg-white,[data-theme="dark"] .bg-light{background:var(--surface-raised)!important;color:var(--ink)!important}
[data-theme="dark"] .border,[data-theme="dark"] .border-top,[data-theme="dark"] .border-bottom{border-color:var(--line)!important}
[data-theme="dark"] hr{border-color:var(--line);opacity:1}

/* ---------- Botones y controles Bootstrap ---------- */
[data-theme="dark"] .btn-primary{--bs-btn-bg:var(--primary);--bs-btn-border-color:var(--primary);--bs-btn-color:var(--on-primary);--bs-btn-hover-bg:var(--primary-hover);--bs-btn-hover-border-color:var(--primary-hover);--bs-btn-hover-color:var(--on-primary);--bs-btn-active-bg:var(--primary-pressed);--bs-btn-active-border-color:var(--primary-pressed);--bs-btn-active-color:var(--on-primary);background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
[data-theme="dark"] .btn-primary:hover{background:var(--primary-hover);border-color:var(--primary-hover);color:var(--on-primary)}
[data-theme="dark"] .btn-primary:active,[data-theme="dark"] .btn-primary.active{background:var(--primary-pressed);border-color:var(--primary-pressed);color:var(--on-primary)}
[data-theme="dark"] .btn-outline-primary{--bs-btn-color:var(--ink);--bs-btn-border-color:var(--line-strong);--bs-btn-hover-bg:var(--brand-soft);--bs-btn-hover-border-color:var(--primary);--bs-btn-hover-color:var(--ink);color:var(--ink);border-color:var(--line-strong);background:transparent}
[data-theme="dark"] .btn-outline-primary:hover{background:var(--brand-soft);border-color:var(--primary);color:var(--ink)}
[data-theme="dark"] .btn-light{background:var(--ink);border-color:var(--ink);color:var(--surface)}
[data-theme="dark"] .btn-light:hover{background:var(--ink-muted);border-color:var(--ink-muted);color:var(--surface)}
[data-theme="dark"] .btn-link{color:var(--link)}
[data-theme="dark"] .btn-close{filter:invert(1) grayscale(1) brightness(2);opacity:.9}
[data-theme="dark"] .btn:disabled,[data-theme="dark"] .btn.disabled{background:var(--disabled-bg)!important;border-color:var(--disabled-bg)!important;color:var(--disabled-fg)!important;opacity:1}
[data-theme="dark"] .form-control,[data-theme="dark"] .form-select,[data-theme="dark"] .form-check-input{background-color:var(--surface-sunken);border-color:var(--line-strong);color:var(--ink)}
[data-theme="dark"] .form-select{background-image:var(--a2-select-bg);background-repeat:no-repeat;background-position:right .75rem center;background-size:16px 12px}
[data-theme="dark"] .form-control::placeholder,[data-theme="dark"] .form-select::placeholder,[data-theme="dark"] textarea::placeholder{color:var(--ink-muted);opacity:1}
[data-theme="dark"] .form-control:focus,[data-theme="dark"] .form-select:focus,[data-theme="dark"] .form-check-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(98,196,144,.2)}
[data-theme="dark"] .form-control:disabled,[data-theme="dark"] .form-select:disabled{background:var(--disabled-bg);color:var(--disabled-fg);border-color:var(--line)}
[data-theme="dark"] .form-check-input:checked{background-color:var(--primary);border-color:var(--primary)}
[data-theme="dark"] .form-check-input[type="checkbox"]:checked{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230A1020' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e")}
[data-theme="dark"] .form-range::-webkit-slider-runnable-track{background:var(--line)}
[data-theme="dark"] .modal-content{background:var(--surface-raised);color:var(--ink);border-color:var(--line)}
[data-theme="dark"] .modal-header,[data-theme="dark"] .modal-footer{border-color:var(--line)}
[data-theme="dark"] .modal-backdrop.show{opacity:.72;background:#000}
[data-theme="dark"] .dropdown-menu{background:var(--surface-raised);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] .dropdown-item{color:var(--ink)}
[data-theme="dark"] .dropdown-item:hover,[data-theme="dark"] .dropdown-item:focus{background:var(--brand-soft);color:var(--ink)}
[data-theme="dark"] .list-group-item{background:var(--surface-raised);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] .table{--bs-table-color:var(--ink);--bs-table-bg:transparent;--bs-table-border-color:var(--line)}
[data-theme="dark"] .swal2-popup{background:var(--surface-raised);color:var(--ink);border:1px solid var(--line)}
[data-theme="dark"] .swal2-title,[data-theme="dark"] .swal2-html-container{color:var(--ink)}
[data-theme="dark"] footer.bg-dark{background:var(--surface-sunken)!important;color:var(--ink)!important;border-top:1px solid var(--line)}
[data-theme="dark"] footer a{color:var(--link)}
[data-theme="dark"] .menu-link,[data-theme="dark"] .menu-link *{color:var(--ink)!important}
[data-theme="dark"] .menu-link:hover{background:var(--brand-soft)}
[data-theme="dark"] #menuModal .modal-content,[data-theme="dark"] #passwordModal .modal-content{background:var(--surface-raised)!important;color:var(--ink)}
[data-theme="dark"] #menuModal .modal-header{background:var(--brand-soft)!important;color:var(--ink)!important}
[data-theme="dark"] #menuModal .modal-body{background:var(--surface-raised)!important;color:var(--ink)!important}
[data-theme="dark"] #menuModal .btn-close{filter:invert(1) grayscale(1) brightness(2)}

/* ---------- Mapa, barra lateral y controles flotantes ---------- */
[data-theme="dark"] #map,[data-theme="dark"] .leaflet-container{background:#08101f}
[data-theme="dark"] #map-container{background:var(--surface-sunken)}
[data-theme="dark"] .a2-rail{background:rgba(24,35,59,.88);border-color:rgba(124,138,166,.28);backdrop-filter:blur(18px);box-shadow:var(--shadow-2)}
[data-theme="dark"] .a2-rail button,[data-theme="dark"] .a2-rail a{color:var(--ink)}
[data-theme="dark"] .a2-rail button:hover,[data-theme="dark"] .a2-rail button:focus-visible{background:var(--ink);color:var(--surface)}
[data-theme="dark"] body.a2-page-body .a2-rail{background:rgba(24,35,59,.88);backdrop-filter:blur(18px);border-color:rgba(124,138,166,.24)}
[data-theme="dark"] body.mapa #search-animated-wrapper{background:rgba(24,35,59,.92)!important;border-color:rgba(124,138,166,.26)!important;box-shadow:var(--shadow-2);backdrop-filter:blur(16px)}
[data-theme="dark"] body.mapa #busquedaInput{color:var(--ink)!important}
[data-theme="dark"] body.mapa #busquedaInput::placeholder{color:var(--ink-muted)!important}
[data-theme="dark"] #search-animated-wrapper.search-open{border-color:var(--line-strong)}
[data-theme="dark"] #resultadosBusqueda{background:var(--surface-raised);color:var(--ink);border-color:var(--line);box-shadow:var(--shadow-3)}
[data-theme="dark"] #resultadosBusqueda .search-results-heading,[data-theme="dark"] #resultadosBusqueda .search-state,[data-theme="dark"] .search-result-address{color:var(--ink-muted)}
[data-theme="dark"] #resultadosBusqueda .result-card{background:transparent;color:var(--ink)}
[data-theme="dark"] #resultadosBusqueda .result-card + .result-card{border-top-color:var(--line)}
[data-theme="dark"] #resultadosBusqueda .result-card:hover,[data-theme="dark"] #resultadosBusqueda .result-card:focus-visible{background:var(--brand-soft)}
[data-theme="dark"] .search-result-icon{background:var(--brand-soft);color:var(--primary)}
[data-theme="dark"] .a2-city{background:rgba(24,35,59,.92);box-shadow:var(--shadow-2);backdrop-filter:blur(16px);border:1px solid rgba(124,138,166,.18)}
[data-theme="dark"] .a2-actions button{background:var(--surface-raised);color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-actions button:last-child{background:var(--primary);color:var(--on-primary);border-color:var(--primary)}
[data-theme="dark"] body.mapa #btn_abrir{background:var(--accent);color:var(--on-accent)}
[data-theme="dark"] body.mapa #mylocation-btn{background:rgba(24,35,59,.92)!important;border-color:var(--line-strong)!important;color:var(--primary)}
[data-theme="dark"] body.mapa #mylocation-btn .icon{filter:invert(1) sepia(1) saturate(0) brightness(2)}
[data-theme="dark"] .a2-map-credit{background:#F3F1EA;color:#14213D;border:0}
[data-theme="dark"] .a2-map-credit img{filter:none}
[data-theme="dark"] .a2-chip,[data-theme="dark"] .a2-clear-chip{background:var(--brand-soft);color:var(--ink);border-color:var(--primary)}
[data-theme="dark"] .a2-clear-chip{background:var(--surface-raised);border-color:var(--line)}
[data-theme="dark"] .leaflet-control-attribution{background:rgba(10,16,32,.86)!important;color:var(--ink-muted)!important}
[data-theme="dark"] .leaflet-control-attribution a{color:var(--link)!important}
[data-theme="dark"] .marker-cluster div{background:var(--primary)!important;color:var(--on-primary)!important;border-color:var(--surface-raised)!important}
[data-theme="dark"] .leaflet-popup-content-wrapper,[data-theme="dark"] .leaflet-popup-tip{background:var(--surface-raised);color:var(--ink);box-shadow:var(--shadow-2)}
[data-theme="dark"] .leaflet-popup-close-button{color:var(--ink-muted)}
[data-theme="dark"] .a2-map-credit span{color:#14213D}

/* ---------- Paneles del mapa: filtros, petición y ficha ---------- */
[data-theme="dark"] .a2-panel .modal-content,[data-theme="dark"] #infoModal .modal-content{background:linear-gradient(145deg,#1b2742,#141e33)!important;color:var(--ink);border:1px solid rgba(124,138,166,.2)!important;box-shadow:var(--shadow-3)!important}
[data-theme="dark"] .a2-panel .modal-header,[data-theme="dark"] .a2-panel .modal-footer,[data-theme="dark"] #infoModal .modal-header{background:transparent!important;border-color:var(--line)!important;color:var(--ink)!important}
[data-theme="dark"] .a2-panel .modal-title,[data-theme="dark"] #infoModalLabel{color:var(--ink)!important}
[data-theme="dark"] .a2-filter-search,[data-theme="dark"] .a2-tabs{background:var(--surface-sunken)}
[data-theme="dark"] .a2-filter-search input{color:var(--ink)}
[data-theme="dark"] .a2-filter-search input::placeholder{color:var(--ink-muted)}
[data-theme="dark"] .a2-tabs button{color:var(--ink)}
[data-theme="dark"] .a2-tabs button.active{background:var(--ink);color:var(--surface)}
[data-theme="dark"] .a2-category-row input:checked:after{color:var(--on-primary)}
[data-theme="dark"] .a2-category-row input{background:var(--surface-raised)}
[data-theme="dark"] .a2-panel .btn-link,[data-theme="dark"] .a2-alta-actions .a2-link-button{color:var(--ink)}
[data-theme="dark"] #peticionForm .form-control,[data-theme="dark"] #peticionForm .form-select{background:var(--surface-sunken)!important;color:var(--ink)!important;border-color:var(--line-strong)!important}
[data-theme="dark"] #peticionForm .form-select{background-image:var(--a2-select-bg)!important;background-repeat:no-repeat!important;background-position:right .75rem center!important;background-size:16px 12px!important}
[data-theme="dark"] #peticionForm .form-control::placeholder,[data-theme="dark"] #peticionForm .form-select::placeholder{color:var(--ink-muted)!important}
[data-theme="dark"] .a2-detail-grid>div+div{border-color:var(--line)}
[data-theme="dark"] .a2-detail-actions .btn-outline-primary{background:var(--surface-raised);color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-category{color:var(--ink)}

/* ---------- Modales de acceso y alta ---------- */
[data-theme="dark"] .a2-auth-modal .modal-content,[data-theme="dark"] .a2-form-panel .modal-content{background:linear-gradient(145deg,#1d2945,#141e33)!important;border:1px solid rgba(124,138,166,.22)!important;color:var(--ink);box-shadow:var(--shadow-3)!important}
[data-theme="dark"] .a2-auth-modal .modal-header,[data-theme="dark"] .a2-form-panel .modal-header{color:var(--ink)!important}
[data-theme="dark"] .a2-sheet-handle{background:var(--line-strong)}
[data-theme="dark"] .a2-field .form-control,[data-theme="dark"] .a2-field .form-select{background:var(--surface-sunken);color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-field .form-select{background-image:var(--a2-select-bg)!important;background-repeat:no-repeat!important;background-position:right .75rem center!important;background-size:16px 12px!important}
[data-theme="dark"] .a2-field .form-control::placeholder{color:var(--ink-muted)}
[data-theme="dark"] .a2-alta-modal .modal-content{background:var(--surface-raised)!important;border:1px solid var(--line)!important;color:var(--ink)}
[data-theme="dark"] .a2-alta-aside{background:var(--surface-sunken)}
[data-theme="dark"] .a2-photo-drop{border-color:var(--line-strong);color:var(--ink)}
[data-theme="dark"] .a2-photo-drop:hover,[data-theme="dark"] .a2-photo-drop:focus-within{background:var(--surface-sunken);border-color:var(--primary)}
[data-theme="dark"] .a2-alta-note{background:var(--brand-soft);color:var(--ink)}
[data-theme="dark"] .a2-auth-switch,[data-theme="dark"] .a2-lead,[data-theme="dark"] .a2-hint{color:var(--ink)}
[data-theme="dark"] .a2-staging-note{color:var(--warning);background:var(--warning-soft)}
[data-theme="dark"] .a2-forgot a{color:var(--link)}

/* ---------- Páginas 10-14 ---------- */
[data-theme="dark"] .a2-page-shell{background:var(--surface);color:var(--ink)}
[data-theme="dark"] .a2-page-inner,[data-theme="dark"] .a2-legal-content{color:var(--ink)}
[data-theme="dark"] .a2-info-card,[data-theme="dark"] .a2-how-card,[data-theme="dark"] .a2-advantage-grid article{background:var(--surface-sunken)}
[data-theme="dark"] .a2-accent-banner{background:var(--accent);color:var(--on-accent)}
[data-theme="dark"] .a2-accent-banner h2,[data-theme="dark"] .a2-accent-banner p{color:var(--on-accent)}
[data-theme="dark"] .a2-accent-banner .btn{background:var(--surface-sunken);color:var(--ink);border:1px solid rgba(10,16,32,.45)}
[data-theme="dark"] .a2-pill-link{color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-pill-link:hover{color:var(--primary);border-color:var(--primary)}
[data-theme="dark"] .a2-profile-side,[data-theme="dark"] .a2-legal-side{background:var(--surface-sunken)}
[data-theme="dark"] .a2-profile-nav button:hover{background:var(--brand-soft)}
[data-theme="dark"] .a2-profile-nav button.active{background:var(--brand-soft);color:var(--primary)}
[data-theme="dark"] .a2-profile-banner{background:var(--info-soft);color:var(--ink)}
[data-theme="dark"] .a2-request-list{background:var(--surface-sunken)}
[data-theme="dark"] .a2-request-list li{border-color:var(--line)}
[data-theme="dark"] .a2-legal-link{color:var(--ink)}
[data-theme="dark"] .a2-legal-link.active{background:var(--brand-soft);color:var(--primary)}
[data-theme="dark"] .a2-legal-back{color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-legal-banner{background:var(--warning-soft)}
[data-theme="dark"] .a2-legal-banner span{color:var(--ink-muted)}
[data-theme="dark"] .a2-center-shell{background:var(--surface)}
[data-theme="dark"] .a2-center-card{background:var(--surface-raised);color:var(--ink);border:1px solid var(--line)}
[data-theme="dark"] .a2-consent{background:var(--surface-raised);border-color:var(--line-strong);color:var(--ink);box-shadow:var(--shadow-3)}
[data-theme="dark"] .a2-consent h2,[data-theme="dark"] .a2-consent p{color:var(--ink)}
[data-theme="dark"] .a2-consent-actions .btn-outline-primary{background:transparent;color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-consent-dialog{background:var(--surface-raised);color:var(--ink);border:1px solid var(--line)}
[data-theme="dark"] .a2-consent-row{border-color:var(--line)}
[data-theme="dark"] .a2-consent-reopen{background:var(--surface-raised);border-color:var(--line-strong);color:var(--ink)}
[data-theme="dark"] .a2-footer-link{color:var(--ink)}

/* ---------- 15-18: administración, promociones y analítica ---------- */
[data-theme="dark"] .a2-admin-table-wrap{background:var(--surface-sunken);border:1px solid var(--line)}
[data-theme="dark"] .a2-admin-table th,[data-theme="dark"] .a2-admin-table td{border-color:var(--line)}
[data-theme="dark"] .a2-admin-table tbody tr:hover{background:rgba(143,178,255,.06)}
[data-theme="dark"] .a2-admin-table .a2-table-name{color:var(--ink)}
[data-theme="dark"] .a2-admin-filters button{background:var(--surface-raised);color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-admin-filters button.is-active{background:var(--brand-soft);border-color:var(--primary);color:var(--primary)}
[data-theme="dark"] .a2-admin-badge{background:var(--brand-soft);color:var(--primary)}
[data-theme="dark"] .a2-admin-note{background:var(--info-soft);color:var(--ink)}
[data-theme="dark"] .a2-kpi-card,[data-theme="dark"] .a2-analytics-card{background:var(--surface-sunken);border:1px solid var(--line)}
[data-theme="dark"] .a2-kpi-card span,[data-theme="dark"] .a2-kpi-card small,[data-theme="dark"] .a2-analytics-card h2{color:var(--ink)}
[data-theme="dark"] .a2-bar-row .a2-bar-track{background:rgba(143,178,255,.17)}
[data-theme="dark"] .a2-bar-row .a2-bar-fill{background:var(--primary)}
[data-theme="dark"] .a2-promo-card{background:var(--surface-sunken);border:1px solid var(--line)}
[data-theme="dark"] .a2-promo-card .a2-promo-icon{background:var(--surface-raised);color:var(--ink)}
[data-theme="dark"] .a2-promo-card .btn{background:transparent;color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-promo-card .btn:hover{background:var(--brand-soft);border-color:var(--primary)}
[data-theme="dark"] .a2-promo-modal .modal-content{background:var(--surface-raised);color:var(--ink);border:1px solid var(--line)}
[data-theme="dark"] .a2-qr-box{background:var(--surface-sunken)}
[data-theme="dark"] .a2-qr-image{background:#fff}
[data-theme="dark"] .a2-error-card{color:var(--ink)}
[data-theme="dark"] .a2-error-actions .btn-outline-primary{background:transparent;color:var(--ink);border-color:var(--line-strong)}
[data-theme="dark"] .a2-access-denied{color:var(--ink)}

/* ---------- Toques de sistema ---------- */
[data-theme="dark"] ::selection{background:var(--primary);color:var(--on-primary)}
[data-theme="dark"] *{scrollbar-color:var(--line-strong) var(--surface-sunken)}
@media (prefers-reduced-motion:reduce){
  .a2-theme-options button,.a2-theme-toggle{transition:none!important}
}
