/*! Cat Operator Assistant. Copyright (c) 2026 Aayush Raj and the Cat Operator Assistant team.
    All rights reserved. Viewing only; no copying, reuse or redistribution without written permission. See LICENSE. */
/* ============ Tokens (Caterpillar language) ============ */
:root {
  --bg: #E9E9E6;
  --canvas: #F4F4F2;
  --surface: #FFFFFF;
  --line: #E6E6E3;
  --line-2: #EFEFEC;
  --chip: #F1F1EE;
  --ink: #080808;
  --y: #FFCD11;
  --canary: #ECCC17;
  --text: #0B0B0B;
  --t2: #6B6B6B;
  --t3: #9A9A96;

  --ok: #2FB36A;       --ok-ink: #1C7A45;
  --mango: #FFAA02;    --mango-ink: #9A6300;
  --warn: #F6790C;     --warn-ink: #AD4F00;
  --crit: #D61D1D;     --crit-ink: #B3161B;
  --info: #3A8DFF;     --info-ink: #1F63C4;

  /* sector chart palette, validated for CVD */
  --s-pb: #8B3FF0;
  --s-best: #0E9F8A;
  --s-slow: #E07B00;

  --r: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.06);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-io: cubic-bezier(.77, 0, .175, 1);

  --f-display: "Barlow Condensed", "Roboto Condensed", system-ui, sans-serif;
  --f-ui: "Roboto Condensed", "Noto Sans Devanagari", system-ui, sans-serif;
}
:root {
  --on-ink: #FFFFFF;          /* text on an ink fill */
  --fill: #080808;            /* filled buttons and selected tabs */
  --on-fill: #FFFFFF;
  --panel: #080808;           /* cab-display surfaces: stay dark in both themes */
  --hover: #F7F7F5;
  --chip-2: #EDEDEA;
  --muted: #DADAD6;
  --muted-2: #E9E9E6;
  --tick: #CFCFCB;
  --ok-bg: #E3F4EA; --ok-line: #BFE3CD;
  --crit-bg: #FBE7E7;
  --mango-bg: #FFF1D6;
  --warn-bg: #FEEBDD;
  --info-bg: #E6F0FF;
  --y-bg: #FFF6D1; --y-ink: #6B5300;
  color-scheme: light;
}
body.hi-contrast { --t2: #3A3A3A; --t3: #5A5A5A; --line: #C9C9C4; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1.4 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  padding: 12px;
  overflow: hidden;
  zoom: 0.9;
  width: 111.111vw;
  height: 111.111vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--y); border-radius: 10px; }
[data-lucide], svg.lucide { width: 18px; height: 18px; stroke-width: 1.5; flex: none; }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

/* ============ Type scale ============
   display 44 · page title 34 · card title 20 · section title 14/600 · body 13 · meta 12 · label 11 caps */
:root {
  --fs-display: 44px; --fs-h1: 34px; --fs-h2: 20px; --fs-h3: 14px; --fs-body: 13px; --fs-meta: 12px; --fs-label: 11px;
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  /* spring for panels: slight settle, like a physical drawer */
  --spring: linear(0, .009, .035 2.1%, .141 4.4%, .723 12.9%, .938 16.7%, 1.017 20.4%, 1.043 24.1%, 1.035 28.4%, 1.003 38.3%, .997 43.9%, 1);
}

/* ============ Shell ============ */
.app {
  height: 100%;
  min-height: 720px;
  background: var(--canvas);
  border-radius: 24px;
  padding: 0 14px 14px;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 320px;
  grid-template-rows: 60px minmax(0, 1fr);
  column-gap: 14px;
  transition: grid-template-columns 560ms var(--spring);
}
.app.left-collapsed { grid-template-columns: 64px minmax(0, 1fr) 320px; }
.app.right-collapsed { grid-template-columns: 224px minmax(0, 1fr) 64px; }
.app.left-collapsed.right-collapsed { grid-template-columns: 64px minmax(0, 1fr) 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.eyebrow {
  font: 500 var(--fs-label)/1 var(--f-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t2);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--t2); flex: none;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--chip); color: var(--ink); } }
.only-mobile { display: none; }

/* ============ Top bar ============ */
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 4px; min-width: 0; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-logo { width: 54px; height: auto; display: block; }
.tb-product { font: 600 var(--fs-h3)/1 var(--f-ui); letter-spacing: .01em; white-space: nowrap; }
.tb-sep { width: 1px; height: 22px; background: var(--line); }
.tb-machine { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; min-width: 0; }
.tb-machine b { font: 700 18px/1 var(--f-display); letter-spacing: .02em; }
.tb-machine span { font-size: var(--fs-meta); color: var(--t2); overflow: hidden; text-overflow: ellipsis; }
.tb-online { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--ok-ink); font-weight: 500; }
.tb-online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(47,179,106,.18); }
.tb-chip { height: 34px; padding: 0 12px; border-radius: 17px; background: var(--surface); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-meta); white-space: nowrap; }
.tb-chip svg { width: 15px; height: 15px; color: var(--t2); }
.num-chip span { font: 600 15px/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* SOS: hold 1.5 s so a bump cannot trigger it; the fill shows progress */
.sos {
  position: relative; overflow: visible; height: 40px; padding: 0 16px 0 12px; border-radius: 20px;
  background: var(--crit); color: #fff; box-shadow: 0 6px 18px rgba(214,29,29,.35), inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform 160ms var(--ease-out); user-select: none; -webkit-user-select: none; touch-action: none;
}
.sos::before { content: ""; position: absolute; inset: -3px; border-radius: 23px; border: 2px solid var(--crit); opacity: 0; animation: sosRing 2.4s var(--ease-out) infinite; pointer-events: none; }
@keyframes sosRing { 0% { transform: scale(.96); opacity: .7; } 70%, 100% { transform: scale(1.12, 1.35); opacity: 0; } }
.sos-fill { position: absolute; inset: 0; border-radius: 20px; background: #8E0E0E; clip-path: inset(0 100% 0 0 round 20px); transition: clip-path 200ms var(--ease-out); }
.sos.holding { transform: scale(.97); }
.sos.holding .sos-fill { clip-path: inset(0 0 0 0 round 20px); transition: clip-path 1500ms linear; }
.sos-content { position: relative; display: flex; align-items: center; gap: 7px; }
.sos-content svg { width: 17px; height: 17px; }
.sos-content b { font: 700 17px/1 var(--f-display); letter-spacing: .08em; }
.sos-content small { font-size: 10.5px; opacity: .8; text-transform: uppercase; letter-spacing: .08em; }

/* ============ Panels (reference: collapsible side panels with a header row) ============ */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.panel-head {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px 0 18px; border-bottom: 1px solid var(--line-2);
}
.panel.right .panel-head { padding: 0 16px 0 10px; justify-content: flex-start; }
.panel-title { font: 500 var(--fs-label)/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--t2); white-space: nowrap; transition: opacity 160ms ease; }
.panel.right .panel-title { flex: 1; }
.panel-foot { flex: none; border-top: 1px solid var(--line-2); padding: 8px; }

/* collapsed left: icon rail */
.app.left-collapsed .panel.left .panel-head { padding: 0; justify-content: center; }
.app.left-collapsed .panel.left .panel-title,
.app.left-collapsed .nav-item span,
.app.left-collapsed .nav-group,
.app.left-collapsed .user-meta,
.app.left-collapsed .user > svg { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
.app.left-collapsed .nav-group { height: 12px; padding: 0; }
.app.left-collapsed .nav-item { padding: 0; justify-content: center; gap: 0; }
.app.left-collapsed .user { justify-content: center; padding: 8px 0; gap: 0; }

/* collapsed right: slim strip with live glances */
.panel.right .rp-body { flex: 1; min-height: 0; overflow-y: auto; }
.panel.right .rp-strip { display: none; }
.app.right-collapsed .panel.right .panel-head { padding: 0; justify-content: center; }
.app.right-collapsed .panel.right .panel-title,
.app.right-collapsed .panel.right .rp-head-extra { display: none; }
.app.right-collapsed .panel.right .rp-body { display: none; }
.app.right-collapsed .panel.right .rp-strip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; }
.glance { position: relative; width: 44px; min-height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--t2); transition: background-color 150ms ease; }
.glance svg { width: 18px; height: 18px; }
.glance b { font: 600 13px/1 var(--f-display); color: var(--text); }
.glance .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
@media (hover: hover) and (pointer: fine) { .glance:hover { background: var(--chip); } }

/* nav */
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding: 12px 10px; }
.nav-group { font: 500 10.5px/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--t3); padding: 14px 12px 8px; white-space: nowrap; }
.nav-group:first-of-type { padding-top: 4px; }
.nav-item {
  position: relative; flex: none;
  height: 40px; border-radius: 11px; padding: 0 12px;
  display: flex; align-items: center; gap: 12px;
  color: var(--t2); font-weight: 500; font-size: var(--fs-body);
  transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
  text-align: left; white-space: nowrap;
}
.nav-item span { transition: opacity 160ms ease; }
.nav-item [data-lucide], .nav-item svg { width: 19px; height: 19px; }
.nav-item.active { background: var(--chip); color: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .nav-item:not(.active):hover { background: var(--hover); color: var(--ink); } }
.nav-item:active { transform: scale(.98); }
.nav-bar {
  position: absolute; left: 0; top: 0; width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--y); z-index: 2;
  transition: transform 420ms var(--spring);
}
.user {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-align: left;
  transition: background-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) { .user:hover { background: var(--chip); } }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); color: var(--y); display: grid; place-items: center; font: 600 13px/1 var(--f-display); flex: none; object-fit: cover; }
img.avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--y); }
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; white-space: nowrap; transition: opacity 160ms ease; }
.user-meta b { font-size: var(--fs-body); font-weight: 600; }
.user-meta small { font-size: var(--fs-label); color: var(--t2); }
.user > svg { width: 15px; height: 15px; color: var(--t3); }

/* right panel sections */
.rp-sec { padding: 18px; }
.rp-sec + .rp-sec { border-top: 1px solid var(--line-2); }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sec-head > svg { width: 17px; height: 17px; color: var(--t2); }
.sec-head h2 { margin: 0; font: 600 var(--fs-h3)/1.2 var(--f-ui); flex: 1; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit-bg); color: var(--crit-ink); font: 600 11px/20px var(--f-ui); text-align: center; }
.rp-head-extra { font-size: var(--fs-label); color: var(--t2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rp-head-extra::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--crit); animation: blink 1.6s ease infinite; }

/* scrim for mobile drawers */
.scrim { position: fixed; inset: 0; background: rgba(8,8,8,.35); opacity: 0; pointer-events: none; transition: opacity 220ms ease; z-index: 30; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* ============ SOS overlay ============ */
.sos-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(8,8,8,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 240ms var(--ease-out); }
.sos-overlay[hidden] { display: none; }
.sos-overlay.on { opacity: 1; }
.sos-card { width: min(520px, 100%); background: var(--panel); color: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 40px 80px rgba(0,0,0,.45); transform: translateY(16px) scale(.97); transition: transform 420ms var(--spring); }
.sos-overlay.on .sos-card { transform: none; }
.sos-top { position: relative; background: var(--crit); padding: 28px 28px 24px; display: flex; gap: 20px; align-items: center; overflow: hidden; }
.beacon { position: relative; width: 64px; height: 64px; flex: none; display: grid; place-items: center; }
.beacon i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); animation: beacon 2s var(--ease-out) infinite; }
.beacon i:nth-child(2) { animation-delay: .66s; } .beacon i:nth-child(3) { animation-delay: 1.33s; }
.beacon span { width: 44px; height: 44px; border-radius: 50%; background: #FFFFFF; color: var(--crit); display: grid; place-items: center; position: relative; }
.beacon span svg { width: 22px; height: 22px; }
@keyframes beacon { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
.sos-top h2 { margin: 0; font: 700 var(--fs-display)/.95 var(--f-display); letter-spacing: .01em; text-transform: uppercase; }
.sos-top p { margin: 6px 0 0; font-size: 13.5px; opacity: .92; }
.sos-steps { list-style: none; margin: 0; padding: 18px 28px 6px; }
.sos-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.08); opacity: .35; transition: opacity 300ms ease; }
.sos-steps li:first-child { border-top: 0; }
.sos-steps li.done { opacity: 1; }
.step-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid rgba(255,255,255,.3); flex: none; margin-top: 1px; transition: background-color 250ms ease, border-color 250ms ease; }
.step-ico svg { width: 13px; height: 13px; opacity: 0; transform: scale(.6); transition: opacity 200ms ease, transform 300ms var(--spring); }
.sos-steps li.done .step-ico { background: var(--ok); border-color: var(--ok); }
.sos-steps li.done .step-ico svg { opacity: 1; transform: none; }
.sos-steps li.working .step-ico { border-color: #fff; border-right-color: transparent; animation: spin .8s linear infinite; }
.sos-steps b { display: block; font-size: 14px; font-weight: 600; }
.sos-steps small { font-size: 12px; color: rgba(255,255,255,.62); }
.sos-foot { display: flex; gap: 10px; padding: 16px 28px 26px; align-items: center; }
.sos-foot .meta { flex: 1; font-size: 12px; color: rgba(255,255,255,.6); }
.btn.light { background: #FFFFFF; color: var(--panel); }
.btn.ghost-dark { background: rgba(255,255,255,.08); color: #fff; }

/* ============ Main / Home ============ */
.main { min-width: 0; min-height: 0; position: relative; grid-row: 2; }
.panel.left { grid-row: 2; grid-column: 1; }
.panel.right { grid-row: 2; grid-column: 3; }
.home { height: 100%; display: grid; }

.stage {
  position: relative; border-radius: 20px; overflow: hidden; min-height: 0;
  background:
    radial-gradient(60% 45% at 58% 18%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    linear-gradient(180deg, #E4E4E0 0%, #ECECE9 46%, #E1E1DD 47%, #F1F1EE 100%);
}
/* service bay: back wall panels + floor grid, all greyscale so the machine is the only colour */
.bay-wall {
  position: absolute; inset: 0 0 53% 0;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 1px, transparent 1px 120px),
    linear-gradient(180deg, rgba(0,0,0,.05), transparent 30%);
}
.bay-wall::after { /* high windows */
  content: ""; position: absolute; left: 12%; right: 8%; top: 10%; height: 18%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.75) 0 90px, rgba(0,0,0,.05) 90px 94px);
  border-radius: 4px; opacity: .8;
}
.bay-floor {
  position: absolute; left: -30%; right: -30%; bottom: -8%; height: 62%;
  transform-origin: 50% 0; transform: perspective(700px) rotateX(62deg);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.05) 0 1px, transparent 1px 90px);
}
.bay-stripe {
  position: absolute; left: 0; right: 0; bottom: 30%; height: 10px;
  transform: perspective(600px) rotateX(60deg);
  background: repeating-linear-gradient(-45deg, #C9C9C4 0 14px, #9E9E99 14px 28px);
  opacity: .55;
}
.stage-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px 30px var(--canvas); }
#three { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#three.dragging { cursor: grabbing; }
.stage.loading #three { filter: blur(8px); opacity: 0; }
#three { transition: filter 700ms var(--ease-out), opacity 700ms var(--ease-out); }

/* hotspots */
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hs {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  pointer-events: auto; display: grid; place-items: center; border-radius: 50%;
  will-change: transform;
}
.hs-ring {
  width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  display: grid; place-items: center;
  transition: transform 200ms var(--ease-out);
}
.hs-core { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transition: background-color 200ms ease; }
.hs-pulse {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--y); animation: pulse 2s var(--ease-out) infinite;
}
.hs.active .hs-ring { transform: scale(1.18); }
.hs.active .hs-core { background: var(--y); box-shadow: 0 0 0 1px var(--ink); }
.hs.alert .hs-pulse { border-color: var(--crit); }
.hs.alert .hs-core { background: var(--crit); }
.hs.caution .hs-pulse { border-color: var(--mango); }
@media (hover: hover) and (pointer: fine) { .hs:hover .hs-ring { transform: scale(1.12); } }
.hs:active .hs-ring { transform: scale(.94); }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }
.hs-label {
  --lt0: translate(-4px, -50%); --lt1: translate(0, -50%);
  position: absolute; left: 34px; top: 50%; transform: var(--lt0); opacity: 0;
  white-space: nowrap; background: var(--panel); color: #fff; font-size: 11px; font-weight: 500;
  padding: 5px 8px; border-radius: 8px; pointer-events: none;
  transition: opacity 150ms ease, transform 150ms var(--ease-out);
  display: flex; gap: 6px; align-items: center;
}
.hs-label i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.hs[data-side="up"] .hs-label { left: 50%; top: -6px; --lt0: translate(-50%, -90%); --lt1: translate(-50%, -100%); }
.hs[data-side="down"] .hs-label { left: 12px; top: 40px; --lt0: translate(0, -4px); --lt1: translate(0, 0); }
@media (hover: hover) and (pointer: fine) { .hs:hover .hs-label { opacity: 1; transform: var(--lt1); } }
.stage.show-labels .hs-label { opacity: 1; transform: var(--lt1); }

.connector { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.connector line { stroke: var(--ink); stroke-width: 1; }
.connector circle { fill: var(--ink); }

/* segmented control */
.segmented {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  height: 52px; padding: 6px; border-radius: 26px; background: var(--surface);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 4px; z-index: 5;
}
.seg-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.seg-tabs { position: relative; display: flex; }
.seg-pill {
  position: absolute; top: 0; left: 0; width: 132px; height: 40px; border-radius: 20px; background: var(--fill);
  transition: transform 280ms var(--ease-out);
}
.seg-tab {
  position: relative; z-index: 1; height: 40px; width: 132px; border-radius: 20px;
  font-weight: 500; font-size: 13px; color: var(--t2); transition: color 200ms ease;
}
.seg-tab.active { color: var(--on-fill); }

/* today card */
.today {
  position: absolute; left: 24px; top: 72px; width: 220px; padding: 16px 16px 14px; z-index: 4;
}
.today-row { position: relative; display: flex; align-items: center; gap: 10px; height: 32px; }
.today-row + .today-row::before { content: ""; position: absolute; left: 8px; top: -10px; height: 12px; width: 1px; background: var(--line); }
.today-row svg { width: 17px; height: 17px; color: var(--t2); }
.today-row span { flex: 1; font-size: 12.5px; }
.badge { min-width: 26px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--chip); display: grid; place-items: center; font: 600 12px/1 var(--f-display); }
.badge.crit { background: var(--crit-bg); color: var(--crit-ink); }

/* overview card */
.overview {
  position: absolute; left: 24px; top: 232px; width: 272px; z-index: 4;
  background: var(--panel); color: #fff; border-radius: 20px; padding: 18px 18px 16px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 24px 48px rgba(0,0,0,.28);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.overview.closed { opacity: 0; transform: translateX(-12px) scale(.98); pointer-events: none; }
.ov-head { display: flex; justify-content: space-between; align-items: center; }
.ov-head .eyebrow { color: rgba(255,255,255,.7); }
.ov-close { display: flex; align-items: center; gap: 4px; font-size: 11px; color: rgba(255,255,255,.7); padding: 4px; margin: -4px; border-radius: 6px; }
.ov-close svg { width: 14px; height: 14px; }
.ov-id { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: rgba(255,255,255,.85); }
.online { color: var(--ok); display: flex; align-items: center; gap: 5px; }
.online::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.blueprint { width: 100%; height: 118px; margin: 10px 0 6px; display: block; }
.bp { fill: none; stroke: var(--y); stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 900ms var(--ease-out) forwards; }
.bp-grid { stroke: rgba(255,255,255,.06); stroke-width: .5; }
.bp-g { opacity: .3; transition: opacity 250ms ease; }
.bp-g.on { opacity: 1; }
.bp-g.on .bp { stroke-width: 1.5; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ov-body { transition: opacity 180ms ease, filter 180ms ease, transform 250ms var(--ease-out); }
.ov-body.swap { opacity: 0; filter: blur(2px); transform: translateY(8px); transition-duration: 0ms; }
.ov-row { display: flex; align-items: center; gap: 10px; height: 34px; font-size: 12.5px; }
.ov-row svg { width: 16px; height: 16px; color: rgba(255,255,255,.6); }
.ov-row span { flex: 1; color: rgba(255,255,255,.75); }
.ov-row b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ov-row b.mango { color: var(--mango); } .ov-row b.crit { color: #FF6B6B; } .ov-row b.ok { color: #5BD694; } .ov-row b.warn { color: #FF9A45; }
.ov-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); margin: 0 0 6px 26px; overflow: hidden; }
.ov-bar i { display: block; height: 100%; background: var(--y); border-radius: 4px; transform-origin: 0 50%; transition: transform 600ms var(--ease-out); }
.ov-cta {
  margin-top: 10px; width: 100%; height: 40px; border-radius: 12px; background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-size: 12.5px;
  transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.ov-cta:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .ov-cta:hover { background: rgba(255,255,255,.1); } }
.xbtn {
  position: absolute; width: 44px; height: 44px; border-radius: 12px; background: var(--panel); color: #fff;
  display: grid; place-items: center; z-index: 4; left: 308px; top: 244px;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  transition: opacity 200ms ease, transform 160ms var(--ease-out);
}
.xbtn:active { transform: scale(.94); }
.xbtn.closed { opacity: 0; pointer-events: none; }

/* shift replay */
.replay { position: absolute; left: 24px; right: 24px; bottom: 16px; height: 164px; padding: 14px 20px; z-index: 4; display: flex; flex-direction: column; }
.replay-top { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.replay-top .label { color: var(--t2); }
.pills { display: flex; gap: 2px; }
.pill { height: 26px; min-width: 38px; padding: 0 10px; border-radius: 13px; font-size: 12px; color: var(--t2); transition: background-color 150ms ease, color 150ms ease; }
.pill.active { background: var(--fill); color: var(--on-fill); }
.pill:active { transform: scale(.96); }
.play { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); }
.play svg { width: 13px; height: 13px; }
.live { margin-left: auto; height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); display: flex; align-items: center; gap: 6px; font-size: 12px; background: var(--surface); }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--t3); }
.live.on::before { background: var(--crit); animation: blink 1.6s ease infinite; }
@keyframes blink { 50% { opacity: .3; } }
.track { position: relative; height: 56px; margin-top: 8px; cursor: pointer; touch-action: none; }
.ticks { position: absolute; left: 0; right: 0; top: 16px; height: 14px; display: flex; justify-content: space-between; }
.ticks i { width: 1px; height: 8px; background: var(--tick); margin-top: 3px; }
.ticks i.h { height: 14px; margin-top: 0; background: var(--t3); }
.segs { position: absolute; left: 0; right: 0; top: 20px; height: 6px; }
.seg { position: absolute; top: 0; height: 6px; border-radius: 3px; }
.seg.work { background: var(--ink); }
.seg.idle { background: repeating-linear-gradient(-45deg, var(--mango) 0 3px, #FFD58A 3px 6px); }
.seg.future { background: var(--muted); height: 2px; top: 2px; }
.alert-dot { position: absolute; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--crit); margin-left: -3.5px; box-shadow: 0 0 0 2px #fff; }
.hours { position: absolute; left: 0; right: 0; top: 38px; }
.hours span { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--t2); font-variant-numeric: tabular-nums; }
.hours span.now { color: var(--ink); font-weight: 600; }
.playhead { position: absolute; top: 8px; width: 16px; height: 30px; margin-left: -8px; cursor: grab; will-change: transform; }
.playhead::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--ink); border-radius: 2px; }
.playhead::after { content: ""; position: absolute; left: 1px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--y); box-shadow: 0 0 0 2px var(--ink); }
.playhead-time { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font: 600 11px/1 var(--f-ui); background: var(--ink); color: var(--on-ink); padding: 3px 6px; border-radius: 6px; white-space: nowrap; }
.chips { display: flex; gap: 10px; margin-top: auto; align-items: center; flex-wrap: nowrap; overflow: hidden; }
.chips .k { color: var(--t2); font-size: 12px; white-space: nowrap; }
.chip { height: 30px; padding: 0 14px; border-radius: 15px; background: var(--chip); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip.ink { background: var(--fill); color: var(--on-fill); }
.chip.ink.idle { background: var(--mango); color: var(--ink); }
.chip.ink.break { background: var(--muted); color: var(--ink); }

/* right rail */
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; background: var(--chip); font-size: 11px; color: var(--ok-ink); font-weight: 500; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.eta { display: flex; align-items: baseline; gap: 4px; }
.eta b { font: 600 44px/1 var(--f-display); letter-spacing: -.01em; }
.eta small { font: 500 12px/1 var(--f-ui); color: var(--t2); margin-right: 8px; }
.eta-cap { font-size: 11.5px; color: var(--t2); margin-top: 4px; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 14px; }
.mini div { display: flex; flex-direction: column; gap: 3px; }
.mini span { font-size: 10.5px; color: var(--t2); }
.mini b { font-weight: 600; font-size: 13px; }
.range { position: relative; height: 24px; }
.range-track { position: absolute; left: 0; right: 0; top: 9px; height: 6px; border-radius: 3px; background: var(--chip); }
.range-band { position: absolute; top: 5px; height: 14px; border-radius: 7px; background: rgba(255,205,17,.28); }
.range-fill { position: absolute; left: 0; top: 9px; height: 6px; border-radius: 3px; background: var(--ink); transform-origin: 0 50%; transition: transform 900ms var(--ease-out); }
.range-tick { position: absolute; top: 2px; width: 3px; height: 20px; margin-left: -1.5px; border-radius: 2px; }
.range-tick.pred { background: var(--y); box-shadow: 0 0 0 1px var(--ink); }
.range-tick.plan { background: var(--t3); width: 1px; margin-left: -.5px; }
.range-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--t3); margin-top: 2px; }
.factors { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.factor { height: 22px; padding: 0 8px; border-radius: 6px; background: var(--y-bg); color: var(--y-ink); font-size: 11px; display: inline-flex; align-items: center; font-weight: 500; }
.stops { margin: 14px 0 12px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.stops::before { content: ""; position: absolute; left: 4px; top: 12px; height: 18px; width: 1px; border-left: 1px dashed var(--t3); }
.stop { display: flex; align-items: center; gap: 12px; font-size: 12.5px; font-weight: 500; }
.stop i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); flex: none; }
.stop i.hollow { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink); }
.btn-ghost {
  width: 100%; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12.5px; font-weight: 500;
  transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.btn-ghost svg { width: 14px; height: 14px; transition: transform 150ms var(--ease-out); }
.btn-ghost:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .btn-ghost:hover { background: var(--hover); } .btn-ghost:hover svg, .ov-cta:hover svg { transform: translateX(2px); } }
.link { font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.link svg { width: 12px; height: 12px; }
.health-row { display: flex; align-items: center; gap: 12px; height: 31px; font-size: 12.5px; transition: transform 150ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .health-row:hover, .alert-row:hover { transform: translateX(2px); } }
.health-row svg { width: 17px; height: 17px; color: var(--t2); }
.health-row span { flex: 1; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.st::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.ok { color: var(--ok-ink); } .st.ok::after { background: var(--ok); }
.st.warn { color: var(--warn-ink); } .st.warn::after { background: var(--warn); }
.st.crit { color: var(--crit-ink); } .st.crit::after { background: var(--crit); }
.alert-list { margin: 0 -4px; padding: 0 4px; }
.alert-row { display: flex; gap: 12px; padding: 9px 0; align-items: flex-start; transition: transform 150ms var(--ease-out); }
.alert-row + .alert-row { border-top: 1px solid var(--line-2); }
.a-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.a-ico svg { width: 15px; height: 15px; }
.a-ico.crit { background: var(--crit-bg); color: var(--crit-ink); }
.a-ico.caution { background: var(--mango-bg); color: var(--mango-ink); }
.a-ico.warn { background: var(--warn-bg); color: var(--warn-ink); }
.a-ico.info { background: var(--info-bg); color: var(--info-ink); }
.a-txt { flex: 1; min-width: 0; }
.a-txt b { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.a-txt small { font-size: 11px; color: var(--t2); }
.a-time { font-size: 11px; color: var(--t2); white-space: nowrap; }
.alert-row.new { animation: slideIn 380ms var(--ease-out) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }

/* ============ Pages ============ */
.page { height: 100%; overflow-y: auto; padding-right: 4px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 16px; }
.page-head h1 { margin: 0; font: 700 var(--fs-h1)/1 var(--f-display); text-transform: uppercase; letter-spacing: -.005em; }
.page-head p { margin: 6px 0 0; color: var(--t2); font-size: 13px; max-width: 60ch; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.pcard { padding: 20px; min-width: 0; }
.pcard h3 { margin: 0; font: 600 var(--fs-h2)/1.05 var(--f-display); text-transform: uppercase; letter-spacing: .01em; }
.pcard .sub { max-width: 62ch; }
.pcard .sub { color: var(--t2); font-size: 12px; margin-top: 4px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.rise { animation: rise 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi b { font: 600 38px/1 var(--f-display); }
.kpi .delta { font-size: 12px; color: var(--t2); display: flex; align-items: center; gap: 6px; }
.btn {
  height: 44px; padding: 0 18px; border-radius: 12px; background: var(--y); color: #0B0B0B;
  font: 600 13px/1 var(--f-ui); letter-spacing: .04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.btn:active { transform: scale(.97); }
.btn.dark { background: var(--fill); color: var(--on-fill); }
.btn.outline { background: var(--surface); border: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-weight: 500; }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out); }
.opt:active { transform: scale(.97); }
.opt svg { width: 15px; height: 15px; }
.opt.active { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.field { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.field > span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--t2); font-weight: 500; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--t2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font: 400 11px var(--f-ui); fill: var(--t2); }
.chart .lbl { fill: var(--text); font-weight: 600; }
.chart .grid-l { stroke: var(--line-2); }
.chart .axis-l { stroke: var(--line); }
.grow { transform-box: fill-box; transform-origin: 0 100%; animation: growY 700ms var(--ease-out) both; animation-delay: calc(var(--i,0) * 60ms); }
.growx { transform-box: fill-box; transform-origin: 0 50%; animation: growX 700ms var(--ease-out) both; animation-delay: calc(var(--i,0) * 60ms); }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
.pop { transform-box: fill-box; transform-origin: center; animation: pop 500ms var(--ease-out) both; animation-delay: calc(200ms + var(--i,0) * 60ms); }
.arc { animation: arcIn 800ms var(--ease-out) both; animation-delay: calc(150ms + var(--i,0) * 80ms); }
@keyframes arcIn { from { stroke-dashoffset: var(--len); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.note { font-size: 12px; color: var(--t2); background: var(--canvas); border-radius: 10px; padding: 10px 12px; margin-top: 14px; display: flex; gap: 8px; }
.note svg { width: 15px; height: 15px; margin-top: 1px; color: var(--text); }
.note b { color: var(--text); font-weight: 600; }

/* stint strip */
.strip { position: relative; margin-top: 18px; }
.strip-row { position: relative; height: 64px; background: var(--canvas); border-radius: 12px; }
.stint { position: absolute; top: 8px; bottom: 8px; border-radius: 9px; padding: 7px 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.stint b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stint small { font-size: 10.5px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stint.done { background: var(--chip-2); }
.stint.active { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.stint.active small { color: var(--on-fill); opacity: .7; }
.stint .over { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(-45deg, rgba(255,170,2,.55) 0 4px, rgba(255,170,2,.2) 4px 8px); }
.rain-zone { position: absolute; top: -10px; bottom: -6px; border-radius: 10px; background: rgba(58,141,255,.07); border: 1px dashed rgba(58,141,255,.45); }
.rain-tag { position: absolute; top: -26px; font-size: 11px; color: var(--info-ink); display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.rain-tag svg { width: 13px; height: 13px; }
.now-line { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--y); box-shadow: 0 0 0 1px var(--ink); border-radius: 2px; }
.strip-hours { position: relative; height: 18px; margin-top: 6px; }
.strip-hours span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--t2); }
.task-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.task-top { display: flex; justify-content: space-between; align-items: center; }
.tag { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; background: var(--chip); }
.tag.active { background: var(--fill); color: var(--on-fill); }
.tag.done { background: var(--ok-bg); color: var(--ok-ink); }
.task-card h4 { margin: 0; font: 600 20px/1 var(--f-display); text-transform: uppercase; }
.meta { display: flex; gap: 12px; color: var(--t2); font-size: 12px; flex-wrap: wrap; }
.meta span { display: inline-flex; gap: 4px; align-items: center; }
.meta svg { width: 14px; height: 14px; }

/* safety */
.flag-tile { display: flex; flex-direction: column; gap: 16px; }
.flag-big { height: 150px; border-radius: 14px; display: flex; align-items: center; gap: 18px; padding: 0 24px; color: #fff; transition: background-color 250ms ease; }
.flag-big svg { width: 44px; height: 44px; stroke-width: 1.5; }
.flag-big b { font: 700 40px/1 var(--f-display); text-transform: uppercase; display: block; }
.flag-big small { font-size: 13px; opacity: .85; }
.flag-big.green { background: #1C7A45; }
.flag-big.yellow { background: repeating-linear-gradient(-45deg, var(--canary) 0 18px, #D9B800 18px 36px); color: var(--ink); }
.flag-big.red { background: var(--crit); }
.flag-big.blue { background: var(--info-ink); }
#edgeGlow { position: fixed; inset: 0; pointer-events: none; z-index: 50; border: 8px solid transparent; opacity: 0; transition: opacity 250ms ease; border-radius: 0; }
#edgeGlow.on { opacity: 1; }
#edgeGlow.yellow { border-image: repeating-linear-gradient(45deg, var(--canary) 0 12px, var(--ink) 12px 24px) 8; }
#edgeGlow.red { border-color: var(--crit); box-shadow: inset 0 0 40px rgba(214,29,29,.35); }
#edgeGlow.blue { border-color: var(--info); box-shadow: inset 0 0 40px rgba(58,141,255,.3); }
.gantry { background: var(--panel); border-radius: 14px; padding: 18px; display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.light { flex: 1; aspect-ratio: 1; max-width: 54px; border-radius: 50%; background: #2A0C0C; box-shadow: inset 0 0 0 3px #1A1A1A; transition: background-color 200ms ease, box-shadow 200ms ease; margin: auto; }
.light.on { background: #FF2D2D; box-shadow: inset 0 0 0 3px #1A1A1A, 0 0 18px rgba(255,45,45,.7); }
.gantry.go .light { background: #1C7A45; box-shadow: inset 0 0 0 3px #1A1A1A, 0 0 18px rgba(47,179,106,.6); }
.checks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.check { min-height: 64px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; font-weight: 500; transition: background-color 150ms ease, transform 120ms var(--ease-out); padding: 6px; text-align: center; }
.check:active { transform: scale(.97); }
.check svg { width: 18px; height: 18px; }
.check.done { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.go-msg { margin-top: 12px; font: 600 15px/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; min-height: 18px; }
.radar-wrap { position: relative; width: 100%; max-width: 280px; aspect-ratio: 1; margin: 12px auto 0; }
.radar-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(8,8,8,.14), rgba(8,8,8,0) 22%); animation: spin 3.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.blip { transform-box: fill-box; transform-origin: center; animation: blipP 1.8s ease-out infinite; }
@keyframes blipP { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.6); opacity: 0; } }
.cond { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.cond div { background: var(--canvas); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.cond span { font-size: 11px; color: var(--t2); display: flex; gap: 5px; align-items: center; }
.cond span svg { width: 14px; height: 14px; }
.cond b { font: 600 20px/1 var(--f-display); }
.hold-wrap { display: flex; align-items: center; gap: 18px; margin-top: 14px; }
.hold { position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--panel); color: #fff; display: grid; place-items: center; flex: none; font: 700 15px/1 var(--f-display); letter-spacing: .06em; transition: transform 160ms var(--ease-out); user-select: none; -webkit-user-select: none; touch-action: none; }
.hold.holding { transform: scale(.96); }
.hold svg { position: absolute; inset: -6px; width: 108px; height: 108px; transform: rotate(-90deg); }
.hold circle.bg { stroke: var(--line); }
.hold circle.fg { stroke: var(--y); stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 200ms var(--ease-out); }
.hold.holding circle.fg { stroke-dashoffset: 0; transition: stroke-dashoffset 1200ms linear; }
.inc-list { margin-top: 14px; }
.inc { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); align-items: center; }
.inc.new { animation: slideIn 380ms var(--ease-out) both; }

/* training */
.licence { background: var(--panel); color: #fff; border-radius: var(--r); padding: 22px; position: relative; overflow: hidden; }
.licence::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; border: 24px solid rgba(255,205,17,.08); }
.lic-class { font: 700 72px/.9 var(--f-display); color: var(--y); }
.prog { height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: var(--y); transform-origin: 0 50%; animation: growX 900ms var(--ease-out) both; }
.points { display: flex; gap: 4px; margin-top: 8px; }
.points i { width: 14px; height: 6px; border-radius: 2px; background: rgba(255,255,255,.15); }
.points i.on { background: var(--warn); }
.rec { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line-2); align-items: center; }
.rec:first-of-type { border-top: 0; }
.rec-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--chip); flex: none; }
.rec-ico.hot { background: var(--y); color: #0B0B0B; }
.rec b { display: block; font-size: 13.5px; font-weight: 600; }
.rec small { color: var(--t2); font-size: 12px; }
.lessons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.lesson { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: transform 160ms var(--ease-out); }
.lesson:active { transform: scale(.98); }
.thumb { height: 92px; background: var(--panel); position: relative; display: grid; place-items: center; }
.thumb svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.thumb .playb { width: 38px; height: 38px; border-radius: 50%; background: var(--y); display: grid; place-items: center; position: relative; }
.thumb .playb svg { width: 16px; height: 16px; color: #0B0B0B; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; font-size: 10.5px; color: #fff; background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 4px; }
.lesson div.t { padding: 10px 12px; }
.lesson b { font-size: 12.5px; font-weight: 600; display: block; }
.lesson small { font-size: 11px; color: var(--t2); }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.slot { height: 56px; border-radius: 10px; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--t2); transition: background-color 150ms ease, transform 120ms var(--ease-out); }
.slot b { font-size: 13px; color: var(--text); font-weight: 600; }
.slot.active { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.slot.active b { color: var(--on-fill); }
.slot:active { transform: scale(.97); }
.sim { background: var(--panel); color: #fff; border-radius: 14px; padding: 18px; margin-top: 12px; position: relative; overflow: hidden; min-height: 150px; }
.sim svg.grid-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.sim .content { position: relative; }

/* heatmap */
.heat { display: grid; gap: 3px; margin-top: 14px; }
.heat .cell { height: 26px; border-radius: 4px; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #fff; }
.heat .cell.n { background: var(--muted-2); color: var(--t3); }
.heat .rl { font-size: 11px; color: var(--t2); display: flex; align-items: center; }

/* settings */
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.set-row:first-of-type { border-top: 0; }
.set-row .txt { flex: 1; }
.set-row b { display: block; font-size: 13.5px; font-weight: 600; }
.set-row small { color: var(--t2); font-size: 12px; }
.switch { width: 44px; height: 26px; border-radius: 13px; background: var(--muted); position: relative; flex: none; transition: background-color 200ms ease; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 220ms var(--ease-out); }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--y); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 12px; }
.tbl th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--t2); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.tbl tr.new td { animation: slideIn 380ms var(--ease-out) both; }

/* tooltip + toast */
#tooltip {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  background: var(--panel); color: #fff; font-size: 12px; line-height: 1.35; padding: 7px 10px; border-radius: 8px;
  opacity: 0; transition: opacity 100ms ease; max-width: 240px; box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
#tooltip.on { opacity: 1; }
#tooltip b { color: var(--y); font-weight: 600; }
#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 16px); opacity: 0;
  background: var(--panel); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13px; display: flex; gap: 8px; align-items: center;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); box-shadow: 0 12px 30px rgba(0,0,0,.25); pointer-events: none;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast svg { width: 16px; height: 16px; color: var(--y); }

/* ============ Responsive ============ */
@media (max-height: 860px) {
  .stage:has(.overview:not(.closed)) .pace { opacity: 0; pointer-events: none; }
  .overview { top: 72px; }
  .xbtn { top: 84px; }
  .blueprint { height: 96px; }
}
@media (max-width: 1100px) {
  .tb-machine span, .tb-product, .tb-sep { display: none; }
  .c3 { grid-column: span 6; } .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  body { padding: 0; overflow: auto; }
  .app, .app.left-collapsed, .app.right-collapsed, .app.left-collapsed.right-collapsed {
    height: 100%; border-radius: 0; grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px;
  }
  .only-mobile { display: grid; }
  .tb-chip:not(.num-chip) { display: none; }
  .sos-content small, .sos-content b, .ov-close { display: none !important; }
  /* panels become drawers */
  .panel.left, .panel.right { position: fixed; top: 10px; bottom: 10px; z-index: 40; width: min(300px, 86vw); transition: transform 420ms var(--spring); }
  .panel.left { left: 10px; transform: translateX(calc(-100% - 20px)); }
  .panel.right { right: 10px; transform: translateX(calc(100% + 20px)); }
  .app.left-open .panel.left, .app.right-open .panel.right { transform: none; }
  .app .panel.right .rp-body { display: block; }
  .app .panel.right .rp-strip { display: none; }
  .app .panel.right .panel-title { display: block; }
  .overview { width: auto; right: 16px; left: 16px; top: auto; bottom: 212px; }
  .xbtn, .today, .connector, .blueprint { display: none; }
  .home { min-height: 760px; }
  .replay { height: auto; left: 12px; right: 12px; }
  .chips { flex-wrap: wrap; }
  .c3 { grid-column: span 12; }
  .checks, .lessons { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .hs-pulse, .sweep, .blip { display: none; }
}

/* Safety page SOS card */
.sos-card-inline { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; background: linear-gradient(90deg, #FDF0F0, #fff 60%); border-color: #F3CFCF; }
.sos-big { position: relative; width: 112px; height: 112px; border-radius: 50%; background: var(--crit); color: #fff; display: grid; place-items: center; flex: none; font: 700 26px/1 var(--f-display); letter-spacing: .08em; box-shadow: 0 12px 30px rgba(214,29,29,.35); user-select: none; -webkit-user-select: none; touch-action: none; transition: transform 160ms var(--ease-out); }
.sos-big::before, .sos-big::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--crit); opacity: 0; animation: beacon 2.4s var(--ease-out) infinite; }
.sos-big::after { animation-delay: 1.2s; }
.sos-big svg.ring { position: absolute; inset: -6px; width: 124px; height: 124px; transform: rotate(-90deg); }
.sos-big circle.fg { stroke: #fff; stroke-dasharray: 371; stroke-dashoffset: 371; transition: stroke-dashoffset 200ms var(--ease-out); }
.sos-big.holding { transform: scale(.96); }
.sos-big.holding circle.fg { stroke-dashoffset: 0; transition: stroke-dashoffset 1500ms linear; }
.sos-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; flex: 1; min-width: 260px; }
.sos-list div { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; }
.sos-list svg { width: 16px; height: 16px; color: var(--crit-ink); margin-top: 1px; }
.btn { white-space: nowrap; }
.sos-foot .meta { min-width: 0; }

/* ============ Top bar avatar ============ */
.tb-avatar { width: 40px; height: 40px; border-radius: 50%; padding: 0; flex: none; transition: transform 140ms var(--ease-out), box-shadow 150ms ease; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }
.tb-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.tb-avatar:active { transform: scale(.95); }
@media (hover: hover) and (pointer: fine) { .tb-avatar:hover { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--y); } }

/* ============ Training thumbnails (real Cat videos) ============ */
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; transition: transform 400ms var(--ease-out), opacity 200ms ease; }
.thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.45)); }
.thumb .playb, .thumb .dur { z-index: 1; }
@media (hover: hover) and (pointer: fine) { .lesson:hover .thumb img { transform: scale(1.04); opacity: 1; } }
.lesson b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.thumb { height: 104px; overflow: hidden; }
.btn svg { width: 16px; height: 16px; }

/* ============ Video page ============ */
.video-page .vp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border-radius: 10px; font-weight: 500; color: var(--t2); transition: background-color 150ms ease, color 150ms ease; }
.back svg { width: 18px; height: 18px; transition: transform 150ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .back:hover { background: var(--chip); color: var(--ink); } .back:hover svg { transform: translateX(-2px); } }
.parked { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--ok-bg); color: var(--ok-ink); font-size: var(--fs-meta); font-weight: 500; }
.parked svg { width: 14px; height: 14px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: var(--panel); box-shadow: 0 24px 48px rgba(0,0,0,.18); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vp-meta { padding: 18px 2px 0; }
.vp-title { margin: 8px 0 14px; font: 700 28px/1.08 var(--f-display); text-transform: uppercase; letter-spacing: .005em; }
.vp-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.channel { display: flex; align-items: center; gap: 10px; }
.channel img { width: 44px; height: auto; }
.channel b { display: block; font-size: var(--fs-h3); font-weight: 600; }
.channel small { font-size: var(--fs-meta); color: var(--t2); }
.vp-actions { display: flex; gap: 8px; }
a.btn { text-decoration: none; }
.upnext { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.un-item { display: flex; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 12px; text-align: left; align-items: flex-start; transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .un-item:hover { background: var(--canvas); } }
.un-thumb { position: relative; width: 104px; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; flex: none; background: var(--panel); }
.un-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.done-dot { position: absolute; right: 6px; bottom: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; }
.un-txt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-body); font-weight: 600; line-height: 1.3; }
.un-txt small { font-size: var(--fs-label); color: var(--t2); text-transform: uppercase; letter-spacing: .06em; }

/* ============ Profile ============ */
.profile-hero { overflow: hidden; padding: 0; }
.ph-cover { height: 96px; background:
  repeating-linear-gradient(-45deg, rgba(255,205,17,.14) 0 18px, transparent 18px 36px),
  linear-gradient(90deg, #080808, #1b1b1b); }
.ph-body { display: flex; align-items: flex-end; gap: 20px; padding: 0 24px 22px; margin-top: -44px; flex-wrap: wrap; }
.ph-avatar { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--y), 0 12px 24px rgba(0,0,0,.2); flex: none; }
.ph-id { flex: 1; min-width: 240px; padding-top: 52px; }
.ph-id h1 { margin: 0; font: 700 var(--fs-h1)/1 var(--f-display); text-transform: uppercase; }
.ph-role { color: var(--t2); font-size: var(--fs-body); margin-top: 4px; }
.ph-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ph-tabs { position: relative; display: flex; background: var(--chip); border-radius: 22px; padding: 4px; }
.ph-pill { position: absolute; top: 4px; left: 4px; width: 120px; height: 36px; border-radius: 18px; background: var(--fill); transition: transform 380ms var(--spring); }
.ph-tab { position: relative; width: 120px; height: 36px; border-radius: 18px; font-weight: 500; color: var(--t2); transition: color 200ms ease; }
.ph-tab.active { color: var(--on-fill); }
.kpi b .of { font-size: 18px; color: var(--t2); font-weight: 500; }
.cert-list { margin-top: 12px; }
.cert { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); }
.cert:first-child { border-top: 0; }
.cert b { display: block; font-size: var(--fs-body); font-weight: 600; }
.cert small { font-size: var(--fs-meta); color: var(--t2); }
.cert-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.cert-ico svg { width: 17px; height: 17px; }
.cert-ico.ok { background: var(--ok-bg); color: var(--ok-ink); }
.cert-ico.warn { background: var(--warn-bg); color: var(--warn-ink); }
.cert-ico.lock { background: var(--chip); color: var(--t3); }
.prog.light { background: var(--chip); margin-top: 12px; }
.prog.light i { background: var(--ink); }
.mini-vids { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.mv { display: flex; gap: 12px; align-items: center; padding: 6px; margin: 0 -6px; border-radius: 10px; text-align: left; transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .mv:hover { background: var(--canvas); } }
.mv img { width: 88px; aspect-ratio: 16 / 9; border-radius: 7px; object-fit: cover; flex: none; }
.mv span { flex: 1; min-width: 0; }
.mv b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv small { font-size: 11px; color: var(--t2); }
.mv-done { width: 18px; height: 18px; color: var(--ok); }
.activity { margin-top: 10px; }
.act { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: var(--fs-body); }
.act:first-child { border-top: 0; }
.act-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; flex: none; }
.act-ico svg { width: 14px; height: 14px; }
.act-t { font: 600 14px/1 var(--f-display); color: var(--t2); width: 42px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .tb-avatar { width: 34px; height: 34px; }
  .ph-tabs { width: 100%; }
  .un-thumb { width: 110px; }
}

/* ============ Minimal scrollbars: no arrows, no track, thin thumb that shows on hover ============ */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
*:hover::-webkit-scrollbar-thumb { background: rgba(8, 8, 8, .14); }
*::-webkit-scrollbar-thumb:hover { background: rgba(8, 8, 8, .28); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(8, 8, 8, .16) transparent; }
}

/* ============ Ghost delta HUD ============ */
.ghost { position: absolute; left: 24px; top: 72px; width: 244px; padding: 14px 16px 14px; z-index: 4; transition: opacity 200ms ease; }
.gh-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gh-task { font-size: var(--fs-label); color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-delta { font: 700 40px/1 var(--f-display); margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; transition: color 250ms ease; }
.ghost.behind .gh-delta { color: var(--mango-ink); }
.ghost.ahead .gh-delta { color: var(--ok-ink); }
.ghost.idle .gh-delta { color: var(--t3); }
.gh-sub { font-size: var(--fs-label); color: var(--t2); margin-top: 4px; min-height: 14px; }
.gh-track { position: relative; height: 6px; border-radius: 3px; background: var(--chip); margin: 18px 6px 8px; }
.gh-fill { position: absolute; inset: 0; border-radius: 3px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform 300ms var(--ease-out); }
.gh-pin { position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 1; transition: left 300ms var(--ease-out); }
.you-pin { width: 14px; height: 14px; border-radius: 50%; background: var(--y); box-shadow: 0 0 0 2px var(--ink); z-index: 2; }
.ghost-pin { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.9); border: 1.5px dashed var(--t2); display: grid; place-items: center; color: var(--t2); top: -10px; transform: translate(-50%, -50%); }
.ghost-pin svg { width: 12px; height: 12px; }
.gh-legend { display: flex; justify-content: space-between; font-size: var(--fs-label); color: var(--t2); margin-top: 6px; }
.gh-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gh-legend b { color: var(--text); font-weight: 600; }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg.you { background: var(--y); box-shadow: 0 0 0 1.5px var(--ink); }
.lg.best { border: 1.5px dashed var(--t2); }
.rp-ghost { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--canvas); font-size: var(--fs-meta); color: var(--t2); }
.rp-ghost svg { width: 15px; height: 15px; }
.rp-ghost span { flex: 1; }
.rp-ghost b { font: 700 16px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.rp-ghost b.behind { color: var(--mango-ink); }
.rp-ghost b.ahead { color: var(--ok-ink); }

/* ============ Pit stop popup (idle lesson) ============ */
.pitstop {
  position: absolute; right: 24px; bottom: 196px; width: 330px; z-index: 6;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px;
  box-shadow: 0 24px 48px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.06);
  opacity: 0; transform: translateY(14px) scale(.97); transform-origin: 100% 100%; pointer-events: none;
  transition: opacity 160ms ease, transform 160ms var(--ease-out);
}
.pitstop.on { opacity: 1; transform: none; pointer-events: auto; transition: opacity 240ms ease, transform 520ms var(--spring); }
.ps-head { display: flex; align-items: center; gap: 8px; }
.ps-badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--mango-bg); color: var(--mango-ink); font: 600 11px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }
.ps-badge svg { width: 13px; height: 13px; }
.ps-time { flex: 1; font: 600 15px/1 var(--f-display); color: var(--t2); font-variant-numeric: tabular-nums; }
.ps-x { width: 28px; height: 28px; }
.ps-belt { display: none; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--crit-bg); color: var(--crit-ink); font-size: var(--fs-meta); font-weight: 600; }
.ps-belt svg { width: 15px; height: 15px; }
.pitstop.belt .ps-belt { display: flex; }
.ps-body { display: flex; gap: 12px; margin-top: 12px; text-align: left; width: 100%; border-radius: 12px; }
.ps-thumb { position: relative; width: 116px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--panel); flex: none; display: grid; place-items: center; }
.ps-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ps-thumb .playb { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--y); display: grid; place-items: center; }
.ps-thumb .playb svg { width: 13px; height: 13px; color: #0B0B0B; }
.ps-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ps-txt small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--t2); }
.ps-txt b { font-size: var(--fs-body); font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ps-txt em { font-style: normal; font-size: var(--fs-label); color: var(--t2); line-height: 1.35; }
.ps-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.ps-actions .btn { height: 40px; justify-content: center; }
.ps-note { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 10.5px; color: var(--t3); }
.ps-note svg { width: 12px; height: 12px; }
@media (max-width: 760px) { .pitstop { left: 12px; right: 12px; width: auto; bottom: 250px; } .ghost { display: none; } }

/* ============ Seatbelt live card ============ */
.belt { position: absolute; right: 24px; top: 72px; width: 244px; padding: 14px 16px; z-index: 4; transition: border-color 250ms ease, box-shadow 250ms ease; }
.belt-live { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-label); color: var(--t2); }
.belt-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--crit); animation: blink 1.6s ease infinite; }
.belt-main { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.belt-ill { width: 52px; height: 52px; flex: none; border-radius: 12px; padding: 4px; transition: background-color 250ms ease; }
.belt-ill .seat { fill: none; stroke: var(--t2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.belt-ill .strap { fill: none; stroke-width: 3.2; stroke-linecap: round; }
.belt-ill .strap-on, .belt-ill .strap-off { transition: opacity 220ms ease; }
.belt-ill .strap-on .strap { stroke: var(--ok); } .belt-ill .strap-on .buckle { fill: var(--ok); }
.belt-ill .strap-off .strap { stroke: var(--crit); } .belt-ill .strap-off .buckle { fill: var(--crit); } .belt-ill .latch { fill: var(--t3); }
.belt.on .strap-off, .belt.na .strap-off { opacity: 0; }
.belt.off .strap-on, .belt.na .strap-on { opacity: 0; }
.belt.on .belt-ill { background: var(--ok-bg); }
.belt.off .belt-ill { background: var(--crit-bg); }
.belt.na .belt-ill { background: var(--chip); }
.belt-state { display: block; font: 700 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .01em; transition: color 250ms ease; }
.belt.on .belt-state { color: var(--ok-ink); }
.belt.off .belt-state { color: var(--crit-ink); }
.belt.na .belt-state { color: var(--t3); }
.belt-txt small { display: block; font-size: var(--fs-label); color: var(--t2); margin-top: 4px; line-height: 1.3; }
.belt.danger { border-color: var(--crit); animation: beltAlarm 1.2s ease-in-out infinite; }
.belt.danger .belt-txt small { color: var(--crit-ink); font-weight: 600; }
@keyframes beltAlarm { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(214,29,29,.35); } 50% { box-shadow: var(--shadow), 0 0 0 6px rgba(214,29,29,0); } }
/* a short "click" when the state changes, like a buckle latching */
.belt.clicked .belt-ill { animation: latch 420ms var(--spring); }
@keyframes latch { 0% { transform: scale(.86); } 100% { transform: scale(1); } }
.belt-strip { position: relative; height: 8px; border-radius: 4px; background: var(--chip); margin: 14px 0 8px; overflow: hidden; }
.belt-strip i { position: absolute; top: 0; bottom: 0; }
.belt-strip i.ok { background: var(--ok); }
.belt-strip i.bad { background: repeating-linear-gradient(-45deg, var(--crit) 0 3px, #F07B7B 3px 6px); }
.belt-strip i.br { background: var(--muted); }
.belt-strip .now { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
@media (max-width: 1100px) { .belt { width: 210px; } }
@media (max-width: 760px) { .belt { display: none; } }

/* ============ Cab instruments: pace + seatbelt (look like a Cat monitor, not web cards) ============ */
.hud {
  position: absolute; top: 72px; width: 256px; z-index: 4; padding: 12px 14px 13px;
  border-radius: 12px; color: #ECECE8;
  background: linear-gradient(180deg, #1E1E1C 0%, #131312 100%);
  border: 1px solid #2E2E2B;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.5), 0 14px 28px rgba(20,18,10,.22);
  transition: opacity 200ms ease, border-color 250ms ease;
}
.hud.pace { left: 24px; }
.hud.belt { right: 24px; width: 256px; }
.hud-head { display: flex; align-items: center; gap: 7px; font: 600 12.5px/1 var(--f-ui); color: #C9C9C3; }
.hud-head .ico-watch { width: 16px; height: 16px; color: var(--y); }
.hud-head em { margin-left: auto; font-style: normal; font-weight: 500; font-size: 11.5px; color: #8E8E88; }
.hud-live { display: inline-flex; align-items: center; gap: 5px; }
.hud-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #FF3B30; box-shadow: 0 0 6px rgba(255,59,48,.8); animation: blink 1.6s ease infinite; }
.hud-read { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.hud-read b { font: 700 42px/.9 var(--f-display); font-variant-numeric: tabular-nums; color: #F4F4F0; letter-spacing: .01em; }
.hud-read span { font: 700 17px/1 var(--f-display); text-transform: uppercase; letter-spacing: .05em; color: #F4F4F0; }
.pace.behind .hud-read b, .pace.behind .hud-read span { color: #FFB23E; }
.pace.ahead .hud-read b, .pace.ahead .hud-read span { color: #5BD694; }
.pace.idle .hud-read b { color: #6E6E69; }
.hud-sub { font-size: 12px; color: #A3A39D; margin-top: 5px; line-height: 1.35; }
.lap { display: grid; grid-template-columns: 34px 1fr 36px; align-items: center; gap: 8px; margin-top: 9px; font-size: 11.5px; color: #B8B8B2; }
.lap:first-of-type { margin-top: 12px; }
.lap b { color: #F4F4F0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.lap-bar { height: 7px; border-radius: 2px; background: #2B2B28; overflow: hidden; box-shadow: inset 0 1px 1px rgba(0,0,0,.5); }
.lap-bar i { display: block; height: 100%; background: var(--y); transform-origin: 0 50%; transform: scaleX(0); transition: transform 300ms var(--ease-out); }
.lap.best .lap-bar i { background: repeating-linear-gradient(90deg, #9A9A94 0 5px, transparent 5px 7px); }

/* seatbelt telltale: dark lamp when the belt is on, red and flashing when it is off, like a real dash light */
.telltale { --lamp-bg: #0C0C0B; width: 52px; height: 52px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--lamp-bg); border: 1px solid #2E2E2B; color: #3C3C39; box-shadow: inset 0 2px 6px rgba(0,0,0,.7); transition: color 200ms ease, background-color 200ms ease; }
.telltale .ico-belt { width: 36px; height: 36px; }
.hud.belt.on .telltale { color: #46C07A; }
.hud.belt.off .telltale { --lamp-bg: #1C0907; background: var(--lamp-bg); color: #FF3B30; }
.hud.belt.off .telltale .ico-belt { filter: drop-shadow(0 0 5px rgba(255,59,48,.85)); animation: lamp 1s steps(2, jump-none) infinite; }
@keyframes lamp { 0% { opacity: 1; } 100% { opacity: .28; } }
.hud.belt .belt-main { margin-top: 10px; gap: 12px; }
.hud.belt .belt-ill { display: none; }
.hud .belt-state { font: 700 28px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.hud.belt.on .belt-state { color: #5BD694; }
.hud.belt.off .belt-state { color: #FF6B61; }
.hud.belt.na .belt-state { color: #8E8E88; }
.hud .belt-txt small { color: #A3A39D; font-size: 12px; margin-top: 5px; }
.hud.belt.danger { border-color: #FF3B30; animation: beltAlarm 1.2s ease-in-out infinite; }
.hud.belt.danger .belt-txt small { color: #FF8A82; font-weight: 600; }
.hud .belt-strip { background: #2B2B28; box-shadow: inset 0 1px 1px rgba(0,0,0,.5); border-radius: 2px; height: 7px; }
.hud .belt-strip i.ok { background: #2FA866; }
.hud .belt-strip i.br { background: #45453F; }
.hud .belt-strip .now { background: #F4F4F0; }
.hud-foot { display: flex; justify-content: space-between; font-size: 12px; color: #A3A39D; }
.hud-foot b { color: #F4F4F0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .hud { display: none; } }

/* ============ Less "AI template" styling ============ */
/* labels in normal sentence case instead of spaced-out capitals */
.eyebrow { text-transform: none; letter-spacing: 0; font: 600 12px/1.2 var(--f-ui); color: var(--t2); }
.panel-title, .nav-group { letter-spacing: .04em; }
.st::after { display: none; }
.note { background: transparent; border-left: 3px solid var(--y); border-radius: 0; padding: 4px 0 4px 12px; }
.note svg { display: none; }

/* ============ Night mode ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A09;
  --canvas: #121211;
  --surface: #1A1A19;
  --line: #2C2C2A;
  --line-2: #242423;
  --chip: #252524;
  --chip-2: #2A2A28;
  --hover: #222221;
  --muted: #3A3A37;
  --muted-2: #2A2A28;
  --tick: #45453F;
  --text: #EDEDE8;
  --t2: #A6A6A0;
  --t3: #76766F;
  --ink: #F0F0EB;             /* strong accent flips to near-white */
  --on-ink: #0E0E0D;
  --panel: #0B0B0A;
  --ok-ink: #52CC88;  --ok-bg: rgba(47,179,106,.15);  --ok-line: rgba(47,179,106,.35);
  --crit-ink: #FF7A70; --crit-bg: rgba(214,29,29,.18);
  --mango-ink: #FFB547; --mango-bg: rgba(255,170,2,.15);
  --warn-ink: #FF9D52; --warn-bg: rgba(246,121,12,.16);
  --info-ink: #71AEFF; --info-bg: rgba(58,141,255,.16);
  --y-bg: rgba(255,205,17,.14); --y-ink: #FFD54A;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.35);
}
html[data-theme="dark"] body.hi-contrast { --t2: #CFCFC9; --t3: #9C9C95; --line: #45453F; }

/* machine bay at night: same layout, dark concrete and dim windows */
html[data-theme="dark"] .stage {
  background:
    radial-gradient(60% 45% at 58% 18%, rgba(255,236,190,.10), rgba(255,236,190,0) 70%),
    linear-gradient(180deg, #1B1B1A 0%, #171716 46%, #121211 47%, #1A1A18 100%);
}
html[data-theme="dark"] .bay-wall { background: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 120px), linear-gradient(180deg, rgba(0,0,0,.25), transparent 30%); }
html[data-theme="dark"] .bay-wall::after { background: repeating-linear-gradient(90deg, rgba(255,240,200,.07) 0 90px, rgba(0,0,0,.2) 90px 94px); }
html[data-theme="dark"] .bay-floor { background: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 90px), repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 90px); }
html[data-theme="dark"] .bay-stripe { opacity: .22; }

/* panels that are always dark get an edge so they separate from the dark page */
html[data-theme="dark"] .overview, html[data-theme="dark"] .hud, html[data-theme="dark"] .licence,
html[data-theme="dark"] .sim, html[data-theme="dark"] .sos-card, html[data-theme="dark"] #tooltip,
html[data-theme="dark"] #toast, html[data-theme="dark"] .gantry { box-shadow: 0 0 0 1px #2E2E2B, 0 14px 30px rgba(0,0,0,.5); }
html[data-theme="dark"] .ov-cta { background: rgba(255,255,255,.07); }

/* charts: SVG presentation colours follow the theme */
html[data-theme="dark"] svg [fill="#080808"] { fill: var(--ink); }
html[data-theme="dark"] svg [stroke="#080808"] { stroke: var(--ink); }
html[data-theme="dark"] svg [stroke="#fff"] { stroke: var(--surface); }
html[data-theme="dark"] svg [fill="#fff"] { fill: var(--surface); }
html[data-theme="dark"] svg [stroke="#E6E6E3"], html[data-theme="dark"] svg [stroke="#EFEFEC"] { stroke: var(--line); }
html[data-theme="dark"] svg [stroke="#D6D6D2"] { stroke: var(--muted); }
html[data-theme="dark"] svg [stroke="#6B6B6B"] { stroke: var(--t2); }
html[data-theme="dark"] svg text[style*="#0B0B0B"] { fill: var(--text) !important; }
html[data-theme="dark"] .radar-wrap svg rect[fill="#FFCD11"] { stroke: #000; }
html[data-theme="dark"] .sweep { background: conic-gradient(from 0deg, rgba(255,255,255,.14), rgba(255,255,255,0) 22%); }
html[data-theme="dark"] [style*="background:#EDEDEA"] { background: var(--chip-2) !important; }
html[data-theme="dark"] [style*="background:#E3F4EA"] { background: var(--ok-bg) !important; }
html[data-theme="dark"] .ph-cover { background: repeating-linear-gradient(-45deg, rgba(255,205,17,.12) 0 18px, transparent 18px 36px), linear-gradient(90deg, #050505, #161615); }
html[data-theme="dark"] .ph-avatar { box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--y), 0 12px 24px rgba(0,0,0,.4); }
html[data-theme="dark"] img.avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--y); }
html[data-theme="dark"] .tb-avatar { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3px var(--line); }
html[data-theme="dark"] .tb-logo, html[data-theme="dark"] .channel img { content: url("assets/cat-logo-white.png"); }
html[data-theme="dark"] .seg.idle { background: repeating-linear-gradient(-45deg, var(--mango) 0 3px, #6B4A0A 3px 6px); }
html[data-theme="dark"] .alert-dot { box-shadow: 0 0 0 2px var(--surface); }
html[data-theme="dark"] .playhead::after { box-shadow: 0 0 0 2px var(--canvas); }
html[data-theme="dark"] *:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }
html[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* the theme change itself: a quick fade, not a flash */
html.theme-fade, html.theme-fade * { transition: background-color 240ms ease, color 240ms ease, border-color 240ms ease, fill 240ms ease !important; }

/* night mode button in the top bar */
.tb-theme { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--t2); transition: color 150ms ease, transform 120ms var(--ease-out); }
.tb-theme svg { width: 18px; height: 18px; }
.tb-theme:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .tb-theme:hover { color: var(--text); } }
html[data-theme="dark"] .tb-theme { color: var(--y); }

/* text and icons on Cat yellow are always black, in day and night mode */
.btn:not(.dark):not(.outline):not(.light):not(.ghost-dark) { color: #0B0B0B; }

/* ============ Second-level tabs inside a page ============ */
.subtabs { display: inline-flex; gap: 4px; padding: 4px; margin: -4px 0 18px; border-radius: 12px; background: var(--chip); }
.subtab { height: 40px; padding: 0 20px; border-radius: 9px; font: 600 14px/1 var(--f-ui); color: var(--t2); transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out); }
.subtab:active { transform: scale(.97); }
.subtab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
@media (hover: hover) and (pointer: fine) { .subtab:not(.active):hover { color: var(--text); } }
/* with five items the menu needs no group headings; give the rows more room */
.nav { gap: 6px; padding-top: 16px; }
.nav-item { height: 46px; font-size: 14px; }

/* ============ Shift replay, redesigned ============ */
.replay { padding: 14px 20px 12px; gap: 0; }
.rp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.rp-title b { font: 700 18px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.rp-title span { font-size: 12.5px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-ctrl { display: flex; align-items: center; gap: 6px; flex: none; }
.ctl-play { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--chip); color: var(--text); transition: background-color 150ms ease, transform 120ms var(--ease-out); }
.ctl-play svg { width: 15px; height: 15px; }
.ctl-play:active, .ctl-now:active { transform: scale(.95); }
.ctl-speed { display: flex; height: 34px; border-radius: 9px; background: var(--chip); padding: 3px; }
.ctl-speed button { min-width: 36px; padding: 0 8px; border-radius: 7px; font: 600 12.5px/1 var(--f-ui); color: var(--t2); font-variant-numeric: tabular-nums; transition: background-color 150ms ease, color 150ms ease; }
.ctl-speed button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.ctl-now { height: 34px; padding: 0 12px 0 10px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px/1 var(--f-ui); color: var(--t2); background: var(--chip); transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out); }
.ctl-now::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--t3); }
.ctl-now.on { background: var(--crit-bg); color: var(--crit-ink); }
.ctl-now.on::before { background: var(--crit); animation: blink 1.6s ease infinite; }
@media (hover: hover) and (pointer: fine) { .ctl-play:hover, .ctl-now:not(.on):hover { color: var(--text); background: var(--muted-2); } .ctl-speed button:not(.active):hover { color: var(--text); } }

.replay .track { position: relative; height: 64px; margin-top: 12px; cursor: pointer; touch-action: none; }
.lane { position: absolute; left: 0; right: 0; top: 16px; height: 24px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.replay .seg { position: absolute; top: 0; height: 24px; border-radius: 0; display: flex; align-items: center; overflow: hidden; }
.replay .seg + .seg { box-shadow: -2px 0 0 var(--surface); }
.replay .seg em { font: 600 11px/1 var(--f-ui); font-style: normal; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.replay .seg.work { background: #2B2B29; }
.replay .seg.work em { color: #F2F2EE; }
.replay .seg.idle { background: repeating-linear-gradient(-45deg, #F5A300 0 5px, #FFC654 5px 10px); }
.replay .seg.idle em { color: #3B2600; }
.replay .seg.break { background: var(--muted); }
.replay .seg.break em { color: var(--t2); }
.replay .seg.future { top: 0; height: 24px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 12px); }
.replay .seg.future em { color: var(--t3); font-weight: 500; }
.alert-pin { position: absolute; top: 0; width: 15px; height: 15px; margin-left: -7.5px; border-radius: 50%; background: var(--crit); color: #fff; display: grid; place-items: center; font: 800 10px/1 var(--f-ui); box-shadow: 0 0 0 2px var(--surface); z-index: 2; cursor: help; }
.replay .hours { position: absolute; left: 0; right: 0; top: 42px; height: 22px; }
.replay .hours span { position: absolute; top: 0; transform: translateX(-50%); padding-top: 8px; font-size: 11px; color: var(--t2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay .hours span::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 4px; background: var(--tick); }
.replay .hours span.major::before { height: 6px; background: var(--t3); }
.replay .playhead { top: 8px; height: 40px; width: 20px; margin-left: -10px; }
.replay .playhead::before { left: 9px; width: 2px; background: var(--text); top: 6px; bottom: 0; }
.replay .playhead::after { left: 2px; top: 14px; width: 16px; height: 16px; background: var(--y); box-shadow: 0 0 0 3px var(--surface), 0 2px 6px rgba(0,0,0,.35); }
.replay .playhead-time { top: -14px; font: 700 11.5px/1 var(--f-ui); padding: 4px 7px; border-radius: 6px; background: var(--text); color: var(--surface); font-variant-numeric: tabular-nums; }
.rp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line-2); }
.rp-status { margin: 0; font-size: 13.5px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rp-status b { color: var(--text); font-weight: 600; }
.rp-status b.wait { color: var(--mango-ink); }
.rp-status b.off { color: var(--crit-ink); }
.rp-legend { display: flex; gap: 14px; flex: none; font-size: 11.5px; color: var(--t2); }
.rp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rp-legend i { width: 14px; height: 9px; border-radius: 2px; display: inline-block; }
.rp-legend .k-work { background: #2B2B29; }
.rp-legend .k-wait { background: repeating-linear-gradient(-45deg, #F5A300 0 3px, #FFC654 3px 6px); }
.rp-legend .k-lunch { background: var(--muted); }
.rp-legend .k-alert { width: 13px; height: 13px; border-radius: 50%; background: var(--crit); color: #fff; font: 800 9px/13px var(--f-ui); font-style: normal; text-align: center; }
html[data-theme="dark"] .replay .seg.work, html[data-theme="dark"] .rp-legend .k-work { background: #D9D9D3; }
html[data-theme="dark"] .replay .seg.work em { color: #151514; }
@media (max-width: 1100px) { .rp-legend { display: none; } }
@media (max-width: 760px) { .rp-top { flex-wrap: wrap; } .rp-title span { display: none; } .rp-status { white-space: normal; } }

/* broken part: red in the blueprint too */
.bp-g.fault .bp { stroke: #FF5A4F; }
.bp-g.fault { opacity: .75; }
.bp-g.fault.on { opacity: 1; }
/* the part being viewed is green in the blueprint too, matching the 3D model */
.blueprint.single .bp-g.on:not(.fault) .bp { stroke: #3BE089; }

/* ================= SRS pages ================= */
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-head .legend { margin-top: 2px; }
.late-txt { color: var(--crit-ink); font-weight: 600; }
.muted { color: var(--t3); }
.sample { font-size: 10.5px; font-weight: 600; color: var(--t2); background: var(--chip); padding: 3px 7px; border-radius: 5px; margin-left: 8px; }
.tag.late { background: var(--crit-bg); color: var(--crit-ink); }
.tag.moved { background: var(--mango-bg); color: var(--mango-ink); }
.plan-warn { box-shadow: var(--shadow), inset 3px 0 0 var(--crit); }
.end-line { position: absolute; top: -8px; bottom: -8px; width: 0; border-left: 2px dashed var(--crit); }
.warn-note { border-left-color: var(--crit); }

/* job list */
.jobs { margin-top: 12px; }
.job { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line-2); }
.job:first-child { border-top: 0; }
.job-time b { display: block; font: 700 20px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.job-time small { font-size: 11.5px; color: var(--t2); }
.job-title b { font: 600 17px/1.2 var(--f-ui); }
.job .meta { margin-top: 6px; }
.job.done { opacity: .72; }
.job.active { background: linear-gradient(90deg, var(--y-bg), transparent 70%); margin: 0 -20px; padding: 14px 20px; border-radius: 12px; border-top-color: transparent; }
.job.tomorrow .job-time b { color: var(--t3); }
.job.jumped .job-title b::after { content: " ↑"; color: var(--mango-ink); }
.done-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--t2); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 9px; background: var(--chip); font: 700 20px/1 var(--f-ui); }
.stepper b { min-width: 42px; text-align: center; font: 700 22px/1 var(--f-display); font-variant-numeric: tabular-nums; color: var(--text); }
.stepper em { font-style: normal; font-size: 12px; margin-right: 4px; }
.linkbtn { font-size: 12.5px; font-weight: 600; text-decoration: underline; color: var(--t2); margin-top: 8px; }

/* seatbelt interlock */
.interlock { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.interlock.belt-no { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.il-belt { display: flex; align-items: center; gap: 14px; }
.il-belt > div { flex: 1; }
.il-belt b { display: block; font: 700 22px/1 var(--f-display); text-transform: uppercase; }
.il-belt small { font-size: 12.5px; color: var(--t2); }
.belt-no .il-belt b { color: var(--crit-ink); }
.belt-ok .il-belt b { color: var(--ok-ink); }
.il-lamp { --lamp-bg: #0C0C0B; width: 50px; height: 50px; border-radius: 10px; background: var(--lamp-bg); display: grid; place-items: center; color: #46C07A; flex: none; }
.il-lamp .ico-belt { width: 34px; height: 34px; }
.belt-no .il-lamp, .il-lamp.off { --lamp-bg: #1C0907; color: #FF3B30; }
.belt-no .il-lamp .ico-belt, .il-lamp.off .ico-belt { filter: drop-shadow(0 0 5px rgba(255,59,48,.85)); animation: lamp 1s steps(2, jump-none) infinite; }
.il-checks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.il-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--t2); }
.il-foot .btn { height: 52px; padding: 0 22px; font-size: 14px; }
.btn:disabled { background: var(--muted); color: var(--t2) !important; cursor: not-allowed; }
.il-running { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ok-ink); font-size: 13px; }
.il-running svg { width: 16px; height: 16px; }

/* proximity */
.prox { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 20px; align-items: center; margin-top: 8px; }
.prox .radar-wrap { margin: 0; }
.prox-log .eyebrow { margin-bottom: 8px; display: block; }
.pe { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.pe:first-of-type { border-top: 0; }
.pe-t { font: 600 14px/1.2 var(--f-display); color: var(--t2); width: 40px; flex: none; font-variant-numeric: tabular-nums; }
.pe b { display: block; font-size: 13px; font-weight: 600; }
.pe small { font-size: 11.5px; color: var(--t2); }
.pe.stop b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--crit); margin-right: 7px; }
.pe.slow b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mango); margin-right: 7px; }
.rules td b { color: var(--crit-ink); }

/* reports */
.reports { margin-top: 10px; }
.rep { border-top: 1px solid var(--line-2); }
.rep:first-child { border-top: 0; }
.rep summary { display: flex; align-items: center; gap: 12px; padding: 11px 0; cursor: pointer; list-style: none; }
.rep summary::-webkit-details-marker { display: none; }
.rep-main { flex: 1; min-width: 0; }
.rep-main b { display: block; font-size: 13.5px; font-weight: 600; }
.rep-main small { font-size: 11.5px; color: var(--t2); }
.rep-chev { width: 16px; height: 16px; color: var(--t3); transition: transform 200ms var(--ease-out); }
.rep[open] .rep-chev { transform: rotate(180deg); }
.rep.new { animation: slideIn 380ms var(--ease-out) both; }
.snap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 4px 0 14px 42px; }
.snap div { background: var(--canvas); border-radius: 10px; padding: 9px 10px; }
.snap span { display: block; font-size: 11px; color: var(--t2); }
.snap b { font-size: 13px; font-weight: 600; }
.snap b.bad { color: var(--crit-ink); }
.snap b.wait { color: var(--warn-ink); }
.snap-none { padding: 0 0 12px 42px; font-size: 12px; color: var(--t3); }
.sync-box { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 12px; border-radius: 12px; background: var(--ok-bg); }
.sync-box svg { width: 20px; height: 20px; color: var(--ok-ink); flex: none; }
.sync-box b { display: block; font-size: 13.5px; }
.sync-box small { font-size: 12px; color: var(--t2); }
.sync-box.off { background: var(--warn-bg); }
.sync-box.off svg { color: var(--warn-ink); }

/* machine parts */
.parts { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.part { display: grid; grid-template-columns: 44px 1fr 150px; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--ok); }
.part.crit { box-shadow: inset 4px 0 0 var(--crit); background: color-mix(in srgb, var(--crit-bg) 60%, transparent); }
.part.warn { box-shadow: inset 4px 0 0 var(--warn); }
.part-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; }
.part.crit .part-ico { background: var(--crit-bg); color: var(--crit-ink); }
.part.warn .part-ico { background: var(--warn-bg); color: var(--warn-ink); }
.part-top { display: flex; align-items: center; gap: 10px; }
.part-top b { font-size: 15px; font-weight: 600; }
.part p { margin: 4px 0 0; font-size: 12.5px; color: var(--t2); }
.part p.todo { color: var(--text); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.part p.todo svg { width: 14px; height: 14px; color: var(--t2); }
.part-wear div { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.part-wear i { display: block; height: 100%; background: var(--ink); }
.part.warn .part-wear i { background: var(--warn); }
.part.crit .part-wear i { background: var(--crit); }
.part-wear small { font-size: 11px; color: var(--t2); }

/* learn: cab controls */
.cab-map { position: relative; margin-top: 12px; }
.cab-svg { width: 100%; display: block; }
.cab-svg .c-floor { fill: var(--canvas); stroke: var(--line); stroke-width: 2; }
.cab-svg .c-glass { fill: color-mix(in srgb, var(--info) 18%, transparent); }
.cab-svg .c-seat { fill: var(--muted); }
.cab-svg .c-console { fill: var(--chip-2); stroke: var(--line); }
.cab-svg .c-stick, .cab-svg .c-lever { fill: #2B2B29; }
.cab-svg .c-pedal { fill: var(--t3); }
.cab-svg .c-screen { fill: #1A1A19; stroke: var(--y); stroke-width: 2; }
.cab-svg .c-belt { stroke: #E0A800; stroke-width: 7; stroke-linecap: round; }
.cab-svg .c-btn { fill: var(--crit); }
.cab-svg .c-dial { fill: var(--surface); stroke: #2B2B29; stroke-width: 4; }
.cm-pin { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; display: grid; place-items: center; }
.cm-pin span { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--text); font: 700 14px/28px var(--f-display); text-align: center; box-shadow: 0 0 0 2px var(--ink), 0 3px 8px rgba(0,0,0,.2); transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.cm-pin.on span { background: #22C06A; color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #22C06A; transform: scale(1.12); }
@media (hover: hover) and (pointer: fine) { .cm-pin:hover span { transform: scale(1.1); } }
.cm-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ctrl-name { margin: 8px 0 16px; font: 700 30px/1.05 var(--f-display); text-transform: uppercase; }
.ctrl-row { padding: 12px 0; border-top: 1px solid var(--line-2); }
.ctrl-k { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--t2); }
.ctrl-k svg { width: 15px; height: 15px; }
.ctrl-row p { margin: 6px 0 0; font-size: 15px; line-height: 1.45; }
.ctrl-row.care .ctrl-k { color: var(--crit-ink); }
.ctrl-vid { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; margin-top: 12px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .ctrl-vid:hover { background: var(--hover); } }
.ctrl-vid small { display: block; font-size: 11px; color: var(--t2); }
.ctrl-vid b { font-size: 13px; font-weight: 600; line-height: 1.3; }

/* habits */
.habs { margin-top: 12px; }
.hab { display: grid; grid-template-columns: 1fr 160px 100px 130px; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.hab:first-child { border-top: 0; }
.hab-name b { display: block; font-size: 14px; font-weight: 600; }
.hab-name small, .hab-now small { font-size: 11.5px; color: var(--t2); }
.hab-now b { display: block; font: 700 20px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.spark { width: 150px; height: 36px; color: var(--t2); }
.hab.bad .spark { color: var(--crit); } .hab.mid .spark { color: var(--mango-ink); } .hab.good .spark { color: var(--ok); }
.hab-lvl { display: inline-flex; justify-content: center; height: 26px; padding: 0 10px; border-radius: 13px; align-items: center; font-size: 12px; font-weight: 600; white-space: nowrap; }
.hab-lvl.bad { background: var(--crit-bg); color: var(--crit-ink); }
.hab-lvl.mid { background: var(--mango-bg); color: var(--mango-ink); }
.hab-lvl.good { background: var(--ok-bg); color: var(--ok-ink); }
.hab-lvl.big { height: 32px; padding: 0 14px; font-size: 13px; }
.hab-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--t2); }

/* fleet view */
.app.fleet-mode, .app.fleet-mode.left-collapsed, .app.fleet-mode.right-collapsed, .app.fleet-mode.left-collapsed.right-collapsed { grid-template-columns: minmax(0, 1fr); }
.app.fleet-mode .panel { display: none; }
.app.fleet-mode .main { grid-column: 1; }
.fleet-badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--info-bg); color: var(--info-ink); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.fleet-badge svg { width: 14px; height: 14px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: -4px 0 16px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--t2); }
.filters select { height: 40px; min-width: 170px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 13px var(--f-ui); }
.filters .sample { margin-left: auto; align-self: center; }
.queue { margin-top: 10px; }
.q-item { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.q-item:first-child { border-top: 0; }
.q-item b { font-size: 13.5px; font-weight: 600; }
.q-item p { margin: 3px 0 0; font-size: 12.5px; color: var(--t2); }
.q-act { display: flex; gap: 6px; }
.q-act .btn { height: 36px; padding: 0 12px; font-size: 12px; }
.empty { padding: 24px 0; text-align: center; color: var(--t2); font-size: 13px; }
.bars { display: flex; gap: 12px; align-items: flex-end; height: 150px; margin-top: 14px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar-col i { width: 100%; max-width: 36px; background: var(--ink); border-radius: 4px 4px 0 0; }
.bar-col b { font-size: 12px; } .bar-col span { font-size: 10.5px; color: var(--t2); }
.growy { transform-origin: 50% 100%; animation: growY 700ms var(--ease-out) both; }
.hbars { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 50px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar span small { display: block; font-size: 10.5px; color: var(--t2); }
.hbar div { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--ink); border-radius: 5px; }
.acc { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.acc > div { display: grid; grid-template-columns: 90px 1fr 48px; gap: 10px; align-items: center; font-size: 12.5px; }
.acc-bar { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.acc-bar i { display: block; height: 100%; background: var(--crit); border-radius: 5px; }
.acc-bar i.good { background: var(--ok); }

/* login */
.login { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: var(--bg); transition: opacity 300ms var(--ease-out); }
.login.out { opacity: 0; pointer-events: none; }
.login-card { width: min(860px, 100%); display: grid; grid-template-columns: 300px 1fr; border-radius: 24px; overflow: hidden; background: var(--surface); box-shadow: 0 30px 70px rgba(0,0,0,.18); border: 1px solid var(--line); }
.login-side { background: #0B0B0A; color: #fff; padding: 34px 28px; display: flex; flex-direction: column; gap: 8px; background-image: repeating-linear-gradient(-45deg, rgba(255,205,17,.08) 0 16px, transparent 16px 32px); }
.login-logo { width: 110px; content: url("assets/cat-logo-white.png"); margin-bottom: 18px; }
.login-side h1 { margin: 0; font: 700 32px/1 var(--f-display); text-transform: uppercase; }
.login-side p { margin: 0; color: rgba(255,255,255,.65); font-size: 13px; }
.login-role { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.login-role button { height: 48px; border-radius: 12px; text-align: left; padding: 0 16px; color: rgba(255,255,255,.7); font: 600 14px var(--f-ui); background: rgba(255,255,255,.05); }
.login-role button.active { background: var(--y); color: #0B0B0B; }
.login-main { padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-who { display: flex; align-items: center; gap: 12px; align-self: stretch; padding: 12px; border-radius: 14px; background: var(--canvas); }
.login-who img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--y); }
.login-who b { display: block; font-size: 16px; } .login-who small { color: var(--t2); font-size: 12px; }
.pin-dots { display: flex; gap: 14px; margin-top: 6px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--t3); transition: background-color 120ms ease, border-color 120ms ease; }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-dots.shake { animation: shake 360ms ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-msg { font-size: 12.5px; color: var(--t2); min-height: 18px; }
.pin-msg.bad { color: var(--crit-ink); }
.pad { display: grid; grid-template-columns: repeat(3, 80px); gap: 10px; }
.pad button { height: 64px; border-radius: 14px; background: var(--chip); font: 600 24px var(--f-display); color: var(--text); display: grid; place-items: center; transition: transform 100ms var(--ease-out), background-color 120ms ease; }
.pad button[data-k="clear"] { font: 600 13px var(--f-ui); }
.pad button:active { transform: scale(.95); background: var(--muted); }
.badge-btn { margin-top: 4px; }
.login-main.mgr { justify-content: center; text-align: center; }
.mgr-ico { width: 44px; height: 44px; color: var(--info-ink); }
.login-main.mgr h2 { margin: 0; font: 700 28px var(--f-display); text-transform: uppercase; }
.login-main.mgr p { margin: 0; max-width: 34ch; color: var(--t2); }
.login-main.mgr small { color: var(--t3); }

/* moving: locked strip */
.tb-drive { height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px var(--f-ui); color: var(--t2); }
.tb-drive svg { width: 15px; height: 15px; }
.tb-drive.on { background: var(--y); color: #0B0B0B; border-color: var(--y); }
.tb-chip.sync { color: var(--ok-ink); }
.tb-chip.sync.off { color: var(--warn-ink); background: var(--warn-bg); }
.tb-chip.sync.busy svg { animation: spin 1s linear infinite; }
.drive-lock { position: fixed; inset: 0; z-index: 70; background: rgba(8,8,8,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; flex-direction: column; justify-content: space-between; padding: 18px; opacity: 0; transition: opacity 220ms ease; }
.drive-lock.on { opacity: 1; }
.dl-top { display: flex; justify-content: space-between; align-items: center; color: #fff; font: 600 15px var(--f-ui); }
.dl-top span { display: inline-flex; gap: 8px; align-items: center; }
.dl-top svg { width: 18px; height: 18px; }
.dl-top button { height: 40px; padding: 0 16px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.dl-strip { display: flex; align-items: stretch; gap: 14px; background: #111110; border: 1px solid #2E2E2B; border-radius: 20px; padding: 14px; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.dl-job { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; }
.dl-job small { font-size: 12px; color: #A3A39D; }
.dl-job b { font: 700 34px/1 var(--f-display); text-transform: uppercase; }
.dl-job span { font-size: 15px; color: #FFB23E; font-weight: 600; margin-top: 4px; }
.dl-belt { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-left: 1px solid #2E2E2B; border-right: 1px solid #2E2E2B; }
.dl-belt b { font: 700 20px var(--f-display); text-transform: uppercase; }
.dl-btn { position: relative; overflow: hidden; width: 150px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
.dl-btn svg { width: 22px; height: 22px; position: relative; }
.dl-btn b { font: 700 20px var(--f-display); letter-spacing: .04em; position: relative; }
.dl-btn small { font-size: 11px; opacity: .8; position: relative; text-transform: uppercase; letter-spacing: .06em; }
.dl-btn.report { background: #2B2B29; }
.dl-btn.sos { background: var(--crit); }
.dl-fill { position: absolute; inset: 0; background: rgba(255,255,255,.18); clip-path: inset(0 100% 0 0); transition: clip-path 200ms var(--ease-out); }
.dl-btn.holding .dl-fill { clip-path: inset(0 0 0 0); transition: clip-path 1300ms linear; }

@media (max-width: 1100px) {
  .snap { grid-template-columns: repeat(2, 1fr); }
  .hab { grid-template-columns: 1fr 120px 80px; } .hab-lvl:not(.big) { grid-column: 1 / -1; justify-self: start; }
  .prox { grid-template-columns: 1fr; }
  .q-item { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; } .login-role { flex-direction: row; } .login-role button { flex: 1; }
}
@media (max-width: 760px) {
  .il-checks { grid-template-columns: repeat(2, 1fr); }
  .part { grid-template-columns: 44px 1fr; } .part-wear { grid-column: 1 / -1; }
  .dl-strip { flex-wrap: wrap; } .dl-btn { flex: 1; height: 80px; width: auto; }
  .tb-drive span, .tb-chip.sync { display: none; }
  .job { grid-template-columns: 60px 1fr; } .job-tag { grid-column: 2; }
  .prox .radar-wrap { margin: 16px auto 24px !important; }
}

/* jobs: one line of detail per job */
.job { grid-template-columns: 64px 1fr auto; padding: 12px 0; align-items: center; }
.job-time b { font-size: 22px; }
.job-title { display: flex; align-items: center; gap: 8px; }
.job-wx { width: 16px; height: 16px; color: var(--t2); }
.job-line { font-size: 13px; color: var(--t2); margin-top: 3px; }
.job.active .done-box { margin-top: 10px; }
.done-line { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-ink); font-size: 13px; font-weight: 500; }
.done-line svg { width: 16px; height: 16px; }
.done-line .linkbtn { margin: 0 0 0 auto; color: var(--ok-ink); }
.job-tag .tag { font-size: 12px; height: 24px; }

/* Today's plan as three plain tiles */
.plan-tiles { grid-column: span 12; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; }
.ptile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ptile.now { background: var(--panel); border-color: var(--panel); color: #fff; }
.pt-k { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--t2); }
.pt-k svg { width: 15px; height: 15px; }
.ptile.now .pt-k { color: var(--y); }
.ptile b { font: 700 28px/1.05 var(--f-display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-v { font-size: 14px; color: var(--t2); }
.ptile.now .pt-v { color: #FFB23E; font-weight: 600; }
.pt-bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; margin-top: 4px; }
.pt-bar i { display: block; height: 100%; background: var(--y); border-radius: 4px; }
.pt-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--t3); }
.plan-alert { grid-column: span 12; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--crit-bg); color: var(--crit-ink); font-size: 14px; }
.plan-alert svg { width: 18px; height: 18px; flex: none; }
.plan-alert b { font-weight: 700; }
@media (max-width: 1100px) { .plan-tiles { grid-template-columns: 1fr; } }
/* realistic cab drawing: pins sit on top with a clear ring */
.cab-map { border-radius: 16px; overflow: hidden; }
.cab-svg { background: var(--canvas); }
.cm-pin span { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #0B0B0B, 0 3px 10px rgba(0,0,0,.35); }

/* add a job: inline, big controls for gloves */
.plan-head .btn { height: 42px; }
.add-job { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--canvas); border: 1px solid var(--line); }
.add-job label, .aj-time { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--t2); }
.add-job select { height: 50px; min-width: 190px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 15px var(--f-ui); }
.add-job .btn { height: 50px; }
.tag.new { background: var(--info-bg); color: var(--info-ink); }

/* ============ Machine tab: a drawing of the machine, then what to do ============ */
.mh-map { margin-top: 12px; padding: 12px 8px 0; }
.blueprint.health { height: auto; width: 100%; margin: 0; }
.blueprint.health .bp-grid { display: none; }
.blueprint.health .bp-g { opacity: 1; }
.blueprint.health .bp { stroke-width: 2.4; stroke: var(--ok); animation-duration: 1.2s; }
.blueprint.health .bp-g[data-part="hydraulics"] .bp { stroke: var(--crit); stroke-width: 3.2; }
.blueprint.health .bp-g[data-part="bucket"] .bp { stroke: var(--ok); }
.blueprint.health .bp-g[data-part="undercarriage"] .bp { stroke: var(--warn); stroke-width: 2.8; }
.blueprint.health .bp-g[data-part="hydraulics"] { animation: faultBlink 1.6s ease-in-out infinite; }
@keyframes faultBlink { 50% { opacity: .45; } }
.mh-key { display: flex; gap: 18px; margin-top: 10px; font-size: 13px; font-weight: 600; }
.mh-key .k { display: inline-flex; align-items: center; gap: 7px; }
.mh-key .k::before { content: ""; width: 22px; height: 4px; border-radius: 2px; }
.mh-key .crit { color: var(--crit-ink); } .mh-key .crit::before { background: var(--crit); }
.mh-key .warn { color: var(--warn-ink); } .mh-key .warn::before { background: var(--warn); }
.mh-key .ok { color: var(--ok-ink); } .mh-key .ok::before { background: var(--ok); }
.mh-list { padding: 0; overflow: hidden; }
.mh-sec { padding: 18px 20px; }
.mh-sec + .mh-sec { border-top: 1px solid var(--line-2); }
.mh-sec h4 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font: 700 15px var(--f-ui); }
.mh-sec h4 svg { width: 18px; height: 18px; }
.mh-sec.crit { background: var(--crit-bg); }
.mh-sec.crit h4 { color: var(--crit-ink); }
.mh-sec.warn h4 { color: var(--warn-ink); }
.mh-sec.ok h4 { color: var(--ok-ink); margin-bottom: 6px; }
.mh-item b { font: 700 20px/1.1 var(--f-display); text-transform: uppercase; }
.mh-item p { margin: 5px 0 0; font-size: 14px; color: var(--t2); line-height: 1.4; }
.mh-item p.mh-do { color: var(--text); font-weight: 600; }
.mh-call { margin-top: 14px; height: 50px; width: 100%; justify-content: center; font-size: 14px; }
.mh-fine { margin: 0; font-size: 14px; color: var(--t2); }
.mh-service { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; }
.mh-svc-num b { display: block; font: 700 32px/1.1 var(--f-display); text-transform: uppercase; margin-top: 4px; }
.mh-svc-num small { font-size: 12.5px; color: var(--t2); }
.mh-svc-bar > div { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.mh-svc-bar i { display: block; height: 100%; background: var(--y); border-radius: 5px; }
.mh-svc-bar > span { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--t3); margin-top: 6px; }
@media (max-width: 1100px) { .mh-service { grid-template-columns: 1fr; gap: 14px; } }

/* Learn > Controls fits one screen: the cab drawing shrinks to the space that is left */
.page.fit { display: flex; flex-direction: column; overflow: hidden; }
.page.fit .page-head { margin-bottom: 10px; }
.page.fit .subtabs { margin-bottom: 12px; }
.page.fit .grid { flex: 1; min-height: 0; }
.page.fit .grid > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.page.fit .ctrl-card { overflow-y: auto; }
.cab-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin-top: 10px; }
.cab-stage .cab-map { margin: 0; flex: none; }
.cab-stage .cab-svg { width: 100%; height: auto; }
@media (max-width: 1100px), (max-height: 620px) { .page.fit { overflow-y: auto; display: block; } .cab-stage { display: block; } .cab-stage .cab-map { width: 100% !important; } }

/* ============ Custom dropdowns ============ */
.dd { position: relative; }
.dd > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.dd-btn { width: 100%; min-width: 190px; height: 50px; padding: 0 12px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 15px var(--f-ui); text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn svg { width: 18px; height: 18px; color: var(--t2); flex: none; transition: transform 220ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .dd-btn:hover { border-color: var(--t3); } }
.dd.open .dd-btn { border-color: var(--ink); box-shadow: 0 0 0 3px var(--y-bg); }
.dd.open .dd-btn svg { transform: rotate(180deg); }
.dd-list { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 100%; max-height: 300px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.06);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center; pointer-events: none; visibility: hidden;
  transition: opacity 140ms ease, transform 180ms var(--ease-out), visibility 0s linear 180ms; }
.dd.up .dd-list { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; transform: translateY(4px) scale(.98); }
.dd.open .dd-list { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 140ms ease, transform 180ms var(--ease-out); }
.dd-opt { height: 44px; padding: 0 10px; border-radius: 9px; display: flex; align-items: center; gap: 10px; font: 500 14.5px var(--f-ui); color: var(--text); cursor: pointer; white-space: nowrap; }
.dd-opt span { flex: 1; }
.dd-opt::before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: transparent; flex: none; }
.dd-opt svg { width: 17px; height: 17px; opacity: 0; color: var(--ink); flex: none; }
.dd-opt.act { background: var(--chip); }
.dd-opt.sel { font-weight: 700; }
.dd-opt.sel::before { background: var(--y); }
.dd-opt.sel svg { opacity: 1; }
.filters .dd-btn { height: 42px; font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { .dd-list { transition: none; } }

/* Machine tab: the real 3D machine, coloured by condition */
.mh-3d { position: relative; height: 360px; margin-top: 12px; border-radius: 14px; overflow: hidden;
  background: radial-gradient(60% 55% at 50% 40%, rgba(255,255,255,.9), rgba(255,255,255,0) 70%), linear-gradient(180deg, #E6E6E2 0%, #EEEEEB 55%, #E2E2DE 56%, #F2F2EF 100%); }
html[data-theme="dark"] .mh-3d { background: radial-gradient(60% 55% at 50% 40%, rgba(255,236,190,.08), rgba(255,236,190,0) 70%), linear-gradient(180deg, #1C1C1B 0%, #171716 55%, #121211 56%, #1A1A18 100%); }
.mh-3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.mh-hint { position: absolute; right: 12px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--t2); background: var(--surface); padding: 5px 9px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.mh-hint svg { width: 14px; height: 14px; }
/* shift panel sits on the same bottom line as the side panels */
.stage .replay { bottom: 0; }

/* ============ Phone ============
   Platform layer first: no tap flash, no input zoom, no tap delay, notch-safe. */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, a, [role="button"], .dd-btn, .dd-opt, summary { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
@media (pointer: coarse) { input, textarea, select { font-size: 16px; } }

@media (max-width: 760px) {
  html, body { overscroll-behavior: none; }
  /* drawers park off-screen: clip them so they never widen the page */
  body { overflow: hidden; }
  .app, .app.left-collapsed, .app.right-collapsed, .app.left-collapsed.right-collapsed {
    height: 100%; min-height: 0; overflow: hidden;
    grid-template-rows: calc(72px + env(safe-area-inset-top, 0px)) minmax(0, 1fr);
    padding: 0 max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  }
  .main { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .panel.left, .panel.right {
    top: calc(62px + env(safe-area-inset-top, 0px)) !important;
    bottom: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    overscroll-behavior: contain;
  }
  .panel.left { left: 0 !important; transform: translateX(calc(-100% - 40px)); }
  .panel.right { right: 0 !important; transform: translateX(calc(100% + 40px)); }
  /* removed redundant transforms */

  /* top bar: logo, machine, then only what a phone needs */
  .topbar { padding: env(safe-area-inset-top, 0px) 0 0; gap: 8px; position: relative; z-index: 35; }
  .tb-left, .tb-right { gap: 6px; }
  .tb-logo { width: 42px; }
  .tb-machine b { font-size: 16px; }
  .tb-online { font-size: 0; gap: 0; }
  .tb-online::before { width: 8px; height: 8px; }
  .icon-btn, .tb-theme, .tb-drive { width: 40px; height: 40px; }
  .tb-drive { padding: 0; justify-content: center; border-radius: 20px; }
  .tb-drive svg, .icon-btn svg { width: 19px; height: 19px; }
  .num-chip, .tb-avatar { display: none; }
  #sosBtn { height: 40px; padding: 0 14px; }
  #parkBtn { white-space: nowrap; flex: none; }
  .dl-top { gap: 10px; }
}
@media (max-width: 380px) {
  .tb-logo { width: 36px; }
  .tb-machine { display: none; }
}

/* Home on a phone: machine on top, cards stacked underneath, page scrolls */
@media (max-width: 760px) {
  .home { display: block; min-height: 0; height: auto; }
  .home .stage { height: min(52svh, 430px); min-height: 330px; border-radius: 20px; }
  .home .segmented { 
    top: 10px; left: 10px; right: 10px; width: auto; 
    transform: none; 
  }
  .home .segmented .seg-tabs { flex: 1; }
  .home .segmented .seg-tab { width: 50%; flex: 1; }
  .home .segmented .seg-pill { width: 50%; }
  .home .segmented:has([data-seg="status"].active) .seg-pill { transform: translateX(100%) !important; }
  .home .segmented:has([data-seg="ops"].active) .seg-pill { transform: translateX(0) !important; }
  .home .pitstop { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .home-below { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
  .home-below > * { position: static; width: auto; inset: auto; }
  .home-below .overview.closed { display: none; }
  .home-below .overview { transform: none; overflow: hidden; }
  .home-below .overview::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 140px;
    height: 90px;
    background: url("assets/cat-logo-white.png") no-repeat center right / contain;
    opacity: 0.07;
    pointer-events: none;
  }
  .home-below .hud { display: block; }
  .home-below .hud.belt, .home-below .hud.pace { width: auto; }
  .home-below .replay { height: auto; display: flex; flex-direction: column; padding: 20px 16px 24px; }
  .home-below .rp-top, .home-below .rp-foot { display: contents; }
  .home-below .rp-title { order: 1; justify-content: center; margin-bottom: 4px; }
  .home-below .rp-title b { font-size: 20px; }
  .home-below .track { order: 2; margin: 16px 0 24px; }
  .home-below .rp-ctrl { order: 3; justify-content: center; gap: 10px; margin-bottom: 24px; width: 100%; }
  .home-below .rp-status { order: 4; text-align: center; white-space: normal; line-height: 1.5; margin-bottom: 16px; font-size: 13.5px; }
  .home-below .rp-legend { order: 5; justify-content: center; display: flex; flex-wrap: wrap; gap: 8px 16px; }
  .home-below .replay .seg em { display: none; }
}

/* Pages on a phone */
@media (max-width: 760px) {
  .page { overscroll-behavior: contain; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  .plan-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ptile { padding: 14px 16px; }
  .ptile.now { grid-column: 1 / -1; }
  .ptile b { font-size: 22px; white-space: normal; }
  .ptile.now b { font-size: 28px; }
}
@media (max-width: 760px) {
  .add-job { gap: 12px; }
  .add-job label { flex: 1 1 100%; }
  .add-job .dd, .add-job select { width: 100%; min-width: 0; }
  .add-job .btn { flex: 1; }
  .job { align-items: start; }
  .job-time { padding-top: 2px; }
}
@media (max-width: 760px) {
  .pcard { padding: 16px; }
  .opt-row:has(> .opt:nth-child(4)) { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  /* habit row: name + value on top, trend line under it, rating last */
  .hab { grid-template-columns: 1fr auto; grid-template-areas: "name now" "spark spark" "lvl lvl"; row-gap: 8px; }
  .hab .hab-name { grid-area: name; }
  .hab .hab-now { grid-area: now; text-align: right; }
  .hab .spark { grid-area: spark; width: 100%; height: 40px; }
  .hab .hab-lvl:not(.big) { grid-area: lvl; grid-column: auto; justify-self: start; }
}
@media (max-width: 760px) {
  .ph-body { padding: 0 16px 18px; gap: 12px; }
  .ph-avatar { width: 88px; height: 88px; }
  .ph-id { padding-top: 0; min-width: 0; flex-basis: 100%; }
  .grid > .kpi.c3 { grid-column: span 6; }
}
.tbl-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
@media (max-width: 760px) {
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  .tbl-wrap .tbl { min-width: 560px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .filters label { min-width: 0; }
  .filters .dd, .filters select { width: 100%; min-width: 0; }
  .filters .sample { grid-column: 1 / -1; margin: 0; justify-self: start; }
  .fleet .page-head .btn { width: 100%; justify-content: center; }
  .q-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi .delta { display: block; }
}
@media (max-width: 760px) {
  .dd-btn { min-width: 0; }
  .dd-list { width: 100%; }
  .dd-opt { white-space: normal; min-height: 44px; height: auto; padding-block: 8px; }
}
@media (max-width: 760px) {
  /* sign-in: scrolls on short phones, compact header */
  .login { place-items: center; overflow-y: auto; overscroll-behavior: contain; padding: max(24px, env(safe-area-inset-top, 0px)) 24px max(24px, env(safe-area-inset-bottom, 0px)); background: rgba(8, 8, 8, 0.8) !important; backdrop-filter: blur(24px) !important; -webkit-backdrop-filter: blur(24px) !important; }
  .login-card { margin: auto; transform: scale(0.85); transform-origin: center; width: 100%; border-radius: 28px !important; }
  .login-side { padding: 20px 20px 18px; gap: 4px; }
  .login-logo { width: 72px; margin-bottom: 10px; }
  .login-side h1 { font-size: 26px; }
  .login-role { margin-top: 12px; }
  .login-main { padding: 18px 16px 20px; gap: 12px; }
}
@media (max-width: 760px) {
  .sos-overlay { padding: 12px; overflow-y: auto; }
  .sos-top { padding: 20px; gap: 14px; }
  .sos-top h2 { font-size: 34px; }
  .sos-steps { padding: 12px 20px 4px; }
  .sos-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 20px max(18px, env(safe-area-inset-bottom, 0px)); }
  .sos-foot > :not(button) { grid-column: 1 / -1; }
  .sos-foot .btn { width: 100%; justify-content: center; }
}
/* "I'm safe" shares the .light class with the site-warning lamps; keep it a normal button */
.sos-foot .btn.light { flex: none; aspect-ratio: auto; max-width: none; border-radius: 12px; background: #FFFFFF; box-shadow: none; }
@media (max-width: 760px) { .sos-foot .btn.light { flex: 1; } }

/* ============ Machine: part by part ============ */
.pp { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; margin-top: 14px; }
.pp-list { display: flex; flex-direction: column; gap: 4px; }
.pp-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; padding: 12px 14px; border-radius: 12px; text-align: left; min-height: 56px;
  transition: background-color 150ms ease, transform 120ms var(--ease-out); }
.pp-row:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .pp-row:not(.on):hover { background: var(--hover); } }
.pp-row.on { background: var(--chip); box-shadow: inset 3px 0 0 var(--ink); }
.pp-n { font: 600 14.5px/1.2 var(--f-ui); }
.pp-hp { font: 700 20px/1 var(--f-display); }
.pp-row.crit .pp-hp { color: var(--crit-ink); } .pp-row.warn .pp-hp { color: var(--warn-ink); }
/* ten-segment bar, like a fuel gauge */
.pp-bar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.pp-bar i { height: 6px; border-radius: 1.5px; background: var(--chip); }
.pp-row.on .pp-bar i:not(.f) { background: var(--line); }
.pp-row.ok .pp-bar i.f { background: var(--ok); }
.pp-row.warn .pp-bar i.f { background: var(--warn); }
.pp-row.crit .pp-bar i.f { background: var(--crit); }

.pp-detail { min-width: 0; }
.pd-top { display: flex; align-items: center; gap: 22px; }
.hg { width: 180px; flex: none; }
.hg path { fill: none; stroke-width: 14; stroke-linecap: round; }
.hg-track { stroke: var(--chip); }
.hg-val { stroke-dashoffset: var(--c); animation: hgFill 800ms var(--ease-out) forwards; }
.hg.ok .hg-val { stroke: var(--ok); } .hg.warn .hg-val { stroke: var(--warn); } .hg.crit .hg-val { stroke: var(--crit); }
@keyframes hgFill { to { stroke-dashoffset: var(--off); } }
.hg-tick { stroke: var(--t3); stroke-width: 1.5; }
.hg-num { font: 700 40px var(--f-display); fill: var(--text); }
.hg-of { font: 500 11.5px var(--f-ui); fill: var(--t2); }
.pd-txt h4 { margin: 6px 0 0; font: 700 24px/1.05 var(--f-display); text-transform: uppercase; }
.pd-txt p { margin: 5px 0 0; font-size: 14px; color: var(--t2); line-height: 1.4; }
.pd-txt p.mh-do { color: var(--text); font-weight: 600; }
.pd-st { font: 600 13px var(--f-ui); }
.pd-st.crit { color: var(--crit-ink); } .pd-st.warn { color: var(--warn-ink); } .pd-st.ok { color: var(--ok-ink); }

.pd-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.rc { margin: 0; padding: 14px 14px 8px; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.rc figcaption { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; }
.rc figcaption span { font: 600 13.5px var(--f-ui); color: var(--t2); }
.rc figcaption b { font: 700 26px/1 var(--f-display); grid-row: span 2; align-self: center; }
.rc figcaption b small { font: 500 13px var(--f-ui); color: var(--t2); margin-left: 3px; }
.rc figcaption em { font-style: normal; font-size: 12.5px; font-weight: 600; }
.rc.ok figcaption em { color: var(--ok-ink); } .rc.warn figcaption em { color: var(--warn-ink); } .rc.crit figcaption em { color: var(--crit-ink); }
.rc.crit figcaption b { color: var(--crit-ink); } .rc.warn figcaption b { color: var(--warn-ink); }
.rc svg { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.rc-band { fill: var(--ok); opacity: .12; }
.rc-lim { stroke: var(--crit); stroke-width: 1.25; stroke-dasharray: 5 4; }
.rc-limt { font: 600 10.5px var(--f-ui); fill: var(--crit-ink); }
.rc-ax { font: 500 10.5px var(--f-ui); fill: var(--t3); }
.rc-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: rcDraw 700ms var(--ease-out) forwards; }
@keyframes rcDraw { to { stroke-dashoffset: 0; } }
.rc-pt { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.rc-now { stroke: var(--surface); stroke-width: 2.5; }
.rc.ok .rc-now { fill: var(--ok); } .rc.warn .rc-now { fill: var(--warn); } .rc.crit .rc-now { fill: var(--crit); }
.pd-key { display: flex; gap: 18px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--t2); }
.pd-key span { display: inline-flex; align-items: center; gap: 7px; }
.pd-key .kb { width: 16px; height: 10px; border-radius: 2px; background: var(--ok); opacity: .25; }
.pd-key .kl { width: 18px; border-top: 1.5px dashed var(--crit); }
.pd-sample { margin-left: auto; color: var(--t3); }
@media (prefers-reduced-motion: reduce) { .hg-val { stroke-dashoffset: var(--off); animation: none; } .rc-line { stroke-dashoffset: 0; animation: none; } }
@media (max-width: 1100px) { .pp { grid-template-columns: 1fr; } .pp-list { display: grid; grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .pp-list { grid-template-columns: 1fr 1fr; }
  .pd-top { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .hg { width: 210px; }
  .pd-charts { grid-template-columns: 1fr; }
  .pd-key { flex-wrap: wrap; gap: 8px 16px; }
}


/* ============ Learn > Controls: every Cat video beside the cab ============ */
.ctrl-card .ctrl-name { margin: 6px 0 10px; }
.ctrl-card .ctrl-row { padding: 10px 0; }
.ctrl-card .ctrl-row p { font-size: 14.5px; margin-top: 4px; }
.cv-head { display: flex; align-items: baseline; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.cv-head h3 { margin: 0; font: 600 var(--fs-h2)/1 var(--f-display); text-transform: uppercase; }
.cv-head span { font-size: 12.5px; color: var(--t2); }
.cv-list { flex: 1; min-height: 140px; overflow-y: auto; overscroll-behavior: contain; margin: 10px -8px 0; padding: 0 8px 4px; display: flex; flex-direction: column; gap: 6px; }
.cv { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 12px; transition: background-color 150ms ease; }
.cv.mine { background: var(--chip); box-shadow: inset 3px 0 0 var(--y); }
@media (hover: hover) and (pointer: fine) { .cv:not(.mine):hover { background: var(--hover); } }
.cv-main { display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; }
.cv-main:active { transform: scale(.99); }
.cv-thumb { position: relative; flex: none; width: 104px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #111; }
.cv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-thumb .playb { position: absolute; inset: 0; margin: auto; width: 28px; height: 28px; border-radius: 50%; background: var(--y); color: #0B0B0B; display: grid; place-items: center; }
.cv-thumb .playb svg { width: 13px; height: 13px; margin-left: 2px; fill: currentColor; }
.cv-seen { position: absolute; left: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.cv-seen svg { width: 12px; height: 12px; stroke-width: 3; }
.cv-txt { min-width: 0; }
.cv-txt small { display: block; font-size: 11.5px; color: var(--t2); font-weight: 600; }
.cv.mine .cv-txt small { color: var(--text); }
.cv-txt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; font-weight: 600; line-height: 1.3; margin-top: 2px; }
.cv-nums { display: flex; gap: 4px; flex: none; }
.cv-nums em { font-style: normal; font-size: 11.5px; color: var(--t3); white-space: nowrap; }
/* the same numbered dots as on the cab; tap one to jump to that control */
.cv-n { width: 30px; height: 30px; border-radius: 50%; font: 700 13px/1 var(--f-display); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); transition: transform 120ms var(--ease-out); }
.cv-n:active { transform: scale(.92); }
.cv-n.on { background: #22C06A; color: #fff; box-shadow: none; }
.cm-pin.hint span { background: var(--y); color: #0B0B0B; transform: scale(1.12); }
.page.fit .ctrl-card { overflow: hidden; }
@media (max-width: 1100px), (max-height: 620px) { .cv-list { overflow: visible; flex: none; } .page.fit .ctrl-card { overflow: visible; } }
@media (max-width: 760px) { .cv-thumb { width: 92px; } .cv { grid-template-columns: 1fr; } .cv-nums { padding-left: 104px; } }
.ctrl-card .ctrl-name { margin: 4px 0 6px; font-size: 28px; }
.ctrl-card .ctrl-row { padding: 8px 0; }
.cv-head { padding-top: 12px; }

/* ============ Sign in: who is driving -> PIN -> belt on, start engine ============ */
.login-card { min-height: 520px; }
.login-steps { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.login-steps li { display: flex; align-items: center; gap: 10px; font: 600 14px var(--f-ui); color: rgba(255,255,255,.45); }
.login-steps li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--f-display); border: 1.5px solid rgba(255,255,255,.3); }
.login-steps li.on { color: #fff; }
.login-steps li.on span { background: var(--y); border-color: var(--y); color: #0B0B0B; }
.login-steps li.done { color: rgba(255,255,255,.75); }
.login-steps li.done span { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.login-main h2 { margin: 0; font: 700 28px/1.05 var(--f-display); text-transform: uppercase; align-self: stretch; }
.login-main.who { align-items: stretch; justify-content: center; }
.op-list { display: flex; flex-direction: column; gap: 8px; }
.op-card { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color 150ms ease, transform 120ms var(--ease-out); }
.op-card:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .op-card:hover { border-color: var(--ink); } }
.op-card > svg { width: 18px; height: 18px; color: var(--t3); }
.op-av, .ini { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.ini { display: grid; place-items: center; background: #2B2B29; color: var(--y); font: 700 17px var(--f-display); letter-spacing: .02em; }
.op-txt { flex: 1; min-width: 0; }
.op-txt b { display: block; font-size: 16px; }
.op-txt small { color: var(--t2); font-size: 12.5px; }
.op-lvl { font: 600 12.5px var(--f-ui); padding: 4px 10px; border-radius: 8px; background: var(--chip); }
.op-lvl.expert { color: var(--ok-ink); }
.op-lvl.beginner { color: var(--warn-ink); }
button.login-who { text-align: left; border: 0; }
.login-who .ini { width: 52px; height: 52px; }
.lw-change { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--t2); text-decoration: underline; }
.tb-avatar .ini, .user .avatar.ini { width: 100%; height: 100%; font-size: 14px; }
.user .avatar.ini { width: 34px; height: 34px; }

/* belt gate: the machine's own telltale, big */
.login-main.start { justify-content: center; text-align: center; gap: 12px; }
.login-main.start h2 { text-align: center; }
.login-main.start p { margin: 0; color: var(--t2); font-size: 14.5px; }
.gate-lamp { width: 112px; height: 112px; border-radius: 22px; background: #1C0907; color: #FF3B30; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #3A0F0B; transition: background-color 250ms ease, color 250ms ease; }
.gate-lamp .ico-belt { width: 70px; height: 70px; filter: drop-shadow(0 0 8px rgba(255,59,48,.85)); animation: lamp 1s steps(2, jump-none) infinite; }
.gate-lamp.ok { background: #0C0C0B; color: #46C07A; box-shadow: inset 0 0 0 2px #1E3A2A; }
.gate-lamp.ok .ico-belt { filter: drop-shadow(0 0 6px rgba(70,192,122,.6)); animation: none; }
.gate-lamp.shake, .gate-start.shake { animation: shake 360ms ease; }
.gate-belt { height: 44px; }
.gate-checks { align-self: stretch; text-align: left; margin-top: 4px; }
.gate-checks > span { font-size: 12.5px; font-weight: 600; color: var(--t2); }
.gate-checks > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.gate-start { align-self: stretch; height: 60px; justify-content: center; font-size: 17px; margin-top: 4px; }
.gate-start.locked { background: var(--chip); color: var(--t2); }
.gate-note { min-height: 16px; color: var(--crit-ink); font-weight: 600; font-size: 12.5px; }
@media (max-width: 760px) { .gate-checks > div { grid-template-columns: 1fr 1fr; } .gate-lamp { width: 88px; height: 88px; } .gate-lamp .ico-belt { width: 54px; height: 54px; } .login-card { min-height: 0; } .login-steps { display: none; } }

/* running late: one tap adds 15 min to the job in progress */
#runLate { height: 44px; }
.late-n { font-style: normal; color: var(--warn-ink); margin-left: 4px; }

/* report: two taps after the hold */
.rep-pick { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.rp-step { display: flex; align-items: center; gap: 8px; font: 600 14px var(--f-ui); }
.rp-step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--f-display); background: var(--chip); }
.rp-step span.on { background: var(--y); color: #0B0B0B; }
.rp-step span.done { background: var(--ok); color: #fff; }
.rp-step b { margin-left: auto; font-weight: 700; }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rp-grid button { min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 8px; padding: 0 12px; font: 600 14px var(--f-ui); text-align: left; transition: transform 120ms var(--ease-out); }
.rp-grid button:active { transform: scale(.97); }
.rp-grid button svg { width: 18px; height: 18px; color: var(--t2); }
.rp-grid.sev { grid-template-columns: 1fr; }
.rp-grid.sev button { justify-content: center; font-size: 15px; }
.rp-grid.sev .minor { background: var(--warn-bg); border-color: transparent; color: var(--warn-ink); }
.rp-grid.sev .serious { background: var(--crit-bg); border-color: transparent; color: var(--crit-ink); }
.rp-grid.sev .critical { background: var(--crit); border-color: var(--crit); color: #fff; }
.rep-pick .linkbtn { align-self: flex-start; }
/* fleet manager entry on the sign-in screen: separate from the operators, with its own button */
.mgr-box { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.mgr-box .mgr-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; flex: none; }
.mgr-box .mgr-ico svg { width: 22px; height: 22px; }
.mgr-txt { flex: 1; min-width: 0; }
.mgr-txt b { display: block; font-size: 15px; }
.mgr-txt small { color: var(--t2); font-size: 13px; }
.mgr-box .btn { height: 48px; flex: none; gap: 8px; }
.mgr-box .btn svg { width: 16px; height: 16px; }
@media (max-width: 760px) { .mgr-box { flex-wrap: wrap; } .mgr-box .btn { width: 100%; justify-content: center; } }
/* fleet manager: secondary to the operator list */
.mgr-box { gap: 12px; padding-top: 14px; }
.mgr-box .mgr-ico { width: 38px; height: 38px; border-radius: 10px; color: var(--t2); }
.mgr-box .mgr-ico svg { width: 18px; height: 18px; }
.mgr-txt b { font-size: 14px; font-weight: 600; }
.mgr-txt small { font-size: 12.5px; }
.mgr-box .btn { height: 40px; padding: 0 14px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--t2); }
/* fleet manager sits at the bottom of the card; the operator list stays in the middle */
.login-main.who { justify-content: flex-start; }
.login-main.who > h2 { margin-top: auto; }
.login-main.who .mgr-box { margin-top: auto; }

/* forecast for the rest of the shift, beside the Jobs title */
.fc { display: flex; gap: 6px; margin-left: auto; margin-right: 10px; }
.fc-i { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid var(--line); font: 600 12.5px var(--f-ui); color: var(--t2); font-variant-numeric: tabular-nums; }
.fc-i svg { width: 15px; height: 15px; }
.fc-i.now { background: var(--chip); border-color: transparent; color: var(--text); }
@media (max-width: 760px) { .plan-head:has(.fc) { flex-wrap: wrap; } .fc { order: 3; margin: 8px 0 0; width: 100%; overflow-x: auto; } }

/* ============ Night mode, refined: layered blacks, each surface one step up ============
   page #0C0C0B -> app canvas #121211 -> cards #181817 -> chips and inputs #20201F -> selected #2E2E2B */
html[data-theme="dark"] {
  --bg: #0C0C0B;
  --canvas: #121211;
  --surface: #181817;
  --chip: #20201F;
  --chip-2: #252523;
  --hover: #1D1D1C;
  --line: #272725;
  --line-2: #1F1F1E;
  --muted: #2E2E2B;
  --muted-2: #262624;
  --tick: #3B3B37;
  --text: #E6E6E0;
  --t2: #9A9A94;
  --t3: #6A6A64;
  --ink: #D4D4CE;             /* data marks: bars, playhead, progress */
  --on-ink: #121211;
  --fill: #2E2E2B;            /* filled buttons and selected tabs: raised grey, not white */
  --on-fill: #F0F0EA;
  --panel: #1A1A19;           /* cab-display cards (part card, instruments) sit just above the canvas */
  --shadow: 0 1px 0 rgba(255,255,255,.025) inset, 0 10px 28px rgba(0,0,0,.35);
}
/* cards get a hairline instead of a heavy black halo */
html[data-theme="dark"] .card, html[data-theme="dark"] .ptile, html[data-theme="dark"] .panel { border-color: var(--line); }
html[data-theme="dark"] .overview, html[data-theme="dark"] .hud, html[data-theme="dark"] .licence,
html[data-theme="dark"] .sim, html[data-theme="dark"] .sos-card, html[data-theme="dark"] #tooltip,
html[data-theme="dark"] #toast, html[data-theme="dark"] .gantry { background-color: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 12px 28px rgba(0,0,0,.4); }
html[data-theme="dark"] .ptile.now { background: #1F1F1D; border-color: var(--line); }
/* filled buttons and selected states: a soft edge so they read as raised */
html[data-theme="dark"] .btn.dark, html[data-theme="dark"] .opt.active, html[data-theme="dark"] .pill.active,
html[data-theme="dark"] .tag.active, html[data-theme="dark"] .slot.active, html[data-theme="dark"] .stint.active,
html[data-theme="dark"] .chip.ink { box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
html[data-theme="dark"] .btn.outline { background: transparent; border-color: var(--line); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  html[data-theme="dark"] .btn.dark:hover { background: #363632; }
  html[data-theme="dark"] .btn.outline:hover { background: var(--hover); }
}
html[data-theme="dark"] .subtab.active, html[data-theme="dark"] .ctl-speed button.active { background: var(--muted); box-shadow: none; }
/* shift replay: working blocks a quiet mid grey instead of near-white */
html[data-theme="dark"] .replay .seg.work, html[data-theme="dark"] .rp-legend .k-work { background: #4A4A45; }
html[data-theme="dark"] .replay .seg.work em { color: #EDEDE7; }
html[data-theme="dark"] .replay .seg.break, html[data-theme="dark"] .rp-legend .k-lunch { background: #2A2A28; }
html[data-theme="dark"] .replay .seg + .seg { box-shadow: -2px 0 0 var(--surface); }
html[data-theme="dark"] .playhead-time { background: #E6E6E0; color: #121211; }
/* pins and hotspots: no bright white rings on a dark page */
html[data-theme="dark"] .cm-pin.on span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #22C06A; }
html[data-theme="dark"] .ini { background: #2A2A27; }
html[data-theme="dark"] .login-card { border-color: var(--line); box-shadow: 0 30px 70px rgba(0,0,0,.5); }
html[data-theme="dark"] .gate-lamp.ok { background: #0F0F0E; }
html[data-theme="dark"] .gate-start.locked { background: var(--chip); color: var(--t3); }
/* switches at night: off is a dim knob on grey, on is Cat yellow with a dark knob */
html[data-theme="dark"] .switch::after { background: #8E8E88; box-shadow: none; }
html[data-theme="dark"] .switch[aria-checked="true"] { background: var(--y); }
html[data-theme="dark"] .switch[aria-checked="true"]::after { background: #121211; }
/* waiting blocks on the replay: light text on the dark amber stripes */
html[data-theme="dark"] .replay .seg.idle em { color: #FFE2A0; }
/* hotspots: off-white, so they don't glare on the dark bay */
html[data-theme="dark"] .hs-ring { background: #E2E2DC; }

/* page subtitles: one line */
.page-head p { max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head > div { min-width: 0; }
/* emergency SOS card follows the theme: faint red wash into the card colour */
.sos-card-inline { background: linear-gradient(90deg, var(--crit-bg), var(--surface) 60%); border-color: var(--crit-bg); }
html[data-theme="dark"] .sos-card-inline { border-color: rgba(214,29,29,.3); }

/* sign-in backdrop: a row of Cat excavators in black and white, barely there */
.login::before { content: ""; position: fixed; inset: 0; background: url("assets/login-bg.jpg") center / cover no-repeat; opacity: .07; pointer-events: none; }
.login-card { position: relative; z-index: 1; }
html[data-theme="dark"] .login::before { opacity: .1; }
/* sign-in: operator cards and the fleet button turn Cat yellow under the pointer */
@media (hover: hover) and (pointer: fine) {
  .op-card:hover { background: var(--y); border-color: var(--y); color: #0B0B0B; }
  .op-card:hover .op-txt small, .op-card:hover > svg { color: #3A2F00; }
  .op-card:hover .op-lvl { background: rgba(0,0,0,.1); color: #0B0B0B; }
  .mgr-box .btn:hover { background: var(--y); border-color: var(--y); color: #0B0B0B; }
  html[data-theme="dark"] .mgr-box .btn:hover { background: var(--y); color: #0B0B0B; }
}
.op-card, .mgr-box .btn { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out); }
/* backdrop photo 30% stronger */
.login::before { opacity: .091; }
html[data-theme="dark"] .login::before { opacity: .13; }
/* SOS inside its card: the beacon rings stay within the card */
@keyframes beaconIn { 0% { transform: scale(.85); opacity: .8; } 100% { transform: scale(1.3); opacity: 0; } }
.sos-card-inline { overflow: hidden; }
.sos-card-inline .sos-big { margin: 18px; }
.sos-card-inline .sos-big::before, .sos-card-inline .sos-big::after { animation-name: beaconIn; }

/* Home on a phone, lighter: part numbers in a 2x2 grid, seatbelt and pace side by side */
@media (max-width: 760px) {
  .home-below { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .home-below .overview, .home-below .replay { grid-column: 1 / -1; }
  /* part card: title row, four numbers, one link */
  .home-below .overview { padding: 12px 14px; border-radius: 16px; }
  .home-below .ov-id { display: none; }
  .home-below .ov-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-top: 6px; }
  .home-below .ov-row { height: auto; min-height: 0; padding: 6px 0; flex-wrap: wrap; gap: 2px 6px; font-size: 12px; }
  .home-below .ov-row svg { display: none; }
  .home-below .ov-row span { flex: 1 1 100%; color: rgba(255,255,255,.6); }
  .home-below .ov-row b { font: 700 18px/1 var(--f-display); }
  .home-below .ov-bar { display: none; }
  .home-below .ov-cta { height: 36px; margin-top: 6px; font-size: 12.5px; }
  /* instruments: just the reading */
  .home-below .hud { padding: 10px 12px; border-radius: 12px; }
  .home-below .hud-head { font-size: 11.5px; }
  .home-below .hud-head em { display: none; }
  .home-below .belt-main { margin-top: 8px; gap: 8px; }
  .home-below .telltale { width: 36px; height: 36px; border-radius: 8px; }
  .home-below .telltale .ico-belt { width: 24px; height: 24px; }
  .home-below .hud .belt-state { font-size: 20px; }
  .home-below .hud .belt-txt small { font-size: 11px; margin-top: 2px; }
  .home-below .belt-strip, .home-below .hud-foot { display: none; }
  .home-below .hud-read { margin-top: 8px; gap: 6px; }
  .home-below .hud-read b { font-size: 30px; }
  .home-below .hud-read span { font-size: 13px; }
  .home-below .hud-sub { font-size: 11px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .home-below .lap { display: none; }
}

/* ============ Phone top bar: one button style, even spacing ============ */
@media (max-width: 760px) {
  .topbar { gap: 4px; }
  .tb-left { gap: 8px; min-width: 0; }
  .tb-right { gap: 2px; }
  #openNav { margin-left: -6px; }
  .tb-logo { width: 40px; }
  .tb-machine { align-items: center; gap: 6px; }
  .tb-machine b { font-size: 15px; letter-spacing: .02em; }
  /* the three tools read as one set: plain icons, same size, pressed state on tap */
  .tb-drive, #openStatus, .tb-theme { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--text); display: grid; place-items: center; }
  .tb-drive svg, #openStatus svg, .tb-theme svg { width: 20px; height: 20px; }
  .tb-drive:active, #openStatus:active, .tb-theme:active { background: var(--chip); }
  .tb-drive.on { background: var(--y); color: #0B0B0B; }
  html[data-theme="dark"] .tb-theme { color: var(--y); }
  /* SOS: compact pill, no ring pulsing outside the bar */
  #sosBtn { height: 38px; padding: 0 12px; margin-left: 6px; border-radius: 19px; box-shadow: 0 4px 12px rgba(214,29,29,.3); }
  #sosBtn::before { display: none; }
  #sosBtn .sos-content { gap: 6px; }
  #sosBtn .sos-content b { font-size: 15px; }
}
@media (max-width: 380px) {
  .tb-machine { display: flex; }
  .tb-logo { width: 36px; }
  .tb-left { gap: 6px; }
  .tb-drive, #openStatus, .tb-theme { width: 36px; }
  #sosBtn { padding: 0 10px; margin-left: 4px; }
}
@media (max-width: 340px) { .tb-machine { display: none; } }

/* ============ Phone top bar on black (phones only) ============ */
@media (max-width: 760px) {
  .topbar {
    background: #0B0B0A; color: #F2F2EE;
    margin: 0 calc(-1 * max(10px, env(safe-area-inset-right, 0px))) 0 calc(-1 * max(10px, env(safe-area-inset-left, 0px)));
    padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px));
    margin-bottom: 10px;
  }
  .tb-logo { content: url("assets/cat-logo-white.png"); }
  .tb-machine b { color: #F2F2EE; }
  .topbar .icon-btn, .tb-drive, #openStatus, .tb-theme { color: #F2F2EE; }
  .tb-drive:active, #openStatus:active, .tb-theme:active, .topbar .icon-btn:active { background: rgba(255,255,255,.12); }
  .tb-drive.on { background: var(--y); color: #0B0B0B; }
  html[data-theme="dark"] .tb-theme { color: var(--y); }
  #sosBtn { box-shadow: none; }
}

/* ============ Site warning panel: lit cab-display signal instead of a flat block ============ */
.flag-big { position: relative; overflow: hidden; isolation: isolate; --fb: #1C7A45; --ring: rgba(255,255,255,.13); --dot: rgba(255,255,255,.07); --badge: rgba(255,255,255,.14);
  background: radial-gradient(110% 120% at 0% 0%, rgba(255,255,255,.16), rgba(255,255,255,0) 55%), linear-gradient(180deg, var(--fb), color-mix(in srgb, var(--fb) 78%, #000));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 -18px 30px rgba(0,0,0,.12); }
/* radar rings on the right, fading out toward the text */
.flag-big::before { content: ""; position: absolute; z-index: -1; right: -90px; top: 50%; width: 300px; height: 300px; transform: translateY(-50%); border-radius: 50%;
  background: repeating-radial-gradient(circle, var(--ring) 0 1.5px, transparent 1.5px 28px);
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 72%); mask: radial-gradient(circle, #000 35%, transparent 72%); }
/* fine dot grid across the panel */
.flag-big::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(var(--dot) 1px, transparent 1.2px) 0 0 / 14px 14px;
  -webkit-mask: linear-gradient(90deg, transparent 20%, #000 70%); mask: linear-gradient(90deg, transparent 20%, #000 70%); }
.flag-big > svg { width: 68px; height: 68px; padding: 14px; box-sizing: border-box; border-radius: 16px; background: var(--badge); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); flex: none; }
.flag-big > div { position: relative; }
.flag-big.green { --fb: #1C7A45; }
.flag-big.red { --fb: #D61D1D; }
.flag-big.blue { --fb: #1F63C4; }
/* slow down keeps its yellow hazard hatch, with dark rings and badge */
.flag-big.yellow { --ring: rgba(0,0,0,.12); --dot: rgba(0,0,0,.06); --badge: rgba(0,0,0,.1);
  background: radial-gradient(110% 120% at 0% 0%, rgba(255,255,255,.22), rgba(255,255,255,0) 55%), repeating-linear-gradient(-45deg, var(--canary) 0 18px, #D9B800 18px 36px); color: #0B0B0B; }
.flag-big.yellow > svg { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }

/* ============ My tasks tiles: a bit of Cat character ============ */
.ptile { position: relative; overflow: hidden; isolation: isolate; }
.ptile > * { position: relative; }
/* Now: hazard hatch on the right edge, faint Cat logo, job progress along the bottom */
.ptile.now { background: radial-gradient(90% 120% at 0% 0%, rgba(255,255,255,.07), rgba(255,255,255,0) 60%), var(--panel); }
.pt-hatch { position: absolute !important; z-index: -1; top: 0; right: 0; bottom: 0; width: 70px; background: repeating-linear-gradient(-45deg, var(--y) 0 10px, #111 10px 20px); opacity: .9;
  -webkit-mask: linear-gradient(90deg, transparent, #000 60%); mask: linear-gradient(90deg, transparent, #000 60%); }
.pt-mark { position: absolute !important; z-index: -1; right: 84px; top: 50%; width: 120px; transform: translateY(-50%); opacity: .07; pointer-events: none; }
.pt-job { position: absolute !important; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.1); }
.pt-job i { display: block; height: 100%; background: var(--y); }
/* Next: the forecast for its slot as a big faint watermark, and where the job is */
.pt-wx { position: absolute !important; z-index: -1; right: -14px; top: 50%; width: 120px !important; height: 120px !important; transform: translateY(-50%); color: var(--text); opacity: .06; stroke-width: 1.2 !important; }
.pt-chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--chip); font-size: 12px; font-weight: 600; color: var(--t2); margin-top: 2px; }
.pt-chip svg { width: 13px; height: 13px; }
/* Shift left: a faint clock-face ring, hour marks and a now marker on the bar */
.pt-dial { position: absolute !important; z-index: -1; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%;
  background: repeating-conic-gradient(from -1deg, var(--line) 0 2deg, transparent 2deg 30deg); -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%, #000 70%, transparent 71%); mask: radial-gradient(circle, transparent 60%, #000 61%, #000 70%, transparent 71%); opacity: .9; }
.ptile.left .pt-bar { position: relative; overflow: visible; }
.ptile.left .pt-bar em { position: absolute; top: 0; bottom: 0; width: 1.5px; margin-left: -.75px; background: var(--surface); opacity: .8; }
.pt-now { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--text); }
.ptile.left .pt-scale span { font-variant-numeric: tabular-nums; }
.pt-dial { background: radial-gradient(circle, transparent 57%, var(--line) 57.5% 58.5%, transparent 59% 69%, var(--line) 69.5% 70.5%, transparent 71%); -webkit-mask: none; mask: none; opacity: 1; }
/* page tabs: a clearly visible track behind the tabs */
.subtabs { background: #E3E3DE; box-shadow: inset 0 0 0 1px #D8D8D3; }
.subtab:not(.active) { color: #55554F; }
html[data-theme="dark"] .subtabs { background: #1C1C1B; box-shadow: inset 0 0 0 1px var(--line); }
html[data-theme="dark"] .subtab:not(.active) { color: var(--t2); }

/* ============ Report something: a real button on a radar backdrop ============ */
.hold-stage { position: relative; overflow: hidden; isolation: isolate; margin-top: 14px; padding: 26px 16px 18px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: radial-gradient(80% 90% at 50% 38%, rgba(255,205,17,.10), rgba(255,205,17,0) 60%), var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.hold-stage::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 88px; width: 340px; height: 340px; transform: translate(-50%, -50%); border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(0,0,0,.07) 0 1px, transparent 1px 24px); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.hold-stage::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(rgba(0,0,0,.06) 1px, transparent 1.2px) 0 0 / 14px 14px; -webkit-mask: linear-gradient(180deg, #000, transparent 80%); mask: linear-gradient(180deg, #000, transparent 80%); }
html[data-theme="dark"] .hold-stage::before { background: repeating-radial-gradient(circle, rgba(255,255,255,.06) 0 1px, transparent 1px 24px); }
html[data-theme="dark"] .hold-stage::after { background: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.2px) 0 0 / 14px 14px; }
/* the button: yellow bezel that fills while held, dark domed face */
.hold { width: 132px; height: 132px; background: #FFCD11; padding: 0; box-shadow: 0 10px 24px rgba(0,0,0,.18), inset 0 -3px 0 rgba(0,0,0,.15); }
.hold svg { inset: 0; width: 132px; height: 132px; }
.hold circle.bg { stroke: rgba(0,0,0,.18); }
.hold circle.fg { stroke: #0B0B0B; }
.hold-face { position: absolute; inset: 11px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #fff;
  background: radial-gradient(70% 60% at 40% 30%, #3A3A37, #0B0B0A 72%); box-shadow: inset 0 2px 1px rgba(255,255,255,.12), inset 0 -4px 10px rgba(0,0,0,.6), 0 2px 4px rgba(0,0,0,.35); }
.hold-face svg { position: static; width: 22px; height: 22px; transform: none; color: var(--y); }
.hold-face b { font: 700 18px/1 var(--f-display); letter-spacing: .1em; }
.hold-face small { font: 500 10.5px/1 var(--f-ui); color: rgba(255,255,255,.55); letter-spacing: .04em; }
.hold.holding .hold-face { box-shadow: inset 0 3px 8px rgba(0,0,0,.7); }
.hold-hint { font-size: 12px; color: var(--t2); text-align: center; }
/* what goes with the report */
.rep-attach { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.ra-k { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--t2); margin-bottom: 2px; }
.rep-attach > div { display: grid; grid-template-columns: 18px 1fr; column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.rep-attach svg { width: 16px; height: 16px; color: var(--t2); grid-row: span 2; }
.rep-attach span { font-size: 11px; color: var(--t3); }
.rep-attach b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* signal status with its icon in a round badge */
.sync-box { align-items: center; margin-top: 14px; }
.sb-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); flex: none; box-shadow: inset 0 0 0 1px var(--ok-line); }
.sync-box.off .sb-ico { box-shadow: inset 0 0 0 1px rgba(246,121,12,.35); }
.sb-ico svg { width: 18px; height: 18px; }

/* ============ Emergency SOS card: same build as Report something, in red ============ */
.sos-card-inline { display: block; overflow: hidden; }
.sos-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sos-head .btn { flex: none; }
.sos-body { display: grid; grid-template-columns: minmax(220px, 260px) 1fr; gap: 16px; margin-top: 14px; align-items: stretch; }
.sos-stage { position: relative; overflow: hidden; isolation: isolate; padding: 24px 14px 16px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(80% 80% at 50% 40%, rgba(214,29,29,.12), rgba(214,29,29,0) 62%), var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.sos-stage::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 45%; width: 320px; height: 320px; transform: translate(-50%, -50%); border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(214,29,29,.12) 0 1px, transparent 1px 24px); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.sos-stage::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(rgba(0,0,0,.06) 1px, transparent 1.2px) 0 0 / 14px 14px; -webkit-mask: linear-gradient(180deg, #000, transparent 80%); mask: linear-gradient(180deg, #000, transparent 80%); }
html[data-theme="dark"] .sos-stage::after { background: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.2px) 0 0 / 14px 14px; }
/* the button: red bezel that fills white while held, dark red domed face */
.sos-card-inline .sos-big { width: 132px; height: 132px; margin: 0; font-size: 0; background: #D61D1D; box-shadow: 0 10px 26px rgba(214,29,29,.35), inset 0 -3px 0 rgba(0,0,0,.2); }
.sos-card-inline .sos-big svg.ring { inset: 0; width: 132px; height: 132px; }
.sos-card-inline .sos-big circle.bg { stroke: rgba(0,0,0,.22); }
.sos-card-inline .sos-big circle.fg { stroke: #fff; stroke-dasharray: 390; stroke-dashoffset: 390; }
.sos-card-inline .sos-big.holding circle.fg { stroke-dashoffset: 0; }
.sos-face { position: absolute; inset: 11px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #fff;
  background: radial-gradient(70% 60% at 40% 30%, #E23B34, #7E0C0C 75%); box-shadow: inset 0 2px 1px rgba(255,255,255,.2), inset 0 -4px 10px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3); }
.sos-face svg { width: 22px; height: 22px; }
.sos-face b { font: 700 22px/1 var(--f-display); letter-spacing: .1em; }
.sos-face small { font: 500 10.5px/1 var(--f-ui); color: rgba(255,255,255,.7); letter-spacing: .04em; }
.sos-big.holding .sos-face { box-shadow: inset 0 3px 8px rgba(0,0,0,.6); }
/* what SOS does, as tiles */
.sos-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: center; }
.sos-acts > div { display: grid; grid-template-columns: 36px 1fr; column-gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.sa-ico { grid-row: span 2; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--crit-bg); color: var(--crit-ink); }
.sa-ico svg { width: 18px; height: 18px; }
.sos-acts b { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.sos-acts small { font-size: 12px; color: var(--t2); }
@media (max-width: 1100px) { .sos-body { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .sos-head { flex-direction: column; } .sos-head .btn { width: 100%; justify-content: center; } .sos-acts { grid-template-columns: 1fr; } }
.sa-ico { width: 24px; height: auto; background: none; border-radius: 0; }
.sos-acts > div { grid-template-columns: 24px 1fr; }

/* ============ Cab instruments (Seatbelt, Your pace): lit display finish ============ */
.hud { overflow: hidden; isolation: isolate; --glow: rgba(70,192,122,.22); }
.hud > * { position: relative; }
.hud::before { content: ""; position: absolute; z-index: -1; inset: 0;
  background: radial-gradient(120px 90px at 44px 64px, var(--glow), transparent 70%), linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,0) 40%); transition: background 300ms ease; }
.hud::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.2px) 0 0 / 12px 12px;
  -webkit-mask: linear-gradient(90deg, transparent 30%, #000 85%); mask: linear-gradient(90deg, transparent 30%, #000 85%); }
.hud.belt.off, .hud.belt.danger { --glow: rgba(255,59,48,.28); }
.hud.belt.na { --glow: rgba(255,255,255,.05); }
.hud.pace { --glow: rgba(255,178,62,.18); }
.hud.pace.ahead { --glow: rgba(91,214,148,.2); }
.hud .telltale { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 0 0 3px rgba(0,0,0,.25); }
/* SOS: no box behind the button, it sits straight on the card */
.sos-stage { background: none; box-shadow: none; overflow: visible; padding: 8px 0; }
.sos-stage::before, .sos-stage::after { display: none; }

/* ============ Job time: how close were the guesses ============ */
.hc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.hc-score { display: flex; gap: 10px; }
.hc-s { min-width: 150px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.hc-s span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--t2); }
.hc-s b { font: 700 34px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.hc-s small { font-size: 11.5px; color: var(--t3); }
.hc-s.tool { background: var(--y-bg); border-color: rgba(255,205,17,.55); }
.hc-key { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.hc-key.plan { background: #A3A39D; }
.hc-key.tool { background: var(--y); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }

.hc { --lab: 230px; --real: 76px; margin-top: 18px; }
.hc-axis, .hc-scale { display: flex; justify-content: space-between; padding-left: calc(var(--lab) + var(--real) + 32px); font-size: 11.5px; color: var(--t3); }
.hc-axis { margin-bottom: 6px; }
.hc-axis b { color: var(--text); font-size: 12px; }
.hc-scale { margin-top: 6px; font-variant-numeric: tabular-nums; }
.hc-row { display: grid; grid-template-columns: var(--lab) var(--real) 1fr; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.hc-row:first-of-type { border-top: 0; }
.hc-job b { display: block; font-size: 15px; font-weight: 600; }
.hc-job small { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--t2); margin-top: 2px; }
.hc-job small svg { width: 14px; height: 14px; }
.hc-real { text-align: right; }
.hc-real b { display: block; font: 700 26px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.hc-real small { font-size: 11px; color: var(--t3); }
/* track: centre line = real time, faint guides at 8 min either side */
.hc-track { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 4px 0;
  background: linear-gradient(90deg, transparent calc(25% - .5px), var(--line) calc(25% - .5px) calc(25% + .5px), transparent calc(25% + .5px) calc(75% - .5px), var(--line) calc(75% - .5px) calc(75% + .5px), transparent calc(75% + .5px)); }
.hc-track::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); z-index: 1; }
.hc-bar { position: relative; height: 16px; }
.hc-bar i { position: absolute; top: 0; bottom: 0; width: var(--w); border-radius: 4px; transform-origin: right center; animation: hcGrow 700ms var(--ease-out) both; }
.hc-bar.pos i { left: 50%; transform-origin: left center; }
.hc-bar.neg i { right: 50%; }
.hc-bar.plan i { background: #A3A39D; }
.hc-bar.tool i { background: var(--y); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.hc-bar em { position: absolute; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; white-space: nowrap; color: var(--t2); }
.hc-bar.tool em { color: var(--text); font-weight: 600; }
.hc-bar.neg em { right: calc(50% + var(--w) + 8px); }
.hc-bar.pos em { left: calc(50% + var(--w) + 8px); }
@keyframes hcGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
html[data-theme="dark"] .hc-bar.plan i, html[data-theme="dark"] .hc-key.plan { background: #6E6E68; }
html[data-theme="dark"] .hc-s.tool { border-color: rgba(255,205,17,.3); }
@media (prefers-reduced-motion: reduce) { .hc-bar i { animation: none; } }
@media (max-width: 1100px) { .hc { --lab: 170px; } }
@media (max-width: 760px) {
  .hc-score { width: 100%; } .hc-s { flex: 1; min-width: 0; }
  .hc-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .hc-track { grid-column: 1 / -1; }
  .hc-axis, .hc-scale { padding-left: 0; }
}
.hc-s b span { font: inherit; color: inherit; display: inline; }
/* long bars carry their label inside, so it never runs off the card */
.hc-bar.in em { z-index: 1; color: #1A1A19; font-weight: 600; }
.hc-bar.in.neg em { right: calc(50% + 8px); }
.hc-bar.in.pos em { left: calc(50% + 8px); }
.hc-bar.in { height: 20px; }

/* ============ Cat branding: practice strip and the level (licence) card ============ */
.sim { box-shadow: inset 0 2px 0 var(--y); }
.sim-mark { position: absolute; left: 52%; top: 50%; width: 230px; transform: translate(-50%, -50%); opacity: .06; pointer-events: none; }
.sim-hatch { position: absolute; top: 0; right: 0; bottom: 0; width: 64px; background: repeating-linear-gradient(-45deg, var(--y) 0 10px, #111 10px 20px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 70%); mask: linear-gradient(90deg, transparent, #000 70%); opacity: .85; pointer-events: none; }
.sim .content { padding-right: 56px; }
/* licence: an operator ID card */
.licence::after { top: auto; right: 0; left: 0; bottom: 0; width: auto; height: 8px; border: 0; border-radius: 0; background: repeating-linear-gradient(-45deg, var(--y) 0 8px, #111 8px 16px); }
.licence { padding-bottom: 28px; }
.licence > * { position: relative; }
.lic-logo { position: absolute !important; top: 18px; right: 20px; width: 54px; }
.lic-mark { position: absolute !important; right: -30px; bottom: 10px; width: 200px; opacity: .06; pointer-events: none; }
@media (max-width: 760px) { .sim-mark { width: 160px; left: 70%; } .sim .content { padding-right: 40px; } .sim-hatch { width: 44px; } }
/* top bar SOS: no pulsing ring, the red button is enough */
#sosBtn::before { display: none; animation: none; }
/* collapsed menu: the name block takes no room, so the photo sits dead centre */
.app.left-collapsed .user-meta { flex: 0 0 0; min-width: 0; padding: 0; margin: 0; }
/* page tabs hug their tabs, even on pages laid out as a column (Learn > Controls) */
.subtabs { align-self: flex-start; width: max-content; max-width: 100%; }

/* ============ Right now panel: three clear blocks, little text ============ */
.panel.right .rp-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.rp-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); }
.rp-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rp-h h2 { margin: 0; font: 700 16px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.rp-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit-bg); color: var(--crit-ink); font: 700 12px/20px var(--f-ui); text-align: center; }
.rp-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font: 600 12.5px var(--f-ui); color: var(--t2); min-height: 32px; }
.rp-link svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { .rp-link:hover { color: var(--text); } }
/* Now: the job on a dark card, like the cab display */
.rp-now { position: relative; overflow: hidden; background: var(--panel); border-color: var(--panel); color: #F2F2EE; display: flex; flex-direction: column; gap: 4px; }
.rp-now::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 34px; background: repeating-linear-gradient(-45deg, var(--y) 0 7px, #111 7px 14px); -webkit-mask: linear-gradient(90deg, transparent, #000 80%); mask: linear-gradient(90deg, transparent, #000 80%); opacity: .8; }
.rp-now > * { position: relative; z-index: 1; }
.rp-now-k { display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--f-ui); color: var(--y); }
.rp-now-k svg { width: 13px; height: 13px; }
.rp-now-job { font: 700 24px/1.05 var(--f-display); text-transform: uppercase; }
.rp-now-left { font-size: 13px; color: rgba(255,255,255,.7); }
.rp-now-left b { font: 700 20px/1 var(--f-display); color: #FFB23E; }
.rp-now-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); margin: 6px 34px 4px 0; overflow: hidden; }
.rp-now-bar i { display: block; height: 100%; background: var(--y); border-radius: 2px; }
.rp-now-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: rgba(255,255,255,.75); }
.rp-now-facts span { display: inline-flex; align-items: center; gap: 5px; }
.rp-now-facts svg { width: 14px; height: 14px; }
.rp-now-facts .behind { color: #FFB23E; } .rp-now-facts .ahead { color: #5BD694; }
.rp-now .rp-link { margin-left: 0; align-self: flex-start; color: #F2F2EE; }
/* Machine: only what needs attention */
.rp-row { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 13.5px; font-weight: 600; border-top: 1px solid var(--line-2); }
.rp-row:first-of-type { border-top: 0; }
.rp-row svg { width: 17px; height: 17px; color: var(--t2); }
.rp-row em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.rp-row.crit em { background: var(--crit-bg); color: var(--crit-ink); }
.rp-row.warn em { background: var(--warn-bg); color: var(--warn-ink); }
.rp-ok { display: flex; align-items: flex-start; gap: 7px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--t2); }
.rp-ok svg { width: 15px; height: 15px; color: var(--ok-ink); flex: none; margin-top: 1px; }
/* Alerts: one line each */
.rp-alert { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; min-height: 38px; border-top: 1px solid var(--line-2); }
.rp-alert:first-child { border-top: 0; }
.rp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t3); }
.rp-alert.crit .rp-dot { background: var(--crit); }
.rp-alert.warn .rp-dot { background: var(--warn); }
.rp-alert.caution .rp-dot { background: var(--mango); }
.rp-alert b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-alert small { font-size: 11.5px; color: var(--t3); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .app .panel.right .rp-body { display: flex; } }
/* Now card: light, like the other blocks */
.rp-now { background: var(--surface); border-color: var(--line); color: var(--text); }
.rp-now::after { display: none; }
.rp-now-k { color: var(--t2); }
.rp-now-k svg { color: var(--y); fill: var(--y); }
.rp-now-left { color: var(--t2); }
.rp-now-left b { color: var(--mango-ink); }
.rp-now-bar { background: var(--chip); margin-right: 0; }
.rp-now-facts { color: var(--t2); }
.rp-now-facts .behind { color: var(--mango-ink); } .rp-now-facts .ahead { color: var(--ok-ink); }
.rp-now .rp-link { color: var(--text); }
/* Safety rows: same row style as Machine, a tag per state */
.rp-row.ok em { background: var(--ok-bg); color: var(--ok-ink); }
.rp-row.info em { background: var(--chip); color: var(--text); }
.rp-card { flex: none; }

/* ============ Locked while moving: a driving machine, and a fixed button strip ============ */
.drive-lock { background: radial-gradient(90% 70% at 50% 45%, rgba(30,30,28,.55), rgba(8,8,8,.82)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dl-scene { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.dl-svg { width: min(640px, 92vw); height: auto; overflow: visible; }
.dl-ground { animation: dlGround 700ms linear infinite; }
.dl-far { animation: dlFar 14s linear infinite; }
.dl-tread { animation: dlTread 500ms linear infinite; }
.dl-sprocket { transform-box: fill-box; transform-origin: center; animation: dlSpin 900ms linear infinite; }
.dl-body { animation: dlBob 900ms ease-in-out infinite; }
.dl-dust circle { fill: rgba(200,180,140,.18); transform-box: fill-box; transform-origin: center; animation: dlDust 1.2s ease-out infinite; }
.dl-dust circle:nth-child(2) { animation-delay: .4s; } .dl-dust circle:nth-child(3) { animation-delay: .8s; }
@keyframes dlGround { to { transform: translateX(-64px); } }
@keyframes dlFar { to { transform: translateX(-320px); } }
@keyframes dlTread { to { stroke-dashoffset: -28; } }
@keyframes dlSpin { to { transform: rotate(-360deg); } }
@keyframes dlBob { 50% { transform: translateY(-2px); } }
@keyframes dlDust { 0% { transform: translateX(0) scale(.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateX(-60px) scale(1.4); opacity: 0; } }
.dl-msg { text-align: center; color: #fff; }
.dl-msg b { display: block; font: 700 34px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.dl-msg span { font-size: 14px; color: rgba(255,255,255,.65); }
@media (prefers-reduced-motion: reduce) { .dl-ground, .dl-far, .dl-tread, .dl-sprocket, .dl-body, .dl-dust circle { animation: none; } }
/* strip buttons: same height, SOS no longer inherits the top-bar SOS styles */
.dl-strip { align-items: stretch; }
.dl-btn { min-height: 84px; }
.dl-btn.dl-sos { background: radial-gradient(80% 90% at 40% 25%, #E23B34, #A30F0F 80%); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 20px rgba(214,29,29,.35); }
.dl-btn.report { background: linear-gradient(180deg, #34342F, #232321); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
@media (max-width: 760px) { .dl-msg b { font-size: 26px; } .dl-btn { min-height: 72px; } }
.dl-svg { overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); }
.dl-far path { fill: rgba(255,255,255,.035); }

/* Machine: next service on black */
.mh-service { background: var(--panel); border-color: var(--panel); color: #F2F2EE; }
.mh-service .eyebrow { color: rgba(255,255,255,.6); }
.mh-svc-num small { color: rgba(255,255,255,.6); }
.mh-svc-bar > div { background: rgba(255,255,255,.12); }
.mh-svc-bar > span { color: rgba(255,255,255,.5); }
.mh-service .btn.outline { background: transparent; color: #F2F2EE; border-color: rgba(255,255,255,.22); }
@media (hover: hover) and (pointer: fine) { .mh-service .btn.outline:hover { background: rgba(255,255,255,.08); } }
html[data-theme="dark"] .mh-service { border-color: var(--line); }

/* moving lock: the demo way out, impossible to miss */
.dl-top { align-items: flex-start; }
.dl-demo { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dl-demo-tag { font: 700 11px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: #0B0B0B; background: #fff; padding: 4px 8px; border-radius: 6px; }
.dl-top .dl-demo button { height: 48px; padding: 0 18px; border-radius: 12px; background: var(--y); color: #0B0B0B; font: 700 15px var(--f-ui); display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: transform 120ms var(--ease-out); }
.dl-top .dl-demo button svg { width: 20px; height: 20px; }
.dl-top .dl-demo button:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .dl-top .dl-demo button:hover { background: #FFD83D; } }
.dl-demo small { font-size: 12px; color: rgba(255,255,255,.7); }
@media (max-width: 760px) { .dl-demo small { display: none; } .dl-top .dl-demo button { height: 42px; padding: 0 14px; font-size: 14px; } }

/* ================= UX audit fixes (23 Sep 2026) ================= */

/* 1. Contrast: small grey text reaches 4.5:1 on cards in both themes */
:root { --t3: #71716C; }
html[data-theme="dark"] { --t3: #8A8A84; }
.replay .seg.break em { color: #4A4A46; }
html[data-theme="dark"] .replay .seg.break em { color: #B8B8B2; }

/* 2. Tap targets: glove-sized hit areas without changing the look */
.ps-x { width: 40px; height: 40px; }
.ov-close { position: relative; min-height: 32px; padding: 0 4px; }
.ctl-speed button { position: relative; }
.ctl-speed button::before, .ov-close::before, .cv-n::before { content: ""; position: absolute; inset: -6px; }
.cv-n { position: relative; width: 34px; height: 34px; }
.switch { width: 50px; height: 30px; border-radius: 15px; }
.switch::after { width: 24px; height: 24px; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* 3. Home at 761 to 900px wide: the part card's close button no longer lands on the seatbelt card */
@media (min-width: 761px) and (max-width: 900px) {
  .xbtn, .connector { display: none !important; }
  .hud.belt { width: 200px; }
}

/* 4. One quiet motion language: 150ms colour, 120ms press, lifts only with a mouse */
.btn, .tb-drive, .seg-icon, .ov-close, .ps-body, .opt, .check, .slot, .rec, .rep > summary, .cv, .hc-row, .rp-alert, .pp-row, .lesson, .dd-btn, .dd-opt, .subtab, .ctl-now, .ctl-play, .cm-pin span, .cv-main, .rp-link, .linkbtn {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 200ms ease, transform 160ms var(--ease-out), opacity 150ms ease;
}
.btn:active, .tb-drive:active, .seg-icon:active, .opt:active, .check:active, .slot:active, .cv-main:active, .rp-link:active { transform: scale(.97); }
.cm-pin:active span { transform: scale(.92); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(.dark):not(.outline):not(.light):not(.ghost-dark):not(:disabled):hover { background: #FFD83D; box-shadow: 0 6px 16px rgba(255,205,17,.28); }
  .btn.dark:hover { background: #242422; }
  .btn.outline:hover { background: var(--hover); border-color: var(--t3); }
  .tb-drive:not(.on):hover { border-color: var(--t3); color: var(--text); }
  .seg-icon:hover { background: var(--chip); }
  .ov-close:hover { color: #fff; }
  .ps-body:hover { background: rgba(255,255,255,.05); }
  .opt:not(.active):hover { border-color: var(--t3); }
  .check:not(.done):hover { border-color: var(--t3); background: var(--hover); }
  .slot:not(.active):hover { border-color: var(--t3); }
  .rec:hover { background: var(--hover); }
  .rep > summary:hover { background: var(--hover); }
  .hc-row:hover { background: var(--hover); }
  .rp-alert:hover { background: var(--hover); }
  .lesson:hover { transform: translateY(-2px); }
  .ptile:not(.now):hover, .kpi:hover { box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 14px 32px rgba(0,0,0,.08); }
  .rp-link:hover { color: var(--text); }
  .cv-n:hover { background: var(--chip); }
}
.rec, .rep > summary, .hc-row, .rp-alert { border-radius: 10px; }
.rec, .rp-alert { margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; }
html[data-theme="dark"] .btn.dark:hover { background: #363632; }

/* 5. Changing page: the content settles in (cards keep their own staggered rise) */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }
#main > .page, #main > .home { animation: pageIn 240ms var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  #main > .page, #main > .home { animation: none; }
  .lesson:hover { transform: none; }
}


/* ================= Site warning: a machine at work instead of generic rings ================= */
.flag-big::before { right: 18px; top: auto; bottom: 14px; width: 260px; height: 124px; transform: none; border-radius: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 200'%3E %3Cg fill='white'%3E %3Crect x='150' y='148' width='190' height='34' rx='17'/%3E %3Crect x='120' y='96' width='170' height='46' rx='8'/%3E %3Cpath d='M120 104 Q98 108 98 122 Q98 138 120 142 Z'/%3E %3Crect x='238' y='52' width='52' height='48' rx='5'/%3E %3Cpath d='M282 112 L330 36 L346 44 L302 124 Z'/%3E %3Cpath d='M330 36 L392 120 L380 130 L324 52 Z'/%3E %3Cpath d='M376 120 L410 128 L404 166 L380 170 Q364 150 370 128 Z'/%3E %3C/g%3E %3Cg fill='black' fill-opacity='.35'%3E %3Crect x='246' y='60' width='36' height='28' rx='3'/%3E %3Ccircle cx='170' cy='165' r='10'/%3E%3Ccircle cx='205' cy='165' r='8'/%3E%3Ccircle cx='240' cy='165' r='8'/%3E%3Ccircle cx='275' cy='165' r='8'/%3E%3Ccircle cx='318' cy='165' r='10'/%3E %3C/g%3E %3C/svg%3E") right bottom / contain no-repeat; -webkit-mask: none; mask: none; opacity: .16; }
.flag-big.yellow::before { filter: invert(1); opacity: .14; }
/* ground line with site marks under the machine */
.flag-big::after { inset: auto 0 0 0; height: 14px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 18px, transparent 18px 30px) 0 0 / auto 2px no-repeat, linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.14)); -webkit-mask: none; mask: none; }
.flag-big.yellow::after { background: repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 18px, transparent 18px 30px) 0 0 / auto 2px no-repeat; }
/* the icon stands on its own, no frosted square */
.flag-big > svg { width: 52px; height: 52px; padding: 0; background: none; box-shadow: none; border-radius: 0; stroke-width: 1.75; }
.flag-big.yellow > svg { box-shadow: none; }
.flag-big b { font-size: 44px; letter-spacing: .01em; }

/* ================= Home: darker grey service bay for contrast ================= */
.stage {
  background:
    radial-gradient(55% 45% at 58% 22%, rgba(255,255,255,.55), rgba(255,255,255,0) 70%),
    linear-gradient(180deg, #CFCFCA 0%, #D6D6D1 46%, #C6C6C1 47%, #D0D0CB 100%);
}
.stage-vignette { box-shadow: inset 0 0 120px 10px rgba(40,40,36,.18); }
.bay-wall::after { opacity: .7; }

/* ================= Contrast leftovers ================= */
.heat .cell.n { color: #5A5A56; }
html[data-theme="dark"] .heat .cell.n { color: #B8B8B2; }
:root { --t2: #5F5F5B; }

/* collapsed panels: the panel name runs up the bottom of the strip; tap it to open the panel */
.panel-vlabel { display: none; writing-mode: vertical-rl; transform: rotate(180deg); margin: auto auto 14px; padding: 10px 6px; border-radius: 8px;
  font: 600 11px/1 var(--f-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--t3); white-space: nowrap; flex: none;
  transition: color 150ms ease, background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .panel-vlabel:hover { color: var(--text); background: var(--hover); } }
.app.right-collapsed .panel.right .rp-strip { flex: 1; min-height: 0; }
.app.right-collapsed .panel.right .panel-vlabel, .app.left-collapsed .panel.left .panel-vlabel { display: block; }
@media (max-width: 760px) { .panel-vlabel { display: none !important; } }
/* collapsed panels: the expand button sits dead centre, nothing hidden beside it takes space */
.app.left-collapsed .panel.left .panel-title, .app.right-collapsed .panel.right .panel-title, .app.right-collapsed .panel.right .rp-head-extra { display: none; }
.app.left-collapsed .panel.left .panel-head, .app.right-collapsed .panel.right .panel-head { padding: 0; justify-content: center; gap: 0; }

/* "While you wait" never covers the seatbelt card: it takes the left side while it shows */
@media (min-width: 761px) {
}
/* Today's shift: same 24px gap from the bottom of the grey bay as from its sides */
@media (min-width: 761px) {
  .stage .replay { bottom: 24px; }
}
/* While you wait: back on the right, under the seatbelt card (top and max height set from the live layout) */
@media (min-width: 761px) {
  .stage.ps-on .pitstop { left: auto; right: 24px; bottom: auto; width: 300px; transform-origin: 100% 0; overflow-y: auto; }
  /* compact while docked: one line of video text, no footnote */
  .stage.ps-on .ps-note { display: none; }
  .stage.ps-on .ps-thumb { width: 104px; }
  .stage.ps-on .ps-txt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ============ Loader ============ */
.loader {
  position: fixed; inset: 0; z-index: 99999;
  background: #FFCD11;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.loader.hide { opacity: 0; pointer-events: none; transform: scale(1.05); }
.loader .dl-svg { width: 100%; max-width: 640px; }
.login-designer {
  position: absolute;
  font-family: var(--f-ui), sans-serif; font-weight: 500; font-size: 13.5px;
  letter-spacing: 0.05em;
}
.loader-designer {
  font-family: var(--f-ui), sans-serif; font-weight: 500; font-size: 13.5px;
  letter-spacing: 0.05em;
  color: #111; opacity: 0.5;
  margin-top: -10px;
}
.login-designer b, .loader-designer b { font-weight: 800; opacity: 1; }
.login-designer {
  bottom: 24px; left: 24px;
  color: var(--t3); opacity: 0.8;
}
@media (max-width: 760px) {
  .login-designer { left: 50%; transform: translateX(-50%); white-space: nowrap; }
}
