/* ============================================================
   AskPerTask Map — Mobile Shell V1 (MAP-MOBILE-SHELL-V1)
   ============================================================
   ≤767px only. /map/ becomes one self-contained product block
   below the shared site header:

     .apt-map-mobile-shell[data-apt-shell-state]
       ├─ .apt-map-nav            toolbar: location · search
       └─ .apt-map-app            (positioned sheet layer)
            ├─ .apt-shell-bar     type chips · active-layer chip · Filters
            ├─ .apt-map-center    real Leaflet map + locate + selected sheet
            ├─ .apt-map-results   results bottom sheet (peek ↔ expanded)
            └─ .apt-map-sidebar   filters sheet (existing controls)

   States (set by apt-map-mobile-shell.js):
     base | selected | results | filters

   Above 767px the wrapper and chip bar are display:contents and every
   .apt-shell-only element is hidden, so desktop and tablet render the
   exact previous DOM box tree — no rule here reaches them.
   ============================================================ */

@media ( min-width: 768px ) {
	.apt-map-mobile-shell,
	.apt-shell-bar { display: contents; }
	.apt-shell-only { display: none !important; }
}

@media ( max-width: 767px ) {

	/* ── Tokens ─────────────────────────────────────────────── */
	.apt-map-mobile-shell {
		--apt-shell-green: #08B95A;
		--apt-shell-green-dark: #068D45;
		--apt-shell-green-tint: #EFFBF5;
		--apt-shell-ink: #0F172A;
		--apt-shell-muted: #64748B;
		--apt-shell-line: #E5E7EB;
		--apt-shell-radius: 20px;
		--apt-shell-peek: 76px;
		--apt-shell-shadow: 0 -6px 24px rgba( 15, 23, 42, 0.12 ), 0 -1px 3px rgba( 15, 23, 42, 0.06 );
		--apt-shell-ease: cubic-bezier( 0.22, 0.8, 0.3, 1 );
	}

	.apt-map-mobile-shell [hidden] { display: none !important; }

	/* ── Page frame: header + shell fill the viewport, page never scrolls ──
	   Re-locks what the ≤900px MAP-MOBILE-SCROLL-1A-FIX1 rules unlocked for
	   the tablet stacked layout: on phones the list lives inside the shell's
	   own sheet, so there is nothing below the map to scroll to. */
	/* Height = the DYNAMIC viewport (100dvh: tracks the mobile browser's
	   URL bar / toolbar as they show and hide, so nothing is ever trapped
	   under browser chrome); 100% is the fallback where dvh is unsupported.
	   The root is locked too so iOS cannot rubber-band the whole page. */
	html:has( > body.apt-page-map ) {
		height: 100%;
		overflow: hidden;
		overscroll-behavior: none;
	}
	body.apt-page-map {
		height: 100%;
		height: 100dvh;
		min-height: 0;
		overflow: hidden;
		overscroll-behavior: none;
	}
	body.admin-bar.apt-page-map {
		height: calc( 100% - 46px );
		height: calc( 100dvh - 46px );
		min-height: 0;
	}

	/* The shared header's mobile drawer opens in flow above the shell. While it
	   is open the page scrolls again (a tall drawer must stay reachable) and the
	   shell keeps a fixed height below it instead of being squeezed to zero. */
	html:has( > body.apt-page-map .aptv2-header.is-open ),
	body.apt-page-map:has( .aptv2-header.is-open ) {
		overflow-y: auto;
	}
	body.apt-page-map:has( .aptv2-header.is-open ) .apt-map-mobile-shell {
		flex: 0 0 auto;
		height: 70vh;
		height: 70svh;
	}

	/* ── The shell: one solid block with its own boundary ───── */
	.apt-map-mobile-shell {
		position: relative;
		display: flex;
		flex-direction: column;
		flex: 1 1 auto;
		min-height: 0;
		overflow: hidden;
		isolation: isolate;
		background: #fff;
		border-top: 1px solid var( --apt-shell-line );
	}

	/* ── Toolbar: location + search ─────────────────────────── */
	.apt-map-mobile-shell .apt-map-nav {
		height: auto;
		gap: 8px;
		padding: 10px 12px 8px;
		border-bottom: 0;
		box-shadow: none;
	}
	.apt-map-mobile-shell .apt-map-nav__location {
		display: inline-flex;
		height: 40px;
		max-width: 132px;
		padding: 0 10px;
		border-radius: 999px;
		font-size: 13px;
		font-weight: 600;
	}
	.apt-map-mobile-shell .apt-map-nav__location #apt-nav-location-label {
		overflow: hidden;
		text-overflow: ellipsis;
		min-width: 0;
	}
	.apt-map-mobile-shell .apt-map-nav__search-wrap {
		margin: 0;
		max-width: none;
	}
	.apt-map-mobile-shell .apt-map-nav__search-wrap .apt-map-nav__search-input {
		height: 40px;
		padding-left: 34px;
		border-radius: 999px;
		font-size: 16px; /* ≥16px: iOS never zooms the page on focus */
	}
	.apt-map-mobile-shell .apt-map-nav__search-icon { left: 12px; }
	.apt-map-mobile-shell .apt-map-nav__links { display: none; }

	/* ── Sheet layer container ──────────────────────────────── */
	.apt-map-mobile-shell .apt-map-app {
		position: relative;
		z-index: 1;
		display: flex;
		flex-direction: column;
		flex: 1 1 auto;
		min-height: 0;
		height: auto;
		overflow: hidden;
		/* PWA-FIX-07: clip, not a scroll container. A hidden scroller can still be scrolled by the browser
		   (scrollIntoView, focus, keyboard); the map then sat shifted, and the next pin tap's focus snapped it back
		   mid-tap so the tap missed the pin. Browsers without clip keep hidden plus the JS guard. */
		overflow: clip;
	}

	/* Scrim behind the filters sheet — tapping it closes the sheet (JS). */
	.apt-map-mobile-shell .apt-map-app::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 25;
		background: rgba( 15, 23, 42, 0.32 );
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.22s ease;
	}
	.apt-map-mobile-shell[data-apt-shell-state="filters"] .apt-map-app::after {
		opacity: 1;
		pointer-events: auto;
	}

	/* ── Chip bar: type chips · layer chip · Filters ────────── */
	.apt-map-mobile-shell .apt-shell-bar {
		display: flex;
		align-items: center;
		gap: 8px;
		flex-shrink: 0;
		padding: 0 12px 10px;
		background: #fff;
		border-bottom: 1px solid var( --apt-shell-line );
		box-shadow: 0 2px 6px rgba( 15, 23, 42, 0.05 );
		position: relative;
		z-index: 5;
	}
	.apt-map-mobile-shell .apt-rt-filter-mobile {
		flex: 1 1 auto;
		min-width: 0;
		padding: 0;
		border: 0;
		background: transparent;
		gap: 6px;
	}
	.apt-map-mobile-shell .apt-rt-filter-mobile .apt-rt-btn,
	.apt-map-mobile-shell .apt-rt-filter-sheet .apt-rt-btn {
		min-height: 36px;
		padding: 0 14px;
		font-size: 13px;
		border-radius: 999px;
	}
	/* ExpertHive's frontend.js writes an inline "0 5px 21px <bg @35%>" glow
	   onto every solid-background button at load; only !important beats an
	   inline style. Shell controls keep their own (flat) look. */
	.apt-map-mobile-shell .apt-rt-btn,
	.apt-map-mobile-shell .apt-shell-filter-btn,
	.apt-map-mobile-shell .apt-shell-layer-chip,
	.apt-map-mobile-shell .apt-shell-icon-btn,
	.apt-map-mobile-shell .apt-shell-sheet-head,
	.apt-map-mobile-shell .apt-shell-cta { box-shadow: none !important; }
	.apt-map-mobile-shell .apt-shell-locate { box-shadow: 0 2px 10px rgba( 15, 23, 42, 0.18 ) !important; }
	.apt-map-mobile-shell .apt-rt-btn[data-apt-rt=""].is-active {
		background: var( --apt-shell-green );
		border-color: var( --apt-shell-green );
		color: #fff;
	}

	.apt-shell-layer-chip {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		flex: 0 1 auto;
		min-width: 0;
		min-height: 36px;
		margin-right: auto;
		padding: 0 12px 0 14px;
		border: 1.5px solid var( --apt-mk-base, var( --apt-shell-green ) );
		border-radius: 999px;
		background: var( --apt-mk-tint, var( --apt-shell-green-tint ) );
		color: var( --apt-mk-dark, var( --apt-shell-green-dark ) );
		font-size: 13px;
		font-weight: 700;
		white-space: nowrap;
		cursor: pointer;
		-webkit-appearance: none;
	}
	.apt-shell-layer-chip__label { overflow: hidden; text-overflow: ellipsis; }
	.apt-shell-layer-chip svg { flex-shrink: 0; opacity: 0.75; }

	.apt-shell-filter-btn {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 40px;
		height: 40px;
		margin-left: auto;
		padding: 0;
		border: 1.5px solid var( --apt-shell-line );
		border-radius: 50%;
		background: #fff;
		color: var( --apt-shell-ink );
		cursor: pointer;
		-webkit-appearance: none;
	}
	.apt-shell-filter-btn[aria-expanded="true"],
	.apt-shell-filter-btn.has-filters {
		border-color: var( --apt-shell-green );
		color: var( --apt-shell-green-dark );
		background: var( --apt-shell-green-tint );
	}
	.apt-shell-filter-btn__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect( 0 0 0 0 );
		white-space: nowrap;
	}
	.apt-shell-filter-btn__count {
		position: absolute;
		top: -4px;
		right: -4px;
		min-width: 18px;
		height: 18px;
		padding: 0 5px;
		border-radius: 999px;
		background: var( --apt-shell-green );
		color: #fff;
		font-size: 11px;
		font-weight: 800;
		line-height: 18px;
		text-align: center;
		box-shadow: 0 0 0 2px #fff;
	}

	.apt-map-mobile-shell button:focus-visible {
		outline: 2px solid #2D6CDF;
		outline-offset: 2px;
	}

	/* ── Map viewport ───────────────────────────────────────── */
	.apt-map-mobile-shell .apt-map-center {
		display: flex;
		flex-direction: column;
		flex: 1 1 auto;
		min-height: 0;
		height: auto;
		overflow: hidden;
	}
	.apt-map-mobile-shell .apt-map-canvas-wrap {
		flex: 1 1 auto;
		height: auto;
		min-height: 0;
	}
	.apt-map-mobile-shell #apt-map-canvas {
		flex: 1 1 auto;
		height: 100%;
		min-height: 0;
	}
	.apt-map-mobile-shell .apt-map-legend,
	.apt-map-mobile-shell .apt-map-hero,
	.apt-map-mobile-shell .apt-map-toggle,
	.apt-map-mobile-shell .apt-map-toggle__hint { display: none !important; }

	/* Leaflet controls sit clear of the chip bar; attribution clears the peek. */
	.apt-map-mobile-shell .leaflet-top { top: 4px; }
	.apt-map-mobile-shell .leaflet-bottom { bottom: var( --apt-shell-peek ); }
	.apt-map-mobile-shell .leaflet-control-zoom a {
		width: 36px;
		height: 36px;
		line-height: 36px;
	}

	/* Empty-state card stays above the peek sheet. */
	.apt-map-mobile-shell .apt-map-empty { padding-bottom: calc( var( --apt-shell-peek ) + 20px ); }
	/* APT-013: the map fallback card sits between the floating chrome and the peek sheet. */
	.apt-map-mobile-shell .apt-map-fallback { padding: calc( var( --apt-mapx-chrome, 150px ) + 8px ) 20px calc( var( --apt-shell-peek ) + 20px ); }

	/* Floating locate control */
	.apt-shell-locate {
		position: absolute;
		right: 12px;
		bottom: calc( var( --apt-shell-peek ) + 14px );
		z-index: 600;
		display: grid;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: #fff;
		color: var( --apt-shell-green-dark );
		box-shadow: 0 2px 10px rgba( 15, 23, 42, 0.18 );
		cursor: pointer;
		transition: opacity 0.2s ease;
		-webkit-appearance: none;
	}
	.apt-map-mobile-shell:not( [data-apt-shell-state="base"] ) .apt-shell-locate {
		opacity: 0;
		pointer-events: none;
	}

	/* ── Shared sheet chrome ────────────────────────────────── */
	.apt-shell-handle {
		display: block;
		width: 40px;
		height: 5px;
		margin: 0 auto;
		border-radius: 999px;
		background: #CBD2DC;
	}

	/* ── Results sheet (peek ↔ expanded) ────────────────────── */
	body.apt-page-map .apt-map-mobile-shell .apt-map-results {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 20;
		display: flex;
		flex-direction: column;
		width: auto;
		height: 74%;
		padding: 0;
		overflow: hidden;
		border: 0;
		border-radius: var( --apt-shell-radius ) var( --apt-shell-radius ) 0 0;
		background: #fff;
		box-shadow: var( --apt-shell-shadow );
		transform: translateY( calc( 100% - var( --apt-shell-peek ) ) );
		transition: transform 0.3s var( --apt-shell-ease );
		will-change: transform;
	}
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-state="results"] .apt-map-results {
		transform: translateY( 0 );
	}
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-state="selected"] .apt-map-results,
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-state="filters"] .apt-map-results {
		transform: translateY( 100% );
	}

	.apt-map-mobile-shell .apt-map-context,
	.apt-map-mobile-shell .apt-map-results__header { display: none; }

	.apt-shell-sheet-head {
		display: flex;
		align-items: center;
		gap: 12px;
		flex-shrink: 0;
		position: relative;
		width: 100%;
		min-height: var( --apt-shell-peek );
		margin: 0;
		padding: 18px 16px 12px;
		border: 0;
		border-bottom: 1px solid transparent;
		border-radius: 0;
		background: #fff;
		color: var( --apt-shell-ink );
		text-align: left;
		cursor: pointer;
		touch-action: none;
		-webkit-appearance: none;
		-webkit-tap-highlight-color: transparent;
	}
	.apt-map-mobile-shell[data-apt-shell-state="results"] .apt-shell-sheet-head {
		border-bottom-color: #F1F3F5;
	}
	.apt-shell-sheet-head .apt-shell-handle {
		position: absolute;
		top: 8px;
		left: 50%;
		margin-left: -20px;
	}
	.apt-shell-sheet-head__text {
		display: flex;
		flex-direction: column;
		flex: 1 1 auto;
		min-width: 0;
	}
	.apt-shell-sheet-head__title {
		font-size: 17px;
		font-weight: 800;
		line-height: 1.25;
		letter-spacing: -0.01em;
		color: var( --apt-shell-ink );
	}
	.apt-shell-sheet-head__meta {
		margin-top: 2px;
		overflow: hidden;
		font-size: 13px;
		line-height: 1.35;
		color: var( --apt-shell-muted );
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.apt-shell-sheet-head__cue {
		display: grid;
		place-items: center;
		flex-shrink: 0;
		width: 34px;
		height: 34px;
		border-radius: 50%;
		background: var( --apt-shell-green-tint );
		color: var( --apt-shell-green-dark );
		transition: transform 0.3s var( --apt-shell-ease );
	}
	.apt-map-mobile-shell[data-apt-shell-state="results"] .apt-shell-sheet-head__cue {
		transform: rotate( 180deg );
	}

	body.apt-page-map .apt-map-mobile-shell .apt-map-results__list {
		flex: 1 1 auto;
		min-height: 0;
		height: auto;
		margin: 0;
		padding: 4px 0 calc( 16px + env( safe-area-inset-bottom, 0px ) );
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		visibility: hidden;
	}
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-state="results"] .apt-map-results__list {
		visibility: visible;
	}

	/* Compact app-style rows (same markup as desktop, re-laid out). */
	.apt-map-mobile-shell .apt-result-card {
		align-items: center;
		gap: 12px;
		margin: 0;
		padding: 10px 16px;
		border-top: 0;
		border-bottom: 1px solid #F1F3F5;
		min-height: 64px;
	}
	.apt-map-mobile-shell .apt-result-card:hover:not( .is-selected ) {
		transform: none;
		box-shadow: none;
	}
	.apt-map-mobile-shell .apt-result-card.is-selected {
		transform: none;
		background: var( --apt-mk-tint, var( --apt-shell-green-tint ) );
		box-shadow: inset 4px 0 0 var( --apt-mk-base, var( --apt-shell-green ) );
		border-color: #F1F3F5;
	}
	.apt-map-mobile-shell .apt-result-card__avatar {
		width: 44px;
		height: 44px;
	}
	.apt-map-mobile-shell .apt-result-card__body {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		column-gap: 8px;
		row-gap: 2px;
		padding: 0;
	}
	.apt-map-mobile-shell .apt-result-card__title-row {
		flex: 1 1 100%;
		align-items: center;
		margin: 0;
	}
	.apt-map-mobile-shell .apt-result-card__title {
		font-size: 14px;
		font-weight: 700;
		-webkit-line-clamp: 1;
	}
	.apt-map-mobile-shell .apt-result-card__cat {
		max-width: 60%;
		margin: 0;
		padding: 0;
		overflow: hidden;
		border: 0;
		background: none;
		color: var( --apt-shell-muted );
		font-size: 12px;
		font-weight: 600;
		letter-spacing: 0;
		text-transform: none;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.apt-map-mobile-shell .apt-result-card__area {
		display: inline-flex;
		min-width: 0;
		margin: 0;
		font-size: 12px;
		white-space: nowrap;
	}
	.apt-map-mobile-shell .apt-result-card__meta,
	.apt-map-mobile-shell .apt-result-card__rating,
	.apt-map-mobile-shell .apt-result-card__price { margin: 0; }
	.apt-map-mobile-shell .apt-result-card__chips {
		margin: 0;
	}

	/* ── Selected sheet (compact MapPopupCard) ──────────────── */
	.apt-map-mobile-shell .apt-map-sheet {
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1100;
		max-height: 70%;
		padding-top: 14px;
		overflow-y: auto;
		overscroll-behavior: contain;
		border-radius: var( --apt-shell-radius ) var( --apt-shell-radius ) 0 0;
		box-shadow: var( --apt-shell-shadow );
		animation: apt-shell-sheet-in 0.28s var( --apt-shell-ease );
	}
	.apt-map-mobile-shell .apt-map-sheet::before {
		content: "";
		position: absolute;
		top: 8px;
		left: 50%;
		width: 40px;
		height: 5px;
		margin-left: -20px;
		border-radius: 999px;
		background: #CBD2DC;
	}
	@keyframes apt-shell-sheet-in {
		from { transform: translateY( 40% ); opacity: 0.4; }
		to   { transform: none; opacity: 1; }
	}
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__banner { display: none; }
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__close {
		display: grid;
		top: 6px;
		right: 10px;
		width: 36px;
		height: 36px;
		background: #F3F4F6;
		box-shadow: none;
	}
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__head-text { padding: 6px 56px 0 16px; }
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__head { padding: 6px 56px 0 16px; }
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__title {
		font-size: 18px;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__category { margin: 0 0 6px; }
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__desc { margin-bottom: 8px; }
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__facts {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 4px 14px;
		margin-bottom: 4px;
	}
	/* Actions are pinned to the sheet's bottom edge: on a short phone the
	   summary scrolls inside the sheet, the two buttons never leave view. */
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__actions {
		position: sticky;
		bottom: 0;
		z-index: 2;
		background: #fff;
		padding: 10px 16px calc( 14px + env( safe-area-inset-bottom, 0px ) );
	}
	.apt-map-mobile-shell .apt-map-sheet .apt-mpc__btn {
		min-height: 48px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		font-size: 15px;
		border-radius: 12px;
	}

	/* ── Filters sheet (the existing rail, re-presented) ────── */
	.apt-map-mobile-shell .apt-map-sidebar {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 30;
		display: flex;
		flex-direction: column;
		width: auto;
		height: auto;
		max-height: 86%; /* map + scrim stay visible above: tap there to close */
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		border: 0;
		border-radius: var( --apt-shell-radius ) var( --apt-shell-radius ) 0 0;
		background: #fff;
		box-shadow: var( --apt-shell-shadow );
		transform: translateY( 105% );
		visibility: hidden;
		transition: transform 0.3s var( --apt-shell-ease ), visibility 0s linear 0.3s;
	}
	.apt-map-mobile-shell[data-apt-shell-state="filters"] .apt-map-sidebar {
		transform: translateY( 0 );
		visibility: visible;
		transition: transform 0.3s var( --apt-shell-ease ), visibility 0s;
	}

	.apt-shell-sheet-top {
		position: sticky;
		top: 0;
		z-index: 2;
		padding: 8px 16px 6px;
		background: #fff;
	}
	.apt-shell-sheet-top__row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 6px;
	}
	.apt-shell-sheet-top__title {
		margin: 0;
		font-size: 18px;
		font-weight: 800;
		line-height: 1.3;
		color: var( --apt-shell-ink );
	}
	.apt-shell-icon-btn {
		display: grid;
		place-items: center;
		width: 36px;
		height: 36px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: #F3F4F6;
		color: #374151;
		cursor: pointer;
		-webkit-appearance: none;
	}

	/* "Show on map" — the existing layer tiles as wrapping chips */
	.apt-map-mobile-shell .apt-map-browse {
		display: block;
		width: auto;
		padding: 6px 16px 12px;
		border-bottom: 1px solid #F1F3F5;
	}
	.apt-map-mobile-shell .apt-map-browse__header {
		display: block;
		margin: 0 0 8px;
	}
	.apt-map-mobile-shell .apt-map-browse__title {
		margin: 0;
		font-size: 12px;
		font-weight: 700;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		color: var( --apt-shell-muted );
	}
	.apt-map-mobile-shell .apt-map-browse__sub { display: none; }
	.apt-map-mobile-shell .apt-map-layers {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
	}
	.apt-map-mobile-shell .apt-map-layer-btn {
		width: auto;
		min-height: 40px;
		padding: 4px 12px 4px 6px;
		border-radius: 999px;
	}

	.apt-map-mobile-shell .apt-map-filters {
		display: block;
		padding: 12px 16px 4px;
	}
	/* The sheet already says "Filters" — keep only the header's "Clear all". */
	.apt-map-mobile-shell .apt-map-filters__header {
		display: flex;
		justify-content: flex-end;
		margin: 0;
	}
	.apt-map-mobile-shell .apt-map-filters__title { display: none; }
	.apt-map-mobile-shell .apt-map-filter { margin-bottom: 14px; }
	.apt-map-mobile-shell .apt-map-filter__label {
		display: block;
		margin-bottom: 6px;
		font-size: 12px;
		font-weight: 700;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		color: var( --apt-shell-muted );
	}
	.apt-map-mobile-shell .apt-map-filter__toggle-row .apt-map-filter__label { margin: 0; }
	.apt-map-mobile-shell .apt-map-filter__select {
		min-height: 46px;
		font-size: 16px; /* no iOS focus zoom */
		border-radius: 12px;
	}
	.apt-rt-filter-sheet {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	.apt-map-mobile-shell .apt-map-sidebar__upsell { display: none; }
	.apt-map-mobile-shell .apt-map-sidebar__notice {
		display: flex;
		margin: 0 16px 12px;
		border-radius: 12px;
	}

	.apt-shell-sheet-foot {
		position: sticky;
		bottom: 0;
		z-index: 2;
		margin-top: auto;
		padding: 10px 16px calc( 12px + env( safe-area-inset-bottom, 0px ) );
		background: #fff;
		border-top: 1px solid #F1F3F5;
	}
	.apt-shell-cta {
		display: block;
		width: 100%;
		min-height: 50px;
		padding: 0 16px;
		border: 0;
		border-radius: 14px;
		background: var( --apt-shell-green );
		color: #fff;
		font-size: 16px;
		font-weight: 800;
		cursor: pointer;
		-webkit-appearance: none;
	}
	.apt-shell-cta:active { background: var( --apt-shell-green-dark ); }

	/* Cookie-consent "revisit" button (CookieYes, fixed bottom-left, site-wide):
	   on the map shell it would sit on top of the sheet title and the card's
	   actions. Lift it above the peek sheet (mirroring the locate control) and
	   hide it only while a sheet is open — it is back as soon as the user
	   returns to the map. Consent itself is untouched. */
	body.apt-page-map .cky-btn-revisit-wrapper {
		bottom: calc( var( --apt-shell-peek, 76px ) + 14px ) !important;
		left: 12px !important;
	}
	body.apt-page-map:has( #apt-map-shell:not( [data-apt-shell-state="base"] ) ) .cky-btn-revisit-wrapper {
		display: none !important;
	}

	/* Location picker opens above every sheet, pinned under the toolbar. */
	.apt-map-mobile-shell .apt-location-picker { top: auto; }

	@media ( prefers-reduced-motion: reduce ) {
		.apt-map-mobile-shell *,
		.apt-map-mobile-shell *::before,
		.apt-map-mobile-shell *::after {
			transition-duration: 0.01ms !important;
			animation-duration: 0.01ms !important;
		}
	}
}

/* ============================================================
   MAP-FIRST-MOBILE-1A — the map is the screen (≤767px)
   ============================================================
   The Leaflet map fills the whole shell (below the app header, above
   the bottom navigation); every control floats over it:

     .apt-map-nav        row 1 — location · search   (+ Filters at right)
     .apt-mapx-chrome    row 2 — Requests · Services · Professionals · More
                         row 3 — category chips (scrolls sideways)
     .apt-mapx-cluster   an opened group: "10 requests in this spot · Done"
     sheets              results (peek ↔ expanded), card, filters — as V1

   --apt-mapx-chrome (set by apt-map-mobile-shell.js) = the bottom edge of
   the floating rows, so no sheet ever slides under them.
   ============================================================ */
@media ( max-width: 767px ) {

	.apt-map-mobile-shell {
		--apt-mapx-chrome: 150px;
		--apt-mapx-float-shadow: 0 2px 8px rgba( 15, 23, 42, 0.16 ), 0 0 0 1px rgba( 15, 23, 42, 0.04 );
		border-top: 0;
		background: #E8ECEF; /* behind the tiles while they load */
	}

	/* ── Full-bleed map ─────────────────────────────────────── */
	.apt-map-mobile-shell .apt-map-app {
		position: absolute;
		inset: 0;
	}

	/* ── Row 1: location + search, floating ─────────────────── */
	.apt-map-mobile-shell .apt-map-nav {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		z-index: 40;
		padding: 10px 64px 0 12px;
		background: transparent;
		pointer-events: none;
	}
	.apt-map-mobile-shell .apt-map-nav > * { pointer-events: auto; }
	.apt-map-mobile-shell .apt-map-nav__location,
	.apt-map-mobile-shell .apt-map-nav__search-wrap .apt-map-nav__search-input {
		background: #fff;
		border-color: transparent;
		box-shadow: var( --apt-mapx-float-shadow );
	}
	.apt-map-mobile-shell .apt-map-nav__location { max-width: 120px; }
	.apt-map-mobile-shell .apt-map-nav__post { display: none; }

	/* Filters button joins row 1 (it lives in .apt-shell-bar inside the map layer). */
	.apt-map-mobile-shell .apt-shell-bar {
		position: absolute;
		top: 10px;
		right: 12px;
		z-index: 30;
		padding: 0;
		border: 0;
		background: transparent;
		box-shadow: none;
	}
	.apt-map-mobile-shell .apt-rt-filter-mobile,
	.apt-map-mobile-shell .apt-shell-layer-chip { display: none !important; }
	.apt-map-mobile-shell .apt-shell-filter-btn {
		border-color: transparent;
		box-shadow: var( --apt-mapx-float-shadow ) !important;
	}

	/* ── Rows 2 + 3 ─────────────────────────────────────────── */
	.apt-mapx-chrome {
		position: absolute;
		top: 58px;
		left: 0;
		right: 0;
		z-index: 40;
		pointer-events: none;
		transition: opacity 0.2s ease;
	}
	.apt-mapx-chrome > * { pointer-events: auto; }
	.apt-map-mobile-shell[data-apt-shell-state="filters"] .apt-mapx-chrome {
		opacity: 0;
		pointer-events: none;
	}
	.apt-map-mobile-shell[data-apt-shell-state="filters"] .apt-mapx-chrome > * { pointer-events: none; }

	.apt-mapx-tabs {
		display: flex;
		gap: clamp( 4px, 1.4vw, 6px );
		margin: 0 12px;
	}
	/* Fluid so all four labels always fit whole, down to 320px (never "Requ…"). */
	.apt-mapx-tab {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 5px;
		flex: 1 1 auto;
		min-width: max-content;
		height: 36px;
		margin: 0;
		padding: 0 clamp( 6px, 2vw, 10px );
		border: 1.5px solid transparent;
		border-radius: 999px;
		background: #fff;
		color: #1F2937;
		font-size: clamp( 11.5px, 3.4vw, 13px );
		font-weight: 700;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		box-shadow: var( --apt-mapx-float-shadow ) !important;
		-webkit-appearance: none;
		-webkit-tap-highlight-color: transparent;
	}
	.apt-mapx-tab .apt-mk-icon { display: none; }
	.apt-mapx-tab__label { white-space: nowrap; }
	.apt-mapx-tab.is-active,
	.apt-mapx-tab[aria-pressed="true"] {
		border-color: var( --apt-mk-base, #08B95A );
		background: var( --apt-mk-base, #08B95A );
		color: #fff;
	}
	.apt-mapx-tab--more { flex: 0 0 auto; padding: 0 clamp( 7px, 2.4vw, 10px ); }
	.apt-mapx-tab--more svg { flex-shrink: 0; transition: transform 0.2s ease; }
	.apt-mapx-tab--more[aria-expanded="true"] svg { transform: rotate( 180deg ); }
	.apt-mapx-tab:focus-visible,
	.apt-mapx-cat:focus-visible,
	.apt-mapx-more__item:focus-visible {
		outline: 2px solid #2D6CDF;
		outline-offset: 2px;
	}
	@media ( min-width: 460px ) {
		.apt-mapx-tab { padding: 0 10px 0 6px; font-size: 13px; }
		.apt-mapx-tab .apt-mk-icon { display: inline-grid; }
		.apt-mapx-tab.is-active .apt-mk-icon,
		.apt-mapx-tab[aria-pressed="true"] .apt-mk-icon { box-shadow: 0 0 0 2px rgba( 255, 255, 255, 0.85 ); }
		.apt-mapx-tab--more { padding: 0 12px; }
	}

	.apt-mapx-more { position: relative; flex: 0 0 auto; display: flex; }
	.apt-mapx-more__menu {
		position: absolute;
		top: calc( 100% + 8px );
		right: 0;
		z-index: 60;
		width: 248px;
		padding: 6px;
		border-radius: 16px;
		background: #fff;
		box-shadow: 0 12px 32px rgba( 15, 23, 42, 0.22 ), 0 0 0 1px rgba( 15, 23, 42, 0.05 );
	}
	.apt-mapx-more__item {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
		min-height: 52px;
		margin: 0;
		padding: 8px 10px;
		border: 0;
		border-radius: 12px;
		background: transparent;
		color: #0F172A;
		text-align: left;
		cursor: pointer;
		box-shadow: none !important;
		-webkit-appearance: none;
	}
	.apt-mapx-more__item[aria-checked="true"] { background: var( --apt-mk-tint, #F3F4F6 ); }
	.apt-mapx-more__item:active { background: #F3F4F6; }
	.apt-mapx-more__text { display: flex; flex-direction: column; min-width: 0; }
	.apt-mapx-more__label { font-size: 15px; font-weight: 700; line-height: 1.25; }
	.apt-mapx-more__desc { font-size: 12.5px; color: #64748B; line-height: 1.3; }

	.apt-mapx-cats {
		display: flex;
		gap: 6px;
		margin-top: 8px;
		padding: 0 12px 6px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		scroll-padding: 0 12px;
	}
	.apt-mapx-cats::-webkit-scrollbar { display: none; }
	.apt-mapx-cats[hidden] { display: none !important; }
	.apt-mapx-cat {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		flex: 0 0 auto;
		height: 34px;
		margin: 0;
		padding: 0 12px 0 6px;
		border: 1.5px solid transparent;
		border-radius: 999px;
		background: #fff;
		color: #1F2937;
		font-size: 13px;
		font-weight: 600;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		box-shadow: var( --apt-mapx-float-shadow ) !important;
		-webkit-appearance: none;
		-webkit-tap-highlight-color: transparent;
	}
	.apt-mapx-cat[data-apt-mapx-cat=""] { padding: 0 14px; }
	.apt-mapx-cat.is-active {
		border-color: var( --apt-mk-base, #0F172A );
		background: var( --apt-mk-base, #0F172A );
		color: #fff;
	}
	.apt-mapx-cat.is-active .apt-mk-icon { box-shadow: 0 0 0 2px rgba( 255, 255, 255, 0.9 ); }

	/* Local Businesses keeps its own directory categories in the Filters sheet; on the layers that use the shared
	   category row the sheet's Category select would be a second copy of it, so it steps aside there. The Browse
	   tiles are replaced by the tabs. */
	.apt-map-mobile-shell[data-apt-mapx-pcat="1"] .apt-map-filters .apt-map-filter:has( #apt-cat-filter ) { display: none; }
	.apt-map-mobile-shell .apt-map-browse { display: none; }

	/* ── Map controls over the full-bleed map ───────────────── */
	.apt-map-mobile-shell .leaflet-control-zoom { display: none; }
	.apt-map-mobile-shell .leaflet-top { top: var( --apt-mapx-chrome ); }
	.apt-map-mobile-shell .leaflet-control-attribution { font-size: 9px; }

	.apt-shell-locate { color: #1A73E8; }
	.apt-shell-locate.has-fix { background: #1A73E8; color: #fff; }
	.apt-shell-locate.is-busy svg { animation: apt-mapx-pulse 1s ease-in-out infinite; }
	@keyframes apt-mapx-pulse { 50% { opacity: 0.35; } }

	/* Opened group bar */
	.apt-mapx-cluster {
		position: absolute;
		top: calc( var( --apt-mapx-chrome ) + 6px );
		left: 50%;
		z-index: 800;
		display: flex;
		align-items: center;
		gap: 10px;
		max-width: calc( 100% - 24px );
		padding: 5px 5px 5px 14px;
		transform: translateX( -50% );
		border-radius: 999px;
		background: #0F172A;
		color: #fff;
		font-size: 13px;
		font-weight: 700;
		white-space: nowrap;
		box-shadow: 0 6px 18px rgba( 15, 23, 42, 0.3 );
	}
	.apt-mapx-cluster[hidden] { display: none !important; }
	.apt-mapx-cluster__text { overflow: hidden; text-overflow: ellipsis; }
	.apt-mapx-cluster__close {
		min-height: 32px;
		padding: 0 14px;
		border: 0;
		border-radius: 999px;
		background: #fff;
		color: #0F172A;
		font-size: 13px;
		font-weight: 800;
		cursor: pointer;
		box-shadow: none !important;
	}
	.apt-map-mobile-shell:not( [data-apt-shell-state="base"] ) .apt-mapx-cluster { display: none; }

	/* Notes over the map start below the floating rows. */
	.apt-map-mobile-shell .apt-map-launch {
		top: calc( var( --apt-mapx-chrome ) + 6px );
		left: 12px;
		right: 12px;
	}
	.apt-map-mobile-shell .apt-map-toast {
		bottom: calc( var( --apt-shell-peek ) + 70px );
	}

	/* ── Sheets never slide under the floating rows ─────────── */
	body.apt-page-map .apt-map-mobile-shell .apt-map-results {
		height: calc( 100% - var( --apt-mapx-chrome ) - 8px );
	}
	.apt-map-mobile-shell .apt-map-sidebar {
		max-height: calc( 100% - 64px );
	}
	.apt-map-mobile-shell .apt-map-sheet {
		max-height: min( 70%, calc( 100% - var( --apt-mapx-chrome ) - 8px ) );
	}

	/* Results sheet: the scope line in the list header is shown on phones too, inside the sheet. */
	.apt-map-mobile-shell .apt-map-results__scope-clear { display: none; }
}

/* ============================================================
   MAP-FIRST-1C — Map / Browse switch (≤767px, Map screen only)
   ============================================================
   The switch sits in the results sheet's head. Browse
   ([data-apt-shell-view="browse"], apt-map-mobile-shell.js) is the
   same results sheet opened over the whole map area, with every live
   layer as a section tab. The map underneath is only hidden
   (visibility), never resized or moved, so Map finds it unchanged.
   ============================================================ */
@media ( max-width: 767px ) {

	/* ── The switch ─────────────────────────────────────────── */
	/* 30px tall on the title line, so the meta line below it can use the full width; each half's touch area
	   reaches 6px further up and down. */
	.apt-shell-view {
		position: absolute;
		top: 9px;
		right: 12px;
		z-index: 3;
		display: inline-flex;
		gap: 2px;
		padding: 2px;
		border-radius: 999px;
		background: #EEF1F4;
	}
	.apt-shell-view__btn {
		position: relative;
		display: inline-flex;
		align-items: center;
		gap: 5px;
		height: 26px;
		margin: 0;
		padding: 0 11px;
		border: 0;
		border-radius: 999px;
		background: transparent;
		color: #475569;
		font: inherit;
		font-size: 12.5px;
		font-weight: 700;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		box-shadow: none !important;
		-webkit-appearance: none;
		-webkit-tap-highlight-color: transparent;
	}
	.apt-shell-view__btn::before {
		content: "";
		position: absolute;
		inset: -6px -1px;
	}
	.apt-shell-view__btn svg { flex-shrink: 0; display: none; }
	.apt-shell-view__btn[aria-pressed="true"] {
		background: #fff;
		color: var( --apt-shell-ink );
		box-shadow: 0 1px 3px rgba( 15, 23, 42, 0.16 ) !important;
	}
	.apt-map-mobile-shell .apt-shell-view__btn:focus-visible { outline: 2px solid #2D6CDF; outline-offset: 1px; }
	@media ( min-width: 375px ) {
		.apt-shell-view__btn svg { display: block; }
	}

	/* The switch takes the place of the head's expand cue; the title keeps clear of it. */
	.apt-map-mobile-shell .apt-shell-sheet-head__cue { display: none; }
	.apt-map-mobile-shell .apt-shell-sheet-head__title { padding-right: 128px; }
	@media ( min-width: 375px ) {
		.apt-map-mobile-shell .apt-shell-sheet-head__title { padding-right: 162px; }
	}

	/* "Show on map" — Browse only. */
	.apt-map-mobile-shell .apt-result-row { position: relative; }
	.apt-map-mobile-shell .apt-result-row__onmap { display: none; }

	/* ── Browse view ────────────────────────────────────────── */
	.apt-map-mobile-shell[data-apt-shell-view="browse"],
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-map-app { background: #fff; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-map-center { visibility: hidden; }

	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-chrome {
		padding-bottom: 2px;
		background: #fff;
	}
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-map-nav__location,
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-map-nav__search-wrap .apt-map-nav__search-input,
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-shell-filter-btn {
		box-shadow: 0 0 0 1px var( --apt-shell-line ) !important;
	}

	/* Sections: every live layer as a tab, one row that scrolls sideways. */
	.apt-mapx-tab--browse { display: none; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tabs {
		margin: 0;
		padding: 2px 12px 4px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
		scroll-padding: 0 12px;
	}
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tabs::-webkit-scrollbar { display: none; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-more { display: none; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tab--browse { display: inline-flex; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tab {
		flex: 0 0 auto;
		padding: 0 12px;
		font-size: 13px;
		box-shadow: 0 0 0 1px var( --apt-shell-line ) !important;
	}
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tab.is-active,
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-tab[aria-pressed="true"] { box-shadow: none !important; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-cat { box-shadow: 0 0 0 1px var( --apt-shell-line ) !important; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-mapx-cat.is-active { box-shadow: none !important; }

	/* The list fills everything below the sections. */
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-map-results {
		height: calc( 100% - var( --apt-mapx-chrome ) );
		border-top: 1px solid var( --apt-shell-line );
		border-radius: 0;
		box-shadow: none;
		transform: none;
		transition: none;
	}
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-shell-sheet-head {
		min-height: 0;
		padding: 14px 16px 10px;
		cursor: default;
		touch-action: auto;
	}
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-shell-sheet-head .apt-shell-handle { display: none; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-shell-view { top: 5px; }

	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-result-card { padding-bottom: 48px; }
	.apt-map-mobile-shell[data-apt-shell-view="browse"] .apt-result-row__onmap {
		position: absolute;
		left: 72px;
		bottom: 10px;
		display: inline-flex;
		align-items: center;
		gap: 5px;
		height: 30px;
		margin: 0;
		padding: 0 12px 0 10px;
		border: 1.5px solid var( --apt-mk-base, var( --apt-shell-green ) );
		border-radius: 999px;
		background: #fff;
		color: var( --apt-shell-ink );
		font: inherit;
		font-size: 12.5px;
		font-weight: 700;
		line-height: 1;
		cursor: pointer;
		box-shadow: none !important;
		-webkit-appearance: none;
	}
	.apt-map-mobile-shell .apt-result-row__onmap svg { color: #1A73E8; }
	.apt-map-mobile-shell .apt-result-row__onmap:focus-visible { outline: 2px solid #2D6CDF; outline-offset: 2px; }

	/* An open group on the map scopes the list — said plainly, with the way back to everything. */
	.apt-shell-browse-scope {
		display: flex;
		align-items: center;
		gap: 10px;
		flex-shrink: 0;
		margin: 0 16px 6px;
		padding: 8px 8px 8px 12px;
		border-radius: 12px;
		background: #F1F5F9;
		color: #334155;
		font-size: 13px;
		font-weight: 600;
		line-height: 1.3;
	}
	.apt-shell-browse-scope__text { flex: 1 1 auto; min-width: 0; }
	.apt-shell-browse-scope__btn {
		flex-shrink: 0;
		min-height: 32px;
		padding: 0 14px;
		border: 0;
		border-radius: 999px;
		background: #0F172A;
		color: #fff;
		font: inherit;
		font-size: 13px;
		font-weight: 800;
		cursor: pointer;
		box-shadow: none !important;
	}

	/* Filters open over Browse; the list stays behind the scrim. */
	body.apt-page-map .apt-map-mobile-shell[data-apt-shell-view="browse"][data-apt-shell-state="filters"] .apt-map-results {
		transform: none;
	}
}

/* PWA-FIX-04 — the request's details in the selected sheet: as tall as the map area under the floating rows. */
@media ( max-width: 767px ) {
	.apt-map-mobile-shell .apt-map-sheet.is-detail {
		/* Anchored under the floating rows; the bottom stays wherever the shell puts the sheet (above the peek). */
		top: calc( var( --apt-mapx-chrome ) + 8px );
		height: auto;
		max-height: none;
		padding-top: 12px; /* room for the sheet's handle only */
	}
	.apt-map-mobile-shell .apt-map-sheet.is-detail .apt-map-detail__bar { border-radius: 0; }
}
