/* landing.css - Map landing page styles */

/* Override site body defaults for full-bleed map layout */
.landing-page {
    --header-height: 86px;  /* logo 50px + padding 32px + border 4px */
    --statusbar-height: 34px;
    display: block;
    overflow: hidden;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.landing-page header {
    position: relative;
    z-index: 2000;
}

/* =========================================================================
   MAP
   ========================================================================= */

#map {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--statusbar-height);
    z-index: 1;
}

/* Leaflet controls — keep default light theme for the landing page */
.leaflet-control-zoom a {
    background: white !important;
    color: #333 !important;
    border-color: #ccc !important;
}

.leaflet-control-zoom a:hover {
    background: #f4f4f4 !important;
}

/* =========================================================================
   LRS DOWNLOAD BANNER
   ========================================================================= */

.lrs-download-banner {
    position: fixed;
    top: calc(var(--header-height) + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--surface-2);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.85rem;
    width: max-content;
    max-width: 90%;
}

.lrs-banner-btn {
    padding: 5px 16px;
    background: var(--accent);
    color: var(--surface-2);
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.lrs-banner-btn:hover {
    background: var(--accent-hover);
}

.lrs-banner-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* =========================================================================
   SEARCH BUTTON (floating on map)
   ========================================================================= */

.landing-search-btn,
.landing-tool-btn {
    position: fixed;
    right: 16px;
    z-index: 800;
    padding: 8px 16px;
    width: 190px;
    background: var(--surface-2);
    color: white;
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    text-align: left;
}

.landing-search-btn {
    top: calc(var(--header-height) + 10px);
}

.landing-search-btn:hover,
.landing-tool-btn:hover {
    background: var(--surface-3);
    transform: translateY(-1px);
    color: white;
}

/* =========================================================================
   STATE TOOLS (floating on map, below search button)
   ========================================================================= */

.tool-btn-stack {
    position: fixed;
    top: calc(var(--header-height) + 52px);
    right: 16px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.landing-tool-btn {
    position: static;
}

.landing-tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Report Bug Button (inline in status bar) */
.report-bug-btn {
    margin-left: auto;
    padding: 3px 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.report-bug-btn:hover {
    color: white;
    border-color: rgba(126, 200, 80, 0.5);
}

.landing-tool-btn:disabled:hover {
    background: var(--surface-2);
    transform: none;
}

/* =========================================================================
   SIDE PANEL (right, for tools like ROW lookup)
   ========================================================================= */

.side-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 50%;
    bottom: var(--statusbar-height);
    background: var(--surface-1);
    border-left: 1px solid rgba(126, 200, 80, 0.3);
    z-index: 900;
    display: none;
    flex-direction: column;
}

.side-panel.open {
    display: flex;
}

.side-panel-drag {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    bottom: 0;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
}

.side-panel-drag:hover,
.side-panel-drag.dragging {
    background: var(--accent);
}

.side-panel-close {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 10;
    background: rgba(26, 62, 99, 0.85);
    border: 1px solid var(--accent-dim);
    color: #F8FAFC;
    font-size: 1rem;
    cursor: pointer;
    padding: 1px 7px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0.85;
    width: 28px;
    text-align: center;
    box-sizing: border-box;
}

.side-panel-close:hover {
    opacity: 1;
    border-color: var(--accent);
}

.side-panel-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: var(--surface-1);
}

body.side-panel-dragging .side-panel-frame {
    pointer-events: none;
}

body.side-panel-dragging {
    cursor: col-resize;
    user-select: none;
}

body.side-panel-active #map {
    right: 50%;
}

/* Hide floating buttons when side panel is open */
body.side-panel-active .landing-search-btn,
body.side-panel-active .tool-btn-stack {
    display: none !important;
}


/* =========================================================================
   DESK CTA (floating on map, bottom-right)
   ========================================================================= */

.desk-cta {
    display: none;
}

/* =========================================================================
   STATUS BAR
   ========================================================================= */

#statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 34px;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--surface-2);
    color: rgba(255, 255, 255, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    border-top: 2px solid var(--accent);
    font-size: 0.95rem;
    overflow: hidden;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.status-fields {
    display: flex;
    align-items: center;
    height: 100%;
    flex: 1;
    min-width: 0;
    padding: 2px 0;
}

.status-field {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
}

.status-field-coords {
    border-right: none;
}

.status-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-text);
}

.status-value {
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: color 0.15s;
}

.status-value:hover {
    color: var(--accent);
}

.status-value.copied {
    color: var(--accent);
}

.status-message {
    position: absolute;
    left: 0;
    right: 250px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    background: var(--surface-2);
    pointer-events: none;
}

.status-message:empty {
    display: none;
}

.status-copyright {
    margin-left: auto;
    padding: 0 14px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================================================================
   SEARCH MODAL
   ========================================================================= */

.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 5000;
}

.search-modal {
    position: fixed;
    top: calc(var(--header-height) + 48px);
    right: 16px;
    background: var(--surface-2);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 5001;
    animation: pickerFadeIn 0.15s ease-out;
}

.search-modal-header {
    display: none;
}

.search-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.search-modal-close:hover {
    color: white;
}

.search-modal-body {
    padding: 8px 12px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.search-modal-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-modal-row label {
    width: auto;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: right;
}

.search-modal-row input {
    width: 70px;
    padding: 6px 8px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
}

.search-modal-row input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.search-modal-footer {
    display: none;
}

.search-modal-go {
    padding: 6px 18px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent);
    color: var(--surface-2);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-modal-go:hover {
    background: var(--accent-hover);
}

.search-modal-go-inline {
    display: block;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent);
    color: var(--surface-2);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

/* =========================================================================
   CROSS-SECTION PANEL (inside side-panel)
   ========================================================================= */

.section-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    overflow: hidden;
}

.section-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 60px 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.section-panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analyze-update-link {
    margin-left: 12px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.analyze-update-link:hover {
    text-decoration: underline;
    color: #9ade6a;
}


.section-panel-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-align: center;
    padding: 6px 0;
    min-height: 18px;
    flex-shrink: 0;
}

.section-chart-container {
    flex: 1;
    position: relative;
    padding: 0 12px 8px;
    min-height: 0;
}

.section-panel-bottom {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.section-table-header {
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.section-table-wrap {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.section-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
}

.section-table-wrap th {
    position: sticky;
    top: 0;
    background: var(--surface-1);
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--accent-text);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.section-table-wrap td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.section-table-wrap tr:hover {
    background: rgba(126, 200, 80, 0.08);
}

.section-table-wrap tr.parcel-highlighted {
    background: rgba(232, 124, 30, 0.15);
}

.section-table-wrap a {
    color: var(--accent);
    text-decoration: none;
}

.section-table-wrap a:hover {
    text-decoration: underline;
}

.section-data-wrap {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

.section-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    padding: 8px 12px;
}

.section-data-col {
    padding: 0 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.section-data-col:last-child {
    border-right: none;
}

.section-data-col-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(126, 200, 80, 0.15);
}

.section-data-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1px 0;
    font-size: 0.73rem;
    line-height: 1.2;
}

.section-data-label {
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}


.section-data-value {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: right;
}

.section-data-value.loading {
    color: var(--accent-text);
    font-style: italic;
}

.section-data-value.nodata {
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

.section-data-value.error {
    color: var(--error-text);
}


.section-expand-btn {
    position: absolute;
    top: 6px;
    right: 40px;
    z-index: 10;
    background: rgba(26, 62, 99, 0.85);
    border: 1px solid var(--accent-dim);
    color: #F8FAFC;
    font-size: 1rem;
    cursor: pointer;
    padding: 1px 7px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0.85;
    width: 28px;
    text-align: center;
    box-sizing: border-box;
}

.section-expand-btn:hover {
    opacity: 1;
    border-color: var(--accent);
}

.section-panel-bottom {
    position: relative;
}

.section-source {
    padding: 2px 12px 4px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.section-panel-top {
    position: relative;
}

/* Expanded cross-section modal overlay */
.section-expand-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-expand-modal {
    background: var(--surface-1);
    border: 1px solid var(--accent-dim);
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    width: 90vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-expand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.section-expand-close {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
}

.section-expand-close:hover {
    color: white;
    border-color: var(--accent);
}

.section-expand-chart {
    flex: 1;
    position: relative;
    padding: 8px 16px;
    min-height: 0;
}

/* =========================================================================
   PARCEL LABELS (on map for ROW results)
   ========================================================================= */

.parcel-label {
    background: none !important;
    border: none !important;
}

.parcel-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--surface-2);
    color: var(--accent);
    border: 2px solid var(--surface-3);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
}

/* =========================================================================
   ROW SLIDER NODE + INFO CARD
   ========================================================================= */

.row-slider-node {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(126, 200, 80, 0.5), 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: grab;
    transition: box-shadow 0.15s;
}

.row-slider-node:hover {
    box-shadow: 0 0 0 4px rgba(126, 200, 80, 0.4), 0 2px 12px rgba(0, 0, 0, 0.6);
}

.row-slider-card {
    position: fixed;
    top: calc(var(--header-height) + 10px);
    right: calc(50% + 10px);
    z-index: 800;
    background: rgba(26, 62, 99, 0.94);
    border: 1px solid rgba(126, 200, 80, 0.5);
    border-radius: 8px;
    padding: 10px 16px;
    color: #f8fafc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.row-slider-card-widths {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
}

.row-card-line { white-space: nowrap; }
.row-card-left { color: #60a5fa; }
.row-card-right { color: #4ade80; }
.row-card-total { color: #f8fafc; font-weight: 700; }
.row-card-sep { font-size: 11px; color: #94a3b8; font-weight: 400; }

/* =========================================================================
   PICK PINS (coordinate picking from map)
   ========================================================================= */

.pick-pin {
    background: none !important;
    border: none !important;
    font-size: 20px;
    line-height: 1;
}

/* =========================================================================
   PICKER (route type / direction selection)
   ========================================================================= */

.picker-panel {
    position: fixed;
    top: calc(var(--header-height) + 94px);
    right: 16px;
    background: var(--surface-2);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 5100;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    min-width: 180px;
    max-width: 260px;
    max-height: 60vh;
    overflow-y: auto;
    animation: pickerFadeIn 0.15s ease-out;
}

@keyframes pickerFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.picker-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-text);
    padding: 2px 14px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

.picker-options {
    display: flex;
    flex-direction: column;
}

.picker-btn {
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.1s;
}

.picker-btn:hover {
    background: rgba(126, 200, 80, 0.2);
    color: var(--accent);
}

/* =========================================================================
   STATE LAYER TOOLTIP
   ========================================================================= */

.state-tooltip {
    background: var(--surface-2) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 4px !important;
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.state-tooltip.state-tooltip-active {
    color: white !important;
    border-color: rgba(126, 200, 80, 0.4) !important;
}

.state-tooltip::before {
    border-top-color: var(--surface-2) !important;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

/* Tab bar — hidden on desktop, shown on mobile */
.section-tab-bar {
    display: none;
}

/* On desktop, parcels content always visible, tab switching disabled */
#section-tab-parcels-content {
    display: block;
}

/* Persistent map container — not used on desktop */
.section-map-persistent {
    display: none;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* Hamburger menu */
    .nav-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
    }

    .nav-container nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface-2);
        border-top: 1px solid rgba(126, 200, 80, 0.3);
        flex-direction: column;
        z-index: 3000;
        box-shadow: var(--shadow-lg);
    }

    .nav-container nav.nav-open {
        display: flex;
    }

    .nav-container nav a {
        padding: 12px 20px;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        font-size: 0.9rem;
    }

    .nav-container {
        position: relative;
    }

    /* Compact status bar */
    #statusbar {
        height: 26px;
        font-size: 0.8rem;
        padding: 0;
        margin: 0;
        border-top-width: 1px;
        box-sizing: border-box;
    }

    .landing-page {
        --statusbar-height: 26px;
    }

    /* Hide source disclosures and section headers on mobile */
    .section-source,
    .section-table-header {
        display: none;
    }

    /* Collapse Leaflet attribution to minimize footer area */
    /* Leaflet controls stay left on full map, move right when side panel open */
    body.side-panel-active .leaflet-top.leaflet-left {
        left: auto;
        right: 10px;
    }

    .leaflet-control-attribution {
        font-size: 0;
        padding: 1px 4px;
        line-height: 1;
        max-height: 14px;
        overflow: hidden;
    }

    .leaflet-control-attribution a,
    .leaflet-control-attribution span {
        font-size: 8px;
    }

    .status-field {
        padding: 0 6px;
    }

    .status-label {
        display: none;
    }

    /* Hide Elevation (4th), Offset (5th), Coordinates (6th) — keep Route, MP, Direction */
    .status-field:nth-child(n+4) {
        display: none;
    }

    /* Tool buttons — narrower, smaller font */
    .landing-search-btn,
    .landing-tool-btn {
        right: 10px;
        font-size: 0.75rem;
        padding: 6px 10px;
        width: 150px;
    }

    .landing-search-btn {
        top: calc(var(--header-height) + 6px);
    }

    .tool-btn-stack {
        top: calc(var(--header-height) + 40px);
        right: 10px;
    }

    /* Search modal — position tweak for mobile */
    .search-modal {
        top: calc(var(--header-height) + 38px);
        right: 10px;
    }

    .search-modal-row input {
        width: 50px;
        padding: 5px 6px;
        font-size: 0.8rem;
    }

    .search-modal-row label {
        font-size: 0.65rem;
    }

    /* Picker panel */
    .picker-panel {
        top: calc(var(--header-height) + 74px);
        right: 10px;
    }


    /* Side panel — full width on mobile, map hidden (accessible via Map tab) */
    .side-panel {
        width: 100%;
        border-left: none;
    }

    body.side-panel-active #map {
        right: 100%;
    }

    /* Hide drag handle on mobile */
    .side-panel-drag {
        display: none;
    }

    /* Close button — no mobile override, matches expand button */

    /* Section panel — compact for peek mode */
    .section-panel-top {
        flex: 2;
    }

    .section-panel-bottom {
        flex: 3;
    }

    .section-panel-header {
        padding: 6px 50px 6px 12px;
    }

    .section-panel-title {
        font-size: 0.75rem;
    }

    /* Tab bar — 3-tab layout: Section | Parcels | Data */
    .section-tab-bar {
        display: flex;
        flex-shrink: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .section-tab {
        flex: 1;
        padding: 6px 0;
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        transition: color 0.15s;
    }

    .section-tab.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

    .section-tab:not(.active):hover {
        color: rgba(255, 255, 255, 0.7);
    }

    /* Mobile section panel: top content + tab bar + persistent map bottom */
    .section-panel {
        display: flex;
        flex-direction: column;
    }

    /* Top content area — chart (section-panel-top) OR parcels/data content */
    .section-panel-top {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    /* Parcels/data content area — shown when their tab is active */
    .section-panel-bottom {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    #section-tab-parcels-content {
        display: none;
    }

    #section-tab-parcels-content.active {
        display: block;
    }

    /* Mobile: use grid so all areas maintain their size */
    .section-panel {
        display: grid !important;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 1fr;
    }

    .section-panel-header { display: none; }

    /* Both top and bottom occupy the first row, stacked via grid-row */
    .section-panel-top {
        grid-row: 1;
        grid-column: 1;
        min-height: 0;
        overflow: hidden;
    }

    .section-panel-bottom {
        grid-row: 1;
        grid-column: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .section-tab-bar {
        grid-row: 2;
        grid-column: 1;
    }

    .section-map-persistent {
        grid-row: 3;
        grid-column: 1;
        min-height: 0;
    }

    /* Tab switching: show/hide via z-index and visibility in the shared top row */
    .section-panel.mobile-tab-section .section-panel-top { z-index: 2; visibility: visible; }
    .section-panel.mobile-tab-section .section-panel-bottom { z-index: 1; visibility: hidden; }

    .section-panel.mobile-tab-parcels .section-panel-top { z-index: 1; visibility: hidden; }
    .section-panel.mobile-tab-parcels .section-panel-bottom { z-index: 2; visibility: visible; padding-top: 32px; }

    .section-panel.mobile-tab-data .section-panel-top { z-index: 1; visibility: hidden; }
    .section-panel.mobile-tab-data .section-panel-bottom { z-index: 2; visibility: visible; }

    /* Better touch scrolling for parcel table on mobile */
    .section-table-wrap {
        -webkit-overflow-scrolling: touch;
        overflow-x: scroll;
    }

    .section-table-wrap table {
        min-width: 600px;
    }

    /* Persistent map container on bottom — always visible */
    .section-map-persistent {
        display: flex;
        flex: 1;
        min-height: 0;
        position: relative;
    }

    /* Compact parcel table on mobile */
    .section-table-wrap table {
        font-size: 0.65rem;
    }

    .section-table-wrap th {
        padding: 3px 5px;
        font-size: 0.6rem;
    }

    .section-table-wrap td {
        padding: 2px 5px;
    }

    /* Data grid — single column */
    .section-data-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .section-data-col {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding-bottom: 8px;
    }

    .section-data-col:last-child {
        border-bottom: none;
    }

    /* Parcel table — horizontal scroll */
    .section-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .desk-cta {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Status bar — show only Route and MP, hide Direction too */
    .status-field:nth-child(n+3) {
        display: none;
    }

    #statusbar {
        height: 22px;
        padding: 0;
        font-size: 0.75rem;
    }

    .landing-page {
        --statusbar-height: 22px;
    }

    .status-copyright {
        font-size: 0.6rem;
        padding: 0 8px;
    }

    /* Header — smaller logo and nav */
    .landing-page .logo img {
        height: 36px;
    }

    .landing-page header {
        padding: 0.5rem 0;
    }

    .landing-page .nav-container {
        padding: 0 10px;
    }

    .landing-page nav a {
        font-size: 0.75rem;
        padding: 0 8px;
    }

    /* Recalculate header height: logo 36px + padding 16px + border 4px = 56px */
    .landing-page {
        --header-height: 56px;
    }

    /* Tool buttons — smaller, abbreviated */
    .landing-search-btn,
    .landing-tool-btn {
        right: 8px;
        font-size: 0.7rem;
        padding: 5px 8px;
        width: 130px;
    }

    .landing-search-btn {
        top: calc(var(--header-height) + 4px);
    }

    .tool-btn-stack {
        top: calc(var(--header-height) + 34px);
        right: 8px;
    }

    /* Search modal — right below search button */
    .search-modal {
        top: calc(var(--header-height) + 34px);
    }

    /* Data panel — smaller on phone */
    /* Picker panel — full width */
    .picker-panel {
        top: calc(var(--header-height) + 64px);
        right: 8px;
        left: 8px;
        max-width: none;
    }

    /* LRS download banner — stack vertically on small screens */
    .lrs-download-banner {
        flex-direction: column;
        gap: 6px;
        font-size: 0.78rem;
        padding: 8px 14px;
        text-align: center;
    }

    /* ROW slider card — smaller on mobile */
    .row-slider-card {
        top: calc(50% + 40px);
        right: auto;
        bottom: auto;
        left: 8px;
        padding: 4px 8px;
        z-index: 3000;
        border-radius: 4px;
    }

    .row-slider-card-widths {
        font-size: 10px;
        flex-direction: column;
        gap: 1px;
    }

    /* Status message — clear space for report btn + copyright */
    .status-message {
        right: 180px;
        font-size: 0.8rem;
    }

    /* Report bug button — smaller */
    .report-bug-btn {
        padding: 2px 6px;
        font-size: 0.65rem;
    }
}
