/* Arabic type is served locally, so the studio looks the same on every device. */
@font-face {
  font-family: 'Tajawal';
  src: url('/static/fonts/Tajawal-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/static/fonts/Tajawal-Medium.woff2') format('woff2');
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/static/fonts/Tajawal-Bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f5f6fa;
  --surface: #fff;
  --surface-subtle: #f8f9fc;
  --ink: #202637;
  --muted: #657086;
  --faint: #657086;
  --accent: #4056e8;
  --accent-hover: #3144c7;
  --accent-subtle: #f0f3ff;
  --line: #e3e7ef;
  --line-strong: #cdd4e1;
  --success: #247657;
  --warning: #946119;
  --danger: #b23d4a;
  --radius: 12px;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font:
    400 16px/1.65 'Tajawal',
    Tahoma,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}
html[lang='en'] body {
  font-family: system-ui, 'Tajawal', sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
summary,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
  outline-offset: 4px;
}
:focus-visible {
  outline: 3px solid #a2b0ff;
}
button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 500;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
a {
  color: inherit;
}
svg {
  display: block;
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}

/* Header and compact workflow navigation. */
.topbar {
  height: 72px;
  padding-inline: max(32px, calc((100vw - 1472px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.home-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}
.home-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 10px;
}
.home-icon svg {
  width: 28px;
  height: 28px;
}
.top-actions,
.top-action,
.access summary {
  display: flex;
  align-items: center;
}
.top-actions {
  gap: 8px;
}
.top-action,
.access summary {
  min-height: 40px;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.top-action:hover,
.access summary:hover,
.access[open] summary {
  background: var(--surface-subtle);
}
.top-action svg,
.access summary svg {
  width: 18px;
  height: 18px;
}
.language-switch {
  border-color: var(--line-strong);
}
.language-switch [lang='en'] {
  font-family: system-ui, sans-serif;
}
.access {
  position: relative;
  font-size: 14px;
}
summary {
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}
html[dir='ltr'] .step-arrow {
  transform: scaleX(-1);
}
.access p {
  position: absolute;
  z-index: 10;
  inset-inline-end: 0;
  width: 288px;
  margin: 8px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: 0 8px 32px #20263712;
}
main {
  max-width: 1536px;
  margin-inline: auto;
  padding: 28px 32px 0;
}
.intro {
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}
h1 {
  margin: 0 0 4px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
}
h1 > span {
  color: var(--accent);
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
}
.step + .step {
  border-inline-start: 1px solid var(--line);
}
.step > b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.step strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.step small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.step-arrow,
.step-check {
  margin-inline-start: auto;
  color: #a7afbf;
  font:
    19px/1 Arial,
    sans-serif;
}
.step:hover {
  background: var(--surface-subtle);
}
.step.active,
.step[aria-current='step'] {
  background: var(--accent-subtle);
}
.step.active > b,
.step[aria-current='step'] > b {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.step.complete > b {
  background: var(--accent-subtle);
  border-color: #cbd4ff;
  color: var(--accent);
}
.step.active strong {
  color: var(--accent);
}
.connection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.connection-row > button {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 14px;
}
.connection {
  flex: 1;
  margin: 0;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.connection::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 8px;
  border-radius: 50%;
  background: var(--faint);
  vertical-align: middle;
}

/* The right-hand setup panel is wide enough to read and use comfortably. */
.studio-grid {
  display: grid;
  grid-template-columns: 480px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.controls,
.workspace {
  min-width: 0;
}
.controls.panel {
  overflow: clip;
}
.setup-section {
  padding: 24px;
  scroll-margin-top: 24px;
}
.idea-section {
  border-top: 1px solid var(--line);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-title > div {
  min-width: 0;
}
.section-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
}
.section-description {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 20px 16px;
  text-align: center;
  border: 1px dashed #b8c2d7;
  border-radius: 10px;
  background: var(--surface-subtle);
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.upload-zone:hover,
.upload-zone.is-dragover,
.upload-zone.is-loading {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.upload-zone.is-dragover {
  box-shadow: 0 0 0 3px #4056e81a;
}
.upload-zone.is-loading {
  cursor: progress;
}
.upload-zone:focus-within {
  outline: 3px solid #a2b0ff;
  outline-offset: 4px;
}
.upload-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  color: var(--accent);
}
.upload-icon svg {
  width: 28px;
  height: 28px;
}
.upload-zone strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}
.upload-zone > span:not(.upload-icon) {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}
.upload-zone em {
  font-style: normal;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.upload-zone small {
  margin-top: 4px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}
.upload-input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 0 !important;
  padding: 0 !important;
  opacity: 0;
  overflow: hidden;
  bottom: 0;
}
.inline-feedback {
  margin: 12px 0 0;
  padding: 8px 12px;
  color: var(--success);
  background: #f1f8f4;
  border-radius: 8px;
  font-size: 14px;
}
.asset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.asset-list:empty {
  display: none;
}
.asset-card {
  position: relative;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.asset-card.is-primary,
.asset-card:has(input[type='radio']:checked) {
  border-color: #a2b0f9;
  background: #fafbff;
}
.asset-image {
  position: relative;
}
.asset-card img {
  display: block;
  width: 100%;
  height: 136px;
  object-fit: contain;
  background: var(--surface-subtle);
  border-radius: 6px;
}
.asset-badge {
  position: absolute;
  bottom: 6px;
  inset-inline-start: 6px;
  padding: 2px 6px;
  border: 1px solid #e0e5ff;
  border-radius: 5px;
  color: var(--accent);
  background: #fffffff2;
  font-size: 12px;
  font-weight: 500;
}
.asset-card label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}
.asset-card select {
  min-height: 36px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 16px;
}
.asset-assessment {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Form controls share a consistent scale, border, and focus treatment. */
label {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 500;
}
input:not([type='checkbox']):not([type='radio']):not([type='range']):not(
    [type='color']
  ),
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
textarea {
  resize: vertical;
  line-height: 1.7;
}
textarea::placeholder {
  color: var(--faint);
  font-size: 14px;
}
select {
  cursor: pointer;
}
input[type='checkbox'],
input[type='radio'],
input[type='range'] {
  accent-color: var(--accent);
}
input[type='checkbox'],
input[type='radio'] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}
.check input {
  margin: 4px 0 0;
}
.append-reference {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-subtle);
}
.consent {
  padding: 12px;
  border: 1px solid #efdfbd;
  border-radius: 8px;
  color: var(--warning);
  background: #fffaf0;
}
.disclosure {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.disclosure > summary::after {
  content: '+';
  margin-inline-start: auto;
  color: var(--faint);
  font:
    18px/1 Arial,
    sans-serif;
}
.disclosure[open] > summary::after {
  content: '−';
}
.summary-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 15px;
}
.optional {
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}
.hint,
.mask-editor .hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.mask-steps {
  margin: 0 0 12px;
  padding-inline-start: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.mask-steps li + li {
  margin-top: 4px;
}
.mask-task-help {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-subtle);
}
.mask-task-help:empty {
  display: none;
}
.mask-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.mask-tool {
  padding: 10px 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
}
.mask-tool > span {
  font-weight: 700;
}
.mask-suggest {
  width: 100%;
  margin-bottom: 8px;
}
.mask-tool-select {
  width: 100%;
  min-height: 44px;
  color: var(--accent);
  font-weight: 700;
}
.mask-tool-select[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.mask-select-help {
  margin: 6px 0 14px;
}
.mask-refine {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  background: var(--surface-subtle);
}
.mask-refine > summary {
  min-height: 44px;
  font-size: 13px;
}
.mask-refine[open] {
  padding-bottom: 12px;
}
.mask-refine .mask-modes {
  margin: 10px 0;
}
.mask-tool-keep {
  color: #176747;
}
.mask-tool-remove {
  color: #a83240;
}
.mask-tool-keep[aria-pressed='true'] {
  border-color: #25815c;
  background: #e9f7f0;
  box-shadow: inset 0 0 0 1px #25815c;
}
.mask-tool-remove[aria-pressed='true'] {
  border-color: #b23d4a;
  background: #fff0f1;
  box-shadow: inset 0 0 0 1px #b23d4a;
}
.mask-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mask-tools > label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.mask-brush-size > span,
.mask-range-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mask-brush-size output {
  color: var(--muted);
  font-size: 12px;
}
.mask-tools input[type='range'] {
  width: 100%;
  min-height: 32px;
  padding: 0;
  accent-color: var(--accent);
}
.mask-brush-size .mask-range-labels {
  color: var(--muted);
  font-size: 11px;
}
.mask-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  text-align: center;
}
.mask-stage {
  position: relative;
  overflow: auto;
  max-height: 520px;
  direction: ltr;
  margin: 14px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
}
#mask-canvas {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}
.mask-inspection-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.mask-inspection-tools label {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 12px;
}
.mask-inspection-tools select,
.mask-operation-label select {
  width: 100%;
}
.mask-operation-label {
  display: block;
  margin: 10px 0;
  font-size: 12px;
}
.mask-stage[data-view='checker'] {
  background: repeating-conic-gradient(#e7eaf0 0% 25%, #fff 0% 50%) 0 0 / 16px
    16px;
}
#mask-canvas[data-mode='select'] {
  cursor: pointer;
}
#mask-canvas[aria-busy='true'] {
  cursor: progress;
}
.mask-cursor {
  position: absolute;
  z-index: 1;
  border: 2px solid #176747;
  border-radius: 50%;
  background: rgb(37 129 92 / 14%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 90%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.mask-cursor[data-mode='remove'] {
  border-color: #a83240;
  background: rgb(178 61 74 / 14%);
}
.mask-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mask-edit-actions .quiet {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}
.mask-save-bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 22px rgb(32 38 55 / 12%);
}
#mask-expand {
  width: 100%;
  margin: 12px 0;
}
#mask-dialog {
  width: min(1200px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
#mask-dialog::backdrop {
  background: rgb(20 26 44 / 65%);
}
.mask-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mask-dialog-heading h2 {
  font-size: 18px;
  margin: 0;
}
#mask-dialog #mask-content {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  margin-top: 14px;
}
#mask-dialog .mask-control-panel,
#mask-dialog .mask-visual-panel {
  min-width: 0;
  max-height: calc(100dvh - 130px);
  overflow: auto;
  padding: 4px;
}
#mask-dialog .mask-stage {
  max-height: min(58dvh, 620px);
}
@media (max-width: 760px) {
  #mask-dialog #mask-content {
    grid-template-columns: minmax(0, 1fr);
  }
  #mask-dialog .mask-control-panel,
  #mask-dialog .mask-visual-panel {
    max-height: none;
    overflow: visible;
  }
}
.mask-save-bar #mask-save {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 9px 12px;
  font-size: 14px;
}
.mask-status {
  min-height: 24px;
  margin: 8px 0 14px;
}
.mask-status[data-state='dirty'] {
  color: var(--warning);
}
.mask-status[data-state='saved'] {
  color: var(--success);
}
.mask-status[data-state='error'] {
  color: var(--danger);
}
.mask-reload {
  margin-bottom: 12px;
  font-size: 13px;
}
.mask-preview h3 {
  margin: 0;
  font-size: 14px;
}
.mask-preview .hint {
  margin: 4px 0 10px;
}
.mask-preview-surface {
  display: grid;
  place-items: center;
  min-height: 72px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e7eaf0 25%, transparent 25%),
    linear-gradient(-45deg, #e7eaf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7eaf0 75%),
    linear-gradient(-45deg, transparent 75%, #e7eaf0 75%);
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}
#mask-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 240px;
}
#mask-save {
  width: 100%;
}
.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.task-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  text-align: start;
}
.task-card > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.task-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  min-height: 72px;
}
.task-card:hover {
  border-color: #a7b1e8;
  background: #fafbff;
}
.task-card.active,
.task-card[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 1px var(--accent);
}
.task-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--muted);
  background: transparent;
}
.task-icon svg {
  width: 23px;
  height: 23px;
}
.task-card.active .task-icon {
  color: var(--accent);
}
.task-card strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}
.task-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.task-card.active strong {
  color: var(--accent);
}
.task-selected {
  position: absolute;
  top: 5px;
  inset-inline-end: 6px;
  display: none;
  color: var(--accent);
  font:
    700 12px/1 Arial,
    sans-serif;
}
.task-card.active .task-selected,
.task-card[aria-pressed='true'] .task-selected {
  display: block;
}
.task-help {
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.task-help.needs-connection {
  padding: 10px 12px;
  border: 1px solid #efdfbd;
  border-radius: 8px;
  color: var(--warning);
  background: #fffaf0;
}
.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 6px;
}
.field-heading label {
  margin: 0;
}
#look-heading {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.character-count {
  color: var(--faint);
  font-size: 12px;
}
.request-box {
  position: relative;
}
.request-box textarea {
  display: block;
  min-height: 112px;
  padding-bottom: 32px;
}
.clear-request {
  position: absolute;
  bottom: 4px;
  inset-inline-end: 4px;
  min-height: 28px;
  padding: 2px 8px !important;
  font-size: 12px !important;
}
.interaction-help {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #c3ccfb;
  border-inline-start: 3px solid var(--accent);
  border-radius: 9px;
  background: var(--accent-subtle);
  font-size: 14px;
}
.interaction-help p {
  margin: 6px 0 10px;
  color: var(--muted);
}
.interaction-help button {
  max-width: 100%;
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--accent);
}
.aspect-field {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
}
.aspect-field label {
  margin: 0;
}
.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.color-label {
  display: flex;
  align-items: center;
  gap: 16px;
}
.color-label input {
  width: 44px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.generate-section {
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}
.brief-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.generate-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.generate-row > label {
  flex: 0 0 124px;
  margin: 0;
  font-size: 14px;
}
.generate-row select {
  margin-top: 6px;
  min-height: 46px;
  padding: 10px;
  font-size: 16px;
}
.primary {
  min-height: 44px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 500;
}
.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.generate-row .primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  min-height: 46px;
}
.generate-row .primary:disabled {
  background: #8793da;
  opacity: 0.7;
}
.button-arrow {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
#generate-label {
  white-space: normal;
  text-wrap: balance;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff60;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.preserve-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.preserve-note > span {
  margin-inline-end: 4px;
  color: var(--muted);
}
.secondary {
  min-height: 40px;
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
  font-size: 14px;
}
.secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: #a7b1c5;
}
.quiet {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
}
.quiet:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* Preview and results. The placeholder never imitates a generated product. */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-margin-top: 24px;
}
.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.canvas-toolbar > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}
.preview-badge > span {
  width: 6px;
  height: 6px;
  background: #a2adbf;
  border-radius: 50%;
}
.empty-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 516px;
  padding: 32px 24px;
  text-align: center;
  background: var(--surface-subtle);
}
.empty-art {
  position: relative;
  width: min(100%, 380px);
  height: 224px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: #9aa5b9;
}
.preview-placeholder svg {
  width: 56px;
  height: 56px;
}
.preview-placeholder span {
  color: var(--faint);
  font-size: 14px;
}
#source-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  object-fit: contain;
  background: var(--surface);
}
.empty-art:has(#source-preview:not([hidden])) .preview-placeholder {
  display: none;
}
.empty-eyebrow {
  color: var(--faint);
  font-size: 12px;
}
.empty-result h3 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
}
.empty-result p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.empty-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 40px;
  margin-top: 16px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.empty-action:hover {
  color: var(--accent);
  border-color: #a7b1e8;
}
.empty-action > span {
  font:
    18px/1 Arial,
    sans-serif;
}
.empty-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
}
.empty-tags > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.tag-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #aab2c1;
  border-radius: 50%;
}
.progress-area {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
.status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.status-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #a2adbf;
}
#status {
  overflow-wrap: anywhere;
}
.status-line .quiet {
  margin-inline-start: auto;
  padding: 3px 8px;
  font-size: 13px;
}
progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 10px;
  border: none;
  border-radius: 4px;
  background: #edf0f6;
}
progress::-webkit-progress-bar {
  border-radius: 4px;
  background: #edf0f6;
}
progress::-webkit-progress-value {
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.25s ease;
}
progress::-moz-progress-bar {
  border-radius: 4px;
  background: var(--accent);
}
.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #f0d6d9;
  border-radius: 8px;
  color: var(--danger);
  background: #fff5f6;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.error:empty {
  display: none;
}
.progress-card {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #dce2ff;
  border-radius: 9px;
  background: #f7f8ff;
}
.progress-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--accent);
}
.progress-icon svg {
  width: 24px;
  height: 24px;
}
.progress-heading strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.progress-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.progress-track {
  height: 4px;
  margin-top: 16px;
  background: #e3e8ff;
  border-radius: 4px;
  overflow: hidden;
  direction: ltr;
}
#progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.35s ease;
}
.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
}
.creative-variation-controls {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.generation-summary {
  margin: 0 24px 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.generation-resources {
  margin: 0 24px 20px;
}
.generation-metrics {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.generation-metrics > div {
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: 8px;
  min-width: 0;
}
.generation-metrics dt {
  color: var(--muted);
  font-size: 12px;
}
.generation-metrics dd {
  margin: 4px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
#result-state {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 13px;
}
#variants {
  display: flex;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  gap: 0.5rem;
}
#variants button {
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}
#variants button.active {
  border-color: #c4cdfb;
  color: var(--accent);
  background: var(--accent-subtle);
}
.comparison-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 0 24px 16px;
}
.comparison-tabs button {
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 14px;
}
.comparison-tabs button.active,
.comparison-tabs button[aria-pressed='true'] {
  border-color: #d5dcff;
  color: var(--accent);
  background: var(--accent-subtle);
}
.comparison {
  position: relative;
  height: 520px;
  overflow: hidden;
  background: repeating-conic-gradient(#eef0f4 0 25%, #f9fafc 0 50%) 50% / 18px
    18px;
}
.comparison img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#after-image {
  clip-path: inset(0 50% 0 0);
}
.before-label,
.after-label {
  position: absolute;
  bottom: 16px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fffffff2;
  font-size: 13px;
}
.before-label {
  right: 16px;
}
.after-label {
  left: 16px;
}
.comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--comparison-position, 50%);
  width: 2px;
  background: white;
  pointer-events: none;
}
.comparison-divider i {
  position: absolute;
  top: calc(50% - 18px);
  left: -17px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  background: var(--surface);
  font:
    18px/1 Arial,
    sans-serif;
  box-shadow: 0 2px 10px #20263714;
}
.comparison[data-view='before'] #after-image,
.comparison[data-view='before'] .after-label,
.comparison[data-view='after'] #before-image,
.comparison[data-view='after'] .before-label {
  visibility: hidden;
}
.comparison[data-view='after'] #after-image {
  clip-path: none !important;
}
.comparison[data-view='before'] .comparison-divider,
.comparison[data-view='after'] .comparison-divider {
  display: none;
}
.comparison-controls {
  padding: 16px 24px 4px;
}
.compare-control {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.compare-control input {
  min-width: 0;
  flex: 1;
  direction: ltr;
  cursor: ew-resize;
}
#comparison-hint {
  margin: 6px 0 0;
  font-size: 12px;
  text-align: center;
}
.review-reasons {
  padding: 0 24px;
  color: var(--warning);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.review-reasons:empty {
  display: none;
}
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px 16px;
}
.download-link {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font:
    500 13px/1.6 Arial,
    sans-serif;
  text-decoration: none;
}
.download-link:hover {
  color: var(--accent);
  border-color: #a7b1e8;
  background: var(--accent-subtle);
}
.upload-format-note,
.subject-help {
  line-height: 1.7;
}
.subject-help {
  margin: 8px 0 16px;
}
.export-panel {
  margin: 0 24px 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.export-panel > .hint {
  margin: 8px 0 0;
  line-height: 1.8;
}
.export-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.export-fields > :last-child {
  grid-column: 1 / -1;
}
.export-fields label {
  margin-top: 12px;
  font-size: 13px;
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-block: 14px 10px;
}
.export-feedback {
  overflow-wrap: anywhere;
}
@media (max-width: 420px) {
  .export-panel {
    margin-inline: 16px;
    padding: 12px;
  }
  .export-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
.revision-panel {
  margin: 4px 24px 20px;
}
.approval {
  margin: 0 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.approval-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.approval-title > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
}
.approval h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}
.approval-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.approval .check {
  margin: 10px 0;
}
.approval-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.approval-actions .primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
}
.technical {
  margin: 20px 24px 24px;
}
.technical summary {
  color: var(--muted);
  font-size: 13px;
}
.technical pre {
  max-height: 350px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-subtle);
  overflow: auto;
  font: 12px/1.6 monospace;
}

/* Saved work, footer, and transient messages. */
.history-panel {
  padding: 20px 24px;
}
.history-panel .panel-title {
  margin-bottom: 16px;
}
.history-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-subtle);
}
.history-icon svg {
  width: 22px;
  height: 22px;
}
.refresh-history {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  font-size: 13px;
}
.refresh-history span {
  font:
    18px/1 Arial,
    sans-serif;
}
.history-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.44fr);
  gap: 10px;
}
.history-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
}
.history-filters :is(input, select) {
  padding-block: 7px;
}
.history-search-field input::placeholder {
  color: var(--muted);
  font-size: 14px;
}
.history-message {
  min-height: 1.4em;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
.history-message:empty {
  display: none;
}
.history-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.history-empty > span {
  color: #a2adbf;
  font-size: 32px;
}
.history-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.history-empty strong {
  font-weight: 400;
}
.history-list {
  display: grid;
  gap: 8px;
}
.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  text-align: start;
}
.history-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}
.history-item.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.history-thumb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 7px;
  background: #edf0f6;
  color: var(--muted);
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-thumb svg {
  width: 22px;
  height: 22px;
}
.history-description,
.history-detail {
  display: grid;
  gap: 3px;
}
.history-request {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.history-meta :is(span, time) + :is(span, time)::before {
  content: '·';
  margin-inline-end: 7px;
}
.history-detail {
  justify-items: end;
}
.history-badge {
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: #edf0f6;
  color: #515e73;
  font-size: 12px;
  line-height: 1.45;
}
.history-badge[data-status='review'] {
  background: #fdf1d9;
  color: #765014;
}
.history-badge[data-status='active'] {
  background: #e9edff;
  color: #3447b2;
}
.history-badge[data-status='approved'] {
  background: #e6f5ee;
  color: #206345;
}
.history-item .history-count {
  color: var(--muted);
  font-size: 12px;
}
.history-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}
.history-footer > :not([hidden]) {
  margin-top: 10px;
}
#history-more {
  margin-inline-start: auto;
  font-size: 13px;
}
.workspace-note {
  margin: -4px 8px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 32px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer-home {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(90vw, 480px);
  padding: 12px 20px;
  border: 1px solid #394359;
  border-radius: 10px;
  color: white;
  background: #263147;
  box-shadow: 0 6px 24px #20263724;
  transform: translateX(-50%);
  font-size: 15px;
  text-align: center;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Stack the studio before either column becomes cramped. */
@media (max-width: 1279px) and (min-width: 981px) {
  .studio-grid {
    grid-template-columns: 440px minmax(0, 1fr);
    gap: 20px;
  }
  .setup-section,
  .generate-section {
    padding: 20px;
  }
  .preview-badge {
    display: none;
  }
  .canvas-toolbar,
  .history-panel {
    padding: 20px;
  }
  .comparison {
    height: 440px;
  }
  .empty-result {
    min-height: 516px;
    padding-inline: 20px;
  }
  .history-panel h2,
  .canvas-toolbar h2 {
    font-size: 20px;
  }
  .history-panel .section-description {
    font-size: 13px;
  }
}
@media (max-width: 980px) {
  .topbar {
    padding-inline: 24px;
  }
  main {
    padding-inline: 24px;
  }
  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: start;
  }
  .idea-section {
    border-top: 0;
    border-inline-start: 1px solid var(--line);
  }
  .generate-section {
    grid-column: 1 / -1;
  }
  .generate-row > label {
    flex-basis: 160px;
  }
  .generate-row .primary {
    max-width: 320px;
  }
  .empty-result {
    min-height: 496px;
  }
  .empty-art {
    height: 224px;
  }
  .comparison {
    height: 540px;
  }
}
@media (max-width: 740px) {
  .topbar {
    height: 68px;
    padding-inline: 20px;
    gap: 16px;
  }
  .home-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .home-icon svg {
    width: 25px;
    height: 25px;
  }
  .access summary {
    padding-inline: 10px;
    font-size: 13px;
  }
  .top-action {
    font-size: 13px;
  }
  .access p {
    width: 260px;
  }
  main {
    padding: 24px 20px 0;
  }
  .intro {
    margin-bottom: 20px;
  }
  h1 {
    font-size: 30px;
  }
  .steps {
    margin-bottom: 12px;
  }
  .step {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    text-align: center;
  }
  .step > b {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .step strong {
    font-size: 14px;
  }
  .step small,
  .step-arrow,
  .step-check {
    display: none;
  }
  .connection {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.65;
  }
  .connection-row {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 16px;
  }
  .connection-row > button {
    align-self: flex-start;
  }
  .controls {
    display: block;
  }
  .idea-section {
    border-top: 1px solid var(--line);
    border-inline-start: 0;
  }
  .setup-section,
  .generate-section {
    padding: 20px;
  }
  .panel-title {
    gap: 10px;
  }
  h2 {
    font-size: 21px;
  }
  .section-description {
    font-size: 14px;
  }
  .task-grid {
    gap: 10px;
  }
  .task-card {
    min-height: 88px;
    padding: 12px 10px;
    gap: 7px;
  }
  .task-icon {
    width: 24px;
    height: 26px;
  }
  .task-icon svg {
    width: 21px;
    height: 21px;
  }
  .task-card strong {
    font-size: 15px;
  }
  .task-card small {
    font-size: 12px;
  }
  .upload-zone {
    padding: 20px 12px;
  }
  .upload-zone strong {
    font-size: 16px;
  }
  .upload-zone small {
    font-size: 12px;
  }
  .generate-row > label {
    flex-basis: 120px;
  }
  .generate-row .primary {
    max-width: none;
  }
  .canvas-toolbar,
  .history-panel {
    padding: 20px;
  }
  .preview-badge {
    display: none;
  }
  .empty-result {
    min-height: 480px;
    padding: 24px 20px;
  }
  .empty-art {
    height: 208px;
    margin-bottom: 20px;
  }
  .empty-result h3 {
    font-size: 23px;
  }
  .empty-result p {
    font-size: 14px;
  }
  .empty-tags {
    gap: 8px 12px;
    max-width: 300px;
    margin-top: 20px;
  }
  .comparison {
    height: 440px;
  }
  .result-meta,
  .progress-area,
  .comparison-controls,
  .downloads {
    padding-inline: 20px;
  }
  .revision-panel {
    margin-inline: 20px;
  }
  .approval {
    margin-inline: 20px;
    padding: 16px;
  }
  .technical {
    margin-inline: 20px;
  }
  .history-panel .panel-title > div {
    flex: 1;
  }
  .refresh-history {
    padding-inline: 6px;
  }
  .history-panel .section-description {
    font-size: 13px;
  }
  footer {
    align-items: flex-start;
    gap: 16px;
    padding-block: 20px;
  }
  footer > span {
    max-width: 170px;
    font-size: 12px;
  }
}
@media (max-width: 390px) {
  .topbar {
    padding-inline: 16px;
  }
  .top-actions {
    gap: 4px;
  }
  .top-action,
  .access summary {
    min-height: 44px;
    padding-inline: 8px;
  }
  main {
    padding-inline: 16px;
  }
  h1 {
    font-size: 28px;
  }
  .setup-section,
  .generate-section {
    padding: 16px;
  }
  .section-description {
    font-size: 13px;
  }
  .task-grid {
    gap: 8px;
  }
  .task-card {
    padding: 12px 8px;
    gap: 6px;
  }
  .task-card strong {
    font-size: 14px;
  }
  .task-card small {
    font-size: 12px;
  }
  .generate-row {
    gap: 8px;
  }
  .generate-row > label {
    flex-basis: 112px;
  }
  .generate-row .primary {
    padding-inline: 12px;
    font-size: 14px;
  }
  .canvas-toolbar,
  .history-panel {
    padding: 16px;
  }
  .canvas-toolbar h2,
  .history-panel h2 {
    font-size: 20px;
  }
  .history-panel .panel-title {
    gap: 8px;
  }
  .history-panel .section-description {
    font-size: 12px;
  }
  .refresh-history {
    font-size: 12px;
    padding-inline: 4px;
  }
  .history-filters {
    grid-template-columns: minmax(0, 1fr) minmax(105px, 0.62fr);
    gap: 7px;
  }
  .history-filters :is(input, select) {
    padding-inline: 7px;
  }
  .history-item {
    column-gap: 8px;
    padding: 7px;
  }
  .history-thumb {
    width: 44px;
    height: 48px;
  }
  .history-meta :is(span, time) + :is(span, time)::before {
    content: none;
  }
  .history-badge {
    padding-inline: 6px;
    font-size: 11px;
  }
  .comparison {
    height: 360px;
  }
  .approval-actions {
    gap: 8px;
  }
  .approval-actions .quiet {
    padding-inline: 6px;
    font-size: 13px;
  }
  .optional {
    margin-inline-start: auto;
  }
  .disclosure > summary::after {
    margin-inline-start: 0;
  }
}
@media (max-width: 600px) {
  .history-link span,
  .access summary span {
    display: none;
  }
  .top-action,
  .access summary {
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }
}
@media (max-width: 360px) {
  .topbar {
    gap: 8px;
  }
  .home-link {
    gap: 7px;
  }
  .home-icon {
    width: 32px;
    height: 32px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Creative choices stay compact; advanced image tools remain optional. */
.reference-help {
  margin: 10px 0 16px;
  padding: 10px 12px;
  border-inline-start: 3px solid var(--success);
  border-radius: 8px;
  background: #f0f8f3;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}
.reference-help.needs-attention {
  border-color: var(--warning);
  background: #fff8e9;
  color: #79541c;
}
.photography-look-section {
  margin: 18px 0;
}
.look-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.look-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: start;
  font-size: 12px;
}
.look-card strong {
  font-size: 13px;
}
.look-card small {
  color: var(--muted);
  line-height: 1.5;
  font-size: 11px;
}
.look-card[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent-subtle);
}
.look-swatch {
  height: 26px;
  border-radius: 5px;
  background: linear-gradient(120deg, #e7e5d2, #bed5c4, #f6e3c8);
}
.look-cinematic .look-swatch {
  background: linear-gradient(120deg, #273746, #46636e, #dfaf77);
}
.look-vibrant .look-swatch {
  background: linear-gradient(120deg, #eb9a64, #d55b91, #6471d8);
}
.look-minimal .look-swatch {
  background: linear-gradient(120deg, #f0e8dc, #faf8f4, #dadfd9);
}
.look-editorial .look-swatch {
  background: linear-gradient(120deg, #9d9a91, #ded8ce, #9dbaab);
}
.look-luxury .look-swatch {
  background: linear-gradient(120deg, #252c32, #5e5b4a, #d8bf80);
}
.product-layout-controls {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.product-layout-controls output {
  color: var(--accent);
  margin-inline-start: 8px;
}
.product-layout-controls input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
.image-text-tools {
  margin-top: 16px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.text-tools-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}
.text-tools-actions button {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}
.image-text-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}
.text-region-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  max-height: 220px;
  overflow: auto;
}
.text-region-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: start;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.text-region-list button small {
  font-size: 11px;
  color: var(--muted);
}
.text-unreadable {
  margin-block: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.text-unreadable summary {
  font-size: 13px;
}
.text-scope {
  margin-block: 8px;
}
.text-scope select {
  margin-top: 4px;
}
.text-region-list button[aria-pressed='true'] {
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.image-text-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px 12px;
  margin: 12px 0;
}
.image-text-options label {
  min-width: 0;
  font-size: 13px;
}
.image-text-options textarea,
.image-text-options select,
.image-text-options input {
  width: 100%;
}
.text-edit-actions,
.text-edit-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.text-edit-preview figure {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}
.text-edit-preview figcaption {
  color: var(--muted);
  font-size: 12px;
}
.text-edit-preview img {
  display: block;
  width: 100%;
  max-height: 210px;
  margin-top: 4px;
  object-fit: contain;
}
.text-tool-status {
  color: var(--muted);
  line-height: 1.75;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.text-tool-status[data-state='error'] {
  color: var(--danger);
}
@media (max-width: 420px) {
  .look-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .image-text-options {
    grid-template-columns: 1fr;
  }
  .text-region-list button {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Native-artwork placement controls remain separate from generation and copy editing. */
.label-canvas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-block: 16px;
}
.label-canvas-grid canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  border: 1px solid var(--line, #dce3ec);
  border-radius: 10px;
  cursor: crosshair;
}
.label-canvas-grid canvas[hidden] {
  display: none;
}
.label-coordinate-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  direction: ltr;
}
.label-coordinate-fields label {
  font-size: 0.8rem;
}
.label-preview {
  display: block;
  width: 100%;
  height: auto;
  margin-block: 16px;
  border-radius: 12px;
}
.label-preview[hidden] {
  display: none;
}
.label-versions,
.label-protection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 12px;
}
.label-protection-list button {
  border: 1px solid #12845b;
  color: #126746;
  overflow-wrap: anywhere;
}
.label-versions [aria-pressed='true'] {
  border: 1px solid #4056e8;
  background: #edf0ff;
}
@media (max-width: 700px) {
  .label-canvas-grid {
    grid-template-columns: 1fr;
  }
}
.visual-options {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line, #d6dedb);
  border-radius: 0.75rem;
}
.shot-plan {
  margin: 0.6rem 0 1rem;
  border-inline-start: 3px solid var(--primary, #3957d7);
  padding-inline-start: 0.8rem;
}
.shot-plan p {
  margin: 0.5rem 0;
  font-weight: 600;
}
.shot-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.shot-plan button {
  background: white;
  color: inherit;
  border: 1px solid var(--line, #d6dedb);
  border-radius: 0.5rem;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}
.shot-plan button[aria-pressed='true'] {
  border-color: #4056e8;
  color: #243cb4;
  background: #edf0ff;
}
.visual-options legend {
  padding-inline: 0.4rem;
  font-weight: 700;
}
.shot-grid,
.label-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.shot-grid select {
  width: 100%;
  margin-block: 0.25rem 0;
}
.shot-fine-controls {
  margin-block-start: 0.85rem;
}
.shot-fine-controls summary {
  cursor: pointer;
  font-weight: 600;
}
.shot-fine-controls[open] .shot-grid {
  margin-block-start: 0.65rem;
}
[data-shot][aria-invalid='true'] {
  border-color: #ae5c24;
}
.variant-review {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}
.variant-review h3 {
  margin: 0;
}
.variant-review ol {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0;
}
.variant-review li {
  display: grid;
  gap: 0.2rem;
  padding-block: 0.65rem;
  border-block-start: 1px solid var(--line);
}
.variant-review li[data-decision='ready'] strong {
  color: #16664a;
}
.variant-review li[data-decision='withheld'] strong {
  color: #894911;
}
.variant-review li span {
  font-size: 0.9rem;
}
.variant-review summary {
  color: var(--accent);
  cursor: pointer;
}
#draft-panel {
  margin: 0;
}
#draft-image {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--surface-subtle);
}
#draft-caption {
  padding: 0.65rem 1.1rem;
  color: var(--muted);
}
.review-reference {
  position: relative;
  max-width: 13rem;
  margin-block: 0.5rem;
  line-height: 0;
}
.review-reference img {
  width: 100%;
  height: auto;
}
.review-reference span {
  position: absolute;
  border: 2px solid white;
  outline: 2px solid #71430c;
  color: white;
  text-shadow:
    0 0 3px black,
    0 0 1px black;
  font-weight: bold;
  line-height: 1.2;
  pointer-events: none;
}
#product-proof,
.label-pair figure {
  margin: 0.5rem 0;
  min-width: 0;
}
#product-proof-image {
  display: block;
  border-radius: 0.5rem;
  background: repeating-conic-gradient(#fff 0 25%, #e7ecec 0 50%) 0 / 14px 14px;
}
.label-detail {
  position: relative;
  overflow: hidden;
}
.label-detail img {
  position: absolute;
  max-width: none;
}
.label-pair figcaption,
#product-proof-caption {
  font-size: 0.85rem;
}
.label-pair p {
  grid-column: 1 / -1;
}
@media (max-width: 420px) {
  .shot-grid {
    grid-template-columns: 1fr;
  }
}

.goal-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 57rem;
  margin-block-start: 0.8rem;
}
.goal-card {
  text-align: start;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.goal-card strong,
.goal-card small {
  display: block;
}
.goal-card small {
  color: var(--muted);
  margin-block-start: 0.25rem;
}
.goal-card[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-soft, #edf1ff);
}
@media (max-width: 520px) {
  .goal-card {
    padding: 0.65rem;
  }
  .goal-card small {
    font-size: 0.78rem;
    line-height: 1.4;
  }
}

#scene-description {
  margin-block: 0.65rem;
}
#scene-description #scene-examples {
  margin-block: 0.55rem 0.8rem;
}
#scene-description .request-box {
  margin-block-end: 0.7rem;
}
.reference-role-note {
  padding-inline: 0.55rem;
}

/* Merchant styles: one card per style with a swatch of its light and colour. */
.style-clean_studio .look-swatch {
  background: linear-gradient(120deg, #f4f4f2, #ffffff, #dcdcd8);
}
.style-natural_daylight .look-swatch {
  background: linear-gradient(120deg, #f3e6cf, #fff6e4, #b9cdb0);
}
.style-premium_dark .look-swatch {
  background: linear-gradient(120deg, #15181c, #3a3530, #c9a96a);
}
.style-soft_editorial .look-swatch {
  background: linear-gradient(120deg, #e9d6d2, #d8dcea, #e7e1cf);
}
.effective-summary {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  font-size: 13px;
}
.effective-summary ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
}
.effective-summary .effective-notes {
  color: var(--accent);
}
.effective-summary .effective-notes:empty {
  display: none;
}
.role-effect {
  margin-top: 6px;
}
.marking-overlay {
  position: absolute;
  pointer-events: none;
}
.marking-overlay span {
  position: absolute;
  border: 2px solid #f08c00;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 35%);
}
.comparison[data-view='before'] .marking-overlay {
  display: none;
}
.marking-toggle {
  margin: 8px 24px 0;
}
.next-action {
  margin-top: 6px;
}
#variants button.alternative {
  border-style: dashed;
}

/* Product placement: drag, resize and preview before saving a separate version. */
.placement-stage {
  margin-block: 12px;
}
.placement-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  border: 1px solid var(--line, #dce3ec);
  border-radius: 10px;
  cursor: move;
  background: #f4f4f2;
}
.placement-stage canvas.selecting {
  cursor: crosshair;
}
.placement-stage canvas:focus-visible {
  outline: 3px solid #4056e8;
  outline-offset: 2px;
}
.placement-stage canvas[hidden] {
  display: none;
}
.placement-controls {
  display: grid;
  gap: 8px;
  margin-block: 8px;
}
.placement-size {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.placement-model {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #dce3ec);
}
.placement-model h4 {
  margin: 0 0 4px;
}
.placement-model[hidden] {
  display: none;
}

/* ==========================================================================
   Studio shell: one view at a time (setup steps or the review workspace),
   a sticky summary with the create button, an editor-style result view with
   tool tabs and an always-visible approval bar, and history as a drawer.
   ========================================================================== */
:root {
  --topbar-h: 64px;
  --shell-gap: 20px;
  --shadow-soft: 0 1px 2px #1b22360d, 0 8px 24px #1b223614;
  --shadow-raised: 0 -6px 24px #1b22361f;
  --checker: repeating-conic-gradient(#eef0f4 0 25%, #f9fafc 0 50%) 50% / 16px
    16px;
}
body .topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  box-shadow: 0 1px 0 var(--line);
}
.top-actions {
  align-items: center;
}
.top-actions .connection-row {
  margin: 0;
  gap: 4px;
  min-width: 0;
}
.top-actions .connection {
  max-width: 360px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}
.top-actions .connection-row > button {
  padding: 6px 10px;
  font-size: 13px;
}
main {
  padding-top: 20px;
}
.intro {
  margin-bottom: 16px;
}
.intro h1 {
  font-size: 26px;
}
.goal-picker {
  max-width: none;
}
.steps {
  margin-bottom: var(--shell-gap);
}
.step {
  transition:
    background 0.15s,
    color 0.15s;
}
body[data-view='review'] .intro {
  display: none;
}

/* ---- Views ---------------------------------------------------------------- */
body .studio-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--shell-gap);
}
body[data-view='setup'] #review-section,
body[data-view='review'] .controls {
  display: none;
}
#review-section,
.controls > .setup-section,
.setup-aside {
  animation: shell-enter 0.18s ease-out;
}
@keyframes shell-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ---- Setup: one step, with a sticky summary --------------------------------- */
body .controls.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--shell-gap);
  align-items: start;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.controls > .setup-section {
  grid-column: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
body .idea-section {
  border-top: 1px solid var(--line);
}
body[data-step='upload'] #idea-section,
body[data-step='idea'] #upload-section {
  display: none;
}
.step-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.setup-aside {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.summary-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.summary-head h2 {
  margin: 0;
  font-size: 17px;
}
.setup-thumb {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--checker);
}
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.link-button:hover {
  text-decoration: underline;
}
.setup-aside .generate-section {
  border: 0;
  padding: 16px 20px 20px;
}
.setup-aside .generate-row {
  flex-wrap: wrap;
}
.setup-aside .generate-row .primary {
  flex: 1 1 100%;
  max-width: none;
}

/* ---- Review workspace ------------------------------------------------------ */
body #review-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
body[data-view='setup'] #review-section {
  display: none;
}
.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.review-header .canvas-toolbar {
  flex: 1;
  padding: 0;
  border: 0;
}
.review-header .preview-badge {
  display: none;
}
.back-to-setup::before {
  content: '→ ';
}
html[dir='ltr'] .back-to-setup::before {
  content: '← ';
}
.shortcut-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
#review-section .progress-area {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.review-layout {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.review-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow: auto;
}
body #variants {
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 0;
  gap: 10px;
}
body #variants button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 6px 8px;
  border-radius: 12px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
body #variants button:not(:disabled):hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
body #variants button[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  color: var(--accent);
}
.variant-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--checker);
}
#variants button[data-state='pending'] .variant-thumb {
  background: linear-gradient(100deg, #eef0f4 30%, #f9fafc 50%, #eef0f4 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
#variants button[data-state='withheld'] .variant-thumb {
  outline: 2px solid #f1c7cc;
  outline-offset: -2px;
  opacity: 0.75;
}
#variants button[data-state='unfinished'] {
  opacity: 0.6;
}
@keyframes shimmer {
  to {
    background-position: -150% 0;
  }
}
.review-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.review-main > .empty-result,
.review-main > #draft-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
body .result-editor:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}
.viewer,
.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  min-width: 0;
}
.viewer {
  overflow: hidden;
}
.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.viewer-toolbar .result-meta {
  margin: 0;
  padding: 0;
}
.viewer-toolbar .comparison-tabs {
  padding: 0;
}
body .comparison {
  height: min(70vh, 760px);
  background: var(--checker);
  user-select: none;
}
.zoom-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.comparison.zoomed {
  cursor: grab;
}
.comparison.panning {
  cursor: grabbing;
}
.comparison.zoomed .comparison-divider {
  display: none;
}
.zoom-controls {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 3;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffffff2;
  box-shadow: var(--shadow-soft);
}
.zoom-controls button {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}
.zoom-controls button:hover {
  background: var(--accent-subtle);
}
.zoom-controls .zoom-level {
  min-width: 56px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.viewer-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.viewer-footer .comparison-controls {
  flex: 1;
  margin: 0;
  padding: 0;
}
.viewer-footer .comparison-controls .hint {
  display: none;
}
.viewer-footer .marking-toggle {
  margin: 0;
}
.tool-panel {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 120px);
  overflow: auto;
}
.tool-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tool-tabs button {
  flex: none;
  padding: 12px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.tool-tabs button:hover {
  color: var(--ink);
}
.tool-tabs button[aria-selected='true'] {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.tool-tabs button[hidden] {
  display: none;
}
.tool-pane {
  padding: 16px;
}
.tool-pane > * + * {
  margin-top: 12px;
}
.tool-pane .review-reasons {
  margin-top: 0;
}
.tool-pane details.tab-primary {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
.tool-pane details.tab-primary > summary {
  display: none;
}
.tool-pane .downloads {
  padding: 0;
}
body .approval-bar {
  grid-column: 1 / -1;
  position: sticky;
  bottom: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}
.approval-bar .approval-title {
  margin: 0;
}
.approval-bar .approval-title p {
  display: none;
}
.approval-bar h3 {
  font-size: 15px;
}
.approval-bar .check {
  margin: 0;
  font-size: 14px;
}
.approval-bar .check[hidden] {
  display: none;
}
.approval-bar .approval-actions {
  margin: 0 0 0 auto;
  margin-inline-start: auto;
}
.approval-bar .approval-actions .primary {
  flex: none;
  gap: 10px;
}

/* ---- History drawer -------------------------------------------------------- */
body .history-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: 50;
  width: min(460px, 100vw);
  margin: 0;
  overflow: auto;
  border-radius: 0;
  box-shadow: 0 0 40px #1b223633;
  transform: translateX(105%);
  visibility: hidden;
  transition:
    transform 0.22s ease,
    visibility 0.22s;
}
html[dir='rtl'] body .history-drawer {
  transform: translateX(-105%);
}
body.history-open .history-drawer,
html[dir='rtl'] body.history-open .history-drawer {
  transform: none;
  visibility: visible;
}
.history-drawer:focus {
  outline: none;
}
.history-drawer .panel-title {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}
.drawer-close {
  margin-inline-start: 4px;
  font-size: 22px;
  line-height: 1;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: #141824;
  opacity: 0.35;
}
.drawer-backdrop[hidden] {
  display: none;
}
body.history-open {
  overflow: hidden;
}

/* ---- Focus and motion -------------------------------------------------------- */
:where(button, [role='tab'], a, summary):focus-visible {
  outline: 3px solid #4056e866;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  #review-section,
  .controls > .setup-section,
  .setup-aside,
  body .history-drawer,
  #variants button {
    animation: none;
    transition: none;
  }
}

/* ---- Narrower screens -------------------------------------------------------- */
@media (max-width: 1180px) {
  body .result-editor:not([hidden]) {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool-panel {
    position: static;
    max-height: none;
  }
}
@media (max-width: 980px) {
  body .controls.panel {
    grid-template-columns: minmax(0, 1fr);
  }
  .setup-aside {
    grid-column: 1;
    grid-row: auto;
    position: static;
  }
  .top-actions .connection {
    max-width: 200px;
  }
}
@media (max-width: 760px) {
  :root {
    --topbar-h: 60px;
  }
  .top-actions .connection-row {
    display: none;
  }
  .review-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .review-rail {
    position: static;
    max-height: none;
    overflow-x: auto;
  }
  body #variants {
    flex-direction: row;
  }
  body #variants button {
    width: 92px;
    flex: none;
  }
  body .comparison {
    height: min(62vh, 520px);
  }
  .shortcut-hint {
    display: none;
  }
  body .approval-bar {
    bottom: 0;
    margin-inline: -12px;
    border-radius: 16px 16px 0 0;
  }
  .approval-bar .approval-title {
    display: none;
  }
  .approval-bar .approval-actions {
    width: 100%;
    margin: 0;
  }
  .approval-bar .approval-actions .primary {
    flex: 1;
  }
}

/* ---- Review view refinements ------------------------------------------------ */
body[data-view='review'] .controls.panel {
  display: none;
}
body[data-view='review'] .steps {
  margin-bottom: 12px;
}
body[data-view='review'] .step {
  padding-block: 8px;
}
body[data-view='review'] .step small {
  display: none;
}
#review-section .progress-area {
  display: grid;
  gap: 8px;
  padding: 10px 16px;
}
#review-section .progress-card {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
#review-section .progress-heading {
  gap: 10px;
}
#review-section .progress-heading > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
#review-section .progress-heading p {
  margin: 0;
}
#review-section .progress-icon {
  width: 28px;
  height: 28px;
}
#review-section .progress-track {
  display: none;
}
#review-section #progress {
  display: block;
  width: 100%;
  height: 4px;
  margin: 0;
}
.progress-area:has(#progress-card:not([hidden])) #status,
.progress-area:has(#progress-card:not([hidden])) .status-dot {
  display: none;
}
.progress-area
  .status-line:not(:has(button:not([hidden]):not(:disabled))):has(
    #status:empty
  ) {
  display: none;
}
#review-section .variant-review {
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}
#review-section .variant-review h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
#review-section .variant-review ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
}
#review-section .variant-review li {
  padding: 4px 0;
  border: 0;
  font-size: 13px;
}
#review-section .variant-review li strong,
#review-section .variant-review li h4 {
  font-size: 13px;
}
body .comparison {
  height: clamp(360px, calc(100vh - var(--topbar-h) - 330px), 820px);
}
@media (max-width: 760px) {
  body .comparison {
    height: min(62vh, 520px);
  }
}
#review-section .variant-review li[data-decision='ready'],
#review-section .variant-review li[data-decision='pending'] {
  display: none;
}
.progress-area
  .status-line:not(:has(button:not([hidden]):not(:disabled))):has(
    #status:empty
  ),
.progress-area:has(#progress-card:not([hidden]))
  .status-line:not(:has(button:not([hidden]):not(:disabled))) {
  display: none;
}
html {
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}
#review-section,
.setup-section {
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

/* ---- Editor refinements --------------------------------------------------- */
.review-header .canvas-toolbar {
  display: none;
}
.review-header {
  justify-content: space-between;
}
.viewer.adjusting .comparison,
.viewer.adjusting .viewer-footer,
.viewer.adjusting .comparison-tabs {
  display: none;
}
.viewer > .placement-stage {
  display: grid;
  place-items: center;
  height: clamp(360px, calc(100vh - var(--topbar-h) - 330px), 820px);
  margin: 0;
  padding: 12px;
  background: var(--checker);
}
.viewer > .placement-stage canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

/* Tools and approval share one sticky column beside the image. */
.editor-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
@media (min-width: 1181px) {
  .editor-side {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px);
  }
  .editor-side .tool-panel {
    position: static;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
  }
  body .editor-side .approval-bar {
    position: static;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    box-shadow: var(--shadow-soft);
  }
  .editor-side .approval-bar .approval-actions {
    margin: 0;
  }
  .editor-side .approval-bar .approval-actions .primary {
    flex: 1;
  }
}
@media (max-width: 1180px) {
  .editor-side {
    display: contents;
  }
}
.viewer > .placement-stage canvas {
  max-height: calc(
    clamp(360px, calc(100vh - var(--topbar-h) - 330px), 820px) - 24px
  );
}
#review-section #variant-review-title {
  display: none;
}
body[data-view='review'] .steps {
  display: none;
}
:is(
    #progress-card[data-state='requires_review'],
    #progress-card[data-state='partial'],
    #progress-card[data-state='failed'],
    #progress-card[data-state='cancelled'],
    #progress-card[data-state='uncertain'],
    #progress-card[data-state='requires_reconciliation']
  )
  .progress-icon {
  display: none;
}
.progress-area:has(
    #progress-card:is(
      [data-state='requires_review'],
      [data-state='partial'],
      [data-state='failed'],
      [data-state='cancelled'],
      [data-state='uncertain'],
      [data-state='requires_reconciliation']
    )
  )
  #progress {
  display: none;
}
#review-section .progress-area:has(#variant-review[hidden]) {
  padding-block: 8px;
}
body[data-view='review'] main {
  padding-top: 12px;
}
@media (min-width: 1181px) {
  .editor-side .approval-bar .approval-title {
    display: none;
  }
}

/* ---- Header fits every width ---------------------------------------------- */
.viewer-footer .downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}
@media (max-width: 1180px) {
  .top-actions .connection {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 0;
    text-align: center;
  }
  .top-actions .connection::before {
    margin: 11px 0 0;
  }
}
@media (max-width: 900px) {
  .top-actions .top-action > span:not(#language-target),
  .top-actions .access summary > span {
    display: none;
  }
  .top-actions .connection-row > button {
    display: none;
  }
}

/* A closed drawer is out of the layout entirely; it slides in when opened. */
body:not(.history-open) .history-drawer {
  display: none;
}
body.history-open .history-drawer {
  animation: drawer-in 0.22s ease;
}
@keyframes drawer-in {
  from {
    transform: translateX(105%);
  }
}
html[dir='rtl'] body.history-open .history-drawer {
  animation-name: drawer-in-rtl;
}
@keyframes drawer-in-rtl {
  from {
    transform: translateX(-105%);
  }
}
@media (prefers-reduced-motion: reduce) {
  body.history-open .history-drawer {
    animation: none;
  }
}
