* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #1a1a2e; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.header { background: linear-gradient(135deg, #0f0c29, #302b63); color: white; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.header h1 { font-size: 1.2rem; }
.header-right { display: flex; align-items: center; gap: 8px; }
.stats { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; }
.btn-salir { background: none; border: 1px solid rgba(255,255,255,0.4); color: white; padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; cursor: pointer; }
.filter-bar { background: #16213e; padding: 10px 16px; display: flex; gap: 10px; border-bottom: 1px solid #0f3460; flex-shrink: 0; }
.filter-bar select { flex: 1; min-width: 0; padding: 8px 12px; background: #0f3460; border: none; border-radius: 8px; color: white; font-size: 14px; }
.sync-badge { background: #e94560; padding: 4px 10px; border-radius: 20px; font-size: 10px; white-space: nowrap; cursor: pointer; color: white; display: flex; align-items: center; }
.pendientes-envio { background: #ffc107; color: #222; border: none; padding: 6px 16px; font-size: 13px; font-weight: bold; text-align: left; white-space: pre-line; cursor: pointer; flex-shrink: 0; }
.pendientes-envio[hidden] { display: none; }
.view { display: none; flex: 1; overflow-y: auto; }
.view.active { display: flex; flex-direction: column; }
.map-container { flex: 1; position: relative; }
#map { height: 100%; width: 100%; background: #0a0a1a; }
.map-controls { position: absolute; bottom: 80px; right: 10px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.map-btn { width: 44px; height: 44px; border-radius: 10px; background: #16213e; border: none; color: white; font-size: 20px; cursor: pointer; }
.map-btn-fila { position: relative; }
.gps-precision { position: absolute; right: 52px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 3px 7px; border-radius: 8px; font-size: 12px; font-weight: bold; background: rgba(0,0,0,0.8); pointer-events: none; }
.gps-precision[hidden] { display: none; }
.gps-precision.buena { color: #4CAF50; }
.gps-precision.media { color: #FFC107; }
.gps-precision.mala { color: #f44336; }
.legend { position: absolute; bottom: 80px; left: 10px; z-index: 1000; background: rgba(0,0,0,0.8); border-radius: 10px; padding: 8px 12px; font-size: 10px; color: white; }
.legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.legend-color { width: 12px; height: 12px; border-radius: 50%; }
.bottom-nav { display: flex; background: #16213e; border-top: 1px solid #0f3460; padding: 8px 0; flex-shrink: 0; }
.nav-btn { flex: 1; text-align: center; padding: 10px; background: none; border: none; color: #aaa; font-size: 12px; cursor: pointer; }
.nav-btn.active { color: #e94560; border-top: 2px solid #e94560; }
.nav-btn span { font-size: 20px; display: block; margin-bottom: 4px; }

.form-container { padding: 16px; padding-bottom: 80px; }
.form-section { background: #1e1e2e; border-radius: 12px; padding: 16px; margin-bottom: 16px; border: 1px solid #333; }
.form-section h3 { color: #e94560; font-size: 14px; margin-bottom: 12px; border-left: 3px solid #e94560; padding-left: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 11px; color: #aaa; margin-bottom: 4px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #333; background: #2a2a3a; color: white; font-size: 14px; }
.btn-primary { width: 100%; padding: 14px; background: linear-gradient(135deg, #e94560, #c2185b); border: none; border-radius: 10px; color: white; font-weight: bold; font-size: 16px; cursor: pointer; margin-top: 8px; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary { width: 100%; padding: 12px; background: #444; border: none; border-radius: 10px; color: white; cursor: pointer; }
.btn-gps { background: #28a745; margin-bottom: 8px; }
.aviso-fotos { background: rgba(255,193,7,0.15); border: 1px solid #ffc107; color: #ffc107; border-radius: 10px; padding: 10px; margin-top: 8px; font-weight: bold; }
.aviso-fotos button { margin-top: 8px; background: #ffc107; color: #222; font-weight: bold; }

.codigo-buscar { display: flex; gap: 8px; margin-bottom: 12px; }
.codigo-buscar input { flex: 1; }
.codigo-buscar button { width: auto; padding: 10px 20px; margin: 0; }

.lista-vacia { text-align: center; padding: 40px; color: #aaa; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-item { width: 70px; height: 70px; background: #2a2a3a; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; border: 1px solid #444; overflow: hidden; color: white; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .delete { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.7); border: none; color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; cursor: pointer; }
.photo-item.add { font-size: 24px; }

.selected-materials { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: #aaa; }
.material-tag { background: #e94560; color: white; padding: 4px 10px; border-radius: 15px; font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.material-tag button { background: none; border: none; color: white; cursor: pointer; }

.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.9); color: white; padding: 8px 16px; border-radius: 30px; font-size: 12px; z-index: 3000; display: none; }
.loading { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.9); color: white; padding: 15px 25px; border-radius: 10px; z-index: 4000; display: none; }

.debug-panel { background: #0a0a1a; color: #0f0; font-family: monospace; font-size: 10px; padding: 5px; border-top: 1px solid #333; max-height: 80px; overflow-y: auto; flex-shrink: 0; }

/* login.html */
body.login { align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.login-card { width: 100%; max-width: 360px; background: #1e1e2e; border: 1px solid #333; border-radius: 12px; padding: 24px; }
.login-card h1 { color: white; font-size: 1.3rem; margin-bottom: 4px; }
.login-card p { color: #aaa; font-size: 12px; margin-bottom: 20px; }
.login-error { color: #ff6b81; font-size: 12px; min-height: 16px; margin-bottom: 4px; }

/* pie con la versión instalada (js/version.js) */
.version-pie { color: #777; font-size: 10px; text-align: center; padding: 2px 8px; flex-shrink: 0; background: #0a0a1a; }
.login-card .version-pie { background: none; margin-top: 14px; padding: 0; }

/* el atributo hidden manda aunque la clase fije display */
[hidden] { display: none !important; }

/* vanos en la leyenda */
.legend-line { width: 12px; height: 3px; border-radius: 2px; }
/* estructura con AP: círculo con borde amarillo (COLOR_AP en app.js) */
.legend-ap { border: 2px solid #FFEB3B; box-sizing: border-box; }
.legend-triangulo { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid white; }

/* selector de capa MT | BT */
.capa-selector { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; background: #16213e; border-radius: 20px; padding: 3px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.capa-btn { min-width: 56px; padding: 8px 14px; border: none; border-radius: 17px; background: none; color: #aaa; font-weight: bold; font-size: 14px; cursor: pointer; }
.capa-btn[data-capa="mt"][aria-pressed="true"] { background: #ff7043; color: white; }
.capa-btn[data-capa="bt"][aria-pressed="true"] { background: #29b6f6; color: white; }

/* subestación: triángulo (divIcon de Leaflet sin el fondo blanco por defecto) */
.icono-sed { background: none; border: none; }
.icono-sed svg { display: block; filter: drop-shadow(0 0 1px rgba(0,0,0,0.8)); }
/* localidad de la SED (UBICACÍON): tooltip permanente, oculto con zoom < 15 (ver mostrarEtiquetasSedSegunZoom) */
.etiqueta-sed { padding: 1px 5px; font-size: 11px; font-weight: bold; }
.sin-etiquetas-sed .etiqueta-sed { display: none; }

/* sección admin: actualizar KMZ */
.btn-admin { border: none; background: #1a73e8; }
.admin-nota { color: #aaa; font-size: 12px; margin-bottom: 12px; line-height: 1.4; }
.form-group input[type="file"] { padding: 8px; }
.kmz-resumen { width: 100%; border-collapse: collapse; color: white; font-size: 13px; margin: 8px 0; }
.kmz-resumen th, .kmz-resumen td { padding: 6px 8px; border-bottom: 1px solid #333; text-align: right; }
.kmz-resumen th:first-child, .kmz-resumen td:first-child { text-align: left; color: #aaa; }
.kmz-detalle { color: #ccc; font-size: 12px; line-height: 1.5; white-space: pre-line; }
.kmz-error { color: #ff6b81; }
/* historial de importaciones: fila que abre el detalle; BAJA con inspecciones activas en rojo */
.kmz-fila { cursor: pointer; }
.kmz-fila:hover td { background: #2a2a3a; }
.kmz-resumen tr.kmz-error td { color: #ff6b81; font-weight: bold; }
/* importación reemplazada (mismo archivo aplicado de nuevo): atenuada */
.kmz-reemplazada td { opacity: 0.55; }
@media (max-width: 420px) {
    .kmz-resumen { font-size: 12px; }
    .kmz-resumen th, .kmz-resumen td { padding: 6px 4px; }
}
