/* ============================================================
   2026 LAYOUT — loaded after style.css (overrides it)
   ------------------------------------------------------------
   Stage 1: the new shell + Dashboard + Hub.
   - Desktop (≥ 768 px): the header becomes a slim strip down the left
     edge holding the logo, Map / Dashboard / Hub, and account controls.
     The map fills the whole screen; the field list floats on the left
     and the field panel (#map-lower-panels: trend, image history,
     Zones, Land) slides in on the right when a field is open (shell.js).
   - Softer, rounder look everywhere via the shared radius/shadow tokens.
   When the layout is signed off, these rules fold into style.css and
   the rules they replace are deleted.
   ============================================================ */

/* Computers only (≥ 768 px). Phones keep the original design untouched —
   the only phone rules are at the end of this file and just hide the new
   pieces of markup (decided 2026-11-23). */
@media (min-width: 768px) {

:root {
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-glow-emerald: none;
    --shadow-glow-red: none;
    --shadow-glow-amber: none;
    --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.32);

    /* Chrome (rail, tab bar) — instrument tier: dark in both themes */
    --glass-bg: rgba(16, 16, 18, 0.82);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 10px 36px rgba(0, 0, 0, 0.38);
    /* Panels over the map — content tier: follow the theme */
    --panel-bg: rgba(16, 16, 18, 0.86);
    --accent-text: #E0BE90; /* bronze, lightened for small text on dark */
    --card-bg: #141416;         /* content cards — follow the theme */
    --instrument-card: #141416; /* gauge / conditions — dark in both themes */
    --day-bg: rgba(255, 255, 255, 0.04); /* Hub day cells */

    --rail-w: 76px;
    --edge: 12px;
    --sidebar-w: 300px;
    --panel-w: clamp(340px, 30vw, 420px);
}

html.light-theme {
    --panel-bg: rgba(255, 255, 255, 0.92);
    --card-bg: #ffffff;
    --day-bg: #ffffff;
}

/* Quiet the old neon: no glows on active states */
.nav-item.active svg,
.nav-item.active .nav-icon { filter: none; }
.status-dot { box-shadow: none; }
.map-history-panel::before { display: none; }

/* ---------- Phone "+" button (hidden on desktop) ---------- */
.quick-log-btn { display: none; }

/* ============================================================
   DESKTOP / TABLET
   ============================================================ */
@media (min-width: 768px) {
    :root {
        --nav-height: 0px;
        --header-height: 0px;
    }

    body {
        padding-bottom: 0;
        padding-inline-start: calc(var(--rail-w) + var(--edge) * 2);
    }

    /* ---------- Left strip (the old header) ---------- */
    #app-main .app-header {
        position: fixed;
        z-index: 200;
        inset-inline-start: var(--edge);
        top: var(--edge);
        bottom: var(--edge);
        width: var(--rail-w);
        height: auto;
        box-sizing: border-box;
        flex-direction: column;
        justify-content: space-between;
        padding: 14px 0;
        background: var(--glass-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border: 1px solid var(--glass-border);
        border-radius: 18px;
        box-shadow: var(--glass-shadow);
    }

    #app-main .app-header .brand {
        flex-direction: column;
        gap: 6px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .brand-icon { width: 40px; height: 40px; border-radius: 10px; }
    .brand-name, .brand-tagline, .app-accent-dot { display: none; }
    .brand-plan,
    .brand-upgrade {
        margin: 0;
        font-size: 9px;
        letter-spacing: 0.06em;
        padding: 2px 7px;
    }

    .header-end {
        flex-direction: column;
        gap: 10px;
    }
    .status-group { align-items: center; }
    .sync-time { display: none; }
    .connectivity-block .status-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .theme-toggle {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        border-color: rgba(255, 255, 255, 0.12);
    }
    .user-badge {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        font-size: 13px;
    }

    /* The nav links sit inside the strip, under the logo */
    .bottom-nav {
        top: 150px;
        bottom: auto;
        left: var(--edge);
        right: auto;
        width: var(--rail-w);
        height: auto;
        flex-direction: column;
        justify-content: flex-start;
        gap: 6px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 201;
    }
    [dir="rtl"] .bottom-nav { left: auto; right: var(--edge); }
    body.has-notes-fab .bottom-nav { padding-inline-end: 0; }

    .nav-item {
        width: 64px;
        min-width: 0;
        padding: 8px 0 7px;
        border-radius: 14px;
        gap: 4px;
    }
    .nav-item span {
        font-family: var(--font-family);
        font-size: 11px;
        line-height: 1.15;
        text-align: center;
    }
    .nav-item.active {
        background: rgba(var(--app-accent-rgb), 0.22);
        color: var(--accent-text);
    }
    .nav-item.active svg { stroke: currentColor; }
    #nav-settings { display: none; } /* Settings = the account button */

    /* Farm notes button joins the strip, above the account controls */
    .notes-fab {
        inset-inline-start: calc(var(--edge) + (var(--rail-w) - 40px) / 2);
        right: auto;
        bottom: 168px;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: transparent;
        color: #CFCFCF;
        box-shadow: none;
        z-index: 202;
    }
    [dir="ltr"] .notes-fab { left: calc(var(--edge) + (var(--rail-w) - 40px) / 2); }
    [dir="rtl"] .notes-fab { left: auto; right: calc(var(--edge) + (var(--rail-w) - 40px) / 2); }
    .notes-fab:hover { background: rgba(255, 255, 255, 0.06); filter: none; }
    .notes-panel {
        left: calc(var(--rail-w) + var(--edge) * 2);
        right: auto;
        bottom: var(--edge);
        border-radius: var(--radius-xl);
    }
    [dir="rtl"] .notes-panel { left: auto; right: calc(var(--rail-w) + var(--edge) * 2); }

    /* Banners float at the top instead of pushing the map down */
    .demo-banner {
        position: fixed;
        top: var(--edge);
        left: 50%;
        transform: translateX(-50%);
        z-index: 300;
        margin: 0;
        max-width: min(640px, 70vw);
        box-shadow: var(--glass-shadow);
    }

    /* Christmas garland is drawn for the old wide header */
    .season-garland { display: none; }

    /* ---------- Full-screen map ---------- */
    #view-map.active-view {
        position: fixed;
        inset: 0;
        height: 100dvh !important;
        z-index: 1;
        animation: none;
        /* Clear space between the floating panels — used by the map's own
           controls below and by map.js coverPanels() via the same widths */
        --map-left: calc(var(--rail-w) + var(--edge) * 2);
        --map-right: var(--edge);
    }
    #view-map.active-view:has(.map-sidebar:not(.collapsed)) {
        --map-left: calc(var(--rail-w) + var(--edge) * 3 + var(--sidebar-w));
    }
    #view-map.active-view:has(.map-sidebar.collapsed) {
        --map-left: calc(var(--rail-w) + var(--edge) * 2 + 52px);
    }
    body.field-panel-open #view-map.active-view {
        --map-right: calc(var(--panel-w) + var(--edge) * 2);
    }

    #view-map .map-view-layout,
    #view-map .map-view-layout.map-view-layout--resized {
        position: absolute;
        inset: 0;
        flex: none !important;
    }
    #view-map .map-wrapper {
        position: absolute;
        inset: 0;
    }
    .map-wrapper .map-container {
        inset: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .map-resize-handle { display: none !important; }

    /* Field list — floating panel that slides off to the left */
    .map-sidebar {
        position: absolute;
        z-index: 20;
        inset-inline-start: calc(var(--rail-w) + var(--edge) * 2);
        top: var(--edge);
        bottom: var(--edge);
        width: var(--sidebar-w);
        min-width: var(--sidebar-w);
        max-width: var(--sidebar-w);
        margin: 0;
        border-radius: 18px;
        border: 1px solid var(--glass-border);
        background: var(--panel-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--glass-shadow);
        transition: transform 250ms ease, opacity 250ms ease;
    }
    .map-sidebar.collapsed {
        width: var(--sidebar-w) !important;
        min-width: var(--sidebar-w) !important;
        margin: 0 !important;
        border: 1px solid var(--glass-border);
        transform: translateX(calc(-100% - var(--rail-w)));
    }
    [dir="rtl"] .map-sidebar.collapsed { transform: translateX(calc(100% + var(--rail-w))); }

    #sidebar-open-btn {
        top: var(--edge) !important;
        left: calc(var(--rail-w) + var(--edge) * 2) !important;
        width: 44px;
        height: 44px;
        border-radius: 12px !important;
        background: var(--glass-bg) !important;
        border: 1px solid var(--glass-border) !important;
        box-shadow: var(--glass-shadow);
    }
    [dir="rtl"] #sidebar-open-btn { left: auto !important; right: calc(var(--rail-w) + var(--edge) * 2) !important; }

    /* Map toolbars, legend and info live in the clear space */
    .map-wrapper .map-toolbar-stack {
        top: var(--edge);
        left: var(--map-left);
        right: var(--map-right);
        transition: left 250ms ease, right 250ms ease;
    }
    .map-wrapper #satellite-date-pill { top: var(--edge); right: var(--map-right); }
    .map-wrapper .index-switcher {
        background: var(--glass-bg);
        border-color: var(--glass-border);
        box-shadow: var(--glass-shadow);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }
    .map-wrapper .index-panel {
        left: var(--map-left);
        bottom: var(--edge);
        background: var(--glass-bg);
        box-shadow: var(--glass-shadow);
        transition: left 250ms ease;
    }
    .map-wrapper .index-info-panel {
        left: auto;
        right: var(--map-right);
        top: calc(var(--edge) + 108px);
        transition: right 250ms ease;
    }
    /* Map buttons + credits move to the top right: the bottom belongs to
       the layer bar and timeline */
    .map-container .maplibregl-ctrl-bottom-right {
        right: var(--map-right);
        top: var(--edge);
        bottom: auto;
        transition: right 250ms ease;
    }
    .boundary-edit-panel,
    .guided-select-panel {
        left: var(--map-left);
        top: calc(var(--edge) + 96px);
        border-radius: var(--radius-xl);
    }
    [dir="rtl"] .map-wrapper .map-toolbar-stack { left: var(--map-right); right: var(--map-left); }
    [dir="rtl"] .map-wrapper .index-panel { left: auto; right: var(--map-left); }
    [dir="rtl"] .map-wrapper .index-info-panel { right: auto; left: var(--map-right); }

    /* ---------- Field panel (right) ---------- */
    #view-map .map-lower-panels,
    #view-map .map-lower-panels.map-lower-panels--compressed {
        position: absolute;
        z-index: 30;
        top: var(--edge);
        bottom: var(--edge);
        inset-inline-end: var(--edge);
        width: var(--panel-w);
        flex: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--panel-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border: 1px solid var(--glass-border);
        border-radius: 18px;
        box-shadow: var(--glass-shadow);
        transform: translateX(calc(100% + var(--edge) * 2));
        visibility: hidden;
        transition: transform 250ms ease, visibility 0s linear 250ms;
    }
    [dir="rtl"] #view-map .map-lower-panels { transform: translateX(calc(-100% - var(--edge) * 2)); }
    body.field-panel-open #view-map .map-lower-panels {
        transform: none;
        visibility: visible;
        transition: transform 250ms ease, visibility 0s;
    }

    .field-panel-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px 10px;
    }
    .field-panel-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
    .field-panel-name {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--color-text-primary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .field-panel-meta { font-size: 13px; color: var(--color-text-secondary); }
    .field-panel-close {
        flex-shrink: 0;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 1px solid var(--color-border-strong);
        background: transparent;
        color: var(--color-text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .field-panel-close:hover { color: var(--color-text-primary); background: var(--color-hover-tint); }

    /* Panels inside it lose their own card chrome and stack with dividers */
    .map-lower-panels .map-history-panel,
    .map-lower-panels .zones-panel {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-top: 0;
        border-bottom: 1px solid var(--color-border-subtle);
        padding: 16px 18px;
        overflow: visible;
    }

    /* "Field details" — reopens the panel after its ✕ */
    .field-panel-reopen {
        display: none;
        position: absolute;
        z-index: 25;
        top: var(--edge);
        inset-inline-end: calc(var(--edge) + 120px);
        height: 40px;
        padding: 0 12px 0 14px;
        border-radius: 12px;
        border: 1px solid var(--glass-border);
        background: var(--glass-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--glass-shadow);
        color: #EDEDED;
        font: 500 13px var(--font-family);
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }
    body.field-panel-closed .field-panel-reopen { display: flex; }
    .field-panel-reopen svg { order: -1; }
    [dir="rtl"] .field-panel-reopen svg { transform: scaleX(-1); }
}

/* Phones keep the original map page: panels flow under the map, no tabs */


@media (prefers-reduced-motion: reduce) {
    .map-sidebar,
    #view-map .map-lower-panels,
    .map-wrapper .map-toolbar-stack,
    .map-wrapper .index-panel,
    .map-wrapper .index-info-panel,
    .map-container .maplibregl-ctrl-bottom-right { transition: none !important; }
}


/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px 16px;
    flex-wrap: wrap;
    padding: 12px 0 4px;
}
.dash-head-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dash-date { font-size: 13px; color: var(--color-text-muted); }
.dash-field-name {
    margin: 0;
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}
.dash-field-meta { font-size: 13px; color: var(--color-text-secondary); }
.dash-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--color-border-strong);
    background: transparent;
    color: var(--color-text-primary);
    font: 500 14px var(--font-family);
    cursor: pointer;
}
.dash-btn:hover { background: var(--color-hover-tint); }
.dash-btn--primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    font-weight: 600;
}
.dash-btn--primary:hover { background: var(--app-accent); filter: brightness(1.1); }

.dash-fields {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    margin: 10px 0 6px;
    scrollbar-width: thin;
}
.dash-fields[hidden] { display: none; }
.dash-field {
    flex: 0 0 210px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--color-border-subtle);
    background: var(--card-bg);
    color: var(--color-text-primary);
    text-align: start;
    font-family: var(--font-family);
    cursor: pointer;
}
.dash-field:hover { border-color: var(--color-border-strong); }
.dash-field.is-active {
    border-color: rgba(var(--app-accent-rgb), 0.6);
    background: rgba(var(--app-accent-rgb), 0.14);
}
.dash-field-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dash-field-name-sm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-field-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-field-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dash-field-ndvi { font-family: var(--font-tech); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Cards: one calm style — no coloured top stripes, no lift on hover */
.gauge-section {
    background: var(--instrument-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    margin-top: 6px;
    padding: 24px;
}
.gauge-value { text-shadow: none; }
.gauge-note { border-radius: 12px; }
.stat-card {
    background: var(--instrument-card);
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.stat-card:hover { background: var(--instrument-card); }
.actions-section .action-card {
    background: var(--card-bg);
    border: 1px solid var(--color-border-subtle);
    border-radius: 18px;
    padding: 20px;
    cursor: default;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.actions-section .action-card::before { display: none; }
.actions-section .action-card:hover { transform: none; background: var(--card-bg); }
.advisory-card.monitor { border-color: rgba(255, 171, 0, 0.35); }
.advisory-card.irrigate { border-color: rgba(255, 23, 68, 0.35); }
.advisory-card .advisory-action { text-shadow: none; }
.card-header { margin-bottom: 12px; }
.card-header-label { font-size: 12px; letter-spacing: 0.06em; }

@media (min-width: 768px) {
    #view-dashboard {
        padding: 20px 28px 40px;
        max-width: 1480px;
        margin: 0 auto;
        box-sizing: border-box;
    }
    .stats-section { gap: 14px; padding: 14px 0; }
    .actions-section {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 14px;
        padding: 0;
    }
}


/* ============================================================
   HUB (calendar.js draws it; these restyle it)
   ============================================================ */
@media (min-width: 768px) {
    #view-calendar .cal-view {
        padding: 24px 28px 32px;
        max-width: 1480px;
        margin: 0 auto;
        box-sizing: border-box;
    }
}
.cal-header { gap: 14px; margin-bottom: 16px; }
.cal-field-bar {
    border-bottom: 0;
    padding-bottom: 0;
    gap: 6px 14px;
}
.cal-field-select {
    appearance: none;
    -webkit-appearance: none;
    max-width: 100%;
    padding: 2px 34px 2px 0;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 4px center / 20px;
    border: 0;
    border-radius: 8px;
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 600;
    letter-spacing: -0.02em;
}
[dir="rtl"] .cal-field-select { padding: 2px 0 2px 34px; background-position: left 4px center; }
.cal-field-select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.cal-field-area, .cal-field-crop, .cal-field-nocrop { font-size: 13px; color: var(--color-text-secondary); }

.cal-header-controls { gap: 10px 12px; }
.cal-add-pill { margin-inline-start: auto; }
.cal-nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: transparent;
}
.cal-month-label { font-size: 18px; font-weight: 600; min-width: 8.5em; }
.cal-view-toggle {
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
    background: var(--card-bg);
    border: 1px solid var(--color-border-subtle);
    box-shadow: none;
}
.cal-view-btn { border-radius: 9px; padding: 7px 14px; font-size: 13px; }
.cal-view-btn.is-active {
    background: var(--app-accent);
    color: #fff;
    font-weight: 600;
    box-shadow: none;
}
.cal-add-pill {
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: none;
}
.cal-weekday { font-size: 12px; color: var(--color-text-muted); padding: 0 4px; text-align: start; }
.cal-grid, .cal-weekdays { gap: 6px; }
.cal-day {
    min-height: 104px;
    padding: 8px;
    gap: 4px;
    border: 0;
    border-radius: 12px;
    background: var(--day-bg);
}
.cal-day:hover { background: var(--color-hover-tint); }
.cal-day--other-month { opacity: 0.35; }
.cal-day--today {
    border: 0;
    background: rgba(var(--app-accent-rgb), 0.10);
    box-shadow: inset 0 0 0 1.5px rgba(var(--app-accent-rgb), 0.85);
}
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--color-text-primary); }
.cal-day--today .cal-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--app-accent);
    color: #fff;
}
.cal-event-chip { border-radius: 6px; font-size: 11px; padding: 3px 7px; }


/* ============================================================
   MAP — fixes after the first preview
   ============================================================ */
@media (min-width: 768px) {
    /* The field's image date now sits under its name in the field panel */
    .field-panel-title .index-date-chip {
        position: static;
        align-self: flex-start;
        margin-top: 6px;
    }
    /* Toolbar rows scroll sideways inside the clear space rather than spill */
    .map-wrapper .map-toolbar-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
    .map-wrapper .map-toolbar-stack .index-switcher { max-width: 100%; box-sizing: border-box; }
    /* "About this index" sits low on the right, clear of the map's middle */
    .map-wrapper .index-info-panel {
        top: auto;
        bottom: calc(var(--edge) + 96px);
        width: min(300px, 32vw);
        max-height: calc(100% - 260px);
    }
    /* Field panel: give the trend chart room */
    .map-lower-panels .map-history-svg { height: 190px; }
}


/* ============================================================
   MAP — layer bar, timeline, field panel tabs (stage 2 + 4)
   ============================================================ */
:root { --tile-bg: rgba(255, 255, 255, 0.045); }
html.light-theme { --tile-bg: rgba(15, 23, 42, 0.04); }

.map-bottom { display: none; }

@media (min-width: 768px) {
    /* The old top bars are emptied into the layer bar (shell.js) */
    body.map-dock-on #index-switcher,
    body.map-dock-on #view-toggle-switcher { display: none; }

    .map-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        position: absolute;
        z-index: 15;
        left: var(--map-left);
        right: var(--map-right);
        bottom: var(--edge);
        pointer-events: none;
        transition: left 250ms ease, right 250ms ease;
    }
    .map-bottom > * { pointer-events: auto; }

    /* ---------- Layer bar ---------- */
    .map-dock {
        display: flex;
        align-items: center;
        gap: 2px;
        max-width: 100%;
        padding: 4px;
        box-sizing: border-box;
        border-radius: 14px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--glass-shadow);
    }
    .dock-index { position: relative; flex-shrink: 0; }
    .dock-index-btn {
        height: 36px;
        padding: 0 10px 0 14px;
        border: 0;
        border-radius: 10px;
        background: var(--app-accent);
        color: #fff;
        font: 600 13px var(--font-family);
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }
    .dock-index-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
    .dock-index-menu {
        position: absolute;
        bottom: calc(100% + 10px);
        inset-inline-start: -4px;
        min-width: 220px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 6px;
        border-radius: 14px;
        background: rgba(16, 16, 18, 0.94);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--glass-shadow);
    }
    .dock-index-menu[hidden] { display: none; }
    .dock-index-menu .index-pill {
        width: 100%;
        justify-content: flex-start;
        text-align: start;
        padding: 9px 12px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #EDEDED;
        font-size: 14px;
        box-shadow: none;
    }
    .dock-index-menu .index-pill:hover { background: rgba(255, 255, 255, 0.07); }
    .dock-index-menu .index-pill.active {
        background: rgba(var(--app-accent-rgb), 0.28);
        color: var(--accent-text);
        font-weight: 600;
    }
    .dock-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: rgba(255, 255, 255, 0.12); flex-shrink: 0; }
    .dock-layers {
        display: flex;
        gap: 2px;
        overflow-x: auto;
        scrollbar-width: none;
        min-width: 0;
    }
    .dock-layers::-webkit-scrollbar { display: none; }
    .dock-layers .index-pill {
        height: 36px;
        padding: 0 12px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #CFCFCF;
        font-size: 13px;
        white-space: nowrap;
        box-shadow: none;
    }
    .dock-layers .index-pill:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
    .dock-layers .index-pill.active {
        background: rgba(var(--app-accent-rgb), 0.28);
        color: var(--accent-text);
    }

    /* ---------- Timeline ---------- */
    .map-timeline {
        width: min(640px, 100%);
        box-sizing: border-box;
        padding: 10px 12px 8px;
        border-radius: 16px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--glass-shadow);
        color: #EDEDED;
    }
    .map-timeline[hidden] { display: none; }
    .tl-head { display: flex; justify-content: space-between; gap: 10px; padding: 0 6px 6px; font-size: 12px; }
    .tl-title { color: #A8A8A8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tl-shown { color: var(--accent-text); white-space: nowrap; font-weight: 500; }
    .tl-row { display: flex; align-items: flex-start; gap: 4px; }
    .tl-step {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        border-radius: 9px;
        border: 0;
        background: transparent;
        color: #CFCFCF;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .tl-step:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
    .tl-step:disabled { opacity: 0.3; cursor: default; }
    [dir="rtl"] .tl-step svg { transform: scaleX(-1); }
    .tl-track {
        position: relative;
        flex: 1;
        display: flex;
        justify-content: space-between;
        min-width: 0;
    }
    .tl-track::before {
        content: '';
        position: absolute;
        left: 12px;
        right: 12px;
        top: 13px;
        height: 3px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.12);
    }
    .tl-pass {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        padding: 6px 0 2px;
        border: 0;
        background: transparent;
        cursor: pointer;
        color: #8f8f8f;
        font: 11px var(--font-family);
    }
    .tl-dot {
        width: 12px;
        height: 12px;
        margin: 2px 0;
        border-radius: 50%;
        box-shadow: 0 0 0 2px rgba(16, 16, 18, 0.9);
        transition: transform 120ms ease;
    }
    .tl-pass:hover .tl-dot { transform: scale(1.25); }
    .tl-pass.is-on .tl-dot { transform: scale(1.35); box-shadow: 0 0 0 2px #101012, 0 0 0 4px var(--accent-text); }
    .tl-label { white-space: nowrap; }
    .tl-label--quiet { visibility: hidden; }
    .tl-pass:hover .tl-label--quiet { visibility: visible; color: #EDEDED; }
    .tl-pass.is-on .tl-label { color: #EDEDED; font-weight: 600; }

    /* ---------- Field panel tabs ---------- */
    .field-tabs {
        position: sticky;
        top: 0;
        z-index: 3;
        display: flex;
        gap: 2px;
        padding: 0 10px;
        background: var(--panel-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-bottom: 1px solid var(--color-border-subtle);
    }
    .field-tab-btn {
        border: 0;
        background: transparent;
        padding: 10px 10px 11px;
        font: 500 13px var(--font-family);
        color: var(--color-text-secondary);
        cursor: pointer;
    }
    .field-tab-btn:hover { color: var(--color-text-primary); }
    .field-tab-btn[aria-selected="true"] {
        color: var(--color-text-primary);
        box-shadow: inset 0 -2px 0 var(--app-accent);
    }
    .field-tab { display: none; flex-direction: column; gap: 10px; padding: 12px 16px 16px; }
    #map-lower-panels[data-ftab="overview"] .field-tab[data-ftab="overview"],
    #map-lower-panels[data-ftab="indices"] .field-tab[data-ftab="indices"],
    #map-lower-panels[data-ftab="land"] .field-tab[data-ftab="land"],
    #map-lower-panels[data-ftab="records"] .field-tab[data-ftab="records"] { display: flex; }
    .field-tab .map-history-panel,
    .field-tab .zones-panel { padding: 0; border: 0; }
    .ftab-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--color-text-secondary); }
    .ftab-hint[hidden] { display: none; }

    /* Overview */
    .ov-hero, .ov-tile, .ov-box {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 10px 14px;
        border-radius: 12px;
        background: var(--tile-bg);
        border: 1px solid var(--color-border-subtle);
    }
    .ov-label { font-size: 12px; color: var(--color-text-muted); }
    .ov-big { font-family: var(--font-tech); font-size: 34px; font-weight: 600; line-height: 1.05; color: var(--color-text-primary); }
    .ov-val { font-family: var(--font-tech); font-size: 20px; font-weight: 600; color: var(--color-text-primary); }
    .ov-val--text { font-family: var(--font-family); font-size: 15px; line-height: 1.3; }
    .ov-sub { font-size: 12px; line-height: 1.45; color: var(--color-text-secondary); }
    .ov-sub:empty { display: none; }
    .ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ov-box-title { font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
    .ov-box-title:empty { display: none; }
    .ov-box[hidden] { display: none; }
    #ov-advisory.monitor { background: rgba(255, 171, 0, 0.08); border-color: rgba(255, 171, 0, 0.3); }
    #ov-advisory.irrigate { background: rgba(255, 23, 68, 0.08); border-color: rgba(255, 23, 68, 0.3); }
    /* Overview fills the panel so its buttons sit on the panel's bottom edge */
    .field-tab[data-ftab="overview"] { flex: 1 0 auto; }
    .ov-actions { display: flex; gap: 8px; }
    .ov-actions .dash-btn { flex: 1 1 0; height: 38px; }

    /* Indices */
    .ftab-index-chips { display: flex; flex-wrap: wrap; gap: 6px; }
    .ftab-chip {
        height: 32px;
        padding: 0 12px;
        border-radius: 10px;
        border: 1px solid var(--color-border-strong);
        background: transparent;
        color: var(--color-text-secondary);
        font: 600 13px var(--font-family);
        cursor: pointer;
    }
    .ftab-chip:hover { color: var(--color-text-primary); }
    .ftab-chip.is-active { background: var(--app-accent); border-color: var(--app-accent); color: #fff; }
    .ftab-slot:empty { display: none; }
    /* Legend + "About this index" live here open, as plain tiles */
    .ftab-slot .index-panel,
    .ftab-slot .index-panel.collapsed {
        position: static;
        width: auto !important;
        height: auto !important;
        max-width: none;
        max-height: none;
        padding: 14px 16px;
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 14px;
        background: var(--instrument-card);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        overflow: visible;
    }
    .ftab-slot .bar-collapse-btn { display: none; }
    .ftab-slot .index-panel .index-panel-content,
    .ftab-slot .index-panel.collapsed .index-panel-content {
        max-height: none !important;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    .ftab-slot .guide-help-btn--panel { top: 10px; inset-inline-end: 10px; }
    .ftab-slot .index-date-chip { display: none; }

    /* Records */
    .ftab-records { display: flex; flex-direction: column; gap: 6px; }
    .rec-item {
        display: flex;
        gap: 12px;
        align-items: flex-start;
        width: 100%;
        padding: 11px 12px;
        border-radius: 12px;
        border: 1px solid transparent;
        background: var(--tile-bg);
        color: var(--color-text-primary);
        text-align: start;
        font-family: var(--font-family);
        cursor: pointer;
    }
    .rec-item:hover { border-color: var(--color-border-strong); }
    .rec-date { flex-shrink: 0; width: 52px; font-size: 12px; color: var(--color-text-muted); padding-top: 1px; }
    .rec-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .rec-title { font-size: 14px; font-weight: 500; }
    .rec-note { font-size: 12px; color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

    /* Field list: quiet cards like the mock-up */
    .map-sidebar .field-card {
        background: transparent;
        border: 1px solid transparent;
        border-radius: 12px;
        padding: 10px;
    }
    .map-sidebar .field-card:hover { background: var(--color-hover-tint); border-color: transparent; }
    .map-sidebar .field-card.active {
        background: rgba(var(--app-accent-rgb), 0.14);
        border-color: rgba(var(--app-accent-rgb), 0.45);
    }
    .map-sidebar .field-meta p + p { display: none; } /* sowing date: in the field panel instead */
    .map-sidebar .field-card .field-history-zone { display: none; } /* trend: in the field panel */
}



/* ============================================================
   Fixes from the walk-through (2026-11-23)
   ============================================================ */
/* Light/dark button stays visible on the always-dark strip */
@media (min-width: 768px) {
    #app-main .app-header .theme-toggle { color: #CFCFCF; }
    #app-main .app-header .theme-toggle:hover { color: #fff; }
}
/* Index descriptions only show in the layer-bar menu */
.dock-pill-desc { display: none; }
@media (min-width: 768px) {
    .dock-index-menu .index-pill { flex-wrap: wrap; row-gap: 1px; }
    .dock-index-menu .dock-pill-desc {
        display: block;
        flex-basis: 100%;
        padding-inline-start: 22px;
        font-size: 12px;
        font-weight: 400;
        color: #A8A8A8;
    }
    .dock-index-menu { min-width: 250px; }
    /* Legend's help button stays inside its own tile */
    .ftab-slot .index-panel, .ftab-slot .index-panel.collapsed { position: relative; }
    /* Overview headline: big number on the left, label + note beside it */
    .ov-hero-text {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "big label" "big sub";
        align-items: center;
        column-gap: 14px;
        row-gap: 2px;
    }
    .ov-hero-text .ov-big { grid-area: big; }
    .ov-hero-text .ov-label { grid-area: label; align-self: end; }
    .ov-hero-text .ov-sub { grid-area: sub; align-self: start; }
}
/* Hub: the field picker's arrow sits right after the name */
.cal-field-select { field-sizing: content; }
/* Dashboard cards fill their rows: advisory + forecast share a row,
   spray windows has its own, the smaller cards sit four (or two) across */
@media (min-width: 768px) {
    .actions-section { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; }
}
@media (min-width: 1200px) {
    .actions-section { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .actions-section .advisory-card,
    .actions-section .forecast-card { grid-column: span 2; }
}


/* ============================================================
   HUB — side column (today · coming up · farm notes) + colour key
   ============================================================ */
.hub-side[hidden] { display: none; }
.hub-side { display: flex; flex-direction: column; gap: 14px; }
.hub-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--card-bg);
    border: 1px solid var(--color-border-subtle);
}
.hub-card:empty { display: none; }
.hub-card-head { display: flex; flex-direction: column; gap: 3px; }
.hub-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.hub-day { margin: 0; font-size: 19px; font-weight: 600; color: var(--color-text-primary); }
.hub-wx { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hub-wx-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 12px;
    background: var(--tile-bg);
    font-size: 11px;
    color: var(--color-text-muted);
}
.hub-wx-tile b { font-family: var(--font-tech); font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
.hub-empty {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed var(--color-border-strong);
    font-size: 13px;
    color: var(--color-text-secondary);
}
.hub-add {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: var(--app-accent);
    color: #fff;
    font: 600 13px var(--font-family);
    cursor: pointer;
}
.hub-list { display: flex; flex-direction: column; gap: 6px; }
.hub-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--tile-bg);
    color: var(--color-text-primary);
    text-align: start;
    font-family: var(--font-family);
}
button.hub-item { cursor: pointer; }
button.hub-item:hover { border-color: var(--color-border-strong); }
.hub-bar { width: 4px; align-self: stretch; min-height: 28px; border-radius: 2px; flex-shrink: 0; }
.hub-bar--hazard { background: var(--color-amber); }
.hub-item-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hub-item-title { font-size: 14px; font-weight: 500; }
.hub-item-sub { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-item-date { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
.hub-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--color-text-secondary); }

.cal-key {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--color-text-secondary);
}
.cal-key-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-key-swatch { width: 10px; height: 10px; border-radius: 3px; }
.cal-key-swatch--hazard { background: transparent; border: 1.5px dashed var(--color-amber); }

@media (min-width: 768px) {
    .hub-layout {
        max-width: 1560px;
        margin: 0 auto;
        padding: 24px 28px 32px;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    #view-calendar .cal-view { padding: 0; max-width: none; margin: 0; }
}
@media (min-width: 1100px) {
    .hub-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
    .hub-side { position: sticky; top: 24px; }
}

/* Farm notes as the column's third card (shell.js moves it in on the Hub) */
body.notes-in-hub #notes-panel {
    display: flex;
    position: static;
    width: auto;
    max-height: none;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--card-bg);
    border: 1px solid var(--color-border-subtle);
    box-shadow: none;
    animation: none;
}
body.notes-in-hub #notes-close,
body.notes-in-hub .notes-fab { display: none; }
body.notes-in-hub #farm-notepad { min-height: 140px; }


/* ============================================================
   Pre-launch fixes (2026-11-23)
   ============================================================ */
@media (min-width: 768px) {
    /* 3D turn/tilt bar: above the layer bar + timeline, centred in the clear map */
    #view-map .terrain-bar {
        bottom: calc(var(--edge) + var(--map-bottom-h, 60px) + 10px);
        left: calc(var(--map-left) + (100% - var(--map-left) - var(--map-right)) / 2);
        z-index: 16;
        transition: left 250ms ease, bottom 200ms ease;
    }
    /* Connection dot: a little larger, with its words on hover */
    #app-main .app-header .status-group { cursor: default; padding: 4px; }
    #app-main .app-header .status-dot { width: 9px; height: 9px; }
}


/* ============================================================
   MOTION — one easing and timing for every panel (2026-11-23)
   Panels glide in and out; nothing pops. Reduced-motion users get
   instant changes (end of this section).
   ============================================================ */
:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --t-panel: 360ms;
    --t-fast: 200ms;
}

/* The bar under the map (indices, views, timeline) only with a field open */
#view-map .map-bottom {
    transition: left var(--t-panel) var(--ease-out), right var(--t-panel) var(--ease-out),
                bottom var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out),
                opacity var(--t-fast) ease, visibility 0s;
}
body:not(.has-field) #view-map .map-bottom {
    opacity: 0;
    transform: translateY(28px);
    visibility: hidden;
    pointer-events: none;
    transition: transform var(--t-panel) var(--ease-out), opacity var(--t-fast) ease, visibility 0s linear var(--t-panel);
}

/* Timeline glides open under the layer bar once the field's passes arrive */
.map-timeline {
    display: block;
    max-height: 140px;
    overflow: hidden;
    transition: max-height var(--t-panel) var(--ease-out), opacity var(--t-fast) ease,
                padding var(--t-panel) var(--ease-out), margin var(--t-panel) var(--ease-out),
                border-width var(--t-panel) var(--ease-out);
}
.map-timeline.is-off {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    margin-top: -10px; /* cancels the bar's gap while closed */
    pointer-events: none;
}

/* Index menu rises out of its button */
.dock-index-menu,
.dock-index-menu[hidden] {
    display: flex;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transform-origin: bottom left;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out), visibility 0s linear var(--t-fast);
}
.dock-index-menu.is-open {
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out), visibility 0s;
}

/* Tab content settles in */
@keyframes ftab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.field-tab { animation: ftab-in 240ms var(--ease-out); }

@media (min-width: 768px) {
    /* Field list */
    .map-sidebar {
        will-change: transform;
        transition: transform var(--t-panel) var(--ease-out), opacity var(--t-panel) var(--ease-out);
    }
    /* Field panel: slides + fades in, slides out, then leaves the tab order */
    #view-map .map-lower-panels,
    #view-map .map-lower-panels.map-lower-panels--compressed {
        opacity: 0;
        will-change: transform;
        transition: transform var(--t-panel) var(--ease-out), opacity var(--t-panel) ease, visibility 0s linear var(--t-panel);
    }
    body.field-panel-open #view-map .map-lower-panels {
        opacity: 1;
        transition: transform var(--t-panel) var(--ease-out), opacity var(--t-fast) ease, visibility 0s;
    }
    /* Everything that makes room for the panels moves in step with them */
    .map-wrapper .map-toolbar-stack,
    .map-wrapper .index-panel,
    .map-container .maplibregl-ctrl-bottom-right,
    #view-map .terrain-bar {
        transition: left var(--t-panel) var(--ease-out), right var(--t-panel) var(--ease-out), bottom var(--t-panel) var(--ease-out);
    }
    /* "Field details" fades in beside the map buttons when the panel is closed */
    .field-panel-reopen {
        display: flex;
        opacity: 0;
        transform: translateX(8px);
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--t-fast) ease, transform var(--t-panel) var(--ease-out), visibility 0s linear var(--t-panel);
    }
    body.field-panel-closed .field-panel-reopen {
        opacity: 1;
        transform: none;
        visibility: visible;
        pointer-events: auto;
        transition: opacity var(--t-fast) ease var(--t-fast), transform var(--t-panel) var(--ease-out) var(--t-fast), visibility 0s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-sidebar, #view-map .map-lower-panels, #view-map .map-bottom, .map-timeline,
    .dock-index-menu, .field-panel-reopen, .map-wrapper .map-toolbar-stack, .map-wrapper .index-panel,
    .map-container .maplibregl-ctrl-bottom-right, #view-map .terrain-bar {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
    .field-tab { animation: none; }
}

/* Pop-up messages: on the computer Map they appear at the top, clear of the
   layer bar and timeline; on phones, just above the bottom bar */
@media (min-width: 768px) {
    body[data-view="map"] #sentinel-toast-container {
        top: calc(64px + env(safe-area-inset-top, 0px));
        bottom: auto;
    }
}


/* ============================================================
   FIELD PANEL TYPE SCALE — one consistent set of sizes for every
   tab, overriding the older map-strip styles of the Zones / Land /
   trend cards (written for the wide strip under the old map).
     label 12px caps · lead 15px semibold · body 13px · key 13px
   ============================================================ */
@media (min-width: 768px) {
#view-map #map-lower-panels .zones-panel,
body.zones-on #view-map #map-lower-panels #zones-card,
body.land-on #view-map #map-lower-panels #land-card {
    padding: 0;
    gap: 12px;
    background: transparent;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
#view-map #map-lower-panels .zones-panel-header { gap: 10px; align-items: center; flex-wrap: wrap; }
#view-map #map-lower-panels .zones-panel-title,
#view-map #map-lower-panels .map-history-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
#view-map #map-lower-panels .zones-headline {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    max-width: none;
    color: var(--color-text-primary);
}
#view-map #map-lower-panels .zones-note,
#view-map #map-lower-panels .rx-launch-text,
#view-map #map-lower-panels .map-history-caption {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}
/* Key: tidy rows of small swatches */
#view-map #map-lower-panels .zones-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--tile-bg);
}
#view-map #map-lower-panels .zones-chip { font-size: 13px; gap: 7px; color: var(--color-text-secondary); }
#view-map #map-lower-panels .zones-chip b,
#view-map #map-lower-panels .zones-chip strong { color: var(--color-text-primary); font-weight: 600; }
#view-map #map-lower-panels .zones-swatch { width: 10px; height: 10px; border-radius: 3px; }
#view-map #map-lower-panels .zones-swatch.land-line { width: 16px; height: 3px; }
/* Height key: low number · colour bar · high number on one line — the bar gives way, never the numbers */
#view-map #map-lower-panels .zones-legend:has(> .land-ramp) { flex-wrap: nowrap; align-items: center; gap: 10px; }
#view-map #map-lower-panels .land-ramp { flex: 1 1 auto; width: auto; min-width: 48px; max-width: 240px; height: 10px; border-radius: 5px; }
#view-map #map-lower-panels .land-ramp-end { font-size: 12px; flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Water / Slope / Height: same buttons as the index chips */
#view-map #map-lower-panels .land-views { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
#view-map #map-lower-panels .land-view-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--color-border-strong);
    background: transparent;
    color: var(--color-text-secondary);
    font: 600 13px var(--font-family);
}
#view-map #map-lower-panels .land-view-btn.active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}
/* Actions */
#view-map #map-lower-panels .rx-launch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-subtle);
}
#view-map #map-lower-panels .rx-open-btn,
#view-map #map-lower-panels .zones-generate-btn {
    height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
}
/* Trend chart controls (Indices tab) */
#view-map #map-lower-panels .map-history-header { gap: 10px; }
#view-map #map-lower-panels .map-history-field-name { display: none; } /* the panel already names the field */
#view-map #map-lower-panels .hist-controls { gap: 8px 14px; }
#view-map #map-lower-panels .hist-control-label { font-size: 12px; color: var(--color-text-muted); }
#view-map #map-lower-panels .hist-seg-btn { font-size: 12px; padding: 5px 10px; }
/* Section spacing inside each tab */
#view-map #map-lower-panels .field-tab > * + * { margin-top: 0; }
#view-map #map-lower-panels .field-tab { gap: 10px; }
#view-map #map-lower-panels .field-tab > .ov-actions { margin-top: auto; } /* buttons on the panel's bottom edge */
}

/* Zones and Land tabs: an explainer + button while the view is off */
@media (min-width: 768px) {
    #map-lower-panels[data-ftab="zones"] .field-tab[data-ftab="zones"] { display: flex; }
    .ftab-off { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
    .ftab-off[hidden] { display: none; }
    .field-tab-btn { padding-left: 9px; padding-right: 9px; }
}

} /* end computers only */

/* Phones: the original design — hide the redesign's extra markup */
@media (max-width: 767px) {
    .dash-head, .dash-fields, .hub-side, .cal-key, .quick-log-btn, .map-bottom,
    .field-panel-head, .field-panel-reopen, .field-tabs, .ftab-off,
    .dock-pill-desc, .nav-label-short { display: none !important; }
    .field-tab { display: contents; }
    .field-tab--desktop { display: none !important; }
}
@media (min-width: 768px) {
    .nav-label-long { display: none; }
}

/* Map credits on computers: folded into a small ⓘ under the map buttons (map.js),
   "Imagery © Esri" always readable beside it (Esri imagery licence); open the ⓘ
   for the full list. Phones keep the plain credit line (style.css). */
@media (min-width: 768px) {
    .map-container .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib.maplibregl-compact {
        background: none;
        margin: 0;
        padding: 0 28px 0 0;
        min-height: 24px;
        color: rgba(255, 255, 255, 0.85);
        text-align: right;
    }
    .map-container .maplibregl-ctrl-attrib.maplibregl-compact::before {
        content: 'Imagery © Esri';
        font-size: 10px;
        line-height: 24px;
        color: rgba(255, 255, 255, 0.7);
        text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
    }
    .map-container .maplibregl-ctrl-attrib.maplibregl-compact-show::before { content: none; }
    .map-container .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {
        background-color: rgba(255, 255, 255, 0.5); /* inverted → dark disc, white ⓘ */
        filter: invert(1);
    }
    .map-container .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
        display: inline-block;
        max-width: 420px;
        padding: 4px 10px;
        border-radius: 10px;
        background: rgba(10, 10, 10, 0.78);
        font-size: 11px;
        line-height: 1.4;
        text-shadow: none;
    }
    [dir="rtl"] .map-container .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib.maplibregl-compact { padding: 0 28px 0 0; }
}

/* Map icons (sprite at the top of index.html; source files media/Icons/svg) */
.map-icon { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-inline-end: 0.4em; flex-shrink: 0; }
.index-pill .map-icon { width: 15px; height: 15px; vertical-align: -3px; margin-inline-end: 5px; }
.bar-collapse-icon .map-icon { display: block; width: 16px; height: 16px; margin: 0; }
.land-view-btn { display: inline-flex; align-items: center; }
.land-view-btn .map-icon { width: 16px; height: 16px; margin-inline-end: 6px; }
/* White panels (light theme): deepen the pale colours. The map bars stay dark. */
html.light-theme .map-icon { filter: brightness(0.75) saturate(1.5); }
html.light-theme .map-dock .map-icon,
html.light-theme .index-switcher .map-icon { filter: none; }
/* Solid bronze (selected) buttons: lift the colours so they still read */
.index-switcher .index-pill.active .map-icon,
#view-map #map-lower-panels .land-view-btn.active .map-icon { filter: brightness(1.45) saturate(0.8); }
@media (min-width: 768px) {
    .map-dock .index-pill { display: inline-flex; align-items: center; column-gap: 8px; }
    .map-dock .map-icon { width: 18px; height: 18px; margin: 0; }
    .dock-index-menu .dock-pill-desc { padding-inline-start: 26px; }
}
