/* ===================================================================
   PROJECT MAP — project-map.css (2026-10-18 design system)
   The Leaflet skin shared by the Company Dashboard's Project Map and
   Project Data's Site Location card. Everything is prefixed pm- (plus
   Leaflet's own leaflet-* classes inside .pm-map), so nothing here restyles
   the rest of the app. Values are K tokens (DESIGN-SYSTEM.md).

   Color discipline: the base map is greyed out, so only pins carry color —
   the stage colors on projects (KUI.palette.stage, passed in by the
   dashboard: Pursuit gray · Preconstruction charcoal · Hard Bid red), brand
   red on the Site Location pin. Offices are charcoal tiles, clusters ink
   bubbles. A hollow ring means the pin is approximate (only the city/ZIP
   matched). Hover cards are ink like the chart tooltips; the touch popup
   is the white product popover.
   Class names avoid "empty", "-label" and "-value" (styles.css matches them).
   =================================================================== */

/* The map box. z-index:0 makes it its own stacking context, so Leaflet's
   internal panes (z-index up to 1000) never float over app menus/modals. */
.pm-map{position:relative;z-index:0;width:100%;height:100%;background:var(--k-fill-2);font-family:var(--k-font);outline:none}
.pm-map:focus-visible{box-shadow:inset 0 0 0 2px rgba(231,0,0,0.35)}
.pm-tiles-muted{filter:grayscale(1) contrast(0.78) brightness(1.08)}
.pm-map-msg{display:flex;align-items:center;justify-content:center;gap:8px;height:100%;padding:16px;text-align:center;color:var(--k-text-2);font-size:var(--k-fs-sm);line-height:1.5;background:var(--k-fill)}

/* Leaflet controls: 28px icon buttons in one popover-style group */
.pm-map .leaflet-bar{border:1px solid var(--k-line);border-radius:var(--k-r-md);overflow:hidden;box-shadow:var(--k-shadow-sm)}
.pm-map .leaflet-bar a{width:28px;height:28px;line-height:28px;background:var(--k-surface);color:var(--k-ink-2);font:600 16px/28px var(--k-font);border-bottom-color:var(--k-line-2)}
.pm-map .leaflet-bar a:hover{background:var(--k-fill);color:var(--k-ink)}
.pm-map .leaflet-control-attribution{font-size:10px;color:var(--k-text-2);background:rgba(255,255,255,0.78);padding:1px 6px;border-top-left-radius:var(--k-r-sm)}
.pm-map .leaflet-control-attribution a{color:var(--k-text)}

/* Project pins: small, flat marks with a soft white halo (the 6-week
   look-ahead style) on a light, low-contrast base map.
     Preconstruction   red dot — the one red mark on the map
     Hard Bid          charcoal diamond (the look-ahead "Bid" marker)
     Pursuit           light gray dot
     Awarded           dark gray dot
     Lost              light gray ring
   A faded pin = approximate location (city/ZIP only). The Site Location pin
   (Project Data) is the red dot. .pm-sw is the same mark at legend size. */
.pm-pin{background:none;border:none;display:flex;align-items:center;justify-content:center}
.pm-pin i,.pm-sw{box-sizing:border-box;display:block;flex-shrink:0;border-radius:50%;background:var(--k-accent)}
.pm-pin i{width:10px;height:10px;margin:0;box-shadow:0 0 0 2px var(--k-surface),0 1px 3px 2px rgba(15,15,18,0.18);transition:transform .12s ease}
.pm-sw{display:inline-block;width:9px;height:9px;margin-right:6px;vertical-align:0}
.pm-pin.pm-k-active i,.pm-sw.pm-k-active{background:var(--k-accent)}
.pm-pin.pm-k-hard_bid i,.pm-sw.pm-k-hard_bid{background:var(--k-gray-800);border-radius:1.5px;transform:rotate(45deg)}
.pm-pin.pm-k-hard_bid i{width:9px;height:9px}
.pm-sw.pm-k-hard_bid{width:8px;height:8px;margin-left:1px;margin-right:7px}
.pm-pin.pm-k-pursuit i,.pm-sw.pm-k-pursuit{background:var(--k-gray-400)}
.pm-pin.pm-k-completed i,.pm-sw.pm-k-completed{background:var(--k-gray-650)}
.pm-pin.pm-k-lost i,.pm-sw.pm-k-lost{background:var(--k-surface);border:2px solid var(--k-gray-400)}
.pm-pin.is-approx i,.pm-sw.is-approx{opacity:0.5}
.pm-pin:hover i,.pm-pin:focus-visible i,.pm-pin.leaflet-drag-target i{transform:scale(1.35)}
.pm-pin.pm-k-hard_bid:hover i,.pm-pin.pm-k-hard_bid:focus-visible i,.pm-pin.pm-k-hard_bid.leaflet-drag-target i{transform:rotate(45deg) scale(1.35)}
.pm-pin:focus-visible{outline:none}

/* Office: a small white building tile (the primary office is ink) */
.pm-office{background:none;border:none}
.pm-office i{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:100%;border-radius:var(--k-r-sm);background:var(--k-surface);color:var(--k-ink-2);font-size:10.5px;border:1px solid var(--k-line-strong);box-shadow:var(--k-shadow-sm);transition:transform .12s ease}
.pm-office.is-primary i{font-size:11.5px;background:var(--k-ink);color:var(--k-on-dark);border-color:var(--k-ink)}
.pm-office:hover i,.pm-office:focus-visible i{transform:scale(1.12)}
.pm-office:focus-visible{outline:none}

/* Cluster: a white bubble with the count in ink */
.pm-cluster{background:none;border:none}
.pm-cluster span{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:100%;border-radius:50%;background:var(--k-surface);color:var(--k-ink);font:600 11.5px/1 var(--k-mono);border:1px solid var(--k-line-strong);box-shadow:0 0 0 3px rgba(255,255,255,0.7),var(--k-shadow-sm);transition:transform .12s ease}
.pm-cluster:hover span{transform:scale(1.08)}

/* Hover card (tooltip): ink, like the chart tooltips (ui-tokens.js) and
   toasts. Its touch twin (popup, with an action button) is the white
   product popover. */
.leaflet-tooltip.pm-tip{padding:10px;min-width:180px;max-width:280px;white-space:normal;background:var(--k-gray-900);border:1px solid var(--k-dark-line);border-radius:var(--k-r-md);box-shadow:var(--k-shadow-md);color:var(--k-on-dark);font:12px/1.45 var(--k-font)}
.leaflet-tooltip-top.pm-tip::before{border-top-color:var(--k-gray-900)}
.leaflet-tooltip-bottom.pm-tip::before{border-bottom-color:var(--k-gray-900)}
.leaflet-tooltip-left.pm-tip::before{border-left-color:var(--k-gray-900)}
.leaflet-tooltip-right.pm-tip::before{border-right-color:var(--k-gray-900)}
.leaflet-tooltip.pm-tip .pm-tip-name,.leaflet-tooltip.pm-tip .pm-tip-row,.leaflet-tooltip.pm-tip .pm-tip-n{color:var(--k-on-dark)}
.leaflet-tooltip.pm-tip .pm-tip-name .fa,.leaflet-tooltip.pm-tip .pm-tip-muted,.leaflet-tooltip.pm-tip .pm-tip-note{color:var(--k-on-dark-2)}
.leaflet-tooltip.pm-tip .pm-tip-hint{color:var(--k-on-dark-3);border-top-color:var(--k-dark-line)}
/* a hairline ring keeps dots visible on the ink card */
.leaflet-tooltip.pm-tip .pm-tip-dot{box-shadow:0 0 0 1px var(--k-on-dark-3)}
.pm-pop .leaflet-popup-content-wrapper{border-radius:var(--k-r-lg);box-shadow:var(--k-shadow-md)}
.pm-pop .leaflet-popup-content{margin:12px 14px;min-width:190px;color:var(--k-ink);font:12.5px/1.45 var(--k-font)}
.pm-tip-name{font-weight:700;font-size:13px;line-height:1.3;color:var(--k-ink);margin-bottom:3px;display:flex;align-items:center;gap:6px}
.pm-tip-name .fa{font-size:11px;color:var(--k-text-2)}
.pm-tip-row{margin-top:2px;color:var(--k-text)}
.pm-tip-row .cd-cdn{margin-left:6px}
.pm-tip-muted{color:var(--k-text-2)}
.pm-tip-dot{display:inline-block;width:8px;height:8px;margin-right:6px;border-radius:50%;vertical-align:0}
.pm-tip-n{font-family:var(--k-mono);color:var(--k-ink)}
.pm-tip-note{margin-top:5px;font-size:11px;color:var(--k-text-2);font-style:italic}
.pm-tip-hint{margin-top:7px;padding-top:6px;border-top:1px solid var(--k-line-2);font-size:11px;color:var(--k-text-3)}
/* touch popup action: a small primary button */
.pm-pop-btn{display:inline-flex;align-items:center;gap:6px;height:var(--k-control-h-sm);margin-top:9px;padding:0 10px;border:none;border-radius:var(--k-r-md);background:var(--k-accent);color:var(--k-on-dark);font:600 12px var(--k-font);cursor:pointer}
.pm-pop-btn:hover{background:var(--k-accent-hover)}

/* ----- Project Data → Site Location ----- */
.pm-site-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:18px;align-items:stretch}
.pm-site-sub{font-size:var(--k-fs-xs);color:var(--k-text-2);margin-bottom:12px}
.pm-site-map{position:relative;min-height:236px;border:1px solid var(--k-line);border-radius:var(--k-r-md);overflow:hidden;background:var(--k-fill)}
.pm-site-map>.pm-map,.pm-site-map>.pm-map-msg{position:absolute;inset:0;height:auto}
.pm-site-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.pm-site-clear{background:none;border:none;padding:0;color:var(--k-text-2);font:500 12px var(--k-font);cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.pm-site-clear:hover{color:var(--k-accent-ink)}
.pm-site-status{margin-top:9px;font-size:12px;line-height:1.5;color:var(--k-text)}
.pm-site-status .fa{margin-right:3px;color:var(--k-text-3)}
.pm-site-match{margin-top:2px;font-size:11px;color:var(--k-text-3)}
.pm-site-unsaved{color:var(--k-accent-ink);font-weight:600;white-space:nowrap}
@media (max-width:860px){
  .pm-site-grid{grid-template-columns:1fr}
  .pm-site-map{min-height:220px}
}
