.task-submission-list { display: grid; gap: 6px; padding: 0 12px 8px; min-width: 0; }
.task-submission-list[hidden] { display: none; }
.task-submission-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; color: var(--muted, #86868b); font-size: 12px; }
.task-submission-label { min-width: 0; overflow-wrap: anywhere; }
.task-submission-row button { flex-shrink: 0; border: 0; background: transparent; color: var(--accent, #007aff); font: inherit; padding: 4px; cursor: pointer; }
.task-submission-row button:disabled { opacity: .5; cursor: default; }
.task-image-progress-list { display: grid; gap: 9px; padding: 0 12px 12px; min-width: 0; }
.task-image-progress-list[hidden] { display: none; }
#preparationFeedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; min-width: 0; box-sizing: border-box; padding: 8px 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#preparationFeedback[hidden] { display: none; }
#preparationFeedback .preparation-copy { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
#preparationFeedback .preparation-copy[hidden] { display: none; }
#preparationFeedback time { flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
#preparationFeedback button { flex-shrink: 0; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 6px; padding: 4px 7px; cursor: pointer; }
#preparationFeedback::before { content: none; }
@keyframes preparation-spin { to { transform: rotate(360deg); } }
#preparationFeedback[data-phase="error"] { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
#preparationFeedback[data-phase="error"]::before { content: '⚠'; width: auto; height: auto; border: 0; border-radius: 0; animation: none; color: var(--muted); font-size: 15px; }
@media (prefers-reduced-motion: reduce) { #preparationFeedback::before { animation: none; } }
.task-image-heading { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 11px; line-height: 16px; color: var(--muted); }
.task-image-heading [data-image-label] { color: var(--text); flex-shrink: 0; }
.task-image-heading [data-image-state] { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-image-heading time { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.task-image-progress { width: 100%; min-width: 0; box-sizing: border-box; }
.task-image-track { transform-origin: top left; display: block; width: 100%; height: 4px; min-height: 4px; max-height: 4px; padding: 0; border: 0; box-sizing: border-box; margin-top: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.task-image-track > span { display: block; width: calc(var(--image-estimated-progress, 0) * 100%); height: 100%; background: var(--accent); border-radius: inherit; transition: width 1s linear; }
.task-image-progress:is([data-state="paused"], [data-state="stopping"], [data-state="cancelled"], [data-state="interrupted"]) .task-image-track > span { background: var(--muted); transition: none; }
.task-image-progress[data-state="failed"] .task-image-track > span { background: var(--danger, #d94151); }
.task-image-progress[data-state="failed"] [data-image-state] { color: var(--danger, #d94151); }
@media (prefers-reduced-motion: reduce) { .task-image-track > span { transition: none; } }
#generateButton[aria-busy="true"] { opacity: 1; filter: none; cursor: progress; }
#generateButton[aria-busy="true"] .button-label { white-space: normal; line-height: 1.3; }
.app-topbar { overflow: visible; display: flex; gap: 16px; }
.app-topbar .topbar-generation-progress { display: none; }
.app-topbar > .task-toolbar { justify-content: flex-start; }
/* Spend spare panel height on reference cards, leaving settings at the bottom. */
.composer-fields > #generationReferences { display: flex; flex-direction: column; flex: 1 0 auto; }
#generationReferences > .reference-header { flex-shrink: 0; }
#generationReferences > #referenceDetails { display: flex; flex-direction: column; flex: 1 0 auto; }
.composer-fields #referenceDetails > .reference-role-grid { flex: 1 0 auto; align-content: stretch; grid-auto-rows: auto; }
.composer-fields #referenceDetails > .reference-role-grid > .reference-role-card { height: auto; align-self: stretch; }
#referenceDetails > .reference-header-previews { flex-shrink: 0; }
.app-topbar > .app-brand { flex-shrink: 0; }
.app-topbar > .app-brand-logo { flex-shrink: 0; }
@font-face { font-family: 'Nunito Brand'; src: url('/fonts/Nunito-Variable.ttf') format('truetype'); font-style: normal; font-weight: 200 1000; font-display: swap; }
.app-wordmark { flex: 0 0 auto; font-family: 'Nunito Brand', sans-serif; font-weight: 900; font-size: calc(21px + var(--app-font-increase, 1pt)); line-height: 1.15; letter-spacing: -.04em; white-space: nowrap; color: var(--text); padding-right: 14px; border-right: 1px solid var(--line); }
@media (max-width: 900px) { .app-wordmark { font-size: calc(18px + var(--app-font-increase, 1pt)); padding-right: 0; border-right: 0; } }
.task-toolbar { display: flex; flex: 1; justify-content: center; align-items: center; gap: 0; min-width: 0; position: relative; }
.task-toolbar button { color: var(--text); background: transparent; border: 0; cursor: pointer; border-radius: 7px; }
.task-toolbar button:hover, .task-toolbar button[aria-expanded="true"] { background: var(--accent-faint); }
.task-toolbar button:focus-visible, .task-drawer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-metric, .task-current { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; padding: 4px 16px; min-height: 44px; }
.task-metric span, .task-current span { font-size: calc(10px + var(--app-font-increase, 1pt)); color: var(--muted); white-space: nowrap; }
.task-metric strong { font-size: calc(20px + var(--app-font-increase, 1pt)); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.task-current { border: 1px solid rgb(102 126 153 / 20%); border-radius: 13px; width: 180px; min-width: 180px; min-height: 40px; margin-right: 12px; background: linear-gradient(180deg, rgb(255 255 255 / 78%), rgb(230 238 248 / 65%)); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 95%), inset 0 -1px 0 rgb(255 255 255 / 35%), 0 2px 5px rgb(41 64 91 / 5%); }
.task-current strong { font-size: calc(16px + var(--app-font-increase, 1pt)); font-weight: 500; font-variant-numeric: tabular-nums; }
.task-current { align-items: center; justify-content: center; }
.task-toolbar .task-current .task-elapsed[hidden] { display: none; }
.task-current > [data-label] { font-size: calc(11px + var(--app-font-increase, 1pt)); font-weight: 600; letter-spacing: .015em; color: var(--text); }
.task-elapsed { flex-shrink: 0; min-width: 48px; font-size: calc(16px + var(--app-font-increase, 1pt)); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.task-current { position: relative; isolation: isolate; overflow: hidden; }
.task-toolbar > div.task-metric, .task-toolbar > div.task-current { box-sizing: border-box; color: var(--text); cursor: default; }
.task-current > span, .task-current > strong { position: relative; z-index: 1; }
.task-current::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: 0; background: linear-gradient(90deg, rgb(105 174 252 / 32%) 0%, rgb(105 174 252 / 32%) 68%, rgb(139 193 255 / 22%) 87%, transparent 100%); box-sizing: border-box; transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.task-current::after { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(180deg, rgb(255 255 255 / 32%), transparent 52%); }
.task-toolbar[data-generating="true"] .task-current { border-color: rgb(102 126 153 / 20%); }
.task-toolbar[data-generating="true"] .task-current::before { animation: task-current-fill 4s linear infinite; }
:root[data-theme="dark"] .task-current { background: linear-gradient(180deg, rgb(65 78 97 / 85%), rgb(31 42 59 / 90%)); border-color: rgb(182 207 238 / 19%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 16%), 0 2px 6px rgb(0 0 0 / 12%); }
:root[data-theme="dark"] .task-current::after { opacity: .2; }
:root[data-theme="dark"] .task-current::before { background: linear-gradient(90deg, rgb(58 137 232 / 48%) 0%, rgb(58 137 232 / 48%) 68%, rgb(83 160 245 / 26%) 87%, transparent 100%); }
@media (prefers-reduced-transparency: reduce) { .task-current { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--composer-card-solid) !important; } }
@media (prefers-contrast: more) { .task-current { border-color: var(--text); } .task-current > [data-label] { color: var(--text); } }
@keyframes task-current-fill {
  0% { transform: scaleX(.08); opacity: 1; }
  85% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .task-toolbar[data-generating="true"] .task-current::before { animation: none; transform: scaleX(1); opacity: .65; }
}
.task-toolbar[data-busy="true"] [data-running], .task-toolbar[data-busy="true"] [data-elapsed] { color: var(--accent); }
.task-failed strong { color: #d34d49; }
.task-recent { display: flex; gap: 5px; padding: 0 12px; }
.task-thumbnail { width: 38px; height: 38px; padding: 3px !important; border: 1px solid var(--line) !important; background: var(--surface-raised) !important; }
.task-thumbnail img { width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }
.task-toggle { white-space: nowrap; font-size: calc(11px + var(--app-font-increase, 1pt)); padding: 10px; }
/* Compact, aligned toolbar groups around the generation indicator. */
.task-toolbar .task-elapsed { min-width: 46px; margin-right: 14px; font-size: calc(13px + var(--app-font-increase, 1pt)); font-weight: 500; text-align: center; letter-spacing: .02em; }
.task-toolbar > .task-metric { flex-direction: row; align-items: center; gap: 7px; min-height: 30px; padding: 0 9px; }
.task-toolbar > .task-metric span { font-size: calc(11px + var(--app-font-increase, 1pt)); color: var(--muted); }
.task-toolbar > .task-metric strong { font-size: calc(14px + var(--app-font-increase, 1pt)); font-weight: 600; line-height: 1; }
.task-toolbar .task-recent { gap: 5px; margin-left: 12px; padding: 0 14px; border-left: 1px solid var(--line); }
.task-toolbar .task-thumbnail { width: 34px; height: 34px; padding: 2px !important; border-radius: 8px; background: var(--composer-card-solid) !important; box-shadow: 0 1px 2px rgb(28 51 80 / 4%); }
.task-toolbar .task-thumbnail:hover { border-color: var(--accent-line) !important; }
.task-toolbar .task-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--composer-card-solid); font-size: calc(11px + var(--app-font-increase, 1pt)); font-weight: 500; color: var(--muted); }
.task-toolbar .task-toggle [data-chevron] { font-size: calc(13px + var(--app-font-increase, 1pt)); line-height: 1; }
.task-toolbar .task-toggle:hover, .task-toolbar .task-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-faint); }
.task-toolbar .task-failed { margin-right: 8px; }
@media (max-width: 580px) { .task-toolbar .task-elapsed { margin-right: 4px; min-width: 40px; } .task-toolbar > .task-metric { padding-inline: 5px; gap: 4px; } .task-toolbar .task-toggle { padding-inline: 7px; } }
.task-drawer { position: absolute; top: calc(100% + 8px); left: 0; width: min(300px, 100%); box-sizing: border-box; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--composer-card-solid); box-shadow: 0 12px 36px rgb(0 0 0 / 12%); z-index: 20; }
.task-drawer[hidden], .task-toolbar [hidden], .task-drawer .generation-job[hidden] { display: none !important; }
.task-drawer-close { float: right; position: relative; z-index: 2; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: var(--surface-raised); color: var(--text); cursor: pointer; }
#taskDrawer #generationJobsPanel { margin: 0; padding: 0; border: 0; background: transparent; animation: none; box-shadow: none; max-height: min(440px, 65dvh); overflow: auto; }
#taskDrawer .job-history-header { padding-right: 65px; }
#taskDrawer .job-panel-toggle, #taskDrawer .generation-jobs-summary { display: none; }
#taskDrawer .generation-jobs-list { max-height: none; }
#taskDrawer .generation-job { padding: 12px 60px 12px 0; min-height: 72px; border-top: 1px solid var(--line); }
#taskDrawer .generation-job-copy { display: grid; grid-template-columns: minmax(0,1fr); align-items: center; gap: 10px; }
#taskDrawer .job-result-thumbnails { margin: 0; grid-template-columns: repeat(4,48px); }
#taskDrawer .job-result-select { width: 48px; height: 48px; }
#taskDrawer .job-result-thumbnails { grid-template-columns: repeat(4, minmax(0, 48px)); }
#taskDrawer .job-result-thumbnails .job-result-select { width: 100%; height: auto; }
#taskDrawer .job-requested-model, #taskDrawer .job-error { overflow-wrap: anywhere; }
#taskDrawer .job-notice-details, #taskDrawer .job-stop-details { grid-column: 1 / -1; }
/* History now lives in the header drawer; assets occupy the whole rail. */
body[data-active-view="create"] .stage > #createSideRail { grid-template-rows: minmax(0, 1fr); }
#createSideRail > #createMoodboardDock { flex: 1 1 auto; height: auto; min-height: 0; }
.task-drawer .task-drawer-close { position: absolute; top: 10px; right: 10px; float: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 4px; border-color: var(--line); border-radius: 7px; background: transparent; color: var(--muted); }
.task-drawer-close svg { width: 16px; height: 16px; }
.task-drawer-close:hover { background: var(--surface-hover); color: var(--text); }
#taskDrawer .job-history-header { min-height: 26px; margin: 0 0 6px; padding: 0 30px 8px 0; border-bottom: 1px solid var(--line); }
#taskDrawer .generation-jobs-list { margin: 0; padding: 0; gap: 0; overflow: visible; }
#taskDrawer .generation-job { display: block; min-height: 0; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
#taskDrawer .generation-job:last-child { border-bottom: 0; }
#taskDrawer .generation-job-copy { gap: 6px 10px; }
#taskDrawer .generation-job-copy:has(.job-result-thumbnails) { grid-template-columns: 56px minmax(0,1fr); }
#taskDrawer .job-result-thumbnails { grid-column: 1; grid-row: 1; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; }
#taskDrawer .job-result-thumbnails:has(> :only-child) { grid-template-columns: 1fr; }
#taskDrawer .job-status-copy { grid-column: -2; min-width: 0; }
#taskDrawer .generation-job-heading { gap: 3px 6px; padding: 0; }
#taskDrawer .job-state-badge { padding: 0; background: transparent; font-size: calc(11px + var(--app-font-increase, 1pt)); }
#taskDrawer .job-history-time { font-size: calc(10px + var(--app-font-increase, 1pt)); color: var(--muted); }
#taskDrawer .job-history-duration { font-size: calc(10px + var(--app-font-increase, 1pt)); color: var(--muted); }
#taskDrawer .job-requested-model { font-size: calc(10px + var(--app-font-increase, 1pt)); line-height: 1.5; margin-top: 4px; }
#taskDrawer .generation-job > .job-cancel { position: static; display: block; margin: 7px 0 0 auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 1400px) { .app-topbar .app-brand-tagline { display: none; } .task-metric { padding-inline: 12px; } }
@media (max-width: 1400px) { .app-topbar { flex-wrap: wrap; } .app-topbar .app-topbar-actions { margin-left: auto; width: auto; } .task-toolbar { order: 3; flex-basis: 100%; justify-content: flex-start; border-top: 1px solid var(--line); padding-top: 8px; } .task-toggle { margin-left: auto; } }
@media (max-width: 580px) { .task-recent { display: none; } .task-metric { padding-inline: 10px; } #taskDrawer .generation-job-copy { grid-template-columns: minmax(0,1fr); } .task-current { width: 150px; min-width: 150px; padding-inline: 12px; margin-right: 6px; } }

/* Shared submit stays connected to its form when placed in the header. */
.topbar-create { display: flex; flex: 0 0 auto; align-items: stretch; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 2px 5px rgba(20,35,60,.04); }
.topbar-create #topbarCount { width: 54px; min-width: 54px; padding: 0 6px 0 12px; border: 0; border-radius: 10px 0 0 10px; background: transparent; color: var(--text); font: inherit; font-size: calc(14px + var(--app-font-increase, 1pt)); font-variant-numeric: tabular-nums; cursor: pointer; }
.topbar-create #generateButton { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 7px; width: auto; min-width: 100px; min-height: 0; height: 38px; margin: 0; padding: 0 14px; border: 0; border-radius: 0 10px 10px 0; font-size: calc(13px + var(--app-font-increase, 1pt)); white-space: nowrap; }
.topbar-create .generation-icon { width: 17px; height: 17px; order: -1; }
.topbar-create select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#promptCountControl .prompt-count-grid, #imageEditPanel .image-edit-output-count { display: none; }
@media (max-width: 700px) { .app-topbar { flex-wrap: wrap; } .topbar-create { margin-left: auto; } }
.topbar-create { box-sizing: border-box; height: 42px; padding: 3px; gap: 3px; border-radius: 12px; background: color-mix(in srgb, var(--surface-raised) 85%, transparent); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 6px rgba(20,35,60,.05); }
.topbar-quantity { display: flex; align-items: center; width: 58px; flex: none; border-radius: 8px; }
.topbar-create #topbarCount { appearance: textfield; -moz-appearance: textfield; box-sizing: border-box; width: 34px; min-width: 0; height: 32px; padding: 0; margin: 0; text-align: center; border-radius: 7px; box-shadow: none; outline: none; font-weight: 600; cursor: text; }
#topbarCount::-webkit-inner-spin-button, #topbarCount::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.quantity-steps { display: flex; flex-direction: column; width: 20px; gap: 1px; }
.quantity-steps button { display: grid; place-items: center; width: 20px; height: 15px; min-height: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.quantity-steps button:hover { color: var(--text); background: var(--surface-hover); }
.quantity-steps button:active { background: var(--accent-faint); }
.quantity-steps svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.topbar-quantity:focus-within { box-shadow: 0 0 0 2px var(--accent-line); }
.topbar-quantity:has(input:disabled) { opacity: .45; pointer-events: none; }
.topbar-create #generateButton,
#imageEditWindow .edit-image-workspace > .edit-prompt-pane #dockEditSubmit { height: 34px; min-width: 96px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,90,200,.15); background: linear-gradient(180deg, #2999ff, #087ff5); color: white; }
.topbar-create #generateButton:hover:not(:disabled),
#imageEditWindow .edit-image-workspace > .edit-prompt-pane #dockEditSubmit:hover:not(:disabled) { background: linear-gradient(180deg, #198fff, #0074e8); }
/* Two independent header surfaces: creation and job status. */
.app-shell > .app-topbar { padding: 0; gap: 14px; align-items: stretch; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
.topbar-launch-card, .topbar-status-card { display: flex; align-items: center; gap: 16px; min-height: 64px; box-sizing: border-box; padding: 10px 16px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(120deg, color-mix(in srgb, var(--composer-card-solid) 88%, transparent), color-mix(in srgb, var(--composer-card-solid) 70%, transparent)); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), 0 4px 16px rgb(32 60 100 / 4%); }
.topbar-launch-card { flex: 0 0 auto; }
.topbar-status-card { flex: 1; min-width: 0; }
.topbar-status-card .task-toolbar { justify-content: flex-start; }
:root[data-theme="dark"] .app-shell > .app-topbar { box-shadow: none; }
@media (max-width: 1400px) { .topbar-status-card { flex-wrap: wrap; } .topbar-status-card .task-toolbar { order: 0; flex-basis: 100%; border: 0; padding-top: 0; } }
@media (max-width: 900px) { .topbar-status-card { flex-basis: 100%; } .topbar-launch-card { width: 100%; justify-content: space-between; } }
@media (prefers-reduced-transparency: reduce) { .topbar-launch-card, .topbar-status-card { background: var(--composer-card-solid); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (min-width: 901px) {
  .app-shell > .app-topbar { display: grid; grid-template-columns: var(--composer-width) minmax(0, 1fr); gap: var(--app-gap); }
  .topbar-launch-card { min-width: 0; width: 100%; padding-inline: 12px; gap: 10px; justify-content: space-between; }
  .topbar-launch-card .app-wordmark { font-size: calc(19px + var(--app-font-increase, 1pt)); padding-right: 10px; }
  .topbar-launch-card .topbar-create { margin-left: 0; }
  .topbar-launch-card #generateButton { min-width: 84px; padding-inline: 10px; }
}
.topbar-status-card > .app-topbar-actions { border-left: 0; padding-left: 0; }

#previewCornerActions { position: absolute; z-index: 4; pointer-events: none; }
#previewCornerActions[hidden] { display: none; }
.preview-corner { position: absolute; top: 0; width: 64px; height: 64px; pointer-events: auto; display: flex; align-items: flex-start; padding: 10px; box-sizing: border-box; }
.preview-corner-left { left: 0; }
.preview-corner-right { right: 0; justify-content: flex-end; }
.preview-corner button, .preview-corner a { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid rgba(255,255,255,.65); border-radius: 10px; background: rgba(250,252,255,.85); color: #414853; box-shadow: 0 2px 10px rgba(0,0,0,.12); backdrop-filter: blur(12px); opacity: 0; transition: opacity 160ms ease; cursor: pointer; }
.preview-corner:hover button, .preview-corner:hover a, .preview-corner:focus-within button, .preview-corner:focus-within a { opacity: 1; }
.preview-corner-left button:hover { color: #d13d42; }
.preview-corner-right a:hover { color: #007aff; }
.preview-corner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.preview-corner :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: none) { .preview-corner button, .preview-corner a { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .preview-corner button, .preview-corner a { transition: none; } }
#imageEditDock { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 8px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); overflow: hidden; }
#imageEditDock[hidden] { display: none; }
#imageEditDock > header { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
#imageEditDock h2 { margin: 0; font-size: calc(15px + var(--app-font-increase, 1pt)); }
.edit-dock-body { min-height: 0; overflow: auto; padding: 14px; flex: 1; }
#imageEditDock #imageEditPanel { display: block; margin: 0; padding: 0; border: 0; background: transparent; }
#imageEditDock .image-edit-output-count { display: block; }
#imageEditDock .image-edit-output-count[hidden] { display: none; }
#imageEditDock .image-edit-source-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#imageEditDock .image-edit-source { max-height: 190px; }
#imageEditDock .image-edit-preview { max-height: 180px; object-fit: contain; }
#imageEditDock .image-edit-prompt { min-height: 120px; }
#imageEditDock > footer { display: grid; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.edit-dock-settings { display: flex; align-items: center; gap: 10px; }
.edit-dock-settings select { min-width: 90px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--composer-card-solid); color: var(--text); }
.edit-dock-resolution, #imageEditDock summary { font-size: calc(11px + var(--app-font-increase, 1pt)); color: var(--muted); }
#imageEditDock details { margin-top: 14px; }
#imageEditDock pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 12px; }
#dockEditSubmit { width: 100%; min-height: 38px; }
@media (min-width: 1500px) {
 body[data-active-view="create"] .stage > #imageEditDock { grid-column: 2; grid-row: 2 / 5; }
}
@media (max-width: 1499px) {
 body[data-active-view="create"] .stage > #createSideRail { grid-column: 1; grid-row: 2; }
 body[data-active-view="create"] .stage > #imageEditDock { grid-column: 1; grid-row: 3; }
}
body[data-active-view="create"] .stage.has-contained-preview:not(#canvasPanel) > #imageEditDock { display: none; }
/* Keep the editing card's content grouped and its actions within the viewport. */
#imageEditDock { background: color-mix(in srgb, var(--surface-raised) 55%, var(--bg)); }
#imageEditDock > header { padding: 16px 18px; }
#imageEditDock .edit-dock-body { padding: 16px; }
#imageEditDock #imageEditPanel { display: flex; flex-direction: column; gap: 10px; }
#imageEditDock .image-edit-source-heading { margin: 0; }
#imageEditDock .image-edit-source:has(.image-edit-empty:not([hidden])) { height: 98px; background: var(--composer-card-solid); border-color: var(--line); }
#imageEditDock .image-edit-empty { padding: 12px; gap: 10px; text-align: left; }
#imageEditDock .image-edit-add-copy strong { font-size: calc(13px + var(--app-font-increase, 1pt)); font-weight: 600; }
#imageEditDock .image-edit-source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
#imageEditDock .image-edit-source-actions button { margin: 0; min-height: 32px; font-size: calc(11px + var(--app-font-increase, 1pt)); }
#imageEditDock .image-edit-preserve { padding-top: 16px; margin-top: 6px; border-top: 1px solid var(--line); }
#imageEditDock .image-edit-preserve-heading { margin-bottom: 10px; }
#imageEditDock .image-edit-preserve-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#imageEditDock .image-edit-preserve-option { justify-content: center; min-width: 0; min-height: 32px; padding: 6px 3px; border-radius: 8px; font-size: calc(10px + var(--app-font-increase, 1pt)); white-space: nowrap; }
#imageEditDock .image-edit-prompt-label { padding-top: 16px; margin-top: 6px; border-top: 1px solid var(--line); }
#imageEditDock .image-edit-prompt { height: 124px; min-height: 100px; margin: 0; padding: 12px; border-radius: 10px; background: var(--composer-card-solid); font-size: calc(12px + var(--app-font-increase, 1pt)); line-height: 1.6; }
#imageEditDock .image-edit-prompt-meta { margin-top: -5px; }
#imageEditDock details { padding-top: 12px; border-top: 1px solid var(--line); }
#imageEditDock summary { cursor: pointer; }
#imageEditDock > footer { flex: 0 0 auto; gap: 10px; padding: 14px 16px; background: var(--composer-card-solid); }
#imageEditDock .image-edit-output-count { display: grid; gap: 8px; margin: 0; }
#imageEditDock .image-edit-count-label { font-size: calc(11px + var(--app-font-increase, 1pt)); color: var(--muted); }
#imageEditDock .image-edit-count-help { display: none; }
#imageEditDock .image-edit-output-count .count-button { min-height: 29px; padding: 4px; font-size: calc(11px + var(--app-font-increase, 1pt)); }
#imageEditDock .edit-dock-settings { justify-content: space-between; }
#imageEditDock #dockEditQuality { font: inherit; font-size: calc(11px + var(--app-font-increase, 1pt)); }
#imageEditDock #dockEditSubmit { margin: 0; height: 38px; min-height: 38px; padding: 8px 14px; border-radius: 10px; font-size: calc(13px + var(--app-font-increase, 1pt)); }
/* One launch card keeps submission and its feedback together. */
.app-shell > .app-topbar { align-items: start; }
.app-topbar .topbar-launch-card { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 12px; padding: 12px; min-width: 0; }
.topbar-launch-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.topbar-launch-heading .app-wordmark { border: 0; padding-right: 0; }
.topbar-launch-card .task-toolbar { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-rows: 34px 28px; align-items: center; width: 100%; flex: none; order: 0; gap: 10px 6px; padding: 12px 0 0; border-top: 1px solid var(--line); }
.topbar-launch-card .task-current { grid-column: 1 / 5; grid-row: 1; box-sizing: border-box; width: 100%; min-width: 0; height: 34px; min-height: 34px; margin: 0; padding: 0 12px; border-radius: 10px; }
.topbar-launch-card .task-elapsed { grid-column: 5; grid-row: 1; text-align: right; min-width: 0; margin: 0; padding: 0 2px; font-size: calc(12px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-metric { flex-direction: row; align-items: center; min-height: 24px; padding: 0; gap: 4px; white-space: nowrap; }
.topbar-launch-card .task-metric strong { font-size: calc(12px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-metric span { font-size: calc(9px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-metric:has([data-running]) { grid-column: 1; grid-row: 2; }
.topbar-launch-card .task-metric:has([data-queued]) { grid-column: 2; grid-row: 2; }
.topbar-launch-card .task-recent { display: flex; justify-content: flex-end; grid-column: 3; grid-row: 2; padding: 0; margin: 0; border: 0; gap: 3px; min-width: 0; overflow: hidden; }
.topbar-launch-card .task-thumbnail { width: 24px; height: 28px; min-width: 24px; border-radius: 5px; }
.topbar-launch-card .task-failed { grid-column: 4; grid-row: 2; margin: 0; padding: 3px; }
.topbar-launch-card .task-toggle { grid-column: 5; grid-row: 2; min-height: 28px; margin: 0; padding: 0 7px; gap: 4px; font-size: calc(10px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-drawer { top: calc(100% + 8px); width: 100%; max-width: 400px; }
.app-topbar .topbar-status-card { justify-content: flex-end; align-self: start; min-height: 64px; }
.topbar-status-card .app-topbar-actions { margin-left: auto; }
@media (max-width: 420px) { .topbar-launch-card .task-recent .task-thumbnail:nth-child(n+2) { display: none; } }

/* Footer tools replace reset; the workspace uses the full right-hand height. */
#composerSubmitBar .app-topbar-actions { display: grid; grid-template-columns: 30px 26px minmax(0, 1fr) 30px; gap: 8px; width: 100%; margin: 0; padding: 0; border: 0; }
#composerSubmitBar .topbar-engine { grid-column: 3; min-width: 0; }
#composerSubmitBar .model-select { width: 100%; min-width: 0; max-width: 100%; padding-inline: 6px; font-size: calc(11px + var(--app-font-increase, 1pt)); }
#composerSubmitBar #railSettingsButton { grid-column: 4; grid-row: 1; }
#composerSubmitBar #railStatus { grid-column: 1 / -1; justify-self: start; margin: 0; }
#composerSubmitBar .app-topbar-actions > button:not(#railStatus) { width: 28px; height: 28px; min-width: 0; padding: 4px; }
@media (min-width: 901px) {
  .app-shell > .app-topbar { grid-column: 1; grid-row: 1; display: block; }
  .app-shell > .composer-panel { grid-column: 1; grid-row: 2; }
  .app-shell > .stage { grid-column: 2; grid-row: 1 / 3; }
}

.topbar-launch-card .task-status-group { grid-column: 1 / 5; grid-row: 2; display: inline-flex; align-items: center; justify-self: start; gap: 0; min-height: 28px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); }
.topbar-launch-card .task-status-group > .task-metric { padding: 0 8px; min-height: 20px; margin: 0; }
.topbar-launch-card .task-status-group > .task-metric + .task-metric { border-left: 1px solid var(--line); border-radius: 0; }

.topbar-launch-card .task-progress-group { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: stretch; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-raised); box-shadow: 0 2px 5px rgb(28 51 80 / 4%); }
.topbar-launch-card .task-progress-group .task-current { flex: 1; width: auto; height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.topbar-launch-card .task-progress-group .task-elapsed { display: flex; align-items: center; justify-content: center; flex: 0 0 68px; margin: 0; padding: 0 10px; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* Status, submission and history form one compact action row. */
.app-topbar .topbar-launch-card { gap: 12px; padding: 14px 12px 12px; }
.topbar-launch-heading { min-height: 26px; padding: 0 3px; }
.topbar-launch-card .task-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: 36px 42px; gap: 12px 7px; padding-top: 0; border-top: 0; }
.topbar-launch-card .task-progress-group { grid-column: 1 / -1; height: 36px; }
.topbar-launch-card .task-status-group { grid-column: 1; grid-row: 2; justify-self: stretch; justify-content: space-evenly; min-width: 0; padding: 3px 0; height: 36px; background: transparent; border: 0; }
.topbar-launch-card .task-status-group > .task-metric { flex-direction: column; gap: 4px; flex: 1; padding: 0 4px; min-height: 28px; }
.topbar-launch-card .task-status-group .task-metric span { font-size: calc(9px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-status-group .task-metric strong { font-size: calc(13px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-toolbar > .topbar-create { grid-column: 2; grid-row: 2; margin: 0; }
.topbar-launch-card .task-toolbar .topbar-quantity { width: 43px; }
.topbar-launch-card .task-toolbar #topbarCount { width: 25px; }
.topbar-launch-card .task-toolbar .quantity-steps { width: 18px; }
.topbar-launch-card .task-toolbar #generateButton { min-width: 78px; padding: 0 9px; font-size: calc(12px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-toolbar .generation-icon { width: 15px; height: 15px; }
.topbar-launch-card .task-toggle { grid-column: 3; grid-row: 2; height: 38px; padding: 0 7px; }

.topbar-launch-card .task-toolbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px 36px; gap: 10px; }
.topbar-launch-card .task-progress-group { height: 44px; overflow: visible; }
.topbar-launch-card .task-progress-group .task-current { flex-direction: row; gap: 10px; min-width: 0; margin: 0; padding: 0 8px; border-radius: 10px 0 0 10px; }
.topbar-launch-card .task-progress-group .task-elapsed { flex: 0 0 auto; border: 0; padding: 0; }
.topbar-launch-card .task-progress-group > .topbar-create { align-self: center; margin: 0; height: 42px; border: 0; border-left: 1px solid var(--line); border-radius: 0 10px 10px 0; box-shadow: none; }
.topbar-launch-card .task-toggle { grid-column: 2; height: 34px; }
.topbar-launch-card .task-status-group { justify-self: start; }
.topbar-launch-card .task-status-group > .task-metric { flex-direction: row; gap: 6px; padding: 0 12px; }

/* Keep the action prominent; status, values and captions share a steady type scale. */
.topbar-launch-card .task-current > [data-label],
.topbar-launch-card .task-progress-group .task-elapsed {
  font-size: calc(12px + var(--app-font-increase, 1pt));
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
}
.topbar-launch-card .task-status-group .task-metric span {
  font-size: calc(10px + var(--app-font-increase, 1pt));
  font-weight: 400;
  line-height: 1.2;
}
.topbar-launch-card .task-status-group .task-metric strong,
.topbar-launch-card .task-toolbar #topbarCount {
  font-size: calc(13px + var(--app-font-increase, 1pt));
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.topbar-launch-card .task-toolbar #generateButton,
.topbar-launch-card .task-toolbar #generateButton .button-label {
  font-size: calc(13px + var(--app-font-increase, 1pt));
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}
.topbar-launch-card .task-toolbar .task-toggle {
  font-size: calc(11px + var(--app-font-increase, 1pt));
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
}

/* Reserve the longest action label so polling and generation never shift the split. */
.topbar-launch-card .task-toolbar #generateButton {
  box-sizing: border-box;
  width: calc(122px + 6 * var(--app-font-increase, 1pt));
  min-width: calc(122px + 6 * var(--app-font-increase, 1pt));
  flex: none;
}
.topbar-launch-card .task-progress-group .task-current { flex: 1 1 0; }
.topbar-launch-card .task-current > [data-label] { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar-launch-card .task-progress-group .task-elapsed { width: 5ch; flex: 0 0 5ch; white-space: nowrap; }

#taskDrawer { max-height: var(--drawer-available-height, 65dvh); overflow: hidden; }
#taskDrawer #generationJobsPanel { box-sizing: border-box; max-height: calc(var(--drawer-available-height, 65dvh) - 26px); overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; padding: 0 3px 8px 0; }
#taskDrawer .generation-jobs-list { display: flex; flex-direction: column; }
#taskDrawer .generation-job { flex: 0 0 auto; }
#taskDrawer .generation-job-heading { display: flex; flex-wrap: wrap; line-height: 1.6; }
#taskDrawer .job-status-copy, #taskDrawer .job-notice-details { min-width: 0; max-width: 100%; }
#taskDrawer .job-requested-model, #taskDrawer .job-error, #taskDrawer .job-history-time, #taskDrawer .job-history-duration { white-space: normal; overflow-wrap: anywhere; word-break: normal; height: auto; max-height: none; line-height: 1.6; text-overflow: clip; }
#taskDrawer .job-error { display: block; white-space: pre-wrap; }

/* On-demand image editor: the image stays central, tools above, request below. */
#imageEditWindow { width: min(1100px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-raised); color: var(--text); box-shadow: 0 24px 100px #0004; }
#imageEditWindow::backdrop { background: #18202c88; backdrop-filter: blur(5px); }
#imageEditWindow #imageEditDock { margin: 0; border: 0; border-radius: 0; height: auto !important; max-height: calc(100dvh - 34px); }
#imageEditWindow #imageEditDock > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
#imageEditWindow [data-close-edit] { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-raised); color: var(--text); font-size: 22px; cursor: pointer; }
#imageEditWindow .edit-dock-body { overflow: auto; padding: 12px 24px; }
#imageEditWindow .image-edit-source-heading, #imageEditWindow .image-edit-source-actions, #imageEditWindow .image-edit-source-meta { display: none; }
#imageEditWindow #imageEditDock .image-edit-source { position: relative; display: flex; justify-content: center; align-items: center; height: auto; max-height: none; min-height: 120px; border: 0; background: transparent; overflow: hidden; }
#imageEditWindow #imageEditDock .image-edit-preview { flex: none; width: auto; height: auto; max-width: 100%; max-height: 48dvh; border-radius: 8px; cursor: default; }
#imageEditWindow .edit-drawing-canvas { position: absolute; touch-action: none; cursor: crosshair; }
#imageEditWindow .edit-drawing-tools { display: grid; gap: 8px; justify-items: center; }
#imageEditWindow .edit-tool-modes, #imageEditWindow .edit-tool-options { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
#imageEditWindow .edit-drawing-tools button { min-height: 32px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); color: var(--text); cursor: pointer; }
#imageEditWindow .edit-drawing-tools button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-faint); }
#imageEditWindow .edit-drawing-tools button:disabled { opacity: .4; cursor: default; }
#imageEditWindow .edit-drawing-tools small { color: var(--muted); text-align: center; }
#imageEditWindow .edit-tool-options input[type=color] { width: 32px; height: 30px; padding: 2px; }
#imageEditWindow .edit-tool-options input[type=range] { width: 90px; }
#imageEditWindow .edit-tool-options input[type=text] { width: 190px; }
#imageEditWindow #imageEditDock .image-edit-prompt { min-height: 72px; height: 72px; margin: 0; border-radius: 14px; }
#imageEditWindow #imageEditDock > footer { grid-template-columns: minmax(0, 1fr) 120px; align-items: end; padding: 10px 24px 16px; gap: 16px; }
#imageEditWindow .edit-advanced-settings { margin: 0; max-height: 25dvh; overflow: auto; }
#imageEditWindow .edit-advanced-settings > summary { cursor: pointer; padding: 8px 0; }
#imageEditWindow .edit-advanced-settings .image-edit-preserve, #imageEditWindow .edit-dock-settings { margin-bottom: 10px; }
#imageEditWindow #imageEditDock .image-edit-preview { max-height: 36dvh; }
#imageEditWindow #imageEditDock #imageEditPrompt { min-height: 64px; height: 64px; }
#imageEditWindow [data-region-actions] > [data-region] { display: none; }
#imageEditWindow .edit-drawing-tools { position: sticky; top: -12px; z-index: 2; padding: 8px 0; background: var(--surface-raised); }

#canvasPanel { position: relative; }
#canvasSurface > #imageEditWindow { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; max-height: none; box-sizing: border-box; border: 0; border-radius: inherit; box-shadow: none; z-index: 20; overflow: hidden; }
#canvasSurface > #imageEditWindow:not([open]) { display: none; }
#canvasSurface > #imageEditWindow #imageEditDock { height: 100% !important; max-height: none; }
#canvasPanel.is-editing-image #canvasSurface > :not(#imageEditWindow) { visibility: hidden; }
#imageEditWindow > .reference-region-editor.is-contained-edit { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; box-sizing: border-box; z-index: 25; border: 0; border-radius: inherit; box-shadow: none; }
#imageEditWindow:has(> .is-contained-edit[open]) > #imageEditDock { visibility: hidden; }

/* Maximize the editing canvas; keep the familiar vertical tool strip beside it. */
#imageEditWindow #imageEditDock > header { padding: 6px 12px; flex: none; }
#imageEditWindow #imageEditDock .edit-dock-body { display: flex; flex: 1; min-height: 0; padding: 6px 10px; overflow: hidden; }
#imageEditWindow #imageEditDock #imageEditPanel { flex: 1; min-height: 0; gap: 6px; }
#imageEditWindow .edit-image-workspace { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; flex: 1; min-height: 0; }
#imageEditWindow .edit-image-workspace .edit-tool-modes { display: flex; flex-direction: column; align-self: start; align-items: center; flex-wrap: nowrap; gap: 5px; padding: 5px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); }
#imageEditWindow .edit-tool-modes button { display: grid; place-items: center; width: 34px; height: 34px; padding: 6px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
#imageEditWindow .edit-tool-modes button svg { width: 22px; height: 22px; }
#imageEditWindow .edit-tool-modes button[aria-pressed="true"] { color: var(--accent); background: var(--accent-faint); }
#imageEditWindow .edit-tool-modes button:hover { background: var(--surface-subtle); }
#imageEditWindow #imageEditDock .image-edit-source { min-height: 0; height: 100%; min-width: 0; border-radius: 8px; }
#imageEditWindow #imageEditDock .image-edit-preview { max-height: 100%; max-width: 100%; border-radius: 6px; }
#imageEditWindow .edit-drawing-tools { position: static; display: block; padding: 0; flex: none; background: transparent; }
#imageEditWindow .edit-tool-options { justify-content: flex-start; gap: 4px; }
#imageEditWindow .edit-tool-options button { padding: 4px 7px; min-height: 28px; }
#imageEditWindow [data-hint], #imageEditWindow .image-edit-prompt-label, #imageEditWindow .image-edit-prompt-meta { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#imageEditWindow #imageEditDock #imageEditPrompt { flex: none; height: 52px; min-height: 52px; max-height: 100px; }
#imageEditWindow #imageEditDock > footer { flex: none; padding: 6px 10px 8px; gap: 10px; }
#imageEditWindow .image-edit-region-actions:has([data-clear-region][hidden]) { display: none; }
#imageEditWindow .edit-drawing-tools[data-mode="view"] input[type=color], #imageEditWindow .edit-drawing-tools[data-mode="view"] input[type=range], #imageEditWindow .edit-drawing-tools[data-mode="erase"] input[type=color] { display: none; }
#imageEditWindow .edit-image-workspace { grid-template-columns: 42px clamp(120px, 24%, 240px) minmax(0, 1fr); }
#imageEditWindow .edit-prompt-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 8px 0; }
#imageEditWindow .edit-prompt-pane .image-edit-prompt-label, #imageEditWindow .edit-prompt-pane .image-edit-prompt-meta { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
#imageEditWindow #imageEditDock .edit-prompt-pane #imageEditPrompt { width: 100%; box-sizing: border-box; height: 180px; min-height: 120px; max-height: 60%; resize: vertical; }
#imageEditWindow .edit-drawing-tools[data-mode="select"] input[type=color], #imageEditWindow .edit-drawing-tools[data-mode="unselect"] input[type=color] { display: none; }

/* Match the surrounding workspace cards, including their clipped inner surfaces. */
#canvasSurface > #imageEditWindow {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgb(20 35 60 / 4%);
  overflow: hidden;
}
#canvasSurface > #imageEditWindow:focus:not(:focus-visible) { outline: none; }
#canvasSurface > #imageEditWindow:focus-visible { outline: 2px solid var(--accent-line); outline-offset: -2px; }
#canvasSurface > #imageEditWindow #imageEditDock { border-radius: 13px; overflow: hidden; }
#imageEditWindow #imageEditDock > header { background: var(--surface-raised); border-bottom: 0; }
#imageEditWindow #imageEditDock > footer { border-top: 1px solid var(--line); background: var(--surface-raised); }

#imageEditWindow .edit-image-workspace { grid-template-columns: 82px clamp(120px, 24%, 240px) minmax(0, 1fr); }
#imageEditWindow .edit-tool-palette { display: grid; grid-template-columns: repeat(2, 34px); align-content: start; align-self: start; gap: 5px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); }
#imageEditWindow .edit-tool-palette .edit-tool-modes, #imageEditWindow .edit-tool-palette .edit-drawing-tools, #imageEditWindow .edit-tool-palette .edit-tool-options { display: contents; }
#imageEditWindow .edit-tool-palette button { display: grid; place-items: center; width: 34px; height: 34px; min-height: 34px; padding: 6px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
#imageEditWindow .edit-tool-palette button svg { width: 22px; height: 22px; }
#imageEditWindow .edit-tool-palette button:hover { background: var(--surface-subtle); }
#imageEditWindow .edit-tool-palette button[aria-pressed="true"] { color: var(--accent); background: var(--accent-faint); }
#imageEditWindow .edit-tool-palette input { grid-column: 1 / -1; max-width: 100%; box-sizing: border-box; }
#imageEditWindow .edit-tool-palette input[type=range] { width: 73px; }
#imageEditWindow .edit-tool-palette input[type=text] { width: 73px; }
#imageEditWindow .edit-prompt-pane { align-self: start; }
#imageEditWindow .edit-prompt-pane #dockEditSubmit { margin-top: 2px; width: 100%; }
#imageEditWindow #imageEditDock > footer { grid-template-columns: 1fr; }

/* One control column and one image area, with a consistent spacing rhythm. */
#imageEditWindow .edit-image-workspace { grid-template-columns: clamp(160px, 25%, 248px) minmax(0, 1fr); gap: 16px; }
#imageEditWindow .edit-control-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 0; overflow-y: auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-sizing: border-box; }
#imageEditWindow .edit-control-sidebar .edit-prompt-pane { width: 100%; padding: 12px; gap: 8px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); }
#imageEditWindow #imageEditDock .edit-prompt-pane #imageEditPrompt { height: 132px; min-height: 100px; max-height: 240px; padding: 10px; border-radius: 9px; }
#imageEditWindow .edit-prompt-pane .image-edit-prompt-label { margin: 0; padding-top: 0; border-top: 0; line-height: 1.4; }
#imageEditWindow .edit-prompt-pane .image-edit-prompt-meta { font-size: 11px; color: var(--muted); }
#imageEditWindow .edit-control-sidebar .edit-tool-palette { width: 100%; box-sizing: border-box; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px; gap: 6px; background: var(--surface-subtle); }
#imageEditWindow .edit-tool-palette button { width: 100%; height: 36px; background: var(--surface-raised); border: 1px solid transparent; }
#imageEditWindow .edit-tool-palette button:disabled { opacity: .35; }
#imageEditWindow .edit-tool-palette button[aria-pressed="true"] { border-color: var(--accent-line); }
#imageEditWindow .edit-tool-palette input { order: 1; width: 100%; min-width: 0; margin-top: 4px; }
#imageEditWindow .edit-tool-palette input[type=range], #imageEditWindow .edit-tool-palette input[type=text] { width: 100%; }
#imageEditWindow .edit-tool-palette input[type=color] { width: 100%; height: 28px; }
#imageEditWindow #imageEditDock > footer { display: none; }
#imageEditWindow .edit-control-sidebar .edit-advanced-settings { border-top: 1px solid var(--line); padding-top: 8px; max-height: none; overflow: visible; }
#imageEditWindow #imageEditDock .edit-dock-body { padding: 12px; }
#imageEditWindow #imageEditDock .image-edit-source { background: var(--surface-subtle); border-radius: 12px; }
#imageEditWindow .edit-tool-palette [data-clear-selection] { grid-row: 3; grid-column: 2; }
#imageEditWindow .edit-tool-palette [data-undo] { grid-row: 4; grid-column: 1; }
#imageEditWindow .edit-tool-palette [data-redo] { grid-row: 4; grid-column: 2; }
#imageEditWindow .edit-tool-palette [data-apply] { grid-row: 5; grid-column: 1 / -1; }
#imageEditWindow #imageEditFeedback { min-width: 0; max-width: 100%; margin: 0; padding: 9px; border-radius: 8px; background: var(--accent-faint); color: var(--muted); font-size: calc(11px + var(--app-font-increase, 1pt)); line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
#imageEditWindow #imageEditFeedback.error { color: var(--danger); }
#imageEditWindow #imageEditPanel { min-width: 0; }
#imageEditWindow .edit-tool-palette button { height: 52px; grid-template-rows: 24px auto; gap: 2px; }
#imageEditWindow .edit-tool-palette button small { font-size: 10px; line-height: 1.2; white-space: nowrap; color: inherit; }
#imageEditWindow .edit-tool-palette [data-hint] { position: static; grid-column: 1 / -1; order: 2; width: auto; height: auto; clip-path: none; overflow: visible; margin: 6px 2px 0; font-size: 11px; line-height: 1.5; color: var(--muted); text-align: left; }
#imageEditWindow .edit-brush-cursor { position: absolute; z-index: 3; pointer-events: none; border: 1px solid white; outline: 1px solid #273746; border-radius: 50%; transform: translate(-50%, -50%); box-sizing: border-box; }
#imageEditWindow .edit-brush-cursor[data-erasing="true"] { border-style: dashed; background: rgb(255 255 255 / 15%); }
#imageEditWindow .edit-brush-cursor[hidden] { display: none; }
#imageEditWindow #dockEditSubmit:disabled { background: var(--surface-subtle); color: var(--muted); border: 1px solid var(--line); box-shadow: none; opacity: .55; cursor: not-allowed; transform: none; }

/* Shared notifications stay outside every workspace tab. */
#appNotifications { position: static; transform: none; width: 100%; min-width: 0; max-height: 57px; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 0; box-sizing: border-box; }
#appNotifications:empty { display: none; }
.topbar-launch-card > #appNotifications { flex: 0 0 auto; align-self: stretch; margin-top: 2px; padding-top: 0; border-top: 1px solid var(--line); }
#appNotifications .app-notification { flex: 0 0 auto; min-height: 56px; box-sizing: border-box; padding: 9px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 12px; line-height: 1.5; }
#appNotifications .app-notification + .app-notification { border-top: 1px solid var(--line); }
#appNotifications .app-notification.is-error { color: var(--danger-text, var(--text)); }
.app-notification { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--composer-card-solid); color: var(--text); box-shadow: 0 6px 24px rgb(0 0 0 / 14%); pointer-events: auto; font-size: 13px; line-height: 1.5; }
.app-notification-content { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.app-notification-content > strong, .app-notification-content > span { display: block; }
.app-notification.is-error { border-color: var(--danger-line); }
.app-notification-close { flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.app-notification-close:hover { background: var(--surface-hover); }
.app-notification-close:focus-visible { outline: 2px solid var(--accent); }
.moodboard-card.is-just-added { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: 0 0 0 3px var(--accent-faint); }

#imageEditWindow .edit-prompt-pane .edit-dock-settings { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr) minmax(0, 1fr); gap: 6px; width: 100%; }
#imageEditWindow .edit-prompt-pane .edit-dock-settings select { width: 100%; min-width: 0; min-height: 34px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background-color: var(--composer-card-solid); color: var(--text); font: inherit; font-size: 12px; }
#imageEditWindow .edit-output-help { font-size: 10px; color: var(--muted); line-height: 1.5; }
#imageEditWindow .edit-dock-settings select:disabled { opacity: .45; }

#imageEditWindow .edit-compare { position: absolute; z-index: 4; pointer-events: none; overflow: hidden; border-radius: 8px; }
#imageEditWindow .edit-compare[hidden] { display: none; }
#imageEditWindow .edit-compare > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; background: var(--surface-subtle); clip-path: inset(0 calc(100% - var(--compare-position)) 0 0); }
#imageEditWindow .edit-compare input { position: absolute; left: var(--compare-position); top: 50%; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
#imageEditWindow .edit-compare-divider { position: absolute; left: var(--compare-position); top: 0; bottom: 0; width: 1px; transform: translateX(-50%); background: rgb(255 255 255 / 92%); box-shadow: 0 0 0 1px rgb(0 0 0 / 12%); pointer-events: none; }
#imageEditWindow .edit-compare-before, #imageEditWindow .edit-compare-after { position: absolute; top: 48px; padding: 3px 7px; border-radius: 5px; background: rgb(0 0 0 / 50%); color: white; font-size: 11px; }
#imageEditWindow .edit-compare-before { left: 12px; } #imageEditWindow .edit-compare-after { right: 12px; }
#imageEditWindow .edit-tool-modes .edit-compare-toggle { position: static; border: 0; font: inherit; }
#imageEditWindow .edit-compare-toggle:disabled { color: var(--muted); }

/* Editing controls span the top; the photo owns the full width below. */
#imageEditWindow .edit-image-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
#imageEditWindow .edit-control-sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: 45vh; overflow: auto; align-items: stretch; }
#imageEditWindow .edit-control-sidebar .edit-prompt-pane { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: center; gap: 6px 14px; padding: 10px 12px; }
#imageEditWindow .edit-prompt-pane .image-edit-prompt-label { grid-column: 1; grid-row: 1; }
#imageEditWindow #imageEditDock .edit-prompt-pane #imageEditPrompt { grid-column: 1; grid-row: 2 / 4; height: 72px; min-height: 60px; max-height: 120px; }
#imageEditWindow .edit-prompt-pane .image-edit-prompt-meta { grid-column: 1; grid-row: 4; }
#imageEditWindow .edit-prompt-pane .edit-dock-settings { grid-column: 2; grid-row: 2; }
#imageEditWindow .edit-prompt-pane #dockEditSubmit { grid-column: 2; grid-row: 3; min-height: 34px; margin: 0; }
#imageEditWindow .edit-prompt-pane .edit-output-help { grid-column: 2; grid-row: 4; }
#imageEditWindow .edit-control-sidebar .edit-tool-palette { grid-template-columns: repeat(9, minmax(52px, 1fr)); align-items: start; align-self: stretch; gap: 4px; padding: 5px; }
#imageEditWindow .edit-tool-palette [data-clear-selection], #imageEditWindow .edit-tool-palette [data-undo], #imageEditWindow .edit-tool-palette [data-redo], #imageEditWindow .edit-tool-palette [data-apply] { grid-row: auto; grid-column: auto; }
#imageEditWindow .edit-tool-palette input { grid-column: span 3; }
#imageEditWindow .edit-tool-palette [data-hint] { margin: 2px 4px 0; }
#imageEditWindow .edit-control-sidebar .edit-advanced-settings { grid-column: 1 / -1; border: 0; padding: 0 4px; }
#imageEditWindow #imageEditDock .image-edit-source { grid-column: 1; grid-row: 2; min-height: 0; width: 100%; align-items: flex-start; }
@media (max-width: 850px) {
  #imageEditWindow .edit-control-sidebar .edit-prompt-pane { grid-template-columns: minmax(0, 1fr) 190px; }
  #imageEditWindow .edit-control-sidebar .edit-tool-palette { grid-template-columns: repeat(9, minmax(52px, 1fr)); }
}

#imageEditWindow .edit-control-sidebar > .edit-prompt-pane { grid-column: 1; grid-row: 1; align-self: stretch; }
#imageEditWindow .edit-control-sidebar > .edit-tool-palette { grid-column: 1; grid-row: 2; overflow-x: auto; }
#imageEditWindow .edit-control-sidebar > #imageEditFeedback { grid-column: 1 / -1; }

.topbar-create #generateButton .generation-icon { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linejoin: round; }
.topbar-create .task-stop { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; margin: 0 2px 0 5px; padding: 7px; border: 1px solid var(--danger-line, #e6c9c9); border-radius: 8px; background: #f9e4e4; color: #b63333; }
.topbar-create .task-stop svg { width: 18px; height: 18px; }
.topbar-create .task-stop:disabled { opacity: .35; background: var(--surface-subtle); color: var(--muted); border-color: var(--line); cursor: default; }
.topbar-create .task-stop:hover:not(:disabled) { background: #f2cccc; }
.topbar-create .task-stop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Keep the history title readable while only the entries scroll underneath. */
#taskDrawer .job-history-header { position: sticky; top: 0; z-index: 2; flex: 0 0 auto; box-sizing: border-box; min-height: 36px; height: auto; padding: 4px 38px 10px 0; margin: 0 0 6px; background: var(--composer-card-solid); }
#taskDrawer .job-history-header .generation-jobs-title { height: auto; min-height: 0; margin: 0; padding: 0; line-height: 1.6; white-space: normal; overflow: visible; }
#taskDrawer #generationJobsPanel { max-height: calc(var(--drawer-available-height, 65dvh) - 26px); scroll-padding-top: 50px; }
#taskDrawer .job-prompt-summary { max-width: 100%; box-sizing: border-box; height: auto; min-height: 28px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
#taskDrawer .job-notice-details, #taskDrawer .job-stop-details, #taskDrawer .job-status-copy { height: auto; overflow: visible; }

/* Submission above a compact, shared progress and status row. */
.app-topbar .topbar-launch-card { gap: 8px; padding: 10px 12px; }
.topbar-launch-card .task-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: 38px 28px; gap: 6px 4px; }
.topbar-launch-card .task-toolbar > .topbar-create { grid-column: 1 / -1; grid-row: 1; justify-self: stretch; justify-content: flex-end; height: 38px; min-height: 0; }
.topbar-launch-card .task-progress-group { grid-column: 1; grid-row: 2; height: 28px; min-height: 0; overflow: hidden; border-radius: 7px; }
.topbar-launch-card .task-progress-group .task-current { gap: 4px; padding: 0 6px; border-radius: 7px; }
.topbar-launch-card .task-current > [data-label],
.topbar-launch-card .task-progress-group .task-elapsed { font-size: calc(10px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-status-group { grid-column: 2; grid-row: 2; height: 28px; min-height: 0; padding: 0; }
.topbar-launch-card .task-status-group > .task-metric { min-height: 22px; padding: 0 5px; gap: 3px; }
.topbar-launch-card .task-toggle { grid-column: 3; grid-row: 2; height: 28px; min-height: 28px; padding: 0 5px; }

/* Give the launch card room for its heading, actions and status. */
@media (min-width: 901px) { .app-shell { --composer-width: 420px; } }
@media (min-width: 1200px) { .app-shell { --composer-width: 460px; } }
.app-topbar .topbar-launch-card { padding: 18px; gap: 16px; }
.topbar-launch-heading { min-height: 28px; padding: 0 4px; }
.topbar-launch-card .task-toolbar { grid-template-rows: 40px 30px; gap: 12px 8px; }
.topbar-launch-card .task-toolbar > .topbar-create { height: 40px; padding-inline: 6px; box-sizing: border-box; }
.topbar-launch-card .task-progress-group { height: 30px; }
.topbar-launch-card .task-progress-group .task-current { padding-inline: 10px; gap: 6px; }
.topbar-launch-card .task-status-group { height: 30px; }
.topbar-launch-card .task-status-group > .task-metric { padding-inline: 6px; gap: 4px; }
.topbar-launch-card .task-toggle { height: 30px; padding-inline: 7px; }
.topbar-launch-card #appNotifications { margin-top: 0; }

/* Keep actionable feedback with the generation settings, directly below the camera angle. */
.generation-options-bar > #appNotifications {
  grid-column: 1 / -1;
  order: 3;
  width: 100%;
  min-width: 0;
  max-height: 92px;
  margin: 2px 0 0;
  border-top: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-subtle) 72%, transparent);
  overflow-y: auto;
}
.generation-options-bar > #appNotifications .app-notification {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-size: 12px;
}
.generation-options-bar > #appNotifications .app-notification + .app-notification { border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 480px) {
  .app-topbar .topbar-launch-card { padding: 14px 12px; gap: 14px; }
  .topbar-launch-card .task-toolbar { column-gap: 4px; }
  .topbar-launch-card .task-status-group > .task-metric { padding-inline: 4px; }
  .topbar-launch-card .task-progress-group .task-current { padding-inline: 6px; gap: 4px; }
}

/* Output choices precede quantity while retaining the original form controls. */
.topbar-output-controls { display: flex; align-items: center; gap: 5px; min-width: 0; margin-right: auto; }
.topbar-output-controls #resolution { width: 61px; min-width: 61px; height: 32px; padding: 0 5px; border-radius: 7px; font-size: 12px; }
.topbar-output-controls #promptRatioControl { width: 88px; min-width: 72px; }
.topbar-output-controls .ratio-picker-trigger { height: 32px; padding: 0 6px; gap: 4px; border-radius: 7px; font-size: 12px; }
.topbar-output-controls .ratio-picker-shape { display: none; }
.topbar-launch-card .task-toolbar > .topbar-create { gap: 4px; }
@media (max-width: 480px) {
 .topbar-launch-card .task-toolbar #generateButton { min-width: 0; padding-inline: 7px; }
 .topbar-output-controls #promptRatioControl { width: 72px; }
}

/* Balanced output choices, quantity and primary action. */
.topbar-launch-card .task-toolbar { grid-template-rows: 44px 30px; }
.topbar-launch-card .task-toolbar > .topbar-create { height: 44px; align-items: center; padding: 4px 6px; gap: 6px; }
.topbar-output-controls { margin-right: 0; gap: 6px; flex: 0 0 auto; }
.topbar-output-controls #promptRatioControl { width: 80px; }
.topbar-launch-card .task-toolbar .topbar-quantity { width: 62px; height: 34px; gap: 2px; padding: 0 2px; box-sizing: border-box; }
.quantity-icon { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); }
.topbar-launch-card .task-toolbar .quantity-steps { width: 14px; flex: 0 0 14px; }
.topbar-launch-card .task-toolbar #generateButton { flex: 1 1 auto; min-width: 90px; height: 34px; padding-inline: 10px; }
.topbar-create .task-stop { margin: 0; }
@media (max-width: 480px) {
 .topbar-output-controls #promptRatioControl { width: 66px; min-width: 66px; }
 .topbar-output-controls #resolution { width: 54px; min-width: 54px; }
 .topbar-launch-card .task-toolbar > .topbar-create { gap: 4px; padding-inline: 4px; }
 .topbar-launch-card .task-toolbar #generateButton { min-width: 0; padding-inline: 6px; }
}

.topbar-launch-card .task-drawer { left: -1px; width: calc(100% + 2px); max-width: none; }
.task-toolbar .task-failed { cursor: default; }

.topbar-output-controls .candidate-variation-inline { margin: 0; padding: 0; border: 0; }
.topbar-output-divider { flex: 0 0 1px; width: 1px; height: 20px; background: var(--line); margin-inline: 2px; }
.topbar-output-controls:has(#promptRatioControl[hidden]) .topbar-output-divider,
.topbar-output-controls:has(#candidateVariationControl[hidden]) .topbar-output-divider { display: none; }
.topbar-output-controls .candidate-variation-toggle { min-width: 64px; height: 32px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--composer-card-solid); font-size: 12px; }
.topbar-engine { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-engine #model { min-width: 0; flex: 1 1 auto; }
.topbar-engine #resolution { width: 59px; min-width: 59px; height: 32px; padding: 0 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--composer-card-solid); color: var(--text); font-size: 12px; }
#promptField { padding-top: 16px; }
#promptField #prompt { padding-top: 14px; }
#promptField #promptCountControl { display: none; }

#composerSubmitBar .app-topbar-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
#composerSubmitBar .topbar-engine { flex: 1 1 auto; min-width: 0; }
#composerSubmitBar #railStatus { flex: 0 0 auto; margin: 0; white-space: nowrap; padding-inline: 4px; font-size: 11px; }
#composerSubmitBar #railSettingsButton { flex: 0 0 28px; }
#composerSubmitBar #railSettingsButton svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Stable disclosure control: one SVG, sized independently of text glyphs. */
.topbar-launch-card .task-toolbar .task-toggle {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  height: 30px; min-height: 30px; padding: 0 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--composer-card-solid);
  color: var(--muted); font-weight: 500; line-height: 1; box-shadow: none;
}
.task-toolbar .task-toggle [data-chevron] { display: block; flex: 0 0 14px; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transform: rotate(0deg); transform-origin: center; }
.task-toolbar .task-toggle[aria-expanded="true"] [data-chevron] { transform: rotate(180deg); }
.topbar-launch-card .task-toolbar .task-toggle[aria-expanded="true"] { background: var(--accent-faint); border-color: var(--accent-line); color: var(--accent); }
.topbar-launch-card .task-toolbar .task-toggle:focus:not(:focus-visible) { outline: none; }
.topbar-launch-card .task-toolbar .task-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Keep the action label and icon stationary during queue updates. */
#generateButton .button-label { display: inline-block; white-space: nowrap; }

#taskDrawer .job-history-header { padding-right: 0; }
#taskDrawer .job-history-clear { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 7px; }

/* Keep generation quality beside output resolution in the footer. */
#composerSubmitBar .compact-quality-control { flex: 0 0 88px; width: 88px; }
#composerSubmitBar #quality { width: 100%; min-width: 0; height: 32px; padding: 0 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--composer-card-solid); color: var(--text); font-size: 12px; }
#composerSubmitBar .compact-quality-label { display: none; }

#imageEditWindow .is-comparing .edit-drawing-canvas,
#imageEditWindow .is-comparing .edit-brush-cursor { visibility: hidden; pointer-events: none !important; }


#imageEditWindow .edit-brush-settings { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--composer-card-solid); }
#imageEditWindow .edit-brush-settings[hidden] { display: none; }
#imageEditWindow .edit-tool-palette .edit-brush-settings input[type=color] { appearance: none; flex: 0 0 32px; width: 32px; height: 32px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: transparent; cursor: pointer; overflow: hidden; }
#imageEditWindow .edit-brush-settings input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
#imageEditWindow .edit-brush-settings input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
#imageEditWindow .edit-brush-settings input[type=color]::-moz-color-swatch { border: 0; border-radius: 5px; }
#imageEditWindow .edit-tool-palette .edit-brush-settings input[type=range] { flex: 1; width: auto; min-width: 60px; accent-color: var(--accent); }
#imageEditWindow .edit-brush-value { min-width: 22px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
#imageEditWindow .edit-brush-presets { display: flex; gap: 4px; }
#imageEditWindow .edit-brush-presets button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
#imageEditWindow .edit-brush-presets button[aria-pressed=true] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-faint); }
#imageEditWindow .edit-brush-presets button span { display: block; border-radius: 50%; background: currentColor; }

/* Integrate image editing into the preview surface instead of a separate panel. */
#canvasSurface > #imageEditWindow {
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
}
#canvasSurface > #imageEditWindow #imageEditDock {
  position: relative;
  border-radius: inherit;
  background: transparent;
  overflow: hidden;
}
#imageEditWindow #imageEditDock > header {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
}
#imageEditWindow #imageEditDock > header h2 { display: none; }
#imageEditWindow [data-close-edit] {
  width: 34px;
  height: 34px;
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  box-shadow: 0 2px 10px rgb(20 35 60 / 10%);
}
#imageEditWindow #imageEditDock .edit-dock-body {
  position: relative;
  display: block;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
#imageEditWindow #imageEditDock #imageEditPanel {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}
#imageEditWindow .edit-image-workspace {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}
#imageEditWindow #imageEditDock .image-edit-source {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: inherit;
  background: var(--surface-subtle);
}
#imageEditWindow #imageEditDock .image-edit-preview {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
}
#imageEditWindow .edit-control-sidebar {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  z-index: 8;
  display: grid;
  grid-template-columns: 44px 270px;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  width: 322px;
  max-height: none;
  padding: 0;
  overflow: visible;
  pointer-events: none;
}
#imageEditWindow .edit-control-sidebar > * { pointer-events: auto; }
#imageEditWindow .edit-control-sidebar > .edit-tool-palette {
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: 42px;
  grid-auto-rows: 42px;
  align-content: start;
  width: 44px;
  max-height: 100%;
  padding: 4px 1px;
  gap: 4px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  box-shadow: 0 4px 18px rgb(20 35 60 / 9%);
  scrollbar-width: none;
}
#imageEditWindow .edit-tool-palette::-webkit-scrollbar { display: none; }
#imageEditWindow .edit-tool-palette .edit-tool-modes,
#imageEditWindow .edit-tool-palette .edit-drawing-tools,
#imageEditWindow .edit-tool-palette .edit-tool-options { display: contents; }
#imageEditWindow .edit-tool-palette button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 8px;
  grid-template-rows: 1fr;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
}
#imageEditWindow .edit-tool-palette button small { display: none; }
#imageEditWindow .edit-tool-palette button[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-faint);
}
#imageEditWindow .edit-tool-palette [data-clear-selection],
#imageEditWindow .edit-tool-palette [data-undo],
#imageEditWindow .edit-tool-palette [data-redo],
#imageEditWindow .edit-tool-palette [data-apply] { grid-column: 1; grid-row: auto; }
#imageEditWindow .edit-control-sidebar > .edit-prompt-pane {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-self: start;
  width: 270px;
  max-height: calc(100dvh - 120px);
  padding: 12px;
  gap: 8px;
  overflow-y: auto;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 6px 22px rgb(20 35 60 / 10%);
}
#imageEditWindow .edit-prompt-pane .image-edit-prompt-label,
#imageEditWindow .edit-prompt-pane .image-edit-prompt-meta,
#imageEditWindow .edit-prompt-pane .edit-dock-settings,
#imageEditWindow .edit-prompt-pane #dockEditSubmit,
#imageEditWindow .edit-prompt-pane .edit-output-help {
  display: block;
  position: static;
  width: 100%;
  height: auto;
  margin: 0;
  grid-column: auto;
  grid-row: auto;
  clip-path: none;
  overflow: visible;
  box-sizing: border-box;
}
#imageEditWindow #imageEditDock .edit-prompt-pane #imageEditPrompt {
  display: block;
  position: static;
  width: 100%;
  height: 88px;
  min-height: 72px;
  max-height: 160px;
  margin: 0;
  padding: 9px 10px;
  resize: vertical;
  box-sizing: border-box;
}
#imageEditWindow .edit-prompt-pane .edit-dock-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
#imageEditWindow .edit-prompt-pane .edit-brush-settings {
  display: flex;
  position: static;
  width: min(100%, var(--edit-image-width, 100%));
  justify-self: center;
  overflow-x: auto;
  padding: 8px;
  gap: 7px;
  box-sizing: border-box;
}
#imageEditWindow .edit-prompt-pane .edit-brush-settings[hidden] { display: none; }
#imageEditWindow .edit-prompt-pane .edit-brush-settings input[type=color] {
  appearance: none;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
}
#imageEditWindow .edit-prompt-pane .edit-brush-settings input[type=range] { flex: 1; width: 0; min-width: 40px; }
#imageEditWindow .edit-prompt-pane > input[type=text] {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--composer-card-solid);
  color: var(--text);
}
#imageEditWindow .edit-prompt-pane > [data-hint] {
  display: block;
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip-path: none;
  overflow: visible;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
#imageEditWindow .edit-control-sidebar > .edit-advanced-settings {
  grid-column: 2;
  grid-row: 2;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
}
#imageEditWindow .edit-control-sidebar > #imageEditFeedback { grid-column: 2; grid-row: 3; align-self: start; }
#imageEditWindow .edit-compare-toggle { left: auto; right: 12px; top: 56px; }
@media (max-width: 700px) {
  #imageEditWindow .edit-control-sidebar { grid-template-columns: 42px minmax(180px, 240px); width: min(290px, calc(100% - 58px)); }
  #imageEditWindow .edit-control-sidebar > .edit-prompt-pane { width: 100%; }
}

/* Fit three prompt lines by reclaiming unused space around the textarea. */
#promptField { padding-top: 8px; }
#promptField #generationComposerFields #prompt {
  min-height: 74px;
  height: 74px;
  padding-block: 3px;
  line-height: 1.5;
  overflow-y: auto;
}
#promptField .prompt-field-header {
  min-height: 16px;
  padding-top: 0;
  padding-bottom: 0;
}

/* The normal preview remains in place; editing adds controls around its bounds. */
.preview-corner-left { width: 64px; gap: 6px; }
.preview-corner-left [data-preview-delete]:hover { color: #d13d42; }
#canvasPanel.is-editing-image #canvasSurface > :not(#imageEditWindow) { visibility: visible; }
#canvasSurface > #imageEditWindow {
  pointer-events: none;
  background: transparent;
}
#imageEditWindow #imageEditDock,
#imageEditWindow #imageEditDock .edit-dock-body,
#imageEditWindow #imageEditDock #imageEditPanel,
#imageEditWindow .edit-image-workspace { background: transparent; }
#imageEditWindow #imageEditDock .image-edit-source {
  left: var(--edit-image-left, 0px);
  top: var(--edit-image-top, 0px);
  right: auto;
  bottom: auto;
  width: var(--edit-image-width, 100%);
  height: var(--edit-image-height, 100%);
  background: transparent;
  pointer-events: auto;
}
#imageEditWindow #imageEditDock .image-edit-preview { opacity: 0; }
#imageEditWindow .edit-control-sidebar {
  top: var(--edit-image-top, 12px);
  left: max(12px, calc(var(--edit-image-left, 68px) - 56px));
  bottom: auto;
  height: var(--edit-image-height, calc(100% - 24px));
  max-height: var(--edit-image-height, calc(100% - 24px));
  pointer-events: none;
}
#imageEditWindow #imageEditDock > header {
  top: calc(var(--edit-image-top, 0px) + 12px);
  left: calc(var(--edit-image-left, 0px) + 12px);
  right: auto;
  pointer-events: auto;
}
#imageEditWindow .edit-compare-toggle { right: auto; }

/* Prompt and tools share the editor's top row; expanded settings stay beside the photo. */
.preview-action-button {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 10px;
}
.preview-edit-toggle { left: 8px; top: 16px; color: var(--accent); }
.preview-edit-settings-toggle {
  left: 8px;
  top: 64px;
  color: var(--muted);
  pointer-events: auto;
}
.preview-edit-settings-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-faint);
}
#imageEditWindow .edit-control-sidebar {
  inset: auto;
  left: 64px;
  top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  width: calc(100% - 76px);
  height: auto;
  max-height: calc(var(--edit-image-top, 220px) - 24px);
  gap: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}
#imageEditWindow .edit-control-sidebar > .edit-tool-palette {
  position: static;
  order: 2;
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  grid-auto-rows: 52px;
  align-items: stretch;
  width: 100%;
  height: 66px;
  min-height: 66px;
  max-height: 66px;
  padding: 6px;
  gap: 3px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 4px 18px rgb(20 35 60 / 9%);
}
#imageEditWindow .edit-tool-palette button {
  display: grid;
  grid-template-rows: 22px auto;
  place-items: center;
  width: 100%;
  height: 52px;
  min-height: 52px;
  padding: 3px 1px 4px;
  gap: 2px;
  box-sizing: border-box;
  border-radius: 8px;
}
#imageEditWindow .edit-tool-palette button svg {
  width: 19px;
  height: 19px;
}
#imageEditWindow .edit-tool-palette button small {
  display: block;
  max-width: 30px;
  color: inherit;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.05;
  white-space: normal;
  word-break: keep-all;
  text-align: center;
}
#imageEditWindow .edit-tool-palette [data-clear-selection],
#imageEditWindow .edit-tool-palette [data-undo],
#imageEditWindow .edit-tool-palette [data-redo],
#imageEditWindow .edit-tool-palette [data-apply] {
  grid-column: auto;
  grid-row: auto;
}
#imageEditWindow .edit-control-sidebar > .edit-prompt-pane {
  position: static;
  order: 1;
  grid-column: 1;
  grid-row: 1;
  left: auto;
  top: auto;
  width: 100%;
  max-height: none;
  padding: 12px;
  overflow: visible;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 4px 18px rgb(20 35 60 / 9%);
}
#imageEditWindow .edit-image-workspace > .edit-advanced-settings {
  position: absolute;
  display: none;
  left: auto;
  right: calc(100% - var(--edit-image-left, 340px) + 12px);
  top: 64px;
  width: min(320px, max(236px, calc(var(--edit-image-left, 340px) - 76px)));
  max-height: calc(100% - 80px);
  margin: 0;
  padding: 12px;
  overflow-y: auto;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 4px 18px rgb(20 35 60 / 9%);
}
#imageEditWindow .edit-image-workspace > .edit-advanced-settings[open] { display: block; }
#imageEditWindow .edit-advanced-settings > summary {
  display: none;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve {
  margin: 8px 0 0;
  padding-top: 10px;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve-option {
  position: relative;
  display: grid;
  grid-template-rows: 24px auto;
  place-items: center;
  min-height: 58px;
  padding: 6px 4px 5px;
  gap: 3px;
  white-space: normal;
  text-align: center;
  word-break: keep-all;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve-icon {
  width: 22px;
  height: 22px;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.15;
}
#imageEditWindow .edit-advanced-settings .image-edit-preserve-check {
  position: absolute;
  top: 4px;
  right: 5px;
  width: auto;
  color: var(--accent);
  font-size: 9px;
}
#imageEditWindow .edit-advanced-settings details { margin-top: 10px; }
#imageEditWindow .edit-image-workspace > #imageEditFeedback {
  position: absolute;
  left: 20px;
  right: auto;
  top: calc(var(--edit-image-top, 220px) + 178px);
  width: min(300px, max(220px, calc(var(--edit-image-left, 340px) - 32px)));
  margin: 0;
  box-sizing: border-box;
}

/* Preview and editing share the same photo bounds below. */
#imageEditWindow .edit-control-sidebar > .edit-prompt-pane {
  left: auto;
  width: 100%;
}
#imageEditWindow .edit-image-workspace > .edit-advanced-settings {
  width: min(320px, max(236px, calc(var(--edit-image-left, 340px) - 76px)));
}
#imageEditWindow .edit-image-workspace > #imageEditFeedback {
  width: min(328px, max(280px, calc(var(--edit-image-left, 340px) - 24px)));
}

@media (max-width: 700px) {
  #imageEditWindow .edit-control-sidebar {
    left: 64px;
    top: 12px;
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 76px);
  }
  #imageEditWindow .edit-control-sidebar > .edit-prompt-pane {
    grid-column: 1;
    grid-row: 1;
  }
  #imageEditWindow .edit-control-sidebar > .edit-tool-palette {
    grid-column: 1;
    grid-row: 2;
  }
  #imageEditWindow .edit-image-workspace > .edit-advanced-settings,
  #imageEditWindow .edit-image-workspace > #imageEditFeedback {
    position: static;
    width: auto;
    margin: 0 12px 12px;
  }
}

/* Keep the edit request compact at two visible lines by default. */
#imageEditWindow .edit-left-rail {
  position: absolute;
  left: 8px;
  top: 124px;
  width: min(360px, calc(100% - 16px));
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  z-index: 25;
  overscroll-behavior: contain;
  pointer-events: auto;
}
#imageEditWindow .edit-left-rail > .edit-advanced-settings {
  position: static;
  display: none;
  width: 100%;
  padding: 12px;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: 0 4px 16px rgb(20 35 60 / 8%);
}
#imageEditWindow .edit-left-rail > .edit-advanced-settings[open] { display: block; }
#imageEditWindow .edit-left-rail .image-edit-preserve { margin: 0; padding: 0; border: 0; gap: 8px; }
#imageEditWindow .edit-left-rail .image-edit-preserve-heading { min-height: 20px; font-size: 12px; flex-wrap: nowrap; }
#imageEditWindow .edit-left-rail .image-edit-preserve-heading small { font-size: 10px; white-space: nowrap; }
#imageEditWindow .edit-left-rail .image-edit-preserve-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#imageEditWindow .edit-left-rail .image-edit-preserve-option {
  height: 48px;
  min-height: 48px;
  grid-template-rows: 18px auto;
  padding: 4px 2px;
  gap: 2px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}
#imageEditWindow .edit-left-rail .image-edit-preserve-option[aria-pressed="true"] { background: var(--accent-faint); border-color: var(--accent-line); color: var(--accent); }
#imageEditWindow .edit-left-rail .image-edit-preserve-icon { width: 18px; height: 18px; }
#imageEditWindow .edit-left-rail .image-edit-preserve-label { font-size: 10px; line-height: 1.15; }
#imageEditWindow .edit-left-rail .edit-advanced-settings > details { font-size: 11px; }
#imageEditWindow .edit-left-rail .edit-advanced-settings > details pre { max-height: 120px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#imageEditWindow .edit-left-rail > .edit-tool-palette {
  position: static;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, 52px) auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 6px;
  gap: 4px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
}
#imageEditWindow .edit-control-sidebar > .edit-prompt-pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px 12px;
}
#imageEditWindow .edit-control-sidebar:empty { display: none; }
#imageEditWindow .edit-left-rail .edit-tool-palette > .edit-prompt-pane {
  grid-column: 1 / -1;
  grid-row: 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 2px 2px;
  border-top: 1px solid var(--line);
  box-sizing: border-box;
}
#imageEditWindow .edit-left-rail .edit-prompt-pane #dockEditSubmit {
  display: block;
  height: 36px;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}
#imageEditWindow .edit-prompt-pane .image-edit-prompt-label { grid-column: 1 / -1; }
#imageEditWindow .edit-prompt-pane .edit-prompt-input { grid-column: 1; grid-row: 2; }
#imageEditWindow .edit-prompt-pane #dockEditSubmit { grid-column: 2; grid-row: 2; align-self: stretch; }
#imageEditWindow .edit-prompt-pane > .edit-brush-settings,
#imageEditWindow .edit-prompt-pane > input[type=text],
#imageEditWindow .edit-prompt-pane > [data-hint] { grid-column: 1 / -1; }
#imageEditWindow .edit-prompt-pane > [data-hint]:empty { display: none; }
#imageEditWindow .edit-control-sidebar > .edit-tool-palette { overflow-x: auto; }
#imageEditWindow .edit-prompt-input { position: relative; min-width: 0; }
#imageEditWindow .edit-prompt-input .image-edit-prompt-meta {
  position: absolute;
  right: 12px;
  bottom: 5px;
  width: auto;
  font-size: 9px;
  line-height: 1.3;
  pointer-events: none;
}
#imageEditWindow #imageEditDock .edit-prompt-pane #imageEditPrompt {
  height: 58px;
  min-height: 58px;
  max-height: 140px;
  line-height: 1.45;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* Keep the prompt above the photo and group tools with brush settings on the left. */
#canvasPanel #canvasSurface { padding: 0; container-type: inline-size; container-name: edit-photo; }
#canvasPanel #canvasImageLink { padding: 76px 16px 16px 16px; transition: padding-left 240ms ease; }
#canvasPanel:not(.is-editing-image) .canvas-image-link.opens-original:not(:disabled):not(.is-privacy-obscured) img { cursor: zoom-in; }
#canvasPanel.is-editing-image #canvasImageLink { padding-left: 64px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette {
  position: absolute;
  left: 8px;
  right: auto;
  top: 116px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, 32px) auto;
  width: 40px;
  max-width: none;
  height: auto;
  padding: 6px;
  gap: 4px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  overflow: visible;
  pointer-events: auto;
}
#imageEditWindow .edit-image-workspace > .edit-tool-palette button { width: 100%; height: 40px; min-height: 40px; padding: 2px; grid-template-rows: 18px auto; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette button svg { width: 16px; height: 16px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette button small { max-width: none; font-size: 8px; white-space: nowrap; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane {
  position: absolute;
  left: var(--edit-image-left, 16px);
  right: auto;
  width: var(--edit-image-width, calc(100% - 32px));
  top: max(52px, calc(var(--edit-image-top, 76px) - 16px));
  transform: translateY(-100%);
  bottom: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  align-items: center;
  gap: 8px;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: auto;
}
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .image-edit-prompt-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .edit-prompt-input { grid-column: 1 / -1; grid-row: 1; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane #dockEditSubmit { grid-column: 2; grid-row: 1; z-index: 1; align-self: center; width: 62px; min-width: 0; min-height: 34px; height: 34px; margin-right: 6px; padding: 0 4px; border-radius: 8px; font-size: 11px; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .image-edit-prompt-meta { right: 78px; bottom: 3px; font-size: 8px; }
#imageEditWindow #imageEditDock .edit-image-workspace > .edit-prompt-pane #imageEditPrompt {
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 5px 78px 14px 12px;
  font-size: 12px;
  line-height: 19px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  box-shadow: 0 2px 5px rgb(20 35 60 / 4%);
  resize: none;
}

#imageEditWindow .edit-image-workspace > .edit-tool-palette > .edit-brush-settings {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 2px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
}
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=color] { grid-column: 1; grid-row: 1; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-value { grid-column: 2; grid-row: 1; text-align: right; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=range] { grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0; margin: 0; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-presets { grid-column: 1 / -1; grid-row: 3; justify-content: space-between; }
#imageEditWindow .edit-tool-palette .edit-brush-presets button { width: 30px; height: 28px; min-height: 28px; grid-template-rows: 1fr; padding: 0; }
#imageEditWindow .edit-tool-palette > [data-hint] { grid-column: 1 / -1; margin: 6px 0 0; padding: 8px 2px 4px; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.5; color: var(--muted); }
#imageEditWindow .edit-tool-palette > [data-hint]:empty { display: none; }

/* One active-ring width across photo cards and bordered selection controls. */
:root { --active-border-width: 2px; }
:is(.workboard-card, .moodboard-card, .gallery-card).is-selected .moodboard-selection-check,
#createMoodboardDock .moodboard-card.is-selected .moodboard-selection-check {
  display: grid; top: 7px; right: 7px; left: auto; z-index: 6;
  width: min(24px, 38%); height: auto; aspect-ratio: 1;
  color: #fff; background: #505660; border: 1px solid #ffffffd9;
  box-shadow: 0 1px 4px #0003; opacity: 1;
}
:is(.workboard-card, .moodboard-card, .gallery-card).is-selected .moodboard-selection-check svg { width: 70%; height: 70%; }
body :is(
  .preview-thumbnail.is-active,
  .reference-role-card.has-reference,
  .option-button.is-selected,
  .count-button.is-selected,
  .theme-option.is-selected,
  .prompt-preset-button[aria-selected="true"],
  .shot-size-option[aria-pressed="true"],
  .preview-action-button[aria-pressed="true"],
  .custom-reference-choices button[aria-pressed="true"],
  .image-edit-preserve-option[aria-pressed="true"],
  .edit-tool-palette button[aria-pressed="true"],
  .reference-region-tools button[aria-pressed="true"],
  .background-color-choice[aria-pressed="true"]
) {
  outline: var(--active-border-width) solid var(--accent);
  outline-offset: calc(-1 * var(--active-border-width));
}
/* Series selection uses a shared wash; auto is a quiet reset, not a variant. */
body .shot-size-picker.is-camera-series .shot-size-option:not(:focus-visible),
body .shot-size-picker .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"]):not(:focus-visible) { outline: none; }
body .shot-size-picker .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"]) { color: var(--muted); font-weight: 500; }
body .shot-size-picker .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"])[aria-pressed="true"] { background: color-mix(in srgb, var(--text) 5%, transparent); }
body .shot-size-picker .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"]) > .shot-icon { color: inherit; }
.camera-series-button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-faint); }
@media (forced-colors: active) {
  body .shot-size-picker .shot-size-option[aria-pressed="true"]:not(:focus-visible) { outline: 1px solid Highlight; outline-offset: -2px; }
}
@media (forced-colors: active) {
  :is(.workboard-card, .moodboard-card, .gallery-card).is-selected {
    outline: var(--active-border-width) solid Highlight;
    outline-offset: calc(-1 * var(--active-border-width));
  }
}

/* A 40px vertical palette aligned with the settings button. */
#imageEditWindow .edit-image-workspace > .edit-tool-palette { padding: 3px; gap: 3px; border-radius: 10px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette button { height: 32px; min-height: 32px; grid-template-rows: 1fr; padding: 5px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette button small { display: none; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette > .edit-brush-settings { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 7px 0 0; margin-top: 3px; justify-items: center; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=color] { grid-column: 1; grid-row: 1; width: 30px; height: 30px; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-value { grid-column: 1; grid-row: 2; text-align: center; font-size: 10px; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=range] { grid-column: 1; grid-row: 3; writing-mode: vertical-lr; direction: rtl; width: 26px; min-width: 0; height: 72px; margin: 2px 0; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-presets { grid-column: 1; grid-row: 4; display: flex; flex-direction: column; gap: 3px; padding-top: 6px; border-top: 1px solid var(--line); }
#imageEditWindow .edit-tool-palette .edit-brush-presets button { width: 30px; height: 26px; min-height: 26px; padding: 0; }
#imageEditWindow .edit-tool-palette > [data-hint] { position: absolute; left: 46px; bottom: 0; width: 180px; margin: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); box-shadow: var(--shadow-control); opacity: 0; pointer-events: none; }
#imageEditWindow .edit-tool-palette:hover > [data-hint],
#imageEditWindow .edit-tool-palette:focus-within > [data-hint] { opacity: 1; }

/* Quiet glass handle; the photo itself remains the pointer interaction surface. */
#imageEditWindow .edit-compare-handle { position: absolute; left: clamp(17px, var(--compare-position), calc(100% - 17px)); top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 30px; height: 40px; box-sizing: border-box; border: 1px solid rgb(255 255 255 / 80%); border-radius: 10px; background: rgb(250 250 252 / 88%); color: #4b4c51; backdrop-filter: blur(12px); box-shadow: 0 1px 5px rgb(0 0 0 / 18%); pointer-events: none; }
#imageEditWindow .edit-compare-handle svg { width: 22px; height: 22px; }
#imageEditWindow .edit-compare input:focus-visible ~ .edit-compare-handle { outline: var(--active-border-width, 2px) solid var(--accent); outline-offset: 2px; }
@media (forced-colors: active) {
  #imageEditWindow .edit-compare-divider { background: CanvasText; }
  #imageEditWindow .edit-compare-handle { background: Canvas; color: CanvasText; border-color: CanvasText; }
}

/* Explicit edit toggle and a brief, non-interactive mode announcement. */
.preview-edit-toggle { color: var(--muted); }
.preview-edit-toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-faint); }
.edit-mode-feedback { position: absolute; z-index: 35; transform: translate(-50%, -50%); padding: 0; border: 0; background: transparent; color: #fff; box-shadow: none; font-size: 16px; font-weight: 600; text-shadow: 0 1px 5px rgb(0 0 0 / 70%); white-space: nowrap; opacity: 0; pointer-events: none; }
.edit-mode-glow { position: absolute; z-index: 34; box-sizing: border-box; pointer-events: none; opacity: 0; background: transparent; border: 0; box-shadow: 0 0 5px 1px rgb(0 122 255 / 42%), 0 0 18px 4px rgb(0 122 255 / 28%), 0 0 32px 7px rgb(0 122 255 / 16%); transition: opacity 220ms ease-out; }
@media (prefers-reduced-motion: reduce) { .edit-mode-glow { transition: none; } }
@media (prefers-reduced-motion: reduce) { .edit-mode-feedback { transition: none; } }

/* Editing is visible on the outer frame without changing photo geometry. */
#canvasPanel.is-editing-image #canvasSurface {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
@media (forced-colors: active) {
  #canvasPanel.is-editing-image #canvasSurface { background: Canvas; }
}

/* Align drawing tools with the actual photo, independent of prompt height. */
#imageEditWindow .edit-image-workspace > .edit-tool-palette { top: var(--edit-image-top, 76px); grid-template-rows: none; grid-auto-rows: auto; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette [data-undo] { position: relative; margin-top: 7px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette [data-undo]::before { content: ""; position: absolute; top: -5px; left: 2px; right: 2px; border-top: 1px solid var(--line); }

/* Compact sidebar toggle; the icon stays in place while its tools open beside the photo. */
#canvasSurface > .preview-edit-toggle { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
#canvasSurface > .preview-edit-toggle[aria-pressed="true"] { outline: none; background: var(--density-selected-bg); color: var(--text); }
#canvasSurface > .preview-edit-toggle:hover { background: var(--density-selected-bg); color: var(--text); }
#canvasSurface > .preview-edit-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#imageEditWindow[open] .edit-image-workspace > .edit-tool-palette { animation: edit-sidebar-reveal 160ms ease-out both; }
@keyframes edit-sidebar-reveal { from { opacity: .85; transform: translateX(-2px); } to { opacity: 1; transform: translateX(0); } }

/* Separate white photo backgrounds from the surrounding library surface. */
.preview-window-title { position: absolute; top: 22px; left: 62px; z-index: 2; margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none; }
#canvasPanel.is-editing-image .preview-window-title { display: none; }
:root { --photo-card-edge: rgb(205 213 227 / 28%); --photo-card-shadow: 0 1px 3px rgb(0 0 0 / 18%); }
:root[data-theme="light"] { --photo-card-edge: #d3d7dd; --photo-card-shadow: 0 1px 3px rgb(25 35 50 / 8%); }
body :is(.moodboard-card, .workboard-card, .gallery-card, .included-card),
body #createMoodboardDock .moodboard-card { border-color: var(--photo-card-edge); }
body :is(.moodboard-card, .workboard-card, .gallery-card, .included-card):not(:focus-within),
body #createMoodboardDock .moodboard-card:not(:focus-within) { box-shadow: var(--photo-card-shadow); }
@media (prefers-reduced-motion: reduce) { #canvasPanel #canvasImageLink { transition: none; } #imageEditWindow[open] .edit-image-workspace > .edit-tool-palette { animation: none; } }

/* Quiet, aligned utility controls; connection state stays in the status dot and text. */
.workspace-account-actions { gap: 8px; }
.workspace-account-actions #railSettingsButton,
.workspace-account-actions #railStatus {
  min-height: 40px; height: 40px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface-raised); color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
  transition: background-color 140ms ease, border-color 140ms ease;
}
.workspace-account-actions #railSettingsButton { padding: 0 11px; gap: 7px; font-weight: 500; color: var(--muted); }
.workspace-account-actions #railSettingsButton svg { width: 16px; height: 16px; stroke-width: 1.6; }
.workspace-account-actions #railStatus { padding: 5px 10px 5px 7px; gap: 8px; }
.workspace-account-actions #railStatus .gpt-account-avatar { width: 27px; height: 27px; flex-basis: 27px; border-radius: 50%; }
.workspace-account-actions #railStatus .gpt-account-name { color: var(--text); font-size: 12px; font-weight: 600; max-width: 112px; }
.workspace-account-actions #railStatus .gpt-account-copy { gap: 3px; }
.workspace-account-actions #railStatus .gpt-account-copy strong { font-size: 10px; font-weight: 400; line-height: 1.1; color: var(--muted); }
.workspace-account-actions #railStatus .rail-status-dot { width: 6px; height: 6px; flex: 0 0 6px; box-shadow: none; margin-left: 3px; }
.workspace-account-actions #railStatus.offline .gpt-account-copy strong { color: var(--danger-text); }
.workspace-account-actions #railStatus.login-required .gpt-account-copy strong { color: var(--accent); }
.workspace-account-actions #railSettingsButton[aria-pressed="true"] { background: var(--accent-faint); color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .workspace-account-actions #railSettingsButton:hover,
  .workspace-account-actions #railStatus:hover { background: var(--surface-hover); border-color: var(--line-strong); }
}
.workspace-account-actions #railSettingsButton:active,
.workspace-account-actions #railStatus:active { background: var(--surface-subtle); transition: none; }
@media (max-width: 720px) {
  .workspace-account-actions #railSettingsButton,
  .workspace-account-actions #railStatus { width: 40px; min-width: 40px; padding: 5px; justify-content: center; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace-account-actions #railSettingsButton,
  .workspace-account-actions #railStatus { transition: none; }
}

/* Explicit person replacement target beside the pose selector. */
.composer-fields .reference-role-grid > .reference-role-card[data-reference-role="person"] { min-height: 166px; padding-bottom: 76px; }
.person-replace-drop { position: absolute; left: 9px; bottom: 9px; right: auto; width: 40px; min-width: 0; box-sizing: border-box; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 4px; border: 1px dashed var(--accent-line); border-radius: 8px; background: var(--accent-faint); color: var(--accent); font-size: 10px; white-space: nowrap; pointer-events: none; }
.person-replace-drop svg { width: 18px; height: 18px; flex: 0 0 18px; }
.reference-role-card .reference-quick-replace { pointer-events: auto; cursor: pointer; }
.reference-role-card .reference-quick-replace:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reference-role-card .reference-quick-replace:hover { background: var(--accent-soft); }
.composer-fields .reference-role-grid > .reference-role-card.has-quick-replace { min-height: 166px; padding-bottom: 76px; }
.composer-fields .reference-role-card.has-quick-replace.has-multiple-references { min-height: 213px; }
.composer-fields .reference-role-card.has-quick-replace .reference-count-thumbnails { bottom: 78px; }
.reference-role-card.has-quick-replace.is-dragging .reference-quick-replace { border-style: solid; background: var(--accent-soft); }
.reference-role-card[data-reference-role="person"].is-dragging .person-replace-drop { border-style: solid; background: var(--accent-soft); }
.composer-fields .reference-role-card[data-reference-role="person"].has-multiple-references { min-height: 213px; }
.composer-fields .reference-role-card[data-reference-role="person"] .reference-count-thumbnails { bottom: 78px; }



/* Settings sits beside the wordmark, centered within the heading row. */
.topbar-launch-heading #railSettingsButton { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; min-width: 32px; height: 32px; min-height: 32px; margin: 0 0 0 auto; padding: 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); box-shadow: none; }
.topbar-launch-heading #railSettingsButton svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.topbar-launch-heading #railSettingsButton:hover, .topbar-launch-heading #railSettingsButton[aria-pressed="true"] { background: var(--accent-faint); color: var(--accent); }
.topbar-launch-heading #railSettingsButton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.person-replace-drop > span { position: absolute; left: 0; bottom: calc(100% + 4px); width: max-content; max-width: 100px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.3; white-space: nowrap; pointer-events: none; }

/* Independent browser sidebar preserves the active workspace. */
#browserPanel { grid-area: auto; position: absolute; inset: var(--browser-sidebar-top, 64px) 12px 12px auto; z-index: 40; width: min(400px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: -6px 0 24px rgb(20 35 60 / 10%); background: var(--composer-card-solid); }
.browser-sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.browser-sidebar-heading strong { font-size: 13px; }
#browserSidebarClose { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
#browserSidebarClose:hover { background: var(--surface-subtle); }
#browserSidebarClose:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#browserPanel .browser-controls { flex-wrap: wrap; padding: 8px; }
#browserPanel #browserAddress { flex: 1 1 180px; order: -1; }
#browserPanel .browser-controls button[type=submit] { order: -1; }
#browserPanel #browserExternal { margin-left: auto; }
#workspace-tab-browser[aria-expanded=true] { background: var(--accent-faint); color: var(--accent); }
@media (min-width: 1400px) {
  body.browser-sidebar-open .stage { padding-right: 412px; }
  body.browser-sidebar-open .stage > .workspace-nav { width: calc(100% + 412px); }
}

/* Keep translated generation sentences readable in compact toolbars. */
.task-current > [data-label] { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }

.topbar-launch-card .task-progress-group { height: auto; min-height: 30px; }
.topbar-launch-card .task-progress-group .task-current { height: auto; min-height: 30px; padding-block: 4px; }
.topbar-launch-card .task-current > [data-label] { flex: 1 1 auto; overflow: visible; text-overflow: clip; }

.topbar-launch-card .task-toolbar { grid-template-rows: 40px minmax(30px, auto); }

/* Reserve a full row for the active generation sentence and elapsed time. */
.topbar-launch-card .task-toolbar[data-generating="true"] { grid-template-rows: 40px minmax(30px, auto) 30px; }
.topbar-launch-card .task-toolbar[data-generating="true"] .task-progress-group { grid-column: 1 / -1; }
.topbar-launch-card .task-toolbar[data-generating="true"] .task-status-group { grid-column: 1 / 3; grid-row: 3; }
.topbar-launch-card .task-toolbar[data-generating="true"] .task-toggle { grid-row: 3; }

/* Multi-image controls occupy their own bottom row instead of covering the heading. */
.composer-fields .reference-role-grid > .reference-role-card.has-multiple-references:has(> .reference-role-region-actions) { display: flex; flex-direction: column; height: auto; min-height: 180px; padding-bottom: 8px; }
.composer-fields .reference-role-card.has-multiple-references > .reference-role-region-actions { position: static; margin: auto 8px 0; padding-top: 12px; justify-content: space-between; align-items: flex-end; }
.reference-role-card.has-multiple-references .reference-region-targets { flex: 1 1 94px; min-width: 94px; padding: 4px 2px 2px; gap: 6px; }
.reference-role-card.has-multiple-references .reference-region-target { flex-basis: 42px; }
.reference-role-card.has-multiple-references .reference-region-target-button { width: 42px; height: 42px; }
.reference-role-card.has-multiple-references .custom-reference-refine { margin-left: auto; max-width: 100%; white-space: normal; }
.composer-fields .reference-role-grid > .reference-role-card.has-multiple-references:has(> .reference-role-region-actions) { max-height: none; overflow: visible; }
.composer-fields .reference-role-card.has-multiple-references > .reference-role-region-actions { flex-shrink: 0; }
#generationReferences .reference-role-card.has-multiple-references:has(> .reference-role-region-actions) { height: auto; min-height: 180px; padding-bottom: 8px; }

/* Optical alignment uses the SVG artwork bounds rather than its export margins. */
.topbar-launch-heading .app-wordmark { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px; line-height: 0; }
.app-wordmark img { display: block; width: 116px; height: auto; flex: 0 0 auto; object-fit: contain; }
.app-wordmark .app-brand-symbol { width: 22px; height: auto; }
.app-wordmark .app-brand-name { font-family: 'Nunito Brand', sans-serif; font-weight: 900; font-size: calc(24px + var(--app-font-increase, 1pt)); line-height: 1.15; letter-spacing: -.04em; color: var(--text); }
[data-theme="dark"] .app-wordmark img { filter: brightness(0) invert(1); }
@media (max-width: 900px) {
  .topbar-launch-heading .app-wordmark { gap: 7px; min-height: 36px; }
  .app-wordmark img { width: 108px; }
  .app-wordmark .app-brand-symbol { width: 20px; }
  .app-wordmark .app-brand-name { font-size: calc(22px + var(--app-font-increase, 1pt)); }
}

/* User supplied final brand lockup, 2026-09-15. */
.app-wordmark .app-brand-final { width: 150.6853px; height: 30px; }
@media (max-width: 900px) { .app-wordmark .app-brand-final { width: 140.6396px; height: 28px; } }

/* Compact sidebar control and aligned preview heading. */
#canvasSurface > #workspace-tab-browser, .moodboard-header > #workspace-tab-browser { flex: 0 0 40px; width: 40px; min-width: 40px; height: 40px; padding: 10px; display: inline-flex; align-items: center; justify-content: center; }
#canvasSurface > #workspace-tab-browser svg, .moodboard-header > #workspace-tab-browser svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.preview-window-title { top: 16px; left: 52px; min-height: 40px; display: flex; align-items: center; color: var(--text); font-size: var(--ui-section-title-size); font-weight: 600; line-height: 1.45; letter-spacing: 0; }

/* Same quiet grip as the existing asset/library splitters. */
.workspace-width-splitter { position: fixed; width: 12px; z-index: 45; cursor: col-resize; touch-action: none; border-radius: 6px; }
.workspace-width-splitter[hidden] { display: none; }
.workspace-width-splitter::after { content: ''; position: absolute; left: 4px; top: calc(50% - 16px); width: 3px; height: 32px; border-radius: 3px; background: #a4aab5; opacity: 0; }
.workspace-width-splitter:is(:hover,:focus-visible,:active)::after { opacity: 1; background: #727985; }
.workspace-width-splitter:focus-visible { outline: none; }
.workspace-width-splitter:focus-visible::after { outline: 1px solid var(--accent); outline-offset: 3px; }
.is-resizing-workspace, .is-resizing-workspace * { cursor: col-resize !important; user-select: none !important; }
.stage #browserPanel { width: min(var(--workspace-browser-width, 400px), calc(100% - 24px)); }
@media (min-width: 1100px) {
  body[data-active-view="create"] .stage.has-width-controls:not(.has-contained-preview):not(#canvasPanel) { grid-template-columns: minmax(0, 1fr) var(--workspace-assets-width, 280px); }
}
@media (min-width: 1400px) {
  body.browser-sidebar-open .stage { padding-right: calc(var(--workspace-browser-width, 400px) + 12px); }
  body.browser-sidebar-open .stage > .workspace-nav { width: calc(100% + var(--workspace-browser-width, 400px) + 12px); }
}

/* Mini browser belongs to the image preview window. */
#canvasSurface > #workspace-tab-browser { position: absolute; top: 16px; right: 12px; left: auto; z-index: 6; margin: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); box-shadow: none; }
#canvasSurface > #workspace-tab-browser:hover { background: var(--density-selected-bg); color: var(--text); }
#canvasSurface > #workspace-tab-browser[aria-expanded="true"] { background: var(--accent-faint); color: var(--accent); }
#canvasSurface > #workspace-tab-browser:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview-window-title { right: 60px; }

/* Match the browser chrome to the surrounding workspace panels. */
.stage #browserPanel { background: color-mix(in srgb, var(--bg) 85%, var(--composer-card-solid)); box-shadow: none; }
.stage #browserPanel { overflow: hidden; }
body:not(.browser-sidebar-open) .workspace-width-splitter[data-pane="browser"] { visibility: hidden; }
#browserPanel .browser-sidebar-heading { box-sizing: border-box; min-height: 72px; padding: 16px 16px 16px 20px; border-bottom: 0; background: transparent; }
#browserPanel .browser-sidebar-heading strong { color: var(--text); font-size: var(--ui-section-title-size); font-weight: 600; line-height: 1.45; letter-spacing: 0; }
#browserSidebarClose { width: 32px; height: 32px; font-size: 20px; }
#browserPanel .browser-controls { gap: 6px; padding: 0 12px 8px; border-bottom: 0; background: transparent; }
#browserPanel #browserAddress { flex: 1 1 140px; box-sizing: border-box; min-height: 34px; padding: 7px 10px; border-radius: 8px; font-size: calc(11px + var(--app-font-increase, 1pt)); background: var(--surface-raised); }
#browserPanel .browser-controls :is(button,a) { box-sizing: border-box; min-height: 34px; padding: 6px 9px; color: var(--muted); font-size: calc(11px + var(--app-font-increase, 1pt)); background: transparent; }
#browserPanel .browser-controls button:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
#browserPanel .browser-bookmarks { flex-wrap: wrap; gap: 2px; padding: 0 12px 8px; min-height: 0; max-height: 100px; overflow-x: hidden; overflow-y: auto; background: transparent; border-bottom: 1px solid var(--line); }
#browserPanel .browser-bookmark { padding: 5px 7px; color: var(--muted); font-size: calc(10px + var(--app-font-increase, 1pt)); }
#browserPanel .browser-bookmark:hover { color: var(--text); }
#browserPanel #browserStatus { box-sizing: border-box; min-height: 28px; padding: 8px 20px 4px; background: transparent; font-size: calc(10px + var(--app-font-increase, 1pt)); }
#browserPanel #browserViewport { background: transparent; }
#browserPanel .browser-empty { justify-content: flex-start; align-items: flex-start; padding: clamp(28px, 6vh, 64px) 20px 24px; text-align: left; overflow: auto; }
#browserPanel .browser-empty strong { color: var(--text); font-size: var(--ui-section-title-size); font-weight: 600; line-height: 1.45; }
#browserPanel .browser-empty p { margin: 10px 0 0; max-width: 320px; color: var(--muted); font-size: calc(11px + var(--app-font-increase, 1pt)); line-height: 1.65; overflow-wrap: anywhere; }

.text-history-trigger { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--muted); cursor: pointer; }
.text-history-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.text-history-trigger:hover, .text-history-trigger[aria-expanded="true"] { color: var(--accent); background: var(--accent-faint); }
.text-history-trigger:disabled { opacity: .4; cursor: default; }
.text-history-panel { position: fixed; inset: auto; margin: 0; box-sizing: border-box; max-height: min(360px, calc(100vh - 24px)); overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--composer-card-solid); color: var(--text); box-shadow: 0 8px 24px rgb(20 35 60 / 14%); font-size: 12px; }
.text-history-panel > strong { font-size: var(--ui-section-title-size); font-weight: 600; }
.text-history-note { margin: 6px 0 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.text-history-list { display: grid; gap: 3px; }
.text-history-row { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: start; cursor: pointer; font: inherit; }
.text-history-row small { color: var(--muted); min-width: 18px; }
.text-history-row span { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.text-history-row:hover { background: var(--surface-hover); }
.text-history-row[aria-pressed="true"] { background: var(--accent-faint); color: var(--accent); }
.text-history-trigger:focus-visible, .text-history-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#imageEditWindow .edit-image-workspace > .edit-prompt-pane { grid-template-columns: minmax(0,1fr) 70px 92px; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .edit-prompt-input { grid-column: 1 / 3; }
#imageEditWindow .edit-reference-box { grid-column: 3; grid-row: 1; position: relative; box-sizing: border-box; height: 40px; min-width: 0; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-raised); overflow: hidden; }
#imageEditWindow .edit-reference-box [data-ref-choose] { display: grid; place-items: center; width: 100%; height: 100%; padding: 3px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 10px; cursor: pointer; }
#imageEditWindow .edit-reference-box img { max-width: 100%; height: 32px; object-fit: contain; }
#imageEditWindow .edit-reference-box [data-ref-remove] { position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--composer-card-solid); color: var(--text); cursor: pointer; }
#imageEditWindow .edit-reference-box button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

#imageEditWindow .edit-image-workspace > .edit-prompt-pane { left: 8px; right: 8px; width: auto; }
@media (max-width: 1400px) {
 #imageEditWindow .edit-image-workspace > .edit-prompt-pane { grid-template-columns: minmax(0,1fr) 70px 44px; gap: 6px; }
 #imageEditWindow .edit-reference-box [data-ref-label] { font-size: 0; }
 #imageEditWindow .edit-reference-box [data-ref-label]::after { content: '+'; font-size: 20px; }
}

/* One asset pane, with an inline source switch instead of nested tabs. */
#createAssetSourceButton { display: none; }
#createMoodboardDock #createAssetSourceButton {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; margin-left: auto; min-height: 28px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-raised); color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
#createMoodboardDock #createAssetSourceButton:hover { color: var(--text); background: var(--bg); }
#createMoodboardDock #createAssetSourceButton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#createMoodboardDock.show-samples > :not(.moodboard-header):not(#builtinModelLibrary):not(#assetSelectionBar) { display: none !important; }
#createMoodboardDock.show-samples .main-board-clear-actions,
#createMoodboardDock.show-samples #moodboardSelectionCount { display: none !important; }
#createMoodboardDock.show-samples #builtinModelLibrary { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#createMoodboardDock #builtinModelLibrary > header { display: none; }
#createMoodboardDock .builtin-model-content { padding: 12px; }
#createMoodboardDock .included-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }

/* Create workspace: preview, user images, then the browser sidebar. */
@media (min-width: 1100px) {
  body[data-active-view="create"] .stage > #canvasPanel:not(.has-contained-viewer) { grid-column: 1; }
  body[data-active-view="create"] .stage > #createSideRail { grid-column: 2; }
}
@media (max-width: 1099px) {
  body[data-active-view="create"] .stage > #canvasPanel:not(.has-contained-viewer) { grid-column: 1; grid-row: 2; }
  body[data-active-view="create"] .stage > #createSideRail { grid-column: 1; grid-row: 3; }
}

/* Keep multi-image reference cards compact without clipping their controls. */
#generationReferences .reference-role-card.has-multiple-references:has(> .reference-role-region-actions) { min-height: 120px; min-width: 0; }
#generationReferences .reference-role-card.has-multiple-references:has(> .reference-role-region-actions) .reference-role-picker { min-height: 60px; }
#generationReferences .reference-role-card.has-multiple-references > .reference-role-region-actions { margin-top: 0; padding-top: 4px; min-width: 0; }
#generationReferences .reference-role-card.has-multiple-references .reference-region-targets { min-width: 98px; padding-right: 4px; flex-basis: 98px; box-sizing: border-box; }

/* Related source controls sit by the title; browser access stays at the far edge. */
#createMoodboardDock .moodboard-header { display: flex; align-items: center; gap: 10px; }
#createMoodboardDock .moodboard-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
#createMoodboardDock #createAssetSourceButton {
  margin-left: 0; min-height: 28px; padding: 4px 8px; border-color: transparent;
  border-radius: 7px; background: var(--density-selected-bg); color: var(--muted);
  font-size: 11px; font-weight: 500; line-height: 18px;
}
.moodboard-header > #workspace-tab-browser {
  position: static; flex: 0 0 30px; width: 30px; min-width: 30px; height: 30px;
  margin-left: auto; padding: 6px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); box-shadow: none;
}
.moodboard-header > #workspace-tab-browser svg { width: 18px; height: 18px; flex-basis: 18px; }
.moodboard-header > #workspace-tab-browser:hover { background: var(--density-selected-bg); color: var(--text); }
.moodboard-header > #workspace-tab-browser[aria-expanded="true"] { background: var(--accent-faint); color: var(--accent); }
.moodboard-header > #workspace-tab-browser:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Copy controls remain available without occupying the whole reference column. */
.composer-fields .reference-role-card[data-reference-role="typography"] .basic-copy-options > summary {
  display: list-item; padding: 8px 0; color: var(--muted); font-size: 12px; cursor: pointer;
}
.composer-fields .reference-role-card[data-reference-role="typography"] .basic-copy-options { padding-top: 0; margin-bottom: 8px; }
.basic-copy-options #basicCopyEditor[hidden] { display: none !important; }
#basicCopySummary { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:44px; padding:10px 12px; box-sizing:border-box; border:1px solid var(--line); border-radius:9px; background:var(--composer-card-solid); color:var(--text); font:inherit; font-weight:500; text-align:start; }
#basicCopySummary [data-copy-preview] { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
#basicCopySummary [data-copy-action] { flex-shrink:0; color:var(--accent); font-size:12px; }
#basicCopySummary:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#basicCopyEditor { padding-top:12px; }
#generationReferences .reference-role-card[data-reference-role="typography"] > .reference-role-region-actions { position:static; margin:8px 12px 0; padding-top:8px; border-top:1px solid var(--line); }
#generationReferences .reference-role-card[data-reference-role="typography"] { padding-bottom:12px; }
.basic-copy-options > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Keep edit inputs aligned to the displayed photograph, reference on the left. */
#imageEditWindow .edit-image-workspace > .edit-prompt-pane {
  left: var(--edit-image-left, 16px); right: auto;
  width: var(--edit-image-width, calc(100% - 32px)); max-width: var(--edit-image-width, calc(100% - 32px));
  grid-template-columns: minmax(40px, 18%) minmax(0, 1fr) 70px;
}
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .edit-reference-box { grid-column: 1; grid-row: 1; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane .edit-prompt-input { grid-column: 2 / 4; grid-row: 1; min-width: 0; }
#imageEditWindow .edit-image-workspace > .edit-prompt-pane #dockEditSubmit { grid-column: 3; grid-row: 1; }

/* Browser opens on the right, so the sidebar glyph mirrors that placement. */
#workspace-tab-browser svg { transform: scaleX(-1); }

/* Keep image cards free of per-photo delete and favorite controls. */
.moodboard-card .moodboard-remove, .moodboard-card .library-like { display: none !important; }

/* One horizontal spacing rule for the create workspace panes. */
@media (min-width: 1100px) {
  body[data-active-view="create"] .app-shell { --app-gap: 16px; }
  body[data-active-view="create"] .stage { column-gap: 16px; }
  body[data-active-view="create"] .stage > #canvasPanel:not(.has-contained-viewer) { margin-left: 16px; margin-right: 0; }
  body[data-active-view="create"] .stage > #createSideRail { margin-left: 0; margin-right: 16px; }
}
@media (min-width: 1400px) {
  body[data-active-view="create"].browser-sidebar-open .stage { padding-right: calc(var(--workspace-browser-width, 400px) + 32px); }
  body[data-active-view="create"].browser-sidebar-open .stage > .workspace-nav { width: calc(100% + var(--workspace-browser-width, 400px) + 32px); }
  body[data-active-view="create"].browser-sidebar-open .stage > #createSideRail { margin-right: 0; }
  body[data-active-view="create"] .stage > #browserPanel { right: 16px; }
}

/* Prompt and launch controls share one surface; references own the lower panel. */
.launch-prompt-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; padding: 0; }
.launch-prompt-panel #promptField .prompt-field-header { min-height: 0; padding: 0; }
.launch-prompt-panel #promptField { margin: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--composer-card-solid); box-shadow: 0 1px 3px rgb(20 35 60 / 5%); }
.launch-prompt-panel #promptField:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-faint); }
.launch-prompt-panel .prompt-draft-label { font-weight: 650; }
.launch-prompt-panel .prompt-section-heading { padding-inline: 2px; }
.composer-fields > #generationReferences { padding-top: 0; border-top: 0; }

/* Keep the receiving edge visible around an OS-owned external drag preview. */
.reference-drop-hint { display: none; pointer-events: none; }
.composer-panel .reference-role-card.is-dragging {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  box-shadow: inset 0 -5px 0 var(--accent);
}
.reference-role-card.is-dragging .reference-drop-hint {
  display: block;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 3px 10px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
/* Persistent last-job display, with in-flow history instead of an overlay. */
.app-shell > .app-topbar { display: flex; flex-direction: column; gap: 10px; }
.topbar-launch-card .task-toolbar.launch-actions { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0; border: 0; }
.topbar-launch-card .launch-actions > .topbar-create { width: 100%; }
.task-history-card { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--line); border-radius: 14px; background: var(--composer-card-solid); overflow: hidden; }
.task-history-card .task-history-summary { display: block; padding: 0; border: 0; width: 100%; }
.task-history-summary > .task-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; height: auto; margin: 0; padding: 10px 14px; box-sizing: border-box; border-radius: 0; font-size: calc(11px + var(--app-font-increase, 1pt)); }
.task-history-summary .task-toggle > span { flex: 0 0 auto; font-weight: 600; }
.task-history-summary .task-progress-group { flex: 1; min-width: 0; }
.task-history-summary .task-current { display: flex; flex-direction: row; justify-content: flex-end; gap: 8px; width: auto; min-width: 0; min-height: 0; height: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.task-history-summary .task-current::before, .task-history-summary .task-current::after { display: none; }
/* Elapsed-time estimate: one forward fill, held below completion. */
.task-history-summary > .task-toggle { position: relative; padding-bottom: 14px; }
.task-history-summary .task-activity-bar { position: absolute; inset-inline: 14px; bottom: 5px; height: 3px; overflow: hidden; border-radius: 999px; background: var(--accent-faint); opacity: 0; pointer-events: none; }
.task-activity-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); }
.task-history-summary[data-progress-state="active"] .task-activity-bar,
.task-history-summary[data-progress-state="waiting"] .task-activity-bar,
.task-history-summary[data-progress-state="paused"] .task-activity-bar { opacity: 1; }
.task-history-summary[data-progress-state="active"] .task-activity-fill { width: calc(var(--task-estimated-progress, 0) * 100%); transition: width 1s linear; }
.task-history-summary[data-progress-state="waiting"] .task-activity-fill,
.task-history-summary[data-progress-state="paused"] .task-activity-fill { width: calc(var(--task-estimated-progress, 0) * 100%); opacity: .45; }
.task-history-summary[data-progress-state="complete"] .task-activity-bar { opacity: .32; }
.task-history-summary[data-progress-state="complete"] .task-activity-fill { width: 100%; transition: width 240ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .task-history-summary[data-progress-state="active"] .task-activity-fill { transition: none; }
  .task-history-summary[data-progress-state="complete"] .task-activity-fill { transition: none; }
}
.task-history-summary .task-current > [data-label] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.task-history-summary .task-elapsed { min-width: 0; font-size: calc(11px + var(--app-font-increase, 1pt)); }
.task-history-summary > .task-status-group { display: none; }
.task-history-card #taskDrawer { position: static; inset: auto; width: auto; min-width: 0; max-width: none; margin: 0; padding: 12px; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; max-height: 320px; }
.task-history-card #taskDrawer[hidden] { display: none; }
.task-history-card #taskDrawer #generationJobsPanel { max-height: 290px; }
.task-history-card .task-history-summary > .task-toggle { border: 0; border-radius: 13px; }
.task-history-card .task-history-summary > .task-toggle[aria-expanded="true"] { border-radius: 13px 13px 0 0; }
.task-history-card .task-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
/* Totals belong to expanded history; the closed display stays one line. */
.task-history-card:has(#taskDrawer:not([hidden])) .task-status-group { display: flex; gap: 14px; padding: 4px 14px 10px; }
.task-history-card .task-status-group .task-metric { display: flex; flex-direction: row; align-items: center; gap: 4px; padding: 0; min-height: 20px; }
.task-history-card .task-status-group .task-metric strong { font-size: 12px; }
.task-history-card .task-status-group .task-metric[hidden] { display: none; }
/* Launch, prompt and feedback are three sections of the same card. */
.topbar-launch-card > .task-history-card { flex: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; padding-top: 4px; }
.topbar-launch-card .task-history-summary .task-progress-group { height: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden; }
.topbar-launch-card .task-history-summary .task-current { height: auto; min-height: 0; padding: 0; border-radius: 0; gap: 8px; }
.topbar-launch-card .task-history-summary .task-current > [data-label] { flex: 0 1 auto; text-align: end; }
.topbar-launch-card .task-history-summary .task-elapsed { padding: 0; font-size: inherit; }
.topbar-launch-card .task-history-summary > .task-toggle { min-height: 46px; height: auto; padding: 10px 12px 14px; border-radius: 8px; gap: 10px; font-size: calc(11px + var(--app-font-increase, 1pt)); }
.topbar-launch-card .task-history-summary > .task-toggle:not(:hover):not([aria-expanded="true"]) { background: transparent; }
.topbar-launch-card .task-history-summary > .task-toggle:focus-visible { outline-offset: -2px; }
.topbar-launch-card .task-history-summary .task-activity-bar { inset-inline: 12px; }
.topbar-launch-card .task-history-summary > .task-status-group { height: auto; min-height: 0; padding: 4px 2px 10px; border: 0; background: transparent; justify-content: flex-start; }
.topbar-launch-card .task-history-summary .task-status-group > .task-metric { flex: none; flex-direction: row; min-height: 20px; padding: 0; border: 0; gap: 4px; }
.topbar-launch-card .task-history-summary .task-status-group .task-metric strong { font-size: 12px; }
.topbar-launch-card .task-history-card #taskDrawer { padding: 0 12px; background: transparent; }
/* One summary owns the title and totals; entries use the same text inset. */
.topbar-launch-card .task-history-summary > .task-status-group,
.topbar-launch-card .task-history-card:has(#taskDrawer:not([hidden])) .task-history-summary > .task-status-group { display: none; }
.topbar-launch-card .task-history-summary .task-current > [data-label] { white-space: normal; overflow: visible; line-height: 1.5; }
.task-history-card #taskDrawer #generationJobsPanel { display: flex; flex-direction: column; }
.task-history-card #taskDrawer .job-history-header { position: sticky; top:0; order: 0; justify-content: flex-end; min-height: 0; margin: 0; padding: 6px 0; border: 0; background: var(--composer-card-solid); }
.task-history-card #taskDrawer .job-history-clear { display:inline-flex; gap:6px; width:auto; flex:0 0 auto; min-height:32px; padding:6px 8px; font:inherit; font-size:12px; }
.job-dismissible-notice { position:relative; padding-right:36px; }
.job-notice-close { position:absolute; right:0; top:0; width:30px; height:30px; border:0; border-radius:7px; background:transparent; color:var(--muted); font-size:20px; cursor:pointer; }
.job-notice-close:hover { background:var(--surface-hover); }
.job-notice-close:focus-visible { outline:2px solid var(--accent); }
.task-history-card #taskDrawer .generation-jobs-title { display: none; }
@media (max-width: 1099px) {
  .app-shell > .app-topbar { position: relative; top: auto; flex-shrink: 0; }
}

/* Apply the same surface hierarchy to all workspace windows. */
.app-shell > .stage, .app-shell > .composer-panel,
.app-topbar > .topbar-launch-card, #createSideRail #createMoodboardDock,
.stage #browserPanel, #historyPanel, #moodboardPanel {
  background: var(--workspace-panel); border-color: var(--line); box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#canvasPanel #canvasSurface, .included-preview > img { background: var(--workspace-preview); box-shadow: none; }
#canvasPanel #canvasImageLink img { box-shadow: 0 4px 16px rgb(0 0 0 / 10%); }
#previewNavigation, .task-history-card { background: var(--workspace-panel); box-shadow: none; }
#createMoodboardDock .reference-library-section,
#moodboardGrid.is-reference-library > .reference-library-section,
.included-section { background: var(--workspace-content); }
#createMoodboardDock .reference-library-section:has(> .reference-library-row.is-empty),
#moodboardGrid.is-reference-library > .reference-library-section:has(> .reference-library-row.is-empty) { background: var(--workspace-empty); }
#createMoodboardDock .reference-library-section > header,
#moodboardGrid.is-reference-library > .reference-library-section > header,
.included-section > header, .builtin-model-library > header,
#browserPanel .browser-sidebar-heading { background: var(--workspace-heading); }
.composer-panel .reference-role-card { background: var(--workspace-content); box-shadow: none; }
.reference-role-card:not(.is-dragging):not(:focus-within) .reference-role-icon,
.reference-role-card:not(.is-dragging):not(:focus-within) .reference-role-action,
.reference-role-card:not(.is-dragging):not(:focus-within) .reference-empty-icon { color: var(--muted); }
.reference-role-card .reference-role-visual { background: transparent; }
.launch-prompt-panel #promptField { background: var(--workspace-content); }
.app-shell { background: var(--workspace-base); }
.app-shell::before { opacity: 0; }
:root[data-theme="dark"] .task-history-summary .task-current { background: transparent; box-shadow: none; }

/* The mini browser shares the existing asset area, preserving preview width. */
@media (min-width: 1100px) {
  body[data-active-view="create"].browser-sidebar-open .stage.browser-within-assets { padding-right: 0; }
  body[data-active-view="create"].browser-sidebar-open .stage.browser-within-assets > .workspace-nav { width: 100%; }
  body[data-active-view="create"] .stage.has-width-controls.browser-within-assets:not(.has-contained-preview):not(#canvasPanel) { grid-template-columns: minmax(0, 1fr) var(--workspace-assets-total-width); }
  body[data-active-view="create"] .stage.browser-within-assets > #createSideRail { width: calc(var(--workspace-assets-total-width) - 16px); margin-right: 16px; justify-self: start; }
  body[data-active-view="create"] .stage.browser-within-assets > #browserPanel { right: 16px; }
  body[data-active-view="create"] .stage.browser-assets-stacked > #createSideRail { width: calc(var(--workspace-assets-total-width) - 16px); height: var(--workspace-assets-stack-height); max-height: var(--workspace-assets-stack-height); align-self: start; }
  body[data-active-view="create"] .stage.browser-assets-stacked > #browserPanel { top: calc(var(--browser-sidebar-top, 64px) + (100% - var(--browser-sidebar-top, 64px) - 12px) * .55 + 8px); }
}
#promptField #generationComposerFields { display: flex; min-width: 0; flex-direction: column; }
#promptField .prompt-intro { flex: 0 0 auto; min-width: 0; padding: 12px 16px 10px; }
#promptField #generationComposerFields #prompt { display: block; flex: 0 0 auto; }
#promptField .prompt-intro strong { display: block; color: var(--text); font-size: calc(14px + var(--app-font-increase, 1pt)); font-weight: 650; line-height: 1.5; word-break: keep-all; }
#promptField .composition-guide { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: calc(11px + var(--app-font-increase, 1pt)); line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere; }
#promptField .composition-guide-icon { flex: 0 0 16px; width: 16px; height: 16px; margin-top: .15em; fill: none; stroke: var(--accent); stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
#promptField .composition-guide-copy { display: grid; min-width: 0; gap: 2px; }
#promptField .composition-guide-copy small { color: var(--accent); font: inherit; }
#promptField .composition-guide-copy small[hidden] { display: none; }

/* Asset sources use the same connected tabs as the main workspace. */
#createAssetTabs { display: none; }
.included-category-tabs { display:flex; flex:0 0 auto; flex-wrap:wrap; gap:4px; padding:10px 12px; border-bottom:1px solid var(--line); background:var(--workspace-panel); }
.included-category-tabs button { flex:1 0 auto; border:0; border-radius:8px; padding:8px 10px; background:transparent; color:var(--muted); font:inherit; font-size:12px; white-space:nowrap; cursor:pointer; }
.included-category-tabs button[aria-selected="true"] { color:var(--accent); background:var(--accent-faint); }
.included-category-tabs button:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.included-section[hidden] { display:none !important; }
.builtin-model-content .included-section { border:0; border-radius:0; background:transparent; margin:0; }
.builtin-model-content .included-section > header { padding:0 0 10px; min-height:32px; margin:0; border:0; background:transparent; }
.builtin-model-content .included-section > .included-grid { padding:0; }
.included-clear-selection { min-height:30px; padding:4px 9px; border:1px solid var(--line); border-radius:8px; background:var(--surface-raised); color:var(--muted); font:inherit; font-size:12px; cursor:pointer; }
.included-clear-selection[hidden] { display:none; }
.included-clear-selection:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#deleteSampleTabSelectionButton, #sampleSelectionCount { display:none; }
.asset-context-menu { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: 208px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; padding: 5px; border: 1px solid rgb(255 255 255 / 14%); border-radius: 10px; background: rgb(38 39 43 / 92%); color: #f5f5f7; box-shadow: 0 12px 30px rgb(0 0 0 / 24%), 0 2px 6px rgb(0 0 0 / 12%), inset 0 0 0 .5px rgb(255 255 255 / 5%); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; line-height: 1.35; outline: none; }
:root[data-theme="light"] .asset-context-menu { background: rgb(248 248 250 / 92%); border-color: rgb(0 0 0 / 12%); color: #242426; box-shadow: 0 12px 30px rgb(0 0 0 / 16%), 0 2px 6px rgb(0 0 0 / 8%), inset 0 0 0 .5px rgb(255 255 255 / 80%); }
.asset-context-menu strong { display: block; padding: 6px 9px 5px; font-size: 11px; font-weight: 500; line-height: 1.4; color: var(--muted); }
.asset-context-menu button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 27px; padding: 4px 9px; text-align: start; background: transparent; color: inherit; border: 0; border-radius: 5px; box-shadow: none; font: inherit; font-weight: 400; letter-spacing: 0; transform: none; transition: none; }
.asset-context-menu button svg { display: block; flex: 0 0 15px; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.asset-context-menu button span { min-width: 0; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) { .asset-context-menu button:hover { background: #007aff; color: white; } }
.asset-context-menu button:focus-visible, .asset-context-menu button:active { background: #007aff; color: white; outline: none; }
.asset-context-menu button:is(:hover, :focus-visible, :active) svg { opacity: 1; }
.asset-context-separator { height: 1px; margin: 5px 8px; background: currentColor; opacity: .12; }
.asset-context-menu .asset-context-delete { color: #ff453a; }
:root[data-theme="light"] .asset-context-menu .asset-context-delete { color: #d92d25; }
.asset-context-menu .asset-context-delete:is(:hover, :focus-visible, :active) { color: white; background: #007aff; }
@media (pointer: coarse) { .asset-context-menu button { min-height: 44px; } }
@media (prefers-reduced-transparency: reduce) { .asset-context-menu { background: #26272b; backdrop-filter: none; -webkit-backdrop-filter: none; } :root[data-theme="light"] .asset-context-menu { background: #f8f8fa; } }

#createMoodboardDock .moodboard-header { flex-wrap: wrap; gap: 8px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
#createMoodboardDock #moodboardTitle { display: none; }
#createMoodboardDock #createAssetTabs { display: flex; flex: 1 0 auto; align-self: stretch; align-items: flex-end; gap: 4px; min-width: 0; }
#createMoodboardDock #createAssetTabs [role="tab"] {
  display: inline-flex; flex: 0 1 auto; min-height: 44px; margin: 0 0 -1px; padding: 8px 12px;
  border: 1px solid transparent; border-radius: 10px 10px 0 0; background: transparent;
  color: var(--muted); font-size: calc(12px + var(--app-font-increase, 1pt)); font-weight: 600; line-height: 1.4;
}
#createMoodboardDock #createAssetTabs [aria-selected="true"] {
  color: var(--accent); background: var(--workspace-panel); border-color: var(--line); border-bottom-color: var(--workspace-panel); font-weight: 700;
}
#createMoodboardDock #createAssetTabs [aria-selected="true"]::after { background: var(--workspace-panel); }
#createMoodboardDock #createAssetTabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
#createMoodboardDock .moodboard-copy { margin-bottom: 6px; }
#createMoodboardDock .moodboard-header > #workspace-tab-browser { margin-bottom: 6px; }
@media (hover: hover) {
  #createMoodboardDock #createAssetTabs [aria-selected="false"]:hover { background: var(--surface-hover); color: var(--text); }
}

/* Shared library controls remain available after docking in Create. */
#createMoodboardDock .moodboard-header { flex-wrap: wrap; }
#createMoodboardDock .main-board-clear-actions { display: flex; }
#createMoodboardDock.show-samples .main-board-clear-actions { display: none; }
#createMoodboardDock .moodboard-selection-check {
  display: grid; pointer-events: auto; opacity: 0; padding: 0;
  background: var(--surface, #fff); color: transparent;
}
#createMoodboardDock .moodboard-card:is(.is-selected, :focus-within) .moodboard-selection-check { opacity: 1; }
@media (hover: hover) {
  #createMoodboardDock .moodboard-card:hover .moodboard-selection-check { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
  #createMoodboardDock .moodboard-selection-check { opacity: 1; }
}
#createMoodboardDock .moodboard-card.is-selected .moodboard-selection-check {
  background: #555b65; color: #fff;
}
#createMoodboardDock .moodboard-selection-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#createMoodboardDock .reference-library-section > header { flex-wrap: wrap; }

#createMoodboardDock .moodboard-copy { flex: 0 0 auto; }
#createMoodboardDock .moodboard-header button { white-space: nowrap; }
#createMoodboardDock .reference-library-section > header { height: auto; padding-block: 8px; }
#createMoodboardDock { overflow-y: auto; }
#createMoodboardDock #moodboardGrid.is-asset-sections { min-height: 1148px; flex-shrink: 0; }

#createMoodboardDock:not(.show-samples) #moodboardSelectionCount:not([hidden]) { display: inline; }
#createMoodboardDock .moodboard-card:not(.is-selected) .moodboard-selection-check { border-color: var(--line-strong); box-shadow: 0 1px 3px #0002; }
/* Separate append area from the full-width replacement footer. */
#generationReferences .reference-role-card.has-quick-replace { padding-bottom: 112px; min-height: 202px; }
#generationReferences .reference-role-card.has-quick-replace.has-multiple-references { min-height: 249px; }
#generationReferences .reference-role-card.has-quick-replace .reference-quick-replace { left: 8px; right: 8px; bottom: 8px; width: auto; height: 44px; min-height: 44px; z-index: 3; gap: 8px; border-color: var(--line); background: var(--surface-subtle); color: var(--muted); }
#generationReferences .reference-quick-replace > span { position: static; width: auto; max-width: none; color: inherit; font-size: 11px; }
#generationReferences .has-quick-replace > .reference-role-region-actions { bottom: 64px; }
#generationReferences .has-quick-replace > .reference-count-thumbnails { bottom: 120px; }
#generationReferences .has-quick-replace #backgroundColorPicker { bottom: 64px; }
#generationReferences .has-quick-replace.has-multiple-references:has(> .reference-role-region-actions),
#generationReferences .has-quick-replace[data-reference-role="typography"] { padding-bottom: 60px; }
#generationReferences .has-quick-replace.is-dragging { outline: none; box-shadow: none; }
#generationReferences .has-quick-replace[data-drop-action="add"] .reference-role-picker { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 9px; background: var(--accent-faint); }
#generationReferences .has-quick-replace[data-drop-action="replace"] .reference-quick-replace { border: 2px solid var(--accent); background: var(--accent-faint); color: var(--accent); }
#generationReferences .has-quick-replace[data-drop-action="add"] .reference-quick-replace { border: 1px dashed var(--line); background: var(--surface-subtle); }
#generationReferences .has-quick-replace .reference-drop-hint { display: none; }
#generationReferences .has-quick-replace .background-color-picker { bottom: 64px; }

/* Inline editing shares the main composer; the overlay contains tools only. */
#imageEditWindow .edit-image-workspace > .edit-prompt-pane { display: none !important; }
#canvasPanel.is-editing-image #canvasImageLink { padding-left: 0; }
#canvasPanel.is-editing-image #canvasSurface { background: var(--surface); }
#canvasSurface > .preview-edit-toggle { width: auto; display: inline-flex; gap: 6px; padding: 7px 10px; font: inherit; font-size: 12px; }
#canvasSurface > .preview-edit-toggle[hidden] { display: none; }
#mainEditContext { margin: 0 0 12px; }
#mainEditContext[hidden] { display: none; }
#mainEditContext > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#mainEditContext strong { font-size: 15px; }
#mainEditContext button { border: 1px solid var(--line); background: var(--surface-raised); color: var(--text); padding: 6px 10px; border-radius: 8px; font: inherit; font-size: 12px; cursor: pointer; }
#mainEditContext small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.edit-mode-glow { box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgb(0 122 255 / 18%); }

#canvasPanel.is-editing-image .preview-window-title { display: block; color: var(--accent); }

#canvasSurface > .preview-edit-toggle { left: auto; right: 16px; top: 16px; }
#mainEditContext { padding: 0 14px; }
#composerPanel.is-editing-without-prompt { visibility: hidden; }

#canvasSurface .preview-window-title { left: 20px; right: 140px; width: auto; max-width: calc(100% - 160px); height: auto; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Equal top replacement / bottom append targets. Settings retain their own hit areas. */
#generationReferences .reference-role-card.has-split-reference { min-height:240px; padding-bottom:120px; position:relative; }
#generationReferences .has-split-reference > .reference-role-picker { min-height:120px; height:50%; box-sizing:border-box; padding-bottom:26px; }
#generationReferences .has-split-reference .reference-role-action { display:none; }
#generationReferences .reference-replace-label { position:absolute; top:calc(50% - 26px); left:12px; color:var(--muted); font-size:11px; pointer-events:none; }
#generationReferences .reference-add-zone { position:absolute; inset:50% 0 0; width:100%; height:50%; display:flex; align-items:center; justify-content:center; gap:7px; border:0; border-top:1px dashed var(--line); border-radius:0 0 13px 13px; color:var(--muted); background:transparent; font:inherit; font-size:12px; cursor:pointer; z-index:1; }
#generationReferences .reference-add-zone svg { width:18px; height:18px; }
#generationReferences .reference-add-zone:hover { color:var(--accent); background:var(--accent-faint); }
#generationReferences .reference-add-zone:focus-visible { outline:2px solid var(--accent); outline-offset:-3px; }
#generationReferences .has-split-reference[data-drop-action=replace] { background:linear-gradient(to bottom,var(--accent-faint) 50%,transparent 50%); }
#generationReferences .has-split-reference[data-drop-action=add] .reference-add-zone { background:var(--accent-faint); box-shadow:inset 0 0 0 2px var(--accent); color:var(--accent); }
#generationReferences .has-split-reference .reference-drop-hint { display:none; }
#generationReferences .has-split-reference > .reference-role-region-actions,
#generationReferences .has-split-reference > .background-color-picker,
#generationReferences .has-split-reference > .reference-count-thumbnails,
#generationReferences .has-split-reference > .custom-reference-fields,
#generationReferences .has-split-reference > .basic-copy-options { z-index:2; position:relative; }
#generationReferences .has-split-reference > .background-color-picker { position:absolute; bottom:calc(50% + 6px); right:8px; }
#generationReferences .reference-role-card.has-split-reference > .reference-role-picker { position:absolute; top:0; left:0; right:0; width:100%; height:50% !important; min-height:0 !important; padding:12px 12px 28px; border-radius:13px 13px 0 0; }
#generationReferences .has-split-reference .reference-replace-label { top:auto; bottom:8px; }
#generationReferences .has-split-reference > .reference-role-region-actions { position:absolute; bottom:calc(50% + 8px); right:8px; left:8px; padding:0; margin:0; flex-wrap:nowrap; min-width:0; }
#generationReferences .has-split-reference > .reference-role-region-actions > .custom-reference-refine { position:static; flex:0 0 auto; width:max-content; max-width:none; min-height:32px; white-space:nowrap; margin:0; }
#generationReferences .has-split-reference > .reference-role-region-actions > .reference-region-targets { flex:1 1 auto; min-width:0; }
#generationReferences .has-split-reference > .reference-count-thumbnails { position:absolute; bottom:calc(50% + 36px); left:8px; right:8px; }
#generationReferences .has-split-reference > .custom-reference-fields,
#generationReferences .has-split-reference > .basic-copy-options { margin-top:70px; }
#generationReferences .reference-role-card.has-split-reference > .reference-role-picker { max-height:none !important; }
#generationReferences .has-split-reference > .custom-reference-heading { position:absolute; inset:0 0 50%; }
#generationReferences .has-split-reference .custom-reference-heading > .reference-role-picker { position:absolute; inset:0; width:100%; height:100% !important; min-height:0 !important; max-height:none !important; padding:12px 12px 28px; }
#generationReferences .has-split-reference .custom-reference-heading > .custom-reference-refine { position:absolute; right:8px; bottom:6px; z-index:3; white-space:nowrap; }

#createMoodboardDock #moodboardGrid.is-asset-sections.has-category-tabs { min-height: 0; height: auto; flex: 1 1 0; }
#createMoodboardDock #moodboardGrid.has-category-tabs .reference-library-section > header { height: auto; min-height: var(--ui-card-header-height); flex-wrap: wrap; padding-block: 8px; }

/* User and sample libraries use the same frame, toolbar and card geometry. */
#createMoodboardDock .user-image-library { display:flex; flex-direction:column; flex:1; min-width:0; min-height:0; border:1px solid var(--line); border-radius:var(--ui-card-radius); background:var(--surface-raised); overflow:hidden; }
#createMoodboardDock #userLibraryCategories { min-height:0; }
#createMoodboardDock #userImageLibrary #moodboardGrid { margin:0; padding:12px; max-height:none; overflow-y:auto; display:block; }
#createMoodboardDock #userImageLibrary .reference-library-section { display:block; padding:0; border:0; border-radius:0; background:transparent; overflow:visible; }
#createMoodboardDock #userImageLibrary .reference-library-section[hidden] { display:none; }
#createMoodboardDock #userImageLibrary .reference-library-section > header { display:flex; flex-wrap:wrap; height:auto; min-height:32px; margin:0; padding:0 0 10px; border:0; background:transparent; gap:8px; }
#createMoodboardDock #userImageLibrary .reference-library-section h3,
#createMoodboardDock #userImageLibrary .asset-density-buttons,
#createMoodboardDock #userImageLibrary .library-sort-trigger,
#createMoodboardDock #userImageLibrary .reference-section-delete { display:none; }
#createMoodboardDock #userImageLibrary .reference-library-section header > span { font-size:11px; padding:2px 6px; border-radius:6px; background:var(--density-selected-bg); }
#createMoodboardDock #userImageLibrary .reference-library-actions { margin-inline-start:auto; }
#createMoodboardDock #userImageLibrary .reference-library-actions button { padding:5px 8px; border:1px solid var(--line); border-radius:6px; background:var(--bg); color:var(--text); font:inherit; font-size:11px; }
#createMoodboardDock #userImageLibrary .reference-library-row { container-type:normal; height:auto; border:0; border-radius:0; background:transparent; display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,140px),1fr)); grid-auto-rows:auto; gap:10px; padding:0; overflow:visible; scrollbar-gutter:auto; }
#createMoodboardDock #userImageLibrary .moodboard-card { position:relative; display:block; align-self:stretch; width:100%; height:auto; min-height:0; aspect-ratio:auto !important; border:1px solid var(--line); border-radius:9px; background:var(--surface-raised); box-shadow:0 1px 2px #00000008; overflow:hidden; }
#createMoodboardDock #userImageLibrary .moodboard-select { position:static; display:block; width:100%; height:auto; padding:0; border:0; border-radius:inherit; background:transparent; color:var(--text); text-align:left; cursor:grab; }
#createMoodboardDock #userImageLibrary .moodboard-image-wrap { position:relative; inset:auto; display:block; flex:none; width:100%; height:auto; min-height:0; aspect-ratio:1; border-radius:0; background:#f5f5f3; }
#createMoodboardDock #userImageLibrary .moodboard-image-wrap img { display:block; position:static; width:100%; height:100%; object-fit:contain; transform:none; }
#createMoodboardDock #userImageLibrary .user-image-title { display:block; padding:7px 8px; font:inherit; font-size:11px; font-weight:600; line-height:1.35; overflow-wrap:anywhere; }
#createMoodboardDock #userImageLibrary .reference-library-row.is-empty { display:block; }
#createMoodboardDock #userImageLibrary .reference-library-empty { height:auto; min-height:150px; box-sizing:border-box; }
#createMoodboardDock #userImageLibrary .reference-library-section.is-drop-target { outline:none; background:transparent; }

#createMoodboardDock:not(.show-samples) .main-board-clear-actions { display:none; }

/* A stationary selection footer serves both sources, outside their scroll areas. */
#assetSelectionBar { display:none; }
#createMoodboardDock .moodboard-header { gap:4px; padding:4px 0 0; }
#createMoodboardDock #createAssetTabs { flex:1 1 auto; }
#createMoodboardDock > #assetSelectionBar {
  display:flex; flex:0 0 auto; align-items:center; justify-content:space-between;
  gap:12px; min-height:44px; box-sizing:border-box; margin-top:8px; padding:6px 4px 0;
  border-top:1px solid var(--line);
}
#createMoodboardDock #assetSelectionBar output {
  min-width:0; color:var(--muted); font-size:11px; font-weight:400; line-height:1.4;
  font-variant-numeric:tabular-nums; overflow-wrap:anywhere;
}
#createMoodboardDock #assetSelectionBar .reference-selection-delete {
  display:inline-flex; flex:0 0 auto; align-items:center; justify-content:center; gap:6px;
  min-height:32px; padding:5px 10px; margin:0; border:1px solid transparent; border-radius:8px;
  background:transparent; color:var(--danger, #d94151); font:inherit; font-size:12px;
  line-height:1.4; white-space:nowrap; box-shadow:none;
}
#createMoodboardDock #assetSelectionBar .reference-selection-delete svg {
  width:15px; height:15px; flex:0 0 15px; fill:none; stroke:currentColor;
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;
}
#createMoodboardDock #assetSelectionBar .reference-selection-delete:disabled { color:var(--muted); opacity:.45; }
#createMoodboardDock:not(.show-samples) #deleteSampleTabSelectionButton,
#createMoodboardDock:not(.show-samples) #sampleSelectionCount,
#createMoodboardDock.show-samples #assetSelectionBar #deleteLibrarySelectionButton { display:none; }
#createMoodboardDock.show-samples #sampleSelectionCount { display:block; }
#createMoodboardDock .moodboard-copy:has(> #moodboardTitle:only-child) { display:none; }
@media (hover:hover) {
  #createMoodboardDock #assetSelectionBar .reference-selection-delete:not(:disabled):hover { background:color-mix(in srgb,var(--danger, #d94151) 8%,transparent); }
}
@media (pointer:coarse) {
  #createMoodboardDock #assetSelectionBar .reference-selection-delete { min-height:44px; padding-inline:12px; }
}


/* Keep editing tools above the photo; the overlay border never changes its geometry. */
#canvasPanel.is-editing-image #canvasImageLink { padding-top:116px; padding-left:16px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette {
 left:16px; right:16px; top:calc(var(--edit-image-top,116px) - 12px); bottom:auto;
 width:max-content; max-width:calc(100% - 32px); height:auto;
 display:flex; flex-direction:row; flex-wrap:nowrap; align-items:center; gap:4px;
 padding:5px; transform:translateY(-100%); overflow-x:auto; overflow-y:hidden;
 animation:none; scrollbar-width:thin;
}
#imageEditWindow .edit-image-workspace > .edit-tool-palette button { flex:0 0 32px; width:32px; height:32px; min-height:32px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette [data-undo] { margin:0; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette [data-undo]::before { display:none; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette > .edit-brush-settings {
 display:flex; flex:0 0 auto; flex-direction:row; align-items:center; gap:6px;
 margin:0 0 0 3px; padding:0 0 0 8px; border-top:0; border-left:1px solid var(--line);
}
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=range] { writing-mode:horizontal-tb; direction:ltr; width:80px; min-width:80px; height:24px; margin:0; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-value { min-width:18px; text-align:center; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings .edit-brush-presets { display:flex; flex-direction:row; gap:2px; padding:0; border:0; }
#imageEditWindow .edit-tool-palette > [data-hint] { display:none; }
#canvasPanel.is-editing-image .edit-mode-glow { border:4px dashed var(--accent); box-shadow:none; border-radius:12px; }

#imageEditWindow[open] .edit-image-workspace > .edit-tool-palette { animation:none; transform:translateY(-100%); }

/* One horizontal tool row follows the displayed photo width. */
#canvasPanel.is-editing-image #canvasImageLink { padding:116px 24px 24px; }
#imageEditWindow .edit-image-workspace > .edit-tool-palette,
#imageEditWindow[open] .edit-image-workspace > .edit-tool-palette {
 left:var(--edit-image-center,50%); right:auto; top:calc(var(--edit-image-top,116px) - 12px);
 transform:translate(-50%,-100%); width:var(--edit-image-width,calc(100% - 48px)); max-width:calc(100% - 32px); box-sizing:border-box;
 flex-wrap:nowrap; justify-content:safe center; gap:3px; padding:6px;
 overflow-x:auto; overflow-y:hidden; border-radius:14px; box-shadow:0 3px 12px #00000012;
}
#imageEditWindow .edit-image-workspace > .edit-tool-palette > .edit-brush-settings { flex:0 0 auto; width:auto; max-width:none; flex-wrap:nowrap; justify-content:center; gap:3px; border:0; border-left:1px solid var(--line); margin:0 0 0 3px; padding:0 0 0 6px; }
#imageEditWindow .edit-tool-palette > .edit-brush-settings input[type=range] { width:48px; min-width:48px; max-width:48px; flex:0 0 48px; }
#canvasPanel.is-editing-image .edit-mode-glow { border:0; outline:3px solid var(--accent); outline-offset:6px; box-shadow:none; }

/* Reference cards share a header, action row and compact add footer. */
#generationReferences .reference-role-card.has-split-reference { display:flex; flex-direction:column; min-height:0; height:auto; padding:0; overflow:visible; }
#generationReferences .reference-role-card.has-split-reference > .reference-role-picker,
#generationReferences .has-split-reference .custom-reference-heading > .reference-role-picker { position:relative; inset:auto; flex:none; width:100%; height:82px !important; min-height:82px !important; padding:12px; box-sizing:border-box; align-items:flex-start; }
#generationReferences .has-split-reference > .custom-reference-heading { position:relative; inset:auto; height:82px; flex:none; }
#generationReferences .has-split-reference .reference-card-actions { order:2; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px; margin:0; padding:4px 10px 10px; min-height:44px; box-sizing:border-box; }
#generationReferences .has-split-reference .reference-card-actions .reference-replace-label { position:static; inset:auto; display:inline-flex; align-items:center; gap:4px; min-height:32px; padding:4px 0; border:0; background:transparent; color:var(--muted); font:inherit; font-size:11px; cursor:pointer; pointer-events:auto; white-space:nowrap; }
#generationReferences .reference-replace-label svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex:none; }
#generationReferences .has-split-reference .reference-card-actions > .background-color-picker,
#generationReferences .has-split-reference .reference-card-actions > .custom-reference-refine,
#generationReferences .has-split-reference .reference-card-actions > .reference-role-region-actions { position:relative; inset:auto; margin:0 0 0 auto; padding:0; flex:0 1 auto; min-width:0; width:auto; }
#generationReferences .has-split-reference .reference-role-region-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:4px; border:0; }
#generationReferences .has-split-reference .reference-card-actions .custom-reference-refine,
#generationReferences .has-split-reference .reference-card-actions .background-color-trigger { position:relative; inset:auto; min-height:32px; height:32px; box-sizing:border-box; border:1px solid var(--line); border-radius:8px; padding:5px 8px; background:var(--surface-raised); font:inherit; font-size:11px; white-space:nowrap; }
#generationReferences .has-split-reference .reference-card-actions .reference-region-targets { flex-basis:100%; order:2; }
#generationReferences .has-split-reference > .reference-add-zone { position:relative; inset:auto; order:5; flex:none; width:100%; height:40px; min-height:40px; border-top:1px dashed var(--line); border-radius:0 0 13px 13px; background:var(--surface-subtle); }
#generationReferences .has-split-reference > .reference-count-thumbnails { position:relative; inset:auto; order:1; margin:0; padding:0 10px 6px; }
#generationReferences .has-split-reference > .custom-reference-fields,
#generationReferences .has-split-reference > .basic-copy-options { position:relative; inset:auto; order:3; margin:0; padding:0 10px 8px; }
#generationReferences .has-split-reference[data-drop-action=replace] { background:var(--accent-faint); }
#generationReferences .reference-card-actions button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }


/* Keep intrinsic button width when macOS fonts need a wider action label. */
#generationReferences .has-split-reference .reference-card-actions { min-width:0; }
#generationReferences .has-split-reference .reference-card-actions > .reference-role-region-actions { flex:0 0 auto; max-width:100%; }
#generationReferences .has-split-reference .reference-card-actions .custom-reference-refine {
  flex:0 0 auto; width:max-content; max-width:100%; margin:0;
  height:auto; min-height:32px; white-space:normal; overflow-wrap:anywhere;
}
#generationReferences .has-split-reference .reference-card-actions > .custom-reference-refine { margin-inline-start:auto; }

#imageEditWindow .edit-image-workspace > .edit-tool-palette button { flex:0 0 28px; width:28px; height:28px; min-height:28px; }

/* Breathe only the outer shadow; image geometry and editing coordinates stay fixed. */
#canvasPanel.is-editing-image .edit-mode-glow::before {
  content:""; position:absolute; inset:-6px; border-radius:inherit; pointer-events:none;
  box-shadow:0 12px 32px rgb(0 0 0 / 18%), 0 0 30px 5px rgb(0 122 255 / 18%);
  animation:edit-shadow-breathe 4s ease-in-out infinite;
}
@keyframes edit-shadow-breathe { 0%, 100% { opacity:.3; } 50% { opacity:1; } }
@media (prefers-reduced-motion:reduce) {
  #canvasPanel.is-editing-image .edit-mode-glow::before { animation:none; opacity:.55; }
}

/* Quiet library empty state, centered in the available pane instead of a short row. */
#createMoodboardDock #userImageLibrary #moodboardGrid { display:flex; flex-direction:column; flex:1 1 0; min-height:0; padding:14px; }
#createMoodboardDock #userImageLibrary .reference-library-section:not([hidden]) { display:flex; flex-direction:column; flex:1 0 auto; min-height:0; }
#createMoodboardDock #userImageLibrary .reference-library-section:has(.reference-library-row.is-empty) { flex:1 1 auto; }
#createMoodboardDock #userImageLibrary .reference-library-row.is-empty { display:flex; flex:1 1 auto; min-height:220px; }
#createMoodboardDock #userImageLibrary .reference-library-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:auto; min-height:220px; gap:12px; padding:28px 20px; text-align:center; }
#createMoodboardDock #userImageLibrary .reference-empty-icon { width:60px; height:60px; margin:0; display:grid; place-items:center; border-radius:18px; color:var(--muted); background:color-mix(in srgb,var(--muted) 7%,transparent); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--line) 45%,transparent); }
#createMoodboardDock #userImageLibrary .reference-empty-icon svg { width:28px; height:28px; stroke-width:1.35; }
#createMoodboardDock #userImageLibrary .reference-library-empty > span:last-child { color:var(--muted); font-size:12px; font-weight:400; line-height:1.6; }
#createMoodboardDock #userLibraryCategories { gap:4px; padding:8px; min-height:48px; background:color-mix(in srgb,var(--surface-raised) 65%,var(--bg)); }
#createMoodboardDock #userLibraryCategories button { border:1px solid transparent; border-radius:7px; min-height:30px; padding:5px 10px; font-size:11px; font-weight:500; color:var(--muted); background:transparent; box-shadow:none; }
#createMoodboardDock #userLibraryCategories button[aria-selected="true"] { background:var(--surface-raised); color:var(--accent); border-color:var(--line); box-shadow:0 1px 3px rgb(0 0 0 / 7%); outline:none; }
#createMoodboardDock #userLibraryCategories button:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
#createMoodboardDock #userImageLibrary .reference-library-actions button { background:var(--surface-raised); border-radius:7px; box-shadow:0 1px 2px rgb(0 0 0 / 4%); }
#createMoodboardDock #userImageLibrary .reference-library-section header > span { background:transparent; color:var(--muted); padding:2px 0; font-size:10px; }
#createMoodboardDock #userImageLibrary .reference-library-section.is-drop-target .reference-empty-icon { color:var(--accent); background:var(--accent-faint); }

/* Compact macOS region editor: quiet chrome, stable controls, full image focus. */
body .reference-region-editor { border-radius: 18px; }
body .reference-region-editor .reference-region-header { gap: 12px; padding: 18px 20px 8px; align-items: center; }
body .reference-region-editor .reference-region-header > [data-close] { align-self: center; width: 28px; min-height: 28px; padding: 5px; border-radius: 8px; background: var(--surface-subtle); }
body .reference-region-editor .reference-region-eyebrow { font-size: 11px; font-weight: 500; }
body .reference-region-editor .reference-region-header h2 { margin-top: 2px; font-size: 17px; font-weight: 650; }
body .reference-region-editor .reference-region-help { padding: 0 20px 14px; font-size: 12px; line-height: 1.5; }
body .reference-region-editor button { min-height: 30px; padding: 6px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
body .reference-region-editor svg { width: 16px; height: 16px; flex-basis: 16px; }
body .reference-region-editor .reference-region-toolbar { margin: 0 16px 12px; padding: 8px; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
body .reference-region-editor .reference-region-tools { flex: 0 0 auto; gap: 2px; padding: 2px; border: 0; border-radius: 8px; background: transparent; }
body .reference-region-editor .reference-region-tools button[aria-pressed="true"] { outline: none; border-color: var(--line); background: var(--composer-card-solid); color: var(--accent); box-shadow: var(--shadow-control); }
body .reference-region-editor button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body .reference-region-editor .reference-region-size { flex: 1 1 150px; max-width: 220px; min-width: 120px; gap: 8px; white-space: nowrap; font-size: 11px; }
body .reference-region-editor .reference-region-size input { flex: 1 1 70px; width: 70px; min-width: 40px; }
body .reference-region-editor .reference-region-size output { flex: 0 0 28px; font-size: 11px; }
body .reference-region-editor .reference-region-toolbar > .reference-region-tools:last-child { margin-left: auto; border-left: 1px solid var(--line); border-radius: 0; padding-left: 8px; }
body .reference-region-editor .reference-region-icon { width: 30px; padding: 6px; }
body .reference-region-editor .reference-region-stage { margin: 0 16px; padding: 12px; border-radius: 12px; }
body .reference-region-editor .reference-region-meta { padding: 8px 16px 0; }
body .reference-region-editor .reference-region-status { margin: 6px 20px 12px; font-size: 11px; line-height: 1.5; }
body .reference-region-editor .reference-region-footer { padding: 12px 20px; background: var(--surface-subtle); }
body .reference-region-editor .reference-region-footer button { min-height: 32px; padding: 7px 14px; }
@media (max-width: 600px) {
  body .reference-region-editor .reference-region-toolbar { gap: 6px; }
  body .reference-region-editor .reference-region-size { order: 3; max-width: none; flex-basis: 100%; }
  body .reference-region-editor .reference-region-toolbar button { padding-inline: 7px; }
}
@media (pointer: coarse) {
  body .reference-region-editor button { min-height: 42px; }
}

/* Separate generated guidance from the user's editable prompt. */
body .launch-prompt-panel #promptField { padding: 0; background: transparent; border: 0; box-shadow: none; }
body .launch-prompt-panel #promptField:focus-within { border: 0; box-shadow: none; }
#promptField .prompt-intro { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-subtle); }
#promptField .composition-guide { font-size: 11px; line-height: 1.55; }
#promptField .composition-guide-icon { width: 14px; height: 14px; flex-basis: 14px; stroke: var(--muted); }
#promptField .prompt-input-area { min-width: 0; padding: 10px 14px 7px; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--composer-card-solid); box-shadow: 0 1px 3px rgb(0 0 0 / 4%); }
#promptField .prompt-input-area:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-faint); }
#promptField #promptFieldLabel { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text); cursor: text; }
#promptField .prompt-input-surface { position: relative; }
#promptField #generationComposerFields #prompt { width: 100%; min-height: 54px; height: 54px; padding: 0; border: 0; border-radius: 0; background: transparent; outline: none; box-shadow: none; font-size: 13px; line-height: 1.65; caret-color: var(--accent); cursor: text; }
#promptField #prompt::placeholder { color: var(--muted); opacity: .7; }
#promptField #promptFieldLabel[hidden] { display: none; }
#promptField .prompt-input-area > .prompt-character-count { display: block; position: static; margin: 5px 0 0; padding: 0; width: auto; text-align: right; font-size: 10px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Reference attachments: compact macOS cards with one consistent add footer. */
.composer-fields > #generationReferences,
#generationReferences > #referenceDetails,
.composer-fields #referenceDetails > .reference-role-grid { flex: 0 0 auto; }
.composer-fields #referenceDetails > .reference-role-grid { align-content: start; gap: 10px; }
body #generationReferences .reference-role-card.has-split-reference {
  min-height: 128px; height: auto; max-height: none; min-width: 0; padding: 0;
  border: 1px solid var(--line); border-radius: 12px; outline: none;
  background: var(--composer-card-solid); box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
}
body #generationReferences .reference-role-card.has-reference,
body #generationReferences .reference-role-card.has-background-color { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
body #generationReferences .reference-role-card.has-split-reference > .reference-role-picker,
body #generationReferences .has-split-reference .custom-reference-heading > .reference-role-picker {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto; gap: 9px;
  height: auto !important; min-height: 64px !important; max-height: none !important;
  padding: 12px 10px 8px; align-items: center; border-radius: 11px 11px 0 0;
}
body #generationReferences .has-split-reference > .custom-reference-heading { height: auto; min-height: 64px; }
body #generationReferences .reference-role-card .reference-role-copy { align-self: center; gap: 3px; padding: 0; min-width: 0; }
body #generationReferences .reference-role-card .reference-role-copy strong { font-size: 13px; font-weight: 600; line-height: 1.3; min-height: 0; letter-spacing: -.02em; }
body #generationReferences .reference-role-card .reference-role-copy small { font-size: 11px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
body #generationReferences .reference-role-card .reference-role-visual { align-self: center; width: 32px; height: 36px; border-radius: 8px; background: var(--surface-subtle); }
body #generationReferences .reference-role-visual .reference-role-image { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 8px; }
body #generationReferences .reference-role-icon { display: grid; place-items: center; width: 32px; height: 36px; color: var(--muted); }
body #generationReferences .reference-role-icon[hidden] { display: none; }
body #generationReferences .reference-role-icon svg { width: 20px; height: 20px; stroke-width: 1.5; }
body #generationReferences .has-split-reference .reference-card-actions {
  gap: 4px; min-height: 34px; padding: 0 8px 6px; align-items: center;
}
body #generationReferences .has-split-reference .reference-card-actions .reference-replace-label,
body #generationReferences .has-split-reference .reference-card-actions .custom-reference-refine,
body #generationReferences .has-split-reference .reference-card-actions .background-color-trigger {
  min-width: 0; min-height: 28px; height: 28px; padding: 4px 6px; gap: 4px;
  border: 1px solid transparent; border-radius: 7px; background: var(--surface-subtle);
  font-size: 10px; font-weight: 500; line-height: 1.3; box-shadow: none;
}
body #generationReferences .has-split-reference .reference-card-actions .reference-replace-label { background: transparent; }
body #generationReferences .reference-replace-label[hidden],
body #generationReferences .reference-card-actions [hidden] { display: none !important; }
body #generationReferences .reference-replace-label svg { width: 13px; height: 13px; stroke-width: 1.5; }
body #generationReferences .reference-card-actions .custom-reference-refine { color: var(--accent); }
body #generationReferences .reference-card-actions .background-color-trigger .background-color-swatch { width: 16px; height: 16px; }
body #generationReferences .reference-card-actions button:disabled { opacity: .4; cursor: default; }
body #generationReferences .has-split-reference > .reference-add-zone {
  height: 30px; min-height: 30px; margin-top: auto; padding: 5px 10px; box-sizing: border-box;
  border-top: 1px solid var(--line); border-radius: 0 0 11px 11px;
  background: var(--surface-subtle); color: var(--muted); gap: 5px; font-size: 11px; font-weight: 500;
}
body #generationReferences .reference-add-zone svg { width: 14px; height: 14px; stroke-width: 1.5; }
body #generationReferences .reference-role-card > .reference-role-remove,
body #generationReferences .typography-card-actions .reference-role-remove,
body #generationReferences .typography-card-actions .reference-reset-button { width: 22px; height: 22px; min-width: 22px; min-height: 22px; flex-basis: 22px; border: 0; border-radius: 6px; background: var(--surface-subtle); font-size: 17px; padding: 0; }
body #generationReferences .typography-card-actions { gap: 4px; top: 6px; right: 6px; }
body #generationReferences .reference-role-card[data-reference-role="typography"] > .reference-role-picker { padding-right: 62px; }
body #generationReferences .reference-role-card > .reference-count-thumbnails { padding: 0 10px 6px; }
body #generationReferences .has-split-reference > .basic-copy-options,
body #generationReferences .has-split-reference > .custom-reference-fields { padding: 0 10px 8px; }
body #generationReferences .reference-role-card.is-dragging { border-color: var(--accent); outline: none; box-shadow: none; }
body #generationReferences .reference-role-card.is-dragging .reference-role-picker,
body #generationReferences .reference-role-card.is-dragging .reference-drop-hint,
body #generationReferences .reference-role-card.is-dragging .reference-quick-replace,
body #generationReferences .reference-role-card.is-dragging .person-replace-drop { border-color: transparent; outline: none; box-shadow: none; }
body #generationReferences .has-split-reference[data-drop-action="replace"] > .reference-role-picker,
body #generationReferences .has-split-reference[data-drop-action="replace"] .custom-reference-heading { background: var(--accent-faint); }
body #generationReferences .has-split-reference[data-drop-action="add"] > .reference-add-zone { color: var(--accent); background: var(--accent-faint); }
body #generationReferences :is(button, .reference-role-picker):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) {
  body #generationReferences .reference-card-actions button:not(:disabled):hover,
  body #generationReferences .reference-add-zone:hover { color: var(--accent); background: var(--accent-faint); }
}
@media (pointer: coarse) {
  body #generationReferences .reference-card-actions button,
  body #generationReferences .has-split-reference > .reference-add-zone { min-height: 40px; height: auto; }
}

/* A quiet title-bar account control; detailed guidance stays in its menu. */
.stage > .workspace-nav { min-height: 72px; box-sizing: border-box; }
.stage > .workspace-account-actions { top: 12px; right: 18px; }
.workspace-account-actions #railStatus {
  min-height: 36px; height: 36px; max-width: 280px; box-sizing: border-box; padding: 6px 10px; gap: 8px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; box-shadow: none; text-align: start;
}
.workspace-account-actions #railStatus .gpt-account-avatar,
.workspace-account-actions #railStatus.ready.has-profile .gpt-account-avatar {
  width: 22px; height: 22px; flex-basis: 22px; border: 0; border-radius: 50%;
  color: var(--muted); background: transparent;
}
.workspace-account-actions #railStatus .gpt-account-avatar svg { width: 18px; height: 18px; stroke-width: 1.6; }
.workspace-account-actions #railStatus .gpt-account-initials { font-size: 10px; font-weight: 600; letter-spacing: .01em; }
.workspace-account-actions #railStatus .gpt-account-copy { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.workspace-account-actions #railStatus :is(.gpt-account-label, .gpt-account-name) { max-width: 110px; margin: 0; font-size: 12px; line-height: 1.3; letter-spacing: -.01em; font-weight: 500; color: var(--text); }
.workspace-account-actions #railStatus .gpt-account-copy strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 400; line-height: 1.3; }
.workspace-account-actions #railStatus .rail-status-dot { margin-inline: 0; width: 4px; height: 4px; flex-basis: 4px; }
.workspace-account-actions #railStatus:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 720px) {
  .stage > .workspace-nav { min-height: 68px; }
  .stage > .workspace-account-actions { top: 12px; right: 14px; }
  .workspace-account-actions #railStatus { width: 36px; min-width: 36px; padding: 6px; gap: 0; }
  .workspace-account-actions #railStatus .gpt-account-copy { display: none; }
}
@media (pointer: coarse) { .workspace-account-actions #railStatus { min-height: 44px; height: 44px; min-width: 44px; } }

/* Six reference categories remain visible beneath a static section heading. */
body #generationReferences { padding-top: 0; border-top: 0; }
body #generationReferences > .section-minihead { min-height: 36px; margin: 0 0 8px; gap: 6px; }
#referenceSectionHeading { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; min-width: 0; min-height: 36px; margin: 0; padding: 6px 4px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: default; }
#referenceSectionHeading strong { font-size: 12px; font-weight: 600; }
#referenceSectionHeading #referenceCount { display: inline; margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 400; }
body #generationReferences .reference-role-card[hidden] { display: none !important; }
body #generationReferences .reference-role-card[data-reference-role="typography"] { grid-column: auto; }
body #generationReferences .reference-role-card.has-split-reference { min-height: 116px; }
body #generationReferences .reference-role-card.has-split-reference > .reference-role-picker { min-height: 56px !important; padding-block: 9px 7px; }
body #generationReferences .has-split-reference .reference-card-actions { min-height: 32px; padding-bottom: 4px; }
body #generationReferences .has-split-reference > .reference-add-zone { min-height: 28px; height: 28px; }
body #generationReferences .reference-role-card[data-reference-role="typography"] > .reference-role-picker { padding-right: 62px; }
body #generationReferences .reference-role-card[data-reference-role="typography"] .typography-card-actions { top: 4px; right: 4px; }
body #generationReferences .reference-role-card[data-reference-role="typography"] .basic-copy-options { min-width: 0; }
body #generationReferences #basicCopySummary { min-width: 0; min-height: 28px; padding: 5px 7px; font-size: 10px; gap: 6px; }
body #generationReferences #basicCopySummary [data-copy-preview] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) { #referenceSectionHeading, body #generationReferences .has-split-reference > .reference-add-zone { min-height: 40px; height: auto; } }

/* A compact account menu with explicit OAuth actions. */
.gpt-account-menu {
  position: fixed; inset: auto; margin: 0; width: min(252px, calc(100vw - 16px)); max-height: calc(100dvh - 16px);
  box-sizing: border-box; overflow: auto; padding: 6px; border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 11px; background: color-mix(in srgb, var(--composer-card-solid) 96%, transparent); color: var(--text);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 8px 24px rgb(0 0 0 / 12%), 0 1px 3px rgb(0 0 0 / 5%);
}
.gpt-account-menu[hidden] { display: none; }
.gpt-account-menu-header { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.gpt-account-menu-header > strong { color: var(--text); font-size: 12px; font-weight: 600; line-height: 1.4; }
.gpt-account-menu-name { font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.gpt-account-menu-status { color: var(--muted); font-size: 11px; line-height: 1.4; }
.gpt-account-menu-action { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.gpt-account-menu-action[hidden], .gpt-account-menu-name[hidden], .gpt-account-menu-notice[hidden] { display: none; }
.gpt-account-menu-action > svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gpt-account-menu-action.is-login { color: var(--accent); }
.gpt-account-menu-action.is-logout { color: var(--text); }
.gpt-account-menu-action:hover:not(:disabled), .gpt-account-menu-action:focus-visible { background: var(--accent-faint); outline: none; }
.gpt-account-menu-action:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.gpt-account-menu-action:disabled { opacity: .45; cursor: default; }
.gpt-account-menu-notice { margin: 5px 10px 4px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.gpt-account-menu-notice.is-error { color: var(--danger-text, #c53632); }
.workspace-account-actions #railStatus[aria-expanded="true"] { background: var(--surface-hover); border-color: var(--line-strong); }
@media (forced-colors: active) { .gpt-account-menu { border-color: CanvasText; background: Canvas; } .gpt-account-menu-action:focus-visible { outline: 2px solid Highlight; } }

/* Generation history: quiet disclosure, readable result strips, local notices. */
.topbar-launch-card .task-history-card #taskDrawer .job-history-header[hidden] { display:none; }
.topbar-launch-card .task-history-card { padding-block:6px; border-bottom:1px solid var(--line); }
.topbar-launch-card .task-history-summary > .task-toggle {
  min-height:34px; padding:6px 8px; gap:10px; border:0; border-radius:10px; justify-content:space-between;
  background:transparent; color:var(--text); box-shadow:none; outline:none;
  font-size:12px; font-weight:600;
}
.topbar-launch-card .task-history-summary > .task-toggle[aria-expanded="true"] {
  border:0; border-radius:10px; background:transparent; color:var(--text); box-shadow:none;
}
.topbar-launch-card .task-history-summary > .task-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.topbar-launch-card .task-history-summary > .task-toggle [data-chevron] { flex:0 0 12px; width:12px; height:12px; color:var(--muted); }
.topbar-launch-card .task-history-summary .task-current { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:4px 8px; }
.topbar-launch-card .task-history-summary .task-current > [data-label] {
  padding:3px 7px; border-radius:6px; font-size:10px; font-weight:500; line-height:1.4;
  color:var(--muted); background:color-mix(in srgb,var(--muted) 7%,transparent);
}
.topbar-launch-card .task-history-summary:is([data-status="running"],[data-status="submitting"]) [data-label] { color:var(--accent); background:var(--accent-faint); }
.topbar-launch-card .task-history-summary[data-status="completed"] [data-label] { color:light-dark(#277747,#78c795); background:light-dark(#2777470d,#78c79512); }
.topbar-launch-card .task-history-summary:is([data-status="failed"],[data-status="paused"]) [data-label] { color:light-dark(#946314,#e2b665); background:light-dark(#9463140b,#e2b66512); }
.topbar-launch-card .task-history-summary .task-elapsed { color:var(--muted); font-size:11px; font-weight:400; font-variant-numeric:tabular-nums; }
.topbar-launch-card .task-history-summary .task-activity-bar { bottom:4px; inset-inline:8px; height:3px; }
.topbar-launch-card .task-history-summary[data-progress-state="complete"] .task-activity-bar { opacity:0; }
.topbar-launch-card .task-history-card #taskDrawer { max-height:380px; padding:0 4px 4px; border:0; }
.topbar-launch-card .task-history-card #taskDrawer #generationJobsPanel { max-height:372px; gap:0; scrollbar-gutter:stable; }
.topbar-launch-card .task-history-card #taskDrawer .job-history-header {
  position:static; order:1; min-height:40px; padding:6px 0 0; margin:4px 0 0;
  border-top:1px solid var(--line); background:transparent;
}
.topbar-launch-card .task-history-card #taskDrawer .job-history-clear {
  min-height:30px; padding:5px 8px; gap:6px; color:var(--muted); font-size:11px; font-weight:400;
}
.topbar-launch-card .task-history-card #taskDrawer .generation-job { position:relative; padding:14px 6px; border-bottom:1px solid var(--line); }
.topbar-launch-card .task-history-card #taskDrawer .generation-job:last-child { border-bottom:0; }
.topbar-launch-card .task-history-card #taskDrawer .generation-job-copy,
.topbar-launch-card .task-history-card #taskDrawer .generation-job-copy:has(.job-result-thumbnails) {
  display:flex; flex-direction:column; align-items:stretch; gap:10px; min-width:0;
}
.topbar-launch-card .task-history-card #taskDrawer .job-status-copy { min-width:0; padding-inline-end:34px; }
.topbar-launch-card .task-history-card #taskDrawer .generation-job-heading { gap:5px 8px; padding:0; }
.topbar-launch-card .task-history-card #taskDrawer .job-state-badge {
  display:inline-flex; align-items:center; gap:5px; padding:0; font-size:12px; font-weight:600; line-height:1.5; color:var(--text);
}
.topbar-launch-card .task-history-card #taskDrawer .job-state-badge::before { content:''; width:5px; height:5px; flex:0 0 5px; border-radius:50%; background:var(--muted); opacity:.7; }
.topbar-launch-card .task-history-card #taskDrawer .job-state-completed::before { background:light-dark(#277747,#78c795); opacity:1; }
.topbar-launch-card .task-history-card #taskDrawer .job-state-running { color:var(--accent); }
.topbar-launch-card .task-history-card #taskDrawer .job-state-running::before { background:var(--accent); opacity:1; }
.topbar-launch-card .task-history-card #taskDrawer .job-state-failed::before { background:light-dark(#ad6c17,#e2b665); opacity:1; }
.topbar-launch-card .task-history-card #taskDrawer .job-history-time,
.topbar-launch-card .task-history-card #taskDrawer .job-history-duration { margin:0; font-size:10px; font-weight:400; color:var(--muted); line-height:1.5; }
.topbar-launch-card .task-history-card #taskDrawer .job-requested-model { margin-top:3px; font-size:10px; color:var(--muted); opacity:.85; line-height:1.5; }
.topbar-launch-card .task-history-card #taskDrawer .job-result-thumbnails {
  display:flex; flex-wrap:wrap; gap:8px; margin:0; min-width:0;
}
.topbar-launch-card .task-history-card #taskDrawer .job-result-thumbnails .job-result-select {
  flex:0 0 64px; width:64px; height:76px; min-height:0; aspect-ratio:auto; padding:3px;
  border:1px solid var(--line); border-radius:9px; background:var(--surface-raised); box-shadow:0 1px 2px #00000005;
}
.topbar-launch-card .task-history-card #taskDrawer .job-result-thumbnail { width:100%; height:100%; object-fit:contain; border-radius:6px; }
.topbar-launch-card .task-history-card #taskDrawer .job-status-thumbnail { width:32px; height:36px; flex:0 0 32px; border:0; border-radius:8px; background:color-mix(in srgb,var(--muted) 6%,transparent); }
.topbar-launch-card .task-history-card #taskDrawer .job-status-thumbnail svg { width:20px; height:20px; }
.topbar-launch-card .task-history-card #taskDrawer .generation-job > :is(.job-history-remove, .job-generation-stop) {
  position:absolute; inset-inline-end:2px; top:10px; display:grid; place-items:center; margin:0;
  width:28px; height:28px; padding:6px; border:0; border-radius:7px; color:var(--muted); background:transparent;
}
.topbar-launch-card .task-history-card #taskDrawer :is(.job-history-remove, .job-generation-stop) svg { width:15px; height:15px; }
.topbar-launch-card .task-history-card #taskDrawer .job-dismissible-notice { min-width:0; padding:0; border:1px solid var(--line); border-radius:8px; background:color-mix(in srgb,var(--muted) 3%,transparent); }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-disclosure { min-width:0; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-summary { display:flex; align-items:center; gap:8px; padding:8px 34px 8px 10px; min-height:30px; box-sizing:border-box; list-style:none; cursor:pointer; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-summary::-webkit-details-marker { display:none; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-label { flex:1; min-width:0; color:var(--muted); font-size:11px; font-weight:500; line-height:1.5; overflow-wrap:anywhere; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-more { flex:0 0 auto; color:var(--accent); font-size:10px; font-weight:400; }
.topbar-launch-card .task-history-card #taskDrawer .job-error { display:block; min-height:0; margin:0; padding:0 10px 10px; border:0; border-radius:0; background:transparent; color:var(--muted); font-size:11px; line-height:1.65; white-space:pre-wrap; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-close { inset-inline-end:2px; top:3px; width:26px; height:26px; font-size:17px; }
.topbar-launch-card .task-history-card #taskDrawer .job-dismissible-notice > .job-cancel { margin:0 10px 8px; font-size:11px; }
.topbar-launch-card .task-history-card #taskDrawer .job-stop-details { font-size:11px; }
.topbar-launch-card .task-history-card #taskDrawer .job-notice-summary:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; border-radius:7px; }
@media (hover:hover) {
  .topbar-launch-card .task-history-summary > .task-toggle:hover { background:color-mix(in srgb,var(--muted) 4%,transparent); }
  .topbar-launch-card .task-history-card #taskDrawer :is(.job-history-remove, .job-generation-stop):hover { background:var(--surface-hover); color:var(--danger, #d94151); }
}
@media (pointer:coarse) {
  .topbar-launch-card .task-history-card #taskDrawer .generation-job > :is(.job-history-remove, .job-generation-stop) { width:40px; height:40px; }
  .topbar-launch-card .task-history-card #taskDrawer .job-status-copy { padding-inline-end:44px; }
  .topbar-launch-card .task-history-card #taskDrawer .job-notice-close { width:36px; height:36px; }
  .topbar-launch-card .task-history-card #taskDrawer .job-notice-summary { min-height:42px; padding-inline-end:42px; }
}

/* Reserve room for the account only; appearance now lives beside settings. */
.stage > #workspaceNav { padding-right:310px; }
@media (max-width:720px) {
  .stage > #workspaceNav { padding-right:58px; }
  #workspaceNav .workspace-tab { gap:6px; padding-inline:6px; }
  #workspaceNav .workspace-tab svg { width:18px; height:18px; flex-basis:18px; }
}
@media (max-width:720px) and (pointer:coarse) { .stage > #workspaceNav { padding-right:66px; } }
:root[dir="rtl"] .workspace-account-actions { flex-direction:row-reverse; }

/* A stable preview title bar makes editing a mode, separate from image actions. */
#canvasSurface > .preview-mode-header {
  position:absolute; inset:16px 20px auto; z-index:25;
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  min-height:34px; pointer-events:none;
}
/* The mode control stays in the header; the quiet label follows the photo. */
#canvasSurface > .preview-window-title {
  position:absolute; z-index:24; display:block;
  left:calc(var(--preview-photo-right, 100%) - 12px); right:auto;
  top:calc(var(--preview-photo-top, 0px) + 12px); transform:translateX(-100%);
  width:max-content; max-width:max(0px, calc(var(--preview-photo-width, 0px) - 24px));
  min-height:0; height:auto; margin:0; padding:5px 9px;
  border:1px solid color-mix(in srgb,var(--line) 55%,transparent); border-radius:8px;
  background:color-mix(in srgb,var(--surface-raised) 85%,transparent);
  color:var(--muted); box-shadow:0 1px 5px #00000008;
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  font-size:11px; font-weight:500; line-height:1.4;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; pointer-events:none;
}
#canvasPanel.is-editing-image #canvasSurface > .preview-window-title {
  left:calc(var(--preview-photo-right, 100%) - 60px);
  max-width:max(0px, calc(var(--preview-photo-width, 0px) - 76px));
  color:var(--accent);
}
#canvasSurface:has(> #canvasImageLink[hidden]) > .preview-window-title,
#canvasPanel.has-contained-viewer[id] .preview-window-title { visibility:hidden; }
#canvasSurface .preview-mode-header > .preview-edit-toggle {
  position:static; display:inline-flex; flex:0 0 auto; align-items:center; justify-content:center;
  gap:7px; width:auto; height:auto; min-height:34px; max-width:100%; padding:7px 12px;
  border:1px solid var(--line); border-radius:10px; background:var(--surface-raised);
  color:var(--text); box-shadow:0 1px 2px #00000006; pointer-events:auto;
  font:inherit; font-size:12px; font-weight:500; line-height:1.4; white-space:nowrap;
  transition:background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
#canvasSurface .preview-mode-header > .preview-edit-toggle[hidden] { display:none; }
#canvasSurface .preview-mode-header > .preview-edit-toggle[aria-pressed="true"] {
  outline:none;
  color:var(--accent); border-color:color-mix(in srgb,var(--accent) 22%,var(--line));
  background:var(--accent-faint); box-shadow:none;
}
#canvasSurface .preview-mode-header > .preview-edit-toggle svg {
  flex:0 0 17px; width:17px; height:17px; fill:none; stroke:currentColor;
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;
}
#canvasSurface .preview-edit-toggle .preview-edit-exit-icon,
#canvasSurface .preview-edit-toggle[aria-pressed="true"] .preview-edit-enter-icon { display:none; }
#canvasSurface .preview-edit-toggle[aria-pressed="true"] .preview-edit-exit-icon { display:block; }
#canvasSurface .preview-mode-header > .preview-edit-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media (hover:hover) {
  #canvasSurface .preview-mode-header > .preview-edit-toggle:hover { background:var(--surface-hover); }
  #canvasSurface .preview-mode-header > .preview-edit-toggle[aria-pressed="true"]:hover { background:color-mix(in srgb,var(--accent) 14%,var(--surface)); }
}
@container edit-photo (max-width:340px) {
  #canvasSurface > .preview-mode-header { inset-inline:12px; gap:8px; }
  #canvasSurface .preview-mode-header > .preview-edit-toggle { padding-inline:9px; gap:5px; }
}
@media (pointer:coarse) {
  #canvasSurface .preview-mode-header > .preview-edit-toggle { min-height:44px; }
}
@media (prefers-reduced-motion:reduce) {
  #canvasSurface .preview-mode-header > .preview-edit-toggle { transition:none; }
}

/* Multiple attachments use one cover and a count, without a duplicate strip. */
body #generationReferences .reference-role-card.has-split-reference.has-multiple-references {
  min-height: 100px;
}
body #generationReferences .has-multiple-references .reference-role-picker { cursor: default; }
body #generationReferences .has-split-reference .reference-card-actions:not(:has(> :not([hidden]))) { display: none; }
body #generationReferences .reference-card-actions .reference-replace-label[hidden] { display: none; }

/* Library source tabs mirror the main workspace; categories stay subordinate. */
#createMoodboardDock .moodboard-header {
  padding: 0 2px; gap: 8px; align-items: end;
  border-bottom: 1px solid var(--line); background: transparent;
}
#createMoodboardDock #createAssetTabs {
  flex: 0 1 auto; align-self: stretch; align-items: end; gap: 3px;
  padding: 0; border: 0; border-radius: 0; background: transparent;
  max-width: calc(100% - 40px);
}
#createMoodboardDock #createAssetTabs [role="tab"] {
  flex: 0 1 auto; min-width: 0; min-height: 38px; margin: 0 0 -1px; padding: 8px 15px;
  border: 1px solid transparent; border-radius: 9px 9px 0 0; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.4;
  white-space: normal; box-shadow: none; transition: background .16s ease, color .16s ease;
}
#createMoodboardDock #createAssetTabs [aria-selected="true"] {
  color: var(--accent); background: var(--workspace-panel); font-weight: 600;
  border-color: var(--line); border-bottom-color: var(--workspace-panel); box-shadow: none;
}
#createMoodboardDock #createAssetTabs [role="tab"]::after { display: none; }
#createMoodboardDock .moodboard-header > #workspace-tab-browser {
  margin: 0; margin-inline-start: auto; width: 32px; min-width: 32px; height: 32px;
  padding: 7px; border-radius: 8px; color: var(--muted);
}
#createMoodboardDock .included-category-tabs {
  gap: 4px; padding: 4px 14px 12px; background: transparent;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin;
}
#createMoodboardDock .included-category-tabs button {
  flex: 1 0 auto; min-height: 30px; padding: 6px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); box-shadow: none;
  font-size: 11px; font-weight: 500; line-height: 1.45; white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
#createMoodboardDock .included-category-tabs button[aria-selected="true"] {
  color: var(--accent); background: var(--accent-faint); font-weight: 600;
}
#createMoodboardDock :is(.included-upload, .image-order-lock, .included-clear-selection) {
  box-sizing: border-box; min-height: 30px; height: 30px; border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: var(--composer-card-solid); color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%); font-size: 11px; font-weight: 500;
}
#createMoodboardDock .included-upload { padding: 5px 12px; }
#createMoodboardDock .image-order-lock { width: 30px; }
#createMoodboardDock .image-order-lock svg { width: 16px; height: 16px; }
#createMoodboardDock .image-order-lock[aria-pressed="true"] { color: var(--accent); background: var(--accent-faint); }
#createMoodboardDock :is(.included-category-tabs button, #createAssetTabs [role="tab"], .included-upload, .image-order-lock):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (hover: hover) {
  #createMoodboardDock .included-category-tabs button[aria-selected="false"]:hover,
  #createMoodboardDock :is(.included-upload, .image-order-lock):not(:disabled):hover { background: var(--surface-hover); color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
  #createMoodboardDock :is(.included-category-tabs button, #createAssetTabs [role="tab"]) { transition: none; }
}

/* Give reference drop footers room while preserving the compact short-window layout. */
body #generationReferences .has-split-reference > .reference-add-zone {
  height: clamp(28px, calc(3vh + 1px), 40px);
  min-height: clamp(28px, calc(3vh + 1px), 40px);
  flex-shrink: 0; padding-block: 7px;
}
@media (max-height: 900px) {
  body #generationReferences .has-split-reference > .reference-add-zone { padding-block: 5px; }
}
@media (pointer: coarse) {
  body #generationReferences .has-split-reference > .reference-add-zone { min-height: 40px; height: auto; }
}

/* My images shares the sample selection toolbar without arrangement controls. */
#createMoodboardDock #userImageLibrary .reference-library-section > header { gap: 8px; align-items: center; }
#createMoodboardDock #userImageLibrary .reference-library-actions { margin-inline-start: auto; }
#createMoodboardDock #userImageLibrary :is(.reference-section-move, .library-sort-trigger, .asset-density-buttons, .image-order-lock) { display: none; }
#createMoodboardDock #userImageLibrary .included-clear-selection[hidden] { display: none; }

/* Remove nested panel frames and spend the recovered area on images. */
#createSideRail #createMoodboardDock { padding: 8px; }
#createMoodboardDock :is(#builtinModelLibrary, #userImageLibrary) {
  border: 0; border-radius: 0; margin: 0; background: transparent;
}
#createMoodboardDock .moodboard-header > #workspace-tab-browser { margin-bottom: 3px; }
#createMoodboardDock .included-category-tabs,
#createMoodboardDock #userLibraryCategories {
  min-height: 0; gap: 3px; padding: 7px 2px;
  background: transparent; border-bottom: 1px solid var(--line);
}
#createMoodboardDock .included-category-tabs button,
#createMoodboardDock #userLibraryCategories button { min-height: 28px; padding: 5px 8px; }
#createMoodboardDock .builtin-model-content,
#createMoodboardDock #userImageLibrary #moodboardGrid { padding: 8px 2px 2px; }
#createMoodboardDock .included-section > header,
#createMoodboardDock #userImageLibrary .reference-library-section > header {
  min-height: 30px; padding: 0 0 8px; margin: 0; gap: 8px;
}
#createMoodboardDock > #assetSelectionBar { min-height: 36px; margin-top: 6px; padding: 3px 2px 0; }

/* One upper-right attachment removal control for every reference role. */
body #generationReferences .reference-role-card > .reference-role-remove:not([hidden]) {
  position: absolute; top: 5px; right: 5px; left: auto; z-index: 4;
  display: grid; place-items: center;
}
body #generationReferences .reference-role-card > .reference-role-remove[hidden] { display: none !important; }
@media (hover: hover) and (pointer: fine) {
  body #generationReferences .reference-role-card > .reference-role-remove:not([hidden]) { opacity: 0; pointer-events: none; }
  body #generationReferences .reference-role-card:hover > .reference-role-remove:not([hidden]),
  body #generationReferences .reference-role-card:focus-within > .reference-role-remove:not([hidden]) { opacity: 1; pointer-events: auto; }
}

#promptField .prompt-input-surface { display: grid; }
#promptField #generationComposerFields .prompt-input-surface > #prompt { grid-area: 1 / 1; height: 100%; }
#promptField .prompt-empty-hint { grid-area: 1 / 1; pointer-events: none; color: var(--muted); opacity: .7; font-size: 13px; line-height: 1.65; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
#promptField .prompt-empty-hint > span { display: block; }
/* The shared grid row grows for long translations; the shortcut stays below. */
#promptField .prompt-empty-hint[hidden] { display: none; }
#promptField .prompt-input-surface:has(> .prompt-empty-hint:not([hidden])) > #prompt::placeholder { color: transparent; }

.preview-privacy-reveal { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); z-index: 8; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; font-size: 12px; cursor: pointer; }
.preview-privacy-reveal[hidden] { display: none; }
#canvasSurface > #previewPrivacyReveal { inset: var(--preview-photo-center-y, 50%) auto auto var(--preview-photo-center-x, 50%); transform: none; translate: -50% -50%; margin: 0; }
.preview-privacy-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#canvasImageLink img { transition: filter 250ms ease, opacity 250ms ease; }
#canvasImageLink.is-privacy-obscured { background: var(--panel); }
#canvasImageLink.is-privacy-obscured img { opacity: .5; filter: blur(28px) saturate(.65); transform: none; }
.preview-privacy-reveal { background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: blur(20px) saturate(1.1); -webkit-backdrop-filter: blur(20px) saturate(1.1); box-shadow: 0 8px 28px #00000012; max-width: calc(100% - 40px); text-align: center; }
#privacyCompletionNotice { flex-basis: 100%; font-size: 11px; }
#privacyCompletionNotice:empty { display: none; }
.privacy-off-notice { position: absolute; z-index: 9; inset: var(--preview-photo-center-y, 50%) auto auto var(--preview-photo-center-x, 50%); translate: -50% -50%; transform:none; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--muted); font-size: 12px; white-space: nowrap; pointer-events: none; }
.privacy-off-notice[hidden] { display: none; }
/* One visual language for privacy and confirmed preview-removal notices. */
.preview-privacy-reveal, .privacy-off-notice, .deletion-feedback-status[data-placement="preview-center"] {
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 72%, transparent); color: var(--muted);
  backdrop-filter: blur(20px) saturate(1.1); -webkit-backdrop-filter: blur(20px) saturate(1.1);
  box-shadow: 0 8px 28px #00000012; font-size: 12px; font-weight: 400; line-height: 1.4;
  text-align: center; white-space: normal; overflow-wrap: anywhere;
}
.topbar-utility-actions .workspace-account-actions { position: static; margin: 0; padding: 0; }
.stage #workspaceNav { padding-right: 12px; }
.topbar-utility-actions .workspace-account-actions { display: flex; align-items: center; align-self: center; }
.privacy-off-notice:not([hidden]) { animation: privacy-off-fade 1600ms ease both; }
@keyframes privacy-off-fade { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .privacy-off-notice:not([hidden]) { animation: none; } }
@media (prefers-reduced-motion: reduce) { #canvasImageLink img { transition: none; } }
.launch-feedback-slot { min-width: 0; width: 100%; }
.launch-feedback-slot:not(:has(#preparationFeedback:not([hidden]))) { display: none; }
.launch-feedback-slot:has(#preparationFeedback[data-live-phase="generation"]) { display: none; }
/* Activity lives in generation history; the button always shows its next action. */
#generateButton .generation-icon { flex: 0 0 18px; width: 18px; height: 18px; min-width: 18px; border: 0; animation: none; transition: none; }
#generateButton .generation-icon > g { display: none; }
#generateButton:not([data-action]) .generation-action-create,
#generateButton[data-action="create"] .generation-action-create,
#generateButton[data-action="continue"] .generation-action-continue,
#generateButton[data-action="edit"] .generation-action-edit { display: inline; }
.task-history-card .task-status-group, .task-history-card .task-queue-summary { display: none; }
.task-history-count { margin-inline-start: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.workspace-account-actions #railStatus { position: relative; width: 36px; min-width: 36px; height: 36px; padding: 5px; border: 1px solid var(--line); border-radius: 50%; background: transparent; }
.workspace-account-actions #railStatus .gpt-account-copy, .workspace-account-actions #railStatus .gpt-account-initials { display: none; }
#railStatus .gpt-account-avatar { width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); }
.workspace-account-actions #railStatus.has-profile .gpt-account-avatar svg { display: block; }
#railStatus .account-smile, #railStatus.ready .account-neutral { display: none; }
#railStatus.ready .account-smile { display: block; }
#railStatus.ready .gpt-account-avatar { color: var(--text); }
.workspace-account-actions #railStatus .rail-status-dot { display: none; }
#railStatus.checking .gpt-account-avatar { border: 1px solid var(--line); border-top-color: var(--accent); border-radius: 50%; }
.gpt-account-menu-header { display: none; }
#gptAccountMenu { width: max-content; min-width: 144px; max-width: min(220px, calc(100vw - 16px)); }
#gptAccountMenu::backdrop { background: transparent; backdrop-filter: none; pointer-events: none; }
.topbar-utility-actions .workspace-account-actions #railStatus { inset: auto; margin: 0; transform: none; display: flex; align-items: center; justify-content: center; }
.workspace-account-actions #railStatus .gpt-account-avatar { display: flex; align-items: center; justify-content: center; }
.workspace-account-actions #railStatus.ready .gpt-account-avatar { color: var(--good-text); }
.workspace-account-actions #railStatus.checking .gpt-account-avatar { color: var(--accent); border: 0; }
.workspace-account-actions #railStatus:is(.offline,.usage-limit) .gpt-account-avatar { color: var(--danger-text); }
#railStatus.ready .account-disconnected, #railStatus.checking .account-disconnected { display: none; }
.launch-feedback-slot #preparationFeedback { flex-wrap: nowrap; min-height: 40px; padding: 6px 2px; }
.launch-feedback-slot #preparationFeedback .preparation-copy { flex: 1 1 0%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.launch-feedback-slot .preparation-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
#preparationFeedback .preparation-detail { display: inline; margin: 0; font-size: inherit; line-height: inherit; opacity: .8; }
/* Errors retain their complete explanation and actionable controls. */
.launch-feedback-slot #preparationFeedback[data-phase="error"] { flex-wrap: wrap; padding: 8px 10px; }
.launch-feedback-slot #preparationFeedback[data-phase="error"] .preparation-copy { flex-basis: calc(100% - 28px); white-space: normal; overflow: visible; }
.task-history-card .task-queue-summary { display: none; }
.task-history-card .task-queue-summary[hidden] { display: none; }
.task-queue-metric { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.task-queue-metric[hidden] { display: none; }
.task-queue-metric strong { color: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.task-live-region { display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden; transition: grid-template-rows 320ms cubic-bezier(.22, 1, .36, 1), opacity 200ms ease, visibility 0s linear 320ms; }
.task-live-content { min-height: 0; overflow: hidden; }
.task-live-region[data-active="true"], .task-live-region:has(#preparationFeedback:not([hidden])) { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition: grid-template-rows 260ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease, visibility 0s; }
.task-live-content .task-image-heading [data-image-label] { display: none; }
.task-live-content .task-image-progress-list { gap: 6px; padding-bottom: 8px; }
.task-live-region[data-active="false"]:has(#preparationFeedback:not([hidden])) :is(.task-queue-summary, .task-image-progress-list) { display: none; }
@media (prefers-reduced-motion: reduce) { .task-live-region, .task-live-region[data-active="true"], .task-live-region:has(#preparationFeedback:not([hidden])) { transition: none; } }
.task-history-card #preparationFeedback { padding: 8px 12px; }

/* Camera controls share a quiet track; only the chosen options are raised. */
body :is(#shotSizePicker, #cameraAnglePicker) {
  container-type: inline-size;
  container-name: camera-picker;
  gap: 7px;
  border: 0;
  padding-block: 0;
}
body #cameraAnglePicker {
  margin-block-start: 3px;
  padding-block-start: 12px;
  border-block-start: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-label {
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
body :is(#shotSizePicker, #cameraAnglePicker) .camera-options-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
  padding: 4px;
  border: 0;
  border-radius: 11px;
  background: color-mix(in srgb, var(--text) 4%, var(--composer-card-solid));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 4%, transparent);
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-options {
  grid-column: 1;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-options-extra, .camera-angle-options-extra) {
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button {
  grid-column: 2;
  grid-row: 1;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option {
  min-height: 52px;
  gap: 4px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option > span {
  min-width: 0;
  max-width: 100%;
  text-align: center;
  text-wrap: balance;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-icon-frame { display: none; }
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: var(--surface-raised, var(--panel));
  box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
  font-weight: 600;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option[aria-pressed="true"]:not(:focus-visible) { outline: none; }
body :is(#shotSizePicker, #cameraAnglePicker).is-camera-series .shot-size-option[aria-pressed="true"] {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  box-shadow: none;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"])[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: var(--surface-raised, var(--panel));
  font-weight: 600;
}
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option:is([data-shot-size="auto"], [data-camera-angle="auto"]) > .shot-icon { color: inherit; }
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button {
  position: relative;
  flex: 0 0 54px;
  min-height: 52px;
  gap: 3px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
  box-shadow: none;
  font-weight: 500;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button::before {
  content: "";
  position: absolute;
  inset-block: 10px;
  inset-inline-start: -5px;
  width: 1px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  pointer-events: none;
}
body :is(#shotSizePicker, #cameraAnglePicker) :is(.camera-series-label, .camera-series-count) {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  text-wrap: balance;
}
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-label { font-size: 11px; font-weight: 600; }
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: var(--surface-raised, var(--panel));
  box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}
body #cameraAnglePicker .camera-angle-option[data-camera-angle-group="direction"] + .camera-angle-option[data-camera-angle-group="elevation"]::before {
  inset: auto;
  inset-block: 11px;
  inset-inline-start: -3px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button):active { transform: none; }
body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option:disabled { opacity: .5; cursor: not-allowed; }
body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button:disabled { opacity: .5; cursor: wait; }
@media (hover: hover) and (pointer: fine) {
  body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button):not(:disabled):not([aria-pressed="true"]):hover {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 6%, transparent);
  }
}
@container camera-picker (max-width: 380px) {
  body #shotSizePicker .shot-size-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body #cameraAnglePicker .camera-angle-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-options-extra, .camera-angle-options-extra) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body #cameraAnglePicker .camera-angle-option[data-camera-angle="auto"] { grid-row: 1 / span 2; }
  body #cameraAnglePicker .camera-angle-option[data-camera-angle-group="direction"] + .camera-angle-option[data-camera-angle-group="elevation"]::before { content: none; }
  body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button { flex-basis: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button) { transition: none; }
}
@media (forced-colors: active) {
  body :is(#shotSizePicker, #cameraAnglePicker) .camera-options-row { border: 1px solid CanvasText; background: Canvas; box-shadow: none; }
  body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button) { color: ButtonText; background: ButtonFace; box-shadow: none; }
  body :is(#shotSizePicker, #cameraAnglePicker).shot-size-picker :is(.shot-size-option, .camera-series-button)[aria-pressed="true"] { border-color: Highlight; color: Highlight; box-shadow: none; }
  body :is(#shotSizePicker, #cameraAnglePicker) .shot-size-option[aria-pressed="true"]:not(:focus-visible) { outline: 1px solid Highlight; outline-offset: -1px; }
  body :is(#shotSizePicker, #cameraAnglePicker) :is(.shot-size-option, .camera-series-button):focus-visible { outline-color: Highlight; }
  body :is(#shotSizePicker, #cameraAnglePicker).shot-size-picker :is(.shot-size-option, .camera-series-button):disabled { color: GrayText; opacity: 1; }
  body :is(#shotSizePicker, #cameraAnglePicker) .camera-series-button::before,
  body #cameraAnglePicker .camera-angle-option[data-camera-angle-group="direction"] + .camera-angle-option[data-camera-angle-group="elevation"]::before { background: CanvasText; }
}
.prompt-submit-shortcut { display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap; gap:6px; margin:6px 2px 0; color:var(--muted); font-size:10px; line-height:1.5; }
.prompt-submit-shortcut kbd { padding:0; border:0; background:transparent; color:inherit; font:inherit; }
#canvasSurface .carousel-arrow { opacity:0; transition:opacity 650ms ease; }
#canvasSurface:hover .carousel-arrow, #canvasSurface .carousel-arrow:focus-visible { opacity:1; transition-duration:180ms; }
#canvasSurface:hover .carousel-arrow:disabled { opacity:.25; }
@media (hover:none) { #canvasSurface .carousel-arrow { opacity:1; } #canvasSurface .carousel-arrow:disabled { opacity:.25; } }
@media (prefers-reduced-motion:reduce) { #canvasSurface .carousel-arrow { transition:none; } }

/* Per-image wardrobe pose shares the region action row. */
.reference-region-buttons { direction:ltr; display:flex; align-items:center; gap:4px; min-width:0; margin-left:auto; }
#generationReferences .reference-region-buttons > .reference-pose-toggle { font:inherit; font-size:11px; line-height:1.25; padding:4px 8px; border:0; border-radius:7px; background:transparent; color:var(--muted); box-shadow:none; min-height:32px; }
#generationReferences .reference-region-buttons > .reference-pose-toggle[aria-pressed="true"] { color:var(--accent); }
.reference-pose-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#generationReferences .has-split-reference[data-reference-role="wardrobe"] > .reference-role-region-actions { flex-wrap:wrap; gap:4px; }
#generationReferences .has-split-reference[data-reference-role="wardrobe"] > .reference-role-region-actions > .reference-region-targets { flex-basis:100%; }
#generationReferences .reference-region-buttons > .custom-reference-refine { position:static; margin:0; min-height:32px; flex:0 1 auto; white-space:normal; }
#generationReferences .reference-region-buttons > .reference-pose-toggle { flex:0 1 auto; white-space:normal; }

.app-notification-action { flex:0 0 auto; border:0; background:transparent; color:var(--accent); font:inherit; font-size:11px; padding:4px; cursor:pointer; }
.app-notification-action:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }

.app-notification-action { order:2; }
.app-notification-close { order:3; }

/* Keep the heading and clear action together, including during active generation. */
.topbar-launch-card .task-toolbar.task-history-summary { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto; gap: 0; align-items: center; padding-inline-end: 26px; }
.topbar-launch-card .task-toolbar.task-history-summary > .task-toggle { grid-column: 1; grid-row: 1; position: static; min-width: 0; width: 100%; }
.topbar-launch-card .task-history-summary > .task-toggle [data-chevron] { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); }
.topbar-launch-card .task-history-summary > .task-toggle[aria-expanded="true"] [data-chevron] { transform: translateY(-50%) rotate(180deg); }
.task-history-actions { grid-column: 2; grid-row: 1; min-width: 0; max-width: 160px; }
.task-history-actions[hidden] { display: none; }
.task-history-actions .job-history-clear { display: inline-flex; align-items: center; gap: 5px; width: auto; min-height: 30px; padding: 5px 6px; font: inherit; font-size: 11px; line-height: 1.4; text-align: start; }
.task-history-actions .job-history-clear svg { flex: 0 0 16px; }
.task-history-actions .job-history-clear span { overflow-wrap: anywhere; }
