

    :root {
    --header-height: 70px;
    /* Altura real del header en desktop:
       padding 10px + logo 90px + padding 10px + border-bottom 3px = 113px.
       Se usa 115px (2px de margen de seguridad) para que el mapa
       empiece siempre 1px por debajo del borde inferior de la cabecera. */
    --effective-header-height: 115px;
    }

    /* Reset */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    /* Base styles */
    body, html {
        width: 100%;
        height: 100%;
        overflow: hidden;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    /* Mapa: reglas canónicas al final de este archivo (matriz responsive). */

    

        /* ════════════════════════════════════════════════════════════════════════
           🌪️ ERA5 Wind Tooltip (Professional)
           - Styled to match dashboard palette (teal + cyan)
           - No extra UI elements; only improves readability
        ════════════════════════════════════════════════════════════════════════ */
        .leaflet-tooltip.era5-hover-tooltip {
            background: rgba(10, 30, 59, 0.92);
            color: #ffffff;
            border: 1px solid rgba(0, 212, 255, 0.55);
            border-radius: 10px;
            padding: 10px 12px;
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
            max-width: 320px;
        }

        .leaflet-tooltip.era5-hover-tooltip::before {
            border-top-color: rgba(0, 212, 255, 0.55);
        }

        .era5-tt-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            font-weight: 800;
            font-size: 12px;
            letter-spacing: 0.7px;
            text-transform: uppercase;
            margin-bottom: 8px;
        }

        .era5-tt-title .era5-tt-name {
            color: #ffffff;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 220px;
        }

        .era5-zone {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 700;
            border: 1px solid rgba(255, 255, 255, 0.20);
            background: rgba(255, 255, 255, 0.08);
        }

        .era5-zone--moderate {
            border-color: rgba(0, 212, 255, 0.55);
            background: rgba(0, 212, 255, 0.14);
        }

        .era5-zone--strong {
            border-color: rgba(255, 215, 0, 0.65);
            background: rgba(255, 215, 0, 0.14);
        }

        .era5-zone--very_strong {
            border-color: rgba(255, 68, 68, 0.75);
            background: rgba(255, 68, 68, 0.14);
        }

        .era5-zone--outside {
            border-color: rgba(255, 255, 255, 0.22);
            background: rgba(255, 255, 255, 0.08);
        }

        .era5-tt-grid {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 6px 12px;
            font-size: 12px;
            line-height: 1.25;
        }

        .era5-tt-label {
            color: rgba(255, 255, 255, 0.78);
            font-weight: 600;
        }

        .era5-tt-value {
            color: #ffffff;
            font-weight: 700;
            font-family: 'Courier New', monospace;
            text-align: right;
        }

        .era5-tt-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.12);
            margin: 8px 0;
        }

        .era5-tt-foot {
            font-size: 10px;
            color: rgba(255, 255, 255, 0.65);
            margin-top: 6px;
        }
        
        /* Main Header - Fixed top with gradient background */
        .main-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: linear-gradient(135deg, #1a4d4d 0%, #2d6666 50%, #1a4d4d 100%);
            border-bottom: 3px solid #00d4ff;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            z-index: 10000;
            padding: 10px 30px;
            backdrop-filter: blur(10px);
        }
        
        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            max-width: 100%;
        }
        
        .header-left {
            display: flex;
            align-items: center;
            gap: 25px;
        }
        
                .header-logo {
            width: 90px;
            height: 90px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.1);
            border: 2px solid rgba(255, 255, 255, 0.2);
            position: relative;
            flex-shrink: 0;
        }
        
        .header-logo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            position: relative;
            z-index: 1;
        }
        
        @keyframes logo-glow {
            0%, 100% {
                box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
                transform: scale(1);
            }
            50% {
                box-shadow: 0 6px 25px rgba(0, 212, 255, 0.7);
                transform: scale(1.05);
            }
        }
        
        .header-logo svg {
            width: 32px;
            height: 32px;
            fill: white;
        }
        
        /* Header titles - Title and subtitle layout */
        .header-titles {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }
        
        .header-title {
            color: #ffffff;
            font-size: 32px;
            font-weight: 700;
            letter-spacing: 1.5px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
            margin: 0;
            line-height: 1.2;
        }
        
        /* Header subtitle - Red alert-style text */
        .header-subtitle {
            color: #ff4444;
            font-size: 16px;
            font-weight: 400;
            letter-spacing: 0.8px;
            margin: 0;
            opacity: 0.95;
        }
        
        /* Header right section - Status, clock, navigation */
        .header-right {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        /* Wrapper btn Admin + reloj: columna en desktop/portrait, fila en landscape smartphone */
        .header-actions {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 5px;
        }

        /* Header responsive (smartphone/tablet) */
        @media screen and (max-width: 768px) {
            .main-header {
                padding: 5px 10px;
            }

            .header-content {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
            }

            .header-left {
                gap: 8px;
                flex: 1;
                min-width: 0;
            }

            .header-logo {
                display: none;
            }

            .header-title {
                font-size: 14px;
                letter-spacing: 0.3px;
                line-height: 1.05;
            }

            .header-subtitle {
                display: none;
            }

            .header-right {
                gap: 6px;
                width: auto;
                flex-direction: row;
            }

            .status-indicator {
                padding: 3px 6px;
            }

            .status-text {
                font-size: 9px;
            }

            /* SMARTPHONE (base <=768): botones misma altura, misma línea */
            .header-buttons {
                flex-direction: row;
                flex-wrap: nowrap;
                align-items: center;
                gap: 4px;
            }

            #registro-btn,
            #autoregistro-btn {
                height: 24px;
                min-height: 24px;
                max-height: 24px;
                padding: 3px 6px;
                font-size: 10px;
                box-sizing: border-box;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            #registro-btn {
                width: 88px;
                min-width: 88px;
                max-width: 88px;
            }

            #autoregistro-btn {
                width: auto;
                min-width: 0;
                max-width: fit-content;
            }

            .header-clock {
                width: 78px;
                min-width: 78px;
                max-width: 78px;
                height: 24px;
                min-height: 24px;
                max-height: 24px;
                padding: 3px 6px;
                font-size: 10px;
                box-sizing: border-box;
                display: flex;
                align-items: center;
                justify-content: center;
            }
        }

        @media screen and (max-width: 768px) and (orientation: portrait) {
            .header-logo {
                display: flex;
                width: 30px;
                height: 30px;
                border-width: 1px;
            }

            .header-left {
                gap: 6px;
            }

            /* En vertical: UTC más compacto y botón Administrador más destacado */
            .header-clock {
                width: 60px;
                min-width: 60px;
                max-width: 60px;
                height: 22px;
                min-height: 22px;
                max-height: 22px;
                font-size: 9px;
                padding: 2px 4px;
            }

            /* SMARTPHONE VERTICAL: botones misma altura, misma línea */
            .header-buttons {
                flex-direction: row;
                flex-wrap: nowrap;
                gap: 4px;
            }

            #registro-btn,
            #autoregistro-btn {
                width: 88px;
                min-width: 88px;
                max-width: 88px;
                height: 26px;
                min-height: 26px;
                max-height: 26px;
                font-size: 10px;
                padding: 3px 6px;
                box-sizing: border-box;
                overflow: hidden;
                white-space: nowrap;
            }
        }

        @media screen and (max-width: 768px) and (orientation: landscape) {
            .main-header {
                padding: 4px 10px;
            }

            .header-logo {
                display: none;
            }

            .header-title {
                font-size: 12px;
            }

            .status-indicator {
                padding: 2px 5px;
            }

            .status-text {
                font-size: 8px;
            }

            .header-clock {
                width: auto;
                min-width: 0;
                max-width: fit-content;
                height: 22px;
                font-size: 9px;
                padding: 2px 5px;
            }

            /* SMARTPHONE HORIZONTAL: botones y reloj ajustan ancho al texto */
            .header-buttons {
                flex-direction: row;
                flex-wrap: nowrap;
                gap: 4px;
            }

            #registro-btn,
            #autoregistro-btn {
                width: auto;
                min-width: 0;
                max-width: fit-content;
                height: 22px;
                font-size: 9px;
                padding: 2px 6px;
                box-sizing: border-box;
            }

            /* Landscape: btn + reloj en fila → header ~30px en vez de ~57px (+27px de mapa) */
            .header-actions {
                flex-direction: row !important;
                align-items: center !important;
                gap: 6px !important;
            }
        }
        
        /* Status indicator - "EN DESARROLLO" with pulsing dot */
        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(0, 0, 0, 0.3);
            padding: 8px 15px;
            border-radius: 8px;
            border: 1px solid rgba(0, 212, 255, 0.3);
        }
        
        .status-dot-live {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #00ff88;
            box-shadow: 0 0 10px #00ff88;
            animation: pulse-live 2s ease-in-out infinite;
        }
        
        @keyframes pulse-live {
            0%, 100% {
                opacity: 1;
                transform: scale(1);
            }
            50% {
                opacity: 0.6;
                transform: scale(1.2);
            }
        }
        
        /* Animación pulse para marcadores de búsqueda */
        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
                opacity: 1;
            }
            50% {
                transform: scale(1.15);
                opacity: 0.8;
            }
        }
        
        /* Animación para spinner de búsqueda - MÁS VISIBLE */
        @keyframes spin-search {
            0% {
                transform: rotate(0deg) scale(1);
                opacity: 1;
            }
            25% {
                transform: rotate(90deg) scale(1.2);
                opacity: 0.9;
            }
            50% {
                transform: rotate(180deg) scale(1.3);
                opacity: 0.8;
            }
            75% {
                transform: rotate(270deg) scale(1.2);
                opacity: 0.9;
            }
            100% {
                transform: rotate(360deg) scale(1);
                opacity: 1;
            }
        }
        
        /* Animación de pulso para botón de búsqueda */
        @keyframes pulse-search {
            0%, 100% {
                transform: scale(1);
                box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
            }
            50% {
                transform: scale(1.05);
                box-shadow: 0 0 20px 5px rgba(0, 212, 255, 0.4);
            }
        }
        
        /* Estilo para el spinner de búsqueda */
        .search-spinner {
            display: inline-block;
            font-size: 1.4em;
            animation: spin-search 1s linear infinite;
        }
        
        .status-text {
            color: #00ff88;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 0.5px;
        }
        
        /* UTC Clock - Monospace digital display */
        .header-clock {
            color: #000000;
            font-size: 14px;
            font-weight: 400;
            font-family: 'Courier New', monospace;
            background: rgba(255, 255, 255, 0.95);
            padding: 8px 15px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            min-width: 160px;
            text-align: center;
        }
        
        .header-clock #current-time {
            color: #ff0000 !important;
            font-weight: 700;
        }
        
        /* Header navigation buttons */
        .header-navigation {
            display: flex;
            align-items: center;
            margin-right: 15px;
        }
        
        .nav-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 15px;
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            color: #0a1e3b;
            text-decoration: none;
            border-radius: 8px;
            font-weight: 600;
            font-size: 14px;
            transition: all 0.3s ease;
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
        }
        
        .nav-btn:hover {
            background: linear-gradient(135deg, #00a8cc 0%, #0066aa 100%);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 212, 255, 0.5);
            text-decoration: none;
            color: white;
        }
        
        /* Ambos botones de acción en la misma fila */
        .header-buttons {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 6px;
        }

        /* Botón Autoregistro - Mismo tamaño que Administrador, fondo blanco */
        #autoregistro-btn {
            min-width: 160px;
            justify-content: center;
            background: #ffffff;
            color: #0a1e3b;
            border: 1px solid rgba(0, 153, 204, 0.5);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        }

        #autoregistro-btn:hover {
            background: #e8f7fc;
            color: #0a1e3b;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }

        /* Botón Autoregistro - Mismo ancho que reloj UTC (160px) */
        #registro-btn {
            min-width: 160px;
            justify-content: center;
        }
        
        /* Map container: ver matriz responsive canónica al final del archivo. */
        
        /* Vessel selector - Top left panel with expand/collapse */
        .vessel-selector {
            position: fixed;
            top: calc(var(--effective-header-height) + 15px);
            left: var(--ui-sidebar-left);   /* Sprint 2: token de layout-tokens.css */
            z-index: 9999;
            background: linear-gradient(135deg, rgba(160, 216, 232, 0.9) 0%, rgba(176, 224, 238, 0.9) 100%);
            border: 2px solid #a0d8e8;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            min-width: 280px;
            max-width: 320px;
            backdrop-filter: blur(10px);
        }
        
        /* Vessel selector header - Clickable title bar */
        .vessel-selector-header {
            padding: 12px 15px;
            background: rgba(120, 180, 200, 0.3);
            border-bottom: 1px solid rgba(160, 216, 232, 0.5);
            border-radius: 10px 10px 0 0;
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            user-select: none;
        }
        
        .vessel-selector-header:hover {
            background: rgba(0, 0, 0, 0.4);
        }
        
        .vessel-selector-icon {
            font-size: 18px;
        }
        
        .vessel-selector-title {
            color: #2d6666;
            font-size: 14px;
            font-weight: 700;
            letter-spacing: 0.5px;
            flex: 1;
        }
        
        .vessel-selector-toggle {
            color: #2d6666;
            font-size: 16px;
            transition: transform 0.3s ease;
        }
        
        .vessel-selector-toggle.expanded {
            transform: rotate(180deg);
        }
        
        .vessel-selector-count {
            background: rgba(0, 212, 255, 0.2);
            color: #2d6666;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
        }
        
        /* Vessel list - Collapsible scrollable container */
        .vessel-selector-list {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        
        .vessel-selector-list.expanded {
            max-height: 400px;
            overflow-y: auto;
        }
        
        .vessel-selector-list::-webkit-scrollbar {
            width: 6px;
        }
        
        .vessel-selector-list::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 3px;
        }
        
        .vessel-selector-list::-webkit-scrollbar-thumb {
            background: rgba(0, 212, 255, 0.5);
            border-radius: 3px;
        }
        
        .vessel-selector-list::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 212, 255, 0.8);
        }
        
        /* Vessel item - Individual clickable vessel entry */
        .vessel-item {
            padding: 10px 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .vessel-item:hover {
            background: rgba(0, 212, 255, 0.2);
        }
        
        .vessel-item:active {
            background: rgba(0, 212, 255, 0.3);
        }
        
        .vessel-item-icon {
            font-size: 16px;
        }
        
        .vessel-item-info {
            flex: 1;
        }
        
        .vessel-item-name {
            color: #2d6666;
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 2px;
        }
        
        .vessel-item-mmsi {
            color: rgba(45, 102, 102, 0.7);
            font-size: 11px;
            font-family: 'Courier New', monospace;
        }
        
        .vessel-item-status {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #a0d8e8;
            box-shadow: 0 0 8px #a0d8e8;
            animation: pulse-live 2s ease-in-out infinite;
        }
        
                .vessel-selector-empty {
            padding: 20px 15px;
            text-align: center;
            color: rgba(255, 255, 255, 0.5);
            font-size: 12px;
        }
        
        /* Vessel search box */
        .vessel-search-box {
            position: fixed;
            top: calc(var(--effective-header-height) + 15px);
            left: var(--ui-search-left);    /* Sprint 2: token de layout-tokens.css */
            z-index: 9999;
            display: flex;
            align-items: center;
            gap: 5px;
            background: linear-gradient(135deg, rgba(160, 216, 232, 0.9) 0%, rgba(176, 224, 238, 0.9) 100%);
            border: 2px solid #a0d8e8;
            border-radius: 12px;
            padding: 8px 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(10px);
        }
        
        #vessel-search-input {
            border: none;
            background: rgba(255, 255, 255, 0.9);
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 13px;
            width: 200px;
            outline: none;
            color: #2d6666;
            font-weight: 500;
        }
        
        #vessel-search-input::placeholder {
            color: rgba(45, 102, 102, 0.6);
        }
        
        #vessel-search-input:focus {
            background: rgba(255, 255, 255, 1);
            box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
        }
        
        #vessel-search-btn {
            background: rgba(0, 212, 255, 0.3);
            border: 1px solid rgba(0, 212, 255, 0.5);
            border-radius: 8px;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s ease;
        }
        
        #vessel-search-btn:hover {
            background: rgba(0, 212, 255, 0.6);
            transform: scale(1.05);
        }
        
        #vessel-search-btn:active {
            transform: scale(0.95);
        }
        
        .vessel-search-results {
            position: absolute;
            top: 50px;
            left: 0;
            right: 0;
            background: rgba(255, 255, 255, 0.98);
            border: 2px solid #a0d8e8;
            border-radius: 12px;
            max-height: 300px;
            overflow-y: auto;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            display: none;
            z-index: 10000;
        }
        
        .vessel-search-results.show {
            display: block;
        }
        
        .vessel-search-result-item {
            padding: 10px 15px;
            border-bottom: 1px solid rgba(160, 216, 232, 0.3);
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .vessel-search-result-item:last-child {
            border-bottom: none;
        }
        
        .vessel-search-result-item:hover {
            background: rgba(0, 212, 255, 0.1);
        }
        
        .vessel-search-result-name {
            font-weight: 600;
            color: #2d6666;
            font-size: 14px;
        }
        
        .vessel-search-result-mmsi {
            color: #666;
            font-size: 12px;
            margin-top: 2px;
        }
        
        .vessel-search-no-results {
            padding: 15px;
            text-align: center;
            color: #999;
            font-size: 13px;
        }
        
        
        /* Iconos de embarcaciones */
        .vessel-marker-svg {
            background: transparent !important;
            border: none !important;
        }
        
                /* Marcadores de huracanes - Estilo NOAA */
        .hurricane-marker {
            background: transparent !important;
            border: none !important;
            z-index: 1000 !important;  /* Asegurar que esté encima de círculos */
        }
        
        .hurricane-icon-container {
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1001 !important;  /* Nivel superior para símbolo */
        }
        
        /* Símbolo oficial de huracán según categoría */
        .hurricane-symbol {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 3px solid white;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
            animation: hurricane-pulse 3s ease-in-out infinite;
            font-size: 20px;
            font-weight: bold;
            color: white;
        }
        
        @keyframes hurricane-pulse {
            0%, 100% {
                transform: scale(1);
                box-shadow: 0 4px 12px rgba(0,0,0,0.4);
            }
            50% {
                transform: scale(1.08);
                box-shadow: 0 6px 20px rgba(0,0,0,0.6);
            }
        }
        
        /* Cono de incertidumbre translúcido */
        .forecast-cone {
            opacity: 0.25;
            transition: opacity 0.3s;
        }
        
        .forecast-cone:hover {
            opacity: 0.45;
        }
        
        /* Track points de pronóstico */
        .forecast-point {
            transition: all 0.3s;
        }
        
        .forecast-point:hover {
            transform: scale(1.3);
        }        /* Weather legend - PERMANENTLY HIDDEN (!important) */
        .weather-legend {
            position: fixed;
            bottom: 10px;
            left: 20px;
            background: rgba(26, 26, 46, 0.95);
            backdrop-filter: blur(10px);
            border: 2px solid #00d4ff;
            border-radius: 12px;
            padding: 15px;
            z-index: 9998;
            min-width: 280px;
            max-width: 320px;
            display: none !important; /* OCULTO PERMANENTEMENTE por petición usuario */
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        }
        
        .weather-legend.active {
            display: block;
        }
        
        /* Legend sub-elements - NOT VISIBLE (legend hidden with !important) */
        .legend-title {
            color: #00d4ff;
            font-weight: bold;
            font-size: 16px;
            margin-bottom: 12px;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        .legend-section {
            margin-bottom: 15px;
        }
        
        .legend-section-title {
            color: #ffffff;
            font-weight: bold;
            font-size: 14px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .legend-scale {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        
        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 12px;
            color: #e0e0e0;
        }
        
        /* Legend color box and gradients */
        .legend-color {
            width: 40px;
            height: 20px;
            border-radius: 4px;
            border: 1px solid rgba(255, 255, 255, 0.3);
            flex-shrink: 0;
        }
        
        .legend-gradient {
            width: 100%;
            height: 25px;
            border-radius: 4px;
            border: 1px solid rgba(255, 255, 255, 0.3);
            margin-top: 5px;
        }
        
        .legend-labels {
            display: flex;
            justify-content: space-between;
            font-size: 10px;
            color: #b0b0b0;
            margin-top: 3px;
        }

        /* Version indicator - Bottom right badge */
        .version-indicator {
            position: fixed;
            bottom: 10px;
            right: 10px;
            background: rgba(46, 204, 113, 0.9);
            color: white;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 11px;
            font-weight: bold;
            z-index: 9999;
            box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        }
        
        /* Coordinates indicator - Bottom left cursor position display */
        .coordinates-indicator {
            position: fixed;
            bottom: 10px;
            left: 10px;
            background: rgba(0, 0, 0, 0.85);
            color: #00d4ff;
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 12px;
            font-family: 'Courier New', monospace;
            font-weight: bold;
            z-index: 9998;
            box-shadow: 0 2px 8px rgba(0,0,0,0.4);
            border: 1px solid rgba(0, 212, 255, 0.3);
            pointer-events: none;
        }
        
        .coordinates-indicator .coord-label {
            color: #ffffff;
            font-size: 10px;
            opacity: 0.7;
        }
        
        /* Layers control - Top right weather layers panel */
        .layers-control {
            position: fixed;
            top: calc(var(--effective-header-height) + 15px);  /* Alineado con cabecera real */
            right: 15px;                   /* Desplazada 5px a la izquierda */
            background: linear-gradient(135deg, rgba(160, 216, 232, 0.9) 0%, rgba(176, 224, 238, 0.9) 100%);  /* ✅ Mismo gradiente que "Grupo de Navegantes" */
            backdrop-filter: blur(10px);
            border-radius: 12px 0 0 12px;  /* Redondeado izquierdo, recto derecho */
            padding: 10px 8px;
            z-index: 9999;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
            border: 2px solid #a0d8e8;  /* ✅ Mismo borde */
            border-right: none;            /* Sin borde derecho (pegado a pantalla) */
            min-width: 160px;
            max-width: 180px;
        }
        
        /* Título h3: OCULTO (no se usa en desktop ni mobile) */
        .layers-control h3 {
            display: none;
        }
        
        /* Cada opción de capa (fila con checkbox + label) */
        .layer-option {
            display: flex;
            align-items: center;
            margin: 10px 0;
            cursor: pointer;
            gap: 2px;
        }
        
        .layer-checkbox {
            width: 16px;
            height: 16px;
            cursor: pointer;
            accent-color: #00d4ff;
        }
        
        /* Checkboxes deshabilitados - Estado durmiente */
        .layer-checkbox:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        
        .layer-checkbox:disabled ~ label {
            opacity: 0.4;
            cursor: not-allowed;
        }
        
        .layer-icon-label {
            font-size: 20px;
            cursor: pointer;
            user-select: none;
            transition: all 0.3s;
        }
        
        .layer-option:hover .layer-icon-label {
            transform: scale(1.1);
        }
        
        .layer-option label {
            color: #000000;
            font-size: 14px;
            font-weight: 700;
            letter-spacing: 0.5px;
            cursor: pointer;
            flex: 1;
            margin-left: 2px;
            text-align: left;
        }
        
        .layer-checkbox:checked ~ .layer-icon {
            filter: grayscale(0%);
            opacity: 1;
        }
        
        .layer-status {
            margin-left: auto;
            padding-left: 10px;
        }

        
        .status-dot {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            margin-left: 8px;
        }
        
        .status-active {
            background: #00ff88;
            box-shadow: 0 0 8px #00ff88;
        }
        
        .status-inactive {
            background: #666;
        }
        
        .status-loading {
            background: #ffaa00;
            animation: pulse-loading 1.5s ease-in-out infinite;
        }
        
        @keyframes pulse-loading {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }
        
        /* Fleet control - Bottom right fleet panel */
        /* ⚠️ HIDDEN (08-ENE-2026): Panel Flota con checkbox Global - Preservado para uso futuro */
        .fleet-control {
            display: none !important;  /* ⚠️ OCULTO - Remover esta línea para mostrar */
            position: fixed;
            bottom: 20px;
            right: 10px;
            background: rgba(26, 77, 77, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 12px 0 0 12px;
            padding: 10px 8px;
            z-index: 9999;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-right: none;
            min-width: 160px;
            max-width: 180px;
        }
        
        .fleet-control h3 {
            color: #ffffff;
            font-size: 14px;
            margin: 0 0 10px 0;
            padding: 0;
            font-weight: 600;
            text-align: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            padding-bottom: 8px;
        }
        
        .fleet-option {
            display: flex;
            align-items: center;
            margin: 10px 0;
            cursor: pointer;
            gap: 2px;
        }
        
        .fleet-checkbox {
            width: 16px;
            height: 16px;
            cursor: pointer;
            accent-color: #00d4ff;
        }
        
        .fleet-icon-label {
            font-size: 20px;
            cursor: pointer;
            user-select: none;
            transition: all 0.3s;
        }
        
        .fleet-option:hover .fleet-icon-label {
            transform: scale(1.1);
        }
        
        .fleet-option label {
            color: #ffffff;
            font-size: 11px;
            cursor: pointer;
            flex: 1;
            margin-left: 2px;
        }
        
        /* Breakpoints estandar: XS<=360, SM<=480, MD<=600, LG<=768, XL<=1024, XXL<=1280, 3XL>1280 */
        /* Responsive Design - Tablets and smaller screens (LG<=768px) - CONSOLIDADO CON LÍNEA 558 */
        
                /* ESTILOS PARA TOOLTIPS DE ISOBARAS */
        /* ============================================================================ */
        
        .isobar-tooltip {
            background: rgba(0, 0, 0, 0.8) !important;
            border: 1px solid #00d4ff !important;
            border-radius: 4px !important;
            padding: 4px 8px !important;
            font-size: 12px !important;
            font-weight: bold !important;
            color: #ffffff !important;
            text-shadow: none !important;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
            z-index: 1000 !important;
        }
        
        .isobar-tooltip::before {
            border-top-color: #00d4ff !important;
        }
        
                /* OPTIMIZACIÓN ADICIONAL PARA PANEL DE CAPAS EN IFRAME */
        /* ============================================================================ */
        
        /* Hacer el panel más compacto cuando está embebido */
        body.embedded .layers-control {
            right: 15px;
            min-width: 160px;
            max-width: 200px;
            padding: 10px;
            transform: translateY(-30px);
        }
        
        body.embedded .layers-control h3 {
            font-size: 12px;
            margin-bottom: 8px;
            padding-bottom: 6px;
        }
        
        body.embedded .layer-option {
            margin: 6px 0;
        }
        
        body.embedded .layer-label {
            font-size: 11px;
        }
        
        body.embedded .layer-checkbox {
            width: 14px;
            height: 14px;
            margin-right: 6px;
        }

        /* En IFRAME para laptop/PC: desplazar ambos manteniendo distancia */
        body.embedded[data-screen-type="laptop"] .vessel-selector,
        body.embedded[data-screen-type="panoramic"] .vessel-selector {
            left: 80px !important;
            width: 320px !important;
            min-width: 320px !important;
            max-width: 320px !important;
        }

        body.embedded[data-screen-type="laptop"] .vessel-search-box,
        body.embedded[data-screen-type="panoramic"] .vessel-search-box {
            left: 410px !important;
            width: 320px !important;
            min-width: 320px !important;
            max-width: 320px !important;
        }

        body.embedded[data-screen-type="laptop"] .vessel-selector-header,
        body.embedded[data-screen-type="panoramic"] .vessel-selector-header,
        body.embedded[data-screen-type="laptop"] .vessel-search-box,
        body.embedded[data-screen-type="panoramic"] .vessel-search-box {
            height: 48px !important;
            min-height: 48px !important;
            box-sizing: border-box !important;
        }

        body.embedded[data-screen-type="laptop"] .vessel-selector-title,
        body.embedded[data-screen-type="panoramic"] .vessel-selector-title {
            margin-left: 10px !important;
        }

        /* Alineación robusta: desktop; en smartphone no debe pisar reglas específicas */
        body[data-screen-type="laptop"] #map,
        body[data-screen-type="panoramic"] #map,
        body:not([data-screen-type]) #map {
            position: absolute !important;
            top: calc(var(--effective-header-height) + 1px) !important;
            height: calc(100vh - var(--effective-header-height) - 1px) !important;
            height: calc(100dvh - var(--effective-header-height) - 1px) !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            margin-top: 0 !important;
            padding: 0 !important;
            overflow: hidden !important;
        }

        /* Tablet: mapa pegado al header (landscape). Portrait lo sobreescribe con 10px. */
        body[data-screen-type="tablet"] #map {
            position: absolute !important;
            top: calc(var(--effective-header-height) + 1px) !important;
            height: calc(100vh - var(--effective-header-height) - 1px) !important;
            height: calc(100dvh - var(--effective-header-height) - 1px) !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            margin-top: 0 !important;
            padding: 0 !important;
            overflow: hidden !important;
        }
        
        
        /* ============================================
           REGISTRO MODAL - Registration Form Styles
           ============================================ */
        
        /* Modal overlay */
        .registro-modal {
            display: none;
            position: fixed;
            z-index: 99999;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(5px);
            animation: fadeIn 0.3s ease;
        }
        
        .registro-modal.show {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        /* Modal content */
        .registro-modal-content {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            margin: auto;
            padding: 0;
            border: 2px solid #00d4ff;
            border-radius: 16px;
            width: 90%;
            max-width: 600px;
            box-shadow: 0 8px 32px rgba(0, 212, 255, 0.4);
            animation: slideDown 0.3s ease;
        }
        
        @keyframes slideDown {
            from { 
                transform: translateY(-50px);
                opacity: 0;
            }
            to { 
                transform: translateY(0);
                opacity: 1;
            }
        }
        
        /* Modal header */
        .registro-modal-header {
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            color: white;
            padding: 20px 25px;
            border-radius: 14px 14px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .registro-modal-header h2 {
            margin: 0;
            font-size: 24px;
            font-weight: 700;
        }
        
        /* Close button */
        .registro-close {
            color: white;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            background: none;
            border: none;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: all 0.3s ease;
            margin-right: 8px;
        }
        
        .registro-close:hover,
        .registro-close:focus {
            background: rgba(255, 255, 255, 0.2);
        }
        
        /* Modal body */
        .registro-modal-body {
            padding: 25px;
        }
        
        /* Form styles */
        .registro-form-group {
            margin-bottom: 20px;
        }
        
        .registro-form-group label {
            display: block;
            margin-bottom: 8px;
            color: #0a1e3b;
            font-weight: 600;
            font-size: 14px;
        }
        
        .registro-form-group label .required {
            color: #ff0000;
            margin-left: 4px;
        }
        
        .registro-form-group input {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            font-family: inherit;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }
        
        .registro-form-group input:focus {
            outline: none;
            border-color: #00d4ff;
            box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
        }
        
        .registro-form-group input.error {
            border-color: #ff0000;
        }
        
        .registro-form-group .error-message {
            color: #ff0000;
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }
        
        .registro-form-group input.error + .error-message {
            display: block;
        }
        
        /* Two-column layout for form */
        .registro-form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }
        
        
        /* GDPR notice */
        .registro-gdpr-notice {
            background: rgba(0, 212, 255, 0.1);
            border: 1px solid #00d4ff;
            border-radius: 8px;
            padding: 15px;
            margin: 20px 0;
            font-size: 12px;
            line-height: 1.5;
            color: #0a1e3b;
        }
        
        .registro-gdpr-notice strong {
            color: #0099cc;
            font-weight: 700;
        }
        
        /* Submit button */
        .registro-submit-btn {
            width: 100%;
            padding: 14px 20px;
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
        }
        
        .registro-submit-btn:hover {
            background: linear-gradient(135deg, #00a8cc 0%, #0066aa 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 212, 255, 0.5);
        }
        
        .registro-submit-btn:active {
            transform: translateY(0);
        }
        
        .registro-submit-btn:disabled {
            background: #cccccc;
            cursor: not-allowed;
            transform: none;
        }
        
        /* Botón Anular de Flota de Navegantes */
        .registro-anular-btn {
            width: 100%;
            padding: 14px 20px;
            background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
            margin-top: 10px;
        }
        
        .registro-anular-btn:hover {
            background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(255, 68, 68, 0.5);
        }
        
        .registro-anular-btn:active {
            transform: translateY(0);
        }
        
        /* Success/Error messages */
        .registro-message {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            display: none;
            font-weight: 600;
        }
        
        .registro-message.success {
            background: rgba(40, 167, 69, 0.1);
            border: 1px solid #28a745;
            color: #155724;
        }
        
        .registro-message.error {
            background: rgba(220, 53, 69, 0.1);
            border: 1px solid #dc3545;
            color: #721c24;
        }
        
        .registro-message.show {
            display: block;
        }
        
        /* ============================================
           PASSWORD MODAL STYLES
           ============================================ */
        .password-modal {
            display: none;
            position: fixed;
            z-index: 10000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(8px);
        }
        
        .password-modal.show {
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .password-modal-content {
            background: linear-gradient(135deg, #0a1e3b 0%, #1a3a5c 100%);
            border-radius: 15px;
            width: 90%;
            max-width: 450px;
            box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
            border: 2px solid #00d4ff;
            animation: modalSlideIn 0.3s ease-out;
        }
        
        @keyframes modalSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .password-modal-header {
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            padding: 20px 25px;
            border-radius: 13px 13px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .password-modal-header h2 {
            margin: 0;
            color: white;
            font-size: 20px;
            font-weight: 700;
        }
        
        .password-modal-header .registro-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            font-size: 28px;
            cursor: pointer;
            width: 35px;
            height: 35px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }
        
        .password-modal-header .registro-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: rotate(90deg);
        }
        
        .password-modal-body {
            padding: 30px 25px;
        }
        
        .password-modal-body label {
            display: block;
            margin-bottom: 10px;
            color: white;
            font-weight: 600;
            font-size: 14px;
        }
        
        .password-input {
            width: 100%;
            padding: 14px 16px;
            border: 2px solid rgba(0, 212, 255, 0.3);
            border-radius: 8px;
            font-size: 15px;
            font-family: inherit;
            background: rgba(255, 255, 255, 0.05);
            color: white;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }
        
        .password-input:focus {
            outline: none;
            border-color: #00d4ff;
            background: rgba(255, 255, 255, 0.08);
            box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
        }
        
        .password-input.error {
            border-color: #ff4444;
            background: rgba(255, 68, 68, 0.1);
        }
        
        .password-btn {
            flex: 1;
            padding: 12px 20px;
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .password-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
        }
        
        .password-btn:active {
            transform: translateY(0);
        }
        
        .password-error {
            margin-top: 15px;
            padding: 15px;
            background: rgba(255, 68, 68, 0.1);
            border: 1px solid #ff4444;
            border-radius: 6px;
            color: #ff4444;
            font-size: 12px;
            font-weight: 500;
            text-align: center;
            line-height: 1.6;
            display: none;
            max-width: 100%;
        }
        
        .password-error.show {
            display: block;
            animation: errorShake 0.4s ease;
        }
        
        @keyframes errorShake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-10px); }
            75% { transform: translateX(10px); }
        }
        
        /* ============================================
           PANEL DE SEGURIDAD MARÍTIMA (09-ENE-2026)
           ============================================ */
        
        .maritime-security-section {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 9999;
            /* Adaptar ancho a ventanas estrechas (zoom elevado o ventana muy pequeña) */
            max-width: min(500px, calc(100vw - 40px));
        }
        
        .security-toggle {
            background: linear-gradient(135deg, rgba(160, 216, 232, 0.9) 0%, rgba(176, 224, 238, 0.9) 100%);  /* ✅ Mismo gradiente que "Grupo de Navegantes" */
            color: #2d6666;  /* ✅ Mismo color de texto */
            border: 2px solid #a0d8e8;  /* ✅ Mismo borde */
            border-radius: 12px 12px 0 0;
            padding: 12px 20px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }
        
        .security-toggle:hover {
            background: linear-gradient(135deg, rgba(140, 196, 212, 0.9) 0%, rgba(156, 204, 218, 0.9) 100%);  /* ✅ Hover: gradiente ligeramente más oscuro */
            box-shadow: 0 6px 20px rgba(160, 216, 232, 0.6);
            transform: translateY(-2px);
        }
        
        .security-toggle .arrow {
            font-size: 14px;
            transition: transform 0.3s ease;
        }
        
        .security-toggle .arrow.open {
            transform: rotate(180deg);
        }
        
        .security-panel {
            background: rgba(26, 26, 46, 0.95);
            backdrop-filter: blur(10px);
            border: 2px solid rgba(0, 212, 255, 0.3);
            border-radius: 0 0 12px 12px;
            overflow: hidden;
            max-height: 0;
            transition: max-height 0.4s ease;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        }
        
        .security-panel.open {
            /* 94px = 54px (toggle) + 40px (= 20px bottom-offset + 20px gap sobre el mapa).
               Geometría: section_top = vh - 20 - 54 - panelH; queremos section_top = headerH + 20
               → panelH = vh - headerH - 54 - 40  →  CSS_CONST = 54 + 40 = 94. */
            max-height: max(80px, min(600px, calc(100vh - var(--effective-header-height, 115px) - 94px)));
            overflow-y: auto;  /* ✅ FIX: Permitir scroll cuando contenido excede 600px */
            padding-right: 4px;  /* Espacio para scrollbar */
        }
        
        /* ✅ FIX: Scrollbar estilizado para panel (consistente con .tab-content) */
        .security-panel::-webkit-scrollbar {
            width: 6px;
        }
        
        .security-panel::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 3px;
        }
        
        .security-panel::-webkit-scrollbar-thumb {
            background: linear-gradient(to bottom, #00d4ff, #0099cc);
            border-radius: 3px;
        }
        
        .security-panel::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(to bottom, #00e5ff, #00aadd);
        }

        /* Suprimir transición durante sincronización de resize (JS añade/quita esta clase) */
        .security-panel.no-transition {
            transition: none !important;
        }
        
        /* Primera fila: Áreas marítimas */
        .area-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 8px;
            padding: 10px 12px;
            background: rgba(0, 40, 80, 0.4);
            border-bottom: 2px solid rgba(0, 212, 255, 0.3);
        }
        
        .area-tab {
            padding: 6px 12px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 5px;
            color: #b0b0b0;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
        }
        
        .area-tab:hover {
            background: rgba(255, 255, 255, 0.15);
            color: #ffffff;
        }
        
        .area-tab.active {
            background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
            color: #ffffff;
            border-color: #1e88e5;
            box-shadow: 0 2px 8px rgba(30, 136, 229, 0.5);
        }
        
        /* Segunda fila: Servicios (filtrados por área) */
        .security-tabs {
            display: flex;
            background: rgba(30, 60, 114, 0.3);
            border-bottom: 2px solid rgba(0, 212, 255, 0.2);
            padding: 8px;
            gap: 5px;
            overflow-x: auto;
        }
        
        .security-tabs::-webkit-scrollbar {
            height: 4px;
        }
        
        .security-tabs::-webkit-scrollbar-thumb {
            background: rgba(0, 212, 255, 0.3);
            border-radius: 2px;
        }
        
        .security-tab {
            background: rgba(255, 255, 255, 0.05);
            color: rgba(255, 255, 255, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            padding: 8px 15px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            white-space: nowrap;
            display: none; /* Ocultar por defecto */
        }
        
        .security-tab.visible {
            display: block; /* Mostrar solo tabs del área activa */
        }
        
        .security-tab:hover {
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border-color: rgba(0, 212, 255, 0.5);
        }
        
        .security-tab.active {
            background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
            color: white;
            border-color: #00d4ff;
            box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
        }
        
        .security-tab.add-tab {
            background: rgba(0, 212, 255, 0.1);
            color: #00d4ff;
            font-size: 18px;
            padding: 8px 12px;
        }
        
        .tab-content {
            display: none;
            padding: 20px;
            animation: fadeIn 0.3s ease;
            max-height: 420px;
            overflow-y: auto;
            padding-right: 8px;
        }
        
        .tab-content.active {
            display: block;
        }
        
        /* Scrollbar personalizado para el contenido */
        .tab-content::-webkit-scrollbar {
            width: 6px;
        }
        
        .tab-content::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 3px;
        }
        
        .tab-content::-webkit-scrollbar-thumb {
            background: rgba(0, 212, 255, 0.3);
            border-radius: 3px;
        }
        
        .tab-content::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 212, 255, 0.5);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .service-card {
            margin-bottom: 20px;
        }
        
        .service-card h4 {
            color: #00d4ff;
            font-size: 15px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .service-card p {
            color: rgba(255, 255, 255, 0.7);
            font-size: 12px;
            margin-bottom: 15px;
            line-height: 1.6;
        }
        
        .quick-links {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-bottom: 15px;
        }
        
        .security-btn {
            background: rgba(255, 255, 255, 0.05);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            padding: 10px 15px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            text-decoration: none;
            display: block;
        }
        
        .security-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
        }
        
        .security-btn.btn-primary {
            background: linear-gradient(135deg, #5bc0de 0%, #428bca 100%);
            border-color: #5bc0de;
        }
        
        .security-btn.btn-warning {
            background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
            border-color: #f0ad4e;
        }
        
        .security-btn.btn-danger {
            background: linear-gradient(135deg, #d9534f 0%, #c9302c 100%);
            border-color: #d9534f;
        }
        
        .security-btn.btn-emergency {
            background: linear-gradient(135deg, #d9534f 0%, #a02622 100%);
            border-color: #d9534f;
            animation: pulse-emergency 2s infinite;
        }
        
        @keyframes pulse-emergency {
            0%, 100% { 
                box-shadow: 0 0 0 0 rgba(217, 83, 79, 0.7);
                transform: scale(1);
            }
            50% { 
                box-shadow: 0 0 0 10px rgba(217, 83, 79, 0);
                transform: scale(1.02);
            }
        }
        
        .info-links {
            display: flex;
            gap: 15px;
            padding-top: 10px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .info-links a {
            color: #00d4ff;
            font-size: 12px;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 5px;
            transition: all 0.3s ease;
        }
        
        .info-links a:hover {
            color: #5bc0de;
            text-decoration: underline;
        }
        
        .security-info {
            background: rgba(0, 212, 255, 0.05);
            border: 1px solid rgba(0, 212, 255, 0.2);
            border-radius: 8px;
            padding: 15px;
            margin-top: 15px;
        }
        
        .security-info h4 {
            color: #00d4ff;
            font-size: 14px;
            margin-bottom: 10px;
        }
        
        .security-info ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        
        .security-info li {
            color: rgba(255, 255, 255, 0.8);
            font-size: 12px;
            padding: 6px 0;
            padding-left: 20px;
            position: relative;
            line-height: 1.5;
        }
        
        .security-info li:before {
            content: "✓";
            position: absolute;
            left: 0;
            color: #00d4ff;
            font-weight: bold;
        }

        .ip-modal-close:hover,
        .ip-modal-close:focus {
            color: #00ff88;
        }

        .ip-details-table td {
            padding: 10px 15px;
            border-bottom: 1px solid rgba(0, 212, 255, 0.2);
        }

        .ip-details-table td:first-child {
            font-weight: bold;
            color: #00d4ff;
            width: 35%;
            text-align: right;
            padding-right: 20px;
        }

        .ip-details-table td:last-child {
            color: #00ff88;
        }

        .ip-details-table tr:hover {
            background-color: rgba(0, 212, 255, 0.1);
        }

        .ip-detail-link {
            color: #00d4ff;
            text-decoration: underline;
            cursor: pointer;
        }

        .ip-detail-link:hover {
            color: #00ff88;
        }

        /* ============================================================================
           MATRIZ RESPONSIVE CANÓNICA (FUENTE DE VERDAD)
           - Una regla por tipo de pantalla
           - En tablet y smartphone, separación explícita portrait/landscape
           ============================================================================ */

        /* Laptop + Panorámico */
        body[data-screen-type="laptop"] #map,
        body[data-screen-type="panoramic"] #map {
            top: calc(var(--effective-header-height) + 1px) !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            height: calc(100dvh - var(--effective-header-height) - 1px) !important;
            margin-top: 0 !important;
            transform: none !important;
        }

        /* Tablet: posicionamiento fijo por coordenada left (sin transform).
           width:280px fijado en la regla base para que sea idéntico en portrait y landscape. */
        body[data-screen-type="tablet"] .vessel-selector {
            top: calc(var(--effective-header-height) + 15px) !important;
            left: var(--ui-sidebar-left) !important;
            right: auto !important;
            width: 280px !important;
            min-width: 280px !important;
            max-width: 280px !important;
            transform: none !important;
        }

        body[data-screen-type="tablet"] .vessel-search-box {
            top: calc(var(--effective-header-height) + 15px) !important;
            left: var(--ui-search-left) !important;
            right: auto !important;
            width: 280px !important;
            min-width: 180px !important;
            max-width: 280px !important;
            transform: none !important;
        }

        /* Smartphone portrait: selector left-anchored, search-box right-anchored. */
        body[data-screen-type="smartphone"] .vessel-selector {
            top: calc(var(--effective-header-height) + 8px) !important;
            left: var(--ui-sidebar-left) !important;
            right: auto !important;
            width: 195px !important;
            min-width: 0 !important;
            max-width: 195px !important;
            transform: none !important;
            box-sizing: border-box !important;
        }

        body[data-screen-type="smartphone"] .vessel-search-box {
            top: calc(var(--effective-header-height) + 8px) !important;
            left: auto !important;
            right: 5px !important;
            width: 155px !important;
            min-width: 0 !important;
            max-width: 155px !important;
            transform: none !important;
            box-sizing: border-box !important;
        }

        /* Input del buscador: flex:1 para llenar el contenedor de ancho fijo */
        body[data-screen-type="smartphone"] #vessel-search-input {
            flex: 1 !important;
            width: auto !important;
            min-width: 0 !important;
            box-sizing: border-box !important;
        }

        /* Smartphone layers-control: siempre anclada esquina inferior-derecha (portrait y landscape).
           Anula bottom:330px !important del @media ≤480px de dashboard-responsive.css.
           min-width:auto anula min-width:140px del @media ≤600px (sin ese override la regla CSS
           «min-width>max-width» haría que el panel quedase 140px de ancho en iPhones portrait). */
        body[data-screen-type="smartphone"] .layers-control {
            top: auto !important;
            bottom: 10px !important;
            right: 5px !important;
            left: auto !important;
            min-width: auto !important;
            max-width: 50px !important;
            padding: 8px 4px !important;
        }

        /* XS (<=360px): anchuras reducidas para caber en 320px
           5 + 170 + 125 + 5 = 305px ✓ dentro de 320px */
        @media screen and (max-width: 360px) {
            body[data-screen-type="smartphone"] .vessel-selector {
                width: 170px !important;
                max-width: 170px !important;
            }
            body[data-screen-type="smartphone"] .vessel-search-box {
                width: 125px !important;
                max-width: 125px !important;
            }
        }

        /* Tablet vertical */
        @media screen and (orientation: portrait) {
            body[data-screen-type="tablet"] #map {
                top: calc(var(--effective-header-height) + 1px) !important;
                left: 0 !important;
                right: 0 !important;
                width: 100% !important;
                height: calc(100dvh - var(--effective-header-height) - 1px) !important;
                margin-top: 0 !important;
                transform: none !important;
            }

            /* Tablet portrait estrecho (<=600px): vessel-search-box desbordaría a 340px */

            body[data-screen-type="tablet"] .layers-control {
                max-height: 45vh !important;
                overflow-y: auto !important;
            }
        }

        @media screen and (orientation: portrait) and (max-width: 600px) {
            /* Tablet portrait estrecho: search-box apilada debajo del selector (~70px alto) con 10px de margen */
            body[data-screen-type="tablet"] .vessel-search-box {
                left: 10px !important;
                top: calc(var(--effective-header-height) + 95px) !important;
            }
        }

        /* Tablet horizontal */
        @media screen and (orientation: landscape) {
            body[data-screen-type="tablet"] #map {
                top: calc(var(--effective-header-height) + 1px) !important;
                left: 0 !important;
                right: 0 !important;
                width: 100vw !important;
                max-width: none !important;
                height: calc(100dvh - var(--effective-header-height) - 1px) !important;
                margin-top: 0 !important;
                margin-left: 0 !important;
                transform: none !important;
            }

            /* Tablet landscape: sólo ajusta top y search-box left.
               width:280px del selector viene de la regla base (mismo en portrait y landscape).
               Geometría: left:10px + width:280px = borde derecho 290px
               search-box: 290px + 20px gap = base:310px + 288px (3 pulgadas) = left:598px */
            body[data-screen-type="tablet"] .vessel-selector {
                top: calc(var(--effective-header-height) + 12px) !important;
            }

            body[data-screen-type="tablet"] .vessel-selector .vessel-selector-title {
                white-space: nowrap !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
            }

            body[data-screen-type="tablet"] .vessel-search-box {
                top: calc(var(--effective-header-height) + 12px) !important;
                left: 598px !important;  /* 10px + 280px + 20px + 288px (3 pulgadas) */
                right: auto !important;
                width: 280px !important;  /* igual al selector */
                max-width: 280px !important;
            }

            body[data-screen-type="tablet"] .layers-control {
                top: calc(var(--effective-header-height) + 12px) !important;
                right: 15px !important;   /* ancla superior-derecha igual que en portrait */
                left: auto !important;
            }

            /* Smartphone landscape: widgets compactos pegados al header.
               selector: left:5px + width:265px → borde derecho en 270px
               search-box: 270px + 20px gap = left:290px; mismo ancho que selector */
            body[data-screen-type="smartphone"] .vessel-selector {
                top: calc(var(--effective-header-height) + 4px) !important;
                width: 265px !important;
                max-width: 265px !important;
            }

            body[data-screen-type="smartphone"] .vessel-selector .vessel-selector-title {
                white-space: nowrap !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
            }

            body[data-screen-type="smartphone"] .vessel-search-box {
                top: calc(var(--effective-header-height) + 4px) !important;
                left: 290px !important;  /* 5px + 265px + 20px */
                right: auto !important;
                width: 155px !important;
                max-width: 155px !important;
            }

            body[data-screen-type="smartphone"] .layers-control {
                top: auto !important;
                bottom: 10px !important;
            }

            /* Lista desplegada: limitar a zona visible del mapa en landscape (~200px máx) */
            body[data-screen-type="smartphone"] .vessel-selector-list.expanded {
                max-height: 200px !important;
                overflow-y: auto !important;
            }
        }


            /* ── Smartphone landscape: header compacto y mapa a pantalla completa ──────
               Se usa body[data-screen-type] en vez de max-width para cubrir iPhones modernos
               cuyo ancho en landscape supera 768px (iPhone 14=844px, 15 Pro Max=932px).
               La variable --effective-header-height en body sobreescribe :root para todos
               los hijos (herencia CSS), forzando el recalculo del #map sin depender de JS. */
            body[data-screen-type="smartphone"] {
                --effective-header-height: 36px;
            }
            body[data-screen-type="smartphone"] .main-header {
                padding-top: 4px !important;
                padding-bottom: 4px !important;
            }
            body[data-screen-type="smartphone"] .header-logo {
                display: none !important;
            }
            body[data-screen-type="smartphone"] .header-subtitle {
                display: none !important;
            }
            body[data-screen-type="smartphone"] .header-title {
                font-size: 12px !important;
            }
            body[data-screen-type="smartphone"] .header-right {
                flex-direction: row !important;
                gap: 8px !important;
                width: auto !important;
                align-items: center !important;
            }
            body[data-screen-type="smartphone"] #map {
                top: calc(var(--effective-header-height) + 1px) !important;
                left: 0 !important;
                right: 0 !important;
                width: 100% !important;
                height: calc(100dvh - var(--effective-header-height) - 1px) !important;
                margin-top: 0 !important;
                transform: none !important;
            }
            body[data-screen-type="smartphone"] #registro-btn,
            body[data-screen-type="smartphone"] #autoregistro-btn {
                width: auto !important;
                min-width: 0 !important;
                max-width: fit-content !important;
            }
            body[data-screen-type="smartphone"] .header-clock {
                width: auto !important;
                min-width: 0 !important;
                max-width: fit-content !important;
            }
        }

        /* Smartphone vertical */
        @media screen and (max-width: 768px) and (orientation: portrait) {
            body[data-screen-type="smartphone"] #map {
                top: calc(var(--effective-header-height) + 1px) !important;
                left: 0 !important;
                right: 0 !important;
                width: 100% !important;
                height: calc(100dvh - var(--effective-header-height) - 1px) !important;
                margin-top: 0 !important;
                transform: none !important;
            }

            body[data-screen-type="smartphone"] #registro-btn,
            body[data-screen-type="smartphone"] #autoregistro-btn {
                width: 102px !important;
                min-width: 102px !important;
                max-width: 102px !important;
            }
        }

        /* Smartphone horizontal */
        @media screen and (max-width: 768px) and (orientation: landscape) {
            body[data-screen-type="smartphone"] #map {
                top: calc(var(--effective-header-height) + 1px) !important;
                left: 0 !important;
                right: 0 !important;
                width: 100% !important;
                height: calc(100dvh - var(--effective-header-height) - 1px) !important;
                margin-top: 0 !important;
                transform: none !important;
            }

            body[data-screen-type="smartphone"] #registro-btn,
            body[data-screen-type="smartphone"] #autoregistro-btn {
                width: auto !important;
                min-width: 0 !important;
                max-width: fit-content !important;
            }

            body[data-screen-type="smartphone"] .header-clock {
                width: auto !important;
                min-width: 0 !important;
                max-width: fit-content !important;
            }
        }

        /* Smartphone: ventana Autoregistro ajustada al contenido */
        @media screen and (max-width: 768px) {
            #autoregistro-modal .registro-modal-content {
                width: fit-content !important;
                min-width: 260px !important;
                max-width: 94vw !important;
            }
        }
        
    
