:root {
  --bg-void: #08090c;
  --bg-obsidian: #0f1117;
  --bg-panel: #151821;
  --bg-elevated: #1c202c;
  --bg-hover: #242938;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --gold: #d4af6a;
  --gold-bright: #ebd096;
  --gold-dim: rgba(212, 175, 106, 0.14);
  --gold-border: rgba(212, 175, 106, 0.36);
  --crimson: #e05353;
  --emerald: #3ec98c;
  --text: #f3efe6;
  --text-soft: #b8becb;
  --text-muted: #7c8496;
  --font-ui: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 10px;
  --radius-sm: 7px;
  --topbar-h: 56px;
  --rail-w: 68px;
  --inspector-w: 392px;
  --timeline-h: 176px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.mono-sm { font-family: var(--font-mono); font-size: 11.5px; }
.muted { color: var(--text-muted); }
.full { width: 100%; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mb-6 { margin-bottom: 6px; }

/* SCROLLBARS */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,106,0.45); }

/* APP SHELL */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  background:
    radial-gradient(900px 420px at 55% 0%, rgba(212, 175, 106, 0.06), transparent 60%),
    var(--bg-void);
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: rgba(15, 17, 23, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #272219, #15120d);
  border: 1px solid var(--gold-border);
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: 17px; letter-spacing: 0.04em;
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.brand-title { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
.brand-gold { color: var(--gold); }
.brand-sub { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }

.ratio-bar {
  display: flex;
  background: var(--bg-void);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.ratio-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text-soft);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.16s ease;
}
.ratio-btn small { font-size: 10px; font-weight: 400; color: var(--text-muted); }
.ratio-btn:hover { background: var(--bg-elevated); color: var(--text); }
.ratio-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold-border);
  color: var(--gold-bright);
}
.ratio-btn.active small { color: var(--gold); }
.ratio-ico {
  display: inline-block; border: 1.5px solid currentColor; border-radius: 2px;
}
.r-916 { width: 8px; height: 13px; }
.r-169 { width: 14px; height: 9px; }
.r-11  { width: 11px; height: 11px; }
.r-45  { width: 10px; height: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  background: var(--bg-panel); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-soft); white-space: nowrap;
}
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 106, 0.7);
}
.status-pill.connected .dot { background: var(--emerald); box-shadow: 0 0 8px rgba(62, 201, 140, 0.8); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated); color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: rgba(255,255,255,0.25); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs { padding: 5px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text); }
.btn-gold {
  background: linear-gradient(135deg, #d8b572, #b88c42);
  border-color: #e9cc8e;
  color: #14110b;
  box-shadow: 0 4px 16px rgba(212, 175, 106, 0.24);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-0.5px); }
.btn-gold-soft {
  background: var(--gold-dim);
  border-color: var(--gold-border);
  color: var(--gold-bright);
}
.btn-gold-soft:hover:not(:disabled) { background: rgba(212, 175, 106, 0.24); }
.btn-primary {
  background: #232a3b; border-color: rgba(132, 169, 255, 0.42); color: #dce8ff;
}
.btn-crimson {
  background: rgba(224, 83, 83, 0.18); border-color: rgba(224, 83, 83, 0.52); color: #ffadad;
}
.btn-crimson.recording {
  background: var(--crimson); color: #fff; animation: pulseRec 1.2s infinite;
}
@keyframes pulseRec { 0%,100% { box-shadow: 0 0 0 0 rgba(224,83,83,0.5); } 50% { box-shadow: 0 0 0 8px rgba(224,83,83,0); } }
.danger-hover:hover { border-color: rgba(224,83,83,0.5) !important; color: #ff9c9c !important; }
.file-btn { cursor: pointer; }

/* WORKSPACE GRID */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail-w) var(--inspector-w) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

/* LEFT RAIL */
.rail {
  background: var(--bg-obsidian);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  gap: 6px;
  overflow-y: auto;
}
.rail-btn {
  width: 56px;
  padding: 9px 4px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: inherit; font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease;
}
.rail-btn svg { width: 19px; height: 19px; }
.rail-btn:hover { background: var(--bg-panel); color: var(--text); }
.rail-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold-border);
  color: var(--gold-bright);
}

/* INSPECTOR */
.inspector {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px;
}
.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.16s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h2 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.panel-subhead {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 8px;
}
.badge, .badge-gold {
  font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px;
  background: var(--bg-elevated); border: 1px solid var(--line); color: var(--text-soft);
}
.badge-gold { background: var(--gold-dim); border-color: var(--gold-border); color: var(--gold-bright); }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* FORMS */
.field { margin-bottom: 9px; }
.field > label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-soft);
  margin-bottom: 5px;
}
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  background: var(--bg-obsidian);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit; font-size: 12.5px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s ease;
}
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
  border-color: var(--gold);
}
textarea { resize: vertical; line-height: 1.5; }
input[type="range"] {
  width: 100%; accent-color: var(--gold); cursor: pointer;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.subbox {
  background: rgba(8, 9, 12, 0.45);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px;
}
.scene-editor-box {
  background: rgba(212, 175, 106, 0.04);
  border: 1px solid rgba(212, 175, 106, 0.22);
  border-radius: var(--radius);
  padding: 11px;
}
.flow-card {
  background: linear-gradient(180deg, rgba(212,175,106,0.08), rgba(15,17,23,0.6));
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 11px;
}
.info-banner {
  background: rgba(212, 175, 106, 0.07);
  border: 1px solid rgba(212, 175, 106, 0.24);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 11.8px; color: var(--text-soft); line-height: 1.5;
}
.hint { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

/* VINHOMES PROJECT CHIPS & TEMPLATE CARDS */
.project-chips {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.proj-chip {
  text-align: left;
  padding: 7px 9px; border-radius: 8px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; transition: all 0.14s ease;
  font-family: inherit;
}
.proj-chip:hover { border-color: var(--gold-border); background: var(--bg-elevated); }
.proj-chip.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 175, 106, 0.28);
}
.proj-chip strong { display: block; font-size: 11.6px; font-weight: 700; color: var(--text); }
.proj-chip.active strong { color: var(--gold-bright); }
.proj-chip span { display: block; font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.template-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.tpl-card {
  text-align: left;
  padding: 9px 10px; border-radius: 8px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; transition: all 0.15s ease;
  font-family: inherit;
}
.tpl-card:hover { border-color: var(--gold-border); background: var(--bg-elevated); transform: translateY(-1px); }
.tpl-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold); }
.tpl-name { font-size: 12px; font-weight: 700; margin-top: 2px; }
.tpl-desc { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* SEGMENTED & CHIPS */
.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.seg-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.seg-btn {
  padding: 7px 6px; border-radius: 7px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text-soft); font-family: inherit; font-size: 11.3px; font-weight: 600;
  cursor: pointer; transition: all 0.14s ease; text-align: center;
}
.seg-btn:hover { color: var(--text); border-color: var(--line-strong); }
.seg-btn.active {
  background: var(--gold-dim); border-color: var(--gold-border); color: var(--gold-bright);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 4px 9px; border-radius: 99px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text-soft); font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.14s ease;
}
.chip.active { background: var(--gold-dim); border-color: var(--gold-border); color: var(--gold-bright); }

/* VOICE LIST */
.voice-list {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 245px; overflow-y: auto; padding-right: 3px;
}
.voice-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 9px; border-radius: 8px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  cursor: pointer; transition: all 0.14s ease; text-align: left;
  color: var(--text); font-family: inherit; width: 100%;
}
.voice-item-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.voice-play-mini {
  width: 26px; height: 24px; border-radius: 6px;
  background: var(--bg-panel); border: 1px solid var(--line-strong);
  color: var(--gold-bright); font-size: 11px; cursor: pointer;
  display: grid; place-items: center; transition: all 0.14s ease;
}
.voice-play-mini:hover { background: var(--gold-dim); border-color: var(--gold); }
.voice-item:hover { border-color: var(--line-strong); background: var(--bg-elevated); }
.voice-item.active {
  border-color: var(--gold); background: rgba(212, 175, 106, 0.11);
}
.voice-name { font-size: 12.2px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.voice-meta { font-size: 10.8px; color: var(--text-muted); margin-top: 1px; }
.voice-pill {
  font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 99px;
  background: rgba(255,255,255,0.06); color: var(--text-soft); flex-shrink: 0;
}
.voice-pill.cached { background: rgba(62,201,140,0.16); color: #7ef0bc; border: 1px solid rgba(62,201,140,0.35); }
.voice-pill.hot { background: var(--gold-dim); color: var(--gold-bright); }

/* AUDIO CHIP & PROGRESS */
.audio-chip {
  margin-top: 6px; padding: 6px 9px; border-radius: 6px;
  background: var(--bg-void); border: 1px dashed var(--line-strong);
  font-size: 11px; color: var(--text-muted);
}
.audio-chip.ready {
  border-style: solid; border-color: rgba(62, 201, 140, 0.4);
  color: #8df0c4; background: rgba(62, 201, 140, 0.08);
}

.progress-wrap { margin-top: 8px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--gold-bright); margin-bottom: 4px; }
.progress-bar { height: 6px; border-radius: 99px; background: var(--bg-void); overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width 0.2s ease; }

/* DROPZONE & MEDIA BIN */
.dropzone {
  border: 1.5px dashed var(--gold-border);
  border-radius: 9px;
  padding: 16px 12px;
  text-align: center;
  background: rgba(212, 175, 106, 0.04);
  cursor: pointer; transition: all 0.16s ease;
}
.dropzone.compact { padding: 12px 10px; }
.dropzone:hover, .dropzone.dragover {
  background: rgba(212, 175, 106, 0.12);
  border-color: var(--gold-bright);
}
.drop-ico { font-size: 22px; margin-bottom: 4px; }
.drop-title { font-size: 12px; font-weight: 700; color: var(--gold-bright); }
.drop-sub { font-size: 10.8px; color: var(--text-muted); margin-top: 3px; }

.asset-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.asset-chip {
  padding: 8px; border-radius: 8px; text-align: left;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; font-family: inherit;
  transition: all 0.14s ease;
}
.asset-chip:hover { border-color: var(--gold); background: var(--bg-elevated); }
.asset-chip strong { display: block; font-size: 11.5px; }
.asset-chip span { font-size: 10.2px; color: var(--gold); }

.media-bin {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  max-height: 150px; overflow-y: auto;
}
.empty-hint {
  grid-column: 1 / -1; padding: 12px; text-align: center;
  font-size: 11px; color: var(--text-muted);
  border: 1px dashed var(--line); border-radius: 7px;
}
.bin-item {
  position: relative; padding: 7px 8px; border-radius: 7px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  cursor: pointer; font-size: 11px; overflow: hidden;
}
.bin-item:hover { border-color: var(--gold); }
.bin-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bin-type { font-size: 10px; color: var(--gold); }

.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-soft); cursor: pointer;
}
.check-row input { accent-color: var(--gold); width: 14px; height: 14px; }

.clone-enroll-box {
  margin-top: 8px; padding: 10px; border-radius: 8px;
  background: rgba(255,255,255,0.025); border: 1px solid var(--line-strong);
}

.export-summary {
  padding: 8px 10px; border-radius: 7px; background: var(--bg-void);
  border: 1px solid var(--line); color: var(--gold-bright);
}

/* CENTER STAGE COLUMN */
.stage-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-void);
}

.stage-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 16px 8px;
}

.stage-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 6px; flex-shrink: 0;
}
.stage-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-soft); min-width: 0; flex-wrap: wrap; }
.stage-voice-picker { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.stage-voice-picker select {
  width: auto; max-width: 245px; padding: 4px 8px; font-size: 11.5px;
  background: var(--bg-panel); border-color: var(--gold-border); color: var(--gold-bright);
  font-weight: 600;
}
.safezone-select {
  width: auto !important; max-width: 185px; padding: 4px 8px !important;
  font-size: 11.5px !important; background: var(--bg-panel) !important;
}
.stage-options-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin-bottom: 8px; flex-shrink: 0;
}
.opt-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 99px;
  background: rgba(21, 24, 33, 0.9); border: 1px solid var(--line);
  color: var(--text-soft); font-size: 10.8px; font-family: inherit;
  cursor: pointer; transition: all 0.14s ease;
}
.opt-pill:hover { border-color: var(--gold-border); color: var(--gold-bright); }
.opt-pill b { color: var(--gold-bright); font-weight: 600; }
.opt-pill.ok { border-color: rgba(62,201,140,0.38); color: #9ff2cd; }
.status-pill { cursor: pointer; }
.stage-voice-banner {
  margin-bottom: 8px; padding: 7px 10px; border-radius: 8px;
  background: rgba(212, 175, 106, 0.1);
  border: 1px solid var(--gold-border);
  flex-shrink: 0;
}
.svb-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--gold-bright); margin-bottom: 5px;
}
.stage-controls { display: flex; align-items: center; gap: 10px; }

.vu-meter {
  width: 68px; height: 8px; border-radius: 99px;
  background: var(--bg-panel); border: 1px solid var(--line); overflow: hidden;
}
.vu-bar {
  height: 100%; width: 4%;
  background: linear-gradient(90deg, var(--emerald), var(--gold), var(--crimson));
  transition: width 0.06s linear;
}

.canvas-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.canvas-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 106, 0.28);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255,255,255,0.04);
  background: #050608;
}
.canvas-frame.r-169 { aspect-ratio: 16 / 9; width: min(100%, 920px); height: auto; max-height: 100%; }
.canvas-frame.r-11  { aspect-ratio: 1 / 1; height: 100%; width: auto; }
.canvas-frame.r-45  { aspect-ratio: 4 / 5; height: 100%; width: auto; }

#stageCanvas {
  width: 100%; height: 100%; display: block; object-fit: contain;
}

/* MULTI-PLATFORM SAFE ZONE OVERLAY */
.safe-zone {
  position: absolute; inset: 0; pointer-events: none;
  border: 2px dashed rgba(224, 83, 83, 0.65);
}
.safe-zone.sz-fb-reels, .safe-zone.sz-fb-feed { border-color: rgba(66, 153, 255, 0.72); }
.safe-zone.sz-yt-shorts, .safe-zone.sz-yt-169 { border-color: rgba(255, 76, 76, 0.72); }

.sz-zone {
  position: absolute;
  background: rgba(224, 83, 83, 0.18);
  border: 1px dashed rgba(224, 83, 83, 0.72);
  display: grid; place-items: center; text-align: center;
  font-size: 10px; font-weight: 700; color: #ffd2d2; padding: 2px 6px;
}
.sz-fb-reels .sz-zone, .sz-fb-feed .sz-zone {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.75);
  color: #cfe4ff;
}
.sz-yt-shorts .sz-zone, .sz-yt-169 .sz-zone {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.78);
  color: #ffd6d6;
}
.sz-safe-box {
  position: absolute;
  border: 1.5px dashed rgba(62, 201, 140, 0.8);
  background: rgba(62, 201, 140, 0.04);
}
.sz-safe-tag {
  position: absolute; top: 4px; left: 6px;
  font-size: 9.5px; font-weight: 700; color: #8ff2c6;
  background: rgba(8, 9, 12, 0.72); padding: 1px 6px; border-radius: 4px;
}
.sz-col {
  display: flex; flex-direction: column; align-items: center; justify-content: space-around;
  font-size: 12px;
}

/* TRANSPORT */
.transport {
  margin-top: 10px;
  display: flex; align-items: center; gap: 12px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--bg-panel); border: 1px solid var(--line);
  flex-shrink: 0;
}
.transport-left, .transport-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--bg-obsidian); border: 1px solid var(--line);
  color: var(--text-soft); cursor: pointer; font-size: 12px;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.play-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #dfbe7e, #b78b40);
  border: 1px solid #f0d79e; color: #141008;
  font-size: 13px; font-weight: 700; cursor: pointer;
  display: grid; place-items: center;
}
.play-btn:hover { filter: brightness(1.08); }
.timecode { font-size: 12px; color: var(--text); margin-left: 4px; white-space: nowrap; }
.scrubber-wrap { flex: 1; display: flex; align-items: center; }

/* BOTTOM MULTI-TRACK TIMELINE */
.timeline-dock {
  height: var(--timeline-h);
  background: var(--bg-obsidian);
  border-top: 1px solid var(--line);
  padding: 8px 14px 10px;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.tl-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px;
}
.tl-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--gold); }
.tl-hint { font-size: 11px; }

.tl-tracks {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}
.tl-card {
  min-width: 178px; max-width: 210px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 9px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; transition: all 0.14s ease;
  position: relative;
}
.tl-card:hover { border-color: var(--line-strong); background: var(--bg-elevated); }
.tl-card.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212,175,106,0.13), rgba(21,24,33,0.95));
  box-shadow: 0 0 0 1px rgba(212,175,106,0.28);
}
.tl-card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tl-num {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  color: var(--gold-bright); background: var(--gold-dim);
  padding: 1px 6px; border-radius: 4px;
}
.tl-dur { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.tl-headline {
  font-size: 11.8px; font-weight: 700; color: var(--text);
  margin: 5px 0 3px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.tl-script {
  font-size: 10.5px; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.35;
}
.tl-badges {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line);
}
.tl-pills { display: flex; gap: 4px; }
.tl-dot {
  font-size: 9.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,0.06); color: var(--text-soft);
}
.tl-dot.ok { background: rgba(62,201,140,0.16); color: #83efc0; }
.tl-move { display: flex; gap: 3px; }
.tl-move button {
  width: 20px; height: 18px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--bg-void); color: var(--text-soft); font-size: 9px; cursor: pointer;
}
.tl-move button:hover { border-color: var(--gold); color: var(--gold-bright); }

/* TOASTS */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  padding: 10px 13px; border-radius: 9px;
  background: rgba(21, 24, 33, 0.96);
  border: 1px solid var(--gold-border);
  color: var(--text); font-size: 12.2px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  animation: slideToast 0.2s ease;
}
.toast.err { border-color: rgba(224,83,83,0.65); color: #ffc7c7; }
.toast.ok  { border-color: rgba(62,201,140,0.55); color: #bdf5dc; }
@keyframes slideToast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* RESPONSIVE TABLET & MOBILE */
@media (max-width: 1080px) {
  :root { --inspector-w: 340px; }
  .ratio-btn small { display: none; }
  .brand-sub { display: none; }
}

@media (max-width: 820px) {
  html, body { overflow: auto; }
  .app-shell { height: auto; min-height: 100dvh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  .ratio-bar { order: 3; width: 100%; justify-content: space-between; }
  .ratio-btn { flex: 1; justify-content: center; padding: 6px 4px; }
  .status-pill { display: none; }
  .stage-voice-picker select { max-width: 175px; }
  .safezone-select { max-width: 155px; }

  .workspace {
    display: flex; flex-direction: column;
    overflow: visible;
  }
  .stage-column { order: 1; }
  .stage-area { padding: 8px 10px; }
  .canvas-viewport { height: 52vh; min-height: 320px; }
  .timeline-dock { height: 158px; }

  .rail {
    order: 2;
    flex-direction: row; justify-content: space-around;
    width: 100%; border-right: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 6px 4px; position: sticky; top: 0; z-index: 15;
  }
  .rail-btn { width: auto; flex: 1; padding: 7px 2px; }
  .inspector {
    order: 3; width: 100%; border-right: none;
    overflow: visible; padding: 12px 12px 36px;
  }
}
