/* Map + Devices pages. Shares the tokens and base styles of index.html. */
.pages { display: flex; gap: 4px; }
.pages button { border-radius: 999px; }
.pages button.active { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }

.page-full { padding: 12px; }
.map-layout { display: grid; grid-template-columns: 300px 1fr; gap: 12px; height: calc(100vh - 76px); }
.map-side { display: flex; flex-direction: column; min-height: 0; }
.map-side .section { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.map-side .section h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 500; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { border-radius: 999px; padding: 3px 9px; }
.seg button.active { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mini-stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.mini-stats b { display: block; font-family: var(--mono); font-size: 15px; }
.mini-stats span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.bars { display: grid; gap: 4px; margin-top: 6px; }
.bar { display: grid; grid-template-columns: 56px 1fr 28px; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
.bar .track, .bar .fill, .soc .track, .soc .fill { display: block; }
.bar .track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 4px; }
.bar b { font-family: var(--mono); color: var(--text); text-align: right; }
.map-list { flex: 1; overflow: auto; min-height: 120px; }
.map-item { padding: 6px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.map-item:hover { background: var(--panel-2); }
.map-item.noloc { opacity: .5; }
.map-item .mono { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item small { color: var(--muted); }

.map-wrap { position: relative; min-height: 0; }
#fleet-map, #detail-map { width: 100%; height: 100%; background: #0b1017; border-radius: 8px; }
#detail-map { height: 300px; }
.map-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.leaflet-container { font: inherit; }
/* Light OSM tiles, muted so OSM's own coloured POI pins never compete with ours. */
.leaflet-tile-pane { filter: saturate(.25) brightness(1.04); }
.dev-icon { background: none; border: 0; }
.dev-badge {
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.dev-badge.vcu, .dev-badge.battery { border-radius: 50%; }
.dev-badge.station { border-radius: 8px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 12px; font-size: 12px; min-width: 220px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop h4 { margin: 0 0 4px; font-size: 13px; font-family: var(--mono); }
.pop .kv { padding: 6px 0; grid-template-columns: 90px 1fr; }
.pop footer { display: flex; gap: 6px; margin-top: 6px; }

.track-panel {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 500;
  background: rgba(21, 27, 35, .96); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  display: grid; gap: 8px;
}
.track-panel .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.track-panel input[type=range] { flex: 1; min-width: 160px; padding: 0; }
.track-panel .stat b { font-family: var(--mono); }
.track-now { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Devices page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.card span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.card b { display: block; font-size: 20px; font-family: var(--mono); margin-top: 2px; }
.card small { color: var(--muted); }
.fleet-table { overflow: auto; max-height: calc(100vh - 260px); }
.fleet-table tbody tr { cursor: pointer; }
.fleet-table tbody tr:hover td { background: var(--panel-2); }
.fleet-table th { position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
.fleet-table td { white-space: nowrap; }
.pill.on { color: var(--ok); border-color: var(--ok); }
.pill.off { color: var(--bad); border-color: var(--bad); }
.pill.stale { color: var(--warn); border-color: var(--warn); }
.soc { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.soc .track { width: 46px; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.soc .fill { height: 100%; }
.muted { color: var(--muted); }

.detail-head { display: grid; grid-template-columns: 1fr 380px; gap: 12px; margin-bottom: 12px; }
.detail-head .panel { padding: 12px; }
.detail-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.detail-title h2 { margin: 0; font-size: 16px; font-family: var(--mono); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat-grid div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.stat-grid span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-grid b { font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.stat-grid div.wide { grid-column: span 2; }
.stat-grid div.warn b { color: var(--warn); }
.stat-grid div.bad b { color: var(--bad); }
.signal-grid { padding: 0 12px 12px; }
.stat-grid div.ok b { color: var(--ok); }
.stat-grid div.weak b { color: #f0883e; }
.stat-grid div.nd b { color: var(--muted); font-size: 13px; font-weight: 400; }
.stat-grid small { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.loc-line { margin-top: 8px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 12px; }
.slot { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); padding: 10px; font-size: 12px; }
.slot header { position: static; padding: 0 0 6px; background: none; border: 0; display: flex; justify-content: space-between; gap: 6px; }
.slot .k { color: var(--muted); }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 70vh; }
  .detail-head { grid-template-columns: 1fr; }
}
