@media (max-width: 768px) {
    .hero .heading {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 13px;
    }

    .metrics.row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .metrics .col-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .metric-number {
        font-size: 1.4rem;
    }

    .metric-label {
        font-size: 11px;
    }
}

@media (max-width: 992px) {
    .app-frame {
        display: block !important;
        position: relative;
        height: calc(100dvh - 60px);
        overflow: visible !important;
    }

    .map-area {
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 58px !important;
        height: auto !important;
        overflow: hidden;
    }

    #map {
        width: 100%;
        height: 100%;
    }

    .mapboxgl-ctrl-bottom-right,
    .mapboxgl-ctrl-bottom-left {
        bottom: 68px !important;
    }
}

@media (max-width: 992px) {
    .left-panel,
    .right-panel {
        display: flex !important;
        flex-direction: column;
        position: fixed !important;
        bottom: 58px;
        left: 0;
        right: 0;
        width: 100%;
        height: 78vh;
        max-height: 78vh;
        z-index: 9000;
        border-radius: 18px 18px 0 0;
        border-top: 1px solid var(--light-line);
        box-shadow: 0 -6px 32px rgba(0,0,0,0.18);
        background: var(--card-bg);
        transform: translateY(calc(100% + 60px));
        transition: transform 0.32s cubic-bezier(.4,0,.2,1);
        overflow: hidden;
        pointer-events: auto;
    }

        .left-panel.drawer-open,
        .right-panel.drawer-open {
            transform: translateY(0);
        }

        .left-panel::before,
        .right-panel::before {
            content: '';
            display: block;
            width: 40px;
            height: 4px;
            background: var(--light-line);
            border-radius: 2px;
            margin: 10px auto 4px;
            flex-shrink: 0;
        }

        .left-panel > .panel-header,
        .right-panel > .panel-header,
        .left-panel > .tabs {
            flex-shrink: 0;
        }

        .left-panel > .stats-section,
        .right-panel > .layers-section {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
}

@media (max-width: 992px) {
    .drawer-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 58px;
        z-index: 8000;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

        .drawer-backdrop.visible {
            opacity: 1;
            visibility: visible;
            pointer-events: none;
        }
}

@media (max-width: 992px) {
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: var(--charcoal);
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: 10000;
        align-items: center;
        justify-content: space-around;
    }

    .mobile-tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 44px;
        background: transparent;
        border: none;
        color: rgba(255,255,255,0.5);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        cursor: pointer;
        transition: color 0.15s;
    }

        .mobile-tab-btn .tab-icon {
            font-size: 20px;
            line-height: 1;
        }

        .mobile-tab-btn.active {
            color: var(--sage-light);
        }
}

@media (max-width: 992px) {
    .panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .drawer-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: 1px solid var(--light-line);
        background: var(--cream);
        cursor: pointer;
        font-size: 14px;
        color: var(--mid);
        margin-left: 8px;
        flex-shrink: 0;
        line-height: 1;
    }
}

@media (min-width: 993px) {
    .mobile-tab-bar {
        display: none !important;
    }

    .drawer-close-btn {
        display: none !important;
    }

    .drawer-backdrop {
        display: none !important;
    }
}

@media (max-width: 992px) {
    .tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom: 1px solid var(--light-line);
        padding: 0 8px;
        flex-shrink: 0;
    }

        .tabs::-webkit-scrollbar {
            display: none;
        }

    .tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

        .tab-btn h4 {
            font-size: 11px;
        }
}

@media (max-width: 992px) {
    .stats-section {
        padding: 10px 10px 24px;
    }

    .stats-card {
        padding: 10px;
    }

    .stat-mini-val {
        font-size: 14px;
    }

    .chart-container canvas {
        max-height: 220px;
    }

    .layer-row {
        padding: 10px 8px;
        min-height: 44px;
    }

    .toggle {
        width: 36px;
        height: 20px;
    }

        .toggle::after {
            width: 16px;
            height: 16px;
        }

        .toggle.on::after {
            transform: translateX(16px);
        }

    .draw-btn {
        font-size: 12px;
        padding: 8px 6px;
    }

    .selected-chip {
        top: 8px;
        font-size: 10px;
        padding: 4px 12px;
        max-width: 80%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 768px) {
    .site-nav .container {
        padding: 0 12px;
    }

    .logo {
        font-size: 14px;
    }

    .service-2 img {
        height: 180px;
        object-fit: cover;
    }
}

body {
    overflow-x: hidden;
}
