/* Swap Desk in the Reel Desk / TikiAPI "Cream" look: the same --s-* tokens, 2px ink outlines, hard offset shadows,
   Cabinet Grotesk capitals for headings, Satoshi for text, a mono face for data. */
@font-face { font-family: "Cabinet Grotesk"; src: url("fonts/CabinetGrotesk-700.woff2") format("woff2"); font-weight: 700; font-display: swap }
@font-face { font-family: "Cabinet Grotesk"; src: url("fonts/CabinetGrotesk-800.woff2") format("woff2"); font-weight: 800; font-display: swap }
@font-face { font-family: "Satoshi"; src: url("fonts/Satoshi-400.woff2") format("woff2"); font-weight: 400; font-display: swap }
@font-face { font-family: "Satoshi"; src: url("fonts/Satoshi-500.woff2") format("woff2"); font-weight: 500; font-display: swap }
@font-face { font-family: "Satoshi"; src: url("fonts/Satoshi-700.woff2") format("woff2"); font-weight: 700; font-display: swap }
:root {
  --s-bg: #ffffff; --s-bg-2: #fbead2; --s-surface: #ffffff; --s-ink: #1a1210;
  --s-line: rgb(26 18 16 / 0.14); --s-line-2: rgb(26 18 16 / 0.3);
  --s-fg: #1a1210; --s-fg-2: #4a3f38; --s-fg-3: #6f625a;
  --s-brand: #fb7604; --s-brand-fg: #1a1210; --s-link: #c2410c; --s-lime: #d9ec8f; --s-stop: #d1341f;
  --s-shadow: 4px 4px 0 0 var(--s-ink); --s-shadow-sm: 2px 2px 0 0 var(--s-ink);
  --display: "Cabinet Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --s-bg: #14100e; --s-bg-2: #1e1814; --s-surface: #251d19; --s-ink: #e9d8c0;
  --s-line: rgb(251 234 210 / 0.13); --s-line-2: rgb(251 234 210 / 0.28);
  --s-fg: #fbead2; --s-fg-2: #d6c6b2; --s-fg-3: #a8998a;
  --s-brand: #ff8a2a; --s-link: #ff9a4a; --s-lime: #c9df6e; --s-stop: #ff7a66; color-scheme: dark } }

* { box-sizing: border-box }
body { margin: 0; background: var(--s-bg-2); color: var(--s-fg); font: 500 15px/1.45 var(--body); -webkit-font-smoothing: antialiased }
button, select, textarea, input { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 3px solid var(--s-brand); outline-offset: 2px; border-radius: 6px }
[hidden] { display: none !important }
h2 { margin: 0; font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: -0.01em }
h3 { margin: 0; font: 800 22px/1.05 var(--display); letter-spacing: -0.01em; word-break: break-word }
.lab { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--s-fg-3) }
.hint { font-size: 13px; color: var(--s-fg-3); margin: 0 }
.meta { font: 500 12px var(--mono); color: var(--s-fg-3) }
.msg { font-size: 13px; font-weight: 700 }
.msg.err, .err { color: var(--s-stop); font-size: 13px; font-weight: 700 }
.card { background: var(--s-surface); border: 2px solid var(--s-ink); border-radius: 18px; box-shadow: var(--s-shadow) }
.rowbtn { display: flex; gap: 8px; flex-wrap: wrap }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 12px 24px; background: var(--s-surface); border-bottom: 2px solid var(--s-ink) }
.top .logo { height: 28px }
.top h1 { margin: 0; font: 800 24px/1 var(--display); letter-spacing: -0.02em; text-transform: uppercase; white-space: nowrap }
.top .stats { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end }
.chip { font: 500 12px var(--mono); padding: 5px 10px; border: 2px solid var(--s-ink); border-radius: 999px; background: var(--s-bg); white-space: nowrap; color: inherit; text-decoration: none }
.chip.warn { border-color: var(--s-stop); color: var(--s-stop) }
a.chip:hover, button.chip:hover { background: var(--s-lime); color: #1a1210 }
.logo-dark { display: none }
@media (prefers-color-scheme: dark) { .logo-light { display: none } .logo-dark { display: inline } }
.batchmini { display: flex; align-items: center; gap: 10px; border: 2px solid var(--s-ink); border-radius: 999px; padding: 4px 12px 4px 5px; background: var(--s-bg); font: 500 12px var(--mono); min-width: 0 }
.batchmini:hover { box-shadow: var(--s-shadow-sm) }
.mbar { width: 140px; height: 14px; border-radius: 999px; border: 2px solid var(--s-ink); overflow: hidden; background: var(--s-bg-2); flex: none }
.mbar i { display: block; height: 100%; width: 0; background: var(--s-brand); transition: width 1s ease }
#mbartext { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

main { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; padding: 24px; align-items: start; max-width: 1600px; margin: 0 auto }
@media (max-width: 980px) { main { grid-template-columns: 1fr; padding: 14px } .top { padding: 10px 14px; flex-wrap: wrap } .mbar { width: 90px } }

/* left column */
.side { padding: 18px; position: sticky; top: 82px; display: grid; gap: 20px; max-height: calc(100vh - 106px); overflow-y: auto }
@media (max-width: 980px) { .side { position: static; max-height: none } }
.step { display: grid; gap: 9px }
.drop { border: 2px dashed var(--s-line-2); border-radius: 14px; padding: 18px; text-align: center; background: var(--s-bg); cursor: pointer; transition: background .15s }
.drop.over, .drop:hover { border-color: var(--s-ink); background: color-mix(in oklab, var(--s-brand) 10%, var(--s-bg)) }
.drop b { display: block; font-weight: 700 }
.drop small { color: var(--s-fg-3) }
.pick { display: flex; gap: 6px; align-items: center }
.pick input { flex: 1; min-width: 0 }
textarea, input[type=text], select { width: 100%; border: 2px solid var(--s-ink); border-radius: 12px; padding: 8px 10px; background: var(--s-bg); resize: vertical }
textarea { min-height: 60px }
.links { display: grid; gap: 6px; justify-items: end }
.ups { display: grid; gap: 6px }
.up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font: 500 12px var(--mono); padding: 7px 9px; border: 2px solid var(--s-line-2); border-radius: 10px; background: var(--s-bg) }
.up b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700 }
.up .bar { grid-column: 1 / -1 }
.up.ok { border-color: var(--s-ink); background: color-mix(in oklab, var(--s-lime) 45%, var(--s-bg)) }
.up.bad { border-color: var(--s-stop); color: var(--s-stop) }
.bar { height: 8px; border: 2px solid var(--s-ink); border-radius: 999px; overflow: hidden; background: var(--s-bg-2) }
.bar i { display: block; height: 100%; width: 0; background: var(--s-brand); transition: width .4s ease }

.chars { display: flex; gap: 8px; flex-wrap: wrap }
.char { display: grid; justify-items: center; gap: 4px; padding: 6px; border: 2px solid transparent; border-radius: 14px; background: none; width: 76px }
.char img, .char .plus { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--s-ink); background: var(--s-lime) }
.char .plus { display: grid; place-items: center; font: 800 26px var(--display); color: #1a1210 }
.char span { font-size: 12px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.char[aria-pressed="true"] { background: var(--s-brand); border-color: var(--s-ink); box-shadow: var(--s-shadow-sm); color: var(--s-brand-fg) }
.newchar { display: grid; gap: 8px; padding: 12px; border: 2px dashed var(--s-line-2); border-radius: 14px }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }

.seg { display: flex; border: 2px solid var(--s-ink); border-radius: 12px; overflow: hidden; background: var(--s-bg) }
.seg button { flex: 1; border: 0; background: none; padding: 8px 6px; font-weight: 700; font-size: 13px }
.seg button + button { border-left: 2px solid var(--s-ink) }
.seg button[aria-pressed="true"] { background: var(--s-brand); color: var(--s-brand-fg) }
.seg.small button { padding: 5px 12px; font-size: 12px; flex: none; white-space: nowrap }

.ward { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; max-height: 240px; overflow-y: auto; padding: 2px }
.ward button { padding: 0; border: 2px solid var(--s-line); border-radius: 10px; overflow: hidden; background: var(--s-bg); aspect-ratio: 3 / 4 }
.ward button img { width: 100%; height: 100%; object-fit: cover; display: block }
.ward button[aria-pressed="true"] { border-color: var(--s-brand); box-shadow: 0 0 0 2px var(--s-brand) }
.ward .add { display: grid; place-items: center; font: 800 22px var(--display); border-style: dashed; border-color: var(--s-line-2) }
.preview { max-width: 120px; border: 2px solid var(--s-ink); border-radius: 10px }

.btn { border: 2px solid var(--s-ink); background: var(--s-surface); color: var(--s-fg); border-radius: 12px; padding: 7px 14px; font-weight: 700; box-shadow: var(--s-shadow-sm); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .08s, box-shadow .08s; white-space: nowrap }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: var(--s-shadow) }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none }
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn.on { background: var(--s-brand); color: var(--s-brand-fg) }
.btn.go { background: var(--s-brand); color: var(--s-brand-fg); font: 800 18px/1 var(--display); text-transform: uppercase; padding: 15px; width: 100%; position: sticky; bottom: 0 }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 10px }
.btn.ghost { box-shadow: none; border-color: var(--s-line-2) }
.btn.stop { color: var(--s-stop); border-color: var(--s-stop); box-shadow: none }

/* tabs */
.mainpane { min-width: 0 }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap }
.tabs button { border: 2px solid var(--s-ink); background: var(--s-surface); border-radius: 12px; padding: 8px 16px; font: 800 17px/1 var(--display); text-transform: uppercase; display: flex; align-items: center; gap: 8px }
.tabs button[aria-selected="true"] { background: var(--s-ink); color: var(--s-bg); box-shadow: var(--s-shadow-sm) }
.tc { font: 500 12px var(--mono); padding: 1px 7px; border-radius: 999px; background: var(--s-lime); color: #1a1210; border: 2px solid var(--s-ink) }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap }
.selcount { font: 700 13px var(--mono) }

/* library */
.pack { padding: 14px 16px 16px; margin-bottom: 18px }
.packhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.packhead h2 { font-size: 19px; cursor: pointer; overflow-wrap: anywhere }
.packhead .meta { flex: 1; min-width: 160px }
.packbar { height: 8px; border-radius: 999px; background: var(--s-bg-2); border: 2px solid var(--s-ink); overflow: hidden; display: flex; margin: 10px 0 12px }
.packbar i { display: block; height: 100% }
.packbar .d { background: var(--s-lime) } .packbar .q { background: var(--s-brand) } .packbar .f { background: var(--s-stop) }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px }
.tile { position: relative; display: grid; gap: 5px; min-width: 0 }
.tile .th { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; border: 2px solid var(--s-ink); background: #000; cursor: zoom-in; padding: 0 }
.tile .th img { width: 100%; height: 100%; object-fit: cover; display: block }
.tile .th .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #fbead2; font: 500 11px var(--mono); padding: 8px; text-align: center }
.tile.sel .th { outline: 4px solid var(--s-brand); outline-offset: 1px; box-shadow: var(--s-shadow) }
.tile.off .th img { filter: grayscale(1) opacity(.45) }
.tile .ck { position: absolute; top: 6px; left: 6px; z-index: 2; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--s-ink); background: rgb(255 255 255 / .9); display: grid; place-items: center; font-weight: 800; color: #1a1210; padding: 0 }
.tile.sel .ck { background: var(--s-brand) }
.tile .dur { position: absolute; bottom: 6px; left: 6px; font: 700 11px var(--mono); padding: 1px 6px; border-radius: 6px; background: rgb(26 18 16 / .75); color: #fbead2 }
.tile .badge { position: absolute; top: 6px; right: 6px; font: 700 11px var(--mono); padding: 2px 7px; border-radius: 999px; border: 2px solid var(--s-ink); background: var(--s-surface); color: var(--s-fg) }
.tile .badge.done { background: var(--s-lime); color: #1a1210 }
.tile .badge.q { background: var(--s-brand); color: #1a1210 }
.tile .badge.bad { background: var(--s-stop); color: #fff; border-color: var(--s-stop) }
.tile .nm { font-size: 12px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere }
.tile .tbar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgb(0 0 0 / .4) }
.tile .tbar i { display: block; height: 100%; background: var(--s-brand) }
.empty { padding: 26px; text-align: center; color: var(--s-fg-3); border: 2px dashed var(--s-line-2); border-radius: 16px }

/* queue: the batch and each job's steps */
.batch { padding: 16px 18px; margin-bottom: 18px; display: grid; gap: 10px }
.batch .big { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap }
.batch .big b { font: 800 34px/1 var(--display) }
.batch .big span { font: 500 13px var(--mono); color: var(--s-fg-2) }
.slots { display: flex; gap: 3px; height: 26px }
.slot { flex: 1; min-width: 4px; border: 2px solid var(--s-ink); border-radius: 6px; background: var(--s-bg-2); position: relative; overflow: hidden }
.slot.done { background: var(--s-lime) }
.slot.failed, .slot.cancelled { background: var(--s-stop); border-color: var(--s-stop) }
.slot i { position: absolute; inset: 0 auto 0 0; background: var(--s-brand); transition: width 4s linear }
.legend { display: flex; gap: 14px; font: 500 12px var(--mono); color: var(--s-fg-3); flex-wrap: wrap }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--s-ink); margin-right: 6px; vertical-align: -1px }
.legend .l-d::before { background: var(--s-lime) } .legend .l-r::before { background: var(--s-brand) } .legend .l-w::before { background: var(--s-bg-2) } .legend .l-f::before { background: var(--s-stop); border-color: var(--s-stop) }

.list { display: grid; gap: 14px }
.job { display: grid; grid-template-columns: 34px 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--s-surface); border: 2px solid var(--s-ink); border-radius: 16px; box-shadow: var(--s-shadow-sm) }
.job.running { box-shadow: var(--s-shadow); border-width: 3px }
.job.dragging { opacity: .4 }
.job.dropbefore { box-shadow: 0 -5px 0 0 var(--s-brand), var(--s-shadow-sm) }
.job .n { font: 800 22px var(--display); text-align: center; cursor: grab; user-select: none }
.job .n small { display: block; font: 500 10px var(--mono); color: var(--s-fg-3) }
.job .thumb { width: 64px; height: 86px; border-radius: 10px; border: 2px solid var(--s-ink); object-fit: cover; background: var(--s-bg-2) }
.job .info { min-width: 0; display: grid; gap: 6px }
.job .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.job .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.job .right { display: grid; justify-items: end; gap: 8px }
.job .pct { font: 800 30px/1 var(--display) }
.job .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end }
.steps { display: flex; gap: 4px }
.st { flex: 1; display: grid; gap: 3px; min-width: 0 }
.st.w4 { flex: 4 } .st.w2 { flex: 1.4 }
.st .sb { height: 12px; border-radius: 999px; border: 2px solid var(--s-ink); background: var(--s-bg-2); overflow: hidden; position: relative }
.st .sb i { position: absolute; inset: 0 auto 0 0; background: var(--s-brand); transition: width 4s linear }
.st.done .sb { background: var(--s-ink) }
.st.active .sb { border-color: var(--s-brand); box-shadow: 0 0 0 2px color-mix(in oklab, var(--s-brand) 35%, transparent) }
.st.active.indet .sb { background: repeating-linear-gradient(-45deg, var(--s-brand) 0 8px, color-mix(in oklab, var(--s-brand) 35%, var(--s-bg-2)) 8px 16px); background-size: 200% 100%; animation: march 1.2s linear infinite }
.st.active:not(.indet) .sb i { background: repeating-linear-gradient(-45deg, var(--s-brand) 0 8px, color-mix(in oklab, var(--s-brand) 75%, #fff) 8px 16px); background-size: 200% 100%; animation: march 1.2s linear infinite }
@keyframes march { to { background-position: -45px 0 } }
.st label { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--s-fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.st.active label { color: var(--s-fg); font-weight: 700 }
.st.done label { color: var(--s-fg-2) }
.now { font: 500 12px var(--mono); color: var(--s-fg-2) }
.now b { color: var(--s-fg) }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--s-ink); background: var(--s-surface); justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis }
.pill.failed, .pill.cancelled { color: var(--s-stop); border-color: var(--s-stop) }
@media (max-width: 700px) { .job { grid-template-columns: 26px 52px minmax(0, 1fr) } .job .right { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column } .job .thumb { width: 52px; height: 70px } .st label { display: none } }

.donecard { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 14px; background: var(--s-surface); border: 2px solid var(--s-ink); border-radius: 18px; box-shadow: var(--s-shadow-sm) }
.donecard video { width: 220px; aspect-ratio: 9 / 16; object-fit: contain; background: #000; border-radius: 12px; border: 2px solid var(--s-ink) }
.donecard .sd { display: grid; gap: 10px; align-content: start; min-width: 0 }
.donecard .refs { display: flex; gap: 8px; flex-wrap: wrap }
.donecard .refs a { display: grid; gap: 2px; font: 500 10px var(--mono); color: var(--s-fg-3); text-decoration: none; text-transform: uppercase }
.donecard .refs img { width: 64px; height: 86px; object-fit: cover; border: 2px solid var(--s-ink); border-radius: 8px }
.face { font: 500 12px var(--mono); padding: 6px 10px; border-radius: 10px; border: 2px solid var(--s-ink); justify-self: start }
.face.ok { background: var(--s-lime); color: #1a1210 }
.face.bad { border-color: var(--s-stop); color: var(--s-stop) }
@media (max-width: 640px) { .donecard { grid-template-columns: 1fr } .donecard video { width: 100% } }

/* preview */
dialog { border: 2px solid var(--s-ink); border-radius: 18px; box-shadow: var(--s-shadow); background: var(--s-surface); color: var(--s-fg); padding: 22px; max-width: 420px; width: 92vw }
dialog::backdrop { background: rgb(26 18 16 / .55) }
dialog form { display: grid; gap: 12px }
.previewdlg { max-width: 980px; width: 96vw; padding: 0; overflow: hidden }
.pv { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); max-height: 92vh }
.pvvideo { background: #000; display: grid; place-items: center }
.pvvideo video { display: block; background: #000; aspect-ratio: 9 / 16; height: min(86vh, 760px); width: auto; max-width: 100%; object-fit: contain }
.pvside { padding: 18px; display: grid; gap: 12px; align-content: start; overflow-y: auto }
.pvhead { display: flex; justify-content: space-between; align-items: center; gap: 8px }
.pvjobs { display: grid; gap: 6px }
.pvjob { display: flex; gap: 8px; align-items: center; font: 500 12px var(--mono); padding: 6px 9px; border: 2px solid var(--s-line-2); border-radius: 10px; flex-wrap: wrap }
.pvjob.done { border-color: var(--s-ink); background: color-mix(in oklab, var(--s-lime) 40%, var(--s-surface)) }
.pvjob a { color: var(--s-link); font-weight: 700 }
.pvacts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.pvnav { display: flex; justify-content: space-between; gap: 8px }
@media (max-width: 760px) { .pv { grid-template-columns: 1fr } .pvvideo video { height: 55vh } }
