/* ═══════════════════════════════════════════════════════════════
   CineScript — Volcanic Glass Design System
   Palette: #1A1A1A · #333333 · #FF6B2B · #FFB088
   Fonts: Clash Display · Newsreader · Space Mono
═══════════════════════════════════════════════════════════════ */

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Volcanic Glass palette */
  --bg-base:        #0E0E0E;
  --bg-surface:     #1A1A1A;
  --bg-elevated:    #242424;
  --bg-hover:       #2E2E2E;
  --border:         #333333;
  --border-subtle:  #222222;

  /* Orange ember accents */
  --accent:         #FF6B2B;
  --accent-dim:     #CC4E18;
  --accent-glow:    rgba(255, 107, 43, 0.18);
  --accent-soft:    #FFB088;

  /* Text */
  --text-primary:   #F0EBE3;
  --text-secondary: #9A9080;
  --text-muted:     #5A5248;
  --text-inverse:   #0E0E0E;

  /* Status */
  --status-queued:     #6B8CFF;
  --status-processing: #FF6B2B;
  --status-stitching:  #FFD166;
  --status-completed:  #06D6A0;
  --status-failed:     #EF476F;
  --status-cancelled:  #5A5248;

  /* Typography */
  --font-display: 'Clash Display', sans-serif;
  --font-body:    'Newsreader', Georgia, serif;
  --font-mono:    'Space Mono', 'Courier New', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;

  /* Layout */
  --header-h:  56px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  200ms;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ─── HEADER ────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(14, 14, 14, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: 100%;
  padding: 0 var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  color: var(--accent);
  font-size: 14px;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 8px var(--accent-glow); }
  50%       { text-shadow: 0 0 20px rgba(255,107,43,0.5); }
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.nav-btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 16px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.nav-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.nav-btn.active {
  color: var(--text-inverse);
  background: var(--accent);
  font-weight: 600;
}

.header-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.ws-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--dur);
}

.ws-indicator.connected    { background: var(--status-completed); box-shadow: 0 0 6px rgba(6,214,160,0.5); }
.ws-indicator.disconnected { background: var(--status-failed); }
.ws-indicator.connecting   { background: var(--status-queued); animation: blink 1.2s ease-in-out infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.ws-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── MAIN LAYOUT ───────────────────────────────────────────── */
.app-main {
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; }

/* ─── COMPOSE LAYOUT ────────────────────────────────────────── */
.compose-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

/* ─── PANELS ────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: var(--space-lg);
  gap: var(--space-md);
}

.panel-editor {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.panel-preview {
  background: var(--bg-base);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-actions {
  display: flex;
  gap: var(--space-xs);
}

/* ─── FORM FIELDS ───────────────────────────────────────────── */
.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.field-row--grow {
  flex: 1;
  min-height: 0;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-input,
.field-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A5248' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.field-input:focus,
.field-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-input::placeholder { color: var(--text-muted); }

/* Script textarea */
.script-editor {
  flex: 1;
  min-height: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  padding: var(--space-md);
  resize: none;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  width: 100%;
}

.script-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.script-editor::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.script-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

/* Settings grid */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-md);
  flex-shrink: 0;
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 12px 24px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255,107,43,0.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary.loading .btn-label::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: var(--text-inverse);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

.btn-generate { width: 100%; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--dur);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm { font-size: 11px; padding: 4px 10px; }
.btn-xs { font-size: 10px; padding: 3px 8px; }

/* ─── PREVIEW PANEL STATES ──────────────────────────────────── */
.preview-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  color: var(--text-muted);
}

.idle-icon {
  font-size: 48px;
  opacity: 0.4;
  filter: grayscale(1);
}

.idle-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  text-align: center;
  line-height: 1.7;
  color: var(--text-muted);
}

.idle-text strong { color: var(--accent); font-style: normal; }

/* ─── PROGRESS ──────────────────────────────────────────────── */
.preview-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow: hidden;
  min-height: 0;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.progress-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-soft);
}

.progress-pct {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.progress-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-soft));
  border-radius: 2px;
  transition: width 0.4s var(--ease);
  width: 0%;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,176,136,0.6));
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── CHUNK GRID (film-strip) ───────────────────────────────── */
.chunk-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  min-height: 52px;
}

.chunk-cell {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  position: relative;
  transition: all 0.3s var(--ease);
  cursor: default;
  overflow: hidden;
}

.chunk-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.chunk-cell[data-status="pending"]    { border-color: var(--border); }
.chunk-cell[data-status="processing"] {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: chunk-pulse 1s ease-in-out infinite;
}
.chunk-cell[data-status="completed"]  {
  border-color: var(--status-completed);
  background: rgba(6,214,160,0.08);
  color: var(--status-completed);
}
.chunk-cell[data-status="failed"]     {
  border-color: var(--status-failed);
  background: rgba(239,71,111,0.08);
  color: var(--status-failed);
}

@keyframes chunk-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--accent-glow); }
  50%       { box-shadow: 0 0 16px rgba(255,107,43,0.4); }
}

/* ─── LOG STREAM ────────────────────────────────────────────── */
.log-stream {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.log-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.log-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.log-entries {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-sm);
  animation: log-in 0.15s ease-out;
}

@keyframes log-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

.log-entry .log-time { color: var(--text-muted); flex-shrink: 0; }
.log-entry.log-info  .log-msg { color: var(--text-secondary); }
.log-entry.log-ok    .log-msg { color: var(--status-completed); }
.log-entry.log-warn  .log-msg { color: var(--status-stitching); }
.log-entry.log-error .log-msg { color: var(--status-failed); }
.log-entry.log-accent .log-msg { color: var(--accent-soft); }

/* ─── VIDEO PLAYER ──────────────────────────────────────────── */
.preview-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 0;
}

.video-player {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #000;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  outline: none;
  display: block;
}

.video-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.video-meta span { display: flex; gap: 4px; align-items: center; }
.video-meta strong { color: var(--text-secondary); }

/* ─── JOBS VIEW ─────────────────────────────────────────────── */
.jobs-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-lg);
  gap: var(--space-lg);
  overflow: hidden;
}

.jobs-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.jobs-filters {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all var(--dur);
  text-transform: uppercase;
}

.filter-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.filter-btn.active { color: var(--accent); background: var(--accent-glow); }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: var(--space-md);
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  min-width: 72px;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Job list */
.job-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 0;
}

.job-list-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  color: var(--text-muted);
}

.empty-icon { font-size: 40px; opacity: 0.3; filter: grayscale(1); }

.job-list-empty p {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: var(--text-muted);
}

/* Job card */
.job-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  animation: card-in 0.2s ease-out;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.job-card:hover {
  border-color: var(--border);
  background: var(--bg-elevated);
  transform: translateX(2px);
}

.job-card.hidden { display: none; }

.job-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.job-status-dot[data-status="queued"]     { background: var(--status-queued); }
.job-status-dot[data-status="processing"] { background: var(--accent); animation: blink 1s ease-in-out infinite; }
.job-status-dot[data-status="stitching"]  { background: var(--status-stitching); animation: blink 1s ease-in-out infinite; }
.job-status-dot[data-status="completed"]  { background: var(--status-completed); }
.job-status-dot[data-status="failed"]     { background: var(--status-failed); }
.job-status-dot[data-status="cancelled"]  { background: var(--status-cancelled); }

.job-info { min-width: 0; }

.job-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.job-progress-mini {
  width: 80px;
  flex-shrink: 0;
}

.job-progress-mini-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.job-progress-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

.job-progress-mini-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 3px;
}

.job-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ─── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.2s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--dur);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Modal detail rows */
.detail-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.detail-key {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
  padding-top: 2px;
}

.detail-val {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-all;
}

.detail-val.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail-val.script-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  width: 100%;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
}

.status-badge[data-status="queued"]     { background: rgba(107,140,255,0.15); color: var(--status-queued); }
.status-badge[data-status="processing"] { background: var(--accent-glow); color: var(--accent); }
.status-badge[data-status="stitching"]  { background: rgba(255,209,102,0.15); color: var(--status-stitching); }
.status-badge[data-status="completed"]  { background: rgba(6,214,160,0.12); color: var(--status-completed); }
.status-badge[data-status="failed"]     { background: rgba(239,71,111,0.12); color: var(--status-failed); }
.status-badge[data-status="cancelled"]  { background: rgba(90,82,72,0.2); color: var(--status-cancelled); }

/* ─── TOAST ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease);
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--status-completed); }
.toast.error   { border-left: 3px solid var(--status-failed); }
.toast.info    { border-left: 3px solid var(--status-queued); }
.toast.warning { border-left: 3px solid var(--status-stitching); }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .compose-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .panel {
    height: auto;
    min-height: 60vh;
  }

  .panel-editor { border-right: none; border-bottom: 1px solid var(--border-subtle); }

  .settings-grid { grid-template-columns: 1fr 1fr; }

  .stats-bar { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 var(--space-md); gap: var(--space-md); }
  .logo-text { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .jobs-header { flex-direction: column; align-items: flex-start; }
  .stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); }
}