:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e3e5ea;
  --input: #ffffff; --accent: #e11d1d; --yellow: #f5c400; --ok: #15803d; --warn: #b45309;
  --danger: #b91c1c; --top: #0d0e11; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #171a20; --text: #e8eaee; --muted: #9aa1ad; --line: #2a2f38;
          --input: #0f1115; --ok: #22c55e; --warn: #f59e0b; --danger: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h2 { margin: 0 0 14px; font-size: 1.15rem; }
h3 { margin: 0 0 8px; font-size: 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
small { display: block; color: var(--muted); margin-top: 3px; }
.r { color: var(--accent); }
.y { color: var(--yellow); }
.y-dark { color: #b38f00; }
.w { color: #fff; }
.nowrap { white-space: nowrap; }

/* top bar */
.topbar { background: var(--top); color: #fff; display: flex; align-items: center; justify-content: space-between;
          gap: 12px; padding: 10px 20px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; text-decoration: none; letter-spacing: .2px; font-size: 1.05rem; }
.brand.big { font-size: 1.5rem; text-align: center; margin: 0 0 18px; color: var(--text); }
.topbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.topbar nav a, .topbar .link { color: #cfd3da; text-decoration: none; padding: 6px 10px; border-radius: 8px;
                               background: none; border: 0; font: inherit; cursor: pointer; }
.topbar nav a.on, .topbar nav a:hover, .topbar .link:hover { background: #23262d; color: #fff; }
.pill { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 2px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 720px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) { .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); } }
.grid-2 > * { min-width: 0; }
@media (max-width: 600px) { th:nth-child(3), td:nth-child(3) { display: none; } }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; } main { padding: 14px 10px 40px; } .card { padding: 16px; } }

/* forms */
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
label small, .check small { font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-weight: 400;
  color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: transparent; }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 6px 0 0; vertical-align: -2px; }
input[type=file] { border-style: dashed; }
label.check { font-weight: 500; }
.field { margin-bottom: 6px; }
.field label.check { margin-top: -8px; }
textarea { resize: vertical; }
details.more { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
details.more summary { cursor: pointer; font-weight: 600; margin-bottom: 4px; }
details.more[open] summary { margin-bottom: 14px; }
.tag-r, .tag-y { font-size: .7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; vertical-align: 1px; }
.tag-r { background: var(--accent); color: #fff; }
.tag-y { background: var(--yellow); color: #000; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
       background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: .82rem; }
.btn.wide { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.actions form { margin: 0; }
form.inline { display: inline; margin: 0; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* title preview (mirip judul video) */
.title-preview { background: #000; border-radius: 10px; padding: 14px 10px; margin: 0 0 16px; text-align: center;
  font-family: Impact, "Anton", "Arial Narrow Bold", sans-serif; font-size: 1.9rem; line-height: 1.12; letter-spacing: .3px; }
.title-preview.sm { font-size: 1.25rem; padding: 10px; margin: 8px 0 12px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--card); }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.flash.error { border-color: var(--danger); color: var(--danger); }
.flash.warn { border-color: var(--warn); }
.err { color: var(--danger); margin: 6px 0; }

/* badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
         background: var(--line); color: var(--text); text-transform: uppercase; letter-spacing: .3px; }
.badge.queued { background: #e5e7eb; color: #374151; }
.badge.running, .badge.approved { background: #dbeafe; color: #1d4ed8; }
.badge.done, .badge.uploaded { background: #dcfce7; color: #166534; }
.badge.failed, .badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef3c7; color: #92400e; }

/* jobs */
.job { border-top: 1px solid var(--line); padding: 10px 0; }
.job:first-child { border-top: 0; padding-top: 0; }
.job-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-head .btn { margin-left: auto; }
.log { background: #0b0c0f; color: #cbd5e1; font: 12px/1.45 ui-monospace, Menlo, monospace; padding: 10px; border-radius: 8px;
       max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; }
details summary { cursor: pointer; color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tabs a { padding: 7px 12px; border-radius: 8px; text-decoration: none; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.tabs a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs .push { margin-left: auto; }

/* drafts */
.draft { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
@media (max-width: 760px) { .draft { grid-template-columns: 1fr; } }
.draft-video video, .novideo { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 10px; display: block; }
.novideo { display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.draft-video { max-width: 300px; margin: 0 auto; width: 100%; }
.draft-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.picks { margin: 0 0 14px; padding-left: 26px; }
.picks li { margin-bottom: 6px; }
.meta { border-top: 1px solid var(--line); padding-top: 14px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
tr.inactive td { opacity: .55; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); vertical-align: 1px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px; vertical-align: 1px; }
.status-dot.on { background: var(--ok); }
.status-dot.off { background: var(--line); border: 1px solid var(--muted); }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card.login { width: 100%; max-width: 360px; }
.card.login .btn { width: 100%; justify-content: center; }
