* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #0f172a; background: #fff; }
#map { position: absolute; inset: 0; }
[hidden] { display: none !important; }
.info { position: absolute; z-index: 500; left: 10px; bottom: 22px; max-width: calc(100% - 20px); padding: 4px 9px; border: 1px solid #e2e8f0; border-radius: 6px;
  background: rgba(255,255,255,.94); box-shadow: 0 1px 4px rgba(15,23,42,.15); font-size: 12px; }
.info b { font-weight: 600; }
.info .warn { color: #b45309; }
.empty { position: absolute; z-index: 600; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100% - 40px); padding: 10px 14px; border: 1px solid #e2e8f0;
  border-radius: 8px; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(15,23,42,.15); text-align: center; color: #475569; }
.empty.block { color: #0f172a; font-weight: 600; }
.tlabel { background: rgba(255,255,255,.92); border: 1px solid #94a3b8; border-radius: 4px; padding: 0 4px; font-size: 11px; font-weight: 600; color: #0f172a; box-shadow: none; }
.tlabel::before { display: none; }
/* history: the two ends of the path stand out from the time labels along it */
.tlabel-start, .tlabel-end { padding: 1px 6px; border-width: 2px; font-size: 12px; font-weight: 700; background: #fff; }
.tlabel-start { border-color: #16a34a; color: #14532d; }
.tlabel-end { border-color: #dc2626; color: #7f1d1d; }
.who { background: #fff; border: 1px solid #94a3b8; border-radius: 4px; padding: 0 5px; font-size: 12px; font-weight: 600; box-shadow: none; }
.who::before { display: none; }
.legend { padding: 6px 9px; border: 1px solid #e2e8f0; border-radius: 6px; background: rgba(255,255,255,.95); box-shadow: 0 1px 4px rgba(15,23,42,.15); font-size: 12px; line-height: 1.5; }
.legend label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.legend input { margin: 0; }
.legend .swatch { display: inline-block; width: 26px; height: 7px; border-radius: 4px; }
.legend .swatch.back { height: 3px; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #cbd5e1; }
.legend .hint { color: #475569; font-size: 11px; line-height: 1.35; }
.legend label + .hint { margin-top: 4px; }
.detail { font-size: 12px; line-height: 1.45; }
.detail b { font-size: 13px; }
.detail .sub { margin: 2px 0 5px; color: #475569; }
.detail .leg { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 9px; color: #fff; font-weight: 600; font-size: 11px; }
.detail table { border-collapse: collapse; }
.detail th { padding: 1px 10px 1px 0; text-align: left; font-weight: 400; color: #475569; white-space: nowrap; vertical-align: top; }
.detail td { padding: 1px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail .soft { font-weight: 400; color: #64748b; }
.detail .note { margin-top: 5px; color: #475569; font-size: 11px; }
.detail tr.st-live td { color: #15803d; }
.detail tr.st-delayed td { color: #a16207; }
.detail tr.st-stale td { color: #475569; }
.detail tr.st-alert td { color: #b91c1c; }
.detail .st-alert-chip { background: #dc2626; }
.info .late { color: #a16207; font-weight: 600; }
.info .bad { color: #b91c1c; font-weight: 600; }

/* the red bar for suspicious readings */
.alert { position: absolute; z-index: 700; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 120px); display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px; border: 1px solid #b91c1c; border-radius: 8px; background: #fef2f2; color: #7f1d1d; box-shadow: 0 2px 10px rgba(127,29,29,.3); font-size: 12px;
  animation: alert-glow 1.6s ease-in-out infinite; }
.alert .tri, .legend .ktri { flex: none; width: 0; height: 0; border: 7px solid transparent; border-top-width: 0; border-bottom: 12px solid #dc2626; }
.alert button { flex: none; font: inherit; font-weight: 600; padding: 2px 9px; border: 1px solid #b91c1c; border-radius: 5px; background: #dc2626; color: #fff; cursor: pointer; }
.alert button:hover { background: #b91c1c; }
@keyframes alert-glow { 50% { box-shadow: 0 0 0 4px rgba(220,38,38,.35), 0 2px 10px rgba(127,29,29,.3); } }

/* live marker: a round badge, coloured by status */
.lm { position: relative; width: 34px; height: 34px; }
.lm .badge { position: absolute; inset: 3px; display: flex; align-items: center; justify-content: center; border: 2.5px solid #fff; border-radius: 50%;
  background: #16a34a; color: #fff; box-shadow: 0 1px 5px rgba(15,23,42,.45); }
.lm .ring { position: absolute; inset: 3px; border-radius: 50%; background: #16a34a; opacity: 0; }
.lm .core { width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.lm.is-delayed .core { background: #422006; }
.lm.is-live .badge { animation: lm-blink 1.2s ease-in-out infinite; }
.lm.is-live .ring { animation: lm-pulse 1.2s ease-out infinite; }
.lm.is-delayed .badge { background: #facc15; color: #422006; }
.lm.is-stale .badge { background: #64748b; }
.lm.is-alert .badge { background: #dc2626; }
.lm.is-alert .ring { background: #dc2626; animation: lm-pulse .8s ease-out infinite; }
.lm .bang { position: absolute; right: -2px; top: -3px; width: 15px; height: 15px; border: 1.5px solid #dc2626; border-radius: 50%; background: #fff; color: #dc2626;
  font: 700 11px/12px system-ui, sans-serif; text-align: center; }
@keyframes lm-blink { 50% { background: #86efac; } }
@keyframes lm-pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.3); opacity: 0; } }

/* the key */
.legend .key { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.legend .kdot { display: inline-block; width: 11px; height: 11px; margin: 0 2px; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #94a3b8; }
.legend .kdot.live { background: #16a34a; animation: lm-blink 1.2s ease-in-out infinite; }
.legend .kdot.delayed { background: #facc15; }
.legend .kdot.stale { background: #64748b; }
.legend .ktri { border-width: 0 6px 10px; margin: 0 1.500px; }
.legend .key + .hint, .legend label + .key { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .alert, .lm.is-live .badge, .lm.is-live .ring, .lm.is-alert .ring, .legend .kdot.live { animation: none; }
}
