:root {
  --bg: #0a0c0f; --panel: #11141a; --panel2: #161a21; --line: #232933; --line2: #2e3542;
  --text: #e9ebef; --muted: #8d95a3; --dim: #5d6573;
  --accent: #c7f25c; --accent-ink: #141a05; --accent-soft: rgba(199, 242, 92, .12);
  --ok: #5ad19a; --warn: #f0b952; --err: #f0736a; --info: #7db4ff;
  --r: 12px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; margin: 0 0 18px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.01em; }
h3 { font-size: 12px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }
.hide { display: none !important; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; height: 64px; padding: 0 26px; background: rgba(10, 12, 15, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; }
.top nav { margin-left: auto; display: flex; gap: 4px; }
.top nav a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.top nav a:hover { color: var(--text); }
.top nav a.on { color: var(--text); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2); }
.iconbtn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { color: var(--text); border-color: var(--dim); }

.page { padding: 28px 26px 60px; max-width: 1560px; margin: 0 auto; }
.narrow { max-width: 1060px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; background: #0d1014; border: 1px solid var(--line2); border-radius: 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
label.f { display: block; } label.f > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; } .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; } .check input { width: 16px; height: 16px; accent-color: var(--accent); }

.pills { display: inline-flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); flex-wrap: wrap; }
.pills a, .pills button { padding: 7px 16px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 550; }
.pills .on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
.chip:hover { color: var(--text); } .chip.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.chip b { font-weight: 600; color: var(--dim); margin-right: 6px; font-family: var(--mono); font-size: 11.5px; }
.chip.on b { color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card.tight { padding: 12px 14px; }
.empty { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .03em; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: rgba(90, 209, 154, .35); } .tag.warn { color: var(--warn); border-color: rgba(240, 185, 82, .35); }
.tag.err { color: var(--err); border-color: rgba(240, 115, 106, .4); } .tag.info { color: var(--info); border-color: rgba(125, 180, 255, .35); }
.tag.acc { color: var(--accent); border-color: rgba(199, 242, 92, .4); }
.bar { height: 6px; border-radius: 999px; background: #1b2028; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.bar.multi { display: flex; } .bar.multi > i { border-radius: 0; }

/* create */
.steps { display: flex; justify-content: center; gap: 26px; margin: 6px 0 26px; color: var(--dim); font-weight: 550; }
.steps span { display: inline-flex; align-items: center; gap: 9px; } .steps b { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--line2); }
.steps .on { color: var(--text); } .steps .on b { background: var(--accent); color: var(--accent-ink); border-color: transparent; } .steps .done { color: var(--muted); cursor: pointer; }
.hero { text-align: center; font-size: 30px; letter-spacing: -.02em; margin: 0 0 22px; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.style { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column; transition: transform .12s, border-color .12s; }
.style:hover { border-color: var(--dim); transform: translateY(-2px); }
.style.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.style.off { opacity: .5; cursor: not-allowed; } .style.off:hover { transform: none; border-color: var(--line); }
.style .ph { aspect-ratio: 16 / 9; background: #0d1014 center / cover no-repeat; position: relative; }
.style .ph .tag { position: absolute; left: 8px; top: 8px; background: rgba(10, 12, 15, .82); }
.style .ph .tag.r { left: auto; right: 8px; }
.style .bd { padding: 11px 13px 13px; } .style .nm { font-weight: 650; } .style .ln { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sticky-foot { position: sticky; bottom: 0; margin-top: 22px; padding: 14px 18px; background: rgba(17, 20, 26, .95); backdrop-filter: blur(8px); border: 1px solid var(--line2); border-radius: var(--r); display: flex; align-items: center; gap: 14px; z-index: 5; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; } .stats b { color: var(--text); font-weight: 650; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.note { padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(240, 185, 82, .35); background: rgba(240, 185, 82, .07); color: #f3d59b; }
.note.err { border-color: rgba(240, 115, 106, .4); background: rgba(240, 115, 106, .08); color: #f6b3ad; }
.note.ok { border-color: rgba(90, 209, 154, .35); background: rgba(90, 209, 154, .07); color: #a9e6c9; }

/* library */
.vid { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.vid + .vid { margin-top: 10px; }
.vid .th { aspect-ratio: 16 / 9; border-radius: 8px; background: #0d1014 center / cover no-repeat; border: 1px solid var(--line); }
.vid .ti { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vid .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.side { position: sticky; top: 88px; }
.logbox { height: 430px; overflow: auto; background: #0b0d11; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.logbox.tall { height: calc(100vh - 330px); min-height: 340px; }
.logbox div { white-space: pre-wrap; word-break: break-word; } .logbox time { color: var(--dim); margin-right: 8px; }
.lv-warn { color: var(--warn); } .lv-error { color: var(--err); } .lv-debug { color: var(--dim); } .lv-info { color: #c9cfd8; }
.lane { margin-bottom: 14px; } .lane .hd { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }

/* job */
.scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.scene { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); cursor: pointer; padding: 0; text-align: left; }
.scene:hover { border-color: var(--dim); }
.scene .ph { aspect-ratio: 16 / 9; background: #0d1014 center / cover no-repeat; position: relative; display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.scene .ft { padding: 7px 9px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; gap: 6px; }
.player { width: 100%; border-radius: var(--r); background: #000; border: 1px solid var(--line); max-height: 62vh; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); border-left: 1px solid var(--line2); z-index: 40; padding: 22px; overflow: auto; box-shadow: -30px 0 60px rgba(0, 0, 0, .5); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 39; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, .6); padding: 20px; }
.modal > .card { width: min(560px, 100%); max-height: 90vh; overflow: auto; }

/* settings */
.chain { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: stretch; }
.leg { min-width: 250px; max-width: 250px; border: 1px solid var(--line2); border-radius: var(--r); padding: 14px; background: var(--panel2); }
.leg .n { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line2); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; margin-right: 8px; }
.tasks { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }
.tasks .list button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.tasks .list button.on { border-color: var(--line2); background: var(--panel2); color: var(--accent); }
@media (max-width: 860px) { .tasks { grid-template-columns: 1fr; } }
.prov { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.prov + .prov { margin-top: 8px; }
table.t { width: 100%; border-collapse: collapse; } table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; } table.t td { padding: 9px 10px; border-top: 1px solid var(--line); }

/* login + toasts */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 15px; border-radius: 10px; background: #1b2028; border: 1px solid var(--line2); max-width: 420px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { border-color: rgba(240, 115, 106, .5); } .toast.ok { border-color: rgba(90, 209, 154, .45); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
