:root {
  --bg: #0d0b0a; --panel: #161311; --panel2: #1d1916; --line: #2a2420; --text: #f3ece4; --muted: #a59a90; --dim: #6f655d;
  --accent: #ff7000; --accent2: #ffb020; --ok: #3ccf8e; --bad: #ff5a5a; --warn: #ffb020; --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 13px; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
nav { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; padding: 0 10px 18px; }
.brand i { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-style: normal; color: #fff; font-weight: 900; }
nav a { color: var(--muted); padding: 9px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
nav a:hover { background: var(--panel2); color: var(--text); }
nav a.on { background: rgba(255, 112, 0, 0.12); color: var(--accent); }
nav .spacer { flex: 1; }
nav .live { font-size: 12px; color: var(--dim); padding: 8px 12px; }
nav .live b { color: var(--accent2); font-weight: 600; }
main { padding: 30px 36px 60px; max-width: 1240px; width: 100%; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.sub { color: var(--muted); margin-bottom: 24px; }
h2 { font-size: 17px; font-weight: 700; margin: 26px 0 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); }
.stat .n { font-size: 30px; font-weight: 800; } .stat .l { color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); } .dim { color: var(--dim); font-size: 13px; }

.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #4a3f37; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { padding: 2px; height: 40px; width: 70px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 4px; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.b-queued { background: #2a2420; color: var(--muted); } .b-running { background: rgba(255, 176, 32, .15); color: var(--warn); }
.b-done { background: rgba(60, 207, 142, .14); color: var(--ok); } .b-failed, .b-cancelled { background: rgba(255, 90, 90, .13); color: var(--bad); }
.bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: rgba(255, 255, 255, .015); }

.reel { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.reel video { width: 100%; aspect-ratio: 9/16; background: #000; display: block; }
.reel .ph { width: 100%; aspect-ratio: 9/16; background: repeating-linear-gradient(45deg, #15120f 0 12px, #1a1613 12px 24px); display: grid; place-items: center; color: var(--dim); text-align: center; padding: 20px; }
.reel .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.reel .t { font-weight: 700; line-height: 1.3; }
.lib { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.tpl { cursor: pointer; padding: 0; overflow: hidden; border-width: 2px; }
.tpl.on { border-color: var(--accent); }
.tpl img, .tpl .ph { width: 100%; aspect-ratio: 9/12; object-fit: cover; object-position: top; display: block; background: #000; }
.tpl .body { padding: 12px 14px; } .tpl b { text-transform: capitalize; }

.keybox { background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 12px; word-break: break-all; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; white-space: pre; line-height: 1.6; }
.log { max-height: 60vh; overflow: auto; white-space: pre-wrap; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal .card { width: min(900px, 100%); max-height: 90vh; overflow: auto; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 30px; }

#toast { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
#toast div { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; max-width: 360px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
#toast div.err { border-left-color: var(--bad); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  nav .spacer, nav .live { display: none; }
  .brand { padding: 0 10px 0 0; }
  main { padding: 20px 16px 50px; }
  .g4, .g3, .g2 { grid-template-columns: 1fr 1fr; }
}
