:root {
  --bg: #f6f6f8; --surface: #fff; --ink: #17171c; --ink-2: #5d5d6b; --line: #e3e3ea;
  --accent: #6b4dff; --accent-ink: #fff; --ok: #1f9d55; --warn: #b7791f; --bad: #d23b3b;
  --ok-bg: #e6f6ec; --warn-bg: #fdf3e1; --bad-bg: #fdeaea; --soft: #efedff;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111116; --surface: #1b1b22; --ink: #ececf2; --ink-2: #9a9aab; --line: #2c2c37;
    --accent: #8b74ff; --ok: #4ccb82; --warn: #e3b052; --bad: #ff6b6b;
    --ok-bg: #16301f; --warn-bg: #33280f; --bad-bg: #3a1717; --soft: #25213f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; margin: 8px 0 12px; line-height: 1.25; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.card h2 { margin-top: 0; }
code, .mono, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); font-size: 17px; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: var(--ink-2); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a.on, .nav a:hover { background: var(--soft); color: var(--accent); }
.pill { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  font-size: 13px; white-space: nowrap; color: var(--ink); }
.pill.ok { background: var(--ok-bg); } .pill.off { background: var(--bad-bg); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.pill.ok .dot { background: var(--ok); }
.pill b { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; font-size: 12px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 60px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin: 12px 0; }
.card.ok { border-color: var(--ok); } .card.off { border-color: var(--bad); }
.status h2 { margin: 0 0 4px; }
.quota { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 16px 0; }
.tile { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; color: var(--ink); }
.tile:hover { border-color: var(--accent); }
.tile b { font-size: 28px; color: var(--accent); min-width: 32px; text-align: center; }
.tile small { color: var(--ink-2); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--ink);
  border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--soft); }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 14px; margin: 0; }

.st { font-size: 12px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--ink-2); }
.st-running { background: var(--warn-bg); color: var(--warn); }
.st-done, .sc-made, .sc-published { background: var(--ok-bg); color: var(--ok); }
.st-failed { background: var(--bad-bg); color: var(--bad); }
.sc-new { background: var(--soft); color: var(--accent); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.btn.ghost { cursor: default; color: var(--ink-2); }

.form label, .make label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
input, textarea, select { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
label.check input { width: auto; margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 0; padding: 0; margin: 0 0 12px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; width: 0; }
.seg span { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); cursor: pointer; }
.seg small { display: block; color: var(--ink-2); }
.seg input:checked + span { border-color: var(--accent); background: var(--soft); }
.seg input:disabled + span { opacity: .45; cursor: not-allowed; }

.okmsg { background: var(--ok-bg); color: var(--ok); padding: 8px 12px; border-radius: 9px; }
.err { background: var(--bad-bg); color: var(--bad); padding: 8px 12px; border-radius: 9px; }
.err-box { border-color: var(--bad); }
pre { white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
.log { max-height: 420px; overflow: auto; background: var(--bg); padding: 10px; border-radius: 9px; margin: 10px 0 0; }
details summary { cursor: pointer; font-weight: 600; }

.result { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 16px; margin: 12px 0; }
.player video, .novid { width: 100%; max-height: 72vh; border-radius: var(--r); background: #000; display: block; }
.novid { padding: 24px; background: var(--surface); border: 1px solid var(--line); }
.side textarea { margin: 0 0 10px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.acts form { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.thumb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: var(--ink); }
.thumb img, .noimg { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; background: var(--bg); }
.noimg { display: flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 13px; }
.thumb span { display: block; padding: 8px 10px; }
.thumb b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb small { color: var(--ink-2); }

.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 340px; }
.login h1 { margin-top: 0; }
.login input { margin-bottom: 12px; }
.login .btn { width: 100%; }

@media (max-width: 700px) {
  .top { flex-wrap: wrap; gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .pill { margin-left: auto; }
  .result { grid-template-columns: 1fr; }
  .cols, .seg { grid-template-columns: 1fr; }
  .row > .muted:last-child { display: none; }
  .player video { max-height: 70vh; width: auto; max-width: 100%; margin: 0 auto; }
  h1 { font-size: 21px; }
}
