/* Timeline module chrome — header row above ruler / tracks */

:root {
  --timeline-header-h: 40px;
  --timeline-lane-icon: 16px;
  --timeline-video-accent: rgba(94, 234, 212, 0.82);
  --timeline-audio-accent: rgba(96, 165, 250, 0.82);
  --timeline-playhead: #ff5a4f;
  --timeline-line-subtle: rgba(255, 255, 255, 0.07);
  --timeline-line-muted: rgba(255, 255, 255, 0.045);
  --timeline-shell-radius: 8px;
}

.workspace-transport-stack {
  box-sizing: border-box;
}

.timeline-module {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  background: var(--program-chrome-bg, #161618);
  border: 1px solid var(--cg-line, rgba(255, 255, 255, 0.09));
  border-radius: var(--cg-radius-md, 7px);
  /* Keep visible for header tooltips; clip top corners via chrome-row radius instead. */
  overflow: visible;
}

.timeline-chrome-row {
  display: flex;
  flex: 0 0 var(--timeline-header-h);
  min-height: var(--timeline-header-h);
  background: var(--program-chrome-bg, #161618);
  /* Match module top radius; keep overflow visible so snap/focus/zoom tooltips can paint over the ruler. */
  border-top-left-radius: calc(var(--cg-radius-md, 7px) - 1px);
  border-top-right-radius: calc(var(--cg-radius-md, 7px) - 1px);
  overflow: visible;
  position: relative;
  z-index: 60;
}

.timeline-header-divider {
  display: none;
}

.timeline-header {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 7px 8px;
  container-type: inline-size;
  container-name: timeline-header;
  overflow: visible;
  position: relative;
}

.timeline-header-scout.ai-config-area {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.console-right-scout.ai-config-area {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

/* Flat tool row — no rounded capsule chrome (few buttons; keep NLE-dense) */
.timeline-header-scout .timeline-edit-tools.icon-group-capsule {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: auto;
  min-height: 0;
  padding: 0 !important;
  flex-shrink: 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.timeline-header-scout .timeline-edit-tool-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 4px !important;
  color: rgba(220, 225, 235, 0.84);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.timeline-header-scout .timeline-edit-tool-btn.active-blue {
  color: var(--cg-brand, #a3e635) !important;
  background: var(--cg-brand-dim, rgba(163, 230, 53, 0.12)) !important;
}

.timeline-header-scout .timeline-edit-tool-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Scout in program console uses transport density tokens — do not pin 28px here. */
.console-right-scout #scoutBtn {
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.console-right-scout #scoutResetBtn {
  width: auto;
  min-width: 0;
  height: var(--ws-icon-size, 28px);
  margin-left: 0;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
}

.timeline-header-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-width: 0;
}

.timeline-brand-icon {
  width: 15px;
  height: 15px;
  color: rgba(235, 235, 245, 0.42);
  flex-shrink: 0;
}

.timeline-header-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(235, 235, 245, 0.58);
  user-select: none;
}

.timeline-header-timecode {
  font: 400 11px/1.2 var(--cg-font-timecode, 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 0;
  letter-spacing: 0.02em;
  color: rgba(228, 234, 244, 0.6);
  white-space: nowrap;
  user-select: none;
}

.timeline-header-timecode #curTime,
.timeline-header-timecode #durTime,
.timeline-header-timecode .timecode-sep {
  color: inherit;
  font-weight: 400;
}

.timeline-header-status {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  color: rgba(163, 230, 53, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-header-status[hidden] {
  display: none !important;
}

/* Selection actions — above ruler, X-aligned to I/O range; rounded-rect like toolbar. */
.timeline-header .io-selection-float {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0;
  padding: 2px;
  border-radius: 4px;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: auto;
  width: max-content;
  max-width: min(100%, 220px);
}

.timeline-header .io-selection-float[hidden] {
  display: none !important;
}

/* Mirror recording uses the timeline header's center, below the program picture. */
.loading.is-mirror-record-hud > div {
  position: fixed;
  left: var(--mirror-record-hud-x, 50%);
  top: var(--mirror-record-hud-y, 50%);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: calc(100vw - 32px);
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.92) !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.loading.is-mirror-record-hud > div::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #ff453a;
}

.loading.is-mirror-record-hud #loadingTitle,
.loading.is-mirror-record-hud #loadingSub {
  display: inline;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: #f5f5f7;
}

.loading.is-mirror-record-hud #loadingCancel {
  min-width: 0;
  margin: 0 0 0 4px;
  padding: 3px 8px;
  border-radius: 999px;
}

.timeline-header .io-selection-float-btn {
  appearance: none;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(220, 225, 235, 0.9);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.timeline-header .io-selection-float-btn:hover,
.timeline-header .io-selection-float-btn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.timeline-header .io-selection-float-btn.is-active,
.timeline-header .io-selection-float-btn[aria-expanded='true'] {
  background: rgba(163, 230, 53, 0.16);
  color: #a3e635;
}

.timeline-header .io-selection-float-btn.is-clear:hover,
.timeline-header .io-selection-float-btn.is-clear:focus-visible {
  background: rgba(255, 69, 58, 0.14);
  color: #ff8e86;
}

.timeline-header .io-selection-float-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.timeline-header .io-selection-float-sep {
  width: 1px;
  height: 12px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.timeline-header .io-selection-float-btn[data-tooltip] {
  position: relative;
  z-index: 1;
}

.timeline-header .io-selection-float-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(28, 28, 30, 0.96);
  color: #d1d1d6;
  border: 1px solid #3a3a3c;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  font: 500 11px/1.35 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 20;
}

.timeline-header .io-selection-float-btn[data-tooltip]:hover::after,
.timeline-header .io-selection-float-btn[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.timeline-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-left: auto;
  overflow: visible;
  /* Flat icons — no capsule pad/border height budget */
  --tl-icon-size: 26px;
  --tl-icon-svg: 16px;
  --tl-zoom-track: 48px;
  --tl-zoom-btn-w: 18px;
  --tl-btn-radius: 4px;
  --tl-capsule-pad-y: 0px;
  --tl-capsule-pad-x: 0px;
  --tl-strip-h: var(--tl-icon-size);
}

.timeline-header-tools.icon-group-capsule {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: var(--tl-strip-h);
  min-height: var(--tl-strip-h);
  padding: 0 !important;
  flex-shrink: 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  position: relative;
  overflow: visible !important;
}

.timeline-header-tools-div {
  width: 1px;
  height: var(--tl-icon-svg);
  margin: 0 3px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  align-self: center;
}

.timeline-header-actions .ws-timeline-zoom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: var(--tl-icon-size);
  position: relative;
  overflow: visible;
}

.timeline-header-actions .ws-zoom-slider {
  width: var(--tl-zoom-track);
  height: 12px;
}

.timeline-header-actions .ws-zoom-btn {
  width: var(--tl-zoom-btn-w);
  height: var(--tl-icon-size);
  font-size: 14px;
  line-height: 1;
  border-radius: var(--tl-btn-radius);
}

.timeline-header-actions .ws-zoom-btn:hover {
  border-radius: var(--tl-btn-radius);
}

.timeline-header-actions .icon-btn {
  width: var(--tl-icon-size) !important;
  height: var(--tl-icon-size) !important;
  border-radius: var(--tl-btn-radius) !important;
  position: relative;
  overflow: visible !important;
  color: rgba(220, 225, 235, 0.84);
}

.timeline-header-actions .icon-btn:hover {
  border-radius: var(--tl-btn-radius) !important;
}

.timeline-header-actions .icon-btn svg {
  width: var(--tl-icon-svg);
  height: var(--tl-icon-svg);
  display: block;
  fill: currentColor;
}

.timeline-header-actions .icon-btn.ws-stroke-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-header-actions #btn-timeline-marker .timeline-marker-icon {
  width: var(--tl-icon-svg);
  height: var(--tl-icon-svg);
}

.timeline-header-actions #btn-timeline-marker:hover {
  color: var(--cg-brand, #a3e635) !important;
  background: var(--cg-brand-dim, rgba(163, 230, 53, 0.12)) !important;
}

.timeline-header-actions #btn-timeline-snap.ws-stroke-icon svg {
  stroke-width: unset;
}

.timeline-header-actions #btn-timeline-snap .timeline-snap-icon {
  width: var(--tl-icon-svg);
  height: var(--tl-icon-svg);
}

.timeline-header-actions #btn-timeline-snap.active-blue {
  color: var(--cg-brand, #a3e635) !important;
  background: var(--cg-brand-dim, rgba(163, 230, 53, 0.12)) !important;
  border-radius: var(--tl-btn-radius) !important;
}

.timeline-header-actions #btn-timeline-snap:not(.active-blue) .timeline-snap-icon {
  opacity: 0.55;
}

@container timeline-header (max-width: 860px) {
  .timeline-header-actions {
    --tl-zoom-track: 40px;
  }
}

@container timeline-header (max-width: 640px) {
  .timeline-header-actions {
    --tl-zoom-track: 32px;
  }
}

@container timeline-header (max-width: 520px) {
  .timeline-header-actions .ws-timeline-zoom-wrap,
  .timeline-header-actions .timeline-header-tools-div {
    display: none;
  }

  .timeline-header-brand .timeline-header-title {
    display: none;
  }

  .timeline-header-brand .timeline-header-timecode {
    font-size: 10px;
  }
}

.timeline-header-chip {
  display: none !important;
}

.timeline-header-chip[hidden] {
  display: none !important;
}

.timeline-chip-icon {
  display: none !important;
}

.timeline-module > .timeline-stack-row {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-container {
  border-radius: 0 !important;
  border: 0 !important;
  background: var(--program-chrome-bg, #161618) !important;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-pr-header-corner {
  border-bottom: 0;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-stack-row .scrollbar-track {
  height: 15px !important;
  border-radius: 0 !important;
  border: 0 !important;
  border-top: 0 !important;
  background: var(--program-chrome-bg, #161618);
}

/* Kill the 1px rail line (.scrollbar-track:before in workspace.css) */
:is(.workspace-left, .workspace-stage) .timeline-module .timeline-stack-row .scrollbar-track::before {
  content: none !important;
  display: none !important;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-stack-row #scrollbarThumb {
  top: 3px !important;
  height: 9px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-stack-row #scrollbarThumb:active {
  background: rgba(255, 255, 255, 0.3) !important;
}

:is(.workspace-left, .workspace-stage) .timeline-module .timeline-stack-row .pr-handle {
  top: 1px !important;
  width: 6px !important;
  height: 7px !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
}

/* Lane header SVG icons — opaque solid gray strokes. */
.timeline-lane-icon {
  width: 18px;
  height: 18px;
  display: block;
  opacity: 1;
}

.timeline-lane-icon--video,
.timeline-lane-icon--audio {
  color: #8e8e93;
}
