/* Maps in the app (owner 2026-10-13; beta "app_maps"): the shared map module's
   look (maps.js). Agent IV's own tokens (styles.css) for the panels — the
   popup, the sheet, the legend follow the theme; the map itself and what
   sits on it stay fixed cream / ink / brass, like the tags on photos, because
   the basemap ignores the theme. */

/* The container a page hands to AgentMaps.create: a panel-edged box. The
   page may set its own height; on a phone it runs to the card's edges. The
   box's look (height, edge, margin) is a default at zero specificity
   (:where), so a page's own class — .pick-map, .fm-map, .area-map, with
   their approved heights and phone edges — always wins, whichever
   stylesheet came later; what the module needs to work stays firm. */
.aiv-map { position: relative; overflow: hidden; z-index: 0; --aiv-pin-scale: 1; }
:where(.aiv-map) { height: 460px; border-radius: 10px; border: 1.5px solid var(--panel-line);
  background: #F4F1EA; margin: 0 0 0.7rem; }
.aiv-map.leaflet-container { font-family: inherit; background: #F4F1EA; }
.aiv-map .leaflet-control-attribution { font-size: 10px; background: rgba(251,249,244,0.85); color: #6E6558;
  padding: 1px 6px; }
.aiv-map .leaflet-control-attribution a { color: #6E6558; }
.aiv-map .leaflet-control-zoom a { color: #2A2522; background: #FBF9F4; border-color: #DED5C2; }
.aiv-map .leaflet-control-zoom a:hover { background: #F2EDE2; color: #2A2522; }
.aiv-map .leaflet-bar { border: 1px solid #C7BA9C; box-shadow: 0 1px 4px rgba(42,37,34,0.25); }
/* The vector layers' canvas on the module's own maps (Leaflet's renderer: the drawn shape, an outline,
   the drawn basemap — every one of them interactive: false) takes no taps of its own: it covers the
   whole map, and an iPhone or iPad (the app, Safari) sent a tap on a dot to it instead (WebKit moves a
   finger's tap to the "clickable" thing it judges the better fit, and Leaflet listens for clicks on its
   canvas), so the dot opened nothing on Draw your area (owner 2026-11-02). A tap on the empty map still
   reaches the map. Only .aiv-mapmod (maps.js create): the live heat map's own map wears .aiv-map too,
   and its ZIP shapes on canvas are tapped. */
.aiv-mapmod .leaflet-pane > canvas { pointer-events: none; }
.aiv-map.aiv-drawing { cursor: crosshair; }
.aiv-map.aiv-drawing .leaflet-interactive { cursor: crosshair; }
@media (max-width: 480px) {
  :where(.aiv-map) { height: 420px; border-radius: 0; border-left: 0; border-right: 0; }
}

/* Road names on the drawn basemap: small gray text with a light halo. */
.aiv-roadlbl { background: none; border: 0; box-shadow: none; padding: 0; color: #8A8273;
  font: 600 10px/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em; white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.aiv-roadlbl.primary, .aiv-roadlbl.secondary { color: #6E6558; font-weight: 700; font-size: 11px; }
.aiv-roadlbl.arterial { color: #7A7265; font-weight: 700; }
.aiv-roadlbl::before { display: none; }

/* Pins: a brass circle with the list's number inside; hollow for a home for
   sale, faded when it isn't selected, a ring when its card is open. The
   size follows the zoom (maps.js sets --aiv-pin-scale on the container). */
.aiv-icon { background: none; border: 0; }
.aiv-pin { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: #82632B; color: #FBF9F4; border: 2px solid #FBF9F4;
  box-shadow: 0 1px 4px rgba(0,0,0,0.38); font: 800 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI",
  Helvetica, Arial, sans-serif; letter-spacing: -0.02em; box-sizing: border-box;
  transform: scale(var(--aiv-pin-scale, 1)); transition: transform 0.12s, opacity 0.12s; }
.aiv-pin.hollow { background: #FBF9F4; color: #82632B; border-color: #82632B; }
.aiv-pin.faded { opacity: 0.45; }
.aiv-pin.open { transform: scale(calc(var(--aiv-pin-scale, 1) * 1.2)); box-shadow: 0 0 0 2.5px #82632B, 0 1px 4px rgba(0,0,0,0.38); }
.aiv-pin.dot { width: 15px; height: 15px; font-size: 0; }
/* The comp just tapped (ringPin; beta "duo_mapcomps", owner 2026-10-29): an ink ring
   round the pin, a cream gap inside it, full colour even when it isn't picked — the
   same ring as its card in the list. */
.aiv-pin.ring, .aiv-pin.open.ring { opacity: 1; transform: scale(calc(var(--aiv-pin-scale, 1) * 1.25));
  box-shadow: 0 0 0 2.5px #FBF9F4, 0 0 0 5px #2A2522, 0 2px 6px rgba(0,0,0,0.4); }
/* My Farm's kinds: a new listing, a price cut, under contract, just sold. */
.aiv-pin.k-new { background: #2E7D32; color: #FBF9F4; border-color: #FBF9F4; }
.aiv-pin.k-cut { background: #C47F0E; color: #FBF9F4; border-color: #FBF9F4; }
.aiv-pin.k-pending { background: #FBF9F4; color: #2A2522; border-color: #2A2522; }
.aiv-pin.k-sold { background: #2A2522; color: #FBF9F4; border-color: #FBF9F4; }
.aiv-star { display: block; width: 32px; height: 32px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45)); }
.aiv-star svg { width: 100%; height: 100%; display: block; }
/* The subject's label tag above its star. */
.aiv-tag { background: #2A2522; color: #FBF9F4; border: 0; border-radius: 999px; padding: 0.15rem 0.55rem;
  font: 800 10px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase; box-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.aiv-tag::before { border-top-color: #2A2522; }
/* A ringed pin's address and price (ringPin's tag): the same dark label, in plain words. */
.aiv-tag.aiv-tag-ring { text-transform: none; letter-spacing: 0.01em; font-size: 11px; padding: 0.22rem 0.65rem;
  white-space: nowrap; }
/* The polygon editor's corner handles; the first one grows and fills once
   the shape can be closed ("tap the first corner"). */
.aiv-corner { display: block; width: 12px; height: 12px; margin: 2px; background: #FBF9F4; border: 2px solid #82632B;
  border-radius: 2px; box-sizing: border-box; box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: grab; }
.aiv-corner.first { width: 16px; height: 16px; margin: 0; background: #82632B; border-color: #FBF9F4;
  box-shadow: 0 0 0 2px #82632B, 0 1px 3px rgba(0,0,0,0.3); cursor: pointer; }
/* Bigger corners (beta "market_drawn", owner 2026-10-21): the same 12 px square inside an
   invisible 32 px touch target, so a finger can take one on a phone. */
.aiv-corner.big { width: 32px; height: 32px; margin: 0; background: transparent; border: 0; box-shadow: none;
  display: flex; align-items: center; justify-content: center; }
.aiv-corner.big i { display: block; width: 12px; height: 12px; background: #FBF9F4; border: 2px solid #82632B;
  border-radius: 2px; box-sizing: border-box; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.aiv-corner.big.first { width: 32px; height: 32px; background: transparent; border: 0; box-shadow: none; }
.aiv-corner.big.first i { width: 16px; height: 16px; background: #82632B; border-color: #FBF9F4;
  box-shadow: 0 0 0 2px #82632B, 0 1px 3px rgba(0,0,0,0.3); }

/* The popup: a small card the page writes (its own classes inside). */
.aiv-popup .leaflet-popup-content-wrapper { background: var(--panel); color: var(--ink); border-radius: 10px;
  border: 1.5px solid var(--accent); box-shadow: 0 12px 30px rgba(42,37,34,0.28); padding: 0; }
.aiv-popup .leaflet-popup-content { margin: 0; width: 238px !important; line-height: 1.35; font-family: inherit; }
.aiv-popup .leaflet-popup-tip { background: var(--panel); box-shadow: none; }
.aiv-popup .leaflet-popup-close-button { top: 5px; right: 5px; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; background: rgba(251,249,244,0.92); color: #2A2522; font: 700 17px/22px sans-serif;
  text-align: center; z-index: 1; }
.aiv-popup .leaflet-popup-close-button:hover { background: #FBF9F4; color: #2A2522; }

/* A phone (≤ 480px): the card is a sheet at the bottom of the screen, pulled
   down or closed with its button. */
.aiv-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; background: var(--panel); color: var(--ink);
  border-radius: 14px 14px 0 0; border: 1.5px solid var(--accent); border-bottom: 0;
  box-shadow: 0 -8px 30px rgba(42,37,34,0.28); max-height: 70vh; overflow: auto;
  transform: translateY(105%); transition: transform 0.2s ease-out; visibility: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0); }
.aiv-sheet.open { transform: translateY(0); visibility: visible; }
.aiv-sheet-bar { position: sticky; top: 0; display: flex; align-items: center; justify-content: center;
  height: 26px; background: var(--panel); border-radius: 14px 14px 0 0; }
.aiv-sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: var(--panel-edge); }
.aiv-sheet-close { position: absolute; top: 4px; right: 8px; width: 26px; height: 26px; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: var(--soft); color: var(--ink); font: 700 18px/26px sans-serif;
  text-align: center; cursor: pointer; }
.aiv-sheet-body { padding: 0 0.85rem 0.9rem; }

/* The legend box in the map's bottom-left corner: the page writes its rows
   with these swatches, e.g. <span><i class="aiv-key-pin"></i>Sold</span>. */
.aiv-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; max-width: 80vw;
  margin: 0 0 8px 8px; padding: 0.4rem 0.65rem; border-radius: 8px; background: rgba(251,249,244,0.92);
  border: 1px solid #DED5C2; box-shadow: 0 1px 4px rgba(42,37,34,0.18); color: #6E6558; font-size: 0.74rem;
  font-weight: 600; line-height: 1.3; text-align: left; }
/* Its bottom edge clear of the map credit ("Roads & water: U.S. Census Bureau TIGER", about 16px tall
   in the bottom-right corner), which sat on a wide legend's corner (check1115 R2). */
.aiv-map .leaflet-bottom.leaflet-left .aiv-legend { margin-bottom: 22px; }
.aiv-legend span { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.aiv-legend b { color: #2A2522; font-weight: 700; }
.aiv-key-pin, .aiv-key-dot, .aiv-key-star, .aiv-key-corner, .aiv-key-line { display: inline-block; box-sizing: border-box; }
.aiv-key-pin { width: 18px; height: 18px; border-radius: 50%; background: #82632B; border: 2px solid #FBF9F4;
  box-shadow: 0 0 0 1px rgba(42,37,34,0.25); color: #FBF9F4; font: 800 9px/14px -apple-system, BlinkMacSystemFont,
  "Segoe UI", Helvetica, Arial, sans-serif; text-align: center; font-style: normal; }
.aiv-key-pin.hollow { background: #FBF9F4; color: #82632B; border-color: #82632B; box-shadow: none; }
.aiv-key-pin.faded { opacity: 0.45; }
.aiv-key-pin.open { box-shadow: 0 0 0 2px #82632B; }
.aiv-key-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #FBF9F4; background: #82632B;
  box-shadow: 0 0 0 1px rgba(42,37,34,0.25); }
.aiv-key-dot.new { background: #2E7D32; }
.aiv-key-dot.cut { background: #C47F0E; }
.aiv-key-dot.pending { background: #FBF9F4; border-color: #2A2522; box-shadow: none; }
.aiv-key-dot.sold { background: #2A2522; }
.aiv-key-dot.hollow { background: #FBF9F4; border-color: #82632B; box-shadow: none; }
.aiv-key-star { width: 14px; height: 14px; background: #2A2522;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.aiv-key-corner { width: 11px; height: 11px; border-radius: 2px; background: #FBF9F4; border: 2px solid #82632B; }
.aiv-key-line { width: 18px; height: 0; border-top: 2px dashed #82632B; }

/* Places that matter (Compare Homes, owner 2026-10-13; setPlaces): an ink
   rounded square with the type's icon and the name beside it — to the left of
   the mark when it sits near the map's right edge (.lft, the module's call) —
   a ring when its card is open. Fixed colours, like the pins. */
.aiv-place-mark { position: relative; display: block; width: 26px; height: 26px; }
.aiv-place-pin { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 7px; background: #2A2522; border: 2px solid #FBF9F4; box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,0.38); color: #FBF9F4; flex-shrink: 0; }
.aiv-place-pin svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.1;
  stroke-linecap: round; stroke-linejoin: round; display: block; }
.aiv-place-pin svg.thick { stroke-width: 3; }
.aiv-place-name { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  color: #2A2522; font: 700 11px/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em; pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff; }
.aiv-place-mark.lft .aiv-place-name { left: auto; right: 30px; text-align: right; }
/* Neither side clear: the name under its mark, centred, shifted (--aiv-dx) only to stay on the map. */
.aiv-place-mark.blw .aiv-place-name { left: calc(50% + var(--aiv-dx, 0px)); right: auto; top: 100%; margin-top: 1px;
  transform: translateX(-50%); text-align: center; }
/* Too long for either side and the spot under it taken: the name wraps to the room beside its
   mark (--aiv-w, the module's measure), so it never runs off the map. */
.aiv-place-mark.wrp .aiv-place-name { white-space: normal; width: var(--aiv-w); overflow-wrap: anywhere; }
/* A place named in an ink pill (place.tag: Showing Itinerary's start, mockup app-1). */
.aiv-place-mark.tag .aiv-place-name { background: #2A2522; color: #FBF9F4; text-shadow: none; padding: 4px 8px 4px;
  border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.aiv-place-mark.open .aiv-place-pin { box-shadow: 0 0 0 2.5px #82632B, 0 1px 4px rgba(0,0,0,0.38); }
.leaflet-marker-draggable .aiv-place-pin { cursor: grab; }
@media (max-width: 480px) { .aiv-place-name { font-size: 10.5px; } }
/* A page waiting for a tap on the map (onMapTap): a crosshair. */
.aiv-map.aiv-picking { cursor: crosshair; }
.aiv-map.aiv-picking .leaflet-interactive { cursor: crosshair; }
/* The legend's swatch for the places: <i class="aiv-key-place">(the icon)</i>. */
.aiv-key-place { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 5px; background: #2A2522; border: 2px solid #FBF9F4; box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(42,37,34,0.25); color: #FBF9F4; font-style: normal; }
.aiv-key-place svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; display: block; }
/* A page's own control on the map (addControl): the zoom control's dress. */
.aiv-ctl { border: 1px solid #C7BA9C; border-radius: 6px; background: #FBF9F4;
  box-shadow: 0 1px 4px rgba(42,37,34,0.25); }
/* Center on my location (create's `locate`, owner 2026-11-07): under the zoom buttons, in their dress;
   its note (location off, not found) beside it in the map's cream. */
.aiv-locate { position: relative; }
.aiv-locate .leaflet-bar a { display: flex; align-items: center; justify-content: center;
  color: #2A2522; background: #FBF9F4; border-bottom: none; }
.aiv-locate .leaflet-bar a:hover { background: #F2EDE2; color: #2A2522; }
.aiv-locate svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.aiv-locate svg .dot { fill: currentColor; stroke: none; }
.aiv-locate a.busy svg { animation: aiv-locate-pulse 1s ease-in-out infinite; }
@keyframes aiv-locate-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .aiv-locate a.busy svg { animation: none; opacity: 0.5; } }
.aiv-locate-msg { position: absolute; left: calc(100% + 8px); top: 0; width: max-content; max-width: 220px;
  font-size: 12.5px; line-height: 1.35; color: #2A2522; background: #FBF9F4; border: 1px solid #C7BA9C;
  border-radius: 6px; padding: 6px 9px; box-shadow: 0 1px 4px rgba(42,37,34,0.25); }
/* Showing Itinerary (owner 2026-11-11; beta "showing_itinerary"): a stop's pin (setPins kind
   "stop") is an ink disc with a brass ring inside its paper edge and the stop's number in a
   paper serif numeral, as in the approved mockup and the PDF's map; never faded. The route
   (setRoute) draws itself; the legend has a swatch for each. Fixed colours, like the pins. */
.aiv-pin.k-stop { background: #2A2522; color: #FBF9F4; border: 2px solid #FBF9F4;
  box-shadow: inset 0 0 0 2px #B08A45, 0 1px 4px rgba(0,0,0,0.38);
  font: 700 13px/1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  letter-spacing: 0; }
.aiv-pin.k-stop.open { box-shadow: inset 0 0 0 2px #B08A45, 0 0 0 2.5px #82632B, 0 1px 4px rgba(0,0,0,0.38); }
.aiv-key-stop, .aiv-key-route { display: inline-block; box-sizing: border-box; }
.aiv-key-stop { width: 13px; height: 13px; border-radius: 50%; background: #2A2522;
  box-shadow: inset 0 0 0 1.5px #B08A45; }
.aiv-key-route { width: 18px; height: 6px; border-radius: 3px; background: #82632B;
  box-shadow: 0 0 0 1.5px #FBF9F4; }
