:root {
  --bg: #0e1014;
  --panel: #161a21;
  --panel-2: #1f242d;
  --border: #2a313c;
  --text: #e7eaf0;
  --muted: #8a93a3;
  --accent: #4ade80;
  --accent-hover: #22c55e;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.5; }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.brand em { color: var(--muted); font-style: normal; font-weight: 400; font-size: 12px; padding: 2px 8px; background: var(--panel-2); border-radius: 6px; }
.logo { font-size: 22px; }
.health { font-size: 12px; color: var(--muted); }
.health.ok { color: var(--accent); }
.health.bad { color: var(--danger); }
main {
  display: grid; grid-template-columns: 380px 1fr; gap: 24px;
  padding: 24px 28px; max-width: 1400px; margin: 0 auto;
}
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel h2 { margin: 0 0 16px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text); }
label small.hint { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; font-weight: 400; }
input[type=text], select, textarea, input[type=file] {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; font-family: inherit;
}
input[type=text]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }
.row { display: flex; gap: 12px; }
.row .grow { flex: 1; }
.cost-box {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; margin-bottom: 14px;
}
.cost-box strong { color: var(--accent); font-size: 18px; }
.cost-box small { color: var(--muted); font-size: 11px; width: 100%; }
button.primary {
  width: 100%; padding: 12px; border: 0; border-radius: 8px;
  background: var(--accent); color: #0a0c0f; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background 0.15s;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }
.msg { margin-top: 10px; font-size: 12px; min-height: 16px; }
.msg.error { color: var(--danger); }
.msg.success { color: var(--accent); }

.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.jobs .empty { color: var(--muted); padding: 24px; text-align: center; grid-column: 1/-1; }
.job-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.job-video {
  background: #000; aspect-ratio: 9/16; max-height: 480px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
}
.job-video video { width: 100%; height: 100%; object-fit: contain; }
.job-meta { padding: 12px 14px; font-size: 12px; color: var(--muted); }
.job-meta .title { color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.job-meta .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { padding: 2px 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; font-size: 10px; }
.status { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; margin-top: 4px; }
.status.queued, .status.generating { background: #1e3a5f; color: #7cb6ff; }
.status.subtitling { background: #4a3a7a; color: #c0aaff; }
.status.completed { background: #1f4a2e; color: var(--accent); }
.status.partial { background: #5a4814; color: var(--warn); }
.status.rejected, .status.error, .status.mcp_error { background: #5a1f1f; color: var(--danger); }
.job-error { background: rgba(248,113,113,0.08); border-top: 1px solid var(--border); padding: 8px 14px; color: var(--danger); font-size: 11px; }
.job-actions { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.job-actions a, .job-actions button {
  flex: 1; text-align: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text); text-decoration: none; font-size: 12px; cursor: pointer; font-family: inherit;
}
.job-actions a:hover, .job-actions button:hover { background: var(--panel); }
.job-actions .delete { color: var(--danger); }
footer { padding: 16px 28px; text-align: center; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); margin-top: 24px; }
footer code { background: var(--panel); padding: 2px 6px; border-radius: 4px; }
@media (max-width: 880px) {
  main { grid-template-columns: 1fr; }
}
