/* Image Studio · Apple-inspired workspace system.
   Layout stays with its owning stylesheet; this final layer owns color, surface,
   type, state and motion across the application. */
html[data-theme] {
  --bg: #f5f5f7;
  --paper: #fff;
  --paper-soft: #f5f5f7;
  --panel: #fff;
  --ink: #1d1d1f;
  --muted: #515154;
  --subtle: #6e6e73;
  --line: #e5e5e7;
  --line-strong: #d2d2d7;
  --blue: #0071e3;
  --blue-dark: #0077ed;
  --blue-soft: #eaf4ff;
  --green: #248a3d;
  --rose: #d92d20;
  --shadow: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, .04);
  --theme-canvas: #f5f5f7;
  --theme-panel: #fff;
  --theme-panel-soft: #f5f5f7;
  --theme-panel-raised: #f5f5f7;
  --theme-text: #1d1d1f;
  --theme-text-muted: #515154;
  --theme-text-subtle: #6e6e73;
  --theme-border: #e5e5e7;
  --theme-border-strong: #d2d2d7;
  --theme-accent: #0071e3;
  --theme-accent-hover: #0077ed;
  --theme-accent-soft: #eaf4ff;
  --theme-accent-contrast: #fff;
  --theme-secondary: #6e6e73;
  --theme-secondary-soft: #f5f5f7;
  --theme-success: #248a3d;
  --theme-danger: #d92d20;
  --theme-scrim: rgba(29, 29, 31, .38);
  --theme-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  --theme-shadow-lg: 0 8px 24px rgba(0, 0, 0, .12);
  --theme-hero: #f5f5f7;
  --theme-hero-text: #1d1d1f;
  --theme-hero-muted: #515154;
  --theme-muted: #515154;
  --theme-panel-muted: #f5f5f7;
  --studio-radius-control: 12px;
  --studio-radius-card: 20px;
  --studio-shadow-popover: 0 8px 24px rgba(0, 0, 0, .12);
  color-scheme: light;
}

html[data-theme] body {
  background: #f5f5f7;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

html[data-theme] :is(h1, h2, h3, .mode-screen-intro h1) {
  color: #1d1d1f;
  font-weight: 650;
  letter-spacing: -.025em;
}

html[data-theme] :is(.app-shell, .control-panel, .control-mode-stage, .main-stage,
  .storyboard-mode-panel, .conversation-main) { background: #f5f5f7; }

html[data-theme] :is(.rail, .task-shell-header, .workspace-topbar,
  .creation-settings-header, .creation-settings-footer, .batch-drawer-header,
  .batch-drawer-pagination, .conversation-studio-header,
  .storyboard-workspace-header, .storyboard-workspace-footer) {
  background: #fff;
  border-color: #e5e5e7;
  box-shadow: none;
}

html[data-theme] :is(.rail, .workspace-topbar) {
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}

html[data-theme] :is(.rail-brand-icon, .rail-logo, .auth-brand-mark,
  .smart-project-dialog-mark, .conversation-studio-mark,
  .storyboard-workspace-mark, .developer-api-mark, .workspace-project-mark,
  .project-overview-mark, .creation-task-card-icon,
  .conversation-studio-trigger-icon, .disclosure-icon,
  .help-assistant-launcher-icon) {
  border-radius: 14px;
  background: #eaf4ff;
  color: #0071e3;
  box-shadow: none;
}

/* One visual language is active throughout the workspace. */
html[data-theme] :is(.theme-control, .auth-theme-chooser) { display: none; }

html[data-theme] :is(.control-mode-switcher, .workspace-tabs, .auth-tabs) {
  border: 0;
  border-radius: 16px;
  background: #ededf0;
  box-shadow: none;
}

.saved-filter-actions { display: none; }
.main-stage.workspace-view-saved .saved-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.main-stage.workspace-view-saved .saved-filter-actions .star-filter-button {
  min-height: 40px;
  white-space: nowrap;
}

html[data-theme] :is(.control-mode-button, .workspace-tab, .auth-tab) {
  border-radius: 12px;
  color: #515154;
}

html[data-theme] :is(.control-mode-button.active, .workspace-tab.active, .auth-tab.active) {
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

html[data-theme] :is(.context-policy-button, .toolbar-button, .rail-avatar,
  .prompt-editor-open, .model-info-button, .creation-settings-close,
  .batch-drawer-close, .prompt-editor-close, .smart-project-dialog-close,
  .model-info-dialog header button) {
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  background: #fff;
  color: #1d1d1f;
  box-shadow: none;
}

html[data-theme] .plan-mode-panel .mode-screen-intro h1 { font-weight: 650; }
html[data-theme] .mode-screen-intro p { color: #515154; }

html[data-theme] :is(.plan-mode-panel .creation-task-card,
  .plan-mode-panel .conversation-studio-trigger, .creation-tool-button,
  .workspace-project-button, .batch-collection-box, .project-overview-card,
  .generation-path-card, .iteration-primary-card, .developer-api-doc-card,
  .saved-tile, .image-tile, .usage-card, .loading-card, .empty-state) {
  border: 1px solid #e5e5e7;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  transition: background-color 240ms cubic-bezier(.25,.1,.25,1),
    border-color 240ms cubic-bezier(.25,.1,.25,1),
    box-shadow 240ms cubic-bezier(.25,.1,.25,1),
    transform 240ms cubic-bezier(.25,.1,.25,1);
}

html[data-theme] .plan-mode-panel .creation-task-card.is-primary {
  border-color: #b8d9fb;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, .08);
}

html[data-theme] .plan-mode-panel .creation-task-card.is-primary :is(strong, b) { color: #1d1d1f; }
html[data-theme] .plan-mode-panel .creation-task-card.is-primary small { color: #515154; opacity: 1; }
html[data-theme] .plan-mode-panel .creation-task-card.is-primary .creation-task-card-icon {
  background: #0071e3;
  color: #fff;
}

html[data-theme] :is(.plan-mode-panel .creation-task-card,
  .plan-mode-panel .conversation-studio-trigger, .creation-tool-button,
  .workspace-project-button, .batch-collection-box, .generation-path-card,
  .saved-tile, .image-tile):hover {
  border-color: #d2d2d7;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  transform: none;
}

html[data-theme] :is(.plan-mode-panel .creation-task-card,
  .plan-mode-panel .conversation-studio-trigger, .creation-tool-button,
  .workspace-project-button, .batch-collection-box,
  .saved-tile, .image-tile):active { transform: scale(.98); }

html[data-theme] :is(.creation-task-card, .conversation-studio-trigger,
  .batch-collection-box, .image-tile, .saved-tile):hover
  :is(.creation-task-card-icon, .conversation-studio-trigger-icon,
  .batch-cover-media img, .image-preview-button img, .saved-preview-button img) {
  transform: scale(1.04);
}

html[data-theme] :is(.primary-button, .secondary-button, .ghost-button,
  .creation-settings-footer button, .storyboard-workspace-footer button,
  .prompt-editor-footer button, .batch-drawer-pagination button,
  .auth-submit, .sso-recovery-actions button, .modal-original-button) {
  min-height: 40px;
  border-radius: 999px;
  font-weight: 600;
  transition: background-color 240ms cubic-bezier(.25,.1,.25,1),
    border-color 240ms cubic-bezier(.25,.1,.25,1),
    box-shadow 240ms cubic-bezier(.25,.1,.25,1),
    opacity 240ms cubic-bezier(.25,.1,.25,1),
    transform 240ms cubic-bezier(.25,.1,.25,1);
}

html[data-theme] :is(.primary-button, .generate-mode-panel > #generateButton,
  .creation-settings-footer .secondary-button, .empty-state .ghost-button,
  .prompt-assist-controls .secondary-button, .auth-submit) {
  border: 1px solid #0071e3;
  background: #0071e3;
  color: #fff;
  box-shadow: none;
}

html[data-theme] :is(.primary-button, .generate-mode-panel > #generateButton,
  .creation-settings-footer .secondary-button, .empty-state .ghost-button,
  .prompt-assist-controls .secondary-button, .auth-submit):hover:not(:disabled) {
  border-color: #0077ed;
  background: #0077ed;
  box-shadow: 0 4px 12px rgba(0, 113, 227, .16);
  transform: none;
}

html[data-theme] :is(.secondary-button, .ghost-button,
  .batch-drawer-pagination button, .prompt-assist-actions button,
  .model-info-dialog > .secondary-button, .sso-recovery-actions button) {
  border: 1px solid #e5e5e7;
  background: #fff;
  color: #1d1d1f;
  box-shadow: none;
}

html[data-theme] :is(.secondary-button, .ghost-button,
  .batch-drawer-pagination button, .prompt-assist-actions button,
  .sso-recovery-actions button):hover:not(:disabled) {
  border-color: #d2d2d7;
  background: #f5f5f7;
  box-shadow: none;
  transform: none;
}

html[data-theme] :is(.primary-button, .secondary-button, .ghost-button,
  .creation-settings-footer button, .prompt-editor-footer button,
  .batch-drawer-pagination button, .auth-submit):active:not(:disabled) {
  transform: scale(.98);
  box-shadow: none;
}

html[data-theme] :is(.primary-button, .secondary-button, .ghost-button):disabled {
  opacity: .48;
  box-shadow: none;
}

html[data-theme] :is(#appShell, #authScreen, #developerApiDialog,
  #creationSettingsDialog, #smartProjectForm, #iterationPromptReview,
  #iterationAssistantDialog, #conversationStudioDialog,
  #storyboardWorkspaceDialog, #contextPolicyDialog, #batchDrawer,
  #imageExportDialog, #workflowEditor, #promptEditorDialog)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]), select, textarea) {
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f5f5f7;
  color: #1d1d1f;
  box-shadow: none;
  transition: background-color 240ms cubic-bezier(.25,.1,.25,1),
    box-shadow 240ms cubic-bezier(.25,.1,.25,1),
    border-color 240ms cubic-bezier(.25,.1,.25,1);
}

html[data-theme] :is(#appShell, #authScreen, #developerApiDialog,
  #creationSettingsDialog, #smartProjectForm, #iterationPromptReview,
  #iterationAssistantDialog, #conversationStudioDialog,
  #storyboardWorkspaceDialog, #contextPolicyDialog, #batchDrawer,
  #imageExportDialog, #workflowEditor, #promptEditorDialog)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]), select, textarea)::placeholder {
  color: #6e6e73;
  opacity: 1;
}

html[data-theme] :is(#appShell, #authScreen, #developerApiDialog,
  #creationSettingsDialog, #smartProjectForm, #iterationPromptReview,
  #iterationAssistantDialog, #conversationStudioDialog,
  #storyboardWorkspaceDialog, #contextPolicyDialog, #batchDrawer,
  #imageExportDialog, #workflowEditor, #promptEditorDialog)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]), select, textarea):focus-visible {
  border-color: #0071e3;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .24);
}

html[data-theme] :is(button, a[href], [role="button"]):focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 3px;
}

html[data-theme] :is(.creation-settings-dialog, .smart-project-form.smart-project-dialog,
  .conversation-studio-dialog, .storyboard-workspace-dialog, .developer-api-dialog,
  .context-policy-dialog, .workflow-editor, .iteration-prompt-review,
  .iteration-assistant-dialog, .image-export-dialog, .batch-drawer,
  .prompt-editor-dialog, .model-info-dialog, .help-assistant-panel,
  .auth-card, .theme-menu, .toast) {
  border: 1px solid #e5e5e7;
  border-radius: 20px;
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

html[data-theme] :is(.creation-settings-backdrop, .smart-project-dialog-backdrop,
  .conversation-studio-backdrop, .storyboard-workspace-backdrop,
  .developer-api-backdrop, .context-policy-backdrop, .batch-drawer-backdrop,
  .prompt-editor-backdrop, .image-export-dialog-backdrop) {
  background: rgba(29, 29, 31, .38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

html[data-theme] :is(.reference-dropzone, .reference-slot,
  .prompt-assist-result, .batch-drawer-prompt, .developer-api-builder-output,
  .storyboard-prompt-review, .conversation-composer,
  .smart-project-mode-help, .smart-project-target-panel) {
  border: 1px solid #e5e5e7;
  border-radius: 16px;
  background: #f5f5f7;
  box-shadow: none;
}

html[data-theme] :is(.smart-project-mode-bar button, .storyboard-duration-builder,
  .context-policy-section, .image-export-dialog-selection) {
  border: 1px solid #e5e5e7;
  border-radius: 16px;
  background: #fff;
  box-shadow: none;
}

html[data-theme] :is(.smart-project-mode-bar button.active,
  .smart-project-mode-bar button:hover) {
  border-color: #0071e3;
  background: #eaf4ff;
  box-shadow: none;
}

html[data-theme] :is(.toast-close, .prompt-editor-close,
  .model-info-dialog header button) {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f5f5f7;
}

html[data-theme] :is(.auth-screen, .auth-showcase, .smart-project-hero,
  .smart-project-hero.smart-project-trigger:hover,
  .smart-project-hero.smart-project-trigger[aria-expanded="true"],
  .conversation-studio-header, .conversation-sidebar, .conversation-main,
  .storyboard-keyframe-visual, .batch-cover-media,
  .batch-drawer-image-frame, .reference-dropzone,
  .loading-shimmer, .generation-failure-card) {
  background-image: none;
}

html[data-theme] .auth-screen { background-color: #f5f5f7; }
html[data-theme] .auth-screen::before,
html[data-theme] .auth-screen::after { display: none; }
html[data-theme] .auth-showcase { background-color: #f5f5f7; }
html[data-theme] .smart-project-hero { background-color: #fff; color: #1d1d1f; }
html[data-theme] .conversation-sidebar { background-color: #f5f5f7; }
html[data-theme] .batch-cover-media,
html[data-theme] .batch-drawer-image-frame { background-color: #f5f5f7; }
html[data-theme] .loading-shimmer { background-color: #e5e5e7; }

html[data-theme] .main-stage.workspace-view-saved .saved-grid,
html[data-theme] .gallery-grid {
  grid-auto-rows: max-content;
  align-content: start;
}

html[data-theme] .primary-button { border-radius: 999px !important; box-shadow: none; }
html[data-theme] .control-mode-stage > .iteration-panel #iterateButton { border-radius: 999px; }
html[data-theme] :is(#generateButton, #iterateButton, .auth-submit,
  .smart-project-dialog-submit) { box-shadow: none !important; }
html[data-theme] :is(.rail-logo, .rail-button.active) { box-shadow: none !important; }

html[data-theme] .context-policy-dialog {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.context-policy-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 20px 0;
  background: #fff;
}
.context-policy-tabs button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #515154;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.context-policy-tabs button[aria-selected="true"] {
  background: #eaf4ff;
  color: #0066cc;
}
html[data-theme] .context-policy-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  gap: 10px;
  overflow: hidden;
  padding: 16px 20px;
}
html[data-theme] .context-policy-body > [hidden] { display: none; }
html[data-theme] .context-policy-editor {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
html[data-theme] #contextPolicyInstruction {
  width: 100%;
  height: 100%;
  min-height: 120px;
  resize: none;
}
html[data-theme] .context-policy-assistant {
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}
html[data-theme] #contextPolicyRequest {
  width: 100%;
  height: 100%;
  min-height: 96px;
  resize: none;
}
html[data-theme] .context-policy-summary {
  min-height: 0;
  align-content: start;
  overflow-y: auto;
}
html[data-theme] .context-policy-summary-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
html[data-theme] .context-policy-summary-item {
  display: block;
  padding: 0;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}
html[data-theme] .context-policy-summary-item summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}
html[data-theme] .context-policy-summary-item summary::-webkit-details-marker { display: none; }
html[data-theme] .context-policy-summary-item summary span:last-child { margin-left: auto; }
html[data-theme] .context-policy-summary-item p {
  margin: 0;
  padding: 0 12px 12px 38px;
  color: #515154;
  line-height: 1.55;
}

html[data-theme] .batch-drawer {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}
html[data-theme] .batch-drawer-recipe-content {
  max-height: min(180px, 25dvh);
  overflow-x: hidden;
  overflow-y: auto;
}
html[data-theme] .batch-drawer-grid { min-height: 0; }

html[data-theme] :is(.developer-api-note, .developer-api-batch-card.is-overridden) {
  border-left: 1px solid #e5e5e7;
  box-shadow: none;
}
html[data-theme] :is(.developer-api-header small, .context-policy-header small,
  .account-task-center-header small, .iteration-assistant-dialog header small) {
  letter-spacing: 0;
  text-transform: none;
}

html[data-theme] .modal-original-button {
  min-height: 36px;
  padding: 5px 16px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
html[data-theme] .modal-original-button:hover { background: rgba(255, 255, 255, .26); }

/* Keep the preview image as the dominant element. Controls occupy two quiet bars. */
html[data-theme] .image-modal {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 72px 20px 76px;
}
html[data-theme] .image-modal > .modal-stage {
  grid-column: 1;
  grid-row: 1;
}
html[data-theme] .image-modal > .modal-footer {
  position: fixed;
  top: 18px;
  bottom: auto;
  left: 24px;
  z-index: 3;
  display: flex;
  width: auto;
  max-width: calc(100vw - 460px);
  min-height: 40px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0;
}
html[data-theme] .modal-footer .modal-position {
  min-width: 52px;
  padding: 7px 11px;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(22, 24, 29, .72);
  font-weight: 600;
}
html[data-theme] .modal-footer .modal-caption {
  min-width: 0;
  max-width: min(44vw, 640px);
  overflow: hidden;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, .76);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-theme] .modal-footer .modal-gesture-hint { display: none; }
html[data-theme] .image-modal .modal-original-button {
  position: fixed;
  top: 16px;
  right: 172px;
  z-index: 4;
  min-height: 44px;
  padding: 0 14px;
  border-color: rgba(255, 255, 255, .24);
  background: rgba(22, 24, 29, .72);
  color: #fff;
  font-size: 13px;
  backdrop-filter: blur(12px);
}
html[data-theme] .image-modal > .modal-export-trigger {
  top: 16px;
  right: 76px;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(22, 24, 29, .72);
  box-shadow: none;
}
html[data-theme] .image-modal > .modal-close {
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(22, 24, 29, .72);
}
html[data-theme] .image-modal > .modal-zoom-toolbar {
  top: auto;
  bottom: 16px;
  left: 50%;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(22, 24, 29, .82);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  transform: translateX(-50%);
}
html[data-theme] .modal-zoom-toolbar button { border-radius: 999px; }
html[data-theme] .image-modal > .modal-nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: rgba(22, 24, 29, .72);
  transform: translateY(-50%);
}
html[data-theme] .image-modal > .modal-nav-previous { left: var(--modal-nav-offset, 16px); right: auto; }
html[data-theme] .image-modal > .modal-nav-next { right: var(--modal-nav-offset, 16px); left: auto; }

@media (max-width: 720px) {
  html[data-theme] .image-modal { padding: calc(70px + env(safe-area-inset-top)) 8px calc(102px + env(safe-area-inset-bottom)); }
  html[data-theme] .image-modal > .modal-footer {
    top: var(--modal-info-top, auto);
    right: 12px;
    bottom: auto;
    left: 12px;
    max-width: none;
    min-height: 24px;
    justify-content: center;
    gap: 8px;
  }
  html[data-theme] .modal-footer .modal-position { min-width: 46px; padding: 3px 8px; font-size: 12px; }
  html[data-theme] .modal-footer .modal-caption { max-width: calc(100vw - 92px); font-size: 12px; }
  html[data-theme] .image-modal .modal-original-button {
    top: calc(12px + env(safe-area-inset-top));
    right: 154px;
    min-height: 40px;
    padding-inline: 10px;
    font-size: 12px;
  }
  html[data-theme] .image-modal > .modal-export-trigger { top: calc(12px + env(safe-area-inset-top)); right: 62px; min-width: 80px; min-height: 40px; padding-inline: 8px; }
  html[data-theme] .image-modal > .modal-close { top: calc(12px + env(safe-area-inset-top)); right: 10px; width: 40px; height: 40px; }
  html[data-theme] .image-modal > .modal-zoom-toolbar { bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
}

html[data-theme] .full-text-editor-button {
  justify-self: start;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #fff;
  color: #0066cc;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
html[data-theme] .full-text-editor-button:hover { background: #eaf4ff; border-color: #0071e3; }
html[data-theme] .iteration-primary-card { gap: 8px; }
html[data-theme] .iteration-primary-card .iteration-request-field textarea { min-height: 108px; }
html[data-theme] .control-mode-stage > .iteration-panel .selected-preview { max-height: 132px; }
html[data-theme] .storyboard-mode-panel { gap: 10px; }
html[data-theme] .storyboard-story-field textarea { height: 132px; min-height: 132px; }
html[data-theme] .conversation-message-label textarea { max-height: 38dvh; resize: vertical; }
html[data-theme] .smart-project-primary-column > #smartProjectBrief { min-height: 130px; }
html[data-theme] .smart-project-primary-column {
  grid-template-areas: "brief-label extras" "brief extras" "references references";
}
html[data-theme] .smart-project-primary-column > .smart-project-extras { grid-area: extras; }
.smart-project-extras > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  background: #fff;
  color: #0066cc;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.smart-project-extras-content {
  display: grid;
  gap: 10px;
  padding: 12px 0;
}
.smart-project-extras-content textarea { width: 100%; min-height: 100px; }
.smart-project-extras-close { display: none; }

@media (max-width: 640px) {
  html[data-theme] .control-mode-stage > .iteration-panel.embedded-inspector {
    gap: 9px;
    padding: 12px 14px;
  }
  html[data-theme] .control-mode-stage > .iteration-panel .inspector-header .eyebrow,
  html[data-theme] .control-mode-stage > .iteration-panel .iteration-path-hint { display: none; }
  html[data-theme] .control-mode-stage > .iteration-panel .inspector-header h2 {
    margin: 0;
    font-size: 21px;
  }
  html[data-theme] .control-mode-stage > .iteration-panel .selected-preview,
  html[data-theme] .control-mode-stage > .iteration-panel .selected-preview.empty {
    min-height: 90px;
    max-height: 96px;
    padding: 7px 12px;
  }
  html[data-theme] .iteration-primary-card { position: relative; padding: 10px; }
  html[data-theme] .iteration-primary-card .iteration-request-field textarea {
    height: 80px !important;
    min-height: 80px !important;
    box-sizing: border-box;
  }
  html[data-theme] .iteration-primary-card .iteration-request-field small { display: none; }
  html[data-theme] .iteration-primary-card > .full-text-editor-button {
    position: absolute;
    top: 7px;
    right: 8px;
    min-height: 28px;
    padding: 2px 8px;
    font-size: 12px;
  }
  html[data-theme] .storyboard-mode-panel .mode-screen-intro p { display: none; }
  html[data-theme] .storyboard-mode-panel { position: relative; }
  html[data-theme] .storyboard-mode-panel > .full-text-editor-button {
    position: absolute;
    top: 56px;
    right: 16px;
    min-height: 28px;
    padding: 2px 8px;
    font-size: 12px;
  }
  html[data-theme] .storyboard-story-field textarea { height: 90px; min-height: 90px; }
  html[data-theme] .storyboard-duration-builder { padding: 9px 12px; }
  html[data-theme] .smart-project-primary-column > #smartProjectBrief {
    height: 96px !important;
    min-height: 96px !important;
    box-sizing: border-box;
  }
  html[data-theme] .smart-project-primary-column {
    grid-template-areas: "brief-label" "brief" "extras" "references";
  }
  html[data-theme] .smart-project-extras-content textarea {
    height: 72px !important;
    min-height: 72px !important;
    box-sizing: border-box;
  }
  html[data-theme] .smart-project-extras[open]::before {
    position: fixed;
    z-index: 180;
    inset: 0;
    background: rgba(29, 29, 31, .38);
    content: "";
  }
  html[data-theme] .smart-project-extras[open] .smart-project-extras-content {
    position: fixed;
    z-index: 181;
    top: 50%;
    left: 50%;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid #e5e5e7;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    transform: translate(-50%, -50%);
  }
  html[data-theme] .smart-project-extras-close {
    display: block;
    justify-self: end;
    width: 34px;
    height: 34px;
    border: 1px solid #e5e5e7;
    border-radius: 50%;
    background: #fff;
    color: #1d1d1f;
    cursor: pointer;
  }
  html[data-theme] .smart-project-mode-summary { padding: 10px 12px; }
  html[data-theme] .smart-project-example-row { gap: 4px; }
  html[data-theme] .agent-reference-panel { margin-top: 0; padding: 8px 10px; }
  html[data-theme] .agent-reference-heading small { display: none; }
  html[data-theme] .smart-project-interview-summary:has(#reviewSmartProjectAnswersButton[hidden]) { display: none; }
  html[data-theme] :is(.creation-settings-dialog, .batch-drawer,
    .conversation-studio-dialog, .storyboard-workspace-dialog,
    .developer-api-dialog, .smart-project-form.smart-project-dialog) {
    border-radius: 20px 20px 0 0;
  }
  html[data-theme] .prompt-editor-dialog { border-radius: 0; }
  html[data-theme] .plan-mode-panel :is(.creation-task-card, .conversation-studio-trigger) {
    border-radius: 18px;
  }
  html[data-theme] .batch-collection-box { border-radius: 18px; }
  .main-stage.workspace-view-saved .saved-filter-actions {
    justify-content: flex-start;
  }
  html[data-theme] .context-policy-tabs { padding-inline: 12px; }
  .context-policy-tabs button { flex: 1 1 0; padding-inline: 4px; }
  html[data-theme] .context-policy-body { padding: 12px; }
  html[data-theme] .context-policy-section-heading > div > span { display: block; }
  html[data-theme] .batch-drawer-recipe-content {
    max-height: 138px;
    overflow: hidden;
  }
  html[data-theme] .batch-drawer-recipe-content .batch-drawer-prompt,
  html[data-theme] .batch-drawer-recipe-content .batch-drawer-original-prompt { display: none; }
  html[data-theme] .batch-drawer-references {
    display: flex;
    max-height: 72px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  html[data-theme] .batch-drawer-references > button { flex: 0 0 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] :is(button, a, input, select, textarea, .creation-task-card,
    .conversation-studio-trigger, .batch-collection-box,
    .image-tile, .saved-tile) { transition: none; animation: none; }
  html[data-theme] :is(button, .creation-task-card, .conversation-studio-trigger,
    .batch-collection-box, .image-tile, .saved-tile):active,
  html[data-theme] :is(.creation-task-card, .conversation-studio-trigger,
    .batch-collection-box, .image-tile, .saved-tile):hover * { transform: none; }
}
