/* Fleet Map: one large map of the company vehicles beside a list of units.
   Uses the Command Center's tokens (command-center.css) so Light/Dark follow the
   header switch. Status colors: teal engine on, sky parked, gold located 1-24 h
   ago, grey older than 24 h. Orange stays reserved for "act now". */
body.fm-page{padding:0 16px 16px}
.fm-page main{gap:var(--gap)}
.fm-body{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:var(--gap);height:calc(100vh - 104px);min-height:520px}
.fm-map-wrap{position:relative;overflow:hidden}
#map{position:absolute;inset:0;background:var(--bg-0)}
.fm-rail{min-height:0}
.fm-filters{display:flex;gap:6px;padding:10px 14px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.fchip{height:24px;padding:0 10px;border-radius:999px;border:1px solid var(--line-strong);background:transparent;color:var(--text-2);font:600 11px var(--font);cursor:pointer}
.fchip.on{background:var(--bg-3);color:var(--text-1);border-color:var(--text-3)}
.fm-units{list-style:none;margin:0;padding:0}
.fm-units li{display:grid;grid-template-columns:76px 1fr;gap:2px 10px;padding:10px 14px;border-bottom:1px solid var(--line);cursor:pointer}
.fm-units li:hover,.fm-units li.sel{background:var(--bg-2)}
.fm-units li.nopos{cursor:default;opacity:.75}
.fm-units .u{font:600 13px var(--mono);grid-column:1;grid-row:1 / span 6;align-self:start;padding-top:1px;white-space:nowrap}
.fm-units .st,.fm-units .addr,.fm-units .meta{grid-column:2}
.fm-units .u .pin-dot{margin-right:6px}
.fm-units .st{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
.fm-units .addr{font-size:12.5px;color:var(--text-1)}
.fm-units .meta{font:11px var(--mono);color:var(--text-2)}
.fm-units .job{font-size:11px;color:var(--violet);grid-column:2}
.fm-note{padding:10px 14px;border-top:1px solid var(--line);line-height:1.45}

.pin-dot{display:inline-block;width:9px;height:9px;border-radius:50%;vertical-align:middle;margin-right:6px}
.s-on{background:var(--teal)} .s-off{background:var(--sky)} .s-aging{background:var(--gold)} .s-stale{background:var(--text-3)}
.st.s-on,.st.s-off,.st.s-aging,.st.s-stale{background:none}
.st.s-on{color:var(--teal)} .st.s-off{color:var(--sky)} .st.s-aging{color:var(--gold)} .st.s-stale{color:var(--text-3)}

.fm-legend{position:absolute;left:12px;bottom:12px;z-index:500;display:flex;gap:14px;flex-wrap:wrap;padding:8px 12px;border-radius:var(--r);background:var(--bg-1);border:1px solid var(--line-strong);font-size:11px;color:var(--text-2)}

/* Unit markers: a pill with the unit number, colored by status. */
.unit-pin{display:flex;align-items:center;justify-content:center;height:24px;min-width:48px;padding:0 8px;border-radius:12px;font:600 12px var(--mono);color:#0C0F15;border:2px solid #FFFFFF;box-shadow:0 1px 4px rgba(0,0,0,.45);white-space:nowrap;transform:translate(-50%,-50%)}
.unit-pin.s-on{background:var(--teal)} .unit-pin.s-off{background:var(--sky)} .unit-pin.s-aging{background:var(--gold)}
.unit-pin.s-stale{background:#9A968E;opacity:.7}
.unit-pin.sel{outline:3px solid var(--text-1);outline-offset:1px}
.leaflet-div-icon.unit-icon{background:none;border:0}
:root[data-theme="light"] .unit-pin{color:#FFFFFF}
:root[data-theme="light"] .unit-pin.s-aging{color:#141A26;background:#E9B949}

/* Map popups in Tower's type and colors. */
.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:var(--bg-1);color:var(--text-1);border:1px solid var(--line-strong);box-shadow:0 4px 16px rgba(0,0,0,.35)}
.leaflet-popup-content{margin:12px 14px;font:12.5px/1.45 var(--font);min-width:220px}
.leaflet-popup-content .pu-h{font:700 14px var(--mono);margin-bottom:2px}
.leaflet-popup-content .pu-v{color:var(--text-2);font-size:11.5px;margin-bottom:6px}
.leaflet-popup-content .pu-r{display:grid;grid-template-columns:76px 1fr;gap:2px 8px}
.leaflet-popup-content .pu-r span:nth-child(odd){color:var(--text-2);font-size:11px;text-transform:uppercase;letter-spacing:.06em;padding-top:1px}
.leaflet-container a.leaflet-popup-close-button{color:var(--text-2)}
.leaflet-container{font-family:var(--font)}
.leaflet-control-attribution{font-size:10px}

/* Dark theme: the standard map tiles, darkened to sit on the dark page. */
:root:not([data-theme="light"]) .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6)}
:root:not([data-theme="light"]) .leaflet-control-attribution{background:rgba(22,27,37,.85);color:var(--text-2)}
:root:not([data-theme="light"]) .leaflet-control-attribution a{color:var(--sky)}
:root:not([data-theme="light"]) .leaflet-bar a{background:var(--bg-2);color:var(--text-1);border-color:var(--line-strong)}

@media (max-width:900px){
  .fm-body{grid-template-columns:1fr;height:auto}
  .fm-map-wrap{height:62vh;min-height:360px}
  .fm-rail{max-height:none}
  .top .who{flex-wrap:wrap}
}
.pu-link{display:inline-block;margin-top:8px;font-weight:700;font-size:11.5px;color:var(--orange);text-decoration:underline}
