/* --- STYLING DESIGN SYSTEM --- */
        :root {
            --bg-dark: #070311;
            --bg-panel: rgba(15, 10, 32, 0.78);
            --border-glass: rgba(255, 255, 255, 0.08);
            --text-main: #f5f3f7;
            --text-muted: #a7a2ba;
            
            /* Colores temáticos neón */
            --color-cyan: #00f2fe;     /* Crecimiento General */
            --color-orange: #ff9f43;   /* Expansión Comercial / Salcajá */
            --color-red: #ff4d4d;      /* Saturación Xela */
            --color-purple: #a55eea;   /* Conurbación / Flujos */
            --color-yellow: #f1c40f;   /* Nuevas zonas */
            
            --font-display: 'Outfit', sans-serif;
            --font-body: 'Inter', sans-serif;
            --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
        }

        /* --- BASE STYLES & RESET --- */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            width: 100vw;
            height: 100vh;
            overflow: hidden;
            font-family: var(--font-body);
            background-color: var(--bg-dark);
            color: var(--text-main);
            position: relative;
        }

        /* --- BACKGROUND GLOW ORBS --- */
        .backdrop-orbs {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 5;
            overflow: hidden;
            pointer-events: none;
        }

        .orb {
            position: absolute;
            border-radius: 50%;
            filter: blur(130px);
            opacity: 0.08;
            animation: floatOrb 25s infinite alternate ease-in-out;
        }

        .orb-1 {
            width: 500px;
            height: 500px;
            background: var(--color-cyan);
            top: -10%;
            left: -5%;
        }

        .orb-2 {
            width: 500px;
            height: 500px;
            background: var(--color-purple);
            bottom: -10%;
            right: -5%;
            animation-duration: 30s;
        }

        @keyframes floatOrb {
            0% { transform: translate(0, 0) scale(1); }
            50% { transform: translate(40px, 20px) scale(1.1); }
            100% { transform: translate(-30px, -40px) scale(0.9); }
        }

        /* --- FULLSCREEN MAP --- */
        #map {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }

        /* --- HEADER NAVIGATION BAR --- */
        header {
            position: absolute;
            top: 15px;
            left: 50%;
            transform: translateX(-50%);
            width: calc(100% - 30px);
            max-width: 1750px;
            height: 60px;
            background: var(--bg-panel);
            backdrop-filter: blur(16px);
            border: 1px solid var(--border-glass);
            border-radius: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 25px;
            z-index: 10;
            box-shadow: var(--shadow-glow);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-family: var(--font-display);
            font-weight: 800;
            font-size: 1.25rem;
            letter-spacing: 0.5px;
            background: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-purple) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .logo svg {
            width: 26px;
            height: 26px;
            stroke: var(--color-cyan);
            fill: none;
            filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.4));
            stroke-width: 2.5px;
        }

        .nav-buttons {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .btn-nav {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--border-glass);
            color: var(--text-main);
            padding: 8px 16px;
            border-radius: 10px;
            font-family: var(--font-display);
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: var(--transition-smooth);
            text-decoration: none;
        }

        .btn-nav:hover {
            background: rgba(0, 242, 254, 0.1);
            border-color: var(--color-cyan);
            box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
            color: var(--color-cyan);
        }

        .btn-nav.active {
            background: var(--color-cyan);
            color: #070311 !important;
            border-color: transparent;
            box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
        }

        .btn-nav.btn-back {
            border-color: rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.02);
            color: var(--text-muted);
        }

        .btn-nav.btn-back:hover {
            color: #fff;
            border-color: #fff;
            background: rgba(255, 255, 255, 0.08);
            box-shadow: none;
        }

        /* --- CONTROL SIDEBAR (LEFT) --- */
        .sidebar-left {
            position: absolute;
            top: 90px;
            left: 15px;
            bottom: 20px;
            width: 360px;
            background: var(--bg-panel);
            backdrop-filter: blur(16px);
            border: 1px solid var(--border-glass);
            border-radius: 20px;
            z-index: 10;
            box-shadow: var(--shadow-glow);
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            overflow-y: auto;
        }

        .sidebar-left::-webkit-scrollbar {
            width: 5px;
        }
        .sidebar-left::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
        }

        .researcher-badge {
            font-family: var(--font-display);
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--color-cyan);
            text-transform: uppercase;
            letter-spacing: 1px;
            background: rgba(0, 242, 254, 0.06);
            border: 1px solid rgba(0, 242, 254, 0.2);
            padding: 5px 12px;
            border-radius: 20px;
            width: fit-content;
            margin-bottom: 2px;
            text-shadow: 0 0 6px rgba(0, 242, 254, 0.2);
        }

        .panel-title {
            font-family: var(--font-display);
            font-size: 1.5rem;
            font-weight: 800;
            line-height: 1.2;
            letter-spacing: -0.5px;
            margin-bottom: 4px;
        }

        .panel-subtitle {
            font-size: 0.82rem;
            color: var(--text-muted);
            line-height: 1.4;
        }

        .divider {
            height: 1px;
            background: var(--border-glass);
            width: 100%;
        }

        /* SIMULATION PLAYER CONTROLLER */
        .player-container {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 14px;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .player-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .player-label {
            font-family: var(--font-display);
            font-size: 0.8rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
        }

        .year-neon {
            font-family: var(--font-display);
            font-size: 2rem;
            font-weight: 900;
            color: var(--color-cyan);
            text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
            line-height: 1;
        }

        /* Timeline Slider Custom Styling */
        .timeline-slider-wrapper {
            position: relative;
            width: 100%;
        }

        .timeline-slider {
            -webkit-appearance: none;
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: rgba(255, 255, 255, 0.1);
            outline: none;
            cursor: pointer;
            transition: background 0.3s;
        }

        .timeline-slider:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        .timeline-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: var(--color-cyan);
            border: 2px solid var(--bg-dark);
            box-shadow: 0 0 10px var(--color-cyan);
            cursor: pointer;
            transition: transform 0.15s;
        }

        .timeline-slider::-webkit-slider-thumb:hover {
            transform: scale(1.2);
        }

        .slider-bounds {
            display: flex;
            justify-content: space-between;
            font-size: 0.72rem;
            color: var(--text-muted);
            font-weight: 600;
        }

        .player-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .btn-play {
            background: var(--color-cyan);
            color: #070311;
            border: none;
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
            transition: var(--transition-smooth);
        }

        .btn-play:hover {
            transform: scale(1.08);
            box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
        }

        .btn-play svg {
            width: 20px;
            height: 20px;
            fill: currentColor;
        }

        .speed-control {
            display: flex;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-glass);
            border-radius: 8px;
            padding: 3px;
        }

        .speed-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.72rem;
            padding: 5px 10px;
            cursor: pointer;
            border-radius: 6px;
            transition: var(--transition-smooth);
        }

        .speed-btn.active {
            background: rgba(255, 255, 255, 0.08);
            color: var(--color-cyan);
        }

        /* DYNAMIC LEGEND */
        .legend-section {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .legend-header {
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
        }

        .legend-list {
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .legend-item {
            background: rgba(255, 255, 255, 0.015);
            border: 1px solid rgba(255, 255, 255, 0.03);
            border-radius: 10px;
            padding: 10px 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 0.82rem;
            font-weight: 550;
            transition: var(--transition-smooth);
            cursor: pointer;
        }

        .legend-item:hover {
            border-color: rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.03);
            transform: translateX(4px);
        }

        .legend-color {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            flex-shrink: 0;
            box-shadow: 0 0 8px currentColor;
        }

        .btn-action {
            width: 100%;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
            border: 1px solid var(--border-glass);
            border-radius: 12px;
            color: var(--text-main);
            padding: 12px;
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.88rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: var(--transition-smooth);
        }

        .btn-action:hover {
            background: var(--color-cyan);
            color: #070311;
            border-color: transparent;
            box-shadow: 0 5px 15px rgba(0, 242, 254, 0.35);
        }

        .btn-action.btn-purple-glow:hover {
            background: var(--color-purple);
            color: #fff;
            box-shadow: 0 5px 15px rgba(165, 94, 234, 0.35);
        }

        /* --- ANALYTICS PANEL (RIGHT) --- */
        .sidebar-right {
            position: absolute;
            top: 90px;
            right: 15px;
            bottom: 20px;
            width: 380px;
            background: var(--bg-panel);
            backdrop-filter: blur(16px);
            border: 1px solid var(--border-glass);
            border-radius: 20px;
            z-index: 10;
            box-shadow: var(--shadow-glow);
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            overflow-y: auto;
        }

        .sidebar-right::-webkit-scrollbar {
            width: 5px;
        }
        .sidebar-right::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
        }

        /* METRICS BLOCK */
        .metrics-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .metric-card {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.04);
            border-radius: 14px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .metric-card.full-width {
            grid-column: span 2;
        }

        .metric-title {
            font-size: 0.72rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        .metric-value {
            font-family: var(--font-display);
            font-size: 1.35rem;
            font-weight: 800;
            color: #fff;
        }

        .metric-value.cyan-glow {
            color: var(--color-cyan);
            text-shadow: 0 0 6px rgba(0, 242, 254, 0.2);
        }

        /* CHART CONTAINER */
        .chart-box {
            background: rgba(255, 255, 255, 0.015);
            border: 1px solid rgba(255, 255, 255, 0.03);
            border-radius: 14px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .chart-title {
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
        }

        /* ACTIVE GIS ZONES LIST */
        .zones-list-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .zones-list-header {
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .zones-scroll {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 160px;
            overflow-y: auto;
            padding-right: 2px;
        }

        .zone-card {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.04);
            border-radius: 10px;
            padding: 10px 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: var(--transition-smooth);
        }

        .zone-card:hover {
            border-color: rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.03);
        }

        .zone-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .zone-name {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-main);
        }

        .zone-area {
            font-size: 0.72rem;
            color: var(--text-muted);
        }


        .btn-edit-zone {
            background: rgba(165, 94, 234, 0.08);
            border: 1px solid rgba(165, 94, 234, 0.28);
            color: var(--color-purple);
            cursor: pointer;
            padding: 5px 9px;
            border-radius: 6px;
            font-family: var(--font-display);
            font-size: 0.7rem;
            font-weight: 700;
            transition: var(--transition-smooth);
            white-space: nowrap;
        }

        .btn-edit-zone:hover,
        .btn-edit-zone.active {
            background: rgba(165, 94, 234, 0.18);
            border-color: var(--color-purple);
            color: #fff;
            box-shadow: 0 0 12px rgba(165, 94, 234, 0.22);
        }

        .zone-card.editing {
            border-color: rgba(165, 94, 234, 0.42);
            background: rgba(165, 94, 234, 0.07);
        }
        .btn-delete-zone {
            background: transparent;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 4px;
            border-radius: 4px;
            transition: var(--transition-smooth);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-delete-zone:hover {
            color: var(--color-red);
            background: rgba(255, 77, 77, 0.1);
        }

        .btn-delete-zone svg {
            width: 14px;
            height: 14px;
            fill: currentColor;
        }

        .no-zones-msg {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-style: italic;
            text-align: center;
            padding: 15px 0;
            background: rgba(255, 255, 255, 0.01);
            border: 1px dashed rgba(255,255,255,0.05);
            border-radius: 10px;
        }

        /* --- MAP FLOWS ANIMATION --- */
        @keyframes dashflow {
            to {
                stroke-dashoffset: -40;
            }
        }
        .flow-path-animated {
            stroke-dasharray: 8, 8;
            animation: dashflow 1.5s linear infinite;
        }

        /* Leaflet Draw Control overrides */
        .leaflet-draw-toolbar a {
            background-color: var(--bg-panel) !important;
            border-bottom: 1px solid var(--border-glass) !important;
            color: white !important;
        }
        .leaflet-draw-toolbar a:hover {
            background-color: var(--color-cyan) !important;
            color: black !important;
        }
        .leaflet-draw-actions a {
            background-color: rgba(15, 10, 32, 0.95) !important;
            color: white !important;
        }
        .leaflet-draw-actions a:hover {
            background-color: var(--color-red) !important;
        }

        /* --- REPORT GENERATOR MODAL --- */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(7, 3, 17, 0.85);
            backdrop-filter: blur(8px);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s ease;
        }

        .modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-container {
            width: 90%;
            max-width: 850px;
            max-height: 85vh;
            background: #100b25;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 24px;
            box-shadow: 0 25px 60px rgba(0,0,0,0.8);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transform: scale(0.95);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .modal-overlay.active .modal-container {
            transform: scale(1);
        }

        .modal-header {
            padding: 20px 30px;
            border-bottom: 1px solid var(--border-glass);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(255, 255, 255, 0.01);
        }

        .modal-title {
            font-family: var(--font-display);
            font-size: 1.25rem;
            font-weight: 800;
            color: #fff;
        }

        .btn-close-modal {
            background: transparent;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 6px;
            border-radius: 50%;
            transition: var(--transition-smooth);
        }

        .btn-close-modal:hover {
            color: #fff;
            background: rgba(255,255,255,0.06);
        }

        .modal-body {
            padding: 35px 40px;
            overflow-y: auto;
            flex: 1;
            font-size: 0.9rem;
            line-height: 1.6;
            color: var(--text-main);
        }

        .report-sheet {
            background: #fff;
            color: #2c3e50;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            font-family: 'Segoe UI', Arial, sans-serif;
            position: relative;
        }

        .report-header {
            border-bottom: 3px double #2c3e50;
            padding-bottom: 15px;
            margin-bottom: 25px;
            text-align: center;
        }

        .report-title-academy {
            font-size: 0.85rem;
            font-weight: 800;
            color: #7f8c8d;
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 5px;
        }

        .report-title-main {
            font-size: 1.5rem;
            font-weight: 800;
            color: #1a252f;
            text-transform: uppercase;
            line-height: 1.2;
        }

        .report-meta-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 25px;
            font-size: 0.8rem;
            border-bottom: 1px solid #ecf0f1;
            padding-bottom: 15px;
        }

        .report-meta-item strong {
            color: #2c3e50;
        }

        .report-section-title {
            font-size: 1rem;
            font-weight: 800;
            color: #1a252f;
            text-transform: uppercase;
            border-bottom: 2px solid #2ecc71;
            padding-bottom: 4px;
            margin-top: 25px;
            margin-bottom: 12px;
            letter-spacing: 0.5px;
        }

        .report-table {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
            font-size: 0.8rem;
        }

        .report-table th {
            background: #34495e;
            color: #fff;
            text-align: left;
            padding: 8px 12px;
            font-weight: 700;
        }

        .report-table td {
            padding: 8px 12px;
            border-bottom: 1px solid #ecf0f1;
        }

        .report-table tr:nth-child(even) {
            background: #f8f9fa;
        }

        .report-table tr.highlighted {
            background: #e8f8f5;
            font-weight: 700;
            border-top: 1px solid #2ecc71;
            border-bottom: 2px solid #2ecc71;
        }

        .report-findings {
            margin-top: 15px;
        }

        .report-findings ul {
            padding-left: 20px;
        }

        .report-findings li {
            margin-bottom: 8px;
        }

        .report-signatures {
            margin-top: 45px;
            display: flex;
            justify-content: space-around;
            text-align: center;
            font-size: 0.78rem;
        }

        .signature-line {
            border-top: 1px solid #95a5a6;
            width: 180px;
            padding-top: 6px;
            margin-top: 30px;
        }

        .modal-footer {
            padding: 20px 30px;
            border-top: 1px solid var(--border-glass);
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            background: rgba(255, 255, 255, 0.01);
        }

        .btn-modal-action {
            padding: 10px 20px;
            border-radius: 8px;
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.88rem;
            cursor: pointer;
            transition: var(--transition-smooth);
            border: 1px solid var(--border-glass);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn-modal-cancel {
            background: transparent;
            color: var(--text-muted);
        }

        .btn-modal-cancel:hover {
            color: #fff;
            border-color: rgba(255,255,255,0.2);
            background: rgba(255,255,255,0.02);
        }

        .btn-modal-primary {
            background: var(--color-cyan);
            color: #070311;
            border-color: transparent;
        }

        .btn-modal-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
        }

        /* CSS for smooth printing layout */
        @media print {
            body * {
                visibility: hidden !important;
            }
            .modal-overlay, .modal-overlay.active {
                position: absolute !important;
                left: 0 !important;
                top: 0 !important;
                width: 100% !important;
                height: auto !important;
                background: white !important;
                visibility: visible !important;
                backdrop-filter: none !important;
            }
            .modal-container {
                box-shadow: none !important;
                border: none !important;
                width: 100% !important;
                max-width: 100% !important;
                height: auto !important;
                max-height: 100% !important;
                background: white !important;
                visibility: visible !important;
            }
            .modal-body {
                padding: 0 !important;
                overflow: visible !important;
                visibility: visible !important;
            }
            .report-sheet {
                box-shadow: none !important;
                border: none !important;
                padding: 0 !important;
                visibility: visible !important;
            }
            .report-sheet * {
                visibility: visible !important;
            }
            .modal-header, .modal-footer {
                display: none !important;
            }
        }
/* --- RESPONSIVE WORKSPACE LAYOUT --- */
@media (max-width: 1200px) {
    header {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 18px;
    }

    .nav-buttons {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .sidebar-left,
    .sidebar-right {
        width: 320px;
    }
}

@media (max-width: 900px) {
    body {
        min-height: 100vh;
        height: auto;
        overflow-y: auto;
    }

    #map {
        position: fixed;
        min-height: 100vh;
    }

    header,
    .sidebar-left,
    .sidebar-right {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        width: calc(100% - 24px);
        margin: 12px;
        max-width: none;
    }

    header {
        justify-content: flex-start;
    }

    .logo {
        width: 100%;
    }

    .sidebar-left,
    .sidebar-right {
        max-height: none;
    }

    .nav-buttons {
        justify-content: flex-start;
    }

    .btn-nav,
    .btn-action {
        min-height: 40px;
    }

    .modal-container {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }
}

@media (max-width: 560px) {
    header,
    .sidebar-left,
    .sidebar-right {
        padding: 16px;
        border-radius: 12px;
    }

    .nav-buttons,
    .player-controls,
    .modal-footer {
        width: 100%;
    }

    .btn-nav,
    .btn-action,
    .btn-modal-action {
        justify-content: center;
        width: 100%;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .report-meta-grid {
        grid-template-columns: 1fr;
    }
}

.dependency-error {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 2000;
    padding: 14px 16px;
    border: 1px solid rgba(255, 77, 77, 0.35);
    border-radius: 10px;
    background: rgba(32, 10, 18, 0.96);
    color: #fff;
    box-shadow: var(--shadow-glow);
    font-size: 0.9rem;
}
/* --- NAV10 PROFESSIONAL LAB ENHANCEMENTS --- */
:root,
[data-theme="dark"] {
    --bg-main: #070311;
    --bg-panel: rgba(15, 10, 32, 0.84);
    --bg-control: rgba(255, 255, 255, 0.045);
    --border: rgba(255, 255, 255, 0.12);
    --map-control-bg: rgba(15, 10, 32, 0.92);
    --card-soft: rgba(255,255,255,0.03);
}

[data-theme="light"] {
    --bg-main: #eef2f6;
    --bg-dark: #eef2f6;
    --bg-panel: rgba(255, 255, 255, 0.92);
    --bg-control: rgba(15, 23, 42, 0.045);
    --border-glass: rgba(15, 23, 42, 0.14);
    --border: rgba(15, 23, 42, 0.16);
    --text-main: #101828;
    --text-muted: #536070;
    --map-control-bg: rgba(255, 255, 255, 0.95);
    --card-soft: rgba(15,23,42,0.04);
    --shadow-glow: 0 10px 32px rgba(15, 23, 42, 0.16);
}

[data-theme="light"] body,
body[data-theme="light"] {
    background-color: var(--bg-main);
    color: var(--text-main);
}

[data-theme="light"] header,
[data-theme="light"] .sidebar-left,
[data-theme="light"] .sidebar-right,
[data-theme="light"] .modal-container {
    background: var(--bg-panel);
    border-color: var(--border);
}

[data-theme="light"] .metric-card,
[data-theme="light"] .legend-section,
[data-theme="light"] .chart-box,
[data-theme="light"] .zones-list-container,
[data-theme="light"] .zone-card,
[data-theme="light"] .btn-nav,
[data-theme="light"] .btn-action,
[data-theme="light"] .speed-control,
[data-theme="light"] .player-container {
    background: var(--card-soft);
    border-color: var(--border);
}

[data-theme="light"] .metric-value,
[data-theme="light"] #metric-pop,
[data-theme="light"] .modal-title,
[data-theme="light"] .panel-title {
    color: var(--text-main) !important;
}

[data-theme="light"] select,
[data-theme="light"] input,
[data-theme="light"] .nav10-floating-panel {
    color: var(--text-main) !important;
    background: var(--map-control-bg) !important;
    border-color: var(--border) !important;
}

.lab-control-section {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--card-soft);
}

.lab-control-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.lab-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.lab-segmented.wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lab-segmented button,
.lab-tool-btn {
    min-height: 36px;
    border: 1px solid var(--border-glass);
    border-radius: 9px;
    background: var(--bg-control);
    color: var(--text-main);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    transition: var(--transition-smooth);
}

.lab-segmented button.active,
.lab-tool-btn.active {
    background: var(--color-cyan);
    border-color: transparent;
    color: #070311;
    box-shadow: 0 0 14px rgba(0, 242, 254, 0.28);
}

.nav10-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.data-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-glass);
    background: var(--bg-control);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.data-badge.simulado { color: var(--color-yellow); }
.data-badge.campo { color: var(--color-cyan); }
.data-badge.estimado { color: var(--color-orange); }
.data-badge.oficial { color: #2ecc71; }
.data-badge.observado { color: #3498db; }

.nav10-floating-panel {
    position: absolute;
    top: 86px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: none;
    width: min(660px, calc(100vw - 36px));
    padding: 12px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--map-control-bg);
    box-shadow: var(--shadow-glow);
    backdrop-filter: blur(14px);
}

.nav10-floating-panel.active { display: block; }

.layer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.layer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: var(--bg-control);
    color: var(--text-main);
    font-size: 0.78rem;
}

.layer-toggle input { accent-color: var(--color-cyan); }

.method-note {
    margin-top: 10px;
    padding: 10px;
    border-left: 3px solid var(--color-yellow);
    border-radius: 8px;
    background: rgba(241, 196, 15, 0.08);
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.45;
}

.typology-key {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.typology-item {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.typology-symbol {
    width: 20px;
    height: 12px;
    border-radius: 3px;
    border: 2px solid currentColor;
    background-image: repeating-linear-gradient(45deg, currentColor 0 1px, transparent 1px 5px);
    opacity: 0.85;
}

.nav10-panel-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.nav10-panel-actions .lab-tool-btn {
    flex: 1 1 140px;
}

@media (max-width: 900px) {
    .nav10-floating-panel {
        top: auto;
        bottom: 72px;
        max-height: 58vh;
        overflow: auto;
    }
    .layer-grid,
    .lab-segmented.wrap {
        grid-template-columns: 1fr;
    }
    .lab-segmented button,
    .lab-tool-btn {
        min-height: 42px;
        font-size: 0.76rem;
    }
}

/* --- NAV10 TERRITORIAL GEOMETRY EDITOR --- */
.nav10-editor-section {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--card-soft, rgba(255,255,255,0.03));
}

.nav10-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.nav10-editor-grid .lab-tool-btn {
    min-height: 38px;
}

.nav10-editor-status {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.nav10-selected-geometry {
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.9));
}

.nav10-locked-geometry {
    opacity: 0.45 !important;
}

.nav10-move-cursor,
.nav10-move-cursor .leaflet-interactive {
    cursor: move !important;
}

@media (max-width: 900px) {
    .nav10-editor-grid {
        grid-template-columns: 1fr;
    }
}
/* --- NAV10 FIELD TEAMS --- */
.nav10-field-section {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--card-soft, rgba(255,255,255,0.03));
}

.nav10-field-form {
    display: grid;
    gap: 8px;
}

.nav10-field-form input,
.nav10-field-form select,
.nav10-field-form textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border-glass);
    border-radius: 9px;
    background: var(--bg-control);
    color: var(--text-main);
    padding: 8px 10px;
    font: inherit;
    font-size: 0.78rem;
    outline: none;
}

.nav10-field-form textarea {
    resize: vertical;
    min-height: 56px;
}

.nav10-field-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.nav10-field-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.nav10-field-card {
    padding: 10px;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: var(--bg-control);
}

.nav10-field-card-head {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 0.78rem;
}

.nav10-field-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.nav10-field-meta {
    margin: 6px 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.nav10-field-progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.nav10-field-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.nav10-field-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.nav10-field-actions button {
    min-height: 30px;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.nav10-field-marker {
    background: transparent;
    border: 0;
}

.nav10-field-marker span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    color: #070311;
    font: 800 0.72rem var(--font-display);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.nav10-field-place-cursor {
    cursor: crosshair !important;
}

@media (max-width: 900px) {
    .nav10-field-row,
    .nav10-field-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- NAV10 MAIN CREDIT --- */
.main-credit-badge {
    display: grid;
    gap: 2px;
    max-width: min(420px, 32vw);
    padding: 7px 16px;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
}

.main-credit-badge strong {
    color: var(--color-cyan);
    font-weight: 800;
}

.developer-credit {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .main-credit-badge {
        max-width: 100%;
        width: 100%;
        order: 2;
        text-align: center;
    }
}

/* Dark basemap filter for OpenStreetMap tiles (no API key required) */
.nav10-dark-tiles, .leaflet-tile-pane .nav10-dark-tiles { filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(92%) saturate(80%); }
