:root {
  color-scheme: dark;
  --bg-base: #0f0f0f;
  --bg-surface: #181818;
  --bg-elevated: #212121;
  --bg-hover: #2a2a2a;
  --bg-input: #121212;
  --border: #2e2e2e;
  --border-strong: #3f3f3f;
  --text-primary: #f1f5f9;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #ff3b5c;
  --accent-hover: #ff5470;
  --accent-soft: rgba(255, 59, 92, 0.14);
  --studio-blue: #38bdf8;
  --studio-blue-soft: rgba(56, 189, 248, 0.14);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.16);
  --amber: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
  --font-sans: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-mono: Consolas, "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.12rem 0.38rem;
  border-radius: 5px;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* =========================================================
   BUTTONS & INPUTS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.52rem 0.92rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-sm {
  padding: 0.36rem 0.68rem;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 0.22rem 0.52rem;
  font-size: 0.76rem;
}

.btn-block {
  width: 100%;
  padding: 0.68rem 1rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-accent {
  background: linear-gradient(135deg, #ff3b5c, #e11d48);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 59, 92, 0.25);
}

.btn-accent:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-accent-outline {
  background: var(--accent-soft);
  border-color: rgba(255, 59, 92, 0.42);
  color: #ff8da1;
}

.btn-accent-outline:hover:not(:disabled),
.btn-accent-outline.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

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

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.ghost-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.ghost-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.76rem;
  font-weight: 700;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.58rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--studio-blue);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mt-sm {
  margin-top: 0.75rem;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 2.5rem;
}

.password-input-wrap .ghost-icon-btn {
  position: absolute;
  right: 4px;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

/* =========================================================
   LOGIN GATE
   ========================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(circle at top, rgba(255, 59, 92, 0.12), transparent 48%), var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand {
  margin-bottom: 1.4rem;
}

.brand-logo {
  flex-shrink: 0;
  border-radius: 10px;
}

.brand-title-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.login-footer {
  margin-top: 1.25rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =========================================================
   TOP STUDIO HEADER & DISK INDICATOR
   ========================================================= */
.studio-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 4.5rem;
}

.studio-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(15, 15, 15, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.25rem;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
}

.disk-widget {
  min-width: 255px;
  max-width: 340px;
  flex: 1 1 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.48rem 0.75rem;
}

.disk-widget-top,
.disk-widget-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
}

.disk-label {
  font-weight: 700;
  color: var(--studio-blue);
}

.disk-numbers {
  font-weight: 600;
  color: var(--text-primary);
}

.disk-widget-sub {
  color: var(--text-muted);
  margin-top: 0.22rem;
}

.disk-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #2b2b2b;
  overflow: hidden;
  margin-top: 0.3rem;
}

.disk-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald), var(--studio-blue));
  transition: width 0.3s ease;
}

.disk-bar-fill.is-warn {
  background: linear-gradient(90deg, var(--amber), #f97316);
}

.disk-bar-fill.is-danger {
  background: linear-gradient(90deg, #f97316, var(--danger));
}

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

.header-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 300px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.88rem;
  pointer-events: none;
  opacity: 0.7;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 2.1rem 0.5rem 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
}

.search-box input:focus {
  border-color: var(--studio-blue);
  background: var(--bg-input);
}

.clear-search-btn {
  position: absolute;
  right: 0.55rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.4rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.filter-pill.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #0f0f0f;
}

.pill-count {
  font-size: 0.74rem;
  opacity: 0.8;
}

.results-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* =========================================================
   MAIN WORKSPACE & THEATRE PLAYER
   ========================================================= */
.studio-main {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.studio-banner {
  margin-bottom: 0.25rem;
}

.theatre-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.theatre-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.theatre-heading-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-width: 0;
}

.theatre-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.theatre-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 1rem;
  align-items: start;
}

.theatre-player-col {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}

.video-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  background: #000;
  border-radius: var(--radius-md);
  border: 1px solid #262626;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CRITICAL: Preserve original aspect ratio (16:9 or 9:16) without cropping */
.studio-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
}

.player-controls-strip,
.trim-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.speed-control,
.trim-bar-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.strip-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 0.2rem;
}

.speed-btn {
  padding: 0.24rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.speed-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.speed-btn.is-active {
  background: var(--studio-blue-soft);
  border-color: var(--studio-blue);
  color: var(--studio-blue);
}

.theatre-specs {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.trim-range-badge {
  padding: 0.24rem 0.62rem;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.trim-range-badge.has-trim {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.theatre-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theatre-details-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.detail-group-info {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--studio-blue);
}

.detail-summary {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.vm-path-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.vm-path-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.vm-path-code {
  flex: 1 1 auto;
  overflow-x: auto;
  font-size: 0.76rem;
  color: #cbd5e1;
}

/* =========================================================
   TRANSCRIPT PANEL
   ========================================================= */
.transcript-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 640px;
  overflow: hidden;
}

.transcript-header {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.transcript-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.transcript-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.autoscroll-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.transcript-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cue-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cue-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.cue-item.is-active {
  background: var(--studio-blue-soft);
  border-color: rgba(56, 189, 248, 0.45);
}

.cue-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--studio-blue);
  padding-top: 0.1rem;
}

.cue-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
  unicode-bidi: plaintext;
}

.empty-transcript {
  padding: 1.2rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  white-space: pre-wrap;
}

/* =========================================================
   GROUPS & CLIP CARDS
   ========================================================= */
.groups-container {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.group-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.group-section.is-collapsed .group-header {
  border-bottom-color: transparent;
}

.group-section.is-collapsed .group-grid {
  display: none;
}

.group-title-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 280px;
}

.collapse-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.group-section.is-collapsed .collapse-btn {
  transform: rotate(-90deg);
}

.group-title-text {
  min-width: 0;
}

.group-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.group-meta-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.group-speaker {
  color: var(--studio-blue);
  font-weight: 600;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.group-grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.95rem;
}

.clip-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.clip-card:hover {
  border-color: var(--border-strong);
}

.clip-card.is-playing {
  border-color: var(--studio-blue);
  box-shadow: 0 0 0 1px var(--studio-blue);
}

.clip-card.is-selected {
  border-color: rgba(255, 59, 92, 0.75);
}

.clip-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0b0b;
  overflow: hidden;
  cursor: pointer;
}

.clip-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.clip-thumb-wrap:hover .clip-thumb-img {
  transform: scale(1.03);
}

.thumb-top-left {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}

.batch-check-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(15, 15, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.batch-check-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.52rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-original {
  background: rgba(56, 189, 248, 0.9);
  color: #082f49;
}

.badge-ready {
  background: rgba(16, 185, 129, 0.92);
  color: #022c22;
}

.thumb-bottom-right {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 2;
}

.thumb-bottom-left {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 2;
}

.dark-chip {
  padding: 0.14rem 0.45rem;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.82);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
}

.trim-chip {
  background: rgba(245, 158, 11, 0.92);
  color: #1c1917;
}

.clip-body {
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.clip-title-btn {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clip-title-btn:hover {
  color: var(--studio-blue);
}

.clip-summary {
  margin: 0;
  font-size: 0.81rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
}

.clip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.clip-footer-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* =========================================================
   STATE CARDS & FLOATING BATCH BAR
   ========================================================= */
.state-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.4rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

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

.floating-batch-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 35;
  width: min(720px, calc(100vw - 1.5rem));
  background: rgba(24, 24, 24, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 59, 92, 0.5);
  border-radius: var(--radius-md);
  padding: 0.68rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.floating-batch-info {
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
}

.floating-batch-info span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.floating-batch-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* =========================================================
   MODALS & PROMPT BUILDER DRAWER
   ========================================================= */
.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.confirm-message {
  margin: 0;
  color: var(--text-primary);
}

.confirm-detail-box {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.drawer-backdrop {
  justify-content: flex-end;
  padding: 0;
}

.prompt-drawer {
  width: min(760px, 100vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.drawer-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.drawer-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.drawer-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.builder-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.builder-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.builder-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.builder-section-head h3 {
  margin: 0;
}

.builder-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.builder-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.builder-clips-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 260px;
  overflow-y: auto;
}

.builder-clip-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.builder-clip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.builder-clip-title {
  font-weight: 700;
  font-size: 0.85rem;
}

.builder-clip-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.builder-clip-note {
  width: 100%;
  padding: 0.42rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 0.8rem;
}

.checkbox-grid,
.radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.55rem;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.6rem 0.72rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.check-card:hover {
  border-color: var(--border-strong);
}

.check-card input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check-card strong {
  display: block;
  font-size: 0.83rem;
}

.check-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.check-card-highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.prompt-preview-textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b0b0b;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.5;
  resize: vertical;
}

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  background: #1f2937;
  border: 1px solid var(--border-strong);
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.6);
  background: #064e3b;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.6);
  background: #7f1d1d;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */
@media (max-width: 1080px) {
  .theatre-grid {
    grid-template-columns: 1fr;
  }

  .transcript-panel {
    max-height: 320px;
  }
}

@media (max-width: 768px) {
  .studio-header {
    position: static;
  }
}

@media (max-width: 680px) {
  .studio-header {
    position: static;
    padding: 0.7rem 0.85rem;
  }

  .studio-main {
    padding: 0.85rem;
  }

  .disk-widget {
    min-width: 100%;
    order: 3;
  }

  .results-counter {
    width: 100%;
    margin-left: 0;
  }

  .group-grid {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  .drawer-body,
  .drawer-header,
  .drawer-footer {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}
