/* Dispatch Live Map (2026-10-18) — office map inside the Dispatch (Jobs) tab.
 *
 * Light-mode ready by construction (Brian's rule): EVERY color below is a
 * var() from the site's existing theme system (styles.css :root tokens,
 * remapped per theme by futuristic-app.css / the daylight sheet). There
 * are no hard-coded colors in this file — no hex, no rgb — so the map
 * follows the site theme with the same layout in both themes.
 * Spacing is rem-only (architect token rules); layout is fluid at every
 * width: the map and the crew cards stack on phones and sit side by side
 * on wide screens, never overflowing and never leaving dead side bands. */

.dm-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.dm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dm-title {
  font-weight: 800;
  color: var(--ink);
}

.dm-live {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.dm-livedot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999rem;
  background: var(--ok);
  flex: 0 0 auto;
}

.dm-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.dm-map {
  width: 100%;
  min-width: 0;
  height: 24rem;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius);
  background: var(--card-alt);
  z-index: 0;
}

.dm-map-fallback {
  width: 100%;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  padding: 1rem;
}

.dm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.dm-card {
  background: var(--card);
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.dm-card-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dm-name {
  font-weight: 700;
  color: var(--ink);
}

.dm-truck {
  color: var(--muted);
  font-size: 0.875rem;
}

.dm-chip {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5625rem;
  border-radius: 999rem;
  white-space: nowrap;
  background: var(--card-alt);
  color: var(--ink);
  border: 0.0625rem solid var(--line);
}

.dm-chip-en_route {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--bg);
}

.dm-chip-on_site {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--bg);
}

.dm-chip-stale {
  background: var(--warn-orange);
  border-color: var(--warn-orange);
  color: var(--bg);
}

.dm-chip-no_fix {
  background: var(--card-alt);
  color: var(--muted);
}

.dm-detail {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.375rem;
}

.dm-sessbar {
  height: 0.375rem;
  background: var(--line);
  border-radius: 999rem;
  margin-top: 0.5rem;
  overflow: hidden;
}

.dm-sessbar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999rem;
}

.dm-sesslabel {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.3125rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

/* The map dot itself (Leaflet divIcon): a themed disc labeled with the
   truck number. Stale dots go muted with a dashed ring — visibly NOT a
   live position — and stay at their last real point. */
.dm-pin-wrap {
  background: none;
  border: none;
}

.dm-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.375rem;
  border-radius: 999rem;
  background: var(--brand);
  color: var(--bg);
  border: 0.125rem solid var(--card);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.dm-pin-on_site {
  background: var(--ok);
}

.dm-pin-stale {
  background: var(--muted);
  border-style: dashed;
  border-color: var(--warn-orange);
  opacity: 0.75;
}

.dm-pin-no_fix {
  background: var(--muted);
  opacity: 0.6;
}

.dm-empty {
  color: var(--muted);
}

/* Wide screens: map and crew cards side by side, filling the frame. */
@media (min-width: 62rem) {
  .dm-main {
    flex-direction: row;
    align-items: stretch;
  }

  .dm-map {
    flex: 1 1 auto;
    height: auto;
    min-height: 26rem;
  }

  .dm-cards {
    flex: 0 1 22rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
}
