:root {
  --bg: #0b0e14;
  --surface: #121722;
  --surface2: #192030;
  --border: #263044;
  --text: #e6edf7;
  --muted: #8b9bb4;
  --primary: #3b82f6;
  --accent: #a855f7;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.field { display: flex; align-items: center; gap: 5px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; }
.field span { font-size: 11px; color: var(--muted); }
.field input, .field select {
  background: transparent; border: none; color: var(--text); outline: none; font-size: 12px;
}
.field select option { background: var(--surface); color: var(--text); }

.btn {
  border: 1px solid transparent; border-radius: 7px; padding: 6px 12px;
  font-weight: 600; font-size: 12px; cursor: pointer; color: #fff; background: var(--surface2);
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--primary); }
.btn.accent { background: var(--accent); }
.btn.success { background: var(--success); }
.btn.secondary { border-color: var(--border); color: var(--text); }
.btn.mini { padding: 4px 8px; font-size: 11px; border-color: var(--border); color: var(--text); }
.btn.danger { color: #fca5a5; border-color: #7f1d1d; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 14px;
  padding: 14px;
  flex: 1;
}

.monitor-panel, .sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monitor-header, .panel-head, .timeline-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}

.view-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 12px;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.pill {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  font-family: ui-monospace, monospace;
}

.video-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-stage video, .video-stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-overlay {
  position: absolute; left: 10px; top: 10px;
  background: rgba(11, 14, 20, 0.78); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 10px; border-radius: 99px; font-size: 11.5px; pointer-events: none;
}

.timeline-card, .export-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.hint { font-size: 11px; color: var(--muted); margin-left: 6px; }
.timeline-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }

#timelineCanvas {
  width: 100%;
  height: 118px;
  margin-top: 8px;
  border-radius: 7px;
  background: #090c12;
  border: 1px solid var(--border);
  cursor: crosshair;
  display: block;
}

.edl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.edl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; font-family: ui-monospace, monospace;
}

.lane-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
}

.lane-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lane-card:hover { border-color: var(--primary); }
.lane-card.selected { border-color: var(--primary); background: #162238; box-shadow: 0 0 0 1px var(--primary); }

.lane-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-bottom: 5px; }
.lane-title { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

.badge-ready { color: var(--success); }
.badge-flash-high { color: var(--warn); }
.badge-flash-calm { color: #38bdf8; }

.export-status {
  margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; word-break: break-all;
}
.export-status a { color: var(--primary); font-weight: 600; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
}
