/* Phone and iPad layout for index.html and sandbox.html. scripts/mobile.js sets the classes on <html>:
   m-phone (under 700 px), m-tab (700-1180 px, or a touch screen 700 px and up, e.g. a 13" iPad),
   m-wide (m-tab and 1200 px+), m-touch (coarse pointer), m-mappage (a map tab is showing).
   Desktop with a mouse gets none of this. Linked after the pages' own styles so equal selectors win. */

:root { --m-top: 52px; --m-sheet-h: 0px; --m-side-w: 340px; --m-card-w: 420px;
  --m-safe-t: env(safe-area-inset-top, 0px); --m-safe-b: env(safe-area-inset-bottom, 0px);
  --m-safe-l: env(safe-area-inset-left, 0px); --m-safe-r: env(safe-area-inset-right, 0px);
  --m-shadow: 0 2px 6px rgba(0,0,0,0.28), 0 1px 2px rgba(0,0,0,0.2); }

/* iOS: 100vh includes the hidden toolbar; 100dvh is the visible height. */
@supports (height: 100dvh) { body { height: 100dvh; } }
html.m-touch, html.m-touch body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
/* Touch screens (phone and iPad): the page is pinned so it can't scroll, rubber-band or shift under the bars;
   no double-tap zoom; text doesn't grow when the phone turns sideways. mobile.js cancels pinch-zoom of the page. */
html.m-touch { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overflow: hidden; height: 100%; }
html.m-touch body { position: fixed; inset: 0; width: 100%; height: auto; overflow: hidden; }

/* ═════════ Touch: tap targets, no hover-only controls, no input zoom ═════════ */
html.m-touch .nav-link { min-height: 44px; }
html.m-touch .sf-row, html.m-touch .ss-sf-row, html.m-touch .sf-opt, html.m-touch .ss-sf-opt,
html.m-touch .adm-row, html.m-touch .stage-option, html.m-touch .region-option, html.m-touch .search-result { min-height: 44px; }
html.m-touch .ss-chip, html.m-touch .ss-select, html.m-touch .pipe-filter-chip, html.m-touch .map-controls .mc-btn,
html.m-touch .map-controls .mc-select, html.m-touch .dp-action-btn, html.m-touch .dp-tab, html.m-touch .ss-mini,
html.m-touch .ss-sf-seg button, html.m-touch .ss-seg button, html.m-touch #tam-phase button { min-height: 36px; }
html.m-touch #dp-close, html.m-touch #ss-dp-close, html.m-touch #tam-dp-close, html.m-touch .chat-icon-btn { min-width: 40px; min-height: 40px; font-size: 18px; }
html.m-touch .leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; font-size: 20px !important; }
html.m-touch .leaflet-container input[type="checkbox"], html.m-touch .sf-opt input[type="checkbox"],
html.m-touch .ss-sf-opt input[type="checkbox"], html.m-touch #map-controls input[type="checkbox"], html.m-touch #ss-layers input { width: 18px; height: 18px; }
html.m-touch #map-controls label, html.m-touch #map-controls button, html.m-touch #ss-layers label { min-height: 40px; }
/* Text boxes at 16px so iOS Safari doesn't zoom the page when one is tapped. */
html.m-touch #search, html.m-touch #ss-search, html.m-touch #tam-search, html.m-touch .chat-input, html.m-touch .auth-input,
html.m-touch #feedback-modal-card textarea, html.m-touch #feedback-modal-card select { font-size: 16px; }
/* Controls that only appeared on hover stay visible. */
html.m-touch .chat-copy { opacity: 0.7; }
html.m-touch .comp-nav-tab .cntx { opacity: 1; }
/* The thin tabs that hide and show the list panel (iPad) are wide enough for a finger. */
html.m-touch .ss-side-toggle { width: 28px; height: 64px; font-size: 14px; }
html.m-touch #sidebar-show-tab { min-width: 28px; min-height: 64px; display: flex; align-items: center; justify-content: center; }
html.m-touch #sidebar-hide-btn { min-width: 40px; min-height: 40px; }
/* Draw mode: the finger draws, the page doesn't pan. */
html.m-touch .leaflet-container[style*="crosshair"] { touch-action: none; }

/* ═════════ Shared by phone and iPad ═════════ */
html.m-phone #total-badge, html.m-tab #total-badge,
html.m-phone #user-chip, html.m-tab #user-chip,
html.m-phone #theme-btn, html.m-tab #theme-btn { display: none !important; }
/* Sync Now moves into the Admin menu (mobile.js). */
#admin-panel > #sync-btn { display: flex; align-items: center; width: calc(100% - 16px); margin: 8px 8px 2px; min-height: 40px; justify-content: center; font-size: 12px; }
html.m-phone .auth-card, html.m-tab .auth-card { width: min(380px, calc(100vw - 32px)); padding: 32px 24px; box-sizing: border-box; }
#chat-btn { margin-bottom: var(--m-safe-b); }

/* Claude's picks: the Chat button (phone and iPad) and the "‹ 2 of 12 ›" pill shown while a pick's card is open. */
.m-picks-chat { display: none; }
html.m-phone .m-picks-chat, html.m-tab .m-picks-chat { display: inline-flex; }
.m-pick-nav { position: fixed; z-index: 1070; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border2); box-shadow: var(--m-shadow); font-size: 13px; color: var(--text); }
.m-pick-nav[hidden] { display: none; }
.m-pick-nav span { padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-pick-nav button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.m-pick-nav button:disabled { opacity: 0.3; cursor: default; }
html.m-phone .m-pick-nav { left: 50%; transform: translateX(-50%); bottom: calc(var(--m-sheet-h) + 10px); }
/* iPad: centred on the map, clear of its legend. */
html.m-tab .m-pick-nav { left: calc(var(--m-side-w) + (100vw - var(--m-side-w)) / 2); transform: translateX(-50%); bottom: calc(16px + var(--m-safe-b)); }
html.m-tab.m-wide .m-pick-nav { left: calc(var(--m-side-w) + var(--m-card-w) + (100vw - var(--m-side-w) - var(--m-card-w)) / 2); }
/* While the pill shows, the legends at the map's bottom left sit above it. */
html.m-picknav #tam-legend, html.m-picknav #ss-legend { bottom: 96px; }
html.m-picknav #ss-gp-legend { bottom: 206px; }
html.m-short.m-picknav .m-layers-open > #ss-legend, html.m-phone.m-picknav .m-layers-open > #ss-legend { bottom: auto; }

/* ═════════ iPad (and narrow desktop windows) ═════════ */
html.m-tab #topbar { padding-left: var(--m-safe-l); padding-right: var(--m-safe-r); }
html.m-tab #nav { flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 0 8px 0 14px; border-right: 0; }
html.m-tab #nav::-webkit-scrollbar { display: none; }
html.m-tab .logo { margin-right: 10px; }
html.m-tab #filters-bar { flex: 0 1 auto; padding: 0 8px; overflow: visible; }
html.m-tab #filters-bar .spacer { display: none; }
html.m-tab #search { width: clamp(150px, 18vw, 240px); }
html.m-tab #right-bar { padding: 0 12px 0 8px; border-left: 0; }

/* List panel */
html.m-tab #sidebar:not(.hidden), html.m-tab .ss-sidebar { width: var(--m-side-w); }
/* Site Screen at 700-900 px stacks the map over the list; keep them side by side on iPad. */
html.m-tab #page-sitescreen { overflow: hidden; }
html.m-tab .ss-body { flex-direction: row; }
html.m-tab .ss-map-wrap { order: 0; height: auto; flex: 1; }
html.m-tab .ss-sidebar { order: -1; border-right: 1px solid var(--border); }
html.m-tab #ss-list { overflow-y: auto; }
html.m-tab #ss-search { width: 200px; }
html.m-tab .ss-side-toggle { display: block; left: var(--m-side-w); }
html.m-tab .ss-body.ss-collapsed > .ss-side-toggle { left: 0; }
html.m-tab .ss-body.ss-collapsed > .ss-sidebar { display: none; }

/* Deal card: in the panel, over the list (portrait) or beside it (1200 px+). */
html.m-tab #detail-panel { top: var(--m-top); bottom: 0; right: auto; left: 0; width: var(--m-side-w); max-height: none;
  border-radius: 0; border-width: 0 1px 0 0; box-shadow: 4px 0 18px rgba(0,0,0,0.25); position: fixed; }
html.m-tab.m-wide[data-m-page="map"] #detail-panel { left: var(--m-side-w); width: var(--m-card-w); }
html.m-tab.m-wide[data-m-page="map"]:has(#sidebar.hidden) #detail-panel { left: 0; }
/* Beside the list, the map gives up the card's width instead of hiding under it (its controls stay clear and a
   selected deal centres in what's left). */
html.m-tab.m-wide[data-m-page="map"]:has(#detail-panel.open) #map-wrap { margin-left: var(--m-card-w); }
/* Site Screen / TAM cards: same idea inside the map area. */
html.m-tab #ss-detail, html.m-tab #tam-detail { top: 0; bottom: 0; right: auto; left: 0; width: var(--m-card-w); max-width: none; max-height: none;
  border-radius: 0; border-width: 0 1px 0 0; box-shadow: 4px 0 18px rgba(0,0,0,0.25); }
html.m-tab:not(.m-wide) .ss-map-wrap { overflow: visible; }
html.m-tab:not(.m-wide) .ss-body:not(.ss-collapsed) #ss-detail,
html.m-tab:not(.m-wide) .ss-body:not(.ss-collapsed) #tam-detail { left: calc(-1 * var(--m-side-w)); width: var(--m-side-w); }
html.m-tab #ss-detail:not([hidden]) ~ #ss-layers, html.m-tab #ss-detail:not([hidden]) ~ #ss-map-legends,
html.m-tab #tam-detail:not([hidden]) ~ .ml-layers, html.m-tab #tam-detail:not([hidden]) ~ .ml-legends { right: 14px; }
html.m-tab.m-wide .ss-map-wrap:has(> #ss-detail:not([hidden])) > #ss-map,
html.m-tab.m-wide .ss-map-wrap:has(> #tam-detail:not([hidden])) > #tam-map { left: var(--m-card-w); }
html.m-tab.m-wide .ss-map-wrap:has(> #ss-detail:not([hidden])) > #ss-tiles,
html.m-tab.m-wide .ss-map-wrap:has(> #ss-detail:not([hidden])) > #ss-legend,
html.m-tab.m-wide .ss-map-wrap:has(> #ss-detail:not([hidden])) > #ss-gp-legend,
html.m-tab.m-wide .ss-map-wrap:has(> #tam-detail:not([hidden])) > #tam-legend,
html.m-tab.m-wide .ss-map-wrap:has(> #tam-detail:not([hidden])) > #tam-tools { left: calc(var(--m-card-w) + 14px); }
html.m-tab .ss-map-wrap:has(> #ss-detail:not([hidden])) > #ss-draw-bar,
html.m-tab .ss-map-wrap:has(> #tam-detail:not([hidden])) > #tam-draw-bar { left: calc(50% + var(--m-card-w) / 2); }
html.m-tab #ss-tiles { max-width: calc(100% - 320px); }
/* Map tab: the layer list folds behind a round button at the top right, as on phone. */
html.m-tab #map-wrap > .m-fab { display: flex; align-items: center; justify-content: center; position: absolute; right: calc(14px + var(--m-safe-r)); top: 12px;
  width: 44px; height: 44px; border-radius: 50%; z-index: 1040; background: var(--surface); color: var(--text); border: 1px solid var(--border2); box-shadow: var(--m-shadow); padding: 0; cursor: pointer; }
html.m-tab #map-wrap.m-layers-open > .m-fab { background: var(--green); border-color: var(--green); color: #fff; }
html.m-tab #map-controls { display: none; left: auto; right: calc(14px + var(--m-safe-r)); top: 64px; }
html.m-tab #map-wrap.m-layers-open > #map-controls { display: block; }
/* Claude's picks take the list panel's place; a pick's card opens over them (portrait) or beside them (landscape). */
html.m-tab #chat-picks { left: 0; right: auto; top: var(--m-top); bottom: 0; width: var(--m-side-w); max-width: none; height: auto;
  border-radius: 0; border-width: 0 1px 0 0; z-index: 1005; box-shadow: 4px 0 18px rgba(0,0,0,0.25); }
html.m-tab #detail-panel { z-index: 1010; }
/* The chat window keeps clear of the list panel. */
html.m-tab #chat-panel { max-width: calc(100vw - var(--m-side-w) - 36px); }
html.m-tab #deal-summary-panel { top: var(--m-top); height: calc(100% - var(--m-top)); border-bottom-left-radius: 0; }

/* Comps: filters | tables | map. Portrait puts the map across the top. */
html.m-tab .layout { grid-template-columns: var(--sidebar-w, 220px) minmax(0, 1fr) minmax(320px, 40%); }
html.m-tab .map-pane { min-width: 0; }
@media (orientation: portrait) {
  html.m-tab .layout { grid-template-columns: var(--sidebar-w, 220px) minmax(0, 1fr); grid-template-rows: 40% minmax(0, 1fr); }
  html.m-tab .layout > .map-pane { grid-column: 1 / -1; grid-row: 1; border-left: 0; border-bottom: 1px solid var(--border); }
  html.m-tab .layout > .sidebar, html.m-tab .layout > .main { grid-row: 2; }
}
html.m-tab .main { overflow-x: auto; }

/* Phone on its side (iPad layout under 500 px tall): slimmer bar, one-row toolbars, legends behind the layers button. */
html.m-short #topbar { height: 44px; }
html.m-short .nav-link { min-height: 0; padding: 0 11px; }
html.m-short .ss-toolbar, html.m-short .pipe-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 5px 12px; }
html.m-short .ss-toolbar::-webkit-scrollbar, html.m-short .pipe-toolbar::-webkit-scrollbar { display: none; }
html.m-short .ss-toolbar > *, html.m-short .pipe-toolbar > * { flex-shrink: 0; }
html.m-short .ss-toolbar .ss-title, html.m-short #ss-stamp, html.m-short #tam-stamp { display: none; }
html.m-short .ss-pop, html.m-short .ss-pop.ss-method { position: fixed; top: calc(var(--m-top) + 48px); left: auto; right: 12px; width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - var(--m-top) - 60px); overflow-y: auto; }
html.m-short .pipe-filter-pop { position: fixed; top: calc(var(--m-top) + 44px) !important; max-height: calc(100dvh - var(--m-top) - 56px); overflow-y: auto; }
html.m-short .ss-map-wrap > .m-fab { display: flex; align-items: center; justify-content: center; position: absolute; right: calc(12px + var(--m-safe-r)); top: 10px;
  width: 40px; height: 40px; border-radius: 50%; z-index: 1040; background: var(--surface); color: var(--text); border: 1px solid var(--border2); box-shadow: var(--m-shadow); padding: 0; cursor: pointer; }
html.m-short .ss-map-wrap.m-layers-open > .m-fab { background: var(--green); border-color: var(--green); color: #fff; }
html.m-short #ss-layers, html.m-short #ss-legend, html.m-short #ss-gp-legend, html.m-short #ss-map-legends, html.m-short #tam-legend, html.m-short #ss-tiles, html.m-short .ml-layers, html.m-short .ml-legends { display: none; }
html.m-short .m-layers-open > #ss-layers, html.m-short .m-layers-open > #ss-legend, html.m-short .m-layers-open > #tam-legend, html.m-short .m-layers-open > .ml-layers { display: grid; }
html.m-short .m-layers-open > #ss-map-legends, html.m-short .m-layers-open > .ml-legends { display: flex; }
html.m-short #ss-layers, html.m-short #tam-legend, html.m-short .ml-layers { top: 58px; right: calc(12px + var(--m-safe-r)); left: auto; bottom: auto; max-height: calc(100% - 70px); overflow-y: auto; }
html.m-short .ss-map-wrap:has(> .ml-layers) > #tam-legend { right: auto; left: 14px; top: 10px; }
html.m-short .m-layers-open > #ss-legend { top: 10px; bottom: auto; max-height: calc(100% - 20px); overflow-y: auto; }
html.m-short #chat-btn { width: 44px; height: 44px; bottom: 12px; right: calc(12px + var(--m-safe-r)); }
html.m-short #chat-panel { top: 8px; bottom: 8px; height: auto; }
html.m-short .leaflet-control-zoom { display: none; }

/* Pipeline kanban: swipe between columns. */
html.m-tab .pipe-kanban, html.m-phone .pipe-kanban { scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
html.m-tab .pipe-col, html.m-phone .pipe-col { scroll-snap-align: start; }

/* ═════════ Phone ═════════ */
/* Floating top bar: search pill + Admin on the first row, the tabs as chips under it. */
html.m-phone #topbar { position: fixed; top: 0; left: 0; right: 0; height: auto; z-index: 1100; flex-wrap: wrap; gap: 8px;
  padding: calc(var(--m-safe-t) + 8px) calc(var(--m-safe-r) + 10px) 8px calc(var(--m-safe-l) + 10px);
  background: transparent; border-bottom: 0; pointer-events: none; }
html.m-phone #topbar > * { pointer-events: auto; }
html.m-phone:not(.m-mappage) #topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
html.m-phone #filters-bar { order: 1; flex: 1 1 0; min-width: 0; padding: 0; overflow: visible; }
html.m-phone #filters-bar .spacer { display: none; }
html.m-phone #search-wrap { flex: 1; }
html.m-phone #search { width: 100%; height: 44px; box-sizing: border-box; border-radius: 22px; padding: 0 16px 0 38px;
  background: var(--surface); border: 1px solid var(--border2); box-shadow: var(--m-shadow); }
html.m-phone #search-icon { left: 14px; font-size: 14px; }
html.m-phone #search-dropdown { left: 10px !important; right: 10px; top: calc(var(--m-top) + 4px) !important; min-width: 0; max-width: none; max-height: 50dvh; }
html.m-phone #right-bar { order: 2; padding: 0; border: 0; height: auto; gap: 6px; }
html.m-phone #guide-btn { display: none; }
html.m-phone #admin-btn { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; font-size: 0;
  background: var(--surface); border: 1px solid var(--border2); box-shadow: var(--m-shadow); color: var(--text); }
html.m-phone #admin-btn::before { content: '⚙'; font-size: 19px; line-height: 1; }
html.m-phone #admin-caret { display: none; }
html.m-phone #admin-panel { max-width: calc(100vw - 20px); max-height: calc(100dvh - 80px); overflow-y: auto; }
html.m-phone #nav { order: 3; flex: 1 0 100%; height: 36px; padding: 0; gap: 6px; border: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
html.m-phone #nav::-webkit-scrollbar { display: none; }
html.m-phone #nav .logo, html.m-phone #nav .nav-divider { display: none; }
html.m-phone .nav-link, html.m-phone .comp-nav-tab { height: 34px; min-height: 34px; padding: 0 14px; margin: 0; border-radius: 17px; border: 1px solid var(--border2);
  background: var(--surface); color: var(--text); font-size: 13px; box-shadow: var(--m-shadow); flex-shrink: 0; }
html.m-phone .nav-link.active, html.m-phone .comp-nav-tab.active { background: var(--green); border-color: var(--green); color: #fff; }
html.m-phone #comp-tabs-nav { height: 34px; gap: 6px; overflow: visible; flex-shrink: 0; }
html.m-phone:not(.m-mappage) .nav-link, html.m-phone:not(.m-mappage) .comp-nav-tab { box-shadow: none; }

/* Pages fill the screen under the bar; map tabs run the map edge to edge behind it. */
html.m-phone body > [id^="page-"] { padding-top: var(--m-top); box-sizing: border-box; }
html.m-phone #page-map, html.m-phone #page-sitescreen, html.m-phone #page-tam, html.m-phone #page-comps { padding-top: 0; }
html.m-phone #map-wrap { position: relative; flex: 1; }
html.m-phone #sidebar-show-tab, html.m-phone #sidebar-hide-btn, html.m-phone .ss-side-toggle, html.m-phone #zoom-indicator { display: none !important; }
html.m-phone .leaflet-control-zoom { display: none; }
html.m-phone .leaflet-bottom { bottom: var(--m-sheet-h); }
html.m-phone .leaflet-top { top: var(--m-top); }

/* Bottom sheets: always full height, slid up by their top (mobile.js sets both). */
html.m-phone .m-sheet { position: fixed !important; left: 0 !important; right: 0 !important; bottom: auto !important; top: 100%; width: auto !important; min-width: 0 !important; max-width: none !important;
  max-height: none !important; z-index: 1050; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border2); border-bottom: 0; border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.3); padding-bottom: var(--m-safe-b); transition: top 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
html.m-phone .m-sheet.m-dragging { transition: none; user-select: none; }
html.m-phone #sidebar.m-sheet.hidden { border-right: 1px solid var(--border2); }
.m-grab { display: none; }
html.m-phone .m-sheet > .m-grab { display: block; flex-shrink: 0; height: 22px; touch-action: none; cursor: grab; position: relative; }
html.m-phone .m-sheet > .m-grab::after, html.m-phone .m-sheet-card::before, html.m-phone .m-sheet-picks::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--border2); margin: 9px auto 0; }
html.m-phone .m-sheet-card::before, html.m-phone .m-sheet-picks::before { margin: 8px auto 4px; flex-shrink: 0; }
html.m-phone .m-sheet #sidebar-header, html.m-phone .m-sheet .ss-side-head { touch-action: none; padding-top: 2px; }
html.m-phone .m-sheet-card { z-index: 1060 !important; border-radius: 16px 16px 0 0 !important; }
html.m-phone #detail-panel.m-sheet:not(.open), html.m-phone #deal-summary-panel.m-sheet:not(.open) { display: none; }
html.m-phone #ss-detail.m-sheet[hidden], html.m-phone #tam-detail.m-sheet[hidden], html.m-phone #ss-bd.m-sheet[hidden] { display: none; }
html.m-phone #ss-detail .ss-dp-scroll, html.m-phone #tam-detail .ss-dp-scroll { flex: 1; min-height: 0; overflow-y: auto; }
html.m-phone #detail-panel.m-sheet > :last-child { min-height: 0; }
html.m-phone .m-sheet #sidebar-list, html.m-phone .m-sheet #ss-list, html.m-phone .m-sheet #tam-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
html.m-phone .m-sheet .dp-scroll, html.m-phone .m-sheet .ss-dp-scroll, html.m-phone #page-comps .m-sheet.main { overscroll-behavior: contain; }

/* Map list: filters as a row of chips; an open filter's options drop in full width under them. */
html.m-phone #sidebar-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 10px; border-bottom: 1px solid var(--border); }
html.m-phone #sidebar-filters > .sf-row { flex: 0 0 auto; min-height: 34px; padding: 0 12px; gap: 6px; border: 1px solid var(--border2); border-radius: 17px; background: var(--surface2); }
html.m-phone #sidebar-filters > .sf-row .sf-label { flex: none; text-align: left; font-size: 12px; }
html.m-phone #sidebar-filters > .sf-row .sf-caret { font-size: 8px; }
html.m-phone #sidebar-filters > .sf-dd { flex: 1 0 100%; order: 10; border: 1px solid var(--border); border-radius: 10px; }
html.m-phone #sidebar-filters > .sf-reset-btn { flex: 0 0 auto; width: auto; min-height: 34px; padding: 0 10px; margin: 0; border: 0; font-size: 12px; }
html.m-phone #sidebar-filters > .sf-sort-row { flex: 1 0 100%; order: 11; padding: 0; border: 0; }

/* Site Screen / TAM: the toolbar rides at the top of the list sheet (mobile.js) as one row that scrolls sideways. */
html.m-phone #page-sitescreen, html.m-phone #page-tam { overflow: hidden; }
html.m-phone .ss-body { flex-direction: row; flex: 1; }
html.m-phone .ss-map-wrap { order: 0; height: auto; flex: 1; }
html.m-phone .m-sheet > .ss-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 4px 12px 8px; gap: 6px;
  border-bottom: 1px solid var(--border); background: transparent; flex-shrink: 0; z-index: auto; }
html.m-phone .m-sheet > .ss-toolbar::-webkit-scrollbar { display: none; }
html.m-phone .m-sheet > .ss-toolbar > * { flex-shrink: 0; }
html.m-phone .m-sheet > .ss-toolbar .ss-title, html.m-phone .m-sheet > .ss-toolbar #ss-stamp, html.m-phone .m-sheet > .ss-toolbar #tam-stamp { display: none; }
html.m-phone .m-sheet > .ss-toolbar .ss-tb-right { margin-left: 0; }
html.m-phone #ss-search, html.m-phone #tam-search { width: 180px; }
/* Its pop-ups (Costs, How it works) open as a card over the map. */
html.m-phone .ss-pop, html.m-phone .ss-pop.ss-method { position: fixed; left: 10px; right: 10px; top: calc(var(--m-top) + 8px); width: auto; max-width: none;
  max-height: calc(100dvh - var(--m-top) - var(--m-sheet-h) - 20px); overflow-y: auto; z-index: 1200; }
html.m-phone .ss-pop .ss-grid { grid-template-columns: 1fr; }

/* Round buttons down the right side of the map. */
.m-fab { display: none; }
html.m-phone .m-fab { display: flex; align-items: center; justify-content: center; position: absolute; right: calc(10px + var(--m-safe-r)); top: calc(var(--m-top) + 6px);
  width: 44px; height: 44px; border-radius: 50%; z-index: 1040; background: var(--surface); color: var(--text); border: 1px solid var(--border2); box-shadow: var(--m-shadow); padding: 0; cursor: pointer; }
html.m-phone .m-layers-open > .m-fab { background: var(--green); border-color: var(--green); color: #fff; }
/* Layer lists and legends stay folded until the button is tapped. */
html.m-phone #map-controls, html.m-phone #ss-layers, html.m-phone #ss-legend, html.m-phone #ss-gp-legend, html.m-phone #ss-map-legends,
html.m-phone #tam-legend, html.m-phone #ss-tiles, html.m-phone .ml-layers, html.m-phone .ml-legends { display: none; }
html.m-phone .m-layers-open > #map-controls, html.m-phone .m-layers-open > #ss-layers, html.m-phone .m-layers-open > #tam-legend, html.m-phone .m-layers-open > .ml-layers { display: grid; }
html.m-phone .m-layers-open > #map-controls { display: block; }
html.m-phone .m-layers-open > #ss-legend { display: grid; }
html.m-phone .m-layers-open > #ss-map-legends, html.m-phone .m-layers-open > .ml-legends { display: flex; }
html.m-phone #map-controls, html.m-phone #ss-layers, html.m-phone #tam-legend, html.m-phone .ml-layers { position: absolute; left: auto; right: calc(10px + var(--m-safe-r)); top: calc(var(--m-top) + 58px); bottom: auto;
  z-index: 1045; max-height: calc(100dvh - var(--m-top) - var(--m-sheet-h) - 80px); overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
html.m-phone .ss-map-wrap:has(> .ml-layers).m-layers-open > #tam-legend { left: calc(10px + var(--m-safe-l)); right: auto; }
html.m-phone .m-layers-open > #ss-legend { position: absolute; left: calc(10px + var(--m-safe-l)); right: auto; top: calc(var(--m-top) + 58px); bottom: auto; z-index: 1045; }
html.m-phone .m-layers-open > #ss-map-legends, html.m-phone .m-layers-open > .ml-legends { top: auto; bottom: calc(var(--m-sheet-h) + 10px); left: 10px; right: 10px; width: auto; max-height: 40dvh; }
html.m-phone .m-layers-open > #ss-gp-legend:not([hidden]) { display: grid; position: absolute; left: 10px; top: auto; bottom: calc(var(--m-sheet-h) + 10px); z-index: 1044; }
html.m-phone #ss-detail:not([hidden]) ~ #ss-layers, html.m-phone #ss-detail:not([hidden]) ~ #ss-map-legends { right: calc(10px + var(--m-safe-r)); }
/* TAM's Draw button sits under the layers button. */
html.m-phone #tam-tools { left: auto; right: calc(10px + var(--m-safe-r)); top: calc(var(--m-top) + 58px); }
html.m-phone .m-layers-open > #tam-tools { top: auto; bottom: calc(var(--m-sheet-h) + 30px); right: auto; left: calc(10px + var(--m-safe-l)); }
html.m-phone #tam-tools .ss-chip { min-height: 44px; border-radius: 22px; padding: 0 14px; box-shadow: var(--m-shadow); background: var(--surface); }
/* Draw prompts sit just under the top bar. */
html.m-phone #ss-draw-bar, html.m-phone #tam-draw-bar { left: 10px; right: 64px; top: calc(var(--m-top) + 6px); transform: none; flex-wrap: wrap; }

/* Comps: map behind everything, the tables in the sheet with the filters folded at the top of it. */
html.m-phone #page-comps > .layout { display: block; position: relative; flex: 1; }
html.m-phone #page-comps .map-pane { position: absolute; inset: 0; min-width: 0; border: 0; }
html.m-phone #page-comps .map-controls { position: absolute; top: var(--m-top); left: 0; right: 0; z-index: 1000; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  background: transparent; border: 0; padding: 0 10px 6px; gap: 6px; }
html.m-phone #page-comps .map-controls::-webkit-scrollbar { display: none; }
html.m-phone #page-comps .map-controls > * { flex-shrink: 0; box-shadow: var(--m-shadow); }
html.m-phone #page-comps .map-controls .mc-spacer { display: none; }
html.m-phone #s3-map { inset: 0 !important; }
html.m-phone #s3-map-legend { bottom: calc(var(--m-sheet-h) + 10px) !important; }
html.m-phone #page-comps .m-sheet.main { padding: 0 0 var(--m-safe-b); overflow-x: hidden; overflow-y: auto; display: block; }
html.m-phone #page-comps .m-sheet.main > .m-grab { position: sticky; top: 0; z-index: 5; background: var(--surface); }
html.m-phone #page-comps .m-sheet.main > :not(.m-grab):not(.sidebar) { margin-left: 12px; margin-right: 12px; }
html.m-phone #page-comps .main > .sidebar { border: 0; border-bottom: 1px solid var(--border); overflow: visible; height: auto; }
html.m-phone #page-comps .main .comps-grid, html.m-phone #page-comps .main table { display: block; overflow-x: auto; max-width: 100%; }
html.m-phone #page-comps .layout.sb-collapsed .main > .sidebar .sidebar-head { justify-content: space-between; padding: 10px 14px; min-height: 44px; box-sizing: border-box; }
html.m-phone #page-comps .layout.sb-collapsed .main > .sidebar .sb-title { display: inline; }
html.m-phone #page-comps .layout.sb-collapsed .main > .sidebar .sb-chevron { transform: rotate(-90deg); }
html.m-phone #page-comps .layout:not(.sb-collapsed) .main > .sidebar .sb-chevron { transform: rotate(90deg); }
html.m-phone #page-comps .parcel-bar { flex-wrap: wrap; align-items: center; margin-top: 10px; }
html.m-phone #page-comps .parcel-bar > :first-child { flex: 1 1 100%; }
html.m-phone #page-comps .parcel-bar .actions { margin-left: 0; flex-wrap: wrap; }
html.m-phone #page-comps .parcel-bar .btn { min-height: 36px; }

/* Pipeline: toolbar scrolls sideways, one column per swipe. */
html.m-phone .pipe-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 8px 12px; }
html.m-phone .pipe-toolbar::-webkit-scrollbar { display: none; }
html.m-phone .pipe-toolbar > * { flex-shrink: 0; }
html.m-phone .pipe-filter-pop { position: fixed; left: 10px !important; right: 10px; top: calc(var(--m-top) + 52px) !important; max-width: none; max-height: 60dvh; overflow-y: auto; }
html.m-phone .pipe-kanban { padding: 10px 12px calc(16px + var(--m-safe-b)); scroll-padding: 0 12px; scrollbar-width: none; }
html.m-phone .pipe-kanban::-webkit-scrollbar { display: none; }
html.m-phone .pipe-col { flex: 0 0 86vw; }
html.m-phone body > [id^="page-"]:not(#page-map):not(#page-sitescreen):not(#page-tam):not(#page-comps):not(#page-pipeline) { overflow: auto; }

/* Ask Claude: a full-screen sheet; the round button rides above the open list sheet. */
html.m-phone #chat-btn { right: calc(14px + var(--m-safe-r)); bottom: calc(var(--m-sheet-h) + 14px); width: 52px; height: 52px; margin: 0; }
html.m-phone.m-sheet-full #chat-btn, html.m-phone #chat-btn.open { display: none; }
/* Sized to what's above the keyboard, so the box being typed in stays on screen. */
html.m-phone #chat-panel { left: 0; right: 0; top: var(--m-vvt, 0px); bottom: auto; height: var(--m-vvh, 100dvh); width: auto; max-width: none; border-radius: 0; border: 0;
  padding: var(--m-safe-t) var(--m-safe-r) var(--m-safe-b) var(--m-safe-l); transform-origin: 100% 100%; }
/* Claude's picks: a sheet over the map (mobile.js), above the tab's own list, under a pick's card. It opens behind the
   full-screen chat; the chat's button for it is big enough to find. */
html.m-phone #chat-picks.m-sheet { z-index: 1055 !important; border-radius: 16px 16px 0 0; }
html.m-phone #chat-picks.open { animation: none; }
html.m-phone .chat-picks-chip { align-self: stretch; margin: 4px 0 8px; min-height: 44px; padding: 6px 14px 6px 8px; border: 0; border-radius: 12px;
  background: #D97757; color: #fff; font-size: 14px; justify-content: flex-start; }
html.m-phone .chat-picks-chip::after { content: '→'; margin-left: auto; font-size: 16px; }
html.m-phone .chat-picks-chip .chat-avatar { width: 26px; height: 26px; background: rgba(255,255,255,0.2); }
html.m-phone #feedback-modal-card { width: calc(100vw - 24px); max-width: none; box-sizing: border-box; }
