/* <nv-hos-mod kind="drive|dot|gps|reefer|night|trailer"> — HOS Monitoring System: six tiny working miniatures for the modules
   grid. Markup and behaviour: hos-mods.js (header). Colours: token names of nv.css only.
   Size: a block that fills its column, --nvm-h tall (152 px; set it on the element to change), never taller from motion:
   the picture takes what the alert row under it leaves. The static style below IS the final frame of every story; the stories
   are CSS animations that run only while the script holds data-st="play" (paused at their first frame under data-st="arm",
   frozen under data-pause), so without the script, and with reduced motion, each miniature stands at its last frame.
   Only opacity and transform move. */
nv-hos-mod { --s: var(--nv-info); position: relative; isolation: isolate; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; box-sizing: border-box;
  block-size: var(--nvm-h, 152px); min-width: 0; padding: 14px 14px 12px; border-radius: var(--nv-r-sm); overflow: hidden; container-type: inline-size;
  background: radial-gradient(70% 80% at 100% 0%, color-mix(in srgb, var(--nv-hos) 7%, transparent), transparent 70%), var(--nv-box);
  box-shadow: inset 0 0 0 1px var(--nv-line); color: var(--nv-ink); font: 500 12.5px/1.35 var(--nv-font); }
nv-hos-mod .vz { position: relative; min-height: 0; min-width: 0; }
nv-hos-mod .lb { color: var(--nv-dim); font-size: 11.5px; }
nv-hos-mod [data-s="warn"] { --s: var(--nv-warn); }
nv-hos-mod [data-s="bad"] { --s: var(--nv-bad); }
nv-hos-mod [data-s="ok"] { --s: var(--nv-ok); }
nv-hos-mod [data-s="info"] { --s: var(--nv-info); }
nv-hos-mod .al { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
nv-hos-mod .chip { flex: none; font: 650 10px/1 var(--nv-mono); letter-spacing: 0.09em; text-transform: uppercase; padding: 5px 7px 4px; border-radius: 6px; white-space: nowrap;
  color: color-mix(in srgb, var(--s) 80%, var(--nv-ink)); background: color-mix(in srgb, var(--s) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--s) 34%, transparent); }
nv-hos-mod .tx { min-width: 0; color: var(--nv-muted); font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
nv-hos-mod .tx b { color: var(--nv-ink); font-weight: 700; }
nv-hos-mod .ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--s); opacity: 0; pointer-events: none; }
nv-hos-mod svg { display: block; overflow: visible; }
nv-hos-mod svg path, nv-hos-mod svg rect, nv-hos-mod svg circle { vector-effect: non-scaling-stroke; }
nv-hos-mod .g { fill: none; stroke: var(--nv-line); stroke-width: 1; }
nv-hos-mod .ln { fill: none; stroke: var(--nv-ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }

/* drive time running low: the clock left empties to the threshold you choose */
nv-hos-mod .dv { display: grid; align-content: center; gap: 9px; }
nv-hos-mod .dv-n { display: flex; align-items: baseline; gap: 10px; }
nv-hos-mod .dv-n b { font: 750 30px/1 var(--nv-mono); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; min-width: 4.2ch; }
nv-hos-mod .dv-bar { position: relative; height: 10px; margin-top: 2px; }
nv-hos-mod .dv-trk { position: absolute; inset: 0; border-radius: 5px; overflow: hidden; background: color-mix(in srgb, var(--nv-ink) 10%, transparent); }
nv-hos-mod .dv-fill { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0.2333); }
nv-hos-mod .dv-fill i { position: absolute; inset: 0; }
nv-hos-mod .dv-w { background: var(--nv-warn); }
nv-hos-mod .dv-o { background: var(--nv-ok); opacity: 0; }
nv-hos-mod .dv-notch { position: absolute; left: 23.33%; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--nv-ink); }
nv-hos-mod .dv-th { position: relative; height: 14px; }
nv-hos-mod .dv-th span { position: absolute; left: 23.33%; margin-left: -6px; white-space: nowrap; }

/* DOT inspection started: Driving turns into an inspection with no note in the log */
nv-hos-mod .dt { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
nv-hos-mod .dt-log { display: grid; grid-template-columns: 22px minmax(0, 1fr); min-height: 0; }
nv-hos-mod .dt-rows { display: grid; grid-template-rows: 1fr 1fr; font: 600 10px/1 var(--nv-mono); color: var(--nv-dim); }
nv-hos-mod .dt-rows span { align-self: center; }
nv-hos-mod .dt-plot { position: relative; min-height: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--nv-line); }
nv-hos-mod .dt-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
nv-hos-mod .dt-mk { position: absolute; left: 50.6%; top: 75%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--s); box-shadow: 0 0 0 2.5px var(--nv-box); }
nv-hos-mod .dt-tag { position: absolute; left: calc(50.6% + 14px); top: 25%; transform: translateY(-50%); white-space: nowrap; font: 650 11px/1 var(--nv-mono); color: var(--s); }
nv-hos-mod .dt-note { display: flex; align-items: center; gap: 8px; }
nv-hos-mod .dt-none { position: relative; padding: 3px 9px; border-radius: 99px; font: 600 11px/1.2 var(--nv-mono); color: color-mix(in srgb, var(--nv-warn) 80%, var(--nv-ink)); background: color-mix(in srgb, var(--nv-warn) 10%, transparent); }
nv-hos-mod .dt-none::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1.5px dashed var(--nv-warn); }

/* GPS-verified driving: the truck moves, the log says Off Duty */
nv-hos-mod .gp { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; }
nv-hos-mod .gp-road { position: relative; min-height: 28px; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--nv-ink) 7%, transparent); }
nv-hos-mod .gp-lane { position: absolute; left: 0; top: 50%; width: 200%; height: 2px; margin-top: -1px; transform: translateX(-50%);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--nv-ink) 38%, transparent) 0 14px, transparent 14px 28px); }
nv-hos-mod .gp-car { position: absolute; inset: 0; transform: translateX(64%); }
nv-hos-mod .gp-car svg { position: absolute; left: 0; top: 50%; width: 34px; height: 18px; margin-top: -9px; }
nv-hos-mod .gp-car .t { fill: var(--nv-muted); }
nv-hos-mod .gp-car .c { fill: var(--nv-ink); }
nv-hos-mod .gp-car circle { fill: var(--nv-ink); stroke: var(--nv-box); stroke-width: 1.5; }
nv-hos-mod .gp-read { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
nv-hos-mod .gp-read b { font: 700 13px/1 var(--nv-mono); font-variant-numeric: tabular-nums; }
nv-hos-mod .gp-v b { display: inline-block; min-width: 2ch; text-align: right; }
nv-hos-mod .gp-ne { font: 750 17px/1 var(--nv-font); color: var(--nv-bad); }
nv-hos-mod .gp-log { position: relative; padding: 4px 9px; border-radius: 99px; color: color-mix(in srgb, var(--nv-bad) 80%, var(--nv-ink)); background: color-mix(in srgb, var(--nv-bad) 12%, transparent); }
nv-hos-mod .gp-log::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1.5px var(--nv-bad); }

/* reefer: the unit's temperature far from the band the rate con asks for */
nv-hos-mod .rf { border-radius: 8px; box-shadow: inset 0 0 0 1px var(--nv-line); overflow: hidden; }
nv-hos-mod .rf svg { position: absolute; inset: 0; width: 100%; height: 100%; }
nv-hos-mod .rf-band { fill: color-mix(in srgb, var(--nv-ok) 20%, transparent); stroke: color-mix(in srgb, var(--nv-ok) 55%, transparent); stroke-width: 1; }
nv-hos-mod .rf .ln { stroke: var(--nv-bad); }
nv-hos-mod .rf-dot { position: absolute; left: 94%; top: 16.1%; width: 11px; height: 11px; margin: -5.5px; border-radius: 50%; background: var(--nv-bad); box-shadow: 0 0 0 2.5px var(--nv-box); }
nv-hos-mod .rf-lb { position: absolute; font: 650 11px/1 var(--nv-mono); white-space: nowrap; }
nv-hos-mod .rf-unit { right: 9%; top: 26%; color: var(--nv-bad); }
nv-hos-mod .rf-req { left: 8px; bottom: calc(19% + 5px); color: var(--nv-ok); }

/* night driving: the truck's local clock runs into the night hours the company set */
nv-hos-mod .nt { display: grid; align-content: center; gap: 10px; }
nv-hos-mod .nt-top { display: flex; align-items: center; gap: 9px; }
nv-hos-mod .nt-top svg { color: var(--nv-warn); flex: none; }
nv-hos-mod .nt-top b { font: 750 24px/1 var(--nv-mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
nv-hos-mod .nt-track { position: relative; height: 34px; }
nv-hos-mod .nt-track::before { content: ""; position: absolute; left: 0; right: 0; top: 70%; height: 2px; margin-top: -1px; border-radius: 1px; background: color-mix(in srgb, var(--nv-ink) 18%, transparent); }
nv-hos-mod .nt-win { position: absolute; left: 37.5%; width: 50%; top: 0; bottom: 0; border-radius: 7px; background: color-mix(in srgb, var(--nv-warn) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nv-warn) 40%, transparent); }
nv-hos-mod .nt-win span { position: absolute; left: 7px; top: 4px; font-size: 10.5px; line-height: 1; color: color-mix(in srgb, var(--nv-warn) 80%, var(--nv-ink)); white-space: nowrap; }
nv-hos-mod .nt-car { position: absolute; inset: 0; transform: translateX(64.58%); }
nv-hos-mod .nt-car i { position: absolute; left: 0; top: 70%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--nv-warn); box-shadow: 0 0 0 3px var(--nv-box); }
nv-hos-mod .nt-car i + i { background: var(--nv-info); opacity: 0; }
nv-hos-mod .nt-axis { display: flex; justify-content: space-between; font: 500 10.5px/1 var(--nv-mono); color: var(--nv-dim); }

/* dropped trailers: where each one sits, and for how long */
nv-hos-mod .tr { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 12px; }
nv-hos-mod .tr-map { position: relative; min-height: 0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--nv-line); background: color-mix(in srgb, var(--nv-ink) 3%, transparent); }
nv-hos-mod .tr-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
nv-hos-mod .tr-st { fill: none; stroke: var(--nv-line-2); stroke-width: 1; }
nv-hos-mod .tr-hw { fill: none; stroke: color-mix(in srgb, var(--nv-muted) 45%, transparent); stroke-width: 5; stroke-linecap: round; }
nv-hos-mod .tr-yd { fill: color-mix(in srgb, var(--nv-info) 14%, transparent); stroke: color-mix(in srgb, var(--nv-info) 50%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
nv-hos-mod .tr-pin path { fill: var(--nv-info); stroke: var(--nv-box); stroke-width: 1.5; }
nv-hos-mod .tr-pin circle { fill: var(--nv-box); }
nv-hos-mod .tr-rip { fill: none; stroke: var(--nv-info); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
nv-hos-mod .tr-tx { display: grid; align-content: center; gap: 2px; min-width: 0; }
nv-hos-mod .tr-tx b { font-weight: 700; font-size: 14px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nv-hos-mod .tr-tx b.n { font: 750 18px/1.1 var(--nv-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ── the stories: run only under data-st (the script); data-st="arm" holds their first frame, data-pause freezes them ── */
nv-hos-mod[data-st="arm"] *, nv-hos-mod[data-st="arm"] *::before, nv-hos-mod[data-st="arm"] *::after,
nv-hos-mod[data-pause] *, nv-hos-mod[data-pause] *::before, nv-hos-mod[data-pause] *::after { animation-play-state: paused !important; }
nv-hos-mod[data-st] .al .chip { animation: hm-pop 0.45s var(--nv-ease) var(--pop, 1.9s) both; }
nv-hos-mod[data-st] .al .tx { animation: hm-in 0.45s var(--nv-ease) calc(var(--pop, 1.9s) + 0.15s) both; }
nv-hos-mod[kind="drive"] { --pop: 1.85s; }
nv-hos-mod[data-st] .dv-fill { animation: hm-drain 1.6s linear 0.2s both; }
nv-hos-mod[data-st] .dv-o { animation: hm-out 0.35s ease 1.45s both; }
nv-hos-mod[data-st] .dv-th span { animation: hm-in 0.4s var(--nv-ease) 1.5s both; }
nv-hos-mod[data-st] .dt-tail { animation: hm-fade 0.4s ease 0.45s both; }
nv-hos-mod[data-st] .dt-mk { animation: hm-pop 0.4s var(--nv-ease) 0.8s both; }
nv-hos-mod[data-st] .dt-mk .ring { animation: hm-ping 1.1s var(--nv-ease) 0.95s 2 forwards; }
nv-hos-mod[data-st] .dt-tag { animation: hm-fade 0.4s ease 1s both; }
nv-hos-mod[data-st] .dt-note { animation: hm-in 0.4s var(--nv-ease) 1.3s both; }
nv-hos-mod[data-st] .dt-none::after { animation: hm-blink 0.9s ease 1.55s both; }
nv-hos-mod[data-st] .gp-car { animation: hm-drive 1.5s cubic-bezier(0.2, 0.6, 0.35, 1) 0.1s both; }
nv-hos-mod[data-st] .gp-lane { animation: hm-lane 1.5s linear 0.1s both; }
nv-hos-mod[data-st] .gp-ne { animation: hm-pop 0.35s var(--nv-ease) 1.45s both; }
nv-hos-mod[data-st] .gp-log::after { animation: hm-blink 0.9s ease 1.5s both; }
nv-hos-mod[kind="reefer"] { --pop: 1.75s; }
nv-hos-mod[data-st] .rf .s1 { animation: hm-fade 0.25s ease 0.2s both; }
nv-hos-mod[data-st] .rf .s2 { animation: hm-fade 0.25s ease 0.36s both; }
nv-hos-mod[data-st] .rf .s3 { animation: hm-fade 0.25s ease 0.52s both; }
nv-hos-mod[data-st] .rf .s4 { animation: hm-fade 0.25s ease 0.68s both; }
nv-hos-mod[data-st] .rf .s5 { animation: hm-fade 0.25s ease 0.84s both; }
nv-hos-mod[data-st] .rf .s6 { animation: hm-fade 0.25s ease 1s both; }
nv-hos-mod[data-st] .rf-dot { animation: hm-pop 0.35s var(--nv-ease) 1.2s both; }
nv-hos-mod[data-st] .rf-dot .ring { animation: hm-ping 1.1s var(--nv-ease) 1.3s forwards; }
nv-hos-mod[data-st] .rf-unit { animation: hm-in 0.4s var(--nv-ease) 1.3s both; }
nv-hos-mod[kind="night"] { --pop: 1.7s; }
nv-hos-mod[data-st] .nt-car { animation: hm-night 1.4s linear 0.1s both; }
nv-hos-mod[data-st] .nt-car i + i { animation: hm-out 0.3s ease 0.62s both; }
nv-hos-mod[data-st] .nt-win { animation: hm-glow 0.4s ease 0.6s both; }
nv-hos-mod[data-st] .nt-win span { animation: hm-in 0.4s var(--nv-ease) 0.7s both; }
nv-hos-mod[kind="trailer"] { --pop: 2.1s; }
nv-hos-mod[data-st] .tr-pin { animation: hm-drop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) 0.2s both; }
nv-hos-mod[data-st] .tr-rip { animation: hm-ping 1s var(--nv-ease) 0.75s forwards; }
nv-hos-mod[data-st] .tr-tx > :nth-child(-n + 2) { animation: hm-in 0.4s var(--nv-ease) 0.8s both; }
nv-hos-mod[data-st] .tr-tx > :nth-child(n + 3) { animation: hm-in 0.4s var(--nv-ease) 0.95s both; }
@keyframes hm-pop { 0% { opacity: 0; transform: translateY(6px) scale(0.9); } 100% { opacity: 1; transform: none; } }
@keyframes hm-in { 0% { opacity: 0; transform: translateY(5px); } 100% { opacity: 1; transform: none; } }
@keyframes hm-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes hm-out { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hm-glow { 0% { opacity: 0.45; } 100% { opacity: 1; } }
@keyframes hm-blink { 0% { opacity: 0; } 30% { opacity: 1; } 55% { opacity: 0.25; } 100% { opacity: 1; } }
@keyframes hm-ping { 0% { opacity: 0.9; transform: scale(0.8); } 100% { opacity: 0; transform: scale(2.6); } }
@keyframes hm-drain { 0% { transform: scaleX(0.6667); } 100% { transform: scaleX(0.2333); } }
@keyframes hm-drive { 0% { transform: translateX(4%); } 100% { transform: translateX(64%); } }
@keyframes hm-lane { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes hm-night { 0% { transform: translateX(20.83%); } 100% { transform: translateX(64.58%); } }
@keyframes hm-drop { 0% { opacity: 0; transform: translateY(-26px); } 40% { opacity: 1; } 100% { opacity: 1; transform: none; } }

@container (max-width: 279.98px) {
  nv-hos-mod .tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; }
  nv-hos-mod .dv-n b { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  nv-hos-mod *, nv-hos-mod *::before, nv-hos-mod *::after { animation: none !important; transition: none !important; }
}

/* phones: no label under 11 px */
@media (max-width: 640px) {
  nv-hos-mod .chip, nv-hos-mod .dt-rows, nv-hos-mod .nt-win span, nv-hos-mod .nt-axis { font-size: 11px; }
}
