/* ========== Asset detail ========== */
.asset-detail {
  display: flex; flex-direction: column;
  flex: 1;        /* parent is `.main` (flex col) - fill remaining vertical space */
  min-height: 0;
  background: var(--bg-0);
  overflow: hidden;
}
.asset-detail-header {
  height: var(--topbar-h);
  display: flex; align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.asset-detail-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  min-height: 0;
}
.player-col {
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.player {
  background: #000;
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 8px;
  min-height: 0;
  /* Video/filmstrip/shots used to claim the whole column (62vh cap + no
     shrink floor), squeezing the comments/files/transcript tabs below it to
     a sliver. Cap the player itself so the tabs+content area always gets a
     real share of the column. */
  flex-shrink: 1;
}
.player-canvas {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #050608;
  /* Phase 1: give the review player more vertical real estate (Frame.io-like). */
  max-height: min(40vh, 460px);
  flex: 1 1 auto;
  min-height: 0;
}
.player-canvas .thumb-svg { width: 100%; height: 100%; display: block; }
/* Persistent reminder that web previews are proxy quality, not the hi-res master. */
.proxy-quality-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  pointer-events: auto;
  cursor: default;
  user-select: none;
}
.proxy-quality-badge svg { opacity: 0.85; flex-shrink: 0; }

/* Phase 1 — Ci-style stage chips in asset header */
.asset-stage-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}
.asset-stage-chip {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-4);
  background: transparent;
  line-height: 1.2;
}
.asset-stage-chip.is-done {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: var(--success-soft);
}
.asset-stage-chip.is-active {
  color: var(--accent-text);
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
}
.asset-stage-chip.is-live {
  color: var(--live);
  border-color: color-mix(in srgb, var(--live) 45%, var(--border));
  background: var(--live-soft);
}

.player-play-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.4));
  transition: background 120ms;
}
.player-play-overlay:hover { background: rgba(0,0,0,0.3); }
.player-play-overlay svg {
  width: 64px; height: 64px;
  color: white;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  padding: 16px;
}
.player-tc {
  position: absolute;
  right: 12px; bottom: 12px;
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: white;
}
.player-overlay-markers {
  position: absolute; inset: 16px;
  pointer-events: none;
}
.player-pin {
  position: absolute;
  left: 30%; top: 40%;
  display: flex; align-items: center; gap: 6px;
  pointer-events: auto;
}
.player-pin-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: white;
  border: 2px solid white;
}
.player-pin-bubble {
  background: var(--accent);
  color: white;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  max-width: 240px;
}

.player-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px;
}

.playback-bar {
  flex: 1;
  height: 24px;
  position: relative;
  cursor: pointer;
  display: flex; align-items: center;
}
.playback-bar::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
}
.playback-fill {
  position: absolute;
  height: 4px;
  background: var(--accent);
  border-radius: 99px;
  pointer-events: none;
}
.playback-handle {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
  pointer-events: none;
}
.playback-marker {
  position: absolute;
  transform: translateX(-50%) translateY(-2px);
  z-index: 2;
}
.marker-avatar {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 9px; font-weight: 600;
  border: 1.5px solid var(--bg-0);
}
.playback-marker.resolved .marker-avatar { background: var(--text-4); opacity: 0.5; }

.filmstrip-wrap {
  background: var(--bg-1);
  border-radius: var(--r-sm);
  padding: 8px;
  margin-top: 4px;
}
.filmstrip {
  position: relative;
  display: flex;
  gap: 1px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}
.film-frame {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.film-frame .thumb-svg { width: 100%; height: 100%; }
.filmstrip-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 6px var(--accent);
}
.filmstrip-playhead::before {
  content: "";
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
}
.filmstrip-pin {
  position: absolute;
  bottom: -6px;
  transform: translateX(-50%);
}
.filmstrip-pin-avatar {
  display: grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 8px;
  font-weight: 600;
  border: 1.5px solid var(--bg-1);
}
.filmstrip-pin.resolved .filmstrip-pin-avatar { background: var(--text-4); }
.filmstrip-tc {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
  font-size: 10px;
  color: var(--text-4);
}

/* When the user has dragged the splitter the explicit height wins; the canvas
   must give up its 40vh cap or the player stops filling the space it was given. */
.player.sized > .player-canvas { max-height: none; }

/* Drag handle between the player and the tab panel. 6px hit area, visible line. */
.asset-split {
  flex: 0 0 auto;
  height: 6px;
  cursor: row-resize;
  background: var(--bg-0);
  border-top: 1px solid var(--border);
  touch-action: none;
}
.asset-split:hover, .asset-split.dragging, .asset-split:focus-visible {
  background: var(--accent);
  outline: none;
}

.asset-detail-tabs {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 40px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  background: var(--bg-0);
  flex-shrink: 0;
}
.asset-detail-tabs button {
  height: 40px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  position: relative;
  display: flex; align-items: center; gap: 6px;
}
.asset-detail-tabs button:hover { color: var(--text-1); }
.asset-detail-tabs button.active { color: var(--text-1); }
.asset-detail-tabs button.active::after {
  content: ""; position: absolute;
  bottom: -1px; left: 8px; right: 8px;
  height: 2px; background: var(--accent);
}
.asset-detail-tabs .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-3);
  padding: 0 6px;
  border-radius: 99px;
  color: var(--text-3);
}
.asset-detail-tabs button.active .count { background: var(--accent-soft); color: var(--accent-text); }
.tiny-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  color: var(--text-3);
  cursor: pointer;
}
.tiny-toggle input { accent-color: var(--accent); }

.asset-detail-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 8px 20px 20px;
}

.comments-list { display: flex; flex-direction: column; gap: 4px; }
.comment {
  display: flex; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment.resolved { opacity: 0.55; }
.comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 600;
  color: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.comment-body { flex: 1; min-width: 0; }
.comment-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.comment-who { font-weight: 600; }
.comment-time {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 1px 6px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
}
.comment-time:hover { background: var(--accent-soft-2); }
.comment-when { color: var(--text-3); font-size: 11px; }
.comment-action { color: var(--text-3); }
.comment-action:hover { color: var(--text-1); }
.comment-text {
  font-size: 12.5px;
  color: var(--text-1);
  margin-top: 4px;
  line-height: 1.5;
}
.comment-resolved {
  font-size: 11px;
  color: var(--success);
  margin-top: 4px;
}

.comment-composer {
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.composer-head {
  display: flex; align-items: center; justify-content: space-between;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid var(--bg-1); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.add-reviewer {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1.5px dashed var(--border-stronger);
  display: grid; place-items: center;
  color: var(--text-3);
  margin-left: -2px;
}
.composer-tag {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px;
}
.composer-input {
  width: 100%;
  min-height: 90px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  outline: 0;
  font-size: 13px;
  resize: vertical;
  color: var(--text-1);
}
.composer-input:focus { border-color: var(--accent); }
.composer-bar {
  display: flex; align-items: center; gap: 8px;
}
.composer-tools { display: flex; gap: 2px; }

.versions-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.version-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-1);
}
.version-thumb {
  width: 120px; aspect-ratio: 16/9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-2);
}

.meta-table {
  display: flex; flex-direction: column;
  padding: 8px 0;
}
.meta-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  gap: 16px;
}
.meta-row .meta-k { color: var(--text-3); }
.meta-row .meta-v { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }

/* ========== Audio tab ========== */
.audio-tab {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}

.audio-tracks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-track {
  display: grid;
  grid-template-columns: 140px 1fr 64px auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: opacity 120ms;
}

.audio-track.muted {
  opacity: 0.4;
}

.audio-track-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.audio-track-waveform {
  min-width: 0;
  overflow: hidden;
  height: 32px;
}

.audio-track-waveform .waveform {
  width: 100%;
  height: 32px;
  display: block;
}

.audio-track-meters {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.audio-track-meta {
  display: flex;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.audio-track-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-btn {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 80ms, color 80ms, border-color 80ms;
}

.audio-btn:hover {
  border-color: var(--border-stronger);
  color: var(--text-1);
}

.audio-btn.mute.active {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.audio-btn.solo.active {
  background: var(--warning);
  color: var(--bg-0);
  border-color: var(--warning);
}

.audio-fader {
  display: flex;
  align-items: center;
  gap: 4px;
}

.audio-fader input[type="range"] {
  width: 60px;
  height: 4px;
  appearance: none;
  background: var(--bg-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.audio-fader input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-1);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.audio-fader input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-1);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.audio-fader .mono {
  font-size: 10px;
  color: var(--text-4);
  min-width: 24px;
  text-align: right;
}

.audio-master {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.audio-master-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 48px;
}

.audio-master-meters {
  display: flex;
  gap: 6px;
}

.master-fader input[type="range"] {
  width: 100px;
}

/* Audio level meters */
.audio-level-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.audio-level-bar {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  width: 10px;
}

.audio-level-seg {
  width: 10px;
  height: 3px;
  border-radius: 1px;
  transition: background 60ms;
}

.audio-level-label {
  font-size: 9px;
  color: var(--text-4);
  text-align: center;
}

/* Responsive: stack on narrow screens */
@media (max-width: 900px) {
  .audio-track {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
  }
  .audio-track-waveform { height: 24px; }
  .audio-track-meters { justify-content: flex-start; }
}

/* ── Transcript tab (Feature 2: GPU transcription) ── */
.transcript-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 40px 24px; text-align: center;
}
.transcript-tab { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.transcript-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.transcript-lang {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 4px;
  background: var(--accent-soft, rgba(236,19,19,0.14)); color: var(--accent-text, #EC1313);
}
.transcript-lines { overflow-y: auto; flex: 1; padding: 4px 0; }
.transcript-line {
  display: flex; gap: 12px; align-items: baseline;
  padding: 6px 14px; cursor: pointer;
  transition: background 0.1s;
}
.transcript-line:hover { background: var(--surface-2); }
.transcript-line.active {
  background: var(--accent-soft, rgba(236,19,19,0.12));
}
.transcript-tc {
  font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-3);
  min-width: 42px; flex-shrink: 0; font-family: var(--mono, monospace);
}
.transcript-text { font-size: 13px; line-height: 1.45; color: var(--text-1); }

/* ── Editable metadata (Feature 3) ── */
.meta-tab { display: flex; flex-direction: column; gap: 18px; padding: 16px; overflow-y: auto; }
.meta-edit-section { display: flex; flex-direction: column; gap: 8px; }
.meta-edit-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3);
}
.meta-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 22px; align-items: center; }
.meta-tags-empty { font-size: 12px; color: var(--text-3); font-style: italic; }
.meta-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 6px 3px 9px; border-radius: 12px;
  background: var(--accent-soft, rgba(236,19,19,0.14)); color: var(--accent-text, #EC1313);
}
.meta-tag-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer; opacity: 0.7;
}
.meta-tag-x:hover { opacity: 1; background: rgba(0,0,0,0.15); }
.meta-tag-add { display: flex; gap: 8px; align-items: center; }
.meta-tag-add .field-input { flex: 1; max-width: 240px; height: 30px; font-size: 12.5px; }
.meta-notes { width: 100%; resize: vertical; font-size: 12.5px; line-height: 1.5; padding: 8px 10px; }

/* ── Marker ranges / chapters (Feature 3) ── */
.marker-range-toggle { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.marker-kind-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.comment-range-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: var(--surface-2); color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Range / chapter marker span on the scrubber */
.playback-range {
  position: absolute; top: 0; bottom: 0;
  border-radius: 2px; cursor: pointer; pointer-events: auto;
  z-index: 1;
}
