:root {
  --bg: #0e0f13;
  --panel: #16181e;
  --panel-2: #1d2028;
  --line: #2a2e38;
  --text: #ecedf1;
  --muted: #9aa0ad;
  --accent: #ff7a45;
  --accent-2: #ffb547;
  --ok: #3ccf91;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 8px; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); }
.sidebar nav a span { width: 18px; text-align: center; }
.sidebar nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar nav a.active { background: rgba(255, 122, 69, .14); color: var(--text); }
.badge { margin-left: auto; font-style: normal; font-size: 12px; background: var(--accent); color: #111;
  border-radius: 99px; padding: 0 8px; font-weight: 700; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand.big { font-size: 22px; justify-content: center; margin-bottom: 8px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  position: relative; flex: none; }
.logo::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 11px solid #fff;
  border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.view { padding: 34px 40px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }

/* cards & forms */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], input[type=password], select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 11px 13px; font: inherit; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 122, 69, .5); border-color: transparent; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel-2); padding: 6px 12px; border-radius: 99px;
  cursor: pointer; font-size: 13px; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(255, 122, 69, .12); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 4px 0 12px; }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }

.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: #3a3f4c; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #16120e; border: 0; }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }

/* stepper */
.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.steps button { flex: 1; min-width: 120px; background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  border-radius: 12px; padding: 12px; font: inherit; cursor: pointer; text-align: left; }
.steps button b { display: block; color: var(--text); font-size: 14px; }
.steps button.active { border-color: var(--accent); background: rgba(255, 122, 69, .08); }
.steps button.soon { opacity: .55; }
.step-nav { display: flex; justify-content: space-between; margin-top: 8px; }

.voice-grid, .style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.option { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.option.on { border-color: var(--accent); background: rgba(255, 122, 69, .1); }
.option .name { font-weight: 700; text-transform: capitalize; }
.option .desc { font-size: 12.5px; color: var(--muted); }
.soon-box { border: 1px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: rgba(60, 207, 145, .4); }
.pill.bad { color: var(--bad); border-color: rgba(255, 93, 108, .4); }
.pill.run { color: var(--accent-2); border-color: rgba(255, 181, 71, .4); }

.cost { width: 100%; border-collapse: collapse; }
.cost td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.cost td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.cost tr.total td { font-weight: 800; border: 0; padding-top: 12px; font-size: 17px; }

/* queue & library */
.job-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: center; padding: 14px;
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); margin-bottom: 10px; }
.thumb { width: 120px; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--panel-2) center / cover no-repeat;
  display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.bar { height: 7px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lib-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lib-card .thumb { width: 100%; border-radius: 0; }
.lib-card .body { padding: 12px 14px; }
.lib-card .title { font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }

/* job detail */
video { width: 100%; border-radius: 12px; background: #000; }
.log { background: #0a0b0e; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 340px;
  overflow: auto; font: 12px/1.6 ui-monospace, Menlo, monospace; color: #c9ccd4; white-space: pre-wrap; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12.5px; }
.shot .thumb { width: 100%; border-radius: 0; }
.shot p { margin: 8px 10px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.script { white-space: pre-wrap; max-height: 320px; overflow: auto; font-size: 14px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 32px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--panel-2); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: 420px; z-index: 10; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .sidebar { gap: 10px 16px; }
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; order: 3; flex-basis: 100%; }
  .sidebar nav a { white-space: nowrap; padding: 8px 10px; }
  .sidebar #logout { margin-left: auto; }
  .view { padding: 22px 16px 40px; }
  .grid.two { grid-template-columns: 1fr; }
  .job-row { grid-template-columns: 1fr; }
  .thumb { width: 100%; }
}

video.thumb { object-fit: cover; display: block; }
