:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #181c26;
  --border: #252a37;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #fe2c55;
  --accent-2: #25f4ee;
  --ok: #2ecc71;
  --warn: #f5b041;
  --err: #ff5c6c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-2); }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--err); min-height: 1em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--panel-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 800; font-size: 20px; padding: 0 8px; }
.brand.big { font-size: 30px; padding: 0; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { color: var(--text); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
nav a:hover { background: var(--panel-2); }
nav a.active { background: linear-gradient(90deg, rgba(254,44,85,.22), rgba(37,244,238,.08)); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 0 8px; }
.main { padding: 28px; max-width: 1200px; width: 100%; min-width: 0; }
.page-head { margin-bottom: 20px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat .n { font-size: 28px; font-weight: 800; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.spacer { flex: 1; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font: inherit; width: 100%; }
input[type=checkbox] { width: auto; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37,244,238,.4); border-color: transparent; }
.help { font-size: 12px; color: var(--muted); }

.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex;
  gap: 6px; align-items: center; justify-content: center; white-space: nowrap; }
.btn:hover { border-color: #3a4152; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: wait; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); }
.badge.queued { color: var(--muted); }
.badge.running, .badge.processing, .badge.uploading { color: var(--accent-2); }
.badge.done, .badge.published, .badge.inbox { color: var(--ok); }
.badge.error { color: var(--err); }
.badge.canceled { color: var(--warn); }

.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

.videos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.vcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; }
.vcard video { width: 100%; aspect-ratio: 9/16; background: #000; display: block; object-fit: cover; }
.vcard .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vcard .title { font-weight: 700; }
.vcard .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 22px 52px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px;
  border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; }
.steps > li > b.st { display: block; margin-bottom: 4px; font-size: 16px; }
b.st { overflow-wrap: anywhere; }
.copy { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copy code { flex: 1; min-width: 0; padding: 8px 10px; overflow-wrap: anywhere; }
.callout { border-left: 3px solid var(--warn); background: rgba(245,176,65,.08); padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.callout.ok { border-color: var(--ok); background: rgba(46,204,113,.08); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 8px 14px;
  border-radius: 999px; cursor: pointer; font: inherit; }
.tabs button.active { color: var(--text); border-color: var(--accent); background: rgba(254,44,85,.12); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel-2); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: 10px; z-index: 60; max-width: 420px; }
.toast.err { border-color: var(--err); }
pre.log { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 320px;
  overflow: auto; font-size: 12px; white-space: pre-wrap; }
.models-table { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.models-table td, .models-table th { padding: 6px 8px; font-size: 13px; }

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; padding: 10px 12px; flex-direction: row;
    flex-wrap: wrap; align-items: center; gap: 6px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { margin: 0; }
  .sidebar-foot { margin: 0 0 0 auto; gap: 8px; padding: 0; }
  nav { order: 3; width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px;
    scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
  .main { padding: 16px; }
  table { display: block; overflow-x: auto; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .n { font-size: 22px; }
  .toast { left: 16px; right: 16px; max-width: none; }
}
