:root {
  color-scheme: dark;
  --brand-accent: #8641A9;
  --preview-cyan: #46d1d8;
  --connection-green: #55d49f;
  --safety-orange: #e1a64a;
  --warning: #e1a64a;
  --danger: #e33d34;
  --preview: #46d1d8;
  --ink: #f3f5f4;
  --muted: #94a0a3;
  --line: #3b474a;
  --panel: rgba(27, 35, 38, .93);
  --panel-solid: #1b2326;
  --field: #151d1f;
  --shadow: 0 18px 50px rgba(0, 0, 0, .38);
  font-family: "Bahnschrift", "DIN Alternate", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: #0f1416; color: var(--ink); }
body { overflow: hidden; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; font-weight: 800; transition: border-color 150ms ease, background 150ms ease, transform 150ms ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .42; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: 22px; letter-spacing: -.03em; }
h2 { margin-bottom: 12px; font-size: 18px; }
.shell { width: 100%; min-height: 100vh; background: #111719; }
.topbar { position: relative; z-index: 50; display: flex; align-items: center; height: 60px; padding: 0 20px; border-bottom: 1px solid #343e41; background: #171e20; }
.topbar::after { position: absolute; bottom: -1px; left: 0; width: 210px; height: 2px; background: var(--brand-accent); content: ""; }
.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-copy { display: block; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 14px; letter-spacing: .06em; }
.brand-copy small { margin-top: 2px; color: #748084; font-size: 8px; letter-spacing: .12em; }
.tabs { align-self: stretch; display: flex; margin-left: 42px; }
.tab { padding: 0 18px; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #879396; font-size: 12px; }
.tab.active { border-bottom-color: var(--brand-accent); background: #20282b; color: #fff; }
.tab small { padding: 2px 5px; border: 1px solid #475255; border-radius: 2px; color: #778286; font-size: 8px; }
.trajectory-tab { display: flex; align-items: center; gap: 7px; }
.top-state { display: flex; align-items: center; gap: 8px; margin-left: auto; color: #a6b0b2; font-size: 10px; }
.connection-light { width: 7px; height: 7px; border-radius: 50%; background: var(--connection-green); box-shadow: 0 0 0 4px rgba(85, 212, 159, .1); }
.version-badge { color: #748084; }
.tab-view { display: none; }
.tab-view.active { animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
.digital-twin-workspace { position: relative; grid-template-columns: 300px minmax(0, 1fr) 360px; height: calc(100vh - 60px); min-height: 0; overflow: hidden; }
.digital-twin-workspace.active { display: grid; }
.left-rail, .right-rail { position: relative; z-index: 10; min-height: 0; padding: 14px; pointer-events: none; }
.left-rail > *, .right-rail > * { pointer-events: auto; }
.left-rail { grid-column: 1; grid-row: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #465154 transparent; }
.right-rail { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: 10px; padding-top: 104px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #465154 transparent; }
.panel { margin-bottom: 14px; padding: 16px; border: 1px solid rgba(75, 88, 92, .82); border-radius: 5px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.left-rail .panel, .right-rail .panel { margin: 0; }
.panel-heading { padding-bottom: 10px; border-bottom: 1px solid #394447; }
.section-kicker { margin-bottom: 6px; color: var(--safety-orange); font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.status-card, .angle-card { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #202a2d; }
.status-card span, .angle-card span, label { color: var(--muted); font-size: 10px; }
.status-card strong { color: var(--connection-green); font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.button-row button, .scene-tool-row button { min-height: 34px; padding: 8px 11px; border-radius: 3px; font-size: 10px; }
.connection-actions button { flex: 1 1 calc(50% - 4px); }
.primary { background: #293438; color: #fff; box-shadow: inset 0 0 0 1px #526064; }
.ghost { background: #242e31; color: #dce1df; box-shadow: inset 0 0 0 1px #465256; }
.start { flex: 1; background: #256f55; color: white; }
.stop { background: #5c2926; color: #fff; }
.emergency-dock { position: fixed; top: 74px; right: 14px; z-index: 80; display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 10px; align-items: center; width: 332px; min-height: 76px; padding: 10px; border: 1px solid rgba(240, 106, 98, .72); border-radius: 5px; background: rgba(42, 25, 25, .97); box-shadow: 0 16px 38px rgba(0, 0, 0, .48), 0 0 0 2px rgba(227, 61, 52, .1); }
.emergency-copy { min-width: 0; }
.emergency-copy > span { display: block; color: #ff948d; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.emergency-copy > strong { display: block; margin-top: 2px; overflow: hidden; color: #fff; font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.emergency-copy .operation-status { display: -webkit-box; margin: 4px 0 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.emergency-stop { width: 100%; min-height: 52px; border: 1px solid #ff8881; border-radius: 3px; background: var(--danger); color: #fff; font-size: 14px; letter-spacing: .08em; box-shadow: 0 0 0 4px rgba(227, 61, 52, .12); }
label { display: grid; gap: 6px; margin-top: 11px; font-weight: 800; }
input, select { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid #4a575a; border-radius: 3px; outline: none; background: var(--field); color: #f3f5f4; font-size: 11px; }
input:focus, select:focus { border-color: var(--preview-cyan); }
label small { color: #707d80; font-size: 8px; font-weight: 500; line-height: 1.45; }
.follower-target-field { margin-top: 11px; }
.virtual-follower-notice { margin: 7px 0 0; padding: 8px 10px; border-left: 2px solid var(--preview-cyan); background: rgba(23, 76, 80, .42); color: #aaf9fb; font-size: 9px; line-height: 1.45; }
.virtual-follower-notice[hidden] { display: none; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.debug-panel { margin-top: 13px; padding-top: 11px; border-top: 1px solid #344043; }
.debug-panel summary { cursor: pointer; color: #dce1df; font-size: 10px; font-weight: 800; }
.debug-panel pre { min-height: 100px; max-height: 190px; }
.warning-note { margin: 12px 0 0; padding: 10px; border: 1px solid #7d5d2b; border-radius: 3px; background: rgba(100, 68, 21, .28); color: #efbd70; font-size: 10px; line-height: 1.5; }
.scene-stage { position: relative; grid-column: 1 / -1; grid-row: 1; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(circle at 52% 42%, #354246 0, #232d30 25%, #171e20 57%, #101618 84%); }
.scene-stage::before { position: absolute; inset: 0; opacity: .6; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 38px 38px; content: ""; }
.scene-title { position: absolute; z-index: 4; top: 20px; left: 330px; }
.scene-title h2 { margin: 0; font-size: 16px; }
.model-load-status { display: block; margin-top: 5px; color: var(--safety-orange); font-size: 9px; }
.model-load-status[data-state="ready"] { color: var(--connection-green); }
.model-load-status[data-state="error"] { color: var(--danger); }
.robot-scene-controls { position: absolute; z-index: 5; top: 18px; right: 390px; display: flex; align-items: end; gap: 8px; }
.displayed-model { display: grid; min-width: 170px; min-height: 34px; align-content: center; gap: 3px; padding: 5px 8px; border-left: 2px solid var(--preview-cyan); background: rgba(18, 25, 27, .82); }
.displayed-model span { color: var(--muted); font-size: 8px; }
.displayed-model strong { color: #e1e5e4; font-size: 10px; white-space: nowrap; }
#modelPermission { max-width: 180px; color: var(--safety-orange); font-size: 9px; }
.pose-source { display: flex; align-items: center; gap: 8px; margin: 0; padding: 5px 8px; border: 1px solid #465154; border-radius: 3px; }
.pose-source legend { color: var(--muted); font-size: 8px; }
.pose-source label { display: flex; align-items: center; gap: 4px; margin: 0; white-space: nowrap; }
.pose-source input { width: auto; }
.robot-viewport, #robotCanvas { width: 100%; height: 100%; min-height: 0; }
.robot-viewport { position: absolute; inset: 0; }
#robotCanvas { display: block; touch-action: none; }
.scene-tool-row { position: absolute; z-index: 6; right: 390px; bottom: 18px; display: flex; gap: 5px; }
.scene-legend { position: absolute; z-index: 6; left: 330px; bottom: 20px; display: flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #3c484b; border-radius: 3px; background: rgba(15, 21, 23, .78); color: #b9c2c4; font-size: 9px; }
.actual-swatch, .preview-swatch { width: 8px; height: 8px; border-radius: 50%; background: #d8dde5; }
.preview-swatch { margin-left: 6px; background: var(--preview-cyan); }
.scene-hud { position: absolute; z-index: 6; left: 330px; bottom: 60px; display: flex; gap: 5px; }
.scene-hud > div { min-width: 105px; padding: 8px 10px; border-left: 2px solid #596568; background: rgba(18, 25, 27, .78); }
.scene-hud span, .scene-hud strong { display: block; }
.scene-hud span { color: #7d898c; font-size: 7px; letter-spacing: .12em; }
.scene-hud strong { margin-top: 4px; color: #e1e5e4; font: 9px/1.25 monospace; }
.scene-hud > div:first-child { border-color: var(--preview-cyan); }
.scene-hud > div:nth-child(2) { border-color: var(--connection-green); }
.model-load-error { position: absolute; z-index: 10; right: 390px; bottom: 70px; left: 330px; padding: 12px; border: 1px solid var(--danger); border-radius: 3px; background: rgba(91, 25, 22, .94); color: #ffd7d4; }
.joint-panel { flex: 0 0 auto; }
.target-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: 0 0 auto; padding: 3px; border: 1px solid #465154; border-radius: 4px; background: #0c1112; }
.target-mode-button { min-height: 36px; border-radius: 3px; background: transparent; color: #8f9b9e; font-size: 10px; }
.target-mode-button.is-active { background: #174c50; color: #c9fbfd; box-shadow: inset 0 0 0 1px #3aa9af; }
.target-mode-view[hidden] { display: none; }
.target-mode-view > .panel { margin: 0; }
.shared-target-confirmation { flex: 0 0 auto; border-color: rgba(70, 209, 216, .35); }
.shared-target-heading { display: flex; justify-content: space-between; gap: 10px; }
#targetSourceLabel { color: var(--preview-cyan); font-size: 9px; text-align: right; }
.target-duration-field { margin-top: 8px; }
.target-duration-field input { max-width: 130px; }
.joint-slider-panel { flex: 0 0 auto; border-color: rgba(70, 209, 216, .28); }
.joint-slider-panel .section-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.manual-control-mode { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; margin: 8px 0; padding: 7px; border: 1px solid #3b484b; background: #182124; }
.manual-control-mode > div { display: grid; gap: 2px; }
.manual-control-mode span { color: var(--muted); font-size: 7px; }
.manual-control-mode strong { color: var(--connection-green); font-size: 9px; }
.manual-control-mode button { min-height: 28px; padding: 0 8px; font-size: 8px; }
#jointSliderPermission { max-width: 125px; color: var(--safety-orange); font-size: 8px; text-align: right; }
#jointSliderPermission[data-can-command="true"] { color: var(--connection-green); }
.joint-sliders { display: grid; gap: 6px; }
.joint-sliders label { gap: 4px; margin: 0; padding: 6px 8px; border: 1px solid #344043; border-radius: 3px; background: rgba(21, 29, 31, .72); }
.joint-sliders label > span { display: grid; grid-template-columns: minmax(62px, 1fr) auto auto; align-items: center; gap: 10px; color: #c8d1d3; font-size: 9px; }
.joint-sliders label > span b { color: #eef3f2; font-size: 10px; }
.joint-sliders label > span small { color: #7f8c8f; font-size: 8px; font-weight: 700; white-space: nowrap; }
.joint-sliders label > span small output { margin-left: 3px; color: #dce1df; font: 9px monospace; }
.joint-sliders output { color: var(--preview-cyan); font: 10px monospace; }
.joint-sliders label > span small:last-child output { color: var(--preview-cyan); }
.joint-sliders input[type="range"] { height: 16px; padding: 0; border: 0; accent-color: var(--preview-cyan); background: transparent; }
.joint-sliders input[type="range"]:disabled { opacity: .35; }
.joint-target-editor { display: grid; grid-template-columns: minmax(0, 1fr) 58px 8px; gap: 5px; align-items: center; }
.joint-target-editor input[type="number"] { width: 58px; min-width: 0; padding: 4px 5px; font: 9px monospace; text-align: right; }
.joint-target-editor > span { color: var(--muted); font-size: 9px; }
.joint-target-editor input:disabled { opacity: .42; }
.angles { display: grid; grid-template-columns: 1fr; gap: 5px; }
.angle-card { grid-template-columns: 1fr auto; align-items: center; padding: 7px 9px; }
.angle-card strong { color: var(--preview-cyan); font: 12px monospace; }
.target-control-panel { border-color: rgba(70, 209, 216, .35); }
.target-control-heading { display: flex; justify-content: space-between; gap: 10px; }
#targetPermission { max-width: 150px; color: var(--safety-orange); font-size: 8px; text-align: right; }
#targetPermission[data-can-command="true"] { color: var(--connection-green); }
.target-input-note, .target-conflict-note, .operation-status { color: var(--muted); font-size: 9px; line-height: 1.5; }
.target-input-note { margin: 8px 0; }
.target-conflict-note { margin: 8px 0 0; color: var(--safety-orange); }
.tcp-input-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tcp-input-grid label { margin-top: 0; font-size: 8px; }
.preview-target { background: #174c50; color: #aaf9fb; }
.confirm-target { background: var(--danger); color: #fff; }
.target-state { margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: rgba(23, 31, 33, .85); }
.target-state > div:first-child { display: flex; gap: 8px; }
.target-state > div:first-child p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.target-state-mark { width: 8px; height: 8px; margin-top: 3px; flex: 0 0 auto; border-radius: 50%; background: #667275; }
.target-state.is-ready { border-color: var(--preview-cyan); background: rgba(19, 66, 70, .5); }
.target-state.is-ready .target-state-mark { background: var(--preview); box-shadow: 0 0 0 4px rgba(70, 209, 216, .12); }
.target-state.is-error { border-color: var(--danger); }
.target-state.is-sent { border-color: var(--connection-green); }
.target-state.is-stopped { border-color: var(--safety-orange); }
.target-result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin: 8px 0 0; }
.target-result-grid > div, .target-angle-result { padding: 6px; border: 1px solid #364144; background: #182124; }
.target-result-grid dt, .target-angle-result span { color: var(--muted); font-size: 7px; }
.target-result-grid dd { margin: 3px 0 0; font: 9px monospace; }
.target-angle-result { display: grid; gap: 3px; margin-top: 5px; }
.target-angle-result strong { color: var(--preview-cyan); font: 8px/1.4 monospace; }
.target-calibration { margin: 6px 0 0; color: var(--safety-orange); font-size: 8px; }
.safety-dock { border-color: rgba(225, 166, 74, .5); }
.safety-dock > strong { font-size: 11px; }
.safety-dock .operation-status { margin: 6px 0 9px; }
.operation-status.is-error { color: #ff8f88; font-weight: 800; }
.operation-status.is-stopped { color: var(--safety-orange); font-weight: 800; }
.maintenance-view.active { display: block; height: calc(100vh - 60px); padding: 24px max(24px, calc((100% - 1240px) / 2)); overflow-y: auto; background: radial-gradient(circle at 10% 0, #263033, transparent 34%), #111719; }
.trajectory-workspace { grid-template-columns: 280px minmax(480px, 1fr) 320px; gap: 12px; height: calc(100vh - 60px); padding: 12px; overflow: hidden; background: #111719; }
.trajectory-workspace.active { display: grid; }
.trajectory-workspace .panel { margin: 0; min-width: 0; }
.trajectory-left-column { display: grid; grid-template-rows: minmax(0, 1fr) minmax(180px, .55fr); gap: 12px; min-width: 0; min-height: 0; }
.trajectory-device-host, .trajectory-scene-host { min-width: 0; min-height: 0; }
.trajectory-device-host { overflow-y: auto; }
.trajectory-device-host .device-region { width: 100%; min-height: 0; }
.trajectory-device-host .controls { height: auto; }
.trajectory-library, .trajectory-inspector { overflow-y: auto; }
.trajectory-editor { display: grid; grid-template-rows: auto minmax(320px, 1fr) minmax(150px, .42fr) minmax(170px, .5fr); gap: 12px; min-width: 0; min-height: 0; }
.trajectory-scene-host #robotScenePanel { width: 100%; height: 100%; min-height: 320px; }
.trajectory-model-notice { position: absolute; z-index: 4; top: 70px; left: 18px; padding: 6px 9px; border: 1px solid #2f7478; background: rgba(13, 19, 21, .88); color: #aaf9fb; font-size: 9px; }
.trajectory-scene-host { position: relative; }
.trajectory-scene-host .pose-source { display: none; }
.trajectory-scene-host .robot-viewport { min-height: 210px; }
.trajectory-scene-host .scene-title,
.trajectory-scene-host .scene-legend,
.trajectory-scene-host .scene-hud { left: 18px; }
.trajectory-scene-host .robot-scene-controls,
.trajectory-scene-host .scene-tool-row { right: 18px; }
.trajectory-scene-host .model-load-error { right: 18px; left: 18px; }
.section-heading, .trajectory-toolbar, .trajectory-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h1, .section-heading h2, .trajectory-toolbar h2 { margin: 0; }
.trajectory-list, .trajectory-segment-list { display: grid; gap: 7px; margin-top: 12px; }
.trajectory-list button, .trajectory-segment-card { width: 100%; padding: 10px; border: 1px solid #3b474a; border-radius: 3px; background: #202a2d; color: #dfe5e3; text-align: left; }
.trajectory-list button.is-active { border-color: var(--preview-cyan); background: #174c50; }
.trajectory-list button strong, .trajectory-list button small { display: block; }
.trajectory-list button small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.trajectory-import { display: grid; place-items: center; flex: 1; min-height: 34px; margin: 0; border: 1px solid #465256; border-radius: 3px; background: #242e31; color: #dce1df; cursor: pointer; }
.trajectory-import input { display: none; }
.trajectory-toolbar { padding: 13px 16px; }
.trajectory-toolbar-actions { display: flex; gap: 7px; }
.trajectory-toolbar-actions button { min-height: 34px; padding: 8px 12px; border-radius: 3px; }
.trajectory-stage { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.trajectory-stage-head > div { display: grid; gap: 4px; }
.trajectory-stage-head span, #trajectorySummary { color: var(--muted); font-size: 9px; }
.trajectory-stage-head strong { color: var(--preview-cyan); font: 10px monospace; }
.trajectory-timeline { position: relative; display: grid; gap: 3px; min-height: 150px; margin-top: 14px; padding: 26px 8px 8px; overflow: auto; border: 1px solid #344043; background: #0d1315; }
.trajectory-timeline::before { position: absolute; top: 13px; right: 8px; left: 8px; height: 1px; background: #465154; content: ""; }
.trajectory-timeline p { margin: auto; color: var(--muted); font-size: 10px; }
.trajectory-track { display: grid; grid-template-columns: 92px minmax(420px, 1fr); min-height: 32px; border-bottom: 1px solid #263034; }
.trajectory-track > strong { display: flex; align-items: center; padding: 0 8px; border-right: 1px solid #344043; color: #aeb9bb; font-size: 9px; }
.trajectory-track-clips { display: flex; align-items: stretch; gap: 3px; min-width: 420px; }
.trajectory-clip { display: grid; min-width: 110px; padding: 9px; border-left: 3px solid var(--preview-cyan); background: #183b3e; align-content: center; }
.trajectory-clip-gripper { border-left-color: var(--safety-orange); background: #342918; }
.trajectory-clip-tcp { border-left-color: #71d49c; background: #18372d; }
.trajectory-clip-event { border-left-color: #b7a5ee; background: #2c2840; }
.trajectory-clip strong, .trajectory-clip small { display: block; }
.trajectory-clip small { margin-top: 5px; color: #91a9aa; font-size: 8px; }
.trajectory-segments { overflow-y: auto; }
.trajectory-segment-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.trajectory-segment-card strong, .trajectory-segment-card small { display: block; }
.trajectory-segment-card small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.trajectory-segment-card button { padding: 6px 9px; border-radius: 3px; background: #4a2826; color: #ffc0bc; }
.trajectory-check { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid #3b474a; background: #182124; }
.trajectory-check input { width: auto; }
.trajectory-operation-host { margin: 12px 0; }
.trajectory-operation { padding: 11px; border: 1px solid #3b474a; background: #141c1e; }
.trajectory-operation[hidden] { display: none; }
.trajectory-operation-heading { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.trajectory-operation-heading span { color: var(--preview-cyan); font-size: 8px; }
.trajectory-joint-editors { display: grid; gap: 6px; }
.trajectory-joint-editors label { display: grid; grid-template-columns: 54px minmax(0, 1fr) 48px; align-items: center; gap: 7px; }
.trajectory-joint-editors input { width: 100%; padding: 0; }
.trajectory-joint-editors output { color: #aaf9fb; font: 9px monospace; text-align: right; }
.trajectory-tcp-editors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.trajectory-tcp-editors label { display: grid; gap: 4px; }
.trajectory-tcp-editors input { min-width: 0; }
.trajectory-operation > button { width: 100%; margin-top: 9px; }
.trajectory-status { margin-top: 12px; padding: 11px; border: 1px solid #3b474a; background: #182124; }
.trajectory-status p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.trajectory-status[data-state="recording"] { border-color: var(--danger); background: #3c201e; }
.trajectory-status[data-state="ready"], .trajectory-status[data-state="completed"] { border-color: var(--connection-green); background: #18372d; }
.trajectory-status[data-state="error"] { border-color: var(--danger); }
.trajectory-execution { margin-top: 18px; padding-top: 16px; border-top: 1px solid #3b474a; }
.trajectory-execution > p:not(.section-kicker) { color: var(--safety-orange); font-size: 9px; line-height: 1.55; }
.trajectory-execution button { width: 100%; min-height: 38px; border-radius: 3px; }
@media (max-width: 1100px) { .trajectory-workspace { grid-template-columns: 240px minmax(360px, 1fr); overflow-y: auto; } .trajectory-inspector { grid-column: 1 / -1; } }
@media (max-width: 760px) { .trajectory-workspace.active { display: block; height: auto; overflow: visible; } .trajectory-workspace > * { margin-bottom: 12px; } .trajectory-left-column, .trajectory-editor { display: grid; grid-template-rows: auto; } .trajectory-device-host, .trajectory-scene-host { min-height: 420px; } }
.maintenance-view .panel { margin-bottom: 16px; padding: 22px; }
.reset-panel { border: 2px solid rgba(225, 166, 74, .42); }
.reset-header { display: grid; grid-template-columns: 1fr 290px; gap: 22px; }
.reset-header p, .reset-step span { color: var(--muted); line-height: 1.6; }
.danger-card { display: grid; gap: 8px; padding: 16px; border: 1px solid #8d642b; border-radius: 4px; background: rgba(91, 59, 18, .28); color: #f1bd69; }
.reset-steps, .reset-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.reset-step { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: #202a2d; }
.reset-step b { color: var(--safety-orange); }
.reset-actions { padding-top: 16px; border-top: 1px solid var(--line); }
.origin { min-width: 180px; background: var(--warning); color: #17120a; }
.factory-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.factory-progress-panel { position: sticky; top: 96px; padding: 16px; border: 1px solid #4b585c; border-radius: 4px; background: #182124; }
.factory-progress-heading { display: flex; justify-content: space-between; gap: 10px; }
.factory-progress-heading h3 { margin: 0; }
.factory-progress-heading > span { color: var(--muted); font-size: 10px; }
.factory-progress-list { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.factory-progress-step { display: grid; grid-template-columns: 28px 1fr 22px; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 3px; background: #202a2d; }
.factory-progress-step strong { display: block; font-size: 11px; }
.factory-progress-step small { color: var(--muted); font-size: 8px; }
.factory-step-number, .factory-step-state { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #354043; }
.factory-progress-step.is-active { border-color: var(--safety-orange); background: #3a2d19; transform: translateX(3px); }
.factory-progress-step.is-active .factory-step-state { border: 3px solid #725422; border-top-color: var(--safety-orange); animation: factory-progress-spin 800ms linear infinite; }
.factory-progress-step.is-complete { border-color: var(--connection-green); background: #18372d; }
.factory-progress-step.is-failed { border-color: var(--danger); background: #3c201e; }
@keyframes factory-progress-spin { to { transform: rotate(360deg); } }
.factory-manual-power-notice { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; margin-top: 10px; padding: 12px; border: 1px solid #8d642b; border-radius: 4px; background: #342918; color: #f1bd69; }
.factory-manual-power-notice[hidden] { display: none; }
.factory-manual-power-notice strong { display: block; font-size: 11px; line-height: 1.45; }
.factory-manual-power-notice small { color: #c89f60; font-size: 8px; }
.factory-manual-power-icon { display: grid; place-items: center; width: 28px; height: 28px; color: #f1bd69; }
.factory-manual-power-icon svg { display: block; width: 24px; height: 24px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reset-operation-notice { display: flex; gap: 12px; margin-top: 14px; padding: 13px; border: 1px solid; border-radius: 3px; }
.reset-operation-notice[hidden] { display: none; }
.reset-operation-notice.is-busy { border-color: var(--safety-orange); color: #f1bd69; background: #342918; }
.reset-operation-notice.is-success { border-color: var(--connection-green); color: #9ce8c6; background: #18372d; }
.reset-operation-notice.is-error { border-color: var(--danger); color: #ffaaa5; background: #3c201e; }
.reset-operation-icon { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
pre { min-height: 180px; max-height: 360px; overflow: auto; padding: 14px; border: 1px solid #313d40; border-radius: 3px; background: #0d1315; color: #b9d4cb; font: 10px/1.5 monospace; white-space: pre-wrap; }
.confirm-dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid #526064; border-radius: 5px; background: #1b2326; color: var(--ink); box-shadow: 0 28px 90px rgba(0,0,0,.65); }
.confirm-dialog::backdrop { background: rgba(4, 7, 8, .78); }
.confirm-dialog-content { padding: 26px; }
.confirm-dialog-content > p:not(.section-kicker) { color: var(--muted); line-height: 1.6; }
.confirm-check { display: flex; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid #805d2c; background: #322719; color: #efbd70; }
.confirm-actions { justify-content: flex-end; }
.confirm-origin { background: var(--danger); color: #fff; }
@media (max-width: 1199px) and (min-width: 761px) {
  body { overflow: auto; }
  .digital-twin-workspace { grid-template-columns: 280px minmax(0, 1fr); height: auto; min-height: calc(100vh - 60px); overflow: visible; }
  .scene-stage { grid-column: 1 / -1; height: calc(100vh - 60px); min-height: 660px; }
  .left-rail { grid-column: 1; grid-row: 1; height: calc(100vh - 60px); }
  .right-rail { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; padding-top: 14px; overflow: visible; background: #111719; }
  .target-mode-switch { grid-column: 1 / -1; }
  .target-mode-view { min-width: 0; }
  .shared-target-confirmation { min-width: 0; }
  .emergency-dock { right: 18px; }
  .scene-title, .scene-legend, .scene-hud { left: 310px; }
  .robot-scene-controls, .scene-tool-row { right: 18px; }
  .model-load-error { left: 310px; right: 18px; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .factory-workspace { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
  .factory-main .reset-header { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .shell { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 96px; }
  .topbar { height: auto; min-height: 60px; padding: 10px 12px; flex-wrap: wrap; }
  .brand small, .top-state { display: none; }
  .tabs { order: 3; width: 100%; height: 42px; margin: 8px 0 -10px; overflow-x: auto; }
  .tab { flex: 0 0 auto; padding: 0 12px; }
  .digital-twin-workspace:not(.active) { display: none !important; }
  .digital-twin-workspace.active { display: contents !important; }
  .device-region { order: 1; padding: 12px; }
  .model-region { order: 2; width: 100%; height: 520px; min-height: 520px; }
  .control-region { display: contents; }
  .target-mode-switch { order: 3; margin: 12px 12px 0; }
  .target-mode-view { display: contents; }
  .target-mode-view[hidden] { display: none; }
  .emergency-dock { top: auto; right: 12px; bottom: 12px; left: 12px; grid-template-columns: minmax(0, 1fr) 128px; width: auto; min-height: 68px; padding: 8px; }
  .emergency-copy .operation-status { font-size: 8px; }
  .emergency-stop { min-height: 50px; }
  .safety-region { order: 3; margin: 0; }
  .joint-panel { order: 4; margin: 12px; }
  .target-control-panel { order: 4; margin: 12px; }
  .shared-target-confirmation { order: 5; margin: 0 12px 96px; }
  .scene-title { top: 14px; left: 14px; }
  .robot-scene-controls { top: 68px; right: 14px; left: 14px; align-items: stretch; flex-wrap: wrap; }
  .displayed-model { flex: 1 1 210px; }
  .pose-source { flex: 1; }
  .scene-tool-row { right: 14px; bottom: 14px; }
  .scene-legend { left: 14px; bottom: 58px; }
  .scene-hud { right: 14px; bottom: 92px; left: 14px; }
  .scene-hud > div { flex: 1; min-width: 0; }
  .model-load-error { right: 14px; bottom: 138px; left: 14px; }
  .tcp-input-grid { grid-template-columns: 1fr 1fr; }
  .target-result-grid { grid-template-columns: 1fr; }
  .maintenance-view.active { height: auto; padding: 14px; }
  .factory-workspace { grid-template-columns: 1fr; }
  .factory-progress-panel { position: static; }
  .follower-target-field, .virtual-follower-notice { width: 100%; }
  .reset-header, .reset-steps, .reset-status, .settings-grid { grid-template-columns: 1fr; }

/* 更换舵机设置页面样式（与原型一致） */
.tool-panel { border: 2px solid rgba(225, 166, 74, .42); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; align-items: start; }
.header { display: grid; grid-template-columns: 1fr 300px; gap: 22px; }
.kicker { margin: 0 0 6px; color: var(--amber); font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.header h1 { margin: 0 0 10px; font-size: 24px; letter-spacing: 0; }
.header p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.danger { display: grid; gap: 7px; padding: 15px; border: 1px solid #8d642b; border-radius: 4px; background: rgba(91, 59, 18, .28); color: #f1bd69; }
.danger strong { font-size: 13px; }
.danger span { font-size: 10px; line-height: 1.55; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 4px; background: #202a2d; }
.step b { color: var(--amber); font-size: 12px; }
.step strong { display: block; font-size: 11px; }
.step span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.status { display: grid; gap: 5px; padding: 11px; border: 1px solid var(--line); border-radius: 4px; background: #202a2d; }
.status span, label { color: var(--muted); font-size: 10px; }
.status strong { color: var(--green); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 800; }
.field input { width: 100%; min-width: 0; padding: 10px; border: 1px solid #4a575a; border-radius: 3px; outline: none; background: var(--field); color: var(--ink); font-size: 12px; }
.field input:focus { border-color: var(--cyan); }
.field input[readonly] { color: #b8c1c3; background: #111719; }
.field small { color: #707d80; font-size: 9px; line-height: 1.45; }
.target-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border-left: 2px solid var(--cyan); background: rgba(23, 76, 80, .42); }
.target-summary span { color: #a7b5b8; font-size: 10px; }
.target-summary strong { color: #aaf9fb; font: 13px monospace; }
.checkline { display: flex; align-items: flex-start; gap: 9px; margin-top: 15px; padding: 11px; border: 1px solid #4a575a; background: #182124; color: #c7d0d1; font-size: 10px; line-height: 1.55; }
.checkline input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--amber); flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.actions button, .dialog-actions button { min-height: 38px; padding: 9px 14px; border-radius: 3px; font-size: 10px; }
.primary { background: #293438; color: #fff; box-shadow: inset 0 0 0 1px #526064; }
.ghost { background: #242e31; color: #dce1df; box-shadow: inset 0 0 0 1px #465256; }
.execute { min-width: 180px; background: var(--amber); color: #17120a; }
.result { display: none; gap: 12px; margin-top: 14px; padding: 13px; border: 1px solid; border-radius: 3px; }
.result.show { display: flex; }
.result.busy { border-color: var(--amber); background: #342918; color: #f1bd69; }
.result.success { border-color: var(--green); background: #18372d; color: #9ce8c6; }
.result.error { border-color: var(--red); background: #3c201e; color: #ffaaa5; }
.result-mark { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 2px solid currentColor; border-radius: 50%; font-weight: 900; }
.result strong { display: block; font-size: 12px; }
.result p { margin: 4px 0 0; font-size: 10px; line-height: 1.5; }
.progress { position: sticky; top: 84px; padding: 17px; border: 1px solid #4b585c; border-radius: 4px; background: #182124; }
.progress-head { display: flex; justify-content: space-between; gap: 10px; }
.progress h2 { margin: 0; font-size: 17px; }
.progress-head span { color: var(--muted); font-size: 10px; }
.progress-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.progress-item { display: grid; grid-template-columns: 28px 1fr 22px; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: #202a2d; }
.num, .state { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #354043; font-size: 10px; }
.progress-item strong { display: block; font-size: 11px; }
.progress-item small { color: var(--muted); font-size: 8px; }
.progress-item.active { border-color: var(--amber); background: #3a2d19; transform: translateX(3px); }
.progress-item.active .state { border: 3px solid #725422; border-top-color: var(--amber); animation: spin .8s linear infinite; }
.progress-item.complete { border-color: var(--green); background: #18372d; }
.progress-item.complete .state:after { content: "✓"; color: var(--green); font-weight: 900; }
.progress-item.failed { border-color: var(--red); background: #3c201e; }
.progress-item.failed .state:after { content: "!"; color: #ffaaa5; font-weight: 900; }
@keyframes spin { to { transform: rotate(360deg); } }
.log { margin-top: 16px; }
.log h2 { margin: 0 0 10px; font-size: 16px; }
.log pre { min-height: 118px; max-height: 220px; overflow: auto; margin: 0; padding: 14px; border: 1px solid #313d40; border-radius: 3px; background: #0d1315; color: #b9d4cb; font: 10px/1.6 monospace; white-space: pre-wrap; }

/* 对话框样式（与原型一致） */
.dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid #526064; border-radius: 5px; background: #1b2326; color: var(--ink); box-shadow: 0 28px 90px rgba(0, 0, 0, .65); }
.dialog::backdrop { background: rgba(4, 7, 8, .78); }
.dialog-content { padding: 26px; }
.dialog .kicker { margin: 0 0 6px; color: var(--amber); font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.dialog h2 { margin: 0 0 10px; font-size: 20px; color: var(--ink); }
.dialog p { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 0 0 14px; }
.confirm-data { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 13px; border: 1px solid #805d2c; background: #322719; color: #efbd70; font-size: 11px; border-radius: 3px; }
.confirm-data span { color: #8a979a; }
.confirm-data strong { text-align: right; color: #f8d585; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-actions .ghost { background: #242e31; color: #dce1df; border: 1px solid #465256; padding: 9px 14px; border-radius: 3px; font-size: 10px; min-height: 38px; }
.dialog-actions .confirm { background: var(--red); color: #fff; padding: 9px 14px; border-radius: 3px; font-size: 10px; min-height: 38px; }

@media (max-width: 900px) {
  .layout, .header { grid-template-columns: 1fr; }
  .progress { position: static; }
  .steps, .status-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .target-summary { align-items: flex-start; flex-direction: column; }
}
}

/* 舵机配置 - 全新设计 */
.servo-panel { border: none; background: transparent; box-shadow: none; }
.servo-container { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.servo-sidebar { background: #1a2326; border: 1px solid #2d3a3e; border-radius: 8px; padding: 20px; }
.servo-sidebar h3 { margin: 0 0 16px; font-size: 14px; color: #f5f6fa; }
.servo-steps { list-style: none; padding: 0; margin: 0 0 20px; }
.servo-steps .step { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 12px; margin-bottom: 8px; border-radius: 6px; background: #232f34; }
.servo-steps .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #34495e; color: #95a5a6; font-size: 12px; font-weight: 700; }
.servo-steps .step strong { display: block; font-size: 12px; color: #ecf0f1; }
.servo-steps .step small { color: #7f8c8d; font-size: 10px; }
.servo-status { border-top: 1px solid #2d3a3e; padding-top: 16px; margin-bottom: 16px; }
.servo-status .status-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 0; font-size: 11px; }
.servo-status span { color: #7f8c8d; }
.servo-status strong { color: #2ecc71; }
.progress-wrap { margin-top: 12px; }
.progress-label { font-size: 10px; color: #7f8c8d; margin-bottom: 6px; }
.progress-track { height: 6px; background: #2d3a3e; border-radius: 3px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, #3498db, #2ecc71); transition: width 0.3s; border-radius: 3px; }
.progress-track small { display: block; margin-top: 6px; font-size: 9px; color: #95a5a6; text-align: center; }
.servo-main { background: #1a2326; border: 1px solid #2d3a3e; border-radius: 8px; padding: 24px; }
.servo-header { margin-bottom: 24px; }
.servo-header .kicker { color: #f39c12; font-size: 9px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; margin: 0 0 8px; }
.servo-header h1 { margin: 0 0 8px; font-size: 22px; color: #f5f6fa; }
.servo-header p { margin: 0; color: #95a5a6; font-size: 12px; line-height: 1.6; }
.warn-card { display: grid; gap: 6px; padding: 14px; background: rgba(243, 156, 18, 0.1); border: 1px solid #d68910; border-radius: 6px; margin-top: 16px; }
.warn-card strong { color: #f39c12; font-size: 12px; }
.warn-card span { color: #b7950b; font-size: 10px; line-height: 1.5; }
.servo-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.form-group { display: grid; gap: 6px; }
.form-group label { font-size: 11px; color: #bdc3c7; font-weight: 600; }
.form-group input { padding: 10px 12px; border: 1px solid #34495e; border-radius: 6px; background: #232f34; color: #ecf0f1; font-size: 13px; outline: none; }
.form-group input:focus { border-color: #3498db; }
.form-group input[readonly] { color: #7f8c8d; cursor: not-allowed; }
.form-group small { color: #7f8c8d; font-size: 9px; }
.check-label { display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: #232f34; border-radius: 6px; margin-bottom: 20px; cursor: pointer; }
.check-label input { width: 16px; height: 16px; margin-top: 2px; accent-color: #f39c12; }
.check-label span { color: #bdc3c7; font-size: 11px; line-height: 1.5; }
.btn-row { display: flex; gap: 10px; margin-bottom: 20px; }
.btn-primary { background: #3498db; color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-ghost { background: transparent; color: #bdc3c7; border: 1px solid #34495e; padding: 10px 20px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-success { background: #2ecc71; color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-primary:disabled, .btn-ghost:disabled, .btn-success:disabled { opacity: 0.4; cursor: not-allowed; }
.log-box { border-top: 1px solid #2d3a3e; padding-top: 16px; }
.log-box h4 { margin: 0 0 10px; font-size: 11px; color: #7f8c8d; font-weight: 600; }
.log-box pre { background: #0d1114; border: 1px solid #1e2a2e; border-radius: 6px; padding: 12px; max-height: 180px; overflow: auto; color: #7fb3d5; font: 10px/1.6 'Consolas', monospace; }
.simple-dialog { border: none; background: transparent; box-shadow: none; }
.simple-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.dialog-body { background: #1a2326; border: 1px solid #2d3a3e; border-radius: 8px; padding: 24px; max-width: 400px; }
.dialog-body h3 { margin: 0 0 12px; font-size: 16px; color: #f5f6fa; }
.dialog-body p { margin: 0 0 20px; color: #95a5a6; font-size: 12px; line-height: 1.6; }
.dialog-body strong { color: #f39c12; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 900px) {
  .servo-container { grid-template-columns: 1fr; }
  .servo-sidebar { order: 2; }
  .servo-form { grid-template-columns: 1fr; }
}
