* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: var(--t-body-lh);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: var(--nudge); height: var(--nudge); overflow: hidden; clip: rect(0 0 0 0); }

.icon {
  width: var(--icon);
  height: var(--icon);
  flex: none;
  display: block;
  fill: none;
  stroke: currentColor;
}
.icon use { pointer-events: none; }

:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.cmdbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: var(--cmdbar-h);
  padding: 0 var(--s4);
  background: var(--bar);
  border-bottom: var(--bw) solid var(--line);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.brand {
  font-size: var(--t-lead);
  line-height: var(--t-lead-lh);
  font-weight: 600;
  padding: 0 var(--s3) 0 var(--s1);
  border-right: var(--bw) solid var(--line);
  margin-right: var(--s1);
}
.cmds { display: flex; align-items: center; gap: var(--s1); }
.cmds-file { border-left: var(--bw) solid var(--line); padding-left: var(--s2); }
.cmds form { display: flex; margin: 0; }
.new-project input[name="name"] { width: 9rem; }
.cmd {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: transparent;
  border: var(--bw) solid transparent;
  color: var(--mute);
  padding: var(--s2) var(--s3);
  border-radius: var(--r2);
  cursor: pointer;
  white-space: nowrap;
}
.cmd:hover {
  color: var(--ink);
  background: var(--raised);
}
.cmd.is-on {
  color: var(--ink);
  background: var(--raised);
  border-color: transparent;
  box-shadow: inset 0 calc(var(--mark) * -1) 0 var(--action);
}
.cmd.is-on:focus-visible {
  box-shadow: inset 0 calc(var(--mark) * -1) 0 var(--action), 0 0 0 var(--focus-w) var(--focus);
}
.cmd.solid {
  background: var(--raised);
  color: var(--ink);
  border-color: var(--line);
}
.cmd.is-off {
  opacity: var(--off);
  pointer-events: none;
  cursor: not-allowed;
}
.cmd-gpu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.budget-chip, .gpu-pill {
  font-family: var(--mono);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--t-micro-ls);
  text-transform: uppercase;
  color: var(--mute);
  border: var(--bw) solid var(--line);
  padding: var(--s1) var(--s2);
  border-radius: var(--rp);
  background: var(--pane);
}
.gpu-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.gpu-pill i {
  width: var(--dot);
  height: var(--dot);
  border-radius: var(--rp);
  background: var(--mute);
  display: inline-block;
}
.gpu-pill.is-ready { color: var(--ok); }
.gpu-pill.is-ready i { background: var(--ok); }
.gpu-pill.is-starting i { background: var(--attention); }
.gpu-pill.is-busy { color: var(--ok); }
.gpu-pill.is-busy i { background: var(--ok); }
.gpu-pill.is-stopping i { background: var(--attention); }
.gpu-pill.is-stopped { color: var(--mute); }
.gpu-pill.is-stopped i { background: var(--mute); }
.gpu-pill.is-error { color: var(--attention); }
.gpu-pill.is-error i { background: var(--attention); }
.chrono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.gpu-start { display: flex; margin: 0; }
.gpu-go {
  font-family: var(--mono);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  letter-spacing: var(--t-micro-ls);
  text-transform: uppercase;
  color: var(--ink);
  border: var(--bw) solid var(--line);
  padding: var(--s1) var(--s2);
  border-radius: var(--rp);
  background: var(--pane);
}

.toast {
  position: fixed;
  z-index: 20;
  top: calc(var(--cmdbar-h) + var(--s4));
  right: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: max-content;
  max-width: min(var(--login-w), calc(100% - var(--s8)));
  margin: 0;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  color: var(--attention);
  border-radius: var(--r2);
  box-shadow: var(--e2);
}
.toast.toast-ok { color: var(--ok); }
.toast.toast-info { color: var(--ink-2); }

.stage { height: calc(100vh - var(--cmdbar-h)); overflow: auto; }
body.nav-series .stage { overflow: auto; }

html,
.stage,
.params,
.cmdbar {
  scrollbar-width: none;
}
html::-webkit-scrollbar,
.stage::-webkit-scrollbar,
.params::-webkit-scrollbar,
.cmdbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.queue {
  scrollbar-width: thin;
}
.queue::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.bench {
  display: grid;
  grid-template-columns: var(--queue-w) minmax(0, 1fr) var(--params-w);
  gap: var(--s5);
  height: 100%;
  min-height: 0;
  padding: var(--s5);
}
.bench.is-folded {
  grid-template-columns: var(--queue-w) minmax(0, 1fr) auto;
}

.queue, .params {
  background: var(--pane);
  border-right: none;
  overflow: auto;
  padding: var(--s4);
  border-radius: var(--r3);
  box-shadow: var(--e2);
  min-height: 0;
}
.params {
  border-left: none;
  display: flex;
  flex-direction: column;
}
.params-toggle { align-self: flex-end; }
.params-body { display: flex; flex-direction: column; min-height: 0; }
.bench.is-folded .params {
  padding: var(--s2);
  overflow: hidden;
}
.bench.is-folded .params-body { display: none; }
.pane-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  letter-spacing: var(--t-micro-ls);
  text-transform: uppercase;
  color: var(--mute);
  padding: 0 0 var(--s3);
}
.params-toggle { align-self: flex-end; }

.queue { display: flex; flex-direction: column; gap: var(--s1); }
.q-item {
  display: grid;
  grid-template-columns: var(--thumb-w) 1fr;
  gap: var(--s2);
  padding: var(--s2);
  border-bottom: none;
  border-radius: var(--r2);
  color: var(--mute);
}
.q-item img {
  width: var(--thumb-w);
  height: var(--thumb-h);
  object-fit: cover;
  background: var(--bg);
  border-radius: var(--r1);
}
.q-item b { display: block; color: var(--ink); font-weight: 500; }
.q-item span { font-size: var(--t-sm); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.q-item.is-on {
  background: var(--raised);
  box-shadow: inset var(--mark) 0 0 var(--action);
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.preview-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--s2);
  min-height: 0;
}
.preview-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--check-b);
  background-image:
    linear-gradient(45deg, var(--check-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-a) 75%);
  background-size: var(--s4) var(--s4);
  background-position: 0 0, 0 var(--s2), var(--s2) calc(-1 * var(--s2)), calc(-1 * var(--s2)) 0;
  position: relative;
  overflow: hidden;
  border-radius: var(--r4);
  box-shadow: var(--e2);
}
.preview-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: var(--s4);
}
.preview-frame img {
  flex: none;
  min-height: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}
.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  color: var(--mute);
  text-align: center;
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
}
.preview-empty .icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
  opacity: 0.4;
}
.preview-meta {
  padding: var(--s2) var(--s4);
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
  font-variant-numeric: tabular-nums;
  color: var(--mute);
  border-top: none;
}

.prompt-dock {
  flex: 0 0 auto;
  border-top: none;
  background: var(--surface);
  padding: var(--s4);
  margin-top: var(--s4);
  border-radius: var(--r4);
  box-shadow: var(--e3);
}
.prompt-dock textarea {
  width: 100%;
  min-height: var(--prompt-min);
  resize: vertical;
  background: var(--bg);
  border: var(--bw) solid transparent;
  border-radius: var(--r2);
  padding: var(--s3);
  font-size: var(--t-body);
  line-height: var(--t-body-lh);
}
.prompt-dock textarea:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
}
.run-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
  flex-wrap: wrap;
}
.run {
  display: flex;
  flex-direction: column;
  border: var(--bw) solid var(--line);
  padding: var(--s2) var(--s3);
  cursor: pointer;
  min-width: var(--s8);
  border-radius: var(--r2);
}
.run input { display: none; }
.run:has(input:checked) {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--ink);
}
.run small {
  color: var(--mute);
  font-family: var(--mono);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-variant-numeric: tabular-nums;
}
.confirm { color: var(--mute); display: flex; gap: var(--s2); align-items: center; }
.go {
  margin-left: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--control-h);
  background: var(--go);
  border: 0;
  color: var(--action-ink);
  padding: var(--s3) var(--s5);
  cursor: pointer;
  font-weight: 600;
  border-radius: var(--r2);
}
.go:hover { filter: brightness(1.08); }
.go:active { transform: translateY(var(--nudge)); }
.go:disabled { opacity: 0.5; cursor: not-allowed; }

.params label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin-bottom: var(--s4);
  color: var(--mute);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  text-transform: uppercase;
  letter-spacing: var(--t-micro-ls);
}
.params input, .params select, .params textarea {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--t-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: var(--bw) solid var(--line);
  border-radius: var(--r1);
  padding: var(--s2) var(--s3);
  width: 100%;
}
.params input:focus-visible,
.params select:focus-visible,
.params textarea:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
}
.params input[readonly] {
  color: var(--mute);
  background: var(--pane);
  cursor: default;
}
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.hint {
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
  text-transform: none;
  letter-spacing: 0;
  padding: var(--s3);
  background: var(--raised);
  border-radius: var(--r2);
  box-shadow: inset var(--mark) 0 0 var(--attention);
}
.param-actions { display: flex; flex-direction: column; gap: var(--s1); margin-top: var(--s3); }
.param-actions .cmd { border: var(--bw) solid var(--line); text-align: left; }

.page { padding: var(--s6) var(--s5); width: min(100%, var(--page-max)); max-width: var(--page-max); }
.page h1 {
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  letter-spacing: var(--t-h2-ls);
  font-weight: 600;
  margin: 0 0 var(--s4);
}
.kicker {
  color: var(--mute);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  text-transform: uppercase;
  letter-spacing: var(--t-micro-ls);
}
.note {
  color: var(--mute);
  box-shadow: inset var(--mark) 0 0 var(--go);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  background: var(--pane);
  border-radius: var(--r2);
}
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.split .actions { margin-top: var(--s4); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--go);
  color: var(--action-ink);
  border: 0;
  padding: var(--s2) var(--s3);
  cursor: pointer;
  border-radius: var(--r2);
  font-weight: 600;
  min-height: var(--control-h);
  white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border: var(--bw) solid var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gpu-offers { margin-top: var(--s4); }
.sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.thumb {
  position: relative;
  min-height: var(--thumb-min);
  background: var(--bg);
  overflow: hidden;
  border-radius: var(--r2);
  box-shadow: var(--e1);
}
.thumb img { width: 100%; height: var(--thumb-img-h); object-fit: cover; }
.thumb small { position: absolute; left: var(--s2); bottom: var(--s2); color: var(--action-ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.list { display: flex; flex-direction: column; gap: var(--s1); }
.shot-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--thumb-w) minmax(0, 1fr) var(--shot-meta) var(--shot-status) var(--shot-cost) auto;
  gap: var(--s2) var(--s3);
  padding: var(--s2) var(--s3);
  height: 80px;
  max-height: 80px;
  overflow: hidden;
  border-bottom: none;
  align-items: center;
  border-radius: var(--r2);
  box-shadow: var(--e1);
  background: var(--surface);
}
.shot-open {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.shot-thumb { width: var(--thumb-w); height: var(--thumb-h); }
.shot-body {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.shot-body .mono {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.line-clamp,
.hist-prompt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: normal;
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  margin: 0;
}
.hist-prompt {
  position: relative;
  z-index: 2;
  min-width: 0;
  color: var(--ink);
}
.shot-row .media-tile,
.shot-row .shot-actions {
  position: relative;
  z-index: 2;
}
.shot-row .media-tile img,
.shot-row .media-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r1);
}
.shot-row > .badge,
.shot-row > .mono {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shot-row .media-btns { margin-top: 0; }
.shot-actions form { margin: 0; }
.type-pill {
  display: grid;
  place-items: center;
  width: var(--thumb-w);
  height: var(--thumb-h);
  border-radius: var(--r1);
  background: var(--bg);
  color: var(--mute);
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
}
.mono {
  font-family: var(--mono);
  font-size: var(--t-sm);
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.stat {
  border: none;
  padding: var(--s4);
  background: var(--pane);
  border-radius: var(--r3);
  box-shadow: var(--e1);
}
.stat b {
  display: block;
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  letter-spacing: var(--t-h3-ls);
  margin: var(--s1) 0;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}
.projects, .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: var(--s4); }
.totp-enroll { display: flex; flex-direction: column; margin: var(--s4) 0; }
.totp-qr {
  align-self: flex-start;
  background: #fff;
  padding: var(--s2);
  border-radius: var(--r2);
  line-height: 0;
  margin: var(--s3) 0;
}
.totp-qr svg { display: block; width: 212px; height: 212px; }
.totp-key { word-break: break-all; margin-bottom: var(--s4); }
.totp-key .mono { color: var(--ink); }
.side-stack { display: flex; flex-direction: column; gap: var(--s2); }
table.ledger { width: 100%; border-collapse: separate; border-spacing: 0 var(--s1); }
table.ledger th, table.ledger td {
  text-align: left;
  padding: var(--s3) var(--s4);
  border-bottom: none;
  background: var(--surface);
}
table.ledger th:first-child, table.ledger td:first-child { border-radius: var(--r2) 0 0 var(--r2); }
table.ledger th:last-child, table.ledger td:last-child { border-radius: 0 var(--r2) var(--r2) 0; }
table.ledger th { font-size: var(--t-micro); letter-spacing: var(--t-micro-ls); text-transform: uppercase; color: var(--mute); }
table.ledger .num, table.ledger td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
table.ledger td { box-shadow: var(--e1); }
.warn-line { color: var(--go); }
.portrait-hero { display: grid; grid-template-columns: var(--hero-w) 1fr; gap: var(--s4); }
.portrait-hero img { width: 100%; height: var(--hero-h); object-fit: cover; border-radius: var(--r3); }
.badge {
  font-size: var(--t-micro);
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: var(--t-micro-ls);
  font-weight: var(--t-micro-w);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 55% at 0% 0%, color-mix(in srgb, var(--action) 6%, transparent), transparent 62%),
    var(--bg);
}
.login-card {
  width: min(var(--login-w), 92vw);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s6);
  background: var(--surface);
  border: none;
  border-radius: var(--r4);
  box-shadow: var(--e3);
}
.login-card h1 {
  margin: 0;
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  letter-spacing: var(--t-h2-ls);
  font-weight: 600;
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  color: var(--mute);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  text-transform: uppercase;
  letter-spacing: var(--t-micro-ls);
}
.login-card input {
  font-size: var(--t-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: var(--bw) solid var(--line);
  border-radius: var(--r1);
  padding: var(--s2) var(--s3);
  min-height: var(--control-h);
}
.login-card input:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
}
.login-card .go { width: 100%; margin-left: 0; }

.guide {
  padding: var(--s6) var(--s5);
  max-width: var(--page-max);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
.guide h1 {
  font-size: var(--t-h1);
  line-height: var(--t-h1-lh);
  letter-spacing: var(--t-h1-ls);
  font-weight: 700;
  margin: 0;
}
.guide h2 {
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  letter-spacing: var(--t-h3-ls);
  font-weight: 600;
  margin: 0 0 var(--s3);
}
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--s8), 1fr)); gap: var(--s2); }
.swatch {
  padding: var(--s4);
  border-radius: var(--r2);
  box-shadow: var(--e1);
  min-height: var(--s8);
}
.swatch b { display: block; font-size: var(--t-sm); }
.swatch span { font-family: var(--mono); font-size: var(--t-micro); font-variant-numeric: tabular-nums; }
.swatch-bg { background: var(--bg); color: var(--ink); }
.swatch-surface { background: var(--surface); color: var(--ink); }
.swatch-pane { background: var(--pane); color: var(--ink); }
.swatch-raised { background: var(--raised); color: var(--ink); }
.swatch-line { background: var(--line); color: var(--ink); }
.swatch-line-strong { background: var(--line-strong); color: var(--ink); }
.swatch-ink { background: var(--ink); color: var(--bg); }
.swatch-ink-2 { background: var(--ink-2); color: var(--bg); }
.swatch-mute { background: var(--mute); color: var(--bg); }
.swatch-action { background: var(--action); color: var(--action-ink); }
.swatch-attention { background: var(--attention); color: var(--bg); }
.swatch-ok { background: var(--ok); color: var(--bg); }
.type-sm { font-size: var(--t-sm); line-height: var(--t-sm-lh); }
.type-lead { font-size: var(--t-lead); line-height: var(--t-lead-lh); font-weight: var(--t-lead-w); }
.type-h3 { font-size: var(--t-h3); line-height: var(--t-h3-lh); letter-spacing: var(--t-h3-ls); font-weight: 600; }
.type-h2 { font-size: var(--t-h2); line-height: var(--t-h2-lh); letter-spacing: var(--t-h2-ls); font-weight: 600; }
.type-h1 { font-size: var(--t-h1); line-height: var(--t-h1-lh); letter-spacing: var(--t-h1-ls); font-weight: 700; }
.guide-sample { max-width: var(--params-w); }
.guide-queue { max-width: var(--queue-w); min-height: 0; }
.toast.is-static { position: static; }
.type-row { display: flex; flex-direction: column; gap: var(--s2); }
.guide-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

.go.htmx-request,
.bench.is-generating .go { pointer-events: none; }
.go.htmx-request .icon,
.bench.is-generating .go .icon { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .cmd, .go, .q-item, .run, .btn, .shot-row {
    transition: background-color var(--base) var(--ease),
      border-color var(--base) var(--ease),
      color var(--base) var(--ease),
      box-shadow var(--base) var(--ease),
      transform var(--fast) var(--ease),
      opacity var(--base) var(--ease);
  }
  .q-item:hover {
    background: var(--raised);
    transform: translateY(calc(-1 * var(--nudge)));
  }
  .gpu-pill.is-starting i {
    animation: gpu-pulse var(--pulse) var(--ease) infinite;
  }
  .preview-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 6%, transparent), transparent);
    opacity: 0;
    transform: translateX(-100%);
  }
  .bench.is-generating .preview-frame::after,
  .preview-frame.htmx-request::after {
    opacity: 1;
    animation: sweep var(--sweep) var(--ease) infinite;
  }
  .go.htmx-request::after,
  .bench.is-generating .go::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--s4);
    height: var(--s4);
    margin: 0;
    border: var(--mark) solid color-mix(in srgb, var(--action-ink) 30%, transparent);
    border-top-color: var(--action-ink);
    border-radius: var(--rp);
    animation: spin var(--slow) linear infinite;
    transform: translate(-50%, -50%);
  }
}

@keyframes gpu-pulse {
  50% { opacity: 0.35; }
}
@keyframes sweep {
  to { transform: translateX(100%); }
}
@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 960px) {
  .bench { grid-template-columns: 1fr; height: auto; }
  .bench.is-folded { grid-template-columns: 1fr; }
  .queue { display: none; }
  .queue.agents { display: flex; }
}

.agent-row {
  display: grid;
  grid-template-columns: var(--dot) 1fr;
  gap: var(--s2);
  align-items: start;
  padding: var(--s2);
  border-radius: var(--r2);
  color: var(--mute);
}
.agent-row b { display: block; color: var(--ink); font-weight: 500; }
.agent-row span span { font-size: var(--t-sm); font-family: var(--mono); }
.agent-row.is-on {
  background: var(--raised);
  box-shadow: inset var(--mark) 0 0 var(--action);
}
.agent-dot {
  width: var(--dot);
  height: var(--dot);
  border-radius: var(--rp);
  background: var(--mute);
  margin-top: 0.45em;
}
.agent-dot.is-ready { background: var(--ok); }
.agent-dot.is-busy { background: var(--attention); }
.agent-dot.is-off { background: var(--mute); }
.video-h { margin-top: var(--s4); }
.work, .chat-panel, .job-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
body.nav-create .bench {
  height: calc(100vh - var(--cmdbar-h));
  max-height: calc(100vh - var(--cmdbar-h));
  min-height: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
}
body.nav-create .queue,
body.nav-create .params {
  overflow: auto;
  min-height: 0;
}
body.nav-create .preview.work {
  overflow-y: auto;
  min-height: 0;
}
body.nav-create .preview.work > .job-panel,
body.nav-create .preview.work > .chat-panel {
  height: auto;
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s2) 0;
}
.chat-bubble {
  max-width: 42rem;
  padding: var(--s3);
  border-radius: var(--r2);
  background: var(--pane);
  color: var(--ink);
}
.chat-bubble.is-user {
  align-self: flex-end;
  background: var(--raised);
}
.chat-bubble pre {
  margin: var(--s2) 0 0;
  white-space: pre-wrap;
  font-family: var(--sans);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
}
.chat-bubble b { font-size: var(--t-micro); letter-spacing: var(--t-micro-ls); text-transform: uppercase; color: var(--mute); }
.input-thumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
  color: var(--mute);
  font-size: var(--t-sm);
}
.input-thumb img {
  width: var(--thumb-w);
  height: var(--thumb-h);
  object-fit: cover;
  border-radius: var(--r1);
  background: var(--bg);
}
.file-slot { margin-bottom: var(--s3); }
.files .hint { margin-top: var(--s2); }

.series {
  height: auto;
  overflow: visible;
  align-items: start;
}
.series .work {
  overflow: visible;
  height: auto;
  gap: var(--s4);
}
.series .queue,
.series .params {
  background: transparent;
  box-shadow: none;
  padding: 0;
  gap: var(--s3);
  overflow: visible;
  height: auto;
}
.series .hint {
  box-shadow: none;
  background: transparent;
  padding: 0;
}
.series-stack,
.series-side {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.series-cartouche {
  background: var(--raised);
  border-radius: var(--r3);
  box-shadow: var(--e2);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-width: 0;
}
.series-cartouche.is-later {
  opacity: 0.72;
}
.series-cartouche-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}
.series-cartouche-h b {
  color: var(--ink);
  font-size: var(--t-lead);
  line-height: var(--t-lead-lh);
  font-weight: var(--t-lead-w);
}
.series-cartouche-h span {
  color: var(--mute);
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
}
.series-cartouche > label,
.series-cartouche .pair label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  color: var(--mute);
  font-size: var(--t-micro);
  line-height: var(--t-micro-lh);
  font-weight: var(--t-micro-w);
  text-transform: uppercase;
  letter-spacing: var(--t-micro-ls);
}
.series-cartouche textarea,
.series-cartouche select,
.series-cartouche input:not([type="file"]):not([type="hidden"]) {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--t-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: var(--bw) solid var(--line);
  border-radius: var(--r1);
  padding: var(--s2) var(--s3);
  width: 100%;
}
.series-cartouche textarea {
  min-height: var(--prompt-min);
  resize: vertical;
}
.series-cartouche textarea:focus-visible,
.series-cartouche select:focus-visible,
.series-cartouche input:focus-visible,
.series-drop:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
}
.series-hook-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}
.series-hook-list li {
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
  padding: var(--s1) 0;
}
.series-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--thumb-h);
  height: var(--thumb-h);
  margin: 0;
  padding: var(--s2);
  background: var(--bg);
  border: var(--bw) dashed var(--line-strong);
  border-radius: var(--r1);
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: var(--t-sm-lh);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
}
.series-slot form {
  display: block;
  height: 100%;
  margin: 0;
}
.series-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--s2);
  align-items: start;
}
.series-chip img,
.series-slot img,
.series-card img {
  width: 100%;
  height: var(--thumb-h);
  max-height: var(--thumb-h);
  object-fit: cover;
  border-radius: var(--r1);
  background: var(--pane);
}
.series-person {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
  align-items: stretch;
}
.series-person-id {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: var(--s2);
}
.series-person-id b { color: var(--ink); font-weight: 500; }
.series-person-id span {
  color: var(--mute);
  font-family: var(--mono);
  font-size: var(--t-sm);
}
.series-more summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: var(--t-sm);
  padding: var(--s2) 0;
}
.series-more summary:focus-visible {
  box-shadow: 0 0 0 var(--focus-w) var(--focus);
  border-radius: var(--r1);
}
.series-more .series-cast { margin-top: var(--s2); }
.series-bins {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s4) 0 var(--s5);
}
.series-cast {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.series-card {
  background: var(--bg);
  border-radius: var(--r2);
  padding: var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.series-card.is-on {
  box-shadow: inset var(--mark) 0 0 var(--action);
}
.series-mux {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s2);
}
.series-mux video {
  display: block;
  width: 100%;
  max-height: 16rem;
  background: var(--pane);
  border-radius: var(--r1);
}
.series-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
}
.series-slot,
.series-chip {
  background: var(--bg);
  border-radius: var(--r1);
  min-height: var(--thumb-h);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  color: var(--mute);
  font-size: var(--t-sm);
}
.series-slot.is-on,
.series-chip {
  color: var(--ink);
  padding: var(--s1);
}
.series-slot img,
.series-chip img,
.series-card img {
  width: 100%;
  height: var(--thumb-h);
  object-fit: cover;
  border-radius: var(--r1);
  background: var(--pane);
}
.series .q-item {
  align-items: start;
}
.series .q-item .cmd {
  margin-top: var(--s1);
}
@media (max-width: 960px) {
  .series-person { grid-template-columns: 1fr 1fr; }
}
