:root {
  --bg: #0b1020;
  --panel: #121a30;
  --panel2: #18223d;
  --line: #24304f;
  --text: #e7ecf7;
  --muted: #93a0bd;
  --brand: #e11d48;
  --brand2: #fb7185;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0e1528; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin: 0 6px 22px; }
.logo .dot { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), #7c3aed); display: grid; place-items: center; font-size: 14px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); margin-bottom: 2px; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel2); color: var(--text); }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5f6b88; margin: 16px 10px 6px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.tight { padding: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.spacer { flex: 1; }

/* stats */
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* forms */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; background: #0d1427; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand2); }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4a74; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #be123c; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: #fca5a5; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: 12px; }
tr:hover td { background: rgba(255,255,255,.015); }
td.q { max-width: 520px; }

/* tags */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #22304f; color: #c7d2fe; white-space: nowrap; }
.pill.cost { background: #3b2a0a; color: #fcd34d; }
.pill.hiring { background: #062e25; color: #6ee7b7; }
.pill.comparison { background: #1e1b4b; color: #a5b4fc; }
.pill.problem { background: #3b0d0d; color: #fca5a5; }
.pill.local { background: #082f49; color: #7dd3fc; }
.pill.s-ready, .pill.s-approved { background: #052e1c; color: #34d399; }
.pill.s-failed, .pill.s-changes { background: #3b0d0d; color: #fca5a5; }
.pill.s-rendering, .pill.s-processing, .pill.s-queued, .pill.s-submitting, .pill.s-scripting, .pill.s-pending { background: #2a2108; color: #fcd34d; }
.score { display: inline-block; width: 34px; text-align: center; font-weight: 700; border-radius: 6px; padding: 2px 0; background: #1b2747; }
.score.hi { background: #064e3b; color: #6ee7b7; }
.score.mid { background: #3b2f0a; color: #fcd34d; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); text-decoration: none; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* video cards */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.vcard { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vcard .thumb { aspect-ratio: 16/10; background: #070b16 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; position: relative; }
.vcard .thumb .sel { position: absolute; top: 8px; left: 8px; }
.vcard .body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.vcard .title { font-weight: 600; line-height: 1.3; }
.vcard .meta { color: var(--muted); font-size: 12px; }

/* avatars */
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 420px; overflow: auto; padding: 2px; }
.acard { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel2); }
.acard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #0a0f1e; }
.acard .n { padding: 6px 8px; font-size: 12px; line-height: 1.3; }
.acard.on { border-color: var(--brand); }

/* video editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.player { background: #000; border-radius: 10px; width: 100%; max-height: 640px; }
.comment { border-left: 3px solid var(--line); padding: 6px 10px; margin: 8px 0; }
.comment.changes { border-color: var(--bad); }
.comment.approved { border-color: var(--ok); }
.comment.internal { border-color: var(--info); }

/* misc */
.toast { position: fixed; right: 18px; bottom: 18px; background: #111a33; border: 1px solid var(--line); padding: 11px 15px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 50; max-width: 420px; }
.toast.err { border-color: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(3,6,15,.7); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(760px, 100%); max-height: 90vh; overflow: auto; }
.banner { background: #2a2108; border: 1px solid #5c4810; color: #fde68a; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: s 0.8s linear infinite; vertical-align: -2px; }
@keyframes s { to { transform: rotate(360deg); } }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 360px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.sticky-bar { position: sticky; bottom: 0; background: rgba(11,16,32,.95); border-top: 1px solid var(--line); padding: 10px 0; margin-top: 10px; backdrop-filter: blur(4px); }
