:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;
  --success: 142 76% 36%;
  --warning: 38 92% 50%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.app-header {
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.25rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 1.625rem;
  height: 1.625rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
}

/* Page layout */
.page-main {
  padding-top: 1.75rem;
  padding-bottom: 2rem;
}
.page-main--wide {
  max-width: 1200px;
}
.page-main--editor {
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.page-main--centered {
  text-align: center;
  padding-top: 4rem;
}

.page-header {
  margin-bottom: 1.5rem;
}
.page-title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-title--sm {
  font-size: 1.375rem;
  margin-bottom: 0.125rem;
}
.page-subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}
.page-subtitle--sm {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 0.8125rem;
}

/* Cards */
.card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}

.card-header {
  padding: 1rem 1.25rem 0;
}
.card-header--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
}
.card-description {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}
.card-content {
  padding: 1.25rem;
}
.card-content--flush {
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem;
  font-weight: 500;
  height: 2.125rem;
  padding: 0 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    opacity 0.15s;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}
.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}
.btn-secondary:hover:not(:disabled) {
  background: hsl(var(--accent));
}
.btn-outline {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.btn-outline:hover:not(:disabled) {
  background: hsl(var(--accent));
}
.btn-ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
}
.btn-ghost:hover:not(:disabled) {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}
.btn-ghost.active {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}
.btn-sm {
  height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.4;
}

.badge-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}
.badge-success {
  background: hsl(var(--success) / 0.12);
  color: hsl(var(--success));
}
.badge-warning {
  background: hsl(var(--warning) / 0.12);
  color: hsl(32 95% 35%);
}
.badge-muted {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* Inputs */
.input {
  display: flex;
  height: 2.125rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  font-family: inherit;
  color: hsl(var(--foreground));
}

.input:focus {
  outline: 2px solid hsl(var(--ring) / 0.3);
  outline-offset: 0;
  border-color: hsl(var(--ring));
}
.input-search {
  padding-left: 2rem;
}

.search-wrap {
  position: relative;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--muted) / 0.4);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.toolbar-group--search {
  flex: 1;
  min-width: 180px;
}
.toolbar-group--actions {
  margin-left: auto;
}
.toolbar-option {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  user-select: none;
}
.toolbar-option input {
  accent-color: hsl(var(--primary));
}

.folder-path {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--background));
  padding: 0.3125rem 0.625rem;
  border-radius: calc(var(--radius) - 2px);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid hsl(var(--border));
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-count {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  padding: 0 0.25rem;
}

/* Movie list */
.movie-list {
  display: flex;
  flex-direction: column;
}

.movie-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  transition: background 0.12s;
}

.movie-row:hover {
  background: hsl(var(--muted) / 0.45);
}
.movie-row:last-child {
  border-bottom: none;
}
.movie-row.hidden-by-search {
  display: none;
}

.movie-row-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.movie-row-check input[type="checkbox"] {
  width: 0.9375rem;
  height: 0.9375rem;
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.movie-row-body {
  flex: 1;
  min-width: 0;
}

.movie-row-title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.movie-row-title strong {
  font-size: 0.8125rem;
  font-weight: 600;
}

.movie-row-path {
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.movie-row-actions {
  flex-shrink: 0;
}

/* Progress */
.progress {
  height: 0.375rem;
  background: hsl(var(--secondary));
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: hsl(var(--primary));
  transition: width 0.3s ease;
  border-radius: 9999px;
}

/* Job panel */
.job-panel {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 24rem;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}

.job-panel.visible {
  display: block;
}
.job-panel .card-content,
.job-panel {
  padding: 0.875rem 1rem;
}

.job-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.job-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}
.job-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.job-status-icon {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: hsl(var(--primary));
  flex-shrink: 0;
}

.job-panel.status-completed .job-status-icon {
  background: hsl(var(--success));
}
.job-panel.status-failed .job-status-icon {
  background: hsl(var(--destructive));
}
.job-panel.status-running .job-status-icon {
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.job-dismiss {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
}

.job-movie {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 0.5rem;
  line-height: 1.35;
}

.job-step {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.job-current {
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.375rem;
  font-style: italic;
}

body.job-running .movie-row-check {
  opacity: 0.45;
  pointer-events: none;
}

body.job-running .toolbar-option {
  opacity: 0.45;
  pointer-events: none;
}

.log-list {
  max-height: 6.5rem;
  overflow-y: auto;
  font-size: 0.6875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(var(--muted-foreground));
  margin-top: 0.5rem;
  line-height: 1.5;
}

.log-list div {
  padding: 0.0625rem 0;
}

/* Editor */
.editor-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.editor-page-header {
  flex-shrink: 0;
  padding: 0.625rem 1rem 0.5rem;
}

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-top {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 0.625rem;
  min-height: 0;
  padding: 0 1rem 0.625rem;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.editor-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.editor-preview-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  min-height: 0;
}

.editor-preview .video-wrap {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16/9;
}

.editor-timeline-dock {
  flex-shrink: 0;
  width: 100%;
  background: hsl(var(--background));
  border-top: 1px solid hsl(var(--border));
  padding: 0.625rem 1rem 0.75rem;
}

.timeline-dock-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.timeline-dock-toolbar .timeline-legend {
  margin-bottom: 0;
  flex: 1;
}

.timeline-dock-toolbar .timeline-zoom {
  margin-left: auto;
}

.timeline-dock-track {
  width: 100%;
  padding-top: 1.125rem;
}

.timeline-dock-track .timeline-ruler {
  margin-top: 0;
  color: hsl(var(--muted-foreground));
}

.timeline-dock-track .timeline-ruler-tick::before {
  background: hsl(var(--border));
}

.timeline-dock-track .timeline-track {
  margin: 0.25rem 0 0;
  border-radius: 4px;
  overflow: visible;
}

.clip-range-display {
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(210 80% 40%);
  background: hsl(210 80% 55% / 0.1);
  border: 1px solid hsl(210 80% 55% / 0.35);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.timeline-dock-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.625rem;
  flex-wrap: wrap;
}

.timeline-dock-footer .time-inputs {
  display: flex;
  gap: 0.75rem;
  flex: 1;
}

.timeline-dock-footer .time-inputs > div {
  flex: 1;
  min-width: 7rem;
  max-width: 10rem;
}

.timeline-dock-footer .timeline-actions {
  margin-top: 0;
  flex-shrink: 0;
}

.timeline-dock-footer .input {
  background: hsl(var(--background));
  border-color: hsl(var(--input));
  color: hsl(var(--foreground));
}

.editor-timeline-dock .timeline-header-left strong {
  color: hsl(var(--foreground));
  font-size: 0.8125rem;
}

.editor-timeline-dock .timeline-view-label {
  color: hsl(var(--muted-foreground));
}

.editor-timeline-dock .legend-item {
  color: hsl(var(--muted-foreground));
}

.editor-timeline-dock .btn-outline {
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
  background: hsl(var(--background));
}

.editor-timeline-dock .btn-outline:hover {
  background: hsl(var(--accent));
}

.clip-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.clip-item {
  padding: 0.6875rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  cursor: pointer;
  transition: background 0.12s;
}

.clip-item:hover {
  background: hsl(var(--muted) / 0.45);
}
.clip-item.active {
  background: hsl(var(--accent));
  border-left: 3px solid hsl(var(--primary));
  padding-left: calc(1rem - 3px);
}

.clip-item-title {
  font-weight: 500;
  font-size: 0.8125rem;
  line-height: 1.35;
}
.clip-item-meta {
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.1875rem;
}

.video-wrap {
  background: #0a0a0a;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  aspect-ratio: 16/9;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
}

.timeline-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-zoom {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.timeline-view-label {
  font-size: 0.6875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(var(--muted-foreground));
  min-width: 9rem;
  text-align: center;
}

.timeline-ruler {
  position: relative;
  height: 1.25rem;
  margin-top: 0.625rem;
  font-size: 0.625rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(var(--muted-foreground));
  user-select: none;
}

.timeline-ruler-tick {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-ruler-tick::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: 0.375rem;
  background: hsl(var(--border));
  transform: translateX(-50%);
}

.timeline-ruler-tick--clip {
  color: hsl(210 80% 40%);
  font-weight: 600;
}

.timeline-ruler-tick--clip::before {
  height: 0.625rem;
  width: 2px;
  background: hsl(210 80% 50%);
}

.timeline-track {
  position: relative;
  height: 5.5rem;
  background: hsl(var(--muted));
  border-radius: calc(var(--radius) - 2px);
  margin: 0.25rem 0 0.5rem;
  user-select: none;
  touch-action: none;
  overflow: visible;
  border: 1px solid hsl(var(--border));
  cursor: crosshair;
}

#timeline-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.timeline-shade {
  position: absolute;
  top: 0;
  height: 100%;
  background: hsl(var(--background) / 0.72);
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

.timeline-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: hsl(210 80% 55% / 0.18);
  border-left: 3px solid hsl(210 80% 50%);
  border-right: 3px solid hsl(210 80% 50%);
  border-top: 2px solid hsl(210 80% 55% / 0.5);
  border-bottom: 2px solid hsl(210 80% 55% / 0.5);
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 2px;
}

.timeline-clip-label {
  margin-top: 0.25rem;
  font-size: 0.625rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: hsl(210 80% 35%);
  background: hsl(0 0% 100% / 0.85);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.4;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: hsl(45 95% 55%);
  z-index: 4;
  margin-left: -1px;
  pointer-events: none;
  box-shadow: 0 0 6px hsl(45 95% 55% / 0.6);
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid hsl(45 95% 55%);
}

.timeline-handle {
  position: absolute;
  top: -4px;
  width: 16px;
  height: calc(100% + 8px);
  background: hsl(210 80% 50%);
  cursor: ew-resize;
  z-index: 5;
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 0 0 1px hsl(0 0% 100% / 0.5);
}

.timeline-handle:hover {
  background: hsl(210 80% 42%);
}

.timeline-handle.start::after,
.timeline-handle.end::after {
  content: attr(data-label);
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5625rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  background: hsl(210 80% 50%);
  color: hsl(0 0% 100%);
  padding: 0.0625rem 0.3125rem;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.handle-grip {
  width: 3px;
  height: 1.75rem;
  border-radius: 1px;
  background: hsl(0 0% 100% / 0.85);
  box-shadow:
    1px 0 0 hsl(0 0% 0% / 0.15),
    -1px 0 0 hsl(0 0% 0% / 0.15);
}

.handle-time {
  display: none;
}

.timeline-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
}

.legend-swatch {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 2px;
}

.legend-swatch--vocal {
  background: hsl(200 70% 55% / 0.7);
}
.legend-swatch--audio {
  background: hsl(280 60% 60% / 0.7);
}
.legend-swatch--range {
  background: hsl(210 80% 55% / 0.3);
  border: 1px solid hsl(210 80% 55%);
}
.legend-swatch--original {
  background: transparent;
  border-left: 2px dashed hsl(0 84% 55%);
  border-radius: 0;
  width: 0.375rem;
}

.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.625rem;
}

.time-inputs label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.1875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.timeline-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.transcript-panel {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0.5rem 0.75rem !important;
}

.transcript-line {
  display: flex;
  gap: 0.5rem;
  padding: 0.4375rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.transcript-line:last-child {
  border-bottom: none;
}

.transcript-line--in-clip {
  background: hsl(var(--primary) / 0.04);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 4px;
  border-bottom-color: transparent;
}

.transcript-time {
  flex-shrink: 0;
  width: 2.75rem;
  font-size: 0.625rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(var(--muted-foreground));
  padding-top: 0.125rem;
  line-height: 1.4;
}

.transcript-line-text {
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.5;
  min-width: 0;
}

.transcript-text {
  font-size: 0.8125rem;
  line-height: 1.6;
}

.transcript-word {
  display: inline;
  padding: 0.05em 0;
  border-radius: 2px;
  cursor: pointer;
}

.transcript-word:hover {
  background: hsl(var(--accent));
}

.transcript-word.in-clip {
  background: hsl(var(--primary) / 0.14);
  font-weight: 500;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}
.empty-state--compact {
  padding: 1.5rem 1rem;
  font-size: 0.8125rem;
}
.empty-state-hint {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
}
.empty-state code {
  font-size: 0.75rem;
  background: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  z-index: 200;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
  max-width: 90vw;
}

.toast.error {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.toast.visible {
  display: block;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    hsl(var(--muted)) 25%,
    hsl(var(--accent)) 50%,
    hsl(var(--muted)) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 4px;
  height: 2.5rem;
  margin: 0.5rem 1rem;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Cut preview modal */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.preview-modal.hidden {
  display: none !important;
}

.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(0 0% 0% / 0.55);
  backdrop-filter: blur(2px);
}

.preview-modal-dialog {
  position: relative;
  width: min(900px, 100%);
  max-height: 90vh;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.preview-modal-subtitle {
  display: block;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.125rem;
}

.preview-range-label {
  display: block;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.preview-modal-close {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.preview-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.preview-modal-video {
  background: #0a0a0a;
  flex-shrink: 0;
  position: relative;
}

.preview-modal-video video {
  width: 100%;
  display: block;
  max-height: 50vh;
}

.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0 0% 0% / 0.4);
  color: #fff;
}

.preview-loading .spinner {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
  border-color: hsl(0 0% 100% / 0.3);
  border-top-color: #fff;
}

/* Custom preview player */
.preview-player {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  background: hsl(220 14% 12%);
  border-top: 1px solid hsl(220 10% 22%);
  flex-shrink: 0;
}

.preview-play-btn {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: none;
  background: hsl(210 80% 55%);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.preview-play-btn:hover {
  background: hsl(210 80% 48%);
}

.preview-mini-btn {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(220 10% 28%);
  background: transparent;
  color: hsl(0 0% 80%);
  cursor: pointer;
}

.preview-mini-btn:hover {
  background: hsl(220 14% 18%);
  color: #fff;
}

.preview-time {
  font-size: 0.6875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: hsl(0 0% 75%);
  flex-shrink: 0;
  min-width: 2.75rem;
  text-align: center;
}

.preview-scrubber {
  position: relative;
  flex: 1;
  height: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.preview-scrubber::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  background: hsl(220 10% 28%);
  border-radius: 9999px;
}

.preview-scrubber-buffered {
  position: absolute;
  left: 0;
  height: 5px;
  width: 0;
  background: hsl(220 10% 40%);
  border-radius: 9999px;
}

.preview-scrubber-progress {
  position: absolute;
  left: 0;
  height: 5px;
  width: 0;
  background: hsl(210 80% 55%);
  border-radius: 9999px;
}

.preview-scrubber-handle {
  position: absolute;
  left: 0;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px hsl(0 0% 0% / 0.4);
  transform: translateX(-50%);
  pointer-events: none;
}

.preview-transcript {
  flex: 1;
  overflow-y: auto;
  min-height: 10rem;
  max-height: 28vh;
  padding: 0.625rem 1rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.25);
}

.preview-transcript .transcript-line {
  padding: 0.3125rem 0;
}

.preview-transcript .transcript-word {
  cursor: pointer;
}

.preview-transcript .transcript-word.playing {
  background: hsl(45 95% 55% / 0.45);
  font-weight: 600;
  border-radius: 2px;
}

body.preview-modal-open {
  overflow: hidden;
}

/* Spinner */
.spinner {
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid hsl(var(--border));
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.editor-recutting {
  cursor: wait;
}

body.editor-recutting .editor-top,
body.editor-recutting .timeline-dock-track {
  opacity: 0.55;
  pointer-events: none;
}

body.editor-recutting .timeline-actions .btn-primary {
  opacity: 1;
  pointer-events: auto;
  cursor: wait;
}

/* Utilities */
.hidden {
  display: none !important;
}
.icon {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .editor-page {
    height: auto;
    overflow: auto;
  }
  .editor-body {
    min-height: auto;
  }

  .editor-top {
    grid-template-columns: 1fr;
    flex: none;
  }

  .clip-list,
  .transcript-panel {
    max-height: 220px;
  }

  .editor-preview .video-wrap {
    max-height: 40vh;
  }

  .timeline-dock-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .timeline-dock-footer .time-inputs {
    flex-direction: column;
  }

  .timeline-dock-footer .time-inputs > div {
    max-width: none;
  }

  .toolbar-group--actions {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-group--search {
    min-width: 0;
  }
  .search-wrap {
    width: 100%;
  }
  .toolbar-divider {
    display: none;
  }
  .toolbar-group--drive-link {
    min-width: 0;
  }
  .job-panel {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
  .time-inputs {
    grid-template-columns: 1fr;
  }
}

/* ─── Google Drive controls ─────────────────────────────────────────────── */
.toolbar--drive {
  margin-bottom: 0.625rem;
}
.toolbar--movies {
  margin-bottom: 1.25rem;
}

.toolbar-divider {
  width: 1px;
  align-self: stretch;
  min-height: 1.75rem;
  background: hsl(var(--border));
}

.toolbar-group--drive-link {
  flex: 1;
  min-width: 280px;
  gap: 0.5rem;
}
.toolbar-group--drive-link .search-wrap {
  flex: 1;
  min-width: 220px;
}
.toolbar-group--drive-link .input-search {
  width: 100%;
}

.btn .icon {
  margin-right: 0.375rem;
  vertical-align: -2px;
}

#btn-drive-connect.drive-connected {
  border-color: hsl(142 70% 45%);
  color: hsl(142 70% 30%);
}

.drive-status {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0.75rem 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.5);
  font-size: 0.8125rem;
}
.import-banner--error {
  border-color: hsl(0 72% 51% / 0.5);
  background: hsl(0 72% 51% / 0.08);
  color: hsl(0 72% 40%);
}
.import-progress {
  flex: 1;
  min-width: 80px;
  height: 6px;
  border-radius: 999px;
  background: hsl(var(--border));
  overflow: hidden;
}
.import-progress-bar {
  height: 100%;
  width: 0;
  background: hsl(var(--primary));
  transition: width 0.3s ease;
}
.import-pct {
  font-variant-numeric: tabular-nums;
  color: hsl(var(--muted-foreground));
  min-width: 2.5rem;
  text-align: right;
}

/* Editor header with Drive actions */
.editor-page-header--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ─── Drive picker modal ─────────────────────────────────────────────────── */
body.drive-modal-open {
  overflow: hidden;
}
.drive-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.drive-modal.hidden {
  display: none;
}
.drive-modal-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(0 0% 0% / 0.5);
}
.drive-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 20px 50px hsl(0 0% 0% / 0.25);
  overflow: hidden;
}
.drive-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}
.drive-modal-toolbar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}
.drive-modal-toolbar .search-wrap {
  width: 100%;
}
.drive-modal-toolbar .input-search {
  width: 100%;
}
.drive-file-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.drive-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  cursor: pointer;
  transition: background 0.12s;
}
.drive-file-row:hover {
  background: hsl(var(--muted) / 0.5);
}
.drive-file-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.drive-file-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-file-meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.drive-modal-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid hsl(var(--border));
}
.drive-modal-hint {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.btn-remove-movie:hover {
  color: hsl(0 72% 45%);
  border-color: hsl(0 72% 45% / 0.4);
}
#drive-import-cancel {
  margin-left: 0.25rem;
}
