:root {
  --primary: #0d2b6e;
  --accent: #f5a623;
  --bg: #0f1116;
  --surface: #1a1d25;
  --surface-2: #232833;
  --text: #e8eaed;
  --text-muted: #8b92a3;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: #2a2f3c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app { display: flex; flex-direction: column; min-height: 100vh; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header h1 { margin: 0; font-size: 20px; font-weight: 700; }
.header .accent { color: var(--accent); }
.logo-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
}

.auth-box { display: flex; align-items: center; gap: 12px; }
.token-input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  width: 220px;
  font-family: monospace;
  font-size: 12px;
}
.status { font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.status.ok { background: rgba(16,185,129,0.15); color: var(--success); }
.status.err { background: rgba(239,68,68,0.15); color: var(--error); }

.main {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 380px;
  gap: 1px;
  background: var(--border);
}
.sidebar, .editor, .queue {
  background: var(--bg);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 58px);
}
h2 { margin: 0 0 16px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }

.tpl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tpl-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.tpl-item:hover { border-color: var(--accent); }
.tpl-item.active { border-color: var(--accent); background: var(--surface-2); }
.tpl-label { font-weight: 700; margin-bottom: 4px; }
.tpl-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.tpl-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); font-family: monospace; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 600px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.field input[type="text"], .field input[type="number"], .field textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.field input[type="color"] {
  background: transparent;
  border: 1px solid var(--border);
  height: 40px;
  width: 80px;
  cursor: pointer;
  border-radius: 6px;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: var(--primary);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.btn-sm:hover { border-color: var(--accent); }

.jobs { display: flex; flex-direction: column; gap: 12px; }
.job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.job.done { border-left: 3px solid var(--success); }
.job.failed { border-left: 3px solid var(--error); }
.job.rendering { border-left: 3px solid var(--warning); }
.job.queued { border-left: 3px solid var(--text-muted); }
.job-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.job-tpl { font-weight: 700; }
.job-status { text-transform: uppercase; color: var(--text-muted); font-size: 10px; letter-spacing: 1px; }
.job-progress {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  margin: 8px 0;
  overflow: hidden;
}
.job-progress .bar { position: absolute; inset: 0; background: var(--accent); transition: width 0.3s; }
.job-progress span { position: absolute; top: -18px; right: 0; font-size: 10px; color: var(--text-muted); }
.job-error { color: var(--error); font-size: 11px; font-family: monospace; }
.job-video { width: 100%; margin-top: 8px; border-radius: 6px; max-height: 300px; }
.job-actions { display: flex; gap: 6px; margin-top: 8px; }
.job-time { font-size: 10px; color: var(--text-muted); margin-top: 6px; font-family: monospace; }

.empty { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 13px; }

@media (max-width: 1024px) {
  .main { grid-template-columns: 1fr; }
  .sidebar, .editor, .queue { max-height: none; }
}
