/* Cargo Ops console. Square corners, one type system, colour reserved for state. */
:root {
  --bg: #0a0d11;
  --pane: #0e1217;
  --pane-2: #12171e;
  --head: #151b23;
  --line: #222a35;
  --line-2: #2e3846;
  --ink: #c9d1db;
  --ink-strong: #eef2f6;
  --dim: #7d8896;
  --faint: #566170;
  --accent: #4aa3df;
  --ok: #3fb27f;
  --caution: #d9a441;
  --alarm: #e5534b;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 12px/1.4 var(--sans);
  display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button {
  font: 500 11px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); background: var(--pane-2); border: 1px solid var(--line-2);
  padding: 7px 11px; cursor: pointer; height: 28px;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--ink-strong); }
button:disabled { color: var(--faint); border-color: var(--line); cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #061320; font-weight: 600; }
button.on { border-color: var(--accent); color: var(--accent); }
button.estop { background: #2a0f0e; border-color: var(--alarm); color: #ffb4ae; font-weight: 600; letter-spacing: 0.08em; }
button.estop.on { background: var(--alarm); color: #1a0403; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

.pane-title { font: 600 10.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.pane-meta { font: 400 10.5px/1 var(--mono); color: var(--dim); }
.tag { font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 5px; border: 1px solid var(--line-2); color: var(--dim); }

/* ── Top bar ── */
.bar { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--pane); min-height: 46px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; justify-content: center; padding: 0 16px; border-right: 1px solid var(--line); }
.brand b { font: 600 13px/1.2 var(--sans); letter-spacing: 0.14em; color: var(--ink-strong); }
.brand span { font: 400 10.5px/1.3 var(--sans); color: var(--dim); }
.readouts { display: flex; margin: 0; }
.readouts > div { display: flex; flex-direction: column; justify-content: center; padding: 0 14px; border-right: 1px solid var(--line); min-width: 84px; }
.readouts dt { font: 500 9.5px/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.readouts dd { margin: 2px 0 0; font: 500 13px/1.2 var(--mono); color: var(--ink-strong); white-space: nowrap; }
.readouts dd.ok { color: var(--ok); }
.readouts dd.bad { color: var(--alarm); }
.actions { display: flex; gap: 6px; align-items: center; margin-left: auto; padding: 0 12px; }

/* ── Layout ── */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.pane-head { display: flex; align-items: center; gap: 12px; height: 30px; padding: 0 12px; background: var(--head); border-bottom: 1px solid var(--line); }
.pane-head .pane-meta:last-child, .legend { margin-left: auto; }
.mapwrap { display: flex; flex-direction: column; min-height: 420px; border-right: 1px solid var(--line); min-width: 0; }
.mapbody { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #080b0f; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#map.dragging { cursor: grabbing; }
.seg { display: inline-flex; }
.seg button { height: 22px; padding: 0 9px; font-size: 10px; border-right-width: 0; }
.seg button:last-child { border-right-width: 1px; }
.seg button.on { background: #1b2a38; border-color: var(--accent); color: var(--ink-strong); }
.pane-head button.icon { height: 22px; width: 24px; padding: 0; font: 600 11px/1 var(--mono); }
.map3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bgcam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0; transition: opacity 0.8s ease; filter: grayscale(1) contrast(1.05) brightness(0.85); pointer-events: none; }
.bgcam.on { opacity: 0.2; }
.legend { display: flex; gap: 10px; font: 400 10.5px/1 var(--mono); color: var(--dim); flex-wrap: wrap; justify-content: flex-end; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; vertical-align: -1px; }
.statusline { display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 12px; border-top: 1px solid var(--line); background: var(--pane); font: 400 11px/1 var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; }
#hint { overflow: hidden; text-overflow: ellipsis; }
.statusline .tag.ok { color: var(--ok); border-color: var(--ok); }
.statusline .tag.caution { color: var(--caution); border-color: var(--caution); }
.statusline .tag.alarm { color: var(--alarm); border-color: var(--alarm); }
.los-banner {
  position: absolute; left: 0; right: 0; top: 0; padding: 6px 12px;
  background: rgba(64, 18, 16, 0.92); border-bottom: 1px solid var(--alarm); color: #ffc7c2;
  font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; pointer-events: none;
}

/* Hand tracking inset */
.cam { position: absolute; left: 12px; bottom: 12px; width: 220px; border: 1px solid var(--line-2); background: var(--pane); }
.cam-top { display: flex; justify-content: space-between; height: 24px; align-items: center; padding: 0 8px; background: var(--head); border-bottom: 1px solid var(--line); font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.cam video { display: none; }
.cam canvas { display: block; width: 100%; height: auto; background: #06080b; }
.cam-gesture { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 8px; border-top: 1px solid var(--line); }
.cam-gesture b { font: 600 12px/1 var(--mono); letter-spacing: 0.1em; color: var(--ink-strong); }
.cam-gesture span { font: 400 10px/1 var(--mono); color: var(--dim); }

/* Replay */
.replaybar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: var(--pane); border-top: 1px solid var(--accent); }
.replaybar[hidden] { display: none; }
.replaybar .tag { color: var(--accent); border-color: var(--accent); }
.replaybar input[type=range] { flex: 1; min-width: 60px; accent-color: var(--accent); }
.replaybar span { font: 400 11px/1 var(--mono); }
.replaybar .file { font: 500 10.5px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); cursor: pointer; border: 1px solid var(--line-2); padding: 8px 10px; }
.replaybar .file input { display: none; }

/* First person */
.fpv { position: absolute; inset: 0; background: #000; }
.fpv[hidden] { display: none; }
.fpv canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: ew-resize; touch-action: none; }
.fpv-pad { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(4, auto); gap: 4px; }
.fpv-pad button { background: rgba(14, 18, 23, 0.9); min-width: 40px; }
.fpv-pad button[data-k=grab], .fpv-pad button[data-k=exit] { grid-column: span 2; }
@media (hover: hover) and (pointer: fine) { .fpv-pad button[data-k=left], .fpv-pad button[data-k=right], .fpv-pad button[data-k=fwd], .fpv-pad button[data-k=back] { display: none; } .fpv-pad { grid-template-columns: repeat(2, auto); } }

/* ── Panels and tables ── */
.panels { display: flex; flex-direction: column; min-height: 0; overflow: auto; background: var(--pane); }
.panel { border-bottom: 1px solid var(--line); }
.panel.grow { flex: 1; min-height: 160px; }
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; font: 400 11px/1.3 var(--mono); }
.grid th { text-align: left; font: 500 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--pane); }
.grid td { padding: 5px 8px; border-bottom: 1px solid #181e26; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); vertical-align: top; }
.grid tbody tr:hover td { background: #131920; }
.grid .r { text-align: right; }
.grid .dim { color: var(--dim); }
.grid .sw { display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 0; }
.grid tr.closed td { color: var(--faint); }
.grid tr.late td.st, .grid tr.urgent td.due { color: var(--caution); }
.grid tr.missed td { color: var(--alarm); }
.grid tr.empty td { color: var(--faint); }
.grid.log td { white-space: normal; }
.grid.log td.t { width: 132px; color: var(--dim); white-space: nowrap; }
.st { font-weight: 500; }
.s-sent { color: var(--accent); } .s-acked { color: #8fb8e6; } .s-executing { color: var(--caution); }
.s-done { color: var(--ok); } .s-expired, .s-failed { color: var(--alarm); } .s-queued { color: var(--dim); }
.m-idle { color: var(--dim); } .m-active { color: var(--ink-strong); } .m-hold { color: var(--caution); } .m-estop { color: var(--alarm); } .m-manual { color: var(--accent); }

/* ── Link bar ── */
.linkbar { display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 12px; border-top: 1px solid var(--line); background: var(--pane); }
.timeline { flex: 1; min-width: 160px; }
.timeline canvas { display: block; width: 100%; height: 26px; }
.latency { display: flex; align-items: center; gap: 8px; }
.latency input { accent-color: var(--accent); width: 120px; }
.latency b { font: 500 12px/1 var(--mono); color: var(--ink-strong); min-width: 40px; }
.back { font: 500 10.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.back:hover { color: var(--accent); }

/* ── Handover modal ── */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(5, 7, 10, 0.78); overflow: auto; }
.overlay[hidden] { display: none; }
.modal { width: min(980px, 100%); background: var(--pane); border: 1px solid var(--line-2); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.modal-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 14px; background: var(--head); border-bottom: 1px solid var(--line); }
.modal-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.card { padding: 18px 20px 16px; }
.card h1 { margin: 0 0 8px; font: 600 18px/1.25 var(--sans); color: var(--ink-strong); }
.card p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.kv { width: 100%; border-collapse: collapse; margin: 4px 0 14px; }
.kv th { width: 76px; text-align: left; vertical-align: top; font: 600 9.5px/1.6 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); padding: 6px 0; border-top: 1px solid var(--line); }
.kv td { font-size: 12.5px; line-height: 1.45; padding: 6px 0; border-top: 1px solid var(--line); }
.kv .num { font-family: var(--mono); color: var(--ink-strong); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions button { height: 32px; padding: 0 14px; }
.card .fine { margin: 14px 0 0; font-size: 11px; color: var(--dim); line-height: 1.5; }
.modal-view { position: relative; border-left: 1px solid var(--line); background: #06090d; min-height: 320px; }
.iss3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.view-cap { position: absolute; left: 10px; bottom: 8px; font: 400 10px/1 var(--mono); color: var(--faint); }

@media (max-width: 900px) {
  html, body { height: auto; }
  .layout { display: block; }
  .mapwrap { border-right: 0; min-height: 0; }
  .mapbody { height: max(380px, 96vw); flex: none; }
  .panels { overflow: visible; }
  .readouts { order: 3; width: 100%; border-top: 1px solid var(--line); overflow-x: auto; }
  .readouts > div { padding: 6px 10px; min-width: 0; }
  .actions { order: 2; margin-left: 0; padding: 8px 12px; flex-wrap: wrap; width: 100%; border-top: 1px solid var(--line); }
  .actions button { flex: 1 1 auto; }
  .brand { padding: 8px 12px; border-right: 0; }
  .legend { display: none; }
  .linkbar { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .cam { width: 150px; left: 8px; bottom: 8px; }
  .modal-body { grid-template-columns: minmax(0, 1fr); }
  .modal-view { border-left: 0; border-top: 1px solid var(--line); min-height: 200px; }
}

/* work plan */
.pane-head { white-space: nowrap; }
.pane-head .push { margin-left: auto; }
.pane-head .push + .seg { margin-left: -6px; }
#planPanel .pane-head .pane-meta:last-child { margin-left: 0; }
.grid.plan td.ctl { padding: 2px 6px 2px 0; text-align: right; overflow: visible; }
.grid.plan td.ctl button { height: 20px; min-width: 20px; padding: 0 4px; font: 400 9px/1 var(--mono); margin-left: 1px; }
.grid tr.pick { cursor: pointer; }
.grid tr.pick:hover td { background: #131a22; }
.s-executing { color: var(--accent); }
.plan-bar { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.plan-bar button { height: 26px; padding: 0 10px; font-size: 10.5px; }
.plan-bar #planSend { margin-left: auto; }
.chk { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1 var(--sans); color: var(--ink); cursor: pointer; padding: 0 4px; }
.chk input { accent-color: var(--accent); margin: 0; }

/* training */
.coach { position: absolute; left: 12px; top: 12px; width: 360px; max-width: calc(100% - 24px); z-index: 8; background: rgba(13, 17, 22, 0.97); border: 1px solid var(--line-2); border-left: 2px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.coach-head { display: flex; justify-content: space-between; align-items: center; height: 26px; padding: 0 10px; background: var(--head); border-bottom: 1px solid var(--line); font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.coach-head span:last-child { color: var(--dim); font-family: var(--mono); letter-spacing: 0; }
.coach-prog { display: flex; gap: 2px; padding: 0 10px; margin-top: 8px; }
.coach-prog i { flex: 1; height: 2px; background: var(--line-2); }
.coach-prog i.done { background: var(--accent); }
.coach h2 { margin: 10px 10px 6px; font: 600 14px/1.3 var(--sans); color: var(--ink-strong); }
.coach p { margin: 0 10px 8px; font-size: 12.5px; line-height: 1.5; }
.coach .wait { margin: 0 10px 10px; padding: 6px 8px; border: 1px solid var(--line-2); font: 500 11px/1.3 var(--mono); color: var(--caution); }
.coach .wait.ok { color: var(--ok); border-color: var(--ok); }
.coach-foot { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.coach-foot button { height: 26px; padding: 0 10px; font-size: 10.5px; }
.coach-foot .push { margin-left: auto; }
.coachmark { position: fixed; z-index: 7; pointer-events: none; border: 2px solid var(--accent); box-shadow: 0 0 0 3px rgba(74, 163, 223, 0.18); animation: cm 1.4s ease-in-out infinite; }
@keyframes cm { 50% { box-shadow: 0 0 0 7px rgba(74, 163, 223, 0.08); } }
@media (prefers-reduced-motion: reduce) { .coachmark { animation: none; } }
.help .modal { width: min(720px, 100%); }
.help .card { max-height: calc(100vh - 120px); overflow: auto; }
.help .kv th { width: 120px; }
.help kbd { font: 500 10.5px/1 var(--mono); border: 1px solid var(--line-2); padding: 2px 4px; color: var(--ink-strong); background: var(--pane-2); }
@media (max-width: 900px) {
  .mapwrap > .pane-head { flex-wrap: wrap; height: auto; min-height: 30px; padding: 5px 12px; row-gap: 5px; }
  #mapMeta { display: none; }
  .mapwrap > .pane-head .seg { margin-left: auto; }
  .coach { top: auto; bottom: 8px; left: 8px; width: auto; right: 8px; max-width: none; }
  .coach p { font-size: 12px; }
}

/* checklist, assists, battery */
.ck { display: inline-block; width: 11px; height: 11px; border: 1px solid var(--line-2); margin-right: 5px; vertical-align: -2px; font: 600 9px/9px var(--mono); text-align: center; color: var(--ok); }
.ck.on { border-color: var(--ok); }
.grid tr.now td { background: rgba(74, 163, 223, 0.07); }
.kind { font: 600 9px/1 var(--sans); letter-spacing: 0.06em; color: var(--accent); border: 1px solid #24435a; padding: 1px 3px; margin-right: 2px; }
.s-assist, .m-assist { color: var(--caution); }
.m-charge { color: var(--ok); }
.panel.assist { border-left: 2px solid var(--caution); }
.panel.assist .pane-title { color: var(--caution); }
.panel.assist td.why { white-space: normal; color: var(--ink-strong); }
.panel.assist td.ctl { padding: 3px 6px 3px 0; text-align: right; overflow: visible; }
.panel.assist td.ctl button { height: 22px; padding: 0 6px; font-size: 10px; margin-left: 2px; }
.grid td.bat { position: relative; padding-right: 6px; }
.grid td.bat i { position: absolute; left: 8px; bottom: 5px; height: 2px; max-width: calc(100% - 16px); background: currentColor; }
.grid td.bat span { font-size: 11px; }
.grid td.bat.ok { color: var(--ok); } .grid td.bat.caution { color: var(--caution); } .grid td.bat.alarm { color: var(--alarm); }
.sched { border-top: 1px solid var(--line); padding: 6px 8px 8px; }
.sched-head { display: flex; justify-content: space-between; font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.sched-head .dim { font: 400 9.5px/1 var(--mono); letter-spacing: 0; text-transform: none; }
#sched { display: block; width: 100%; height: 66px; }
.relay { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.relay .seg button { height: 26px; font-size: 10.5px; }
/* orbit widget, bottom left of the map */
.orbit { position: absolute; left: 12px; bottom: 12px; width: 230px; border: 1px solid var(--line-2); background: rgba(13, 17, 22, 0.92); z-index: 3; }
.orbit canvas { display: block; width: 100%; height: 150px; }
.cam { bottom: 190px; z-index: 3; }
@media (max-width: 900px) { .orbit { width: 170px; left: 8px; bottom: 8px; } .orbit canvas { height: 110px; } .cam { bottom: 146px; left: 8px; width: 170px; } }

/* training card: fixed, travels to whatever it is explaining */
.coach { position: fixed; left: 50%; top: 40%; z-index: 70; width: 350px; max-width: calc(100vw - 16px); transition: left 0.45s cubic-bezier(.2,.8,.2,1), top 0.45s cubic-bezier(.2,.8,.2,1); }
.coach::before { content: ''; position: absolute; width: 10px; height: 10px; background: rgba(13, 17, 22, 0.97); border: 1px solid var(--accent); transform: rotate(45deg); display: none; }
.coach[data-side=right]::before { display: block; left: -7px; top: calc(var(--ay, 50%) - 5px); border-right: 0; border-top: 0; }
.coach[data-side=left]::before { display: block; right: -7px; top: calc(var(--ay, 50%) - 5px); border-left: 0; border-bottom: 0; }
.coach[data-side=below]::before { display: block; top: -7px; left: calc(var(--ax, 50%) - 5px); border-right: 0; border-bottom: 0; }
.coach[data-side=above]::before { display: block; bottom: -7px; left: calc(var(--ax, 50%) - 5px); border-left: 0; border-top: 0; }
.coach { border: 1px solid var(--accent); border-left-width: 2px; }
.coachmark { z-index: 65; transition: left 0.45s cubic-bezier(.2,.8,.2,1), top 0.45s cubic-bezier(.2,.8,.2,1), width 0.45s, height 0.45s; box-shadow: 0 0 0 9999px rgba(3, 5, 8, 0.5); animation: none; }
.coachmark.big { box-shadow: 0 0 0 9999px rgba(3, 5, 8, 0.25); }
.coachmark::after { content: ''; position: absolute; inset: -2px; border: 2px solid var(--accent); animation: cm2 1.4s ease-in-out infinite; }
@keyframes cm2 { 50% { inset: -6px; opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .coach, .coachmark { transition: none; } .coachmark::after { animation: none; } }
@media (max-width: 900px) {
  .coach, .coach[data-side=sheet] { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; transition: none; }
  .coach::before { display: none !important; }
  .coachmark { box-shadow: 0 0 0 9999px rgba(3, 5, 8, 0.35); }
}

.coach { background: #0d1116; }
@media (max-width: 900px) {
  .orbit { width: 136px; } .orbit canvas { height: 92px; }
  .orbit .cam-top { font-size: 8.5px; letter-spacing: 0.04em; padding: 0 6px; }
  .cam { bottom: 128px; width: 136px; }
}
@media (max-width: 900px) { .orbit .wide { display: none; } }

/* levels */
.levels { margin: 4px 0 14px; border-top: 1px solid var(--line); }
.levels .stage { display: flex; justify-content: space-between; font: 600 9.5px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); padding: 9px 0 5px; }
.levels .stage span:last-child { color: var(--dim); letter-spacing: 0.04em; }
.levels button.lv { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; height: auto; padding: 7px 8px; margin: 0 0 3px; background: var(--pane-2); text-transform: none; letter-spacing: 0; font: 400 12px/1.35 var(--sans); }
.levels button.lv b { font: 600 11px/1 var(--mono); color: var(--accent); }
.levels button.lv span.n { color: var(--ink-strong); font-weight: 500; }
.levels button.lv span.n em { display: block; font-style: normal; color: var(--dim); font-size: 11px; margin-top: 2px; }
.levels button.lv span.st { font: 500 10px/1 var(--mono); color: var(--dim); white-space: nowrap; }
.levels button.lv span.st.ok { color: var(--ok); }
.levels button.lv.next { border-color: var(--accent); }
/* objective HUD, top centre of the map */
.objective { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); z-index: 4; background: rgba(13, 17, 22, 0.94); border: 1px solid var(--line-2); border-top: 2px solid var(--accent); padding: 7px 10px 8px; pointer-events: auto; }
.objective.done { border-top-color: var(--ok); }
.obj-head { display: flex; justify-content: space-between; font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.obj-head span:last-child { font-family: var(--mono); color: var(--dim); letter-spacing: 0; }
.obj-goal { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--ink-strong); }
.obj-goal b { font: 600 12px/1.2 var(--mono); }
.obj-bar { height: 3px; background: var(--line-2); margin-top: 6px; }
.obj-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s; }
.objective p { margin: 7px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--ink); }
.objective p:empty { display: none; }
.los-banner { z-index: 5; }
@media (max-width: 900px) { .objective { top: 6px; padding: 6px 8px; } .objective p { font-size: 11px; } }

/* teleop bench */
.teleop { position: absolute; inset: 0; z-index: 9; background: #080b10; }
.teleop[hidden] { display: none; }
#tpCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.tp-panel { position: absolute; left: 12px; top: 12px; width: 330px; max-width: calc(100% - 24px); background: rgba(13, 17, 22, 0.95); border: 1px solid var(--line-2); border-left: 2px solid var(--accent); }
.tp-head { display: flex; justify-content: space-between; align-items: center; height: 26px; padding: 0 10px; background: var(--head); border-bottom: 1px solid var(--line); font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.tp-live { color: var(--alarm); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.tp-panel h2 { margin: 9px 10px 4px; font: 600 14px/1.3 var(--sans); color: var(--ink-strong); }
.tp-panel p { margin: 0 10px 8px; font-size: 12px; line-height: 1.45; }
#tpSteps { list-style: none; margin: 0; padding: 0 10px 6px; }
#tpSteps li { display: flex; gap: 8px; padding: 5px 0; font-size: 12px; line-height: 1.4; color: var(--dim); border-top: 1px solid var(--line); }
#tpSteps li .ck { flex: none; width: 16px; height: 16px; border: 1px solid var(--line-2); font: 600 9.5px/14px var(--mono); text-align: center; }
#tpSteps li.now { color: var(--ink-strong); }
#tpSteps li.now .ck { border-color: var(--accent); color: var(--accent); }
#tpSteps li.ok { color: var(--ok); } #tpSteps li.ok .ck { border-color: var(--ok); }
.tp-grip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); font: 600 9.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.tp-grip b { font: 600 11px/1 var(--mono); padding: 3px 6px; border: 1px solid; }
.tp-grip b.g-L { color: var(--caution); } .tp-grip b.g-R { color: var(--accent); }
.tp-grip button { margin-left: auto; height: 24px; padding: 0 8px; font-size: 10px; }
.tp-tip { margin: 0 10px; padding: 7px 8px; border: 1px solid var(--line-2); font: 500 11px/1.4 var(--mono); color: var(--ink); }
.tp-tip.on { color: var(--caution); border-color: #5a4a2a; }
.tp-link { padding: 7px 10px 0; font: 400 10.5px/1.4 var(--mono); color: var(--dim); }
.tp-link b { color: var(--ink-strong); } .tp-link b.bad { color: var(--alarm); }
.tp-actions { padding: 8px 10px 10px; }
.tp-actions button { height: 26px; padding: 0 10px; font-size: 10.5px; }
.tp-flash { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(8, 20, 14, 0.96); border: 1px solid var(--ok); padding: 16px 26px; text-align: center; }
.tp-flash b { display: block; font: 600 16px/1.3 var(--sans); color: var(--ok); letter-spacing: 0.06em; text-transform: uppercase; }
.tp-flash span { display: block; margin-top: 4px; font: 400 12px/1.4 var(--mono); color: var(--ink); }
.tp-flash i { display: block; margin-top: 6px; font-style: normal; font-size: 22px; color: #e0b25a; letter-spacing: 4px; }
.tp-flash i em { font-style: normal; color: #3a4350; }
.panel.assist td.ctl button.tele { border-color: var(--accent); color: var(--accent); }
@media (max-width: 900px) { .tp-panel { left: 6px; right: 6px; top: 6px; width: auto; } .tp-panel p, .tp-link { display: none; } #tpSteps li:not(.now) { display: none; } }
/* autonomy */
#auto td .rate { display: inline-block; vertical-align: middle; width: 64px; height: 6px; background: var(--line-2); margin-right: 6px; }
#auto td .rate i { display: block; height: 100%; background: var(--ok); }
#auto td.why { white-space: normal; }
/* guide callouts */
.guide { position: fixed; z-index: 60; width: 290px; max-width: calc(100vw - 16px); background: #0d1116; border: 1px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); transition: left 0.35s cubic-bezier(.2,.8,.2,1), top 0.35s cubic-bezier(.2,.8,.2,1); }
.guide[hidden] { display: none; }
.guide .g-head { display: flex; justify-content: space-between; height: 22px; align-items: center; padding: 0 9px; background: #10283b; font: 600 9px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.guide p { margin: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink-strong); }
.guide .g-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 0 8px 8px; }
.guide .g-foot button { height: 22px; padding: 0 8px; font-size: 10px; }
.guide::before { content: ''; position: absolute; width: 10px; height: 10px; background: #0d1116; border: 1px solid var(--accent); transform: rotate(45deg); display: none; }
.guide[data-side=below]::before { display: block; top: -6px; left: calc(var(--ax, 50%) - 5px); border-right: 0; border-bottom: 0; background: #10283b; }
.guide[data-side=above]::before { display: block; bottom: -6px; left: calc(var(--ax, 50%) - 5px); border-left: 0; border-top: 0; }
.guide[data-side=right]::before { display: block; left: -6px; top: calc(var(--ay, 50%) - 5px); border-right: 0; border-top: 0; }
.guide[data-side=left]::before { display: block; right: -6px; top: calc(var(--ay, 50%) - 5px); border-left: 0; border-bottom: 0; }
.guide-ring { position: fixed; z-index: 59; pointer-events: none; border: 2px solid var(--accent); animation: gr 1.3s ease-in-out infinite; }
.guide-ring[hidden] { display: none; }
.guide-ring.pt { border-radius: 50% !important; }
@keyframes gr { 50% { box-shadow: 0 0 0 6px rgba(74, 163, 223, 0.25); } }
@media (prefers-reduced-motion: reduce) { .guide { transition: none; } .guide-ring { animation: none; } }
@media (max-width: 900px) { .guide { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: 8px; transition: none; } .guide::before { display: none !important; } }

.card-actions a.btnlink { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font: 500 11px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; }
.panel.assist tr.handoff td { background: rgba(74, 163, 223, 0.06); }

.tp-cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0; pointer-events: none; }
.tp-cam.on { opacity: 0.32; }
.teleop.hands .tp-grip { display: none; }
.tp-mode { display: flex; align-items: center; gap: 8px; padding: 0 10px 8px; font: 400 11px/1.4 var(--mono); color: var(--dim); }
.tp-mode button { margin-left: auto; height: 24px; padding: 0 8px; font-size: 10px; white-space: nowrap; }
.tp-mode button[hidden] { display: none; }
@media (max-width: 900px) {
  .mapbody:has(.teleop:not([hidden])) { height: 82vh; }
  .tp-panel h2 { font-size: 12.5px; margin: 6px 8px 2px; }
  .tp-head { height: 22px; padding: 0 8px; }
  #tpSteps { padding: 0 8px 4px; } #tpSteps li { font-size: 11.5px; padding: 4px 0; }
  .tp-tip:not(.on) { display: none; } .tp-tip { margin: 0 8px; font-size: 10.5px; }
  .tp-mode span { display: none; } .tp-mode { padding: 0 8px 6px; }
  .tp-grip { padding: 5px 8px; } .tp-actions { padding: 6px 8px 8px; }
}

/* orbit view folds to a one-line bar; it opens itself when LOS is near */
.orbit .cam-top { cursor: pointer; user-select: none; }
.orbit .cam-top i { font-style: normal; color: var(--dim); }
.orbit.min canvas { display: none; }
.orbit.min { width: 210px; }
.orbit.min ~ .cam { bottom: 48px; }
@media (max-width: 900px) { .orbit.min { width: 150px; } .orbit.min ~ .cam { bottom: 40px; } }

/* bench v2: hands overlay and the input chooser */
.tp-hands { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.teleop.hands .tp-cam.on { opacity: 0.55; }
.teleop.hands #tpUseHands { display: none; }
.tp-hstate { padding: 0 10px 6px; font: 400 11px/1.4 var(--mono); color: var(--dim); }
.tp-hstate:empty { display: none; }
.tp-hstate b.ok { color: var(--ok); } .tp-hstate b.no { color: var(--caution); }
.tp-prac { display: flex; padding: 0 10px 8px; font-size: 10.5px; color: var(--dim); }
.tp-choose { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 7, 10, 0.55); z-index: 3; }
.tp-choose[hidden] { display: none; }
.tp-choose-card { width: min(420px, calc(100% - 32px)); background: #0d1116; border: 1px solid var(--accent); padding: 16px 18px; }
.tp-choose-card b { display: block; font: 600 15px/1.3 var(--sans); color: var(--ink-strong); margin-bottom: 6px; }
.tp-choose-card p { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; }
.tp-choose-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-choose-actions button { height: 32px; padding: 0 14px; }
.tp-choose-msg { margin: 10px 0 0 !important; font: 400 11px/1.4 var(--mono) !important; color: var(--dim); }
@media (max-width: 900px) { .tp-prac, .tp-hstate { display: none; } }

.start-row { align-items: center; margin: 6px 0 4px; }
.start-row .fine { margin: 0 !important; }

/* right panel: each section's title and column names stay at the top while it scrolls by */
.panels .panel > .pane-head { position: sticky; top: 0; z-index: 3; }
.panels .grid thead th { position: sticky; top: 30px; z-index: 2; }
@media (max-width: 900px) { .panels .panel > .pane-head, .panels .grid thead th { position: static; } }
.fpv.three { background: transparent; }

/* teleop completion: what was logged, and the next button */
.tp-flash { pointer-events: auto; max-width: min(420px, calc(100% - 32px)); z-index: 6; }
.tp-log { margin: 12px 0 2px; padding: 10px 12px; text-align: left; font: 400 12px/1.45 var(--sans); color: var(--ink); background: rgba(63, 178, 127, 0.1); border-left: 2px solid var(--ok); }
.tp-log strong { display: block; margin-bottom: 2px; font: 700 10.5px/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ok); }
.tp-log small { display: block; margin-top: 4px; font: 400 10.5px/1.4 var(--mono); color: var(--dim); }
.tp-flash .tp-next { margin-top: 12px; }
.tp-flash .tp-next em { font-style: normal; opacity: 0.7; }
/* "next" marker on the button to press, in the first levels */
.next-act { box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(74, 163, 223, 0.6) !important; animation: nextPulse 1.4s ease-in-out infinite; }
@keyframes nextPulse { 0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 6px rgba(74, 163, 223, 0.3); } 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 20px rgba(74, 163, 223, 0.75); } }
.next-pill { position: fixed; z-index: 80; padding: 3px 7px; font: 700 9.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: #0b0f14; background: var(--accent); border-radius: 3px; pointer-events: none; transform: translate(-100%, -50%); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.next-pill[hidden] { display: none; }
/* the Autonomy panel when a demonstration has just been logged */
#autoPanel { position: relative; }
#autoPanel.logged { animation: loggedFlash 2.6s ease-out 1; }
@keyframes loggedFlash { 0% { background: rgba(63, 178, 127, 0.28); } 100% { background: transparent; } }
.logged-badge { position: absolute; right: 10px; top: 36px; z-index: 4; padding: 5px 9px; font: 700 10px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #06130d; background: var(--ok); border-radius: 3px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); animation: loggedBadge 4.5s ease-out forwards; pointer-events: none; }
@keyframes loggedBadge { 0% { opacity: 0; transform: translateY(6px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .next-act, #autoPanel.logged, .logged-badge { animation: none !important; } }
.ok-tick { color: var(--ok); font-weight: 700; }
.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-actions #tpFinish[hidden] { display: none; }

/* small laptops: no wrapping legend in the map header, a bench panel that scrolls, a tighter objective */
@media (max-width: 1400px) and (min-width: 901px) { .legend { display: none; } }
.tp-panel { max-height: calc(100% - 24px); overflow-y: auto; scrollbar-width: thin; }
@media (max-height: 760px) and (min-width: 901px) {
  .tp-panel { padding-top: 8px; padding-bottom: 8px; }
  .tp-panel p { font-size: 12px; line-height: 1.4; }
  .objective { width: min(380px, calc(100% - 24px)); }
  .objective p { font-size: 11.5px; }
}
@media (max-width: 1100px) and (min-width: 901px) { .objective { width: min(340px, calc(100% - 24px)); } }
.tp-finish { animation: nextPulse 1.4s ease-in-out infinite; box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 1100px) and (min-width: 901px) { .tp-panel { width: 280px; } }
