/* Image workspace: one app shell, a compact editor and a flexible image gallery. */
body:has(.creation-panel) { height: 100dvh; }
body:has(.creation-panel) #globalNav { width: 72px; padding: 18px 0 12px; }
body:has(.creation-panel) #globalNav > div:first-child { width: 36px; height: 36px; margin-bottom: 28px; }
body:has(.creation-panel) #dynamicMenuList { padding-inline: 8px; }
body:has(.creation-panel) #dynamicMenuList > div + div { margin-top: 8px; }
.image-studio { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #f5f7fb; }
.studio-topbar { min-height: 68px; padding: 12px 24px; display: flex; align-items: center; gap: 20px; background: #fff; border-bottom: 1px solid #e9edf3; }
.studio-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; color: #172033; white-space: nowrap; }
.studio-brand img { border-radius: 8px; }
.studio-breadcrumb { display: inline-flex; align-items: center; gap: 16px; font-size: 13px; color: #697586; }
.studio-breadcrumb svg { width: 14px; color: #a7b0be; }
.studio-body { display: flex; flex: 1; min-height: 0; gap: 20px; padding: 20px 24px; }
.creation-panel { width: 344px; flex: 0 0 344px; display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid #e6ebf2; border-radius: 16px; box-shadow: 0 3px 12px #1c345006; overflow: hidden; }
.creation-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 20px 10px; }
.creation-heading h1 { font-size: 20px; line-height: 28px; font-weight: 650; color: #172033; letter-spacing: -.3px; }
.creation-heading p { font-size: 12px; color: #697586; margin-top: 4px; }
.points-badge { display: flex; align-items: center; gap: 4px; white-space: nowrap; padding: 6px 9px; border-radius: 8px; color: #2563eb; background: #eff5ff; font-size: 12px; font-weight: 500; }
.points-badge svg { width: 14px; height: 14px; }
.creation-fields { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 20px; }
.creation-step + .creation-step { margin-top: 16px; }
.step-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.step-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #263247; }
.optional-label, .field-hint { font-size: 12px; font-weight: 400; color: #697586; }
.optional-label { border-radius: 5px; padding: 1px 5px; background: #f3f5f8; }
.text-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 5px 7px; border-radius: 7px; font-size: 12px; font-weight: 500; color: #2563eb; cursor: pointer; }
.text-action:hover { color: #1d4ed8; background: #eff5ff; }
.text-action svg { width: 14px; height: 14px; }
.prompt-editor { border: 1px solid #dfe5ee; border-radius: 11px; overflow: hidden; background: #fff; transition: border-color .16s, box-shadow .16s; }
.prompt-editor:focus-within { border-color: #749af2; box-shadow: 0 0 0 3px #2563eb0c; }
.prompt-presets { display: flex; align-items: center; background: #f7f9fc; border-bottom: 1px solid #edf0f5; }
.prompt-presets select { appearance: none; flex: 1; width: 0; min-width: 0; min-height: 40px; padding: 9px 32px 9px 12px; font-size: 13px; color: #43516a; outline: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23748399' stroke-width='1.5'%3E%3Cpath d='m8 10 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px; color: #697586; cursor: pointer; }
.icon-action:hover { color: #2563eb; background: #eff5ff; }
.icon-action svg { width: 16px; height: 16px; }
.danger-action:hover { color: #be123c; background: #fff1f2; }
.prompt-input-wrap { position: relative; }
#manualPrompt { display: block; width: 100%; height: 112px; min-height: 100px; max-height: 260px; resize: vertical; padding: 12px 12px 38px; font-size: 14px; line-height: 1.75; outline: none; background: transparent; }
#manualPrompt::placeholder { color: #8793a5; }
.bookmark-action { position: absolute; bottom: 6px; right: 7px; background: #f5f7fb; }
.reference-dropzone { position: relative; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border: 1px dashed #cfd9e7; border-radius: 10px; background: #fafbfd; cursor: pointer; }
.reference-dropzone:hover { border-color: #7da1f5; background: #eff5ff; }
.reference-dropzone > svg { width: 22px; height: 22px; color: #6480a7; flex-shrink: 0; }
.reference-dropzone strong { display: block; font-size: 13px; font-weight: 500; color: #43516a; }
.reference-dropzone span { display: block; margin-top: 3px; font-size: 11px; color: #697586; }
.reference-dropzone input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.reference-dropzone:focus-within { outline: 2px solid #2563eb; outline-offset: 3px; }
#imagePreview:empty { display: none; }
#imagePreview:not(:empty) { padding-top: 10px; }
.parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.model-field { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500; color: #5c6a80; }
.field select { appearance: none; display: block; width: 100%; min-width: 0; height: 40px; border: 1px solid #dfe5ee; border-radius: 8px; padding: 8px 26px 8px 10px; font-size: 13px; color: #263247; background: #fafbfd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23748399' stroke-width='1.5'%3E%3Cpath d='m8 10 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 7px center / 16px; }
.field select:hover { border-color: #bac8dd; }
.creation-submit { flex-shrink: 0; padding: 14px 20px 16px; border-top: 1px solid #edf0f5; background: #fff; }
.cost-preview { margin-bottom: 10px; font-size: 12px; text-align: center; font-weight: 400; color: #697586; }
.generate-button { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; }
.generate-button svg { width: 18px; height: 18px; }
.generate-button:disabled { cursor: not-allowed; }
.login-hint { margin-top: 10px; font-size: 12px; text-align: center; color: #697586; }
.results-panel { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.workspace-toolbar { min-height: 56px; padding: 0 2px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workspace-title h2 { font-size: 21px; line-height: 28px; font-weight: 650; color: #172033; letter-spacing: -.3px; }
.workspace-title > span { font-size: 12px; color: #697586; display: block; margin-top: 3px; }
.history-retention { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #697586; white-space: nowrap; }
.history-retention svg { width: 14px; height: 14px; }
.workspace-account { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.account-profile { display: flex; align-items: center; gap: 8px; }
.account-wallet { display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-radius: 9px; cursor: pointer; background: #f7f9fc; border: 1px solid #edf0f5; }
.account-wallet:hover { background: #eff5ff; }
.account-wallet > svg { width: 18px; height: 18px; color: #6480a7; }
.account-wallet > span { display: flex; flex-direction: column; align-items: flex-start; font-size: 12px; color: #43516a; font-weight: 500; }
.account-balance { font-size: 11px; color: #697586; }
.login-entry { display: inline-flex; align-items: center; gap: 8px; background: #2563eb; color: #fff; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 500; }
.login-entry svg { width: 14px; height: 14px; }
.history-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.history-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 12px; padding: 4px 2px; gap: 12px; border-bottom: 1px solid #e5eaf2; }
.history-caption { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: #263247; }
.refresh-history { color: #5c6a80; background: #fff; border: 1px solid #e1e7ef; padding-inline: 10px; }
#historyList { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 16px; }
#historyList > .history-batch { padding: 16px; margin-bottom: 16px; border: 1px solid #e5eaf2; border-radius: 14px; background: #fff; box-shadow: 0 2px 5px #1c345003; }
.history-batch-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.history-batch-header > span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #697586; font-weight: 400; }
.history-batch-header .history-model { padding: 4px 8px; border-radius: 6px; color: #5c6a80; background: #f5f7fb; }
.results-panel .queue-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: start; }
.results-panel .queue-image-item { width: 100%; max-width: none; min-width: 0; flex: none; }
.results-panel .image-frame { padding: 0; border: 1px solid #e7ecf3; border-radius: 10px; box-shadow: none; overflow: hidden; background: #fff; }
.results-panel .image-frame > .p-2 { padding: 0; }
.results-panel .image-frame .rounded-\[2\.2rem\], .results-panel .image-frame .rounded-\[2\.5rem\] { border-radius: 8px 8px 0 0; }
.results-panel .image-frame > .p-4 { padding: 10px; }
.results-panel .image-frame button { border-radius: 6px; }
.results-panel .workspace-image-actions { display: grid; grid-template-columns: .8fr 1.2fr 1fr; padding: 8px 6px; gap: 3px; }
.results-panel .workspace-image-actions button { min-width: 0; min-height: 32px; padding: 5px 3px; gap: 4px; border: 0; background: #fff; font-size: 12px; font-weight: 400; color: #5c6a80; white-space: nowrap; }
.results-panel .workspace-image-actions button:hover { color: #2563eb; background: #eff5ff; }
.results-panel .workspace-image-actions button svg { width: 13px; height: 13px; }
.results-panel .image-frame > .bg-white { padding: 0 8px 8px; }
.results-panel .image-frame > .bg-white > button { min-height: 30px; padding: 5px; border: 1px solid #edf0f5; border-radius: 6px; font-size: 11px; font-weight: 400; color: #697586; background: #f7f9fc; }
.results-panel .image-frame > .bg-white > button:hover { background: #eff5ff; }
.results-panel .image-frame > .bg-white > button svg { width: 13px; height: 13px; }
.results-panel .image-frame img:hover { transform: none; }
.results-panel .image-frame img { width: 100%; }
.results-panel .image-frame .result-image-preview { display:flex; align-items:center; justify-content:center; width:100%; min-height:0; padding:0; border:0; border-radius:0; background:#f7f9fc; cursor:zoom-in; }
.result-image-preview img { display:block; max-height:70vh; object-fit:contain; border-radius:0; }
body:has(.creation-panel) #resultPreviewModal { width:100vw; height:100dvh; max-width:100vw; max-height:100dvh; margin:0; padding:32px; border:0; background:#101722f5; color:#fff; }
#resultPreviewModal[open] { display:flex; align-items:center; justify-content:center; }
#resultPreviewModal::backdrop { background:#101722d9; }
#resultPreviewImage { max-width:100%; max-height:100%; object-fit:contain; }
.result-preview-close { position:fixed; top:16px; right:16px; display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:#ffffff26; color:#fff; }
.result-preview-close:hover { background:#ffffff40; }
.result-preview-close svg { width:22px; height:22px; }
.results-panel .image-frame > .p-4 > .grid { gap: 6px; }
.history-loading { align-items: center; justify-content: center; gap: 6px; padding: 10px; font-size: 12px; color: #697586; }
.history-loading:not(.hidden) { display: flex; }
.workspace-empty { height: 100%; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 20px 60px; border: 1px dashed #dce4ef; border-radius: 16px; background: #ffffff80; }
.empty-illustration { width: 116px; height: 100px; position: relative; margin-bottom: 20px; }
.empty-tile { position: absolute; width: 76px; height: 84px; border: 1px solid #dce5f3; border-radius: 14px; background: #fff; }
.empty-tile-back { left: 12px; top: 2px; transform: rotate(-13deg); background: #edf3fe; }
.empty-tile-front { left: 35px; top: 12px; transform: rotate(7deg); display: grid; place-items: center; box-shadow: 0 8px 20px #315aa20a; }
.empty-tile-front svg { width: 32px; height: 32px; color: #7397dc; }
.workspace-empty h3 { font-size: 19px; font-weight: 600; color: #34435b; }
.workspace-empty p { max-width: 340px; margin-top: 8px; font-size: 13px; line-height: 1.7; color: #697586; }
.empty-steps { display: flex; align-items: center; gap: 12px; margin-top: 26px; color: #697586; font-size: 12px; }
.empty-steps span { display: inline-flex; align-items: center; gap: 6px; }
.empty-steps svg { width: 14px; height: 14px; }
.empty-steps > svg { width: 12px; color: #abb6c5; }
.creation-panel .hidden, .results-panel .hidden, .studio-topbar .hidden { display: none !important; }
body:has(.creation-panel) :is(button, a, select, textarea, input):focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
body:has(.creation-panel) #toastContainer { max-width: calc(100vw - 24px); right: 12px; }
body:has(.creation-panel) .toast { min-width: 0; max-width: 100%; }
@media (min-width: 1600px) { .creation-panel { width: 360px; flex-basis: 360px; } .results-panel .queue-image-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
@media (max-width: 1100px) {
    .studio-topbar { padding-inline: 18px; }
    .studio-body { padding: 16px; gap: 16px; }
    .creation-panel { width: 300px; flex-basis: 300px; }
    .creation-heading, .creation-fields, .creation-submit { padding-inline: 16px; }
    .points-badge { font-size: 11px; padding: 5px; }
    .results-panel .queue-image-grid { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 10px; }
    #historyList > .history-batch { padding: 12px; }
    .workspace-toolbar { flex-wrap: wrap; }
    .history-retention { display: none; }
}
@media (min-width: 768px) and (max-height: 850px) {
    .studio-topbar { min-height: 60px; padding-block: 8px; }
    .studio-body { padding-block: 14px; }
    .creation-heading { padding-top: 14px; padding-bottom: 8px; }
    .creation-heading p { display: none; }
    .creation-step + .creation-step { margin-top: 12px; }
    .step-heading { margin-bottom: 6px; }
    #manualPrompt { height: 100px; }
    .reference-dropzone { min-height: 52px; padding-block: 8px; }
    .parameter-grid { gap: 8px 10px; }
    .field label { margin-bottom: 4px; }
    .creation-submit { padding-top: 10px; padding-bottom: 12px; }
}
@media (max-width: 767px) {
    body:has(.creation-panel) { overflow: auto; height: auto; min-height: 100dvh; }
    body:has(.creation-panel) > .flex, body:has(.creation-panel) > .flex > main { overflow: visible; flex-direction: column; }
    body:has(.creation-panel) #globalNav { width: 100%; flex-direction: row; padding: 8px 12px; gap: 12px; }
    body:has(.creation-panel) #globalNav > div:first-child { width: 32px; height: 32px; margin: 0; }
    body:has(.creation-panel) #dynamicMenuList { display: flex; overflow-x: auto; min-width: 0; gap: 4px; padding: 0; }
    body:has(.creation-panel) #dynamicMenuList > div + div { margin-top: 0; }
    body:has(.creation-panel) #globalUserProfile { display: none; }
    .studio-topbar { padding: 10px 14px; gap: 8px; }
    .studio-brand { font-size: 15px; }
    .studio-breadcrumb { display: none; }
    .studio-body { flex-direction: column; padding: 12px; gap: 20px; }
    .creation-panel { width: 100%; flex-basis: auto; }
    .creation-fields { overflow: visible; }
    #manualPrompt, .field select, .prompt-presets select { font-size: 16px; }
    .field select, .prompt-presets select, .text-action, .icon-action { min-height: 44px; }
    .icon-action { width: 44px; }
    .account-wallet > svg, .account-wallet .account-balance { display: none; }
    .account-wallet { background: transparent; border: 0; padding-inline: 0; }
    .results-panel { min-height: 420px; }
    #historyList { overflow: visible; }
    .results-panel .queue-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .results-panel .image-frame button { min-height: 44px; }
    .results-panel .workspace-image-actions button { font-size: 11px; gap: 2px; }
    .results-panel .workspace-image-actions button svg { width: 11px; }
    .workspace-empty { min-height: 340px; }
    .empty-steps { gap: 7px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { body:has(.creation-panel) *, body:has(.creation-panel) *::before, body:has(.creation-panel) *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
