:root {
  --bg: #f5f4f8; --card: #fff; --ink: #1e1b28; --muted: #6c6879; --line: #e6e3ee;
  --accent: #e4532e; --accent-ink: #fff; --accent-soft: #fdeee9; --brand: #3a2f8c; --brand-soft: #ecebf8;
  --ok: #1f8a4c; --ok-soft: #e5f5ec; --warn: #b76e00; --warn-soft: #fff4dc; --err: #c62828; --err-soft: #fdecec;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Be Vietnam Pro", system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
h2 .step { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo { font-weight: 800; color: var(--ink); font-size: 17px; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--brand-soft); color: var(--brand); }
.who { font-size: 13px; color: var(--muted); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 16px 80px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.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(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #cfcbdc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.95); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.f { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* login */
.login { max-width: 380px; margin: 12vh auto; }

/* list */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { width: auto; }
.jobs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.job { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.job .thumb { aspect-ratio: 9/16; max-height: 300px; background: #eceaf2; display: grid; place-items: center; position: relative; overflow: hidden; }
.job .thumb img, .job .thumb video { width: 100%; height: 100%; object-fit: cover; }
.job .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.job .name { font-weight: 700; }
.job .meta { font-size: 12.5px; color: var(--muted); }
.job .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.badge.queued { background: var(--warn-soft); color: var(--warn); }
.badge.rendering { background: var(--brand-soft); color: var(--brand); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.posted { background: #e7f0ff; color: #1d4ed8; }
.badge.error { background: var(--err-soft); color: var(--err); }
.bar { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; width: 70%; }
.bar i { display: block; height: 100%; background: var(--brand); transition: width .5s; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
details.post summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 600; }

/* form */
.drop { border: 2px dashed #cfcbdc; border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: #faf9fc; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumbs figure { margin: 0; width: 92px; text-align: center; font-size: 12px; color: var(--muted); }
.thumbs img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; margin-bottom: 3px; }
.types { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.type { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: block; }
.type input { display: none; }
.type b { display: block; }
.type span { font-size: 12.5px; color: var(--muted); }
.type:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; user-select: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.disabled { opacity: .4; cursor: not-allowed; }
.feat { display: grid; grid-template-columns: 34px 1.2fr 1.5fr 110px 140px 34px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.feat .no { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.feat button { border: 0; background: none; color: var(--err); font-size: 20px; cursor: pointer; }
.counter { font-weight: 700; }
.counter.full { color: var(--ok); }
.actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 10px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
table.scenes { width: 100%; border-collapse: collapse; font-size: 14px; }
table.scenes td, table.scenes th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.scenes th { font-size: 12px; color: var(--muted); text-transform: uppercase; }

/* library */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 14px; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.lib-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tag { font-size: 11.5px; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
table.users { width: 100%; border-collapse: collapse; }
table.users td, table.users th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
table.users input, table.users select { padding: 6px 8px; }

@media (max-width: 720px) {
  .feat { grid-template-columns: 30px 1fr 30px; }
  .feat .sub, .feat .img, .feat .ang { grid-column: 2 / 3; }
  .top .in { gap: 8px; }
  .nav { order: 3; width: 100%; flex: none; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .who { margin-left: auto; }
  .job .thumb { max-height: 360px; }
}
