body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

h1 {
    text-align: center;
    color: #333;
    margin: 10px 0;
    font-size: 22px;
}

#mapa {
    flex: 1;
    width: 100%;
    background-color: white;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
}/* ============================================================
   ESTILOS DEL EDITOR
   ============================================================ */

body.modo-editor {
    height: 100vh;
    overflow: hidden;
}

body.modo-editor header {
    text-align: center;
    padding: 8px;
    background-color: #2c3e50;
    color: white;
}

body.modo-editor header h1 {
    margin: 0;
    font-size: 20px;
    color: white;
}

body.modo-editor .subtitulo {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.8;
}

#contenedor-editor {
    display: flex;
    height: calc(100vh - 60px);
}

#panel-controles {
    width: 280px;
    background-color: #ecf0f1;
    padding: 15px;
    overflow-y: auto;
    border-right: 2px solid #333;
}

#panel-controles .seccion {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #bdc3c7;
}

#panel-controles h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 15px;
}

#panel-controles button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: none;
    border-radius: 4px;
    background-color: #95a5a6;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

#panel-controles button:hover {
    background-color: #7f8c8d;
}

#panel-controles button.primario {
    background-color: #27ae60;
}

#panel-controles button.primario:hover {
    background-color: #229954;
}

#panel-controles button.exportar {
    background-color: #2980b9;
    font-weight: bold;
}

#panel-controles button.exportar:hover {
    background-color: #21618c;
}

#lista-manzanas {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

#lista-manzanas li {
    padding: 6px 8px;
    margin: 3px 0;
    background-color: white;
    border-radius: 3px;
    font-size: 13px;
    border-left: 3px solid #27ae60;
}

body.modo-editor #mapa {
    flex: 1;
    height: 100%;
    border: none;
}

/* Modal de exportación */
.modal-oculto {
    display: none;
}

#modal-exportar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#modal-exportar:not(.modal-oculto) {
    display: flex;
}

.modal-contenido {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 80%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-contenido h2 {
    margin-top: 0;
}

#texto-exportado {
    width: 100%;
    height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
}

.modal-contenido button {
    padding: 10px 20px;
    margin-top: 10px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
    background-color: #2980b9;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.modal-contenido button:hover {
    background-color: #21618c;
}/* === Botones nuevos del editor === */

#panel-controles button.secundario {
    background-color: #16a085;
}
#panel-controles button.secundario:hover {
    background-color: #117a65;
}

#panel-controles button.peligro {
    background-color: #c0392b;
}
#panel-controles button.peligro:hover {
    background-color: #922b21;
}

#panel-controles .link-ver {
    display: block;
    text-align: center;
    padding: 10px;
    background-color: #34495e;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}
#panel-controles .link-ver:hover {
    background-color: #2c3e50;
}

#lista-manzanas li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#lista-manzanas li button {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 16px;
    width: auto;
    padding: 0 4px;
    margin: 0;
}

#lista-manzanas li button:hover {
    background: none;
    color: #922b21;
}/* === Indicador de modo activo === */

#indicador-modo {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}

#indicador-modo.modo-normal {
    background-color: #d5dbdb;
    color: #2c3e50;
}

#indicador-modo.modo-rehacer {
    background-color: #f39c12;
    color: white;
    animation: pulso 2s ease-in-out infinite;
}

@keyframes pulso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(243, 156, 18, 0); }
}

#indicador-modo button {
    display: inline-block;
    width: auto;
    margin: 6px 0 0 0;
    padding: 4px 12px;
    font-size: 12px;
    background-color: rgba(0, 0, 0, 0.3);
}

#panel-controles button.peligro-suave {
    background-color: #e67e22;
}
#panel-controles button.peligro-suave:hover {
    background-color: #ca6f1e;
}/* === Modal de edición de manzana === */

#modal-editar-manzana .modal-contenido {
    max-width: 450px;
}

#modal-editar-manzana label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

#modal-editar-manzana input[type="date"],
#modal-editar-manzana textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

#modal-editar-manzana textarea {
    resize: vertical;
}

.modal-botones {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-botones button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background-color: #95a5a6;
    color: white;
}

.modal-botones button:hover {
    background-color: #7f8c8d;
}

.modal-botones button.primario {
    background-color: #27ae60;
}

.modal-botones button.primario:hover {
    background-color: #229954;
}/* === Mostrar el modal de editar manzana cuando NO está oculto === */

#modal-editar-manzana {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#modal-editar-manzana.modal-oculto {
    display: none;
}

#modal-editar-manzana:not(.modal-oculto) {
    display: flex;
}
/* === Modal de editar territorio === */

#modal-editar-territorio {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#modal-editar-territorio.modal-oculto {
    display: none;
}

#modal-editar-territorio:not(.modal-oculto) {
    display: flex;
}

#modal-editar-territorio .modal-contenido {
    max-width: 450px;
}

#modal-editar-territorio label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

#modal-editar-territorio input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}
/* === Vista visor (index.html) === */

body.modo-visor {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#header-principal {
    background-color: #2c3e50;
    color: white;
    padding: 12px;
    text-align: center;
}

#header-principal h1 {
    margin: 0;
    color: white;
    font-size: 22px;
}

#contenedor-visor {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#contenedor-visor #mapa {
    flex: 1;
    height: 100%;
    background-color: white;
    border: none;
}

/* Panel lateral en vista individual */
#panel-info-territorio {
    width: 300px;
    background-color: #ecf0f1;
    padding: 20px;
    overflow-y: auto;
    border-right: 2px solid #34495e;
}

#panel-info-territorio h2 {
    margin-top: 0;
    color: #2c3e50;
}

#panel-info-territorio h3 {
    color: #2c3e50;
    margin-bottom: 8px;
}

#panel-info-territorio ul {
    list-style: none;
    padding: 0;
}

#panel-info-territorio li {
    padding: 10px;
    margin-bottom: 8px;
    background-color: white;
    border-radius: 4px;
    border-left: 4px solid #27ae60;
    font-size: 14px;
}

#panel-info-territorio li.reciente {
    border-left-color: #c0392b;
}

#panel-info-territorio li.media {
    border-left-color: #e67e22;
}

#panel-info-territorio li .fecha {
    color: #7f8c8d;
    font-size: 12px;
}

#panel-info-territorio .link-volver {
    display: block;
    text-align: center;
    padding: 10px;
    background-color: #34495e;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 10px;
}

#panel-info-territorio .link-volver:hover {
    background-color: #2c3e50;
}

/* Cuando está en vista individual, ocultar bordes del header */
body.vista-individual #header-principal {
    background-color: #16a085;
}
/* ============================================================
   PANTALLA DE LOGIN
   ============================================================ */

body.modo-login {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
}

.contenedor-login {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
}

.contenedor-login h1 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 24px;
    text-align: center;
}

.subtitulo-login {
    text-align: center;
    color: #7f8c8d;
    margin: 0 0 25px 0;
    font-size: 14px;
}

#form-login label {
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
    color: #2c3e50;
    font-weight: bold;
    font-size: 14px;
}

#form-login input {
    width: 100%;
    padding: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

#form-login input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.2);
}

#btn-login {
    width: 100%;
    padding: 14px;
    margin-top: 25px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

#btn-login:hover {
    background-color: #229954;
}

#btn-login:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.mensaje-error {
    margin-top: 20px;
    padding: 12px;
    background-color: #fadbd8;
    color: #c0392b;
    border-radius: 5px;
    border-left: 4px solid #c0392b;
    font-size: 14px;
}

.mensaje-cargando {
    margin-top: 20px;
    padding: 12px;
    background-color: #d6eaf8;
    color: #2874a6;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
}
/* === Botón de cerrar sesión === */

.btn-logout {
    position: absolute;
    top: 10px;
    right: 15px;
    padding: 6px 14px;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

#header-principal, body.modo-editor header {
    position: relative;
}/* === Cursor del mapa === */
.leaflet-container {
    cursor: default !important;
}

.leaflet-grab {
    cursor: default !important;
}

.leaflet-dragging .leaflet-grab {
    cursor: grabbing !important;
}/* === Número de territorio en el mapa === */
.numero-territorio {
    background: transparent !important;
    border: none !important;
}

.numero-territorio div {
    font-size: 42px;
    font-weight: 900;
    color: white;
    text-shadow: 
        -2px -2px 0 #1a5c35,
         2px -2px 0 #1a5c35,
        -2px  2px 0 #1a5c35,
         2px  2px 0 #1a5c35,
         0px  3px 8px rgba(0,0,0,0.6);
    text-align: center;
    line-height: 60px;
    pointer-events: none;
    user-select: none;
}/* === Panel lateral en celular (vista individual ?t=N) === */
@media (max-width: 768px) {
    #contenedor-visor {
        flex-direction: column;
    }

    #panel-info-territorio {
        width: 100%;
        max-height: 35vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 2px solid #34495e;
        box-sizing: border-box;
        padding: 12px;
    }

    #panel-info-territorio h2 {
        font-size: 16px;
        margin-bottom: 4px;
    }

    #panel-info-territorio h3 {
        font-size: 14px;
        margin: 6px 0 4px 0;
    }

    #panel-info-territorio li {
        padding: 6px 8px;
        font-size: 13px;
    }

    #contenedor-visor #mapa {
        flex: 1;
        min-height: 0;
    }
}/* ============================================================
   RESPONSIVE MÓVIL — popups y controles de Leaflet
   ============================================================ */
@media (max-width: 768px) {

    /* Popup más grande y legible */
    .leaflet-popup-content-wrapper {
        font-size: 15px;
        min-width: 220px;
        border-radius: 8px;
    }

    .leaflet-popup-content {
        margin: 14px 16px;
        line-height: 1.5;
    }

    /* Botones dentro del popup más fáciles de tocar */
    .leaflet-popup-content button {
        padding: 10px 14px !important;
        font-size: 14px !important;
        margin: 4px 2px !important;
        border-radius: 5px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* Controles de zoom más grandes */
    .leaflet-control-zoom a {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        font-size: 20px !important;
    }

    /* Número de territorio más legible en zoom bajo */
    .numero-territorio div {
        font-size: 32px;
    }

    /* Header más compacto */
    #header-principal h1,
    body.modo-editor header h1 {
        font-size: 16px;
    }

    .btn-logout {
        font-size: 11px;
        padding: 4px 10px;
        top: 8px;
        right: 8px;
    }
}
/* ============================================================
   GESTIÓN DE HERMANOS
   ============================================================ */

body.modo-gestionar {
    background-color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.modo-gestionar #header-principal {
    background-color: #2c3e50;
    color: white;
    padding: 12px;
    text-align: center;
    position: relative;
}

body.modo-gestionar #header-principal h1 {
    margin: 0;
    color: white;
    font-size: 22px;
}

#contenedor-gestionar {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

#barra-acciones {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#filtros {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#filtros select {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.label-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #2c3e50;
}

.grupo-seccion {
    margin-bottom: 30px;
}

.grupo-titulo {
    color: #2c3e50;
    font-size: 16px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.grupo-count {
    font-size: 13px;
    font-weight: normal;
    color: #7f8c8d;
}

.tabla-hermanos {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.tabla-hermanos th {
    background-color: #34495e;
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
}

.tabla-hermanos td {
    padding: 9px 12px;
    font-size: 14px;
    border-bottom: 1px solid #ecf0f1;
    color: #2c3e50;
}

.tabla-hermanos tr:last-child td {
    border-bottom: none;
}

.tabla-hermanos tr:hover td {
    background-color: #f8f9fa;
}

.celda-check {
    text-align: center;
    color: #27ae60;
    font-weight: bold;
}

.hermano-inactivo td {
    opacity: 0.5;
}

.badge-sup {
    background-color: #e67e22;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    vertical-align: middle;
    margin-left: 4px;
}

.badge-activo {
    background-color: #d5f5e3;
    color: #1e8449;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.badge-inactivo {
    background-color: #fadbd8;
    color: #922b21;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.btn-editar-hermano {
    background: none;
    border: 1px solid #2980b9;
    color: #2980b9;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-editar-hermano:hover {
    background-color: #2980b9;
    color: white;
}

.cargando {
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Modal hermano */
#modal-hermano {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#modal-hermano.modal-oculto { display: none; }
#modal-hermano:not(.modal-oculto) { display: flex; }

#modal-hermano .modal-contenido {
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

#modal-hermano label {
    display: block;
    margin-top: 14px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

#modal-hermano input[type="text"],
#modal-hermano select,
#modal-hermano textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.checks-fila {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Botón primario genérico */
button.primario {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

button.primario:hover {
    background-color: #229954;
}

@media (max-width: 768px) {
    .tabla-hermanos th:nth-child(2),
    .tabla-hermanos td:nth-child(2) {
        display: none;
    }

    #barra-acciones {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   PREDICACIÓN TELEFÓNICA
   ============================================================ */

body.modo-telefonos {
    background-color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.modo-telefonos #header-principal {
    background-color: #2c3e50;
    color: white;
    padding: 12px;
    text-align: center;
    position: relative;
}

body.modo-telefonos #header-principal h1 {
    margin: 0;
    color: white;
    font-size: 22px;
}

#contenedor-telefonos {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 52px);
}

/* Panel calles */
#panel-calles {
    width: 220px;
    background: #ecf0f1;
    border-right: 2px solid #bdc3c7;
    padding: 15px;
    overflow-y: auto;
    flex-shrink: 0;
}

#panel-calles h3 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 15px;
}

#lista-calles {
    margin-bottom: 15px;
}

.item-calle {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 3px;
    border-left: none !important;
}

.item-calle:hover {
    filter: brightness(0.92);
}

.item-calle.activa {
    outline: 2px solid #2980b9;
    color: white;
    font-weight: bold;
}

/* Panel principal */
#panel-numeros {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#header-numeros {
    padding: 15px 20px 10px;
    background: white;
    border-bottom: 1px solid #ecf0f1;
}

#header-numeros h2 {
    margin: 0 0 6px 0;
    color: #2c3e50;
    font-size: 20px;
}

#resumen-calle {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.resumen-item { color: #7f8c8d; }
.pendiente-badge { color: #2980b9; font-weight: bold; }
.nollamar-badge { color: #c0392b; font-weight: bold; }

#filtros-telefonos {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    gap: 15px;
    align-items: center;
}

#filtros-telefonos select {
    padding: 6px 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

#lista-numeros {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

/* Fila de teléfono */
.fila-telefono {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    gap: 10px;
}

.fila-telefono.eliminado {
    opacity: 0.4;
}

.tel-info {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.tel-altura {
    font-size: 12px;
    color: #7f8c8d;
}

.tel-numero {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    font-family: monospace;
}

.tel-notas {
    font-size: 12px;
    color: #e67e22;
    font-style: italic;
}

.tel-estado {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.badge-estado {
    display: inline-block;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    width: fit-content;
}

.tel-fecha {
    font-size: 12px;
    color: #7f8c8d;
}

.tel-obs {
    font-size: 12px;
    color: #8e44ad;
    font-style: italic;
}

.tel-acciones {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    flex-shrink: 0;
}

.btn-llamar {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.btn-llamar:hover { background-color: #229954; }

.btn-historial-tel {
    background: none;
    border: 1px solid #bdc3c7;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-historial-tel:hover { background-color: #ecf0f1; }

/* Modal llamada */
#modal-llamada, #modal-historial-tel, #modal-importar {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#modal-llamada.modal-oculto,
#modal-historial-tel.modal-oculto,
#modal-importar.modal-oculto { display: none; }

#modal-llamada:not(.modal-oculto),
#modal-historial-tel:not(.modal-oculto),
#modal-importar:not(.modal-oculto) { display: flex; }

#modal-llamada .modal-contenido,
#modal-historial-tel .modal-contenido,
#modal-importar .modal-contenido {
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

#modal-llamada label,
#modal-historial-tel label {
    display: block;
    margin-top: 14px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

#modal-llamada input[type="text"],
#modal-llamada textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

#btns-resultado {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.btn-resultado {
    padding: 8px 14px;
    border: 2px solid #bdc3c7;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
}

.btn-resultado:hover { border-color: #2980b9; }

.btn-resultado.seleccionado {
    background-color: #2980b9;
    border-color: #2980b9;
    color: white;
    font-weight: bold;
}

#importar-log p {
    margin: 4px 0;
    font-size: 14px;
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    #contenedor-telefonos { flex-direction: column; height: auto; }

    #panel-calles {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid #bdc3c7;
        max-height: 200px;
    }

    #lista-calles {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .item-calle {
        padding: 6px 12px;
        border: 1px solid #bdc3c7;
        border-radius: 20px;
    }

    .fila-telefono { flex-wrap: wrap; }
}

/* === Items de calle con color y metadata === */
.item-calle {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calle-nombre {
    font-size: 13px;
    font-weight: bold;
    color: #2c3e50;
}

.item-calle.activa .calle-nombre {
    color: white;
}

.calle-meta {
    font-size: 11px;
    color: #7f8c8d;
}

.item-calle.activa .calle-meta {
    color: rgba(255,255,255,0.8);
}

/* === Popup de Leaflet rediseñado === */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18) !important;
}

.leaflet-popup-content {
    margin: 14px 20px 16px 20px !important;
}

.leaflet-popup-tip {
    background: #0d3d21 !important;
}

/* === Leyenda de colores del mapa === */
#leyenda-colores {
    position: fixed;
    bottom: 30px;
    right: 16px;
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 12px;
    color: #333;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.08);
}

.leyenda-titulo {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #0d3d21;
    margin-bottom: 8px;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.leyenda-item:last-child {
    margin-bottom: 0;
}

.leyenda-punto {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    #leyenda-colores {
        bottom: 16px;
        right: 8px;
        font-size: 11px;
        padding: 8px 10px;
    }
    .leyenda-punto {
        width: 12px;
        height: 12px;
    }
}
