/* Layer selector below the field map; map controls remain inside map-wrap. */
.field-map-stack { min-width: 0; }
.field-map-stack .map-wrap { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
body[data-screen="fields"][data-fields-view="map"] #view { height: 100dvh; min-height: 0; }
body[data-screen="fields"][data-fields-view="map"] .field-map-stack { flex: 1 1 0; min-height: 0; width: 100%; }
body[data-screen="fields"][data-fields-view="map"] .field-map-stack .map-wrap { flex: none; height: 100%; min-height: 0; }
body[data-screen="fields"][data-fields-view="map"] .field-map-stack #map { height: 100%; min-height: 0; }
.nspd-panel { position: relative; min-width: 0; margin: 0 0 14px; overflow: hidden; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 16px 16px; }
html[data-layout="mobile"] .nspd-panel { display: none; }
html[data-layout="mobile"] .field-map-stack .map-wrap { margin-bottom: 14px; border-bottom-left-radius: var(--radius, 16px); border-bottom-right-radius: var(--radius, 16px); }
html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] #app { width: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] #view { padding-left: 0; padding-right: 0; padding-bottom: calc(100px + var(--safe-b)); }
html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] #view > .topbar,
html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] #view > .an-seg { margin-left: 16px; margin-right: 16px; }
.nspd-panel button, .nspd-panel input { font: inherit; }
.nspd-panel button { color: inherit; }
.nspd-panel button:disabled { cursor: default; opacity: .45; }
.nspd-panel [hidden] { display: none !important; }
.nspd-heading { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 68px; padding: 13px 16px; border: 0; background: transparent; text-align: left; }
.nspd-heading > svg:first-child { flex: none; width: 22px; height: 22px; color: var(--lime); }
.nspd-heading > span:first-of-type { display: grid; gap: 4px; flex: 1; min-width: 0; }
.nspd-heading b { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.nspd-heading small { font-size: 11px; color: var(--muted); }
.nspd-count { display: inline-grid; place-items: center; flex: none; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 8px; background: var(--lime-soft); color: var(--lime); font-size: 12px; font-weight: 750; }
.nspd-chevron { width: 18px; height: 18px; flex: none; color: var(--muted); transition: transform .16s ease; }
.nspd-heading[aria-expanded=true] .nspd-chevron { transform: rotate(180deg); }
.nspd-body { padding: 0 14px 16px; }
.nspd-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.nspd-tabs button { flex: 1; min-width: 0; min-height: 39px; padding: 7px 5px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.nspd-tabs button[aria-selected=true] { color: var(--ink); background: #314435; }
.nspd-source { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin: 14px 0 12px; }
.nspd-source-text { color: var(--muted); font-size: 11px; line-height: 1.5; }
.nspd-account { display: grid; gap: 7px; margin-top: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.nspd-account-title { display: grid; gap: 5px; }
.nspd-account-title b { font-size: 12px; font-weight: 650; }
.nspd-account-title span, .nspd-account > small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.nspd-account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.nspd-account-actions button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 11px; }
.nspd-account-help, .nspd-account-message { margin: 0; font-size: 10px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.nspd-panel .nspd-warning { color: var(--clay); }
.nspd-retry, .nspd-clear { flex: none; min-height: 32px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 11px !important; font-weight: 650 !important; }
.nspd-retry { margin-top: -5px; }
/* Leaflet blends every tile image to hide hairline seams of an opaque base map. Over transparent
   layers and while the map moves the seams cannot be seen, and the blending costs half of the frames. */
.leaflet-container .leaflet-nspdLayers-pane img.leaflet-tile,
.leaflet-container .map-labels img.leaflet-tile,
body.leaflet-dragging .leaflet-container img.leaflet-tile,
.leaflet-container .leaflet-pan-anim img.leaflet-tile,
.leaflet-container .leaflet-zoom-anim img.leaflet-tile { mix-blend-mode: normal; }
.nspd-results { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #415240 transparent; }
.nspd-layer-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.nspd-layer-group + .nspd-layer-group { margin-top: 14px; }
.nspd-layer-group legend { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 2px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .025em; text-transform: uppercase; overflow-wrap: anywhere; }
.nspd-layer-group legend span { font-weight: 400; opacity: .7; }
.nspd-layer-group.nspd-important { padding: 0 6px 6px; border: 1px solid #3a5032; border-radius: 12px; background: #18291d; }
.nspd-important > legend { width: auto; padding: 5px 7px; color: var(--lime); }
.nspd-layer-row { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 11px 9px; margin: 2px 0; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.nspd-layer-row:hover { background: var(--bg); }
.nspd-layer-row.is-selected { border-color: #395333; background: #1d301e; }
.nspd-panel input[type=checkbox], .nspd-panel input[type=radio] { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--lime); cursor: pointer; }
.nspd-layer-info { display: grid; gap: 5px; flex: 1; min-width: 0; }
.nspd-layer-info b { font-size: 12px; line-height: 1.4; font-weight: 550; overflow-wrap: anywhere; }
.nspd-layer-info small { font-size: 10px; line-height: 1.4; color: var(--muted); }
.nspd-layer-info small.nspd-layer-provider { color: #b5c9b6; }
.nspd-layer-row.is-unavailable { cursor: default; }
.nspd-layer-row.is-unavailable:hover { background: transparent; }
.nspd-panel .is-unavailable input[type=checkbox] { cursor: not-allowed; opacity: .5; }
.nspd-layer-row.is-unavailable .nspd-layer-mark { opacity: .25; }
.nspd-layer-mark { width: 14px; height: 14px; flex: none; margin-right: 1px; border: 1.5px solid #90b3c6; border-radius: 3px; transform: rotate(-12deg); opacity: .65; }
.nspd-layer-row.is-selected .nspd-layer-mark { border-color: var(--lime); background: #d4fa3020; opacity: 1; }
.nspd-empty { margin: 8px 0 12px; padding: 15px 11px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.nspd-tools { display: flex; align-items: center; gap: 17px; padding: 15px 0 0; margin-top: 12px; border-top: 1px solid var(--line); }
.nspd-opacity { display: grid; grid-template-columns: 1fr auto; gap: 8px 6px; flex: 1; min-width: 0; color: var(--muted); font-size: 11px; }
.nspd-opacity output { color: var(--ink); font-variant-numeric: tabular-nums; }
.nspd-opacity input { grid-column: 1 / -1; width: 100%; height: 20px; margin: 0; accent-color: var(--lime); }
.nspd-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.nspd-source-link { display: inline-block; margin-top: 8px; color: var(--lime); font-size: 11px; text-decoration: none; }
.nspd-bases, .nspd-locals { display: grid; gap: 4px; margin-top: 13px; }
.nspd-base-row { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 11px 9px; border-radius: 10px; cursor: pointer; }
.nspd-base-row:has(input:checked) { background: #1d301e; }
.nspd-base-row > span { display: grid; gap: 5px; }
.nspd-base-row b { font-size: 13px; font-weight: 550; }
.nspd-base-row small { color: var(--muted); font-size: 10px; }
.field-map-stack:has(.map-wrap.drawing) .nspd-panel { display: none; }
html[data-layout="desktop"] body[data-screen="fields"] .field-map-stack { grid-column: 1; grid-row: auto; }
html[data-layout="desktop"] body[data-screen="fields"][data-fields-view="map"] #view { height: calc(100dvh - 74px); min-height: 0; }
html[data-layout="desktop"] body[data-screen="fields"][data-fields-view="map"] .field-map-stack { flex: 1 1 0; min-height: 0; width: 100%; }
html[data-layout="desktop"] body[data-screen="fields"] .field-map-stack .map-wrap { height: 100%; min-height: 0; }
html[data-layout="desktop"] body[data-screen="fields"] .field-map-stack #map { height: 100%; min-height: 0; }
html[data-layout="desktop"] .nspd-body { padding: 0 18px 18px; }
html[data-layout="desktop"] .nspd-results { max-height: 330px; }
html[data-layout="desktop"] .nspd-tabs { max-width: 430px; }
@media (max-width: 360px) {
  .nspd-body { padding-right: 10px; padding-left: 10px; }
  .nspd-tabs button { font-size: 10px; }
  .nspd-heading { padding-right: 12px; padding-left: 12px; }
}
@media (max-height: 500px) {
  html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] .map-wrap:not(.is-map-fullscreen) .map-hint { display: none; }
  html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] .map-wrap.drawing:not(.is-map-fullscreen) .map-fullscreen-button { top: 10px; bottom: auto; }
  html[data-layout="mobile"] body[data-screen="fields"][data-fields-view="map"] .map-wrap.drawing:not(.is-map-fullscreen) .map-locate { display: none; }
}
.nspd-soil { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.nspd-soil > b { font-size: 13px; }
.nspd-soil-name { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.nspd-soil-name input { flex: 1; min-width: 0; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.nspd-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.nspd-swatch { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.nspd-swatch i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.nspd-soil-history { margin: 0; padding-left: 16px; color: var(--muted); font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .nspd-chevron { transition: none; } }

/* NSPD object card inside a map popup (EFIS fields and soils). */
.nspd-card { margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.nspd-card:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.nspd-card > b { display: block; margin: 0 0 6px; }
.nspd-card dl { margin: 0; }
.nspd-card dl > div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.nspd-card dl > div:last-child { border-bottom: 0; }
.nspd-card dt { color: var(--muted, #6b7568); font-size: 12px; }
.nspd-card dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.nspd-card > small { display: block; margin: 6px 0 0; color: var(--muted, #6b7568); font-size: 11px; }
.nspd-card-note { margin: 8px 0 0; color: var(--clay); font-size: 12px; }
.nspd-card + .btn, .nspd-card-note + .btn { margin-top: 10px; }
