:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #262622; background: #f2f1ed; font-size: 16px; line-height: 1.5; font-synthesis: none; -webkit-font-smoothing: antialiased;
  --ink: #262622; --muted: #85847d; --line: #e7e5df; --paper: #fffefa; --canvas: #e9e8e2;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { min-height: 44px; border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .36; cursor: not-allowed; }
button, a, input, select, textarea { transition: background-color .18s, color .18s, border-color .18s, box-shadow .18s; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #8b9fb980; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
input, select, textarea { min-width: 0; }
input, textarea { -webkit-appearance: none; }
input::placeholder, textarea::placeholder { color: #98978f; }
textarea { resize: vertical; line-height: 1.65; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 29px; line-height: 1.2; font-weight: 600; letter-spacing: -.9px; }
h2, .field-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
h3 { font-size: 16px; font-weight: 600; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Quiet application chrome. */
.app-header { height: 88px; padding: 0 44px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; border-bottom: 1px solid #dfded7; background: #f2f1edf2; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.brand { display: inline-flex; align-items: center; gap: 11px; min-height: 44px; font-size: 22px; font-weight: 600; letter-spacing: -.7px; }
.brand svg { width: 27px; height: 27px; stroke-width: 1.4; }
.main-nav { display: flex; gap: 3px; padding: 4px; border: 1px solid #dddbd5; border-radius: 13px; background: #e9e7e1f2; position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 30; }
.nav-item { min-width: 110px; padding: 8px 20px; border-radius: 9px; color: #77766e; font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 8px; }
.nav-item > svg { display: none; }
.nav-item:hover { color: var(--ink); background: #fffefa70; }
.nav-item.active, .nav-item[aria-current="page"] { color: #fffefa; background: var(--ink); box-shadow: 0 2px 4px #26262212; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; color: #737269; border-radius: 50%; }
.icon-button:hover { background: #e6e4dc; }
.icon-button > svg { width: 20px; height: 20px; }
.app-main { max-width: 1640px; margin: 0 auto; padding: 29px 44px 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; min-height: 44px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 5px; color: #6e6d65; font-size: 13px; font-weight: 500; white-space: nowrap; }
.text-button > svg { width: 17px; height: 17px; }
.text-button:hover { color: #171714; }
.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; gap: 8px; border-radius: 9px; padding: 11px 17px; font-size: 14px; font-weight: 500; line-height: 1.4; }
.primary-button { color: #fffefa; background: var(--ink); border: 1px solid var(--ink); }
.primary-button:hover { background: #414139; border-color: #414139; }
.secondary-button { border: 1px solid #dfddd5; background: transparent; color: #4a4942; }
.secondary-button:hover { background: #f2f0e9; border-color: #cdcbc2; }
.primary-button > svg, .secondary-button > svg { width: 18px; height: 18px; }
.compact-button { padding-inline: 16px; }
.subtle { color: var(--muted); font-size: 13px; font-weight: 400; }

/* A photographic canvas beside a single continuous composition panel. */
.studio-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 28px; align-items: start; }
.preview-panel { min-width: 0; background: var(--canvas); border: 1px solid #e2e0d8; border-radius: 12px; overflow: hidden; position: sticky; top: 112px; }
.result-stage { min-height: 560px; height: calc(100dvh - 204px); max-height: 1000px; position: relative; display: flex; align-items: stretch; justify-content: center; overflow: hidden; }
.empty-state { grid-column: 1 / -1; display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: center; min-height: 260px; text-align: center; padding: 36px; color: var(--muted); font-size: 14px; }
.empty-state p { color: #77766f; font-size: 17px; font-weight: 500; margin-bottom: 8px; letter-spacing: -.3px; }
.empty-state > span { color: #96958c; font-size: 13px; }
.empty-title { font-size: 17px; color: #77766f; font-weight: 500; letter-spacing: -.3px; margin-bottom: 8px; }
.empty-title + p { font-size: 13px; color: #96958c; font-weight: 400; line-height: 1.7; margin: 0; }
.empty-illustration { color: #aaa89e; margin-bottom: 26px; }
.empty-illustration svg { width: 66px; height: 66px; stroke-width: .9; }
.source-preview { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.source-preview > img, .result-stage > img { width: 100%; height: 100%; min-height: 0; object-fit: contain; padding: 25px 28px 50px; }
.preview-label { position: absolute; top: 18px; left: 19px; z-index: 2; padding: 6px 10px; border: 1px solid #ffffff80; border-radius: 6px; color: #6b6961; background: #fffff8cc; backdrop-filter: blur(12px); font-size: 13px; }
.source-caption { position: absolute; bottom: 18px; left: 20px; right: 20px; color: #78766c; font-size: 13px; text-align: center; }
.result-card { width: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.result-card > img { min-height: 0; width: 100%; height: 0; object-fit: contain; flex: 1; padding: 20px; cursor: zoom-in; }
.result-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; }
.result-actions button:not([class]), .result-actions a { min-height: 44px; padding: 10px 15px; border-radius: 8px; border: 1px solid #d5d3ca; background: #fffefa70; color: #4b4a42; font-size: 13px; font-weight: 500; }
.result-actions button:not([class]):hover { background: var(--paper); }
.result-card > .result-actions > button:last-child { background: var(--ink); color: #fffefa; border-color: var(--ink); }
.result-caption { font-size: 13px; color: var(--muted); padding: 0 20px 16px; }
.studio-controls { min-width: 0; min-height: 560px; height: calc(100dvh - 204px); position: sticky; top: 112px; display: flex; flex-direction: column; background: var(--paper); border: 1px solid #e2e0d9; border-radius: 14px; box-shadow: 0 6px 24px #34332803; overflow: visible; }
.composer-body { min-width: 0; padding: 4px 24px 10px; }
.input-panel { padding: 5px 0 12px; border-bottom: 1px solid var(--line); }
.section-heading { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.inline-actions { display: flex; align-items: center; gap: 15px; }
.inline-actions .text-button { padding-inline: 0; }
.inline-actions .text-button > svg { width: 16px; height: 16px; }
.person-slot, .base-slot { min-width: 0; }
.slot-placeholder, .empty-slot { min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px; border: 1px dashed #d8d5cc; border-radius: 7px; color: #959289; font-size: 13px; text-align: center; }
.slot-placeholder:before { content: ''; width: 24px; height: 24px; flex-shrink: 0; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23959388' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='7.5' r='3.5'/%3E%3Cpath d='M5 21v-2a7 7 0 0 1 14 0v2'/%3E%3C/svg%3E"); }
.selected-asset { position: relative; display: flex; min-width: 0; width: 100%; align-items: center; gap: 15px; padding-right: 28px; min-height: 64px; }
.selected-asset > img { flex-shrink: 0; width: 54px; height: 64px; object-fit: contain; border-radius: 6px; background: #f0eee7; }
.selected-info { flex: 1; min-width: 0; }
.selected-info > strong, strong.selected-info { display: block; font-size: 14px; line-height: 1.55; font-weight: 500; overflow-wrap: anywhere; }
.selected-info > span, .selected-info > small { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.remove-button { position: absolute; right: -9px; top: 0; display: flex; align-items: center; justify-content: center; padding: 0; min-width: 44px; min-height: 44px; color: #77746b; border-radius: 50%; font-size: 21px; z-index: 2; }
.remove-button:hover { color: #24231f; background: #e6e3da70; }
.remove-button > svg { width: 17px; height: 17px; }
.garment-slots, .reference-slots { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #d9d5ca transparent; padding: 1px 1px 3px; }
.garment-slots > .slot-placeholder { flex: 1; width: 100%; min-width: 0; min-height: 64px; }
.garment-slots > .slot-placeholder:before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23959388' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 3-6 4 3 5 3-2v11h8V10l3 2 3-5-6-4a4 4 0 0 1-8 0Z'/%3E%3C/svg%3E"); }
.garment-card, .reference-card { flex: 0 0 calc((100% - 20px) / 3); min-width: 82px; position: relative; background: #f0eee7; border-radius: 7px; overflow: hidden; border: 1px solid #e8e5dc; }
.garment-card > img, .reference-card > img { height: 78px; width: 100%; padding: 5px; object-fit: contain; }
.image-index { position: absolute; left: 6px; top: 6px; min-height: 23px; padding: 2px 5px; background: #fffefaed; color: #656157; border: 1px solid #e1ded3; border-radius: 4px; font-size: 13px; line-height: 19px; }
#garmentSlots .image-index { top: auto; bottom: calc(1.4em + 13px); }
.garment-card .remove-button, .reference-card .remove-button { right: -4px; top: -4px; background: linear-gradient(225deg, #fffefaee, #fffefa00 75%); border-radius: 0; font-size: 20px; }
.garment-name, .garment-card .asset-title, .reference-card .asset-title { display: block; padding: 4px 6px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; line-height: 1.4; color: #6c675c; background: #fffefa70; }
.reference-slots:empty { display: none; }
.reference-slots .garment-card > img { height: 74px; }
.inline-count { margin-left: 6px; font-size: 13px; font-weight: 400; color: #979389; }
.base-slot:empty:before { content: '不选素材，从文字开始创作'; display: block; padding: 2px 0 4px; color: #999589; font-size: 13px; }
.base-slot .selected-asset { min-height: 64px; }
.base-slot .selected-asset > img { height: 64px; width: 52px; }
.environment-panel { display: flex; align-items: center; gap: 16px; min-height: 46px; border-bottom: 1px solid var(--line); }
.environment-panel > .field-title { flex-shrink: 0; }
.environment-slot { min-width: 0; display: flex; flex: 1; justify-content: flex-end; align-items: center; gap: 8px; }
.environment-choice { display: flex; align-items: center; justify-content: flex-end; min-width: 0; gap: 8px; padding: 4px 0 4px 8px; color: #777166; font-size: 13px; }
.environment-choice > span:not(.environment-chevron) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 165px; }
.environment-choice > img { width: 36px; height: 32px; object-fit: contain; background: #ede9df; border-radius: 4px; }
.environment-chevron { color: #a39b8b; flex-shrink: 0; }
.environment-slot > .text-button { font-size: 13px; flex-shrink: 0; }
.prompt-panel { padding-top: 10px; }
.prompt-panel > .section-heading { margin-bottom: 7px; min-height: 32px; }
.prompt-editor { background: #fff; border: 1px solid #d9d6cc; border-radius: 9px; padding: 11px 13px 10px; transition: border-color .18s, box-shadow .18s; }
.prompt-editor:focus-within { border-color: #92958e; box-shadow: 0 0 0 3px #aaa89e17; }
.prompt-editor textarea { display: block; width: 100%; height: 80px; min-height: 80px; border: 0; background: transparent; padding: 0; font-size: 16px; resize: vertical; outline: none; }
.prompt-editor textarea:focus-visible { outline: none; }
.prompt-footnote { display: block; margin-top: 6px; font-size: 13px; color: #a29e92; }
.prompt-chips { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; gap: 7px; margin-top: 12px; }
.prompt-chips:empty { display: none; }
.prompt-chips > button { flex-shrink: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; min-height: 44px; border: 1px solid #e4e0d5; background: transparent; border-radius: 7px; padding: 8px 11px; color: #777166; font-size: 13px; line-height: 1.4; text-align: left; }
.prompt-chips > button:hover { color: #302e27; border-color: #c9c3b6; background: #f5f2e9; }
.prompt-chips > select { flex-shrink: 0; width: 112px; min-height: 44px; max-width: 100%; border: 1px solid #e4e0d5; border-radius: 7px; padding: 8px 18px 8px 8px; background: #fffefa; color: #777166; font-size: 13px; text-overflow: ellipsis; }
.composer-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; flex-shrink: 0; margin-top: auto; padding: 14px 24px; background: #fffefaf5; border-top: 1px solid #e8e5dc; border-radius: 0 0 14px 14px; z-index: 3; }
.composer-footer:has(#startWorkshop) { display: block; }
.selection-summary { display: block; font-size: 13px; color: #928b7c; margin: 0; line-height: 1.4; }
.generate-button { display: flex; justify-content: space-between; width: 164px; min-height: 48px; padding-inline: 17px; border-radius: 9px; font-size: 15px; }
#startWorkshop { width: 100%; }
.generate-button > svg { width: 20px; height: 20px; stroke-width: 1.5; }
.progress-area { font-size: 13px; color: #807a6e; line-height: 1.6; overflow-wrap: anywhere; margin: 0 24px 12px; }
.progress-area:empty { display: none; }
.progress-card { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 9px; font-size: 13px; }
.progress-card > span:not(.spinner) { flex: 1; min-width: 100px; }
.progress-card button { color: #534f46; font-size: 13px; border-bottom: 1px solid #c8c2b4; padding: 5px; }
.spinner { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; border: 1.5px solid #d3cfc4; border-top-color: #4f4c42; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error, .error-text { color: #b34838; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.workshop-kind { display: flex; margin: 17px 0 3px; }
.workshop-prompt { padding-top: 13px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.workshop-prompt textarea { height: 98px; min-height: 98px; }
.reference-panel { padding-bottom: 0; border-bottom: 0; }

/* A photographic contact sheet instead of more boxed cards. */
.library-toolbar { padding: 0 0 25px; border-bottom: 1px solid #dddacf; margin-bottom: 28px; }
.library-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: #e7e4dc; }
.segmented > button { flex: 1; min-width: 76px; min-height: 44px; padding: 9px 23px; color: #847e72; font-size: 14px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.library-top > .segmented { flex-shrink: 0; }
.library-utilities { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-left: auto; }
.source-toggle { flex-shrink: 0; font-size: 13px; font-weight: 400; }
.source-toggle[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #b6b0a2; }
.library-view-note { margin: -7px 0 16px; font-size: 13px; color: #928b7c; }
.segmented > button.active, .segmented > button[aria-pressed="true"] { background: #fffefa; color: #35332b; box-shadow: 0 1px 4px #4b402110; }
.checkbox-control { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: #827b6d; cursor: pointer; white-space: nowrap; }
.checkbox-control input { -webkit-appearance: auto; width: 16px; height: 16px; accent-color: var(--ink); }
.library-filters { display: grid; grid-template-columns: minmax(220px, 1.7fr) repeat(3, minmax(115px, .8fr)) minmax(140px, 1fr); gap: 12px; }
.search-field, .select-field, .tag-filter { display: flex; align-items: center; min-width: 0; min-height: 46px; border: 1px solid #dedacf; border-radius: 8px; background: #fffefa90; }
.search-field, .tag-filter { padding: 0 13px; gap: 9px; }
.search-field > svg { width: 18px; height: 18px; color: #a29c8e; }
.search-field > input, .tag-filter > input { width: 100%; min-height: 44px; padding: 8px 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.search-field:focus-within, .tag-filter:focus-within { border-color: #aaa293; }
.search-field > input:focus-visible, .tag-filter > input:focus-visible { outline: none; }
.select-field > select { width: 100%; min-height: 44px; padding: 9px 27px 9px 13px; border: 0; border-radius: 8px; background: transparent; color: #777062; font-size: 13px; cursor: pointer; }
.tag-filter > span { color: #a29a89; font-size: 17px; }
.select-field:has(select[hidden]), .field:has(select[hidden]) { display: none; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 23px; align-items: start; }
.asset-card { position: relative; min-width: 0; width: 100%; display: block; padding: 0; text-align: left; border: 0; background: transparent; border-radius: 8px; }
.asset-card > img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: contain; padding: 11px; background: #e8e5dd; border: 1px solid #e2ded4; border-radius: 8px; }
.asset-card:hover > img { background: #e4dfd3; border-color: #cfc7b8; }
.asset-card.selected > img, .asset-card[aria-pressed="true"] > img { outline: 2px solid #333129; outline-offset: 2px; }
.asset-card.selected:after, .asset-card[aria-pressed="true"]:after { content: '✓'; position: absolute; top: 10px; right: 10px; height: 25px; width: 25px; border-radius: 50%; background: #2e2d25; color: #fff; text-align: center; line-height: 25px; font-size: 14px; }
.asset-info { min-width: 0; padding: 12px 2px 0; }
.asset-title { display: block; color: #514c40; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta { display: block; font-size: 13px; color: #928c80; line-height: 1.5; margin-top: 5px; overflow-wrap: anywhere; }
.asset-info > .asset-meta + .asset-meta { margin-top: 2px; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tag, .tag-list > span { border: 1px solid #ded8cb; color: #8b8374; background: transparent; font-size: 13px; padding: 1px 5px; border-radius: 4px; }
.library-empty { min-height: 420px; }
.empty-message { grid-column: 1 / -1; padding: 70px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* Sheets, inspectors and confirmations. */
dialog { width: 520px; max-width: calc(100vw - 48px); max-height: calc(100dvh - 64px); border: 1px solid #fdfcf6; border-radius: 16px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 30px 120px #28241738; overflow: auto; }
dialog::backdrop { background: #28261966; backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.dialog-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; background: #fffefaf2; border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.dialog-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.4px; }
.close-button { background: #efede6; }
.close-button > svg { width: 17px; height: 17px; }
.dialog-body { padding: 24px; }
.dialog-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 17px 24px; border-top: 1px solid var(--line); background: #fffefaf5; backdrop-filter: blur(16px); z-index: 5; }
.wide-dialog { width: 880px; }
.picker-toolbar { display: flex; align-items: center; gap: 16px; min-width: 0; }
.picker-toolbar > .search-field { flex: 1; min-width: 0; }
.picker-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 24px 18px; margin-top: 24px; }
.asset-dialog { width: 840px; }
.asset-detail-layout { display: grid; grid-template-columns: 1fr 1fr; }
.asset-preview-wrap { min-height: 460px; background: #ebe8e0; padding: 26px; display: flex; align-items: center; justify-content: center; }
.asset-preview-wrap > img { max-height: 600px; width: 100%; object-fit: contain; }
.asset-detail-fields { min-width: 0; padding: 25px; }
.field { display: block; min-width: 0; font-size: 13px; color: #898377; font-weight: 500; margin-bottom: 20px; }
.field > input, .field > textarea, .field > select { display: block; width: 100%; min-height: 46px; margin-top: 7px; padding: 11px 12px; background: #fff; border: 1px solid #ded8cc; border-radius: 7px; font-size: 16px; line-height: 1.5; color: #4b473e; }
.field > textarea { min-height: 95px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row:has(select[hidden]) { grid-template-columns: 1fr; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions > button { flex: 1; font-size: 13px; padding-inline: 9px; }
.environment-detail { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; }
.environment-detail:has(> button[hidden]) { display: none; }
.environment-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.environment-status .asset-meta { margin: 0; }
.detail-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 20px; margin-top: 25px; border-top: 1px solid var(--line); }
.detail-bottom .primary-button { min-width: 80px; }
.danger-text { color: #a94734; }
.danger-text:hover { color: #8c291d; }
.danger-button { background: #b64637; color: white; }
.confirm-dialog { width: 365px; }
.confirm-body { text-align: center; padding: 30px 26px 23px; }
.confirm-body h2 { font-size: 18px; }
.confirm-body p { margin-top: 11px; color: #8e8474; font-size: 14px; line-height: 1.65; }
.confirm-actions { display: flex; gap: 10px; padding: 0 24px 24px; }
.confirm-actions > button { flex: 1; }
.history-grid { align-items: stretch; }
.history-grid > .text-button { grid-column: 1 / -1; justify-self: start; }
.history-card { min-width: 0; border: 1px solid #e6e1d7; border-radius: 9px; overflow: hidden; display: flex; flex-direction: column; }
.history-card > img { width: 100%; height: 222px; padding: 10px; object-fit: contain; background: #eae6dc; cursor: zoom-in; }
.history-info { display: flex; flex: 1; flex-direction: column; padding: 14px; min-width: 0; }
.history-info > strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; line-height: 1.55; }
.history-info > .result-actions { justify-content: flex-start; gap: 6px; margin-top: auto; padding: 15px 0 0; }
.history-info .result-actions button:not([class]) { font-size: 13px; padding-inline: 10px; }
.history-info .result-actions .text-button { font-size: 13px; padding: 8px 5px; }
.history-info > .error-text { margin-top: 9px; }
.result-dialog { width: 900px; }
.result-preview-wrap { display: flex; align-items: center; justify-content: center; background: var(--canvas); min-height: 150px; padding: 22px; }
.result-preview-wrap > img { max-height: calc(100dvh - 270px); object-fit: contain; }
.service-dialog .dialog-body { font-size: 14px; line-height: 1.75; }
.service-list { display: flex; flex-direction: column; margin-bottom: 20px; }
.service-list > div { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.service-list > div:last-child { border-bottom: 0; }
.status-ready, .status-pending { font-size: 13px; border-radius: 5px; padding: 3px 7px; }
.status-ready { background: #ecf0e4; color: #667544; }
.status-pending { background: #f1eee6; color: #9b917e; }
.service-note { color: #8c8272; font-size: 13px; overflow-wrap: anywhere; }
.service-note + .service-note { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.service-dialog input, .service-dialog select, .service-dialog textarea { padding: 11px; max-width: 100%; min-height: 44px; font-size: 16px; border: 1px solid #dfd8c9; border-radius: 8px; background: #fff; }
.service-dialog pre { overflow: auto; padding: 14px; font-size: 13px; background: #eee9de; border-radius: 6px; }
.cutout-options { margin: 0 0 19px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cutout-options > summary { min-height: 44px; padding: 11px 1px; color: #827967; font-size: 13px; cursor: pointer; }
.cutout-options > textarea { width: 100%; min-height: 103px; font-size: 16px; padding: 12px; border: 1px solid #ded7c7; border-radius: 7px; background: white; margin: 0 0 14px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 1000; width: max-content; max-width: calc(100vw - 40px); padding: 13px 20px; background: #302d24f2; color: #fffef8; border: 1px solid #ffffff26; box-shadow: 0 6px 20px #2d281523; backdrop-filter: blur(15px); border-radius: 10px; text-align: center; font-size: 14px; line-height: 1.55; pointer-events: none; }
.toast:empty { display: none; }

/* Tablet: retain both the image and the inspector. */
@media (max-width: 1180px) {
  .app-header { padding-inline: 29px; }
  .app-main { padding-inline: 29px; }
  .studio-layout { grid-template-columns: minmax(0, 1fr) 345px; gap: 20px; }
  .composer-body, .composer-footer { padding-inline: 21px; }
  .result-stage { min-height: 560px; }
  .library-filters { grid-template-columns: minmax(180px, 1.4fr) repeat(2, minmax(130px, 1fr)); }
  .library-filters > .search-field { grid-column: span 2; }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 25px 18px; }
}
@media (max-width: 950px) and (min-width: 741px) {
  .app-header { padding-inline: 24px; height: 78px; }
  .app-main { padding: 24px 24px 40px; }
  .brand { font-size: 19px; gap: 8px; }
  .brand > svg { width: 24px; }
  .nav-item { min-width: 89px; padding-inline: 15px; }
  .main-nav { top: 13px; }
  .studio-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
  .studio-controls, .preview-panel { top: 99px; }
  .studio-controls { height: calc(100dvh - 184px); }
  .composer-body, .composer-footer { padding-inline: 18px; }
  .result-stage { min-height: 560px; height: calc(100dvh - 184px); }
  .garment-slots, .reference-slots { gap: 7px; }
  .garment-card > img { height: 76px; }
  .inline-actions { gap: 12px; }
  .prompt-chips { gap: 6px; }
  .prompt-chips > button { padding-inline: 9px; }
}

@media (min-width: 741px) and (max-height: 820px) {
  .app-header { height: 72px; }
  .main-nav { top: 10px; }
  .app-main { padding-top: 18px; padding-bottom: 24px; }
  .page-heading { margin-bottom: 16px; }
  .studio-controls, .preview-panel { top: 90px; }
  .studio-controls, .result-stage { height: calc(100dvh - 174px); min-height: 520px; }
  .composer-body { padding-top: 2px; padding-bottom: 8px; }
  .input-panel { padding-top: 0; padding-bottom: 10px; }
  .section-heading { margin-bottom: 2px; }
  .selected-asset { min-height: 50px; }
  .selected-asset > img { height: 50px; width: 43px; }
  .garment-card > img, .reference-slots .garment-card > img { height: 64px; }
  .garment-name { padding-block: 3px; }
  .prompt-panel { padding-top: 12px; }
  .prompt-panel > .section-heading { margin-bottom: 4px; }
  .prompt-editor { padding: 9px 12px; }
  .prompt-editor textarea { height: 64px; min-height: 64px; }
  .prompt-footnote { margin-top: 4px; }
  .prompt-chips { margin-top: 8px; }
  .composer-footer { padding-block: 11px; }
  .workshop-kind { margin-top: 12px; }
  .workshop-prompt textarea { height: 78px; min-height: 78px; }
}

/* Phone: compact input, with the main action always within reach. */
@media (max-width: 740px) {
  .app-header { height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; background: #f2f1edf5; }
  .brand { font-size: 21px; gap: 9px; }
  .brand > svg { width: 25px; height: 25px; }
  .main-nav { position: fixed; left: 0; right: 0; top: auto; bottom: 0; transform: none; height: calc(67px + env(safe-area-inset-bottom)); padding: 4px 12px env(safe-area-inset-bottom); display: flex; border: 0; border-top: 1px solid #e2dfd4; border-radius: 0; background: #fffefaf5; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: none; z-index: 40; }
  .nav-item { flex: 1; min-width: 0; flex-direction: column; min-height: 59px; gap: 2px; border-radius: 0; padding: 5px 0; font-size: 13px; line-height: 1.3; color: #a29c8f; }
  .nav-item > svg { display: block; width: 22px; height: 22px; }
  .nav-item.active, .nav-item[aria-current="page"], .nav-item:hover { background: transparent; color: #2e2b23; box-shadow: none; }
  .nav-item.active > svg { stroke-width: 1.85; }
  .app-main { padding: 12px 18px calc(175px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 12px; gap: 13px; }
  h1 { font-size: 27px; letter-spacing: -.8px; }
  .page-heading .text-button { font-size: 13px; }
  .studio-layout { display: flex; flex-direction: column; gap: 25px; }
  .studio-controls { position: static; order: 0; width: 100%; height: auto; min-height: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .composer-body { padding: 0; }
  .input-panel { padding: 0 0 10px; border-bottom-color: #dedacf; }
  .section-heading { margin-bottom: 3px; }
  .section-heading h2, .field-title { font-size: 15px; }
  .inline-actions { gap: 18px; }
  .inline-actions .text-button { color: #706b60; }
  .slot-placeholder { min-height: 55px; border-color: #d0cabc; background: #fffefa60; }
  .selected-asset { min-height: 56px; gap: 14px; }
  .selected-asset > img { width: 47px; height: 56px; }
  .selected-info > strong, strong.selected-info { font-size: 14px; }
  .selected-info > span, .selected-info > small { font-size: 13px; }
  .garment-panel { padding-top: 6px; }
  .garment-slots > .slot-placeholder { min-height: 55px; }
  .garment-card > img { height: 64px; padding: 4px; }
  .garment-name { padding: 3px 5px; }
  .prompt-panel { padding-top: 12px; }
  .prompt-panel > .section-heading { min-height: 29px; margin-bottom: 8px; }
  .prompt-editor { background: #fffefa; border-color: #d8d0c0; padding: 10px 12px 9px; border-radius: 9px; }
  .prompt-editor textarea { height: 64px; min-height: 64px; font-size: 16px; }
  .prompt-footnote { margin-top: 5px; font-size: 13px; color: #aaa08d; }
  .prompt-chips { margin-top: 8px; gap: 7px; }
  .prompt-chips > button { background: #fffefa60; font-size: 13px; min-height: 44px; padding: 8px 11px; }
  .prompt-chips > select { font-size: 16px; }
  .composer-footer { position: fixed; bottom: calc(67px + env(safe-area-inset-bottom)); left: 0; right: 0; margin-top: 0; padding: 11px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; align-items: center; background: #fffefaf5; border-top: 1px solid #e8e1d2; border-radius: 0; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); z-index: 25; }
  .selection-summary { margin: 0; font-size: 13px; line-height: 1.5; max-width: 155px; }
  .generate-button { width: 164px; min-height: 49px; padding-inline: 16px; font-size: 15px; }
  .composer-footer:has(#startWorkshop) { display: block; }
  #startWorkshop { width: 100%; }
  .studio-controls > .progress-area { margin: 12px 0 0; font-size: 13px; }
  .preview-panel { position: relative; top: auto; order: 1; width: 100%; border-radius: 9px; background: #e7e3d9; }
  .result-stage { min-height: 410px; height: 64dvh; max-height: 720px; }
  .source-preview > img, .result-stage > img { padding: 15px 16px 42px; }
  .preview-label { top: 13px; left: 13px; font-size: 13px; }
  .source-caption { bottom: 13px; font-size: 13px; }
  .result-card > img { padding: 13px; }
  .result-actions { gap: 8px; padding: 11px; }
  .result-actions button:not([class]), .result-actions a { font-size: 13px; padding-inline: 13px; }
  .empty-illustration { margin-bottom: 21px; }
  .empty-illustration svg { width: 54px; height: 54px; }
  .empty-state { padding: 30px 22px; font-size: 14px; }
  .empty-state p { font-size: 16px; }
  .workshop-kind { margin: 0 0 16px; }
  .workshop-prompt { padding-top: 0; padding-bottom: 19px; }
  .workshop-prompt textarea { height: 100px; min-height: 100px; }
  .base-panel { padding-top: 12px; }
  .reference-panel { padding-top: 11px; }
  .reference-slots .garment-card > img { height: 64px; }
  .library-top { margin-bottom: 17px; gap: 4px 10px; }
  .library-utilities { gap: 16px; }
  .picker-toolbar { gap: 11px; }
  .segmented > button { font-size: 14px; min-width: 76px; padding-inline: 16px; }
  .library-toolbar { padding-bottom: 23px; margin-bottom: 23px; }
  .library-filters { grid-template-columns: 1fr 1fr; gap: 9px; }
  .library-filters > .search-field { grid-column: 1 / -1; grid-row: 1; }
  .library-filters > .select-field:nth-child(2) { grid-column: 2; grid-row: 3; }
  .library-filters > .select-field:nth-child(3) { grid-column: 1; grid-row: 2; }
  .library-filters > .select-field:nth-child(4) { grid-column: 2; grid-row: 2; }
  .library-filters > .tag-filter { grid-column: 1; grid-row: 3; }
  .library-filters:has(#subcategoryFilter[hidden]) > .select-field:nth-child(2) { grid-column: 2; grid-row: 2; }
  .library-filters:has(#subcategoryFilter[hidden]) > .tag-filter { grid-column: 1 / -1; grid-row: 3; }
  .search-field > input, .tag-filter > input, .select-field > select { font-size: 16px; }
  .select-field > select { padding-left: 11px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 13px; }
  .asset-card > img { padding: 8px; border-radius: 7px; }
  .asset-info { padding-top: 10px; }
  .asset-title { font-size: 14px; }
  .asset-meta { font-size: 13px; }
  .tag-list { gap: 4px; margin-top: 7px; }
  .tag-list > span { font-size: 13px; }
  .library-empty { min-height: 330px; }
  .compact-button { font-size: 13px; padding-inline: 13px; }
  dialog { max-width: calc(100vw - 24px); max-height: calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 15px; }
  .dialog-head { padding: 14px 18px; }
  .dialog-head h2 { font-size: 18px; }
  .dialog-body { padding: 18px; }
  .dialog-footer { padding: 14px 18px; }
  .picker-grid { margin-top: 20px; gap: 20px 13px; }
  .asset-detail-layout { grid-template-columns: 1fr; }
  .asset-preview-wrap { min-height: 0; padding: 18px; }
  .asset-preview-wrap > img { height: 240px; max-height: 31dvh; object-fit: contain; }
  .asset-detail-fields { padding: 21px; }
  .field { margin-bottom: 18px; }
  .field > input, .field > textarea, .field > select { font-size: 16px; }
  .detail-bottom { margin-top: 20px; }
  .history-card > img { height: 175px; }
  .history-info { padding: 11px; }
  .history-info > strong { font-size: 14px; }
  .history-info .result-actions { gap: 5px; }
  .history-info .result-actions button:not([class]) { padding: 9px 8px; font-size: 13px; }
  .history-info .result-actions .text-button { font-size: 13px; }
  .result-preview-wrap { padding: 12px; }
  .result-preview-wrap > img { max-height: calc(100dvh - 245px); }
  .confirm-dialog { max-width: calc(100vw - 48px); }
  .confirm-body { padding: 27px 22px 23px; }
  .confirm-actions { padding-inline: 22px; }
  .toast { bottom: calc(158px + env(safe-area-inset-bottom)); font-size: 14px; }
  dialog .toast { bottom: 20px; }
}
@media (max-width: 370px) {
  .app-header { padding-inline: 16px; }
  .app-main { padding-inline: 14px; }
  .brand { font-size: 20px; }
  .page-heading { gap: 8px; }
  h1 { font-size: 25px; }
  .page-heading .text-button { gap: 5px; }
  .composer-footer { padding-inline: 14px; gap: 12px; }
  .generate-button { width: 153px; }
  .garment-slots, .reference-slots { gap: 7px; }
  .garment-card > img { height: 60px; }
  .inline-actions { gap: 15px; }
  .prompt-chips { gap: 6px; }
  .prompt-chips > button { padding-inline: 9px; }
  .asset-grid { column-gap: 10px; }
  .asset-info { padding-inline: 0; }
  .segmented > button { padding-inline: 12px; }
  .library-top > .segmented { flex: 1; }
  .library-top .segmented > button { min-width: 66px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
