* { box-sizing: border-box; }
html { overflow-y: auto; scrollbar-gutter: stable; }
body { margin: 0; background: #f5f4f0; color: #24263d; font: 15px system-ui, sans-serif; }
header, footer { padding: 16px 24px; background: #232944; color: #fff; }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
header strong { margin-right: auto; font-size: 19px; }
main { display: grid; grid-template-columns: 190px minmax(0,1fr) 230px; min-height: calc(100vh - 112px); }
aside { padding: 16px; background: #fff; }
h2 { font-size: 14px; margin: 16px 0 10px; }
button, select, input, textarea { font: inherit; }
button, select { padding: 6px 10px; border: 1px solid #a6a9b4; border-radius: 5px; background: #fff; color: #24263d; }
button { cursor: pointer; margin-bottom: 4px; }
button[aria-pressed=true] { background: #e2e6ff; border-color: #4a57a8; }
.workspace { display: grid; place-items: start center; padding: 24px; overflow: auto; }
canvas { background: white; width: min(100%, 720px); height: auto; box-shadow: 0 2px 15px #24263d22; }
ol { list-style: none; padding: 0; }
li button { width: 100%; text-align: left; }
form label { display: block; margin-bottom: 10px; }
input:not([type=color]):not([type=checkbox]), textarea { display: block; width: 100%; }
footer { min-height: 52px; }
@media (max-width: 750px) { main { grid-template-columns: 1fr; } .workspace { grid-row: 1; } }
.workspace { align-content: start; gap: 16px; }
.workspace nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

#proposal-list label, #proposal-list small { display: block; overflow-wrap: anywhere; }
#proposal-list label { margin-bottom: 12px; }
#proposal-list input[type=checkbox] { display: inline-block; width: auto; margin-right: 8px; }
#preview { margin: 8px 0 12px; }

#project-results { list-style: none; padding: 0; }
#project-results li { display: flex; gap: 8px; }
#project-results li button { width: auto; }

#project-results li { flex-wrap: wrap; align-items: baseline; }

#canvas { touch-action: none; }
.canvas-scroll.is-panning #canvas { cursor: grab; }
.canvas-scroll.is-panning[data-dragging] #canvas { cursor: grabbing; }

#layers li[draggable=true] button { cursor: grab; }
#layers .layer-drop-target button { outline: 2px solid #4a57a8; }

.workspace { min-width: 0; }
.canvas-scroll { width: 100%; overflow: auto; max-height: 75vh; padding: 12px; }
.canvas-scroll:focus-visible { outline: 2px solid #4a57a8; }
#canvas { display: block; margin-inline: auto; max-width: none; }

#template-preview { width: auto; max-width: 100%; margin-bottom: 12px; }

#image-ai-comparison:not([hidden]) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 12px; }
#image-ai-comparison figure { margin: 0; }
#image-ai-comparison img { display: block; width: 100%; max-height: 240px; object-fit: contain; background: #eee; }
#image-mask-frame { position: relative; width: fit-content; max-width: 100%; }
#image-mask-source { display: block; max-width: 100%; max-height: 240px; cursor: crosshair; touch-action: none; }
#image-mask-selection { position: absolute; pointer-events: none; border: 2px solid #315cff; background: #315cff35; box-sizing: border-box; }
#image-ai-apply { grid-column: 1 / -1; justify-self: start; }

#canvas-frame { position: relative; margin-inline: auto; }
#page-height-handle { position:absolute; bottom:0; left:50%; transform:translateX(-50%); z-index:4;
  min-width:52px; min-height:44px; padding:0 8px; cursor:ns-resize; touch-action:none;
  border:1px solid var(--studio-focus); background:#fff; color:var(--studio-text); font-size:22px; line-height:1; }
#page-height-handle:focus-visible { outline:2px solid var(--studio-focus); outline-offset:-4px; }
#page-height-marker { position:absolute; inset-inline:0; z-index:3; pointer-events:none;
  border-top:2px dashed var(--studio-selection); filter:drop-shadow(0 0 1px white); }
.page-height-status:not([hidden]) { width:fit-content; max-width:100%; margin:0; padding:4px 8px;
  background:#fff; color:#292929; border-radius:4px; overflow-wrap:anywhere; }
#canvas-frame #canvas { width: 100%; }
#konva-workspace { position: absolute; inset: 0; pointer-events: none; }
#konva-workspace .konvajs-content, #konva-workspace canvas { width: 100% !important; height: 100% !important; }
#konva-workspace canvas { box-shadow: none; max-width: none; }
#canvas-frame.has-konva #canvas { position: relative; background: transparent; }
#canvas-text-editor {
  position: absolute;
  z-index: 1;
  margin: 0;
  padding: 0 2px;
  resize: none;
  min-width: 36px;
  min-height: 26px;
  box-sizing: border-box;
  transform-origin: top left;
  background: #fff;
  color: #181a20;
  border: 0;
  outline: 2px solid #315cff;
}
#canvas-text-editor[hidden] { display: none; }
#canvas-frame.picking-annotation #canvas { cursor: crosshair; }
#annotation-region-preview {
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  border: 2px solid #315cff;
  background: #315cff20;
}
#canvas-frame.with-rulers { margin-top: 20px; }
#ruler-x, #ruler-y { position: absolute; box-shadow: none; background: #ebeaf2; }
#ruler-x { bottom: 100%; left: 0; }
#ruler-y { top: 0; right: 100%; }
.canvas-scroll:has(.with-rulers) { padding-left: 56px; }

.management-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#management-image-jobs:empty, #management-design-history:empty { display: none; }
#home-recent { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }

.export-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.export-controls label { display: inline-flex; align-items: center; gap: 4px; }

/* Editor shell */
:root {
  --studio-text: #24263d;
  --studio-panel: #ffffff;
  --studio-workspace: #f5f4f0;
  --studio-toolbar: #232944;
  --studio-focus: #4a57a8;
  --studio-muted: #565b70;
  --studio-divider: #dedfe6;
  --studio-control: #85899a;
  --studio-hover: #f0f1f7;
}
[hidden] { display: none !important; }
body { font: 14px/1.5 system-ui, sans-serif; color: var(--studio-text); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.studio-bar {
  position: relative; z-index: 3; padding: 12px 16px; gap: 8px 24px;
  justify-content: space-between; background: var(--studio-panel); color: var(--studio-text);
  border-bottom: 1px solid var(--studio-divider);
}
.studio-file, .studio-actions, .canvas-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0;
}
.studio-file { flex: 1 1 360px; }
.studio-actions { justify-content: flex-end; }
#projects { max-width: min(320px, 100%); min-width: 0; font-size: 15px; font-weight: 650; }
#save-status { color: var(--studio-muted); font-size: 12px; }
button, select, input:not([type=checkbox]):not([type=color]), textarea, .action-menu > summary {
  min-height: 34px; max-width: 100%; border: 1px solid var(--studio-control);
  border-radius: 6px; background: var(--studio-panel); color: var(--studio-text);
}
input:not([type=checkbox]):not([type=color]), textarea { padding: 6px 8px; }
textarea { resize: vertical; }
button, select, .action-menu > summary { padding: 6px 10px; }
button { margin: 0; }
button:hover:not(:disabled), .action-menu > summary:hover { background: var(--studio-hover); }
:where(button,select,input,textarea,summary,a,[tabindex]):focus-visible { outline: 2px solid var(--studio-focus); outline-offset: 2px; }
button:disabled { cursor: default; opacity: .55; }
button.primary-action, #apply-proposals:not(:disabled) { color: var(--studio-panel); background: var(--studio-focus); border-color: var(--studio-focus); font-weight: 650; }
button.primary-action:hover:not(:disabled), #apply-proposals:hover:not(:disabled) { background: var(--studio-toolbar); }
button.studio-home-link { border-color: transparent; font-weight: 750; padding-inline: 0 8px; }
.action-menu { position: relative; }
.action-menu > summary { cursor: pointer; white-space: nowrap; }
.action-menu-items {
  position: absolute; z-index: 4; inset-inline-end: 0; top: calc(100% + 6px);
  display: grid; gap: 4px; width: max-content; max-width: min(220px, 80vw);
  padding: 8px; border: 1px solid var(--studio-divider); border-radius: 8px;
  background: var(--studio-panel); box-shadow: 0 8px 24px #23294420;
}
.action-menu-items button { text-align: left; border-color: transparent; }
.action-menu-items label { padding: 6px 8px; }

main { grid-template-columns: minmax(155px, 208px) minmax(0, 1fr) minmax(220px, 280px); align-items: start; min-height: calc(100dvh - 100px); }
.editor-panel { min-width: 0; padding: 16px; overflow-wrap: anywhere; align-self: stretch; }
#editor-tools { border-inline-end: 1px solid var(--studio-divider); }
#editor-properties, #editor-pages { border-inline-start: 1px solid var(--studio-divider); grid-column: 3; grid-row: 1; }
#editor-pages, main[data-desktop-pages="true"] #editor-properties { display: none; }
main[data-desktop-pages="true"] #editor-pages { display: block; }
.mobile-panels { display: none; }
#editor-tools { padding: 0; }
.editor-tool-nav, .editor-inspector-nav { display: flex; gap: 4px; padding: 8px; }
.editor-tool-nav { flex-wrap: wrap; background: var(--studio-workspace); border-bottom: 1px solid var(--studio-divider); }
.editor-tool-nav button, .editor-inspector-nav button { min-height: 40px; margin: 0; }
.editor-tool-nav button[aria-pressed=true], .editor-inspector-nav button[aria-pressed=true] {
  background: var(--studio-focus); border-color: var(--studio-focus); color: var(--studio-panel);
}
.editor-tool-content { min-width: 0; padding: 16px; }
.editor-inspector-nav { padding: 0 0 8px; margin-bottom: 16px; border-bottom: 1px solid var(--studio-divider); }
@media (min-width: 861px) {
  main { grid-template-columns: minmax(245px, 288px) minmax(0, 1fr) minmax(220px, 280px); }
  #editor-tools { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: start; }
  .editor-tool-nav { flex-direction: column; align-self: stretch; border-bottom: 0; border-inline-end: 1px solid var(--studio-divider); }
  .editor-tool-nav button { padding-inline: 4px; }
}
.editor-panel h2 { font-size: 13px; margin: 0 0 8px; }
.editor-panel h2:not(:first-child) { margin-top: 16px; }
.panel-divider { border-top: 1px solid var(--studio-divider); padding-top: 16px; }
.insert-grid, .page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.insert-grid button, .page-actions button { overflow-wrap: anywhere; }
.insert-actions { display: grid; gap: 8px; }
.upload-control { display: block; margin: 12px 0; }
#upload { font-size: 12px; }
#selection-count { min-height:21px; }
#selection-count:empty { visibility:hidden; }
#layers { margin: 0; display: grid; gap: 4px; }
#layers li { min-width: 0; }
#layers button { padding: 4px 8px; min-height: 36px; overflow-wrap: anywhere; border-color: transparent; }
#layers button[aria-pressed=true] { border-color: var(--studio-focus); }
.editor-panel details { margin-block: 8px; }
.editor-panel summary { cursor: pointer; }
.editor-panel fieldset { min-width: 0; margin: 8px 0; border: 1px solid var(--studio-divider); }
.editor-panel form { min-width: 0; }
.editor-panel form button { margin: 2px 0; }
#empty { color: var(--studio-muted); }
.workspace { padding: 0; gap: 0; grid-column: 2; grid-row: 1; width: 100%; overflow: visible; }
.canvas-toolbar { width: 100%; padding: 8px 12px; background: var(--studio-panel); border-bottom: 1px solid var(--studio-divider); }
.page-picker { flex: 1 1 105px; min-width: 0; }
.page-jump-control { display:inline-flex; align-items:center; gap:4px; flex:0 0 auto; }
.page-jump-control input { width:4em; min-height:36px; margin:0; }
.page-jump-control button { margin:0; min-height:36px; }
.page-jump-status:not(:empty) { font-size:12px; min-width:0; overflow-wrap:anywhere; }
@media(max-width:860px){.page-jump-control :is(input,button){min-height:44px;}}
#pages { width: 100%; }
.canvas-scroll { min-height: min(580px, 64dvh); max-height: 78dvh; padding: 24px; }
#canvas-frame { box-shadow: 0 3px 18px #23294424; }
#canvas { box-shadow: none; }
footer { padding: 8px 16px; min-height: 36px; background: var(--studio-panel); color: var(--studio-muted); border-top: 1px solid var(--studio-divider); overflow-wrap: anywhere; }
dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 32px);
  overflow: auto; padding: 20px; border: 1px solid var(--studio-divider); border-radius: 12px;
  color: var(--studio-text); background: var(--studio-panel); box-shadow: 0 18px 64px #23294430;
  overflow-wrap: anywhere;
}
dialog::backdrop { background: #23294455; }
dialog h2 { font-size: 18px; margin: 0 0 12px; }
dialog form > button { margin: 4px 4px 0 0; }

@media (max-width: 860px) {
  .studio-bar { gap: 8px; padding: 8px 12px; }
  .studio-actions { justify-content: flex-start; }
  .studio-file { flex-basis: 100%; }
  #projects { flex: 1; }
  main { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .workspace { grid-column: 1; grid-row: 1; }
  .canvas-toolbar { padding-inline: 8px; }
  .canvas-scroll { padding: 16px; min-height: min(280px, 40dvh); max-height: 58dvh; }
  .mobile-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 8px; background: var(--studio-panel); border-block: 1px solid var(--studio-divider); }
  .mobile-panels button { padding-inline: 4px; }
  #desktop-pages { display: none; }
  #editor-tools, #editor-properties, #editor-pages, main[data-desktop-pages="true"] #editor-pages { display: none; grid-column: 1; grid-row: 3; border: 0; width: 100%; }
  main[data-editor-panel="tools"] #editor-tools,
  main[data-editor-panel="properties"] #editor-properties,
  main[data-editor-panel="pages"] #editor-pages { display: block; }
  .studio-actions button, .studio-actions summary, .mobile-panels button { min-height: 40px; }
}

.studio-surface, #studio-home { width: min(1000px, calc(100% - 24px)); padding: clamp(16px, 3vw, 32px); }
.surface-heading, .home-heading, .home-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.surface-heading, .home-heading { justify-content: space-between; margin-bottom: 16px; }
.surface-heading h2, .home-heading h2 { margin: 0; font-size: clamp(20px, 3vw, 28px); line-height: 1.25; letter-spacing: -.03em; }
.studio-surface h3 { font-size: 15px; margin: 0 0 12px; }
#studio-home h3 { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--studio-divider); }
#home-recent { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px; }
#home-recent button { background: var(--studio-workspace); overflow-wrap: anywhere; }
#home-recent button:hover { background: var(--studio-hover); }
.gallery-filters, .surface-fields, .gallery-workflow, .ai-workflow {
  display: grid; gap: 12px; min-width: 0;
}
#gallery-quick-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px; }
#gallery-quick-categories button { min-height: 40px; }
#gallery-quick-categories button[aria-pressed=true] {
  background: var(--studio-focus); border-color: var(--studio-focus); color: var(--studio-panel);
}
#gallery-result-count { margin: 0 0 8px; color: var(--studio-muted); font-size: 13px; }
#gallery-result-count:empty { display: none; }
#gallery-templates { gap: 12px; }
#gallery-templates .template-tile[aria-pressed=true] { outline: 1px solid var(--studio-focus); outline-offset: -2px; }
.gallery-filters { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.gallery-filters select, .ai-assets select { width: 100%; }
.gallery-workflow { grid-template-columns: minmax(0, 1fr) minmax(220px, 32%); align-items: start; }
.ai-workflow { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); align-items: start; }
.surface-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.surface-fields input, .gallery-filters input, .gallery-filters select { margin-top: 4px; }
#home-templates, #gallery-templates, #ai-options {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); gap: 8px;
}
#home-templates button.template-tile, .template-tile {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: 4px; padding: 8px; min-width: 0; text-align: left;
  overflow-wrap: anywhere;
}
.template-tile strong { font-size: 13px; }
.template-tile small, #template-size, #ai-status, #home-empty { color: var(--studio-muted); }
.template-image {
  display: grid; place-items: center; padding: 8px; min-width: 0;
  aspect-ratio: 4 / 3; background: var(--studio-workspace); border-radius: 4px;
}
#home-templates .template-image canvas, .template-image canvas {
  width: auto; height: auto; max-width: 100%; max-height: 128px; object-fit: contain;
}
.template-tile[aria-pressed=true] { border-color: var(--studio-focus); }
.gallery-preview, .ai-results {
  padding: 16px; min-width: 0; border-radius: 8px;
  background: var(--studio-workspace); border: 1px solid var(--studio-divider);
}
.gallery-preview select { width: 100%; }
:is(#template-page-selection,#team-template-page-selection) { min-width:0; }
:is(#template-page-options,#team-template-page-options) { display:grid; gap:8px; grid-template-columns:repeat(auto-fit,minmax(min(100%,114px),1fr)); }
.template-page-choice { display:grid; align-content:start; min-width:0; gap:4px; overflow-wrap:anywhere; }
.template-page-choice label { font-size:12px; margin:0; }
.template-page-thumbnail-button { display:grid; justify-items:center; align-content:center; gap:4px; width:100%; min-width:0; min-height:44px; margin:0; }
.template-page-thumbnail-button canvas { display:block; max-width:100%; height:auto; }
.template-page-thumbnail-button[aria-pressed=true] { outline:2px solid var(--studio-selection,#087f8c); outline-offset:-2px; }
:is(#library-page-import,#server-page-import) { min-width:0; overflow-wrap:anywhere; }
:is(#library-page-import,#server-page-import) fieldset { min-width:0; }
:is(#library-import-pages,#server-import-pages) { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,128px),1fr)); gap:8px; max-height:16rem; overflow:auto; }
.project-page-tile-placeholder { display:block; width:min(100%,118px); height:58px; background:#eee; border-radius:3px; }
:is(#library-import-pages,#server-import-pages) .surface-actions { margin:4px 0; }
:is(#library-import-preview,#server-import-preview) { max-width:100%; height:auto; }
.ai-assets { border-block: 1px solid var(--studio-divider); padding: 8px 0; margin-bottom: 12px; }
.ai-assets summary { cursor: pointer; padding: 4px 0; }
.ai-assets label:first-of-type { margin-top: 8px; }
.option-action { color: var(--studio-focus); margin-top: auto; padding-top: 4px; font-weight: 650; }
#ai-status { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .gallery-workflow, .ai-workflow { grid-template-columns: minmax(0, 1fr); }
  .gallery-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
  #gallery-templates, #home-templates, #ai-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-preview, .ai-results { padding: 12px; }
}

.surface-panel {
  min-width: 0; padding: 16px; background: var(--studio-workspace);
  border: 1px solid var(--studio-divider); border-radius: 8px;
}
.surface-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px; }
.surface-hint, #export-scope, #management-project { color: var(--studio-muted); }
.export-layout, .management-history { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.export-layout label { display: block; margin-bottom: 8px; }
.export-layout .export-controls label { margin: 0; }
#export-status:empty { display: none; }
.management-history { margin-top: 16px; }
.management-history ul, #comments-list { padding-inline-start: 20px; overflow-wrap: anywhere; }
#comments-dialog { width: min(680px, calc(100% - 24px)); }
#comments-dialog > h3 { margin-top: 20px; }
#review-state { font-weight: 650; margin-block: 8px 12px; }
#review-state[data-state=approved] { color: #245842; }
#review-state[data-state=changes_requested] { color: #843619; }
#review { border-top: 1px solid var(--studio-divider); margin-top: 16px; padding-top: 16px; }
#review-count { color: var(--studio-muted); }
#proposal-list .proposal-row { margin-block: 8px; }
#proposal-list .proposal-row button { min-height: 40px; }
#proposal-list label { display: block; overflow-wrap: anywhere; padding: 8px; margin-block: 8px; border: 1px solid var(--studio-divider); border-radius: 6px; }
#proposal-list [data-rejected=true] label { color: var(--studio-muted); }
#proposal-list label:has(input:checked) { border-color: var(--studio-focus); background: var(--studio-hover); }
.review-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.review-comparison figure { display: grid; align-content: start; gap: 4px; margin: 0; min-width: 0; }
.review-comparison figcaption { font-size: 12px; color: var(--studio-muted); }
.review-comparison canvas { display: block; width: 100%; margin: 0; box-shadow: none; border: 1px solid var(--studio-divider); }
@media (max-width: 700px) {
  .export-layout, .management-history { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .surface-panel { padding: 12px; }
}

.settings-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.settings-panel select { max-width: 100%; }
.settings-panel img { display: block; max-width: 100%; max-height: 220px; object-fit: contain; margin-block: 12px; }
.settings-panel h3:not(:first-child) { margin-top: 16px; }
.settings-panel > label { display: block; margin-bottom: 8px; }
.settings-panel textarea { min-height: 64px; }
.workspace-projects { grid-column: 1 / -1; }
#workspace-create, #workspace-member { margin-top: 12px; }
#workspace-members, #server-projects, #team-templates { list-style: none; padding: 0; }
#workspace-members li { display: grid; gap: 8px; padding-block: 10px; border-top: 1px solid var(--studio-divider); }
#workspace-members li span { display: block; color: var(--studio-muted); font-size: 12px; }
.member-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.member-actions button, #server-projects button, #team-templates button { width: auto; }
#server-projects li, #team-templates li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-block: 4px; }
@media (max-width: 700px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

#page-outline { display: grid; gap: 4px; margin: 0 0 16px; max-height: 260px; overflow: auto; padding: 2px; }
#page-outline button { min-height: 40px; overflow-wrap: anywhere; }
#page-outline small { display: block; color: var(--studio-muted); }
#section-dialog { width: min(560px, calc(100% - 24px)); }
#section-dialog button[value=add] { margin-top: 12px; }
#batch-template-fields { overflow-wrap: anywhere; }
#batch-product-list { min-width: 0; margin-inline: 0; border: 1px solid var(--studio-control); }
.image-workflow:has(#image-edit-options[hidden]) { grid-template-columns: minmax(0, 1fr); }
#image-mask-frame { margin-bottom: 12px; background: var(--studio-panel); }
#image-mask-source { margin: 0; }
#image-job-history { margin-block: 12px; }
#image-ai-comparison { margin-top: 12px; }
#image-ai-comparison figcaption { margin-top: 4px; color: var(--studio-muted); }

.library-tools { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
.record-list { list-style: none; padding: 0; margin-block: 12px 0; }
.record-list > li, #project-results > li {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--studio-divider); overflow-wrap: anywhere;
}
.record-list > li > button { width: auto; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.record-actions button { width: auto; }
button.record-title { border-color: transparent; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
#project-result-count { color: var(--studio-muted); }
#versions-dialog, #project-share { width: min(680px, calc(100% - 24px)); }
#open-project-link { align-self: center; color: var(--studio-focus); padding: 6px; }
@media (max-width: 700px) {
  .library-tools { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #project-results > li { align-items: stretch; }
  #project-results button.record-title { width: 100%; }
}

#version-preview-canvas { max-width: 100%; height: auto; }

.startup-error { margin: 0; padding: 12px 16px; color: var(--studio-text); background: var(--studio-panel); border-bottom: 1px solid var(--studio-divider); }

#canvas-layer-actions .action-menu-items { max-height: min(65dvh, 420px); overflow: auto; overscroll-behavior: contain; }
#canvas-stack { width: 100%; }
@media (max-width: 860px) {
  #canvas-layer-actions .action-menu-items {
    position: fixed; inset: auto 12px 12px;
    width: auto; max-width: none;
  }
  #canvas-layer-actions .action-menu-items button { min-height: 40px; }
}

#distance-guides { position:absolute; inset:0; z-index:3; pointer-events:none; overflow:hidden; }
.distance-guide-line { position:absolute; box-sizing:border-box; border-color:var(--studio-selection,#087f8c); border-style:solid; border-width:0; }
.distance-guide-line[data-axis="x"] { border-top-width:1px; }
.distance-guide-line[data-axis="y"] { border-left-width:1px; }
.distance-guide-label { position:absolute; transform:translate(-50%,-50%); border-radius:3px; padding:2px 4px; color:#fff; background:#075762; white-space:nowrap; font-size:11px; font-variant-numeric:tabular-nums; }
#canvas-selection-box { position: absolute; z-index: 2; pointer-events: none; border: 1px solid var(--studio-focus); background: #4a57a81f; }

#video-timeline { margin-block: 12px; }
#video-timeline > summary { cursor: pointer; padding-block: 8px; }
#video-scenes { display: grid; gap: 8px; }
#video-scenes li {
  display: grid; grid-template-columns: minmax(0, 1fr) 90px auto auto;
  gap: 8px; align-items: center; padding: 8px;
  border: 1px solid var(--studio-divider); border-radius: 8px;
}
#video-scenes button { width: auto; min-height: 40px; margin: 0; overflow-wrap: anywhere; }
#video-scenes input { width: 100%; }
#video-preview { display: block; max-width: 100%; max-height: 240px; object-fit: contain; margin-block: 8px; }
#video-preview[hidden] { display: none; }
@media (max-width: 520px) {
  #video-scenes li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

#stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
#stock-grid article { min-width: 0; }
#stock-grid button { width: 100%; }
#stock-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
#stock-grid a { display: inline-block; padding: 6px 8px; color: var(--studio-focus); font-size: 13px; }
.stock-filters label { min-width: 0; }

#team-cursors { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.team-cursor {
  position: absolute; width: 18px; height: 20px;
  background: var(--studio-focus); filter: drop-shadow(1px 1px 1px #24263d);
  clip-path: polygon(0 0, 90% 65%, 56% 66%, 46% 100%, 30% 93%, 39% 59%, 0 77%);
}

#conflict-fields { display: grid; gap: 16px; }
#conflict-fields fieldset {
  display: grid; gap: 8px; padding: 8px; min-inline-size: 0;
  border: 1px solid var(--studio-divider); border-radius: 8px;
}
#conflict-fields legend { padding-inline: 4px; max-inline-size: 100%; }
#conflict-fields label {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: start; gap: 4px 8px; padding: 8px; min-height: 44px;
  border-radius: 8px; cursor: pointer;
}
#conflict-fields label:has(:checked) { outline: 2px solid var(--studio-focus); outline-offset: -2px; }
#conflict-fields input[type=radio] { min-height: 0; margin: 3px 0 0; padding: 0; accent-color: var(--studio-focus); }
#conflict-fields label span { grid-column: 2; white-space: pre-wrap; }
#conflict-fields img { max-width: 100%; max-height: 120px; display: block; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.conflict-actions button { min-height: 40px; }

#resize-dialog :is(#resize-preview-choice,#resize-layout-mode) { max-width:100%; min-height:44px; }
#resize-preview-status { margin:8px 0 0; overflow-wrap:anywhere; }
#resize-custom-mm:not([hidden]) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
#resize-custom-mm label { display:grid; gap:4px; }
#resize-custom-mm input { min-width:0; width:100%; min-height:44px; }
#resize-custom-label { display:flex; align-items:center; gap:8px; min-height:44px; }
.resize-presets {
  display: grid; gap: 4px 8px; grid-template-columns: repeat(2, minmax(0, 1fr));
  min-inline-size: 0; padding: 8px; border: 1px solid var(--studio-divider); border-radius: 8px;
}
.resize-presets label { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px; }
@media (max-width: 540px) {
  .resize-presets { grid-template-columns: minmax(0, 1fr); }
}

#batch-design-preview { margin: 12px 0 0; }
#batch-design-canvas { display: block; max-width: 100%; height: auto; margin: 4px auto 0; }

#agentation-selection {
  min-inline-size: 0; margin: 8px 0; padding: 8px;
  border: 1px solid var(--studio-divider); border-radius: 8px;
}
#agentation-selection-list label { display: block; padding: 8px 4px; overflow-wrap: anywhere; }

/* MangoBoard guide: command bar, left tool rail, contextual tool pane and slide rail. */
:root {
  --studio-text: #292929;
  --studio-toolbar: #222222;
  --studio-workspace: #626262;
  --studio-focus: #725b00;
  --studio-muted: #595959;
  --studio-divider: #dddddd;
  --studio-control: #999999;
  --studio-hover: #f5f3e8;
  --studio-highlight: #ffdf40;
}
.studio-bar { background: var(--studio-toolbar); color: #ffffff; min-height: 56px; padding-block: 8px; gap: 8px 16px; }
.studio-bar button, .studio-bar select, .studio-bar .action-menu > summary {
  background: transparent; color: #ffffff; border-color: #777777;
}
.studio-bar #save-status { color: #dddddd; }
.studio-bar button:hover:not(:disabled), .studio-bar .action-menu > summary:hover { background: #3d3d3d; }
.studio-bar .action-menu-items { background: var(--studio-panel); }
.studio-bar .action-menu-items button { color: var(--studio-text); }
.studio-bar select option { background: var(--studio-panel); color: var(--studio-text); }
button.primary-action, #apply-proposals:not(:disabled), .studio-bar #export-open {
  background: var(--studio-highlight); border-color: var(--studio-highlight); color: var(--studio-text);
}
button.primary-action:hover:not(:disabled), #apply-proposals:hover:not(:disabled) { background: #f2ce20; color: var(--studio-text); }
.studio-bar :focus-visible { outline-color: var(--studio-highlight); }
.editor-tool-nav { background: var(--studio-panel); }
.editor-tool-nav button { border-color: transparent; border-radius: 4px; font-size: 12px; }
.editor-tool-nav button[aria-pressed=true] { color: var(--studio-text); background: var(--studio-highlight); border-color: var(--studio-highlight); }
.editor-inspector-nav button[aria-pressed=true] { background: var(--studio-highlight); color: var(--studio-text); border-color: var(--studio-highlight); }
.sidebar-search { display: block; font-size: 12px; font-weight: 650; padding-bottom: 16px; }
.editor-tool-content:has(#tool-templates[hidden]):has(#tool-elements[hidden]) > .sidebar-search { display: none; }
.sidebar-search input { display: block; width: 100%; margin-top: 6px; font-size: 13px; }
#sidebar-templates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 8px; }
.sidebar-template { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0; border: 0; text-align: left; gap: 6px; background: transparent; font-size: 12px; }
.sidebar-template .template-image { display: grid; place-items: center; background: #eeeeee; border-radius: 4px; overflow: hidden; height: 136px; }
.sidebar-template canvas { max-width: 100%; max-height: 136px; width: auto; height: auto; }
.sidebar-template span:last-child { overflow-wrap: anywhere; }
#sidebar-template-status { margin: 0 0 12px; font-size: 12px; color: var(--studio-muted); }
.workspace { position: relative; background: var(--studio-workspace); }
.canvas-scroll { background: var(--studio-workspace); }
.canvas-toolbar { background: #f8f8f8; }
.surface-panel, .gallery-preview, .ai-results, #home-recent button { background: #f7f7f7; }
#layers button[aria-pressed=true] { background: #fff4b3; border-color: var(--studio-focus); color: var(--studio-text); }
#canvas-frame { box-shadow: 0 2px 12px #00000040; }
@media (min-width: 861px) {
  main { position: relative; grid-template-columns: 360px minmax(0,1fr); height: calc(100dvh - 56px); min-height: 600px; overflow: hidden; }
  #editor-tools { grid-column: 1; grid-row: 1; grid-template-columns: 64px minmax(0,1fr); height: 100%; overflow: hidden; background: #ffffff; }
  .editor-tool-nav { padding: 8px 4px; gap: 8px; border-inline-end: 1px solid var(--studio-divider); }
  .editor-tool-nav button { min-height: 52px; padding-inline: 2px; }
  .editor-tool-content { padding: 16px; overflow-y: auto; height: 100%; scrollbar-gutter: stable; }
  #editor-properties { grid-column: 1; grid-row: 1; z-index: 1; margin-left: 64px; width: 296px; height: 100%; overflow-y: auto; scrollbar-gutter: stable; border: 0; background: #ffffff; }
  main[data-side-panel="assets"] #editor-properties { display: none; }
  main[data-side-panel="inspector"] .editor-tool-content { visibility: hidden; }
  main[data-side-panel="inspector"] #editor-properties { display: block; }
  .workspace { grid-column: 2; grid-row: 1; height: 100%; display: grid; grid-template-rows: 56px minmax(0,1fr); padding-right: 140px; }
  .canvas-toolbar { align-self: start; justify-self: end; width: auto; max-width: 100%; min-height: 48px; margin: 8px 0 0 12px; border: 1px solid var(--studio-divider); border-radius: 6px; padding: 6px 8px; position: relative; z-index: 2; }
  .page-picker { flex: 0 1 150px; }
  .canvas-scroll { min-height: 0; max-height: calc(100dvh - 112px); height: 100%; padding: 32px; }
  #editor-pages, main[data-desktop-pages="true"] #editor-pages {
    display: block; position: absolute; grid-column: auto; grid-row: auto; z-index: 2;
    right: 16px; top: 104px; width: 112px; max-height: calc(100% - 128px);
    padding: 12px 8px; border: 1px solid var(--studio-divider); border-radius: 6px; background: #ffffff; overflow-y: auto;
  }
  #editor-pages h2 { font-size: 12px; text-align: center; }
  #page-outline { max-height: 200px; }
  #page-outline button { font-size: 12px; }
  #editor-pages .page-actions { grid-template-columns: 1fr; gap: 6px; }
  #editor-pages .page-actions button { font-size: 12px; padding-inline: 2px; }
  main:not([data-desktop-pages="true"]) #editor-pages .page-actions > button:not(#add-page):not(#copy-page):not(#remove-page),
  main:not([data-desktop-pages="true"]) #editor-pages > details { display: none; }
  main[data-desktop-pages="true"] #editor-pages { width: 264px; box-shadow: 0 8px 24px #00000022; }
  main[data-desktop-pages="true"] #editor-pages .page-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (min-width: 861px) and (max-width: 1100px) {
  main { grid-template-columns: 304px minmax(0,1fr); }
  #editor-properties { width: 240px; }
  .workspace { padding-right: 116px; }
  #editor-pages { width: 96px; right: 8px; }
}
@media (max-width: 860px) {
  .editor-tool-nav { gap: 4px; padding: 8px; }
  .editor-tool-nav button { flex: 1 1 62px; min-height: 44px; }
  .canvas-scroll { background: var(--studio-workspace); }
  .canvas-toolbar { background: #f8f8f8; }
}
.editor-tool-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.editor-tool-nav svg { display: block; width: 22px; height: 22px; flex: 0 0 22px; }
.studio-file { flex-basis: 640px; }
.studio-bar #projects { margin-left: 8px; max-width: 240px; font-weight: 500; }
@media (max-width: 860px) {
  .studio-file { flex-basis: 100%; }
  .studio-bar #projects { margin-left: 0; max-width: 100%; }
  .editor-tool-nav button { min-height: 64px; }
}
@media (min-width: 861px) {
  .canvas-toolbar { width: max-content; max-width: calc(100% - 16px); flex-wrap: nowrap; }
  .canvas-toolbar > * { min-width: 0; }
  .canvas-toolbar > button, .canvas-toolbar summary { white-space: nowrap; }
  .page-picker { flex: 1 1 140px; max-width: 180px; min-width: 64px; }
  footer { position: fixed; bottom: 0; left: 360px; right: 0; z-index: 3; min-height: 24px; padding: 2px 12px; font-size: 12px; background: #333333; color: #ffffff; border: 0; }
  footer:empty { display: none; }
}
@media (min-width: 861px) and (max-width: 1100px) { footer { left: 304px; } }
.text-presets { display: grid; gap: 12px; }
.text-presets button { min-height: 64px; text-align: left; padding: 12px; background: #f7f7f7; }
[data-text-preset="title"] { font-size: 24px; font-weight: 700; }
[data-text-preset="subtitle"] { font-size: 18px; font-weight: 700; }
[data-text-preset="body"] { font-size: 14px; }
.canvas-layer-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.canvas-layer-toggle svg { width: 18px; height: 18px; flex: 0 0 18px; }
.canvas-layer-toggle[aria-pressed=true] { background: var(--studio-highlight); color: var(--studio-text); border-color: var(--studio-focus); }
.layer-popover {
  position: fixed; top: 120px; right: 24px; z-index: 5; width: 280px;
  max-width: calc(100% - 24px); max-height: calc(100% - 144px); overflow: auto;
  padding: 16px; border: 1px solid var(--studio-divider); border-radius: 6px;
  background: var(--studio-panel); box-shadow: 0 8px 24px #00000022;
}
.layer-popover-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.layer-popover-heading h2 { margin: 0; font-size: 14px; }
.layer-popover #layers { padding-inline-start: 20px; }
@media (max-width: 860px) {
  .layer-popover { top: auto; bottom: 16px; right: 12px; max-height: min(60dvh, 500px); }
}
#layers li { display: grid; grid-template-columns: minmax(0,1fr) 44px 44px; gap: 4px; align-items: start; }
#layers .layer-row-select { text-align: left; min-height: 44px; }
#layers [data-layer-flag] { min-height: 44px; padding-inline: 2px; font-size: 12px; cursor: pointer; }
#layers [data-layer-flag]:disabled { cursor: default; }

#properties .property-pair-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 8px; margin-bottom: 12px; }
#properties .property-pair-grid label { min-width: 0; margin: 0; font-size: 12px; }
#properties .property-pair-grid input, #properties .property-pair-grid select { width: 100%; min-width: 0; min-height: 44px; margin-top: 4px; }
#properties .geometry-properties { padding: 12px 0 0; border: 0; border-top: 1px solid var(--studio-divider); }
#properties .geometry-properties legend { padding: 0 8px 0 0; font-size: 12px; font-weight: 650; }

#page-outline button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; text-align: center; }
#page-outline .page-thumbnail { display: block; max-width: 100%; max-height: 120px; width: auto; height: auto; margin: 0; border: 1px solid var(--studio-divider); box-shadow: none; pointer-events: none; }
#page-outline button[aria-pressed=true] { background: #fff4b3; border-color: var(--studio-focus); color: var(--studio-text); }
#page-outline button > span { width: 100%; overflow-wrap: anywhere; }
@media (max-width: 860px) { #page-outline { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; } }

.insert-grid [data-kind] { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; min-width: 0; min-height: 104px; background: #f7f7f7; }
.insert-grid .element-thumbnail { width: 112px; max-width: 100%; height: auto; margin: 0; background: transparent; box-shadow: none; pointer-events: none; }
.insert-grid [data-kind] span { font-size: 12px; }

#tool-background #page-settings label { font-size: 12px; }
#tool-background #page-settings input, #tool-background #page-settings select { min-height: 44px; max-width: 100%; }
#tool-background #page-settings input[type=color] { display: block; width: 100%; height: 48px; padding: 4px; margin-top: 4px; }

.sidebar-filter { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 12px; }
.sidebar-filter select { min-width: 0; width: 100%; min-height: 44px; flex: 1; }

.canvas-zoom-controls { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.canvas-zoom-controls button { min-width: 32px; min-height: 36px; padding-inline: 6px; margin: 0; font-size: 18px; }
.canvas-zoom-controls label { margin: 0; }
#canvas-size { font-size: 12px; white-space: nowrap; }
@media (min-width: 861px) {
  .workspace { grid-template-rows: auto minmax(0,1fr); }
  .canvas-toolbar { flex-wrap: wrap; }
}
@media (max-width: 860px) { .canvas-zoom-controls button { min-width: 44px; min-height: 44px; } }

@media (min-width: 861px) { .workspace { grid-template-columns: minmax(0,1fr); } }

#collapse-sidebar { display: none; }
@media (min-width: 861px) {
  #collapse-sidebar { display: block; position: absolute; z-index: 4; left: 360px; top: 45%; width: 24px; min-height: 48px; padding: 0; border-radius: 0 6px 6px 0; border-left: 0; background: var(--studio-panel); color: var(--studio-text); font-size: 24px; }
  main[data-sidebar-collapsed="true"] { grid-template-columns: 64px minmax(0,1fr); }
  main[data-sidebar-collapsed="true"] #editor-tools { grid-template-columns: 64px; }
  main[data-sidebar-collapsed="true"] .editor-tool-content, main[data-sidebar-collapsed="true"] #editor-properties { display: none; }
  main[data-sidebar-collapsed="true"] #collapse-sidebar { left: 64px; }
  body:has(main[data-sidebar-collapsed="true"]) footer { left: 64px; }
}
@media (min-width: 861px) and (max-width: 1100px) { main:not([data-sidebar-collapsed="true"]) #collapse-sidebar { left: 304px; } }

#uploaded-media { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
#uploaded-media-status { font-size: 12px; color: var(--studio-muted); line-height: 1.5; }
#uploaded-media-preview { width:min(640px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; }
#uploaded-media-preview :is(img,video) { display:block; width:auto; max-width:100%; max-height:45dvh; margin:8px auto; object-fit:contain; }
#uploaded-media-preview-name { overflow-wrap:anywhere; }
.uploaded-media-card { display:grid; min-width:0; align-content:start; gap:4px; }
.uploaded-media-card :is(.uploaded-media-item,button) { min-width:0; width:100%; }
.uploaded-media-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 6px; text-align: left; }
.uploaded-media-item img { width: 100%; height: 96px; object-fit: contain; background: #f7f7f7; }
.uploaded-media-item span { max-width: 100%; font-size: 12px; overflow-wrap: anywhere; }

.studio-bar #rename-project { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; background: transparent; border-color: transparent; font-weight: 500; }
.studio-bar #rename-project:hover:not(:disabled) { border-color: #777777; }
.studio-bar .action-menu-items #projects { width: 100%; max-width: 100%; margin: 0 0 8px; color: var(--studio-text); background: var(--studio-panel); }
@media (max-width: 860px) { .studio-bar #rename-project { max-width: 100%; flex: 1 1 140px; min-width: 0; } }

#object-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; margin-bottom: 12px; background: var(--studio-panel); border: 1px solid var(--studio-divider); border-radius: 6px; }
#object-quick-actions button { min-height: 44px; margin: 0; font-size: 12px; }
@media (min-width: 1101px) {
  #object-quick-actions { position: fixed; z-index: 3; right: 144px; top: 184px; width: 80px; flex-direction: column; box-shadow: 0 4px 16px #00000022; }
  #object-quick-actions button { width: 100%; padding-inline: 2px; overflow-wrap: anywhere; }
}

@media (min-width: 1101px) {
  #object-quick-actions { right: auto; left: var(--object-actions-left, calc(100% - 224px)); top: var(--object-actions-top, 184px); }
}

:root { --studio-selection: #087f8c; }
#layers .layer-drop-target button { outline-color: var(--studio-selection); }
#canvas-selection-box { border-color: var(--studio-selection); background: #087f8c1f; }

#object-color-controls { padding: 12px 0; margin: 0 0 12px; border: 0; border-top: 1px solid var(--studio-divider); }
#object-color-controls legend { font-size: 12px; font-weight: 650; padding-right: 8px; }
.color-value-row { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 8px; }
.color-value-row label { min-width: 0; font-size: 12px; }
.color-value-row input { display: block; width: 100%; min-height: 44px; margin-top: 4px; }
.color-value-row input[type=color] { height: 44px; padding: 4px; }
#object-color-palette { display: grid; grid-template-columns: repeat(auto-fit,minmax(44px,1fr)); gap: 6px; margin-top: 8px; }
#object-color-palette button { height: 44px; margin: 0; padding: 6px; background: var(--studio-panel); border-color: #777777; }
#object-color-palette button::before { content: ''; display: block; width: 100%; height: 100%; background: var(--swatch-color); border: 1px solid #777777; }
#object-color-palette button[aria-pressed=true] { outline: 2px solid var(--studio-selection); outline-offset: -3px; }

#matching-text-color-option { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: 12px; min-height: 44px; }
#matching-text-color-hint { display: block; font-size: 12px; line-height: 1.5; color: var(--studio-muted); }

main[data-page-overview="true"] .canvas-scroll, main[data-page-overview="true"] #object-quick-actions { display: none; }
#page-overview { width: 100%; min-height: 0; height: 100%; overflow: auto; padding: 24px; color: #ffffff; }
#page-overview h2 { margin-top: 0; }
#page-overview > p { font-size: 12px; }
#page-overview-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 24px 16px; align-items: start; }
#page-overview-grid article { min-width: 0; }
.page-overview-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; min-height: 240px; padding: 12px; background: #f7f7f7; }
.page-overview-preview canvas { max-width: 100%; max-height: 220px; width: auto; height: auto; box-shadow: none; border: 1px solid var(--studio-divider); }
.page-overview-preview span { overflow-wrap: anywhere; }
.page-overview-preview[aria-pressed=true] { background: #fff4b3; border-color: var(--studio-focus); }
#page-overview-grid article > button:last-child { min-height: 44px; width: 100%; margin-top: 4px; }
@media (max-width: 860px) { #page-overview { padding: 16px; max-height: 65dvh; } #page-overview-grid { grid-template-columns: 1fr; } }
@media (min-width: 1201px) { main[data-page-overview="true"] .workspace { grid-template-rows: auto minmax(0,1fr); } }

.page-overview-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.page-overview-actions button { min-height: 44px; flex: 1 1 60px; margin: 0; font-size: 12px; padding-inline: 4px; }
.overview-drop-target .page-overview-preview { outline: 3px solid var(--studio-highlight); outline-offset: 2px; }

.page-overview-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.page-overview-bulk label { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 12px; }
.page-overview-bulk button { min-height: 44px; margin: 0; font-size: 12px; }
#overview-selection-count { font-size: 12px; }

.page-overview-preview { user-select: none; }
.page-overview-preview canvas, .page-overview-preview span { pointer-events: none; }
#overview-action-status { min-height: 18px; font-size: 12px; }

.page-overview-insert { width: 100%; min-height: 44px; margin-top: 8px; border-style: dashed; font-size: 12px; }
@media (min-width: 861px) and (hover: hover) and (pointer: fine) {
  .page-overview-insert { opacity: 0; }
  #page-overview-grid article:hover .page-overview-insert, #page-overview-grid article:focus-within .page-overview-insert { opacity: 1; }
}

#overview-marquee { position: fixed; z-index: 6; pointer-events: none; border: 2px solid var(--studio-selection); background: #087f8c26; }
#page-overview.is-selecting-pages { user-select: none; cursor: crosshair; }

.text-search-panel { position: fixed; z-index: 7; right: 24px; top: 120px; width: 320px; max-width: calc(100% - 24px); max-height: calc(100dvh - 144px); overflow: auto; padding: 16px; background: var(--studio-panel); border: 1px solid var(--studio-divider); border-radius: 6px; box-shadow: 0 8px 24px #00000022; }
.text-search-panel input:not([type=checkbox]) { min-height: 44px; margin-top: 4px; }
.text-search-panel button { min-height: 44px; margin: 0; }
.text-search-panel label, .text-search-panel small { font-size: 12px; line-height: 1.5; }
.text-search-navigation { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.text-search-navigation p { flex: 1; text-align: center; font-size: 12px; }
.text-search-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.text-search-actions button { flex: 1; }
#text-search-status { font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 860px) { .text-search-panel { top: auto; right: 12px; bottom: 16px; max-height: 65dvh; } }

#canvas.is-style-brush { cursor: copy; }
#text-style-hint { position: fixed; z-index: 5; bottom: 28px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 14px; margin: 0; pointer-events: none; font-size: 12px; line-height: 1.5; background: var(--studio-panel); color: var(--studio-text); border: 1px solid var(--studio-divider); border-radius: 6px; box-shadow: 0 4px 16px #00000022; }

#shape-style label { font-size: 12px; }
#shape-style input:not([type=checkbox]) { min-height: 44px; max-width: 100%; }
#shape-style input[type=color] { display: block; width: 100%; height: 44px; margin-top: 4px; padding: 4px; }

.gradient-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gradient-presets button, #gradient-add-stop { min-height: 44px; font-size: 12px; }
.gradient-stop-row { display: grid; grid-template-columns: minmax(0,1fr) 76px 44px; gap: 6px; align-items: end; margin-bottom: 8px; }
.gradient-stop-row label { margin: 0; min-width: 0; }
.gradient-stop-row button { min-height: 44px; margin: 0; font-size: 12px; padding-inline: 2px; }
.gradient-stop-row input { min-width: 0; width: 100%; }

#element-style-options label { min-height: 44px; display: flex; align-items: center; gap: 8px; }
#element-style-status { font-size: 12px; line-height: 1.5; }

.photo-adjustment-pair { display:grid; grid-template-columns:minmax(0,1fr) 72px; gap:8px; align-items:center; }
.photo-adjustment-pair input { min-width:0; width:100%; min-height:44px; }
.photo-presets { display:flex; flex-wrap:wrap; gap:4px; }

.photo-tone-colors { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.photo-tone-colors label { font-size:12px; min-width:0; }
.photo-tone-colors input { width:100%; min-height:44px; }

#photo-editor-dialog { width:min(1200px,96vw); max-width:96vw; max-height:94dvh; padding:0; background:#f5f5f5; color:#292929; overflow:auto; }
.photo-editor-header { display:flex; flex-wrap:wrap; gap:12px; align-items:center; padding:12px 18px; background:#222; color:white; position:sticky; top:0; z-index:2; }
.photo-editor-header h2 { margin:0 auto 0 0; font-size:18px; }
.photo-editor-layout { display:grid; grid-template-columns:300px minmax(0,1fr); min-height:60vh; }
#photo-editor-tools { background:white; padding:12px; overflow:auto; max-height:72dvh; }
#photo-editor-tools fieldset { min-width:0; }
.photo-editor-preview { padding:24px; background:#626262; display:flex; align-items:center; justify-content:center; }
#photo-editor-preview { max-width:100%; max-height:68dvh; object-fit:contain; }
#photo-editor-status, #photo-editor-save-options { padding:8px 18px; margin:0; }
@media(max-width:700px) { .photo-editor-layout { display:flex; flex-direction:column-reverse; } #photo-editor-tools { max-height:none; } .photo-editor-preview { padding:12px; } #photo-editor-preview { max-height:38dvh; } }

#photo-editor-tools label { display:grid; gap:6px; margin:10px 0; font-size:13px; }
#photo-editor-tools label:has(> input[type="checkbox"]) { display:flex; align-items:center; }
#photo-editor-tools button, #photo-editor-dialog select, #photo-editor-dialog input { min-height:44px; }
#photo-editor-tools input:not([type="checkbox"]), #photo-editor-tools select { width:100%; box-sizing:border-box; }

#photo-editor-preview { touch-action:none; }
#photo-editor-crop p { font-size:12px; line-height:1.5; }
/* Keep the selected area's settings beside the preview. Effects remain stored
   when switching tools; only their controls leave the current view. */
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-clone,
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-selection,
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-brush,
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-blur,
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-mosaic,
#photo-editor-tools:has(#photo-editor-area-tool option:checked) #photo-editor-crop { display:none; }
#photo-editor-tools:has(#photo-editor-area-tool option[value="clone"]:checked) #photo-editor-clone,
#photo-editor-tools:has(#photo-editor-area-tool option[value="clone-region"]:checked) #photo-editor-clone,
#photo-editor-tools:has(#photo-editor-area-tool option[value="erase-region"]:checked) #photo-editor-selection,
#photo-editor-tools:has(#photo-editor-area-tool option[value="wand"]:checked) #photo-editor-selection,
#photo-editor-tools:has(#photo-editor-area-tool option[value="erase"]:checked) #photo-editor-brush,
#photo-editor-tools:has(#photo-editor-area-tool option[value="restore"]:checked) #photo-editor-brush,
#photo-editor-tools:has(#photo-editor-area-tool option[value="blur"]:checked) #photo-editor-blur,
#photo-editor-tools:has(#photo-editor-area-tool option[value="mosaic"]:checked) #photo-editor-mosaic,
#photo-editor-tools:has(#photo-editor-area-tool option[value="crop"]:checked) #photo-editor-crop { display:block; }

#tool-draw label { display:grid; gap:6px; margin:12px 0; }
#tool-draw [role="group"] { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
#tool-draw button,#tool-draw input { min-height:44px; }
canvas.is-drawing { cursor:crosshair; touch-action:none; }

#tool-favorites label { display:grid; gap:6px; margin:10px 0; }
.element-favorite-row { border-bottom:1px solid #e5e5e5; padding:10px 0; }
.element-favorite-insert { width:100%; display:grid; gap:6px; text-align:left; }
.element-favorite-insert canvas { width:100%; height:100px; object-fit:contain; }
.element-favorite-row button,#tool-favorites input,#tool-favorites select { min-height:44px; }

.favorite-template-card { display:flex; flex-direction:column; gap:4px; min-width:0; }
.favorite-template-card > .template-tile,.favorite-template-card > .sidebar-template { width:100%; flex:1; }
.template-favorite-toggle { min-height:44px; display:flex; align-items:center; gap:6px; justify-content:flex-start; }

.favorite-server-actions { display:flex; flex-wrap:wrap; gap:6px; }
#favorite-server-review { width:min(540px,94vw); max-height:85dvh; }
#favorite-server-review-list { max-height:40dvh; overflow:auto; }
#favorite-server-review button { min-height:44px; }

/* The scene strip is docked beneath the canvas only while the user opens it. */
#editor-timeline { width:100%; min-width: 0; min-height: 0; padding: 8px 12px; background: var(--studio-panel, #fff); color: var(--studio-text); border-top: 1px solid var(--studio-divider); }
.editor-timeline-controls { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.editor-timeline-controls h2 { font-size: 14px; margin: 0; }
.scene-navigation { display:inline-flex; align-items:center; flex-wrap:wrap; gap:4px; }
#editor-scene-position { font-size:12px; font-variant-numeric:tabular-nums; min-width:4em; text-align:center; }
.editor-timeline-controls button { min-height: 36px; margin: 0; }
#editor-timeline-time { margin-left: auto; font-variant-numeric: tabular-nums; }
#editor-timeline-seek { display:block; width:100%; margin:4px 0; accent-color:var(--studio-focus); }
#editor-timeline-scenes { display:flex; gap:4px; margin:0; padding:4px; overflow-x:auto; list-style:none; }
#editor-timeline-scenes li { flex:0 0 calc(56px + var(--scene-length) * var(--scene-unit, 14px)); min-width:0; }
#editor-timeline-scenes button { display:grid; text-align:left; width:100%; min-height:44px; padding:4px 8px; margin:0; }
#editor-timeline-scenes button span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#editor-timeline-scenes .editor-scene-compact-number { display:none; }
#editor-timeline-scenes[data-fit=true] li { flex:var(--scene-length) 1 16px; }
#editor-timeline-scenes[data-fit=true] button { display:grid; place-items:center; padding:4px 0; min-width:0; font-size:11px; }
#editor-timeline-scenes[data-fit=true] :is(.editor-scene-name,small) { display:none; }
#editor-timeline-scenes[data-fit=true] .editor-scene-compact-number { display:block; }
#editor-timeline-scenes button[aria-pressed=true] { background:#fff4b3; border-color:var(--studio-focus); }
.editor-timeline-duration { display:inline-flex; gap:8px; align-items:center; margin-top:4px; font-size:12px; }
#editor-timeline-duration { width:72px; min-height:36px; }
#editor-timeline-status { display:inline; margin-left:8px; font-size:12px; }
@media (min-width:861px) { main .workspace.has-scene-timeline { grid-template-rows:auto minmax(0,1fr) auto; } }
@media (max-width:860px) { .editor-timeline-controls button, #editor-timeline-duration { min-height:44px; } }
#gif-editor { width:min(720px, calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; }
#gif-preview { display:block; max-width:100%; max-height:32dvh; width:auto; height:auto; object-fit:contain; margin:8px auto; background:repeating-conic-gradient(#fff 0% 25%,#e8e8e8 0% 50%) 0 0/16px 16px; }
#gif-preview[hidden] { display:none; }
#gif-controls { min-width:0; margin-top:8px; }
.gif-scrub { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
#gif-frame { flex:1 1 120px; width:auto; min-width:0; accent-color:var(--studio-focus); }
.gif-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(105px,1fr)); gap:8px; margin:8px 0; }
.gif-fields label { display:grid; gap:4px; font-size:12px; }
.gif-fields :is(input,select) { width:100%; min-height:36px; }
@media(max-width:600px) { #gif-editor button,.gif-fields :is(input,select) { min-height:44px; } }
#scene-motion-set { width:100%; min-width:0; margin-top:4px; }
#scene-motion-set summary { cursor:pointer; font-size:12px; padding:4px; }
#scene-motion-set-form { padding:4px; align-items:end; margin-block:0; }
#scene-motion-set-form label { display:grid; gap:4px; margin:0; font-size:12px; }
#scene-motion-set-form :is(button,select),#layer-motion-set-actions button { min-height:36px; margin:0; }
@media(max-width:860px) { #scene-motion-set-form :is(button,select),#layer-motion-set-actions button { min-height:44px; } }
#scene-motion-set-status { margin:4px; font-size:12px; }
#layer-motion-set-actions { flex-basis:100%; }
#layer-motion { width:100%; min-width:0; margin-top:4px; max-height:160px; overflow:auto; }
#layer-motion summary { cursor:pointer; font-size:12px; padding:4px; }
#layer-motion-form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; padding:4px; }
#layer-motion-form label { margin:0; font-size:12px; }
#layer-motion-form label :is(input,select) { min-height:36px; max-width:160px; display:block; }
#layer-motion-form input { width:72px; }
#layer-motion-form button { margin:0; }
.layer-motion-track { display:grid; grid-template-columns:minmax(64px,125px) minmax(0,1fr); gap:8px; align-items:center; padding:2px 4px; }
.layer-motion-track button { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin:0; }
.layer-motion-rail { position:relative; height:22px; background:#f1f1f1; border:1px solid var(--studio-divider); border-radius:4px; }
.layer-motion-block { position:absolute; inset-block:0; overflow:hidden; white-space:nowrap; font-size:11px; background:var(--studio-highlight); color:var(--studio-text); border-radius:3px; }
#layer-motion-status { margin:4px; font-size:12px; }
.layer-motion-block.is-draggable { cursor:ew-resize; touch-action:none; }
.layer-motion-rail .layer-motion-marker { position:absolute; z-index:1; inset-block-start:0; width:22px; min-width:0; height:20px; min-height:0; padding:0; border:0; background:transparent; margin:0; transform:translateX(-50%); }
.layer-motion-marker::before { content:''; position:absolute; top:6px; left:7px; width:8px; height:8px; background:var(--studio-text); border:1px solid white; transform:rotate(45deg); }
.layer-motion-rail span.layer-motion-marker { pointer-events:none; }
.layer-motion-repeat-boundary { z-index:0; }
.layer-motion-repeat-boundary::before { border-radius:50%; transform:none; }
.layer-motion-rail button.layer-motion-marker { cursor:ew-resize; touch-action:none; }
.layer-motion-rail button.layer-motion-marker:focus-visible { outline-offset:-2px; }
.timeline-zoom-field { font-size:12px; }
.timeline-zoom-field select { min-height:36px; }
#gif-frame-settings { margin-bottom:8px; }
#gif-frame-settings label { display:block; font-size:12px; }
#gif-frame-delay { max-width:160px; min-height:36px; }
#editor-scene-transition { margin-top: 4px; }
:is(#editor-transition-form,#video-layer-form) { display:flex; flex-wrap:wrap; gap:8px; align-items:end; padding:4px 0; }
:is(#editor-transition-form,#video-layer-form) label { display:grid; gap:4px; font-size:12px; }
:is(#editor-transition-form,#video-layer-form) input { width:78px; }
:is(#editor-transition-form,#video-layer-form) :is(input,select,button) { min-height:36px; margin:0; }
#editor-transition-status { margin:0; font-size:12px; }
@media (max-width:860px) { :is(#editor-transition-form,#video-layer-form) :is(input,select,button) { min-height:44px; } }

#video-trim-preview:not([hidden]) { display:block; margin:8px auto; max-width:100%; max-height:36vh; background:#222; }
#video-trim-file { max-width:100%; }

#video-layer-status { margin:0; font-size:12px; }

.timeline-audio-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,105px),1fr)); gap:8px; }
.timeline-audio-fields label { display:grid; gap:4px; font-size:12px; min-width:0; }
.timeline-audio-fields input { min-width:0; width:100%; min-height:36px; }
.timeline-audio-position { display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:8px; margin:4px 0; font-size:12px; }
.timeline-audio-position-time { text-align:end; font-variant-numeric:tabular-nums; }
.timeline-audio-position-slider { grid-column:1/-1; accent-color:var(--studio-selection,#087f8c); box-sizing:border-box; width:100%; margin:0; min-height:36px; cursor:ew-resize; }
.timeline-audio-position-slider:disabled { cursor:default; }
.timeline-audio-position-slider:focus-visible { outline:2px solid var(--studio-focus,#725b00); outline-offset:1px; }
@media (max-width:860px) { .timeline-audio-position-slider { min-height:44px; } }
#timeline-audio fieldset { margin:6px 0; min-width:0; overflow-wrap:anywhere; }
#timeline-audio-upload,#video-audio { max-width:100%; }
@media (max-width:860px) { .timeline-audio-fields input, #timeline-audio button { min-height:44px; } }

#speaker-notes:not([hidden]) { min-width:0; max-height:40vh; overflow:auto; padding:8px 12px; background:var(--studio-panel,#fff); color:var(--studio-text); border-top:1px solid var(--studio-divider); }
.speaker-notes-heading { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.speaker-notes-heading h2 { font-size:14px; margin:0; }
#speaker-notes-input { display:block; width:100%; min-width:0; resize:vertical; max-height:25vh; }
#speaker-notes :is(p,.surface-actions) { margin:4px 0 0; }
#speaker-notes button { min-height:36px; }
@media(max-width:860px){#speaker-notes button{min-height:44px;}}

#replace-color-form { display:grid; gap:8px; }
#replace-color-form label { display:grid; gap:4px; }
#replace-color-form :is(input,select) { min-height:36px; max-width:100%; }
.replace-color-pick { display:flex; gap:8px; }
.replace-color-pick input[type=text], #replace-color-hex { flex:1; min-width:0; }
#typeface-replace-form { display:grid; gap:8px; }
#typeface-replace-form label { display:grid; gap:4px; }
#typeface-replace-form select { min-height:36px; max-width:100%; }
#typeface-replace-result { margin:0; }
@media(max-width:860px){#typeface-replace-form :is(select,button){min-height:44px;}}
#palette-form { display:grid; gap:8px; }
#palette-form label { display:grid; gap:4px; }
#palette-form :is(input,select) { min-height:36px; max-width:100%; }
#palette-target { flex:1; min-width:0; }
.palette-comparison:not([hidden]) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.palette-comparison figure { margin:0; min-width:0; text-align:center; }
.palette-comparison figcaption { font-size:.78rem; margin-bottom:4px; }
.palette-comparison canvas { display:block; max-width:100%; height:auto; max-height:145px; margin:0 auto; outline:1px solid #626262; }
#palette-result,#palette-preview-status { margin:0; }
#palette-preview-status:empty { display:none; }
@media(max-width:860px){#palette-form :is(input,select,button){min-height:44px;}}
#color-sampler { min-width:0; }
#color-sampler summary { cursor:pointer; min-height:36px; }
.color-sampler-preview { position:relative; max-width:100%; outline:1px solid #626262; overflow:clip; }
#color-sampler-canvas { display:block; width:100%; height:auto; cursor:crosshair; }
#color-sampler-canvas:focus-visible { outline:2px solid #725b00; outline-offset:-2px; }
.color-sampler-preview i { position:absolute; pointer-events:none; width:12px; height:12px; transform:translate(-50%,-50%); border:2px solid white; border-radius:50%; box-shadow:0 0 0 1px #222; }
#replace-color-result { margin:0; }
@media(max-width:860px){#replace-color-form :is(input,select,button,summary){min-height:44px;}}

#background-paste-dialog { width:min(480px,calc(100vw - 32px)); box-sizing:border-box; max-height:90dvh; }
#background-paste-pages { display:grid; gap:8px; max-height:45dvh; overflow:auto; margin:16px 0; }
#background-paste-pages label { display:flex; align-items:center; gap:8px; min-height:44px; overflow-wrap:anywhere; }
#typeface-comparison canvas { width:100%; height:auto; max-height:none; aspect-ratio:auto; }

#canvas-background-actions[data-floating="true"] .action-menu-items,
#canvas-layer-actions[data-floating="true"] .action-menu-items {
  position:fixed; z-index:100; width:min(240px,calc(100vw - 16px));
  max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px);
  overflow:auto; overscroll-behavior:contain; box-sizing:border-box; margin:0;
}

.catalog-favorite-card { min-width:0; display:flex; flex-direction:column; gap:4px; }
.catalog-favorite-card[hidden] { display:none; }
.catalog-favorite-card > [data-kind] { width:100%; flex:1; }
.catalog-favorite-card > .template-favorite-toggle { width:100%; font-size:12px; }

#shape-replace-options button { display:flex; flex-direction:column; align-items:center; gap:6px; min-width:0; }
#shape-replace-options .element-thumbnail { width:112px; max-width:100%; height:auto; background:transparent; box-shadow:none; }

.image-category-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:12px 0; }
.image-category-grid button { min-height:44px; margin:0; text-align:left; font-size:12px; }
.image-category-grid button[aria-pressed="true"] { background:var(--studio-highlight); color:var(--studio-text); border-color:var(--studio-focus); }
#image-model-connection, #image-category-description { font-size:12px; line-height:1.6; }
@media(max-width:600px){.image-category-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

.image-separate-layout{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(240px,1fr);gap:20px}.image-separate-layout>*{min-width:0}
#image-separate-canvas{display:block;width:100%;height:auto;max-height:none;touch-action:none;cursor:crosshair;background:#eee}
.separate-region-coordinates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.separate-region-coordinates input{width:100%;min-width:0}
#image-separate-region-list{max-height:220px;overflow:auto;padding-left:24px}#image-separate-region-list li{margin-bottom:8px}#image-separate-region-list button{margin-left:8px;min-height:40px}
@media(max-width:700px){.image-separate-layout{grid-template-columns:minmax(0,1fr)}}

.watermark-preview { display:block; width:100%; height:auto; max-height:260px; object-fit:contain; }
.watermark-preview[hidden] { display:none; }

.table-editor-actions { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.table-grid-region { max-width:100%; overflow:auto; border:1px solid #767676; }
.table-grid-region:focus-visible { outline:2px solid #725b00; outline-offset:2px; }
#table-cell-grid { border-collapse:collapse; width:100%; table-layout:fixed; }
#table-cell-grid th, #table-cell-grid td { border:1px solid #767676; padding:4px; color:#292929; background:#fff; }
#table-cell-grid th { font-size:12px; position:relative; }
#table-cell-grid .table-axis-label { display:block; padding:4px 16px 4px 4px; }
#table-cell-grid .table-axis-size { display:block; }
#table-cell-grid .table-resize-handle { display:block; position:absolute; touch-action:none; user-select:none; }
#table-cell-grid .table-resize-handle[data-axis="column"] { right:0; top:0; bottom:0; width:24px; cursor:col-resize; }
#table-cell-grid .table-resize-handle[data-axis="row"] { left:0; right:0; bottom:0; height:24px; cursor:row-resize; }
#table-cell-grid .table-resize-handle::after { content:""; position:absolute; background:#292929; }
#table-cell-grid .table-resize-handle[data-axis="column"]::after { width:2px; height:16px; top:calc(50% - 8px); right:4px; }
#table-cell-grid .table-resize-handle[data-axis="row"]::after { height:2px; width:16px; left:calc(50% - 8px); bottom:4px; }
#table-cell-grid .table-resize-handle:hover { background:#ffdf40; }
#table-cell-grid .table-resize-handle:focus-visible { outline:2px solid #725b00; outline-offset:-2px; background:#ffdf40; }
#table-cell-grid td[data-selected="true"] { box-shadow:inset 0 0 0 2px #087f8c; }
#table-cell-grid textarea { box-sizing:border-box; width:100%; min-width:0; min-height:48px; resize:none; }
#design-table-dialog form { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; }
#design-table-dialog textarea { display:block; width:100%; }
.design-table-scroll { max-width:100%; overflow:auto; }
#design-table-preview { width:100%; border-collapse:collapse; font-size:.85rem; }
#design-table-preview :is(td,th) { border:var(--table-line-width,1px) solid var(--table-line,var(--studio-divider)); padding:4px; }
#design-table-preview:is([data-border-scope="inside"],[data-border-scope="outside"]) :is(th,td) { border-width:0; }
#design-table-preview[data-border-scope="outside"] { border:var(--table-line-width,1px) solid var(--table-line,var(--studio-divider)); }
#design-table-preview[data-border-scope="inside"] [data-table-border-right] { border-right-width:var(--table-line-width,1px); }
#design-table-preview[data-border-scope="inside"] [data-table-border-bottom] { border-bottom-width:var(--table-line-width,1px); }
#design-table-preview tr { background:var(--table-body,#fff); color:#292929; }
#design-table-preview tr:nth-child(even) { background:var(--table-stripe,#f2f3f3); }
#design-table-preview th { background:var(--table-heading,var(--studio-toolbar)); color:var(--table-ink,#fff); }
#design-table-preview[data-transparent] tr { background:transparent; }
#design-table-preview[data-transparent] td { background:var(--table-body,#fff); }
#design-table-preview[data-transparent] tr:nth-child(even) td { background:var(--table-stripe,#f2f3f3); }
#design-table-preview[data-transparent] :is(tr, tr:nth-child(even)) :is(th,td)[data-cell-transparent] {
  color:var(--table-transparent-ink,#292929);
  background:repeating-conic-gradient(var(--table-check-a,#fff) 0% 25%,var(--table-check-b,#ececec) 0% 50%) 0 0 / 16px 16px;
}
#design-table-preview textarea { min-width:88px; min-height:44px; margin:0; color:inherit; background:transparent; border-color:transparent; resize:vertical; }
#design-table-preview textarea:focus-visible,.design-table-scroll:focus-visible { outline:2px solid #725b00; outline-offset:-2px; }
#design-table-preview th textarea:focus-visible { outline-color:currentColor; }
:is(#design-table-structure,#design-table-merge,#design-table-sizing,#design-table-border,#design-table-transparency) { border:1px solid var(--studio-divider); padding:0 8px 8px; }
:is(#design-table-structure,#design-table-merge,#design-table-sizing,#design-table-border,#design-table-transparency) summary { min-height:44px; align-content:center; cursor:pointer; }
:is(#design-table-structure,#design-table-merge,#design-table-sizing,#design-table-border,#design-table-transparency) p { margin:0 0 8px; }
:is(#design-table-structure,#design-table-merge,#design-table-sizing,#design-table-border,#design-table-transparency) :is(button,select,input) { min-height:44px; }
#design-table-border input[type="number"] { width:100%; max-width:9rem; }
#design-table-border input[type="color"] { min-width:44px; }
#design-table-sizing input { width:100%; max-width:12rem; }
#design-table-preview[data-custom-sizing] { table-layout:fixed; min-width:264px; }
#design-table-preview[data-custom-sizing] textarea { min-width:0; }
#design-table-sizing .table-size-scroll { max-height:300px; overflow:auto; padding:16px; }
#design-table-size-frame { position:relative; width:100%; margin:auto; outline:1px solid var(--studio-divider); }
#design-table-size-preview { display:block; width:100%; height:100%; }
#design-table-sizing .table-size-handle { position:absolute; z-index:1; width:32px; height:32px; min-height:32px; padding:0; margin:0;
  transform:translate(-50%,-50%); touch-action:none; user-select:none; border:1px solid #626262; background:#fff; color:#292929; }
#design-table-sizing .table-size-handle:focus-visible { outline:2px solid #725b00; outline-offset:2px; }
.table-size-handle[data-table-boundary="column"] { top:0; cursor:ew-resize; }
.table-size-handle[data-table-boundary="row"] { left:100%; cursor:ns-resize; }
#design-table-boundary-guide { position:absolute; z-index:2; pointer-events:none; }
#design-table-boundary-guide[data-axis="column"] { inset-block:0; border-left:2px dashed #087f8c; }
#design-table-boundary-guide[data-axis="row"] { inset-inline:0; border-top:2px dashed #087f8c; }
#design-table-confirm { margin-top:8px; }
#design-table-confirm p { flex-basis:100%; }
#design-table-preview textarea[data-table-current] { box-shadow:inset 0 0 0 2px currentColor; }
#design-table-status { margin:0; }

:is(#design-chart-dialog,#design-series-dialog) form { display:grid; gap:8px; }
:is(#design-chart-dialog,#design-series-dialog) textarea { display:block; width:100%; }
:is(#design-chart-status,#design-series-status) { margin:0; }
:is(#design-chart-preview canvas,#design-series-preview) { display:block; width:100%; height:auto; margin-bottom:8px; outline:1px solid var(--studio-divider); box-shadow:none; }
#design-series-breakdown { min-width:0; border:1px solid var(--studio-divider); padding:0 8px 8px; }
#design-series-breakdown summary { cursor:pointer; min-height:44px; align-content:center; }
#design-series-breakdown summary:focus-visible { outline:2px solid #725b00; }
#design-series-breakdown p { margin:0 0 8px; }
#design-series-breakdown-table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:.85rem; }
#design-series-breakdown-table :is(th,td) { border:1px solid var(--studio-divider); padding:4px; text-align:start; overflow-wrap:anywhere; }
#design-series-breakdown-table td { font-variant-numeric:tabular-nums; }
#design-series-breakdown-table td > * { display:block; }
#design-chart-grid { width:100%; table-layout:fixed; border-collapse:collapse; }
#design-chart-grid :is(th,td) { padding:4px; text-align:left; overflow-wrap:anywhere; }
#design-chart-grid th:last-child { width:52px; }
#design-chart-grid :is(input,button) { width:100%; min-width:0; min-height:40px; margin:0; padding-inline:4px; }
#design-chart-grid input[aria-invalid=true] { border-color:var(--studio-muted); border-style:dashed; }
#design-chart-import-status { margin:4px 0 0; }

.video-layer-track { display:grid; grid-template-columns:minmax(0,120px) minmax(44px,1fr) auto; align-items:center; gap:8px; margin-block:4px; }
.video-track-name { min-width:0; min-height:44px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.video-track-time { font-size:12px; }
.video-track-rail { position:relative; min-width:44px; height:90px; background:var(--studio-panel); border-block:1px solid var(--studio-divider); }
.video-track-fill { position:absolute; left:var(--clip-start); top:8px; height:28px; background:var(--studio-highlight); border-radius:3px; pointer-events:none; }
.video-track-slider { position:absolute; margin:0; width:44px; height:44px; padding:0; touch-action:none; cursor:grab; border:1px solid var(--studio-selection); background:transparent; }
.video-track-start { top:0; left:min(var(--clip-start), calc(100% - 44px)); }
.video-track-end:not([hidden]) { bottom:0; left:clamp(0px, calc(var(--clip-end) - 22px), calc(100% - 44px)); border-style:dashed; cursor:ew-resize; }
.video-track-end::before { content:""; display:block; width:12px; height:10px; margin:auto; border-inline:2px solid currentColor; }
.video-track-hold:not([hidden]) { position:absolute; right:0; top:8px; height:28px; border:1px dashed var(--studio-selection); border-radius:3px; pointer-events:none; }
#video-mosaic { min-width:0; margin-top:8px; }
#video-mosaic summary { cursor:pointer; padding:4px; }
#video-mosaic-source { min-width:0; padding:4px 0; }
#video-mosaic-stage { position:relative; width:min(100%,var(--mosaic-preview-width,320px)); aspect-ratio:var(--mosaic-aspect,16/9); background:var(--studio-workspace,#626262); cursor:crosshair; touch-action:none; overflow:hidden; }
#video-mosaic-stage video { display:block; width:100%; height:100%; }
#video-mosaic-outline { position:absolute; box-sizing:border-box; pointer-events:none; border:2px solid var(--studio-highlight,#ffdf40); box-shadow:inset 0 0 0 1px #292929; }
#video-mosaic-source label { display:flex; gap:8px; align-items:center; font-size:12px; }
#video-mosaic-scrub { flex:1; min-width:0; max-width:260px; }
#video-mosaic-position { font-size:12px; }
#video-mosaic-form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; padding:4px 0; }
#video-mosaic-form label { display:grid; gap:4px; margin:0; font-size:12px; }
#video-mosaic-form input { width:82px; }
#video-mosaic-form :is(select,input,button) { min-height:36px; margin:0; }
#video-mosaic-status { margin:4px 0; font-size:12px; }
@media(max-width:860px) { #video-mosaic-form :is(select,input,button) { min-height:44px; } }
#video-layer-form .video-layer-hold input { width:auto; min-height:0; }
#video-layer-form .video-layer-hold span { display:flex; align-items:center; min-height:44px; gap:6px; }
.video-track-slider:active { cursor:grabbing; }
.video-track-slider:disabled { cursor:default; opacity:.55; }
.video-track-slider:focus-visible { outline:2px solid var(--studio-focus); outline-offset:1px; }

#scene-layer-window-form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; padding:4px 0; }
#scene-layer-window-form label { min-width:0; display:grid; gap:4px; font-size:12px; }
#scene-layer-window-form select { max-width:min(220px,100%); }
#scene-layer-window-form input { width:82px; }
#scene-layer-window-form :is(select,input,button),.scene-window-track button { min-height:36px; margin:0; }
#scene-layer-window-status,.scene-window-track { margin:4px 0; font-size:12px; }
.scene-window-track { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; }
.scene-window-track button { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.scene-window-track button[aria-pressed="true"] { border-color:var(--studio-selection); }
@media (max-width:860px) { #scene-layer-window-form :is(select,input,button),.scene-window-track button { min-height:44px; } }

#video-continuation { margin-top:8px; }
#video-continuation-form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; }
#video-continuation-form label { display:grid; gap:4px; font-size:12px; }
#video-continuation-form :is(input,button) { min-height:36px; margin:0; }
#video-continuation-form input { width:80px; }
#video-continuation-status,#video-continuation-preview { margin:4px 0; font-size:12px; overflow-wrap:anywhere; }
#video-continuation-preview { padding-inline-start:24px; }
@media(max-width:860px) { #video-continuation-form :is(input,button) { min-height:44px; } }

#slide-focus-dialog { width:min(96vw,1360px); height:94dvh; max-width:96vw; max-height:94dvh; padding:0; border:1px solid #686868; background:#292929; color:#fff; }
#slide-focus-dialog::backdrop { background:#141414d9; }
.slide-focus-surface { box-sizing:border-box; width:100%; height:100%; padding:8px; display:grid; grid-template-rows:auto minmax(0,1fr) auto; gap:8px; }
.slide-focus-surface :is(header,nav) { min-width:0; margin:0; }
.slide-focus-surface header h2 { margin-inline-end:auto; }
#slide-focus-display-status { flex:1 0 100%; margin:0; font-size:12px; }
#slide-focus-display-status:empty { display:none; }
.slide-focus-surface:fullscreen { background:#292929; color:#fff; }
.slide-focus-surface nav { justify-content:center; }
.slide-focus-surface h2 { font-size:14px; margin:0; }
.slide-focus-surface button { margin:0; min-height:44px; }
.slide-focus-stage { position:relative; display:grid; min-width:0; min-height:0; place-items:center; overflow:hidden; background:#1b1b1b; }
#graphic-replace-dialog { width:min(420px,calc(100vw - 24px)); }
#graphic-replace-form { min-width:0; display:grid; gap:8px; }
#graphic-replace-form select { min-height:44px; max-width:100%; }
#graphic-replace-preview { max-width:100%; height:auto; margin:auto; border:1px solid #bbb; background:#f4f4f4; }
#graphic-replace-status:empty { display:none; }
#photo-warp-dialog { width:min(680px,calc(100vw - 16px)); }
#photo-warp-stage { position:relative; margin:24px auto; max-width:calc(100% - 48px); }
#photo-warp-canvas { display:block; width:100%; height:auto; background-color:#f4f4f4; background-image:repeating-conic-gradient(#d1d1d1 0% 25%,transparent 0% 50%); background-size:16px 16px; }
#photo-warp-handles { position:absolute; inset:0; pointer-events:none; }
#photo-warp-handles button { position:absolute; width:44px; height:44px; transform:translate(-50%,-50%); margin:0; padding:0; touch-action:none; pointer-events:auto; background:none; border:0; cursor:move; }
#photo-warp-handles button::after { content:""; display:block; box-sizing:border-box; margin:auto; width:14px; height:14px; border-radius:50%; background:#ffdf40; border:2px solid #292929; }
#photo-warp-handles button:focus-visible { outline:3px solid #725b00; outline-offset:0; }
#photo-warp-status:empty { display:none; }
#retail-barcode-dialog, #qr-code-dialog { width:min(440px,calc(100vw - 24px)); }
#retail-barcode-form, #qr-code-form { min-width:0; display:grid; gap:8px; }
:is(#retail-barcode-form,#qr-code-form) :is(input,select,textarea) { box-sizing:border-box; max-width:100%; min-height:44px; }
#retail-barcode-preview { width:min(260px,100%); height:auto; margin:auto; border:1px solid #686868; image-rendering:pixelated; }
#retail-barcode-status:empty { display:none; }
#qr-code-preview { width:min(200px,100%); height:auto; margin:auto; border:1px solid #686868; image-rendering:pixelated; }
#qr-code-status:empty { display:none; }
#page-watermark-dialog, #page-stamp-dialog { width:min(480px,calc(100vw - 24px)); }
#page-watermark-form, #page-stamp-form { min-width:0; display:grid; gap:8px; }
:is(#page-watermark-form,#page-stamp-form) :is(input:not([type=checkbox]),select) { box-sizing:border-box; max-width:100%; min-height:44px; }
#page-stamp-form fieldset { min-width:0; }
#page-watermark-sources { overflow-wrap:anywhere; }
#page-watermark-status:empty, #page-stamp-status:empty { display:none; }
#layer-link-dialog { width:min(420px,calc(100vw - 24px)); }
#layer-link-form { min-width:0; display:grid; gap:8px; }
#layer-link-form :is(input,select) { box-sizing:border-box; max-width:100%; min-height:44px; }
#layer-link-status:empty { display:none; }
#slide-focus-artwork { position:relative; overflow:hidden; }
#slide-focus-canvas { display:block; width:100%; height:100%; border:0; }
#slide-focus-links { position:absolute; inset:0; pointer-events:none; }
#slide-focus-links > :is(a,button) { position:absolute; transform-origin:top left; box-sizing:border-box; display:block; pointer-events:auto; padding:0; margin:0; min-height:0; background:transparent; border:0; border-radius:0; cursor:pointer; }
#slide-focus-links > :is(a,button):is(:hover,:focus-visible) { outline:2px solid #ffdf40; outline-offset:-2px; box-shadow:inset 0 0 0 4px #292929; }
#slide-focus-status { position:absolute; margin:0; color:#fff; }
#slide-focus-position { text-align:center; font-size:13px; overflow-wrap:anywhere; min-width:0; max-width:min(52ch,100%); }

.export-group > summary { min-height: 44px; align-content: center; cursor: pointer; font-weight: 600; }
.export-group + .export-group { border-top: 1px solid var(--studio-divider); }

.canvas-toolbar:has(#canvas-layer-actions[open]) { position: relative; z-index: 8; }

#file-menu > .action-menu-items {
  inset-inline: 0 auto;
  max-height: 72dvh;
  overflow: auto;
  color: var(--studio-text);
}
.file-menu-group > summary { padding: 8px; cursor: pointer; }
.file-menu-group > button { display: block; width: 100%; }
@media (max-width: 600px) {
  #file-menu > .action-menu-items { inset-inline: auto 0; }
}

#project-results details { max-width: 100%; }
#library-folder-tools > summary, #project-results summary {
  cursor: pointer; padding: 8px; min-height: 44px; align-content: center;
}
#project-results .record-actions select { max-width: 100%; }
