/* ==========================================================================
   LinguaReel Studio — Frame.io V4 Media Asset Browser, Discovery & Episode Bin
   ========================================================================== */

.output-folder-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #F59E0B;
  border-radius: 10px;
  background: #16161C;
}
.output-folder-picker > div { min-width: 0; display: grid; gap: 3px; }
.output-folder-picker span {
  color: #F59E0B;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.output-folder-picker strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.output-folder-picker small {
  color: #A1A1AA;
  font-size: 10.5px;
  line-height: 1.4;
}
.output-folder-picker button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.14);
  color: #FFD700;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.output-folder-picker button:hover {
  background: #F59E0B;
  border-color: #FFD700;
  color: #09090B;
}
.output-folder-picker button:disabled { opacity: 0.55; cursor: wait; }

.demucs-diagnostic {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-color: rgba(255, 255, 255, 0.08);
  background: #16161C;
}
.demucs-diagnostic > div { min-width: 0; display: grid; gap: 4px; }
.demucs-diagnostic progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: #F59E0B;
}
.demucs-diagnostic progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.08); }
.demucs-diagnostic progress::-webkit-progress-value { background: linear-gradient(90deg, #F59E0B, #10B981); }
.demucs-diagnostic button,
.cuda-diagnostic button {
  padding: 7px 11px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.14);
  color: #FFD700;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.demucs-diagnostic button:hover,
.cuda-diagnostic button:hover {
  background: #F59E0B;
  border-color: #FFD700;
  color: #09090B;
}
.demucs-diagnostic button:disabled,
.cuda-diagnostic button:disabled { opacity: 0.55; cursor: wait; }
.demucs-ready { color: #34D399; font-size: 9.5px; letter-spacing: 0.08em; }

.cuda-diagnostic {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-color: rgba(255, 255, 255, 0.08);
  background: #16161C;
}
.cuda-diagnostic > div { min-width: 0; display: grid; gap: 4px; }
.cuda-diagnostic progress { width: 100%; height: 5px; border: 0; accent-color: #F59E0B; }
.runtime-cpu { color: #A1A1AA; font-size: 9.5px; letter-spacing: 0.08em; }

/* Recent Searches Bar */
.recent-searches {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}
.recent-searches > span { flex: 0 0 auto; font-weight: 700; color: var(--soft); }
.recent-searches > div { display: flex; flex: 1; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.recent-searches button {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.recent-searches button:hover {
  border-color: rgba(99, 91, 255, 0.45);
  background: rgba(99, 91, 255, 0.12);
  color: #ffffff;
}
.recent-searches .recent-search-clear {
  margin-left: auto;
  border-color: transparent;
  background: none;
  color: var(--soft);
}

/* ==========================================================================
   1. FRAME.IO V4 4-COLUMN ASSET BROWSER GRID (.discovery-board, .discovery-card)
   ========================================================================== */

.discovery-board {
  position: relative;
  margin-top: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.discovery-head,
.f4-asset-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 2px 2px;
}

.f4-asset-count-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.f4-section-caret {
  color: #8b92a8;
  font-size: 12px;
}

.discovery-head h4,
.f4-asset-count-line h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #eef0f6;
}

.f4-asset-storage,
#discoveryKicker {
  color: #7d8498;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* Frame.io V4 Sub-Toolbar Segmented Control Tabs */
.discovery-tabs {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 2px;
  border: 1px solid #262936;
  border-radius: 6px;
  background: #0e1015;
}
.discovery-tabs button {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #8b92a8;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.12s ease;
}
.discovery-tabs button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}
.discovery-tabs button:focus-visible {
  outline: 2px solid var(--indigo-bright);
  outline-offset: 1px;
}
.discovery-tabs button.active {
  color: #ffffff;
  background: #232634;
  border-color: #34394d;
}

.f4-nav-arrows {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.discovery-nav {
  position: static;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #262936;
  border-radius: 5px;
  background: #181a22;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
}
.discovery-nav:hover:not(:disabled) {
  border-color: #3b4054;
  color: #ffffff;
}
.discovery-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.discovery-carousel {
  position: relative;
}

/* Frame.io V4 Dynamic 3..10 Column 9:16 Vertical Asset Grid */
.discovery-track,
.film-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 12px;
  overflow: visible;
  padding: 0;
  transition: gap 0.14s ease;
}

.app-shell[data-grid-cols="3"] .discovery-track,
.app-shell[data-grid-cols="3"] .film-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

.app-shell[data-grid-cols="4"] .discovery-track,
.app-shell[data-grid-cols="4"] .film-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

.app-shell[data-grid-cols="5"] .discovery-track,
.app-shell[data-grid-cols="5"] .film-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.app-shell[data-grid-cols="6"] .discovery-track,
.app-shell[data-grid-cols="6"] .film-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 11px !important;
}

.app-shell[data-grid-cols="7"] .discovery-track,
.app-shell[data-grid-cols="7"] .film-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.app-shell[data-grid-cols="8"] .discovery-track,
.app-shell[data-grid-cols="8"] .film-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  gap: 9px !important;
}

.app-shell[data-grid-cols="9"] .discovery-track,
.app-shell[data-grid-cols="9"] .film-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.app-shell[data-grid-cols="10"] .discovery-track,
.app-shell[data-grid-cols="10"] .film-grid {
  grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
  gap: 7px !important;
}

/* Frame.io V4 9:16 Vertical Episode Card (.discovery-card & .film-card) */
.discovery-card,
.film-card {
  position: relative;
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: #16161c;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.discovery-card:hover,
.discovery-card:focus-visible,
.film-card:hover,
.film-card:focus-visible {
  outline: none;
  background: #1c1c24;
  border-color: rgba(245, 158, 11, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(245, 158, 11, 0.22);
}

/* Vibrant Neon Gold Glow for Active RTX Rendering or Selected Cards */
.discovery-card.is-rendering,
.film-card.is-rendering {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.38), 0 0 22px rgba(245, 158, 11, 0.25);
}

.discovery-card.is-selected,
.film-card.is-selected,
.discovery-card.is-inspecting,
.film-card.is-inspecting {
  border-color: #ffd700;
  background: #1a1922;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.5), 0 8px 24px rgba(245, 158, 11, 0.22);
}

/* 9:16 Vertical Video Frame Inside Asset Card */
.discovery-card-art,
.poster-art {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  margin: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.discovery-card-art::after,
.poster-art::after {
  content: "";
  position: absolute;
  inset: 52% 0 0;
  background: linear-gradient(180deg, transparent, rgba(9, 9, 11, 0.88));
  pointer-events: none;
}

.artwork-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(245, 158, 11, 0.18), transparent 45%),
    #0d0d12;
}

.artwork-shell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  opacity: 0;
  transform: scale(1.01);
  transition: opacity 0.25s ease, transform 0.35s ease;
}

.artwork-shell.loaded img {
  opacity: 1;
}

.discovery-card:hover .artwork-shell img,
.film-card:hover .artwork-shell img {
  transform: scale(1.04);
}

.artwork-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 25%, rgba(245, 158, 11, 0.22), transparent 55%),
    linear-gradient(180deg, #171620 0%, #09090b 100%);
}
.artwork-fallback span {
  position: static !important;
  z-index: 1;
  padding: 0 !important;
  background: none !important;
  color: rgba(255, 215, 0, 0.72) !important;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 24px !important;
  line-height: 1;
}
.artwork-fallback small {
  z-index: 1;
  margin-top: 4px;
  color: #f59e0b;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.artwork-glow {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 28px rgba(4, 6, 10, 0.45);
  pointer-events: none;
}

/* Top-Left Multi-Select Checkbox & Top-Right QA Score Badge */
.f4-card-check {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 5;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: blur(4px);
  color: transparent;
  transition: all 0.12s ease;
}

.f4-card-check .lucide-icon {
  width: 11px;
  height: 11px;
}

.discovery-card:hover .f4-card-check,
.film-card:hover .f4-card-check {
  border-color: #ffd700;
}

.discovery-card.is-selected .f4-card-check,
.film-card.is-selected .f4-card-check {
  border-color: #ffd700;
  background: linear-gradient(135deg, #f59e0b, #ffd700);
  color: #09090b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}

.f4-qa-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
}

.f4-qa-badge .lucide-icon {
  width: 10px;
  height: 10px;
}

.f4-qa-badge.is-gpu {
  background: linear-gradient(135deg, #f59e0b, #ffd700);
  color: #09090b;
  border: 1px solid #ffd700;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.f4-qa-badge.is-ok {
  background: rgba(9, 9, 11, 0.85);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.f4-qa-badge.is-warn {
  background: rgba(9, 9, 11, 0.88);
  color: #ffd700;
  border: 1px solid rgba(245, 158, 11, 0.55);
}

.discovery-country,
.poster-art .card-index {
  display: none;
}

.discovery-season,
.poster-art .card-season-badge {
  position: absolute;
  bottom: 7px;
  left: 7px;
  top: auto;
  right: auto;
  z-index: 4;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(9, 9, 11, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
}

.discovery-rank {
  position: absolute;
  top: 7px;
  left: 29px;
  z-index: 4;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.92);
  color: #09090b;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
}

.discovery-episodes,
.poster-art .episode-pill {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: auto;
  top: auto;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(9, 9, 11, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f4f4f6;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.episode-pill b {
  color: #ffd700;
  font-size: 9.5px;
}

/* Card Copy & JetBrains Mono Metadata Pills Row Beneath Each Card */
.discovery-card-copy,
.film-card-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 2px 1px 0;
  border: 0;
}

.f4-card-title-row,
.film-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.f4-card-title-row > strong,
.film-card-title > strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f4f4f6;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.f4-ep-mono {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.f4-metadata-pills {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.f4-meta-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: 2.5px;
  padding: 2px 4.5px;
  border-radius: 4px;
  background: #111115;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d4d4d8;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.f4-meta-pill.is-gold {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.38);
  color: #ffd700;
}

.f4-meta-pill.is-ok {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.38);
  color: #34d399;
}

.f4-meta-pill.is-warn {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(255, 215, 0, 0.55);
  color: #ffd700;
}

/* Inner Recessed Casting Box */
.f4-card-field-box {
  margin-top: 2px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #111115;
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.f4-field-label {
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

.f4-field-value {
  display: flex;
  align-items: center;
  min-width: 0;
}

.f4-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.f4-role-pill.role-coloring {
  background: rgba(245, 158, 11, 0.18);
  color: #ffd700;
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.f4-role-pill.role-social {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.f4-role-pill.role-retouching {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.f4-role-pill.role-vfx {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.38);
}

/* High-Density Compact Adjustments for 8..10 Cards Per Row */
.app-shell[data-grid-cols="8"] .f4-card-field-box,
.app-shell[data-grid-cols="9"] .f4-card-field-box,
.app-shell[data-grid-cols="10"] .f4-card-field-box,
.app-shell[data-grid-cols="8"] .f4-ep-mono,
.app-shell[data-grid-cols="9"] .f4-ep-mono,
.app-shell[data-grid-cols="10"] .f4-ep-mono {
  display: none;
}

.app-shell[data-grid-cols="8"] .discovery-card,
.app-shell[data-grid-cols="9"] .discovery-card,
.app-shell[data-grid-cols="10"] .discovery-card {
  padding: 5px;
  gap: 5px;
}

.discovery-skeleton {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: #16161c;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.discovery-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.05) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: discovery-shimmer 1.3s infinite;
}
@keyframes discovery-shimmer { to { transform: translateX(100%); } }

.discovery-message {
  grid-column: 1 / -1;
  display: grid;
  place-content: center;
  gap: 6px;
  min-height: 200px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.discovery-message strong { color: #eef0f6; font-size: 14px; }
.discovery-message button {
  justify-self: center;
  margin-top: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.16);
  color: #e0e7ff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Search Summary Header Above Search Results Grid */
.search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.search-summary > div { display: flex; align-items: center; gap: 10px; }
.search-summary span {
  color: #818cf8;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.search-summary strong { font-size: 13.5px; color: #eef0f6; }
.search-summary > small,
.search-summary-actions > small { color: var(--muted); font-size: 11px; }
.search-summary > small i { color: var(--cyan); font-style: normal; margin-left: 4px; }
.search-summary-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(250, 204, 21, 0.38);
  background: rgba(250, 204, 21, 0.12);
  color: #fde047;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.search-reset-btn:hover {
  background: rgba(250, 204, 21, 0.22);
  border-color: rgba(250, 204, 21, 0.65);
  color: #ffffff;
  transform: translateY(-1px);
}
.search-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 4px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}
.search-clear-btn.hidden {
  display: none !important;
}

.f4-trans-chip {
  font-weight: 500;
  font-size: 11px;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.film-grid {
  margin-bottom: 24px;
}

/* ==========================================================================
   3. NLE EPISODE BIN & 2-COLUMN INSPECTOR (.selected-film, .episode-list)
   ========================================================================== */

.selected-film {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 15px;
  min-height: 118px;
  padding: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, rgba(99, 91, 255, 0.16), transparent 40%),
    linear-gradient(125deg, #151928, #0f121d);
  border: 1px solid rgba(99, 91, 255, 0.3);
  border-radius: 11px;
}
.selected-film .selected-artwork {
  height: 98px;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
.selected-film-copy { align-self: center; min-width: 0; padding-right: 8px; }
.selected-film-copy .selected-kicker {
  margin: 0 0 4px;
  color: #a5b4fc;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.selected-film-copy > strong {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-film-copy > p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.selected-film-copy > div { display: flex; gap: 12px; flex-wrap: wrap; }
.selected-film-copy > div span { margin: 0; color: #cbd5e1; font-size: 10.5px; font-variant-numeric: tabular-nums; }

.production-grid {
  align-items: start;
}
.selection-panel {
  align-self: start;
}

@media (min-width: 1151px) {
  .production-grid {
    grid-template-columns: minmax(0, 1.38fr) minmax(370px, 0.85fr);
  }
  .selection-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .selection-panel > .episode-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 540px;
  }
  .launch-panel {
    position: sticky;
    top: 80px;
  }
}

.episode-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 420px;
}

.episode-item {
  position: relative;
  min-height: 54px;
  gap: 9px;
  padding: 8px 10px 8px 8px;
  background: #131622;
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: all 0.16s ease;
}
.episode-item:hover {
  background: #181c2b;
  border-color: rgba(99, 91, 255, 0.4);
  transform: translateY(-1px);
}
.episode-item:has(input:checked) {
  border-color: rgba(99, 91, 255, 0.55);
  background: linear-gradient(125deg, rgba(99, 91, 255, 0.18), rgba(56, 189, 248, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.episode-item input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.episode-check {
  display: grid !important;
  place-items: center;
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.25);
  color: transparent !important;
  font-size: 10px !important;
  font-weight: 800;
  transition: all 0.15s ease;
}
.episode-item input:checked + .episode-check {
  border-color: var(--indigo);
  background: var(--indigo);
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(99, 91, 255, 0.45);
}
.episode-number {
  display: block !important;
  flex: 0 0 auto;
  width: 32px;
  margin: 0 !important;
  color: var(--soft) !important;
  font-family: var(--font-mono);
  font-size: 8px !important;
  line-height: 1.1;
  text-align: center;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.episode-number b {
  color: #f1f5f9;
  font-size: 13.5px;
  letter-spacing: 0;
}
.episode-copy {
  display: grid !important;
  gap: 2px;
  min-width: 0;
  margin: 0 !important;
}
.episode-copy strong {
  font-size: 11px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-copy small {
  color: var(--muted);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}
.episode-item > i {
  margin-left: auto;
  color: var(--soft);
  font-size: 10px;
  font-style: normal;
}
.episode-item:has(input:checked) > i { color: var(--cyan); }

.episode-item.episode-locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(244, 63, 94, 0.05);
  border-color: rgba(244, 63, 94, 0.2);
}
.episode-item.episode-locked:hover {
  background: rgba(244, 63, 94, 0.07);
  border-color: rgba(244, 63, 94, 0.28);
  transform: none;
}
.episode-item.episode-locked .episode-check {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.35);
}
.episode-item.episode-locked .episode-copy small { color: #fda4af; }
.episode-item.episode-locked > i { color: #9f1239; }

.progress-native {
  display: block;
  width: 100%;
  border: 0;
  appearance: none;
}
.progress-native::-webkit-progress-bar { background: rgba(255, 255, 255, 0.06); }
.progress-native::-webkit-progress-value {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
  box-shadow: 0 0 14px rgba(99, 91, 255, 0.35);
}
.progress-native::-moz-progress-bar {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
}

/* ==========================================================================
   4. VOICE MODE, CAST REVIEW & TIMECODE DIALOGUE FEED
   ========================================================================== */

.voice-mode-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 13px;
  border: 1px solid rgba(99, 91, 255, 0.28);
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.09), rgba(56, 189, 248, 0.04));
}
.voice-mode-panel > label:first-child { display: grid; gap: 6px; }
.voice-mode-panel > label:first-child > span { color: #cbd5e1; font-size: 11.5px; font-weight: 700; }
.voice-mode-panel select {
  width: 100%;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0b0d14;
  color: var(--text);
  font-size: 12px;
}

.clone-consent { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.clone-consent input {
  width: 17px;
  min-width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--indigo);
}
.clone-consent > span { display: grid; flex: 1 1 auto; min-width: 0; gap: 3px; }
.clone-consent strong { color: #f1f5f9; font-size: 11.5px; line-height: 1.45; }
.clone-consent small { color: var(--muted); font-size: 10.5px; line-height: 1.5; }

.job-card-side { display: grid; justify-items: end; gap: 8px; }
.job-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.job-card-actions button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.job-card-actions button:hover {
  border-color: rgba(99, 91, 255, 0.45);
  background: rgba(99, 91, 255, 0.14);
  color: #ffffff;
}
.job-card-actions button.primary {
  border-color: rgba(99, 91, 255, 0.45);
  background: rgba(99, 91, 255, 0.18);
  color: #e0e7ff;
}
.job-card.review-required {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: inset 3px 0 0 #f59e0b;
}
.job-status.review_required {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

.dialogue-viewer { display: grid; gap: 14px; padding-right: 5px; }
.dialogue-episode { display: grid; gap: 6px; }
.dialogue-episode h4 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #151928;
  border: 1px solid var(--line);
  color: var(--cyan);
  font-size: 11.5px;
}
.dialogue-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}
.dialogue-row time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.dialogue-row > div { display: grid; gap: 4px; min-width: 0; }
.dialogue-row span { color: #a5b4fc; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.dialogue-row p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.dialogue-row strong { color: #f8fafc; font-size: 12.5px; line-height: 1.5; }
.dialogue-empty { padding: 24px; color: var(--muted); text-align: center; }

.cast-review-title { margin-bottom: 14px; }
.cast-review-banner {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
}
.cast-review-banner strong { color: #fbbf24; font-size: 12px; }
.cast-review-banner span { color: #cbd5e1; font-size: 11px; line-height: 1.5; }
.cast-review-banner.complete {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}
.cast-review-banner.complete strong { color: #34d399; }
.cast-review-viewer { max-height: none; overflow: visible; }
.cast-review-episode { gap: 10px; }

.cast-speaker {
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 11px;
  background: #0d1019;
}
.cast-speaker.reviewed { border-color: rgba(99, 91, 255, 0.3); }
.cast-speaker-head {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) minmax(360px, 1.8fr);
  gap: 14px;
  padding: 13px;
  align-items: center;
}
.cast-speaker-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cast-avatar-box {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.2), rgba(56, 189, 248, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.cast-lock-icon {
  position: absolute;
  bottom: -3px;
  right: -3px;
  font-size: 10px;
  background: #0c101b;
  border: 1px solid rgba(99, 91, 255, 0.45);
  border-radius: 50%;
  padding: 1px 3px;
  line-height: 1;
}
.cast-header-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cast-status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cast-status-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cast-status-pill.status-ok {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.32);
}
.cast-status-pill.status-warn {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.32);
}
.cast-voice-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(99, 91, 255, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(99, 91, 255, 0.32);
}
.cast-line-count { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cast-speaker-title {
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cast-speaker-desc { color: var(--muted); font-size: 10.5px; }
.cast-speaker-desc code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  color: #cbd5e1;
}
.cast-speaker.reviewed .cast-status-pill { color: #34d399; }
.cast-speaker-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: end;
  gap: 8px;
}
.cast-speaker-fields label { display: grid; gap: 5px; min-width: 0; }
.cast-speaker-fields label > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.cast-speaker-fields select,
.cast-speaker-fields button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101420;
  color: #f1f5f9;
  font-size: 11px;
}
.cast-speaker-fields button {
  border-color: rgba(99, 91, 255, 0.45);
  background: rgba(99, 91, 255, 0.18);
  color: #e0e7ff;
  font-weight: 700;
  cursor: pointer;
}
.cast-speaker-fields button:hover:not(:disabled) {
  background: var(--indigo);
  color: #ffffff;
}
.cast-speaker-fields button:disabled,
.cast-speaker-fields select:disabled { opacity: 0.5; cursor: not-allowed; }
.cast-dialogue-samples { display: grid; gap: 8px; padding: 0 12px 12px; }

/* Enhanced Dialogue Row Styles */
.enhanced-dialogue-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #121623;
  transition: border-color 0.16s, background 0.16s;
}
.enhanced-dialogue-row:hover {
  border-color: rgba(99, 91, 255, 0.38);
  background: #161b2b;
}
.dialogue-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.dialogue-speaker-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.dialogue-speaker-pill .d-avatar { font-size: 13px; line-height: 1; }
.dialogue-speaker-pill .d-name { font-size: 11px; font-weight: 700; color: var(--cyan); }
.dialogue-meta-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.d-badge { font-size: 9.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; }
.d-time {
  font-family: var(--font-mono);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.24);
  font-variant-numeric: tabular-nums;
}
.d-emotion {
  background: rgba(124, 102, 255, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(124, 102, 255, 0.26);
}
.d-profile {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid var(--line);
}
.d-voice {
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.28);
}
.dialogue-row-content { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.dialogue-source-line, .dialogue-target-line { display: flex; align-items: baseline; gap: 8px; }
.d-flag { font-size: 12px; opacity: 0.85; flex-shrink: 0; user-select: none; }
.d-src-text { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.d-trans-text { margin: 0; color: #f8fafc; font-size: 12.5px; font-weight: 600; line-height: 1.55; }

.cast-review-actions {
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding-top: 12px;
  background: linear-gradient(transparent, #11141f 28%);
}
.cast-review-actions button:disabled { opacity: 0.45; cursor: not-allowed; }

.video-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}
.video-picker a {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid rgba(99, 91, 255, 0.25);
  border-radius: 10px;
  background: rgba(99, 91, 255, 0.07);
  color: inherit;
  text-decoration: none;
  transition: all 0.16s ease;
}
.video-picker a:hover {
  border-color: var(--indigo);
  background: rgba(99, 91, 255, 0.14);
  transform: translateY(-2px);
}
.video-picker a > span { color: var(--cyan); }
.video-picker a strong { font-size: 12.5px; color: #ffffff; }
.video-picker a small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Selection Film Column & Seasons Selector Panel */
.selection-film-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}
.selection-film-col > .selected-film { margin-bottom: 0; }
.selection-film-col > .series-seasons-panel { margin: 0; }

.series-seasons-panel {
  margin: 0;
  padding: 12px 14px 14px;
  border-radius: 11px;
  background: linear-gradient(180deg, #141826, #0f121d);
  border: 1px solid rgba(99, 91, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.seasons-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.seasons-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
}
.seasons-icon { font-size: 15px; }
.seasons-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 91, 255, 0.16);
  border: 1px solid rgba(99, 91, 255, 0.35);
  color: #c7d2fe;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.seasons-panel-hint { color: var(--muted); font-size: 11px; }
.seasons-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.season-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}
.season-pill-btn:hover {
  background: rgba(99, 91, 255, 0.15);
  border-color: rgba(99, 91, 255, 0.45);
  color: #ffffff;
}
.season-pill-btn.active {
  background: linear-gradient(135deg, var(--indigo), #3b82f6);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99, 91, 255, 0.4);
}
.season-pill-btn .season-pill-episodes {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 6px;
  border-radius: 4px;
}
.season-pill-btn.active .season-pill-episodes {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 700;
}
.season-pill-btn .season-pill-tag {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

@media (max-width: 1360px) {
  .discovery-track,
  .film-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .discovery-track,
  .film-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .discovery-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .discovery-tabs { width: 100%; overflow-x: auto; }
  .discovery-tabs button { flex: 1; }
  .discovery-nav { display: none; }
  .search-summary { align-items: flex-start; }
  .search-summary > small { display: none; }
  .episode-list { grid-template-columns: 1fr; }
  .selected-film { grid-template-columns: 76px 1fr; }
  .selected-film .selected-artwork { height: 96px; }
  .job-card-side { justify-items: stretch; }
  .job-card-actions { justify-content: flex-start; }
  .dialogue-row { grid-template-columns: 1fr; }
  .cast-speaker-head { grid-template-columns: 1fr; }
  .cast-speaker-fields { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .discovery-track,
  .film-grid {
    grid-template-columns: 1fr;
  }
  .selected-film { grid-template-columns: 66px 1fr; gap: 12px; }
  .selected-film .selected-artwork { height: 88px; }
  .selected-film-copy > p { display: none; }
}
