:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #111827;
  --panel-2: #0f1625;
  --panel-3: #172033;
  --border: #253047;
  --muted: #8fa1bd;
  --text: #edf3ff;
  --accent: #56a8ff;
  --accent-2: #9c7cff;
  --ok: #3ddc97;
  --warn: #ffd166;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(86, 168, 255, 0.16), transparent 28%),
    radial-gradient(circle at 76% 0%, rgba(156, 124, 255, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

button, .ghost-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: linear-gradient(180deg, #1b2740, #121a2c);
  border-radius: 9px;
  padding: 7px 10px;
  cursor: pointer;
  text-decoration: none;
  transition: 150ms ease;
  min-height: 32px;
  line-height: 1.05;
}

button:hover, .ghost-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

button:active, .ghost-button:active { transform: translateY(0); }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 80;
  top: 14px;
  bottom: 14px;
  left: 14px;
  width: min(360px, calc(100vw - 28px));
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(9, 13, 22, 0.96);
  backdrop-filter: blur(20px);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.7);
  padding: 14px;
  transform: translateX(calc(-100% - 28px));
  transition: transform 160ms ease;
}

body.file-drawer-open .sidebar {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.42);
  min-height: 0;
  padding: 0;
}

body.file-drawer-open .drawer-backdrop {
  display: block;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.drawer-close {
  padding-inline: 9px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand h1, .brand p, .topbar h2, .topbar p { margin: 0; }
.brand h1 { font-size: 17px; }
.brand p { color: var(--muted); font-size: 12px; margin-top: 2px; }

.controls-card, .summary, .panel {
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.78);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.controls-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--border);
  background: #0b111d;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 9px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.data-root { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.data-root-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.data-root-status { color: var(--muted); font-size: 11px; margin: 0; min-height: 14px; word-break: break-all; }
.data-root-browser {
  border: 1px solid var(--border);
  background: #0b111d;
  border-radius: 9px;
  padding: 8px;
  display: grid;
  gap: 6px;
}
.data-root-browser.hidden { display: none; }
.browser-current { color: var(--accent); font-size: 11px; word-break: break-all; }
.browser-list { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.browser-item {
  text-align: left;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.browser-item:hover { border-color: var(--accent); background: var(--panel-3); }
.browser-up { color: var(--muted); }
.browser-note { color: var(--muted); font-size: 11px; padding: 4px 2px; }
.browser-foot { display: flex; justify-content: flex-end; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
}
.metric {
  padding: 10px;
  background: rgba(15, 22, 37, 0.88);
}
.metric strong { display: block; font-size: 16px; }
.metric span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }

.list-header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}
.kbd {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}

.episode-list {
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 3px;
}
.episode-card {
  display: grid;
  gap: 5px;
  text-align: left;
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 22, 37, 0.76);
}
.episode-card.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(86, 168, 255, 0.18), rgba(156, 124, 255, 0.12));
}
.episode-card .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.episode-card strong { font-size: 13px; }
.episode-card small { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: max-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 11px;
}
.badge-error { border-color: #ff4d6d; color: #ff4d6d; }
.badge-warn { border-color: #ffd166; color: #ffd166; }

.main {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  padding: 10px 14px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 6px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 34px;
}
.top-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
button:disabled, .ghost-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}
.hidden { display: none !important; }

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}
.chip {
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(15, 22, 37, 0.72);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  white-space: nowrap;
}
.compact-meta {
  min-height: 20px;
}
.chip strong { color: var(--text); }

.workflow-panel {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.52);
  border-radius: 12px;
  padding: 4px 6px;
  min-height: 34px;
  overflow: hidden;
}
.inline-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(37, 48, 71, 0.6);
  border-radius: 999px;
  background: rgba(8, 12, 21, 0.45);
  padding: 4px 8px;
  white-space: nowrap;
}
.inline-metric span,
.inline-seek span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.inline-metric strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-metric.episode-time {
  flex: 1 1 auto;
}
.seek-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-left: auto;
}
.seek-box input {
  width: 64px;
  border: 1px solid var(--border);
  background: #0b111d;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 6px;
  min-height: 28px;
}
.seek-box button {
  min-height: 28px;
  padding: 4px 8px;
}

.labeling-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(11, 17, 29, 0.72);
  padding: 5px 7px;
}
.label-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}
.label-toolbar strong {
  font-size: 12px;
  white-space: nowrap;
  color: var(--text);
}
.label-toolbar button,
.import-label {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #1b2740, #121a2c);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.worker-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.worker-label input {
  width: 90px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #121a2c);
  color: var(--text);
  font-size: 12px;
}
.label-toolbar input {
  width: 130px;
  min-height: 26px;
  border: 1px solid var(--border);
  background: #070b13;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 7px;
  outline: none;
}
.label-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.label-toolbar button.active-tool {
  border-color: #ff4d6d;
  background: linear-gradient(180deg, rgba(255,77,109,0.34), rgba(120,20,42,0.36));
  color: #fff;
}

.label-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.segment-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.segment-editor button {
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #343b49;
  border-radius: 8px;
  background: #111722;
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.segment-editor button:hover { border-color: #4a5366; }
.segment-editor button:disabled { opacity: 0.42; cursor: default; }
.seg-readout {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.seg-readout strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}
.seg-step {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.seg-step select {
  min-height: 26px;
  border: 1px solid #343b49;
  border-radius: 8px;
  background: #070b13;
  color: var(--text);
  padding: 3px 7px;
  font-size: 12px;
}
.segment-editor .approval-status {
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
}
.label-timeline.cut-tool,
.label-timeline.cut-tool .timeline-segment {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cg%20stroke%3D%22%230b0f14%22%20stroke-width%3D%224.5%22%3E%3Ccircle%20cx%3D%226%22%20cy%3D%226%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%226%22%20cy%3D%2218%22%20r%3D%223%22%2F%3E%3Cline%20x1%3D%2220%22%20y1%3D%224%22%20x2%3D%228.12%22%20y2%3D%2215.88%22%2F%3E%3Cline%20x1%3D%2214.47%22%20y1%3D%2214.48%22%20x2%3D%2220%22%20y2%3D%2220%22%2F%3E%3Cline%20x1%3D%228.12%22%20y1%3D%228.12%22%20x2%3D%2212%22%20y2%3D%2212%22%2F%3E%3C%2Fg%3E%3Cg%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222%22%3E%3Ccircle%20cx%3D%226%22%20cy%3D%226%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%226%22%20cy%3D%2218%22%20r%3D%223%22%2F%3E%3Cline%20x1%3D%2220%22%20y1%3D%224%22%20x2%3D%228.12%22%20y2%3D%2215.88%22%2F%3E%3Cline%20x1%3D%2214.47%22%20y1%3D%2214.48%22%20x2%3D%2220%22%20y2%3D%2220%22%2F%3E%3Cline%20x1%3D%228.12%22%20y1%3D%228.12%22%20x2%3D%2212%22%20y2%3D%2212%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 26 14, crosshair;
}
.label-timeline {
  position: relative;
  min-width: 0;
  height: 30px;
  border: 1px solid #2d3a55;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px) 0 0 / 10% 100%,
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.12)),
    #07101d;
  cursor: pointer;
}
.label-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.label-ticks span {
  position: absolute;
  top: 1px;
  transform: translateX(-50%);
  color: rgba(143, 161, 189, 0.8);
  font-size: 9px;
}
.label-selection {
  display: none;
  position: absolute;
  top: 12px;
  height: 14px;
  border: 1px dashed var(--warn);
  background: rgba(255, 209, 102, 0.16);
  border-radius: 5px;
  pointer-events: none;
}
.segment-layer {
  position: absolute;
  inset: 12px 0 3px;
}
.timeline-segment {
  position: absolute;
  top: 0;
  height: 100%;
  min-height: 0;
  padding: 0 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--segment-color), white 22%);
  border-radius: 5px;
  background: color-mix(in srgb, var(--segment-color), transparent 35%);
  color: white;
  font-size: 10px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
  cursor: grab;
}
.timeline-segment.selected {
  outline: 2px solid white;
  outline-offset: -2px;
}
.timeline-segment:active { cursor: grabbing; }
.segment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.segment-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255,255,255,0.45);
}
.segment-handle.start { left: 0; cursor: ew-resize; }
.segment-handle.end { right: 0; cursor: ew-resize; }
.label-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff4d6d;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 0 10px rgba(255,77,109,0.7);
  pointer-events: none;
}
.label-playhead::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #ff4d6d;
}
.cut-guide {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 0;
  border-left: 1.5px dashed var(--cut-guide-color, #36d399);
  transform: translateX(-0.75px);
  pointer-events: none;
  display: none;
  z-index: 6;
}
.cut-guide.visible {
  display: block;
}
.cut-guide-label {
  position: absolute;
  top: -19px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #04130d;
  background: var(--cut-guide-color, #36d399);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.cut-guide-label.left { left: 0; transform: none; }
.cut-guide-label.right { left: auto; right: 0; transform: none; }
.notice {
  border: 1px solid rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.08);
  color: #ffe3a3;
  border-radius: 12px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.35;
}
.notice strong { color: #fff0c4; }
.notice code {
  color: #fff0c4;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 1px 5px;
}

.video-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.video-grid.single {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: none;
}
.video-grid.empty {
  grid-template-areas: none;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 18px;
}
.empty-state { color: var(--muted); }
.video-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #05070d;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.video-status-badge {
  position: absolute;
  top: 28px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}
.video-status-badge[data-status="buffering"] { background: rgba(255,193,7,0.85); color: #1a1a1a; }
.video-status-badge[data-status="error"] { background: rgba(244,67,54,0.9); color: #fff; }
.video-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(17, 24, 39, 0.94);
}
.video-title strong { color: var(--text); }
.video-card video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}
.video-card video::-webkit-media-controls,
.video-card video::-webkit-media-controls-enclosure,
.video-card video::-webkit-media-controls-panel {
  display: none !important;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
}
.panel { min-width: 0; overflow: hidden; }
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title h3 { margin: 0; font-size: 14px; }
.panel-title span { color: var(--muted); font-size: 12px; }
.topic-list {
  max-height: 380px;
  overflow: auto;
  display: grid;
}
.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(37, 48, 71, 0.65);
}
.topic-row code { color: var(--accent); word-break: break-word; }
.topic-row small { color: var(--muted); }
.topic-row strong { font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #0b111d;
}
.tab.active { color: white; border-color: var(--accent); }
.raw-panel pre {
  margin: 0;
  padding: 14px;
  max-height: 380px;
  overflow: auto;
  color: #d9e7ff;
  background: #070b13;
  font-size: 12px;
  line-height: 1.55;
}

.metadata-drawer {
  position: fixed;
  inset: 7vh 5vw;
  z-index: 50;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(8, 11, 18, 0.97);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.7);
  padding: 14px;
}
.metadata-drawer.hidden { display: none; }
.metadata-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
}

@media (min-width: 1500px) {
  .chip { padding: 3px 7px; }
  .notice { padding: 5px 8px; }
}

@media (max-width: 1450px) {
  .label-toolbar { flex-wrap: wrap; }
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; height: auto; max-height: none; }
  .details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .main, .sidebar { padding: 14px; }
  .main-split { flex-direction: column; }
  .left-panel { flex: 1; }
  .right-panel { width: auto; max-width: none; }
  .split-resizer { display: none; }
  .teleop-stage { grid-template-columns: 1fr; grid-template-rows: repeat(6, minmax(120px, 1fr)); }
  .label-toolbar { flex-wrap: wrap; }
  .field-grid { grid-template-columns: 1fr; }
}

/* Scenario 3 teleop MVP overrides: simple simulator-style HUD, big videos. */
body {
  background: #07080b;
}

.main.teleop-main {
  padding: 7px 8px;
  gap: 5px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Keyboard help toggle */
.kbd-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  background: rgba(0,0,0,0.88);
  border: 1px solid #2a3140;
  border-radius: 6px;
  padding: 8px 12px;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cdd8ee;
  pointer-events: none;
}
.kbd-overlay.hidden { display: none; }
.kbd-overlay pre { margin: 0; white-space: pre-wrap; }

/* Main left-right split */
.main-split {
  display: flex;
  gap: 6px;
  min-height: 0;
  flex: 1;
}
.left-panel {
  flex: 0 0 var(--split-left, 50%);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.left-panel .teleop-stage {
  flex: 1;
}
.right-panel {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.split-resizer {
  flex: 0 0 6px;
  align-self: stretch;
  cursor: col-resize;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease;
  touch-action: none;
}
.split-resizer:hover,
.split-resizer.dragging {
  background: rgba(86, 168, 255, 0.55);
}
.split-resizer:focus-visible {
  outline: 2px solid rgba(86, 168, 255, 0.7);
  outline-offset: 1px;
}
.right-panel .annotation-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hamburger {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 16px;
  background: #0e1118;
}

.label-toolbar button,
.import-label,
.top-actions .ghost-button {
  min-height: 25px;
  border-radius: 4px;
  padding: 4px 7px;
  background: #111722;
  border-color: #343b49;
  font-size: 12px;
}

.chips.compact-meta {
  min-height: 18px;
  flex: 1;
  min-width: 0;
}
.chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chips-row > .top-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.speed-group {
  display: inline-flex;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #343b49;
}
.speed-btn {
  background: #111722;
  color: #adb5c4;
  border: none;
  padding: 4px 7px;
  font-size: 11px;
  cursor: pointer;
  border-right: 1px solid #343b49;
}
.speed-btn:last-child { border-right: none; }
.speed-btn.active { background: #2563eb; color: #fff; }
.speed-btn:hover:not(.active) { background: #1a2233; }

.chip {
  border-radius: 4px;
  background: #0a0d13;
  border-color: #2a3140;
}

.teleop-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid #1f2735;
  background: #000;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.teleop-stage .video-grid {
  display: contents;
}

.teleop-stage .video-grid.empty {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.info-cell {
  background: rgba(0,0,0,0.9);
  border: 1px solid #1f2735;
  padding: 8px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.info-cell.hidden { display: none; }
.info-cell pre {
  margin: 0;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cdd8ee;
  white-space: pre-wrap;
}

.video-grid {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.video-grid.spatial {
  display: contents;
}

.video-card {
  border-radius: 0;
  border-color: #05070d;
  background: #000;
}

.video-title {
  position: absolute;
  z-index: 2;
  margin: 4px;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.82);
  color: #dce3ef;
  font-size: 12px;
}

.video-title span {
  display: none;
}

.video-card {
  position: relative;
}

.video-card video {
  object-fit: contain;
}


.labeling-panel,
.annotation-panel {
  border-radius: 4px;
  border-color: #2a3140;
  background: #080b11;
  padding: 5px;
}

.labeling-panel {
}

.label-toolbar {
  gap: 4px;
}

.label-timeline {
  height: 108px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.09) 1px, transparent 1px) 0 0 / 10% 100%,
    #050910;
}
.segment-layer {
  inset: 16px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.track-lane {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.track-lane.active {
  background: rgba(86, 168, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(86, 168, 255, 0.55);
}
.lane-tag {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-size: 9px;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.8;
}
.lv-badge {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10px;
  background: #1b2740;
  border: 1px solid var(--border);
  color: #cdd8ee;
}
.lv-badge.lv-1 { border-color: #3ddc97; color: #8ff0c6; }
.lv-badge.lv-2 { border-color: #56a8ff; color: #a9d2ff; }
.lv-badge.lv-3 { border-color: #ffd166; color: #ffe6a8; }

.segment-layer {
  inset: 12px 0 3px;
}

.timeline-segment {
  border-radius: 2px;
  font-weight: 800;
}

.annotation-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
}
.ann-action-btn {
  flex: none;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1b2740;
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.ann-action-btn:hover { border-color: var(--accent); }
.ann-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.annotation-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.annotation-head span {
  color: var(--muted);
}
.annotation-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.annotation-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid #1f2735;
}

.annotation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.annotation-table th,
.annotation-table td {
  border-bottom: 1px solid #1a2130;
  padding: 4px 6px;
  vertical-align: top;
}

.annotation-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101622;
  color: #aab5c8;
  text-align: left;
}
.annotation-table tbody tr { cursor: pointer; }
.annotation-table .row-step {
  width: 100%;
  min-width: 100px;
  max-width: 150px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #0b111d;
  color: var(--text);
  padding: 4px 6px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.annotation-table .row-step:focus { border-color: var(--accent); outline: none; }
.annotation-table .range-cell { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 11px; }
.annotation-table td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.annotation-table td:nth-child(4) { width: 100%; }
.annotation-table .row-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(255, 77, 109, 0.5);
  background: rgba(255, 77, 109, 0.12);
  color: #ff5d72;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.annotation-table .row-delete:hover { background: #ff4d6d; color: #fff; border-color: #ff4d6d; }
.annotation-table tbody tr.seg-selected td { background: rgba(86, 168, 255, 0.16); }
.annotation-table tbody tr.seg-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.annotation-table textarea {
  width: 100%;
  min-height: 38px;
  resize: none;
  overflow: hidden;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #05070d;
  color: var(--text);
  padding: 5px 6px;
  font: inherit;
}

.review-status {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  border: 1px solid #3a4355;
  border-radius: 999px;
  padding: 2px 6px;
  color: #aab5c8;
}

.review-status.approved,
.approved-row .review-status {
  border-color: rgba(61, 220, 151, 0.55);
  color: #7df0bd;
}
.annotation-table .status-toggle {
  min-width: 52px;
  border: 1px solid #3a4355;
  border-radius: 999px;
  padding: 3px 6px;
  background: #141b29;
  color: #aab5c8;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.annotation-table .status-toggle:hover { border-color: var(--accent); }
.annotation-table .status-toggle.approved {
  border-color: rgba(61, 220, 151, 0.55);
  background: rgba(61, 220, 151, 0.12);
  color: #7df0bd;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}


/* Unified Timeline + Action Graph */
.unified-timeline {
  position: relative;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #050910;
  overflow-x: auto;
  overflow-y: hidden;
}
.unified-timeline-inner {
  position: relative;
  min-width: 100%;
  width: 100%;
}
.unified-timeline::-webkit-scrollbar { height: 6px; }
.unified-timeline::-webkit-scrollbar-track { background: #0a0f18; }
.unified-timeline::-webkit-scrollbar-thumb { background: #3a4560; border-radius: 3px; }
.unified-timeline .label-timeline {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #1a2130;
}
.frame-delta-heatmap {
  display: block;
  width: 100%;
  height: 30px;
  border-bottom: 1px solid #1a2130;
}
.frame-delta-heatmap.loading {
  background: linear-gradient(90deg, #1a2130 25%, #2a3a50 50%, #1a2130 75%);
  background-size: 200% 100%;
  animation: heatmapShimmer 1.5s infinite;
}
@keyframes heatmapShimmer { to { background-position: -200% 0; } }
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #2a3a50;
  color: #e0e6ed;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.unified-timeline .label-playhead { display: none; }
.unified-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff4444;
  pointer-events: none;
  z-index: 10;
  left: 0%;
}
.action-graph-wrap {
  height: 100px;
  cursor: crosshair;
  position: relative;
}
.action-graph-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 5;
}
.action-graph-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.action-graph-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 6px;
  font-size: 11px;
}
.action-legend {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: #aab5c8;
}
.action-legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 8px;
  margin-right: 3px;
  border-radius: 2px;
  background: var(--lc);
}
.action-graph-panel { display: none; }
.action-graph-panel canvas { width: 100%; height: 120px; display: block; border-radius: 3px; }

@media (max-width: 900px) {
  .main.teleop-main {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .main-split { flex-direction: column; }
  .left-panel { flex: 1; }
  .right-panel { width: auto; max-width: none; }
  .split-resizer { display: none; }
  .teleop-stage {
    min-height: 400px;
  }
}
.heatmap-status {
  display: block;
  text-align: right;
  padding: 2px 8px;
  font-size: 11px;
  color: #6b7a8d;
  min-height: 16px;
}