:root {
  --bg: #0e0f11;
  --surface: #17191c;
  --surface-2: #202327;
  --border: #2e3338;
  --text: #f5f5f5;
  --muted: #b3b3b3;
  --accent: #2563eb;
  --accent-hover: #447ef2;
  --danger: #ef4444;
  --amber: #f59e0b;
  --green: #22c55e;
  --cyan: #38bdf8;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Monaco, monospace;
}

.strong {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top bar */
.topbar {
  min-height: 54px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  height: 30px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.35);
}

.brand-sub {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(37, 99, 235, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

.divider-v {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.divider-v.small {
  height: 16px;
}

.select-control,
.status-select,
.select-xs {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

.select-xs {
  padding: 4px 8px;
  font-size: 12px;
}

.full-w {
  width: 100%;
}

.version-pills {
  display: flex;
  gap: 4px;
}

.version-pill {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.version-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.meta-pill {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: #1e273d;
}

.btn-primary {
  background: var(--accent);
  color: #fafafa;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.32);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 26px rgba(37, 99, 235, 0.55);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-ghost.active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.btn-icon {
  padding: 5px 9px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.btn-play {
  padding: 6px 16px;
  font-size: 13px;
  background: #fff;
  color: #0b0e14;
  font-weight: 700;
}

.btn-play:hover {
  background: #e2e8f0;
}

/* Workspace layout */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 410px;
}

.player-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #05070b;
}

.video-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  max-width: 440px;
}

.empty-state h2 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text);
  font-size: 28px;
  margin-bottom: 10px;
}

.empty-state code {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.video-frame-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-frame-box video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.annotation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default;
}

.annotation-canvas.drawing-active {
  cursor: crosshair;
}

.annotation-canvas.eyedropper-active {
  cursor: copy;
}

.compare-badge,
.snip-hint-banner {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.snip-hint-banner {
  left: 50%;
  transform: translateX(-50%);
  color: #bae6fd;
  white-space: nowrap;
}

/* Annotator bar */
.annotator-bar {
  min-height: 44px;
  padding: 6px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tool-btn.tool-snip {
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.tool-btn.active {
  background: rgba(99, 102, 241, 0.24);
  border-color: var(--accent);
  color: #fff;
}

.tool-btn.tool-snip.active {
  background: rgba(14, 165, 233, 0.26);
  border-color: var(--cyan);
  color: #fff;
}

.color-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--dot);
  cursor: pointer;
  padding: 0;
}

.color-dot.active {
  border-color: #fff;
  transform: scale(1.15);
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-badge {
  font-size: 11px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Transport & Scrubber */
.transport-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.scrubber-wrap {
  position: relative;
  padding-top: 16px;
  padding-bottom: 4px;
}

.waveform-canvas {
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  height: 18px;
  width: 100%;
  pointer-events: none;
  opacity: 0.55;
}

.scrubber-track {
  position: relative;
  height: 10px;
  background: #1b2436;
  border-radius: 999px;
  cursor: pointer;
}

.scrubber-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  pointer-events: none;
}

.scrubber-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  border-radius: 999px;
  pointer-events: none;
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.scrubber-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker-dot {
  position: absolute;
  top: -11px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
  border: 2px solid #0b0e14;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
}

.marker-dot.open {
  background: var(--danger);
}

.marker-dot.in_progress {
  background: var(--cyan);
}

.marker-dot.resolved {
  background: var(--green);
}

.scrubber-tooltip {
  position: absolute;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.transport-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.transport-left,
.transport-right,
.timecode-readout {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.timecode-readout {
  gap: 10px;
  font-size: 13px;
}

/* Right Comments Column */
.comments-column {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.composer-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}

.composer-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-pill {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.draw-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
}

.author-input {
  margin-left: auto;
  width: 105px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
}

/* Snip preview in composer */
.snip-preview-box {
  background: #0a0f1a;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.snip-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #7dd3fc;
}

.snip-preview-actions {
  display: flex;
  gap: 4px;
}

.snip-preview-img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 6px;
  background: #04060a;
}

/* Quick Change Mode Pills */
.change-mode-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mode-pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.mode-pill.active {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--accent);
  color: #e0e7ff;
}

.spec-panel {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

.spec-input:focus {
  border-color: var(--accent);
}

.spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.spec-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.spec-color-pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.color-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px;
}

.color-picker {
  width: 24px;
  height: 22px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.arrow-sep {
  color: var(--muted);
  font-weight: 700;
  padding-top: 14px;
}

.quick-ranges {
  justify-content: flex-start;
}

.comment-textarea {
  width: 100%;
  resize: vertical;
  min-height: 54px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.comment-textarea:focus {
  border-color: var(--accent);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.composer-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.filter-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.filter-tabs {
  display: flex;
  gap: 6px;
}

.filter-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 6px;
  cursor: pointer;
}

.filter-tab.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.filter-tab span {
  opacity: 0.7;
  margin-left: 2px;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.comment-card:hover,
.comment-card.selected {
  border-color: var(--accent);
}

.comment-card.resolved {
  opacity: 0.65;
}

.comment-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment-idx {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-cat {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.badge-high {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.spec-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
}

.swatch-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: inline-block;
}

.comment-body {
  font-size: 13px;
  line-height: 1.45;
  color: #e2e8f0;
  white-space: pre-wrap;
}

.comment-snaps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.comment-snaps.two-col {
  grid-template-columns: 1fr 1fr;
}

.comment-snap {
  width: 100%;
  max-height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #05070b;
}

.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.comment-author {
  font-size: 11px;
  color: var(--muted);
}

.comment-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Assets Drawer */
.assets-drawer {
  position: fixed;
  top: 54px;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55);
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  margin: 0;
  font-size: 14px;
}

.assets-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-item img,
.asset-item video {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
}

.asset-item audio {
  width: 100%;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--accent);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 60;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

[hidden] {
  display: none !important;
}
