:root {
  --bg: #0b0b12; --panel: #14141f; --panel2: #1b1b29; --line: #2c2c3e;
  --text: #ffffff; --muted: #a3a3bd; --accent: #7c3aed; --accent2: #8b7cf6; --pink: #ec4899;
  --ok: #2fbf71; --bad: #e05252; --warn: #e0a52e; --chip: #23233a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Segoe UI', Inter, system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); }
.ok { color: var(--ok); }
code { background: var(--chip); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
input, select, textarea {
  width: 100%; margin-top: 6px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[readonly] { opacity: .8; }

.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 16px; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--pink)); border: none; color: #fff; font-weight: 600; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: wait; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px; width: 380px; max-width: 100%; text-align: center; }
.login-card .logo { font-size: 44px; }
.login-card h1 { margin: 8px 0 4px; font-size: 25px; font-family: 'Playfair Display', Georgia, serif; }
.login-card label { text-align: left; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 19px; font-weight: 700; padding: 4px 8px 16px; font-family: 'Playfair Display', Georgia, serif; }
.brand span { background: linear-gradient(90deg, var(--accent2), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-family: 'Segoe UI', Inter, system-ui, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.nav-btn { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--muted); padding: 11px 12px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.nav-btn:hover { color: var(--text); background: var(--panel2); }
.nav-btn.active { color: #fff; background: var(--chip); }
.pill { background: var(--accent); color: #fff; border-radius: 20px; font-size: 11px; padding: 1px 8px; margin-left: 4px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.pool-status { line-height: 1.5; }
.main { flex: 1; padding: 26px 30px; max-width: 1060px; }
.main h2 { margin-top: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; align-items: end; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } .sidebar { width: 68px; } .nav-btn { font-size: 0; text-align: center; } .brand span, .brand-sub, .pool-status { display: none; } }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap { gap: 10px; margin: 12px 0; }

/* toggles */
.toggle-row { display: flex; gap: 8px; margin-top: 6px; }
.toggle-btn { flex: 1; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); border-radius: 9px; padding: 10px; cursor: pointer; font-size: 13px; }
.toggle-btn.active { color: #fff; border-color: var(--accent); background: rgba(124, 58, 237, .18); }
.switch-label { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--chip); border: 1px solid var(--line); border-radius: 30px; cursor: pointer; transition: .2s; }
.slider:before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); top: 3px; left: 3px; transition: .2s; }
.switch input:checked + .slider { background: rgba(124, 58, 237, .4); border-color: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); background: #fff; }
.file-label input { border: none; background: none; padding: 4px 0; }

/* jobs */
.job-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.job-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; }
.job-item:hover { border-color: var(--accent); }
.progress { background: var(--chip); border-radius: 20px; height: 12px; overflow: hidden; margin: 14px 0 4px; }
.progress > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--pink)); transition: width .5s; }
.scene-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.scene { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: flex-start; }
.scene .n { font-weight: 700; color: var(--muted); min-width: 30px; }
.scene .prompt { flex: 1; font-size: 14px; word-break: break-word; }
.scene .err { color: var(--bad); font-size: 12px; margin-top: 4px; word-break: break-word; }
.chip { font-size: 11px; font-weight: 700; border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.chip.queued { background: var(--chip); color: var(--muted); }
.chip.generating { background: rgba(139, 124, 246, .2); color: var(--accent2); animation: pulse 1.2s infinite; }
.chip.done { background: rgba(47, 191, 113, .18); color: var(--ok); }
.chip.failed { background: rgba(224, 82, 82, .16); color: var(--bad); }
.chip.cancelled { background: var(--chip); color: var(--muted); text-decoration: line-through; }
@keyframes pulse { 50% { opacity: .45; } }
.status-badge { font-size: 12px; font-weight: 700; border-radius: 20px; padding: 3px 12px; background: var(--chip); }

/* accounts */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .err-cell { color: var(--bad); font-size: 12px; max-width: 260px; word-break: break-word; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--text); cursor: pointer; padding: 4px 9px; margin: 0 2px; font-size: 12px; }
.icon-btn:hover { border-color: var(--accent); }
.steps { line-height: 1.9; padding-left: 20px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 10, .75); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 640px; max-width: 100%; max-height: 92vh; overflow-y: auto; }
.tabs { display: flex; gap: 8px; margin: 14px 0; }
.tab { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.tab.active { color: #fff; border-color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { margin-top: 26px; padding: 16px 6px 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.site-footer a { color: var(--accent2); text-decoration: none; }
.site-footer a:hover { color: var(--pink); text-decoration: underline; }
.login-wrap .site-footer { border-top: none; margin-top: 0; padding-top: 0; justify-content: center; text-align: center; }
