/* allow: SIZE_OK — shared Studio cascade and tokens intentionally span all routes; Operations page rules are split into dedicated modules. */
:root {
  --bg: #f4efe4;
  --ink: #11121a;
  --muted: #5d6472;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(17, 18, 26, 0.12);
  --accent: #e25f3c;
  --ok: #1d8f56;
  --warn: #cc7e12;
  --bad: #c5362f;
  --accent-strong: #a83f22;
  --ok-strong: #17663d;
  --warn-strong: #7a4f0f;
  --bad-strong: #a12620;
  --on-accent: #ffffff;
  --focus-ring: #11121a;
  --surface-soft: rgba(255, 255, 255, 0.72);
  --modal-surface: #ffffff;
  --modal-backdrop: rgba(17, 18, 26, 0.68);
  --modal-frame: rgba(17, 18, 26, 0.06);
  --approval-dialog-width: 68rem;
  --approval-dialog-max-height: min(88vh, 54rem);
  --approval-dialog-mobile-width: calc(100% - var(--space-3));
  --approval-dialog-mobile-max-height: calc(100vh - var(--space-3));
  --approval-preview-min-height: 12rem;
  --approval-preview-max-height: 28rem;
  --touch-target: 44px;
  --shadow-soft: 0 14px 36px rgba(27, 27, 39, 0.08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 48px;
  --space-card: 14px;
  --space-inline-tight: 10px;
  --space-mobile-header: 18px;
  --space-attention-hint: 20px;
  --radius-inner: 10px;
  --radius-compact: 8px;
  --text-body: 0.92rem;
  --text-metadata: 0.78rem;
  --text-label: 0.74rem;
  --text-section: 1.05rem;
  --text-ui: 0.82rem;
  --text-support: 0.84rem;
  --leading-tight: 1.4;
  --leading-body: 1.45;
  --leading-loose: 1.5;
  --tracking-label: 0.06em;
  --tracking-heading: -0.03em;
  --control-padding: var(--space-3);
  --control-padding-compact: var(--space-2);
  --status-min-height: 28px;
  --control-check-size: 18px;
  --pagination-status-width: 68px;
  --rail-status: 3px;
  --rail-state: 4px;
  --selection-column: 44px;
  --thumbnail-size: 72px;
  --pill-radius: 999px;
  --control-sort-width: 240px;
  --transition-fast: 0.15s;
  --skeleton-duration: 1.4s;
  --motion-press-offset: 1px;
  --outline-width: 2px;
  --outline-offset: 2px;
  --text-underline-thickness: 1.5px;
  --text-underline-offset: 0.2em;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 12% 12%, #fceac8 0, #f4efe4 45%, #ede9de 100%);
}

body {
  position: relative;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.45;
  pointer-events: none;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #ff9b78;
  top: -120px;
  right: -50px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: #89c5a4;
  bottom: -120px;
  left: -40px;
}

.app-shell {
  width: min(1400px, 96vw);
  margin: 24px auto 32px;
  position: relative;
  z-index: 2;
}

.top-bar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3.2vw, 2.4rem);
  letter-spacing: -0.03em;
}

.top-bar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 36px rgba(27, 27, 39, 0.08);
}

.upload-panel {
  margin-top: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  row-gap: 4px;
}

.pair-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pair-hint code {
  background: rgba(17, 18, 26, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.file-label em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  margin-left: 4px;
}

.upload-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-panel {
  margin-top: 12px;
  padding: 10px 12px;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.billing-metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.billing-metric span {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.billing-metric strong {
  font-size: 0.95rem;
}

#uploadForm {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.file-label {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.file-label input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.file-label span {
  /* Include vertical padding in the wrapped flex row's height. */
  display: inline-block;
}

.file-label span,
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  background: #fff;
}

.view-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.view-label span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

#viewSelect {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  background: #fff;
}

/* "Editing: <bag-id>" row at the top of the workspace so it's always clear
   which bag is currently loaded in the correction tool. */
.workspace-id-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.workspace-id-label {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.workspace-id-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.workspace-id-batch {
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(45, 111, 88, 0.08);
  border: 1px solid rgba(45, 111, 88, 0.2);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}

.workspace-id-batch:hover {
  background: rgba(45, 111, 88, 0.14);
}

/* Prev/Next job navigation, parked at the right end of the editing row. */
.job-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.job-nav-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(45, 111, 88, 0.08);
  border: 1px solid rgba(45, 111, 88, 0.2);
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
}

.job-nav-btn:hover:not(:disabled) {
  background: rgba(45, 111, 88, 0.16);
}

.job-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.job-nav-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Front/Back view-switch + matching Download buttons live inside
   `.viewport-toolbar` between `.viewport-tools` (left) and `.viewport-meta`
   (right). `margin-left: auto` parks the group sticky-right of the tools
   cluster while leaving the meta bits on the far right. */
.view-switch-buttons {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.view-switch-buttons button.active {
  background: #11121a;
  color: #fff;
  border-color: #11121a;
}

/* Download buttons sit next to the View buttons; visually inverted so they
   don't read as another "active" view state. Filled green vs the view
   buttons' light-grey/dark-when-active scheme — distinct at a glance. */
.view-switch-buttons .download-btn {
  background: #2d6f58;
  color: #fff;
  border-color: transparent;
}

.view-switch-buttons .download-btn:hover:not(:disabled) {
  background: #245a48;
}

.view-switch-buttons .download-btn:disabled {
  background: #b6c9c0;
  border-color: transparent;
  color: #fff;
}

.processing-note {
  margin-top: 10px;
  border: 1px solid rgba(204, 126, 18, 0.35);
  background: #fff4df;
  color: #7a4f0f;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.viewport-toolbar {
  /* No own separator: the row above (`.workspace-id-row`) already supplies
     a single border-bottom. With both rows now flat siblings of the
     workspace section (the wrapping card was removed), keeping a top border
     here doubled-up the divider and added a chunk of dead vertical space. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.viewport-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.viewport-tools button.active {
  background: #11121a;
  color: #fff;
  border-color: #11121a;
}

.viewport-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.viewport-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.viewport-hint kbd {
  font: inherit;
  font-weight: 700;
  background: rgba(17, 18, 26, 0.08);
  border: 1px solid rgba(17, 18, 26, 0.15);
  border-radius: 6px;
  padding: 1px 6px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #222;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#uploadBtn,
#rerenderBtn {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.render-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
  min-width: 0;
  justify-content: flex-end;
}

.render-actions button {
  padding: 6px 10px;
  font-size: 0.74rem;
  line-height: 1.1;
  border-radius: 8px;
  white-space: nowrap;
}


#renderPointsToggleBtn.active {
  background: #11121a;
  color: #fff;
  border-color: #11121a;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  min-width: 90px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-pill.idle,
.status-pill.uploading,
.status-pill.queued,
.status-pill.running,
.status-pill.rerendering {
  background: #ffe9c4;
  color: #744b0b;
}

.status-pill.ready {
  background: #d6f8e6;
  color: #10613a;
}

.status-pill.error {
  background: #ffd7d5;
  color: #7f1d1d;
}

.status-text {
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.selected-file {
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobs-panel {
  margin-top: 14px;
  padding: 10px;
}

#refreshJobsBtn {
  background: #fff;
  color: var(--ink);
}

.jobs-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.jobs-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.jobs-sort-label select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.activity-panel {
  margin-top: 12px;
  padding: 10px;
}

.active-ops-list {
  max-height: 210px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-op-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
}

.active-op-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.active-op-title {
  font-size: 0.84rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-op-eta {
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(17, 18, 26, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.active-op-detail {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-op-meta {
  color: var(--muted);
  font-size: 0.74rem;
}

.active-op-open {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
}

.jobs-head,
.job-row {
  display: grid;
  /* Columns: Preview | ID (tight) | Updated | Render (flex) | Approval | Corrections | Actions
     ID was 1fr and Render fixed 110px, which left the Render column cramped
     and the ID column eating most of the width. Swap: ID gets a tight fixed
     track and Render gets the flex track so two stacked per-side pills fit. */
  grid-template-columns: 124px 150px 120px minmax(0, 1fr) 120px 90px 150px;
  gap: 8px;
  align-items: center;
}

.jobs-head {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.jobs-list {
  max-height: 220px;
  overflow: auto;
  padding-top: 6px;
}

.job-row {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  padding: 8px 0;
  font-size: 0.84rem;
}

.job-row.active {
  background: rgba(29, 143, 86, 0.13);
}

.job-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
}

.job-status.ready {
  color: var(--ok);
}

.job-status.error {
  color: var(--bad);
}

.job-status.draft,
.job-status.running,
.job-status.rerendering,
.job-status.queued,
.job-status.outdated {
  color: var(--warn);
}

/* Render-column cell + per-side mini pills. The cell stacks the front/back
   pills vertically when both are shown, so each side gets its own colour
   (instead of the old single span coloured by the back status). */
.job-status-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.status-pill-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(17, 18, 26, 0.06);
  color: var(--muted);
}

.status-pill-mini.ready {
  background: #d6f8e6;
  color: #10613a;
}

.status-pill-mini.error,
.status-pill-mini.failed {
  background: #ffd7d5;
  color: #7f1d1d;
}

.status-pill-mini.running,
.status-pill-mini.rerendering,
.status-pill-mini.queued,
.status-pill-mini.uploading,
.status-pill-mini.pending,
.status-pill-mini.outdated,
.status-pill-mini.draft {
  background: #ffe9c4;
  color: #744b0b;
}

.review-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.review-status.not_submitted {
  color: #566072;
  background: #eef2f7;
  border-color: rgba(86, 96, 114, 0.18);
}

.review-status.awaiting_review {
  color: #8a5b00;
  background: #fff2d6;
  border-color: rgba(138, 91, 0, 0.18);
}

.review-status.approved {
  color: #196b42;
  background: #e5f6ec;
  border-color: rgba(25, 107, 66, 0.16);
}

.review-status.rejected {
  color: #9f2b24;
  background: #ffe8e6;
  border-color: rgba(159, 43, 36, 0.18);
}

.review-status.on_hold {
  color: #855200;
  background: #fff0cc;
  border-color: rgba(133, 82, 0, 0.18);
}

.job-preview {
  width: 64px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f0f2f5;
  object-fit: cover;
  display: block;
}

.job-preview.placeholder {
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  color: var(--muted);
}

.job-preview-cell {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
}

.job-preview-thumb {
  width: 56px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f0f2f5;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.job-preview-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.04);
}

.job-preview-thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
}

.job-preview-thumb.placeholder.pending {
  border-style: dashed;
  background: rgba(204, 126, 18, 0.08);
  color: var(--warn);
}

.job-preview-thumb.front {
  border-color: rgba(45, 111, 88, 0.35);
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.job-review-cell {
  min-width: 0;
}

.load-btn,
.retry-btn,
.delete-btn {
  font-size: 0.75rem;
  padding: 6px 8px;
}

.retry-btn {
  border-color: rgba(226, 95, 60, 0.45);
  color: var(--accent-strong);
}

.retry-btn:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: rgba(226, 95, 60, 0.08);
}

.delete-btn {
  background: #fff3f2;
  color: #8b1f1a;
  border-color: rgba(197, 54, 47, 0.35);
}

.delete-btn:hover {
  border-color: var(--bad);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.left-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}

.image-card {
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
}

.badge {
  background: #f1f4fa;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #223;
}

.image-wrap {
  position: relative;
  background: #efeee8;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 420px;
  height: clamp(420px, 58vh, 760px);
  display: grid;
  place-items: center;
}

.image-wrap img {
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.image-wrap.is-tool-select {
  cursor: crosshair;
}

.image-wrap.is-tool-pan {
  cursor: grab;
}

.image-wrap.is-pan-active {
  cursor: grabbing;
}

.image-wrap.is-tool-zoom-in {
  cursor: zoom-in;
}

.image-wrap.is-tool-zoom-out {
  cursor: zoom-out;
}

.image-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 16px;
  text-align: center;
  background: rgba(239, 238, 232, 0.7);
  z-index: 2;
}

.hint {
  color: var(--muted);
  margin: 8px 2px 2px;
  font-size: 0.86rem;
}

.image-card .hint {
  min-height: 2.6em;
}

/* ===== Secondary-view preview ===== */
/* Sits below the active Input/Render pair and shows the other view at the
   same size as the primary surfaces. Clicking anywhere on the card swaps
   the active view (which re-renders the workspace with that view as
   primary). Spans both columns of `.left-col` so each thumb keeps half
   the width — matching the primary Input/Render layout exactly. */

.secondary-view-card {
  grid-column: 1 / -1;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.secondary-view-card:hover,
.secondary-view-card:focus-visible {
  border-color: var(--accent);
  background: rgba(226, 95, 60, 0.04);
  outline: none;
}

.secondary-view-card .card-header {
  margin-bottom: 8px;
}

.secondary-view-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.secondary-view-thumb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.secondary-view-caption {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mirror the primary `.image-wrap` framing so the secondary view sits at
   the same dimensions as the active surfaces above it. */
.secondary-view-thumb .image-wrap-mirror {
  position: relative;
  background: #efeee8;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 420px;
  height: clamp(420px, 58vh, 760px);
}

/* Fit the image proportionally inside the wrap. Earlier `width:auto;
   height:auto; max-width:100%; max-height:100%` combo could let tall photos
   overflow the wrap on some browsers (the wrap's `overflow:hidden` would
   then crop the bottom — that's the "image below being cut off" the user
   saw). Filling 100% of the wrap and using `object-fit: contain` is the
   canonical aspect-preserving fit and avoids that browser quirk. */
.secondary-view-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.secondary-view-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  color: var(--muted);
  background: rgba(240, 242, 245, 0.92);
  border: 1px dashed var(--line);
  border-radius: 12px;
  pointer-events: none;
}

.hint-tight {
  margin: 8px 0 2px;
}

.click-marker {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #000;
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}

.render-marker {
  border-color: #111;
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px #e25f3c;
}

.hover-marker {
  width: 14px;
  height: 14px;
  border-color: #0f172a;
  background: #f8fafc;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(29, 143, 86, 0.7);
  z-index: 4;
}

.hover-label {
  position: absolute;
  z-index: 5;
  transform: translate(10px, -18px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.74rem;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
}

.render-points-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.render-points-overlay.tool-blocked .render-point-chip {
  pointer-events: none;
}

.render-point-chip {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  overflow: visible;
  cursor: pointer;
}

.render-point-chip-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.82);
  transform: translate(-50%, -50%);
}

.render-point-chip:hover .render-point-chip-dot,
.render-point-chip:focus-visible .render-point-chip-dot {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(29, 143, 86, 0.7);
}

.render-point-chip.active .render-point-chip-dot {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px #e25f3c;
}

.render-point-chip.queued .render-point-chip-dot {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(226, 95, 60, 0.45);
}

.right-col {
  padding: 10px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

#filterInput {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  width: min(240px, 100%);
}

.table-head,
.part-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 80px 74px;
  gap: 8px;
  align-items: center;
}

.table-head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 0 0 8px;
}

.parts-list {
  overflow: auto;
  padding-top: 6px;
  max-height: min(72vh, 840px);
}

.part-row {
  padding: 7px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 0.88rem;
  cursor: pointer;
}

.part-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.part-row.active {
  background: rgba(226, 95, 60, 0.11);
}

.part-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swatch {
  width: 28px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.24);
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.action-btn {
  font-size: 0.78rem;
  padding: 5px 8px;
}

/* Saturation/brightness toggle + per-component sliders. Hidden by default so
   the components table looks unchanged until the user opts in. */
.adjust-toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 0 2px;
  user-select: none;
}

.adjust-toggle-label input {
  cursor: pointer;
}

/* The sliders live as a full-width 5th grid item under each part row. */
.part-adjust {
  grid-column: 1 / -1;
  display: flex;
  gap: 14px;
  padding: 6px 2px 2px;
}

.parts-list:not(.show-adjust) .part-adjust {
  display: none;
}

.adjust-ctl {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: default;
}

.adjust-label {
  flex: 0 0 auto;
  width: 34px;
}

.adjust-ctl input[type="range"] {
  flex: 1 1 auto;
  min-width: 50px;
  accent-color: var(--accent, #e25f3c);
  cursor: pointer;
}

.adjust-val {
  flex: 0 0 auto;
  width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.adjust-val.nonzero {
  color: var(--ink);
  font-weight: 700;
}

.inline-spinner {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  flex: 0 0 auto;
  animation: spinner-rotate 0.78s linear infinite;
}

.inline-spinner.tiny {
  width: 10px;
  height: 10px;
  border-width: 2px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .left-col {
    grid-template-columns: 1fr;
  }

  .right-col {
    max-height: unset;
  }

  .parts-list {
    max-height: 48vh;
  }

  .image-wrap {
    min-height: 320px;
    height: min(62vh, 560px);
  }

  .render-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .viewport-toolbar {
    align-items: flex-start;
  }

  .upload-panel {
    gap: 8px;
  }

  .upload-files {
    flex-direction: column;
    gap: 4px;
  }

  .billing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-file {
    max-width: 100%;
  }

  .jobs-head,
  .job-row {
    grid-template-columns: 110px 120px 90px minmax(0, 1fr) 100px 70px 128px;
  }

  .job-preview-thumb {
    width: 50px;
    height: 38px;
  }

  .active-op-row {
    grid-template-columns: 1fr;
  }

  .active-op-detail {
    white-space: normal;
  }

  .active-op-open {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 2px;
  }
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Top navbar (page-level Studio | Approvals) ===== */

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 10px 16px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 36px rgba(27, 27, 39, 0.08);
}

.top-nav-brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.top-nav-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.top-nav-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 6px 16px;
  min-height: var(--touch-target);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-nav-brand:focus-visible,
.top-nav-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.top-nav-tab:hover {
  background: rgba(17, 18, 26, 0.04);
  color: var(--ink);
}

.top-nav-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}

.top-nav-tab .tab-count {
  min-width: 22px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(17, 18, 26, 0.08);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  line-height: 1;
}

.top-nav-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ===== Single/Batch tabs INSIDE the upload card ===== */

.upload-card {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.upload-mode-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 18, 26, 0.03);
}

.upload-mode-tab {
  appearance: none;
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.upload-mode-tab:hover {
  background: rgba(17, 18, 26, 0.04);
  color: var(--ink);
}

.upload-mode-tab.active {
  color: var(--ink);
  background: var(--panel);
  border-bottom-color: var(--accent);
}

.upload-mode-pane {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-mode-pane.hidden {
  display: none;
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

.mode-panel.hidden {
  display: none;
}

.batch-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-clear-btn {
  font-size: 0.78rem;
  padding: 6px 10px;
  color: var(--muted);
}

.batch-clear-btn:hover {
  color: var(--ink);
  border-color: #222;
}

.batch-drop-zone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  margin: 12px 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.batch-drop-zone em {
  font-style: italic;
  color: var(--ink);
}

.batch-drop-zone.active {
  border-color: var(--accent);
  background: rgba(226, 95, 60, 0.06);
  color: var(--ink);
}

.batch-preview-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 14px;
  font-size: 0.88rem;
}

.batch-preview-row {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1.5fr 1fr;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.batch-preview-row.unpaired {
  grid-template-columns: 2fr 1fr;
  color: var(--warn);
}

.batch-start-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.batch-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
}

.batch-progress-bar {
  flex: 1;
  height: 10px;
  background: rgba(17, 18, 26, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.batch-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f2a874);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.batch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-items-head {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1.2fr;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}

.batch-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.batch-item-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1.2fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
}

.batch-item-row .image-id {
  font-weight: 600;
}

.batch-item-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.batch-item-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.batch-item-thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.batch-status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.batch-status-pill.pending { background: rgba(93,100,114,0.12); color: var(--muted); }
.batch-status-pill.queued { background: rgba(93,100,114,0.18); color: var(--muted); }
.batch-status-pill.queued_render { background: rgba(204,126,18,0.15); color: var(--warn); }
.batch-status-pill.running { background: rgba(226,95,60,0.15); color: var(--accent); }
.batch-status-pill.extracting { background: rgba(226,95,60,0.12); color: var(--accent); }
.batch-status-pill.extracted { background: rgba(29,143,86,0.14); color: var(--ok); }
.batch-status-pill.rendering { background: rgba(226,95,60,0.18); color: var(--accent); }
.batch-status-pill.ready { background: rgba(29,143,86,0.18); color: var(--ok); }
.batch-status-pill.failed { background: rgba(197,54,47,0.16); color: var(--bad); }
.batch-status-pill.cancelled { background: rgba(93,100,114,0.2); color: var(--muted); }
.batch-status-pill.paused { background: rgba(204,126,18,0.18); color: var(--warn); }
.batch-status-pill.completed { background: rgba(29,143,86,0.2); color: var(--ok); }
.batch-status-pill.deleted { background: rgba(160,40,40,0.18); color: #8a1d1d; text-decoration: line-through; }

.batch-item-thumb.deleted-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    rgba(160, 40, 40, 0.10),
    rgba(160, 40, 40, 0.10) 6px,
    rgba(160, 40, 40, 0.18) 6px,
    rgba(160, 40, 40, 0.18) 12px
  );
  color: #8a1d1d;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px dashed rgba(160, 40, 40, 0.5);
  border-radius: 8px;
  cursor: default;
}

.deleted-hint {
  color: #8a1d1d;
}

.job-batch-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(45, 111, 88, 0.14);
  color: #2d6f58;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid rgba(45, 111, 88, 0.25);
  vertical-align: middle;
}

.job-batch-badge:hover {
  background: rgba(45, 111, 88, 0.22);
}

.batch-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.batch-item-actions button {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.batch-list-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  cursor: pointer;
}

.batch-list-row:hover {
  background: rgba(226, 95, 60, 0.05);
}

.batch-list-row [data-action="delete"] {
  padding: 4px 9px;
  font-size: 0.95rem;
  line-height: 1;
}

.batch-error {
  grid-column: 1 / -1;
  color: var(--bad);
  font-size: 0.8rem;
}

button.danger {
  background: #b3402b;
  border-color: #92341f;
  color: #fff;
}

button.danger:hover:not(:disabled) {
  background: #92341f;
}

button.danger:disabled {
  background: #cdb6b1;
  border-color: #c0a59f;
  color: #ffffff;
  cursor: not-allowed;
}

/* ===== Per-batch collapsible groups inside Jobs ===== */
/* The group header doubles as the lifecycle control row: it carries
   Pause / Resume / Cancel / ZIP / Delete buttons + a small progress bar
   inline. Clicking the buttons doesn't toggle expand/collapse (handler
   filters those clicks). */

.batch-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.batch-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.batch-group-header {
  display: grid;
  grid-template-columns: 16px minmax(180px, 1.4fr) auto auto auto minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  background: rgba(0, 0, 0, 0.025);
}

.batch-group-header:hover {
  background: rgba(226, 95, 60, 0.06);
}

.batch-group-caret {
  font-size: 0.72rem;
  color: var(--muted);
  width: 14px;
}

.batch-group-title {
  font-weight: 700;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.batch-group-stats {
  font-size: 0.78rem;
  color: var(--muted);
}

.batch-group-updated {
  font-size: 0.75rem;
  white-space: nowrap;
}

.batch-group-progress {
  min-width: 120px;
}

.batch-group-progress .batch-progress-bar {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.batch-group-progress .batch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f2a874);
  transition: width 0.3s ease;
}

.batch-group-progress .batch-progress-fill.complete {
  background: linear-gradient(90deg, var(--ok), #4ec38a);
}

.batch-group-actions {
  grid-column: 2 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  cursor: default;
}

.job-style-label {
  display: block;
  font-family: inherit;
  font-weight: 400;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.batch-group-actions button {
  font-size: 0.78rem;
  padding: 4px 9px;
}

.batch-group-actions button[data-batch-action="retry-fresh"]:not(:disabled) {
  border-color: rgba(226, 95, 60, 0.55);
  color: var(--accent-strong);
}

.batch-export-status {
  color: var(--muted);
  font-size: 0.78rem;
  grid-column: 2 / -1;
  min-width: 0;
}

.batch-group-items {
  padding: 4px 12px 8px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Reuse .job-row inside batch groups; just add a left rail accent. */
.batch-group-items .job-row {
  border-left: 2px solid rgba(226, 95, 60, 0.3);
  padding-left: 8px;
}

/* Highlight duplicate-imageId conflicts in the batch preview unpaired list. */
.batch-preview-row.unpaired.conflict {
  background: rgba(179, 64, 43, 0.06);
  border-color: rgba(179, 64, 43, 0.4);
}

@media (max-width: 720px) {
  .jobs-panel {
    min-width: 0;
  }

  .jobs-head {
    display: none;
  }

  .job-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px 10px;
    min-width: 0;
    align-items: start;
  }

  .job-row > * {
    min-width: 0;
  }

  .job-preview-cell {
    grid-column: 1;
    grid-row: 1 / span 5;
    flex-direction: column;
    align-items: stretch;
  }

  .job-preview-thumb {
    width: 56px;
    height: 30px;
  }

  .job-row > .job-id {
    grid-column: 2;
    grid-row: 1;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .job-row > :nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    overflow-wrap: anywhere;
  }

  .job-row > :nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  .job-row > :nth-child(5) {
    grid-column: 2;
    grid-row: 4;
  }

  .job-row > :nth-child(6) {
    grid-column: 2;
    grid-row: 5;
  }

  .job-row > .job-actions {
    grid-column: 1 / -1;
    grid-row: 6;
    flex-wrap: wrap;
  }

  .batch-group-header {
    grid-template-columns: 16px 1fr auto;
  }

  .batch-group-stats,
  .batch-group-updated,
  .batch-group-progress,
  .batch-group-actions {
    grid-column: 2 / -1;
  }
}
.bag-style-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.bag-style-field select {
  font: inherit;
  max-width: 100%;
  padding: 0.55rem;
}

.batch-preview-style {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
