:root {
  --bg: #0b0b12;
  --bg-2: #11111b;
  --panel: #151521;
  --panel-2: #1b1b2a;
  --line: #262638;
  --line-2: #32324a;
  --text: #ececf4;
  --muted: #9a9ab3;
  --faint: #6b6b85;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #d946ef 55%, #ec4899 100%);
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, .12), transparent 60%),
              radial-gradient(900px 500px at 10% 110%, rgba(236, 72, 153, .08), transparent 60%), var(--bg);
  color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: inherit; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 16px; background: rgba(17, 17, 27, .85); border-right: 1px solid var(--line); backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(217, 70, 239, .35); }
.logo svg { fill: #fff; stroke: none; width: 18px; height: 18px; margin-left: 2px; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.brand-sub { color: var(--faint); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-weight: 500; transition: .15s;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(139, 92, 246, .18), rgba(236, 72, 153, .06)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.badge { margin-left: auto; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.system { margin-top: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.system-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; font-weight: 600; }
.sys-row { display: grid; grid-template-columns: 10px auto 1fr; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; color: var(--muted); }
.sys-row b { font-weight: 500; color: var(--text); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(34, 197, 94, .7); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }

.main { padding: 30px 36px 60px; min-width: 0; }
.view { animation: fade .25s ease; max-width: 1400px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.view-head h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.view-head p { margin: 0; color: var(--muted); max-width: 760px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* ---------- form ---------- */
.form { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.field output { color: var(--text); font-weight: 600; }
input[type=text], input[type=number], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px;
  padding: 10px 12px; font: inherit; outline: none; transition: .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: var(--line-2); outline: none; margin: 8px 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); cursor: pointer; }
.hint { color: var(--faint); font-size: 11.5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; flex: 1; white-space: nowrap; }
.seg button.active { background: var(--panel-2); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 2px 8px rgba(0, 0, 0, .3); }
#source-tabs { display: flex; }

.drop {
  border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 26px 16px; text-align: center; cursor: pointer;
  transition: .15s; background: rgba(139, 92, 246, .03); position: relative; overflow: hidden;
}
.drop svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 6px; }
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(139, 92, 246, .09); }
.drop-title { font-weight: 700; }
.drop-sub { color: var(--muted); font-size: 12.5px; }
.upload-bar { margin-top: 12px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.upload-bar div { height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.camp-drop { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: .15s; }
.camp-drop:hover, .camp-drop.over { border-color: var(--accent); background: rgba(139, 92, 246, .09); }
.camp-drop > svg { width: 28px; height: 28px; color: var(--accent); flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camp-drop > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.camp-drop small { color: var(--muted); font-size: 12px; line-height: 1.4; }
#camp-paste { margin-top: 8px; }
.camp-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.camp-card { margin-top: 10px; background: var(--bg); border: 1px solid rgba(139, 92, 246, .45); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.camp-card.warn { border-color: rgba(245, 158, 11, .5); color: var(--muted); display: block; }
.camp-card.loading { border-style: dashed; color: var(--muted); display: flex; flex-direction: row; align-items: center; gap: 8px; }
.camp-card label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.camp-card .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.camp-card .row-2 label { display: block; margin-bottom: 4px; }
.camp-preview { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.camp-preview .h { color: #93c5fd; }
.camp-head {display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.camp-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.camp-card ul { margin: 6px 0 0 18px; padding: 0; color: var(--muted); line-height: 1.5; }
.camp-card summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.file-chip {display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; font-size: 13px; }
.file-chip b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; }

.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.formats.small { grid-template-columns: repeat(2, 1fr); }
.formats button {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 8px; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font: inherit; transition: .15s;
}
.formats.small button { flex-direction: row; justify-content: center; gap: 10px; padding: 10px; }
.formats button small { color: var(--faint); font-size: 11px; }
.formats button:hover { border-color: var(--line-2); background: var(--panel-2); }
.formats button.active { border-color: var(--accent); background: rgba(139, 92, 246, .12); box-shadow: 0 0 0 3px rgba(139, 92, 246, .15); }
.ar { display: block; border: 2px solid currentColor; border-radius: 4px; color: var(--muted); }
.formats button.active .ar { color: var(--accent); }
.ar-916 { width: 16px; height: 28px; } .ar-11 { width: 22px; height: 22px; } .ar-169 { width: 30px; height: 17px; }

.toggles { display: flex; flex-direction: column; gap: 10px; }
.toggle { display: flex; gap: 12px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; transition: .15s; }
.toggle:hover { border-color: var(--line-2); }
.toggle input { display: none; }
.toggle .sw { width: 36px; height: 20px; border-radius: 99px; background: var(--line-2); position: relative; transition: .2s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked + .sw { background: var(--grad); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.toggle b { display: block; font-size: 13.5px; }
.toggle small { color: var(--faint); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.checks { justify-content: flex-end; gap: 10px; }
.advanced { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--bg); }
.advanced summary { cursor: pointer; padding: 11px 0; font-weight: 600; color: var(--muted); list-style: none; }
.advanced summary::before { content: "▸ "; color: var(--accent); }
.advanced[open] summary::before { content: "▾ "; }
.advanced[open] { padding-bottom: 14px; }
.voice-row { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.chips button:hover { color: #fff; border-color: var(--accent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); padding: 9px 15px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 24px rgba(217, 70, 239, .28); }
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.big { padding: 14px; font-size: 15px; }
.btn.ghost { background: transparent; }
.btn.danger { color: #fca5a5; border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .06); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 46px 30px; }
.empty-art { width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 18px; background: rgba(139, 92, 246, .12); display: grid; place-items: center; }
.empty-art svg { width: 32px; height: 32px; color: var(--accent); }
.empty h3 { margin: 0 0 6px; font-size: 18px; }
.empty p { color: var(--muted); max-width: 480px; margin: 0 auto 16px; }
.howto { text-align: left; display: inline-flex; flex-direction: column; gap: 6px; color: var(--muted); padding-left: 20px; margin: 0; }

/* ---------- job panel ---------- */
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.job-head h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-head .meta { color: var(--faint); font-size: 12px; }
.status { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.status.running { background: rgba(139, 92, 246, .16); color: #c4b5fd; }
.status.queued { background: rgba(255, 255, 255, .07); color: var(--muted); }
.status.done { background: rgba(34, 197, 94, .14); color: #86efac; }
.status.error { background: rgba(239, 68, 68, .14); color: #fca5a5; }
.status.cancelled { background: rgba(245, 158, 11, .12); color: #fcd34d; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.progress div { height: 100%; background: var(--grad); border-radius: 99px; transition: width .5s ease; position: relative; }
.progress.running div::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: shine 1.4s infinite; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
.steps { display: flex; gap: 6px; margin: 16px 0 12px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); background: var(--bg); border: 1px solid var(--line); padding: 5px 10px 5px 6px; border-radius: 99px; }
.step i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 700; background: var(--line); color: var(--muted); }
.step.done { color: var(--text); } .step.done i { background: var(--ok); color: #04210f; }
.step.active { color: #fff; border-color: var(--accent); } .step.active i { background: var(--grad); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(139, 92, 246, .25); } }
.job-msg { font-weight: 600; margin: 4px 0 8px; }
.log { background: #08080d; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 12px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; color: #a3a3c2; max-height: 190px; overflow: auto; white-space: pre-wrap; }
.job-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.error-box { background: rgba(239, 68, 68, .08); border: 1px solid rgba(239, 68, 68, .3); color: #fecaca; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }

/* ---------- results ---------- */
.results-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; }
.results-head h2 { margin: 0; font-size: 18px; }
.results { display: flex; flex-direction: column; gap: 14px; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.clip-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: .15s; }
.clip-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.clip-card video { width: 100%; background: #000; display: block; aspect-ratio: 9/16; object-fit: contain; }
.clip-card.wide video { aspect-ratio: 16/9; }
.clip-card.square video { aspect-ratio: 1/1; }
.clip-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.clip-title { font-weight: 700; line-height: 1.3; }
.clip-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.pill.score { background: rgba(139, 92, 246, .15); color: #ddd6fe; border-color: transparent; font-weight: 700; }
.clip-reason { color: var(--faint); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clip-tags { color: #a78bfa; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-actions { display: flex; gap: 6px; margin-top: auto; }
.clip-actions .btn { flex: 1; }

.gen-result { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 20px; }
.gen-video video { width: 100%; border-radius: 14px; background: #000; border: 1px solid var(--line); display: block; }
.gen-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gen-info h2 { margin: 0; font-size: 20px; }
.copy-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 160px; overflow: auto; }
.scenes { display: flex; flex-direction: column; gap: 8px; counter-reset: sc; }
.scene { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 40px; position: relative; font-size: 13px; }
.scene::before { counter-increment: sc; content: counter(sc); position: absolute; left: 10px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.scene small { display: block; color: var(--faint); margin-top: 4px; font-style: italic; }
.sources { display: flex; flex-direction: column; gap: 6px; }
.source { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.source:hover { color: #fff; border-color: var(--line-2); }
.source span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kind { font-size: 10.5px; text-transform: uppercase; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); color: var(--faint); flex: none; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 700; margin-bottom: 6px; }

/* ---------- jobs list ---------- */
.jobs-list { display: flex; flex-direction: column; gap: 10px; max-width: 1000px; }
.job-row { display: grid; grid-template-columns: 38px 1fr 220px auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.job-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(139, 92, 246, .12); color: var(--accent); }
.job-row h4 { margin: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .sub { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .progress { margin: 0; }

/* ---------- library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.lib-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: .15s; display: flex; flex-direction: column; }
.lib-item:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.lib-thumb { position: relative; aspect-ratio: 9/14; background: #000 center/cover no-repeat; }
.lib-thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .75); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.lib-thumb .kindtag { position: absolute; left: 8px; top: 8px; background: rgba(0, 0, 0, .65); font-size: 10.5px; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.lib-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: .15s; background: rgba(0, 0, 0, .25); }
.lib-item:hover .play { opacity: 1; }
.play span { width: 50px; height: 50px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; }
.play svg { fill: #fff; stroke: none; margin-left: 3px; }
.lib-body { padding: 10px 40px 10px 12px; position: relative; }
.lib-del { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--faint); cursor: pointer; }
.lib-del:hover { color: #fca5a5; background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); }
.lib-del svg { width: 15px; height: 15px; }
.lib-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-sub { color: var(--faint); font-size: 11.5px; }

/* ---------- nav extras ---------- */
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); font-weight: 700; padding: 14px 12px 4px; }
.nav .count { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 600; }
.nav a.active .count { color: #c4b5fd; }
.nav-live { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(236, 72, 153, .6); animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(236, 72, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); } }
.disk { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.disk-bar { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.disk-bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.disk small { color: var(--faint); font-size: 11px; display: block; margin-top: 5px; }

/* ---------- home ---------- */
.hero { margin: 6px 0 22px; }
.hero h1 { margin: 0 0 6px; font-size: 32px; font-weight: 800; letter-spacing: -.6px; background: linear-gradient(90deg, #fff, #ddd6fe 60%, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.create-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.create-card { position: relative; display: flex; gap: 16px; align-items: flex-start; text-decoration: none; padding: 22px; border-radius: 18px; border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(500px 200px at 100% 0%, rgba(139, 92, 246, .22), transparent 70%), linear-gradient(180deg, var(--panel), var(--bg-2)); transition: .2s; }
.create-card.alt { background: radial-gradient(500px 200px at 100% 0%, rgba(236, 72, 153, .2), transparent 70%), linear-gradient(180deg, var(--panel), var(--bg-2)); }
.create-card:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, .5); box-shadow: 0 14px 40px rgba(139, 92, 246, .18); }
.create-card h3 { margin: 2px 0 6px; font-size: 19px; }
.create-card p { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.cc-icon { width: 50px; height: 50px; border-radius: 14px; background: var(--grad); display: grid; place-items: center; flex: none; box-shadow: 0 8px 22px rgba(217, 70, 239, .3); }
.cc-icon svg { width: 24px; height: 24px; color: #fff; }
.cc-go { position: absolute; right: 20px; bottom: 16px; font-weight: 700; font-size: 13px; color: #ddd6fe; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; display: flex; flex-direction: column; transition: .15s; }
a.stat:hover { border-color: var(--line-2); }
.stat b { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat span { color: var(--text); font-weight: 600; font-size: 13px; }
.stat small { color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.active-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.active-job { display: grid; grid-template-columns: 38px 1fr auto; gap: 14px; align-items: center; text-decoration: none; background: var(--panel); border: 1px solid rgba(139, 92, 246, .35); border-radius: 12px; padding: 12px 14px; }
.aj-main { min-width: 0; } .aj-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-main small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-pct { font-weight: 800; color: #ddd6fe; }

/* ---------- media (clips / videos IA) ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; }
.search svg { color: var(--faint); width: 16px; height: 16px; }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 9px 0; width: 190px; }
.sm-select { width: auto; padding: 9px 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.media-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: .18s; display: flex; flex-direction: column; }
.media-card:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, .45); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.media-card.wide { grid-column: span 2; }
.mc-thumb { position: relative; aspect-ratio: 9/16; background: #000 center/cover no-repeat; overflow: hidden; }
.media-card.wide .mc-thumb { aspect-ratio: 16/9; }
.mc-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.media-card:hover .mc-thumb video { opacity: 1; }
.mc-thumb::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); pointer-events: none; }
.mc-dur, .mc-score, .mc-tag { position: absolute; z-index: 2; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .72); }
.mc-dur { right: 8px; bottom: 8px; }
.mc-score { left: 8px; bottom: 8px; color: #fde68a; }
.mc-tag { left: 8px; top: 8px; text-transform: uppercase; letter-spacing: .03em; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-tag.camp { background: rgba(139, 92, 246, .85); text-transform: none; }
.mc-actions { position: absolute; right: 8px; top: 8px; z-index: 3; display: flex; flex-direction: column; gap: 6px; opacity: 0; transform: translateX(6px); transition: .18s; }
.media-card:hover .mc-actions { opacity: 1; transform: none; }
.mc-btn { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(0, 0, 0, .7); border: 1px solid rgba(255, 255, 255, .12); color: #fff; cursor: pointer; backdrop-filter: blur(4px); }
.mc-btn svg { width: 15px; height: 15px; }
.mc-btn:hover { background: var(--accent); }
.mc-btn.danger:hover { background: var(--err); }
.mc-body { padding: 10px 12px 12px; }
.mc-title { font-weight: 700; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.mc-sub { color: var(--faint); font-size: 11.5px; margin-top: 3px; }
.group { background: linear-gradient(180deg, rgba(21, 21, 33, .7), transparent); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 18px; scroll-margin-top: 20px; }
.group.focus { border-color: rgba(139, 92, 246, .6); box-shadow: 0 0 0 3px rgba(139, 92, 246, .15); }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.group-info { min-width: 0; }
.group-info h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 640px; }
.group-sub { color: var(--faint); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.pill.camp { background: rgba(139, 92, 246, .16); color: #ddd6fe; border-color: transparent; }
.pill.link { text-decoration: none; } .pill.link:hover { color: #fff; border-color: var(--line-2); }
.btn.danger-text:hover { color: #fca5a5; border-color: rgba(239, 68, 68, .4); }

/* ---------- panel de trabajo: resultado ---------- */
.log-box summary { cursor: pointer; color: var(--faint); font-size: 12.5px; font-weight: 600; margin: 6px 0; }
.log-box[open] summary { margin-bottom: 8px; }
.done-box { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; background: rgba(34, 197, 94, .06); border: 1px solid rgba(34, 197, 94, .3); border-radius: 12px; padding: 14px; margin-top: 6px; }
.done-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.done-check { width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #04210f; display: grid; place-items: center; font-size: 14px; }
.done-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.done-thumb { width: 56px; aspect-ratio: 9/16; border-radius: 8px; background: #000 center/cover; border: 1px solid var(--line-2); transition: .15s; }
.done-thumb:hover { transform: translateY(-2px); border-color: var(--accent); }
.done-gen { display: flex; gap: 12px; align-items: center; }
.done-gen img { width: 64px; border-radius: 8px; border: 1px solid var(--line-2); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.steps-big { gap: 12px !important; padding-left: 22px !important; margin-bottom: 16px !important; }
.steps-big li { line-height: 1.45; } .steps-big b { color: var(--text); }

/* ---------- acceso remoto ---------- */
.remote-card { margin-bottom: 18px; max-width: 1400px; }
.remote-card h3 { margin: 0 0 4px; font-size: 16px; }
.remote-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.remote-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(34, 197, 94, .07); border: 1px solid rgba(34, 197, 94, .3); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.remote-url span { color: var(--muted); font-size: 13px; }
.remote-url a { font-weight: 700; color: #86efac; word-break: break-all; }
.r-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.r-step { display: flex; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.r-step > i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; background: var(--line); color: var(--muted); }
.r-step.ok > i { background: var(--ok); color: #04210f; }
.r-step > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.r-step b { font-size: 13px; }
.r-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.r-row input { flex: 1; min-width: 140px; }
.sm-toggle { padding: 0; border: 0; background: none; }
#logout { margin-top: 8px; }
body.is-remote [data-folder], body.is-remote #folder { display: none !important; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; max-width: 1400px; }
.settings .card h3 { margin: 0 0 14px; font-size: 15px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.set-grid .field.bool { flex-direction: row; align-items: center; gap: 10px; grid-column: span 2; }
.set-grid input[type=color] { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); padding: 4px; }
.field.changed > label { color: #ddd6fe; }
.field.changed input, .field.changed select { border-color: var(--accent); }

/* ---------- modal / toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(4, 4, 8, .78); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 18px; max-width: min(1000px, 96vw); max-height: 94vh; overflow: auto; position: relative; box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 12px; top: 10px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; z-index: 2; }
.modal video { max-height: 78vh; max-width: 100%; border-radius: 10px; display: block; margin: 0 auto 12px; background: #000; }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: fade .2s; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--err); }

@media (max-width: 1100px) {
  .grid-2, .gen-result { grid-template-columns: 1fr; }
  .form { position: static; }
  .job-row { grid-template-columns: 38px 1fr auto; } .job-row .progress-cell { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .create-cards { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .system { display: none; }
  .main { padding: 18px 16px 40px; }
  .row-3, .row-2, .set-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(2, 1fr); } .media-card.wide { grid-column: span 2; }
  .search input { width: 120px; }
  .settings { grid-template-columns: 1fr; }
}
