﻿/* [2026-03-28] 目的：滿版設計工作台 shell（抽屜、AI 區、RWD）；編輯畫布基底樣式由 cDLoading 補載之 ContentStyle1／SimpleEditor1 與列表一致，勿在此複製 .guide／.design 全套 */
/* [2026-03-23] 目的：將 productlist.txt 內嵌樣式搬至外部 CSS，避免模板夾帶 style */
/* 滿版視窗：固定一屏，不讓整頁上下滑動 */
.design-overlay { position: fixed; inset: 0; z-index: 9999; background: #fff; display: none; flex-direction: column; overflow: hidden; height: 100vh; max-height: 100vh; }
.design-overlay.is-open { display: flex; }
.design-overlay__bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.design-overlay__title { font-weight: 600; font-size: 1.125rem; }
.design-overlay__close { cursor: pointer; padding: 8px 16px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.design-overlay__close:hover { background: #f3f4f6; }
.design-overlay__body { flex: 1; min-height: 0; overflow: hidden; padding: 12px 16px; display: flex; flex-direction: column; }
body.overlay-open { overflow: hidden; }

/* [2026-03-26] 目的：畫布工具列僅手機版顯示（桌機維持原本右欄縮放/清除） */
.design-canvas-toolbar { display: none; }

/* [2026-03-26] 目的：手機抽屜 tab 僅手機顯示，避免桌機右下角多出四顆按鈕 */
.design-drawer__tabs { display: none; }

/* [2026-04-18] 目的：桌機左側編輯區上方 .editor-canvas__product-bar 顯示目前商品；抽屜頂「目前選擇」僅手機用，預設隱藏避免與桌機重複 */
.design-drawer__status { display: none; }

/* 新排版：左＝僅編輯畫布（衣服完整呈現），右＝功能區＋AI 生成區（右欄放大） */
.design-overlay .editor-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 42%) minmax(360px, 58%); gap: 0; overflow: hidden; }
.design-overlay .editor-canvas { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #f0f2f5; }
/* [2026-04-18] 目的：左欄「目前選擇商品」置於畫布上方；手機改由抽屜頂列顯示，此區隱藏 */
.design-overlay .editor-canvas__product-bar { flex-shrink: 0; padding: 10px 16px 0; }
.design-overlay .editor-canvas__product-bar .meta--compact { background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 2px 6px rgba(0,0,0,.03); }
/* [2026-04-18] 白卡內左：商品文案；右：縮放＋左右置中 */
.design-overlay .editor-canvas__product-bar .meta--with-canvas-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.design-overlay .editor-canvas__product-bar .meta__text-block { flex: 1 1 200px; min-width: 0; }
.design-overlay .editor-canvas__product-bar .meta--compact .meta__label { font-size: 12px; color: #6b7280; }
.design-overlay .editor-canvas__product-bar .meta--compact .meta__value { font-size: 13px; font-weight: 600; }
.design-overlay .editor-canvas__product-bar .meta--compact .meta__hint { font-size: 12px; color: #9ca3af; }
.design-overlay .editor-canvas__product-bar .meta__hint--empty { display: none !important; }
/* [2026-04-18] 縮放與左右置中同一行，減少白卡高度、讓下方衣服畫布區較大 */
.design-overlay .editor-canvas__inline-tools { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 10px 12px; flex: 1 1 240px; min-width: 0; max-width: 100%; }
.design-overlay .editor-canvas__zoom-row { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.design-overlay .editor-canvas__zoom-row .zoom-label { flex-shrink: 0; font-size: 12px; color: #6b7280; }
.design-overlay .editor-canvas__zoom-row input[type="range"] { flex: 1 1 auto; min-width: 56px; width: auto !important; max-width: 100%; }
.design-overlay .editor-canvas__zoom-row .zoom__value { font-size: 14px; flex-shrink: 0; }
.design-overlay .editor-canvas__btn-center { padding: 6px 12px; font-size: 14px; flex-shrink: 0; white-space: nowrap; }
.design-overlay .stage--full { flex: 1; min-height: 0; display: flex; padding: 16px; align-items: center; justify-content: center; }
.design-overlay .stage--full .stage__canvas { width: 100%; max-width: 100%; height: 100%; min-height: 200px; max-height: 85vh; position: relative; background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); overflow: hidden; aspect-ratio: auto; }
/* [2026-03-23] 目的：編輯區底圖固定以 cover 呈現，與印刷範圍座標換算一致 */
/* [2026-03-28] 目的：底圖填滿 stage__canvas 並置下層；#guide 疊於 tee 上（tee 之 filter 會建立 stacking context，需明示 z-index 避免印刷區被畫在底圖「底下」） */
.design-overlay .stage--full .stage__canvas #teeImg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 0;
}
/* [2026-03-28] 目的：ContentStyle1 已有 .guide 邊框與定位；此處僅保險 position＋疊在 tee 上，避免 left/top 被當 static */
.design-overlay .stage--full .stage__canvas #guide {
    position: absolute !important;
    z-index: 1;
    border: 0 !important;
    outline: 1px dashed rgba(0,0,0,.18);
    outline-offset: 0;
    box-sizing: border-box;
}
/* [2026-04-26] 目的：印刷區外框以 class + CSS 變數定位，由 design-workbench.js 只寫變數不拼 cssText */
.design-overlay .stage--full .stage__canvas #guide.wb-guide--hidden {
    display: none !important;
}
.design-overlay .stage--full .stage__canvas #guide.wb-guide--positioned {
    display: block !important;
    left: var(--wb-guide-left);
    top: var(--wb-guide-top);
    width: var(--wb-guide-width);
    height: var(--wb-guide-height);
    transform: var(--wb-guide-transform, none);
}

/* [2026-03-28] 目的：在 .guide 內讓設計圖疊在 BGCanvas 之上（SimpleEditor1 的 .BGCanvas 僅部分定位） */
.design-overlay .stage--full .stage__canvas #designImg.design,
.design-overlay .stage--full .stage__canvas img.design {
    z-index: 2;
    /* [2026-04-26] 目的：幾何由 --dw-tx/--dw-ty/--dw-scale 驅動，與 setDesignTransform 一致 */
    transform: translate(calc(-50% + var(--dw-tx, 0px)), calc(-50% + var(--dw-ty, 0px))) scale(var(--dw-scale, 0.8));
}

.design-overlay .stage--full .stage__canvas .guide .BGCanvas {
    z-index: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-sizing: border-box;
}
.design-overlay .editor-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; overflow: auto; border-left: 1px solid #e5e7eb; background: #fff; }
/* [2026-04-18] 功能區：左為顏色／區域／設計·AI＋情境照註解，右為印刷設定 */
.design-overlay .function-panel { display: flex; flex-direction: column; gap: 8px; align-items: stretch; background: #f8f9fa; border-radius: 12px; flex-shrink: 0; }
.design-overlay .function-panel__split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    /* 等高：兩欄白卡同列拉伸為同一高度（較矮一側下方留白） */
    align-items: stretch;
    width: 100%;
    min-width: 0;
}
.design-overlay .function-panel__col { min-width: 0; background: #ffffff; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.03); padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; }
.design-overlay .function-panel__col--print,
.design-overlay .function-panel__col--design { justify-content: flex-start; padding: 6px 10px 8px; }
.design-overlay .function-panel__main-grid { display: flex; flex-direction: column; gap: 4px; padding-top: 0; }
/* 左欄「3. 設計圖」：標題與按鈕同一橫列（與改版前一致，節省垂直空間） */
.design-overlay .function-panel__col--print #rowDesignInput {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
}
.design-overlay .function-panel__col--print #rowDesignInput .function-panel__label {
    min-width: 0;
    padding-bottom: 0;
    flex-shrink: 0;
}
.design-overlay .function-panel__col--print #rowDesignInput .function-panel__inline {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}
.design-overlay .function-panel__col--print #rowAI { align-items: stretch; }
.design-overlay .function-panel__col--print #rowAI .function-panel__label { display: none; }
/* 左欄：第 3 步下方情境照註解（原全寬底列移入，少占一整列高度） */
.design-overlay .function-panel__col--print .function-panel__scene-hint { margin: 2px 0 0; padding: 0; }
.design-overlay .function-panel__col--print .function-panel__hint-para { margin: 0; font-size: 12px; line-height: 1.45; color: #6b7280; }
.design-overlay .function-panel__col--print .function-panel__hint-lead { font-weight: 600; color: #4b5563; }
.design-overlay .function-panel__col--print .function-panel__hint-para .hint { margin-left: 0.35em; }
/* 右欄：印刷方式＋下拉（無「印刷設定」總標；無資料時隱藏 #rowWorkbenchPrintMethod） */
.design-overlay .function-panel__col--design .function-panel__row--print-settings-combined {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.design-overlay .function-panel__col--design .function-panel__row--print-settings-combined #rowWorkbenchPrintMethod {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
}
.design-overlay .function-panel__print-mount { min-width: 0; }
/* [2026-04-18] 桌機：兩欄白卡最小高度（過高會拉長整塊功能區；與右欄印刷表單一併調整） */
@media (min-width: 960px) {
    .design-overlay .function-panel__col--print,
    .design-overlay .function-panel__col--design {
        min-height: 270px;
        box-sizing: border-box;
    }
    .design-overlay .function-panel__col--print .function-panel__main-grid--print,
    .design-overlay .function-panel__col--design .function-panel__main-grid--design {
        flex: 1 1 auto;
        min-height: 0;
    }
}
@media (max-width: 959px) {
    .design-overlay .function-panel__split { grid-template-columns: 1fr; }
}
.design-overlay .function-panel__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay #moduleRowView.function-panel__row { align-items: center; }
.design-overlay .function-panel__label { font-size: 14px; color: #6b7280; min-width: 4.5em; }
.design-overlay .seg.seg--frontback { display: flex; gap: 6px; }
.design-overlay .seg__btn { padding: 6px 12px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; }
.design-overlay .seg__btn.is-active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.design-overlay .workbench__color-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.design-overlay .workbench__color-row .sw { box-sizing: border-box; width: 28px; height: 28px; border-radius: 6px; border: 2px solid #d1d5db; cursor: pointer; flex-shrink: 0; background: var(--c, #fff); overflow: hidden; padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
/* [2026-03-28] 目的：工作台色票改為圓點（與列表 DispalyMode 5 一致），勿呈現方塊小衣服圖 */
.design-overlay .workbench__color-row .sw.sw--workbench-dot { border-radius: 50%; background-color: var(--c, #e5e7eb); background-size: cover; background-position: center; background-repeat: no-repeat; }
.design-overlay .workbench__color-row .sw.sw--workbench-dot-text { font-size: 11px; font-weight: 600; color: #374151; background: #f3f4f6; }
.design-overlay .workbench__color-row .sw.sw--workbench-dot-empty { background: #e5e7eb; background-image: none !important; }
.design-overlay .workbench__color-row .sw img { width: 100%; height: 100%; object-fit: cover; display: block; }
.design-overlay .workbench__color-row .sw:hover { border-color: #1f6feb; }
.design-overlay .workbench__color-row .sw.is-active { border-color: #1f6feb; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f6feb; }
/* [2026-04-18] 印刷參數：「3.」「印刷方式：」與下拉同一列（與視角／PData.PrintList 聯動） */
.design-overlay .function-panel__col--design .function-panel__row--print-params { align-items: center; flex-wrap: nowrap; }
.design-overlay #rowWorkbenchPrintMethod .function-panel__sub-label { font-size: 14px; color: #6b7280; flex-shrink: 0; }
.design-overlay #rowWorkbenchPrintMethod .workbench-print-method { flex: 1; min-width: 0; max-width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 14px; background: #fff; }
@media (max-width: 479px) {
    .design-overlay .function-panel__col--design .function-panel__row--print-params { flex-wrap: wrap; }
}
/* [2026-04-26] 目的：印刷動態區塊樣式集中於此，避免 design-workbench.js 使用 cssText／inline layout */
.design-overlay #rowPrintModule .workbench-print-dynamic-root {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin-top: 8px;
}
.design-overlay #rowPrintModule .workbench-print-miss {
    margin: 8px 0 0;
    font-size: 13px;
    color: #6b7280;
}
.design-overlay #rowPrintModule .workbench-print-section {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafafa;
  /*  margin-top: 8px;*/
}
.design-overlay #rowPrintModule .workbench-print-section__title {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
    margin-bottom: 8px;
}
.design-overlay #rowPrintModule .workbench-print-quick-title {
    margin-top: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}
/* [2026-04-18] SpecList：依模組分組 radio */
.design-overlay #rowPrintModule .workbench-print-speclist-wrap { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; }
.design-overlay #rowPrintModule .workbench-print-speclist-group {
    margin: 0; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    align-items: start;
}
.design-overlay #rowPrintModule .workbench-print-speclist-legend {
    grid-column: 1 / -1;
    font-size: 13px; font-weight: 600; color: #374151; padding: 0 4px; line-height: 1.3;
}
.design-overlay #rowPrintModule .workbench-print-speclist-option {
    display: flex; align-items: flex-start; gap: 8px; margin: 0; cursor: pointer; font-size: 13px; color: #374151; min-width: 0;
}
.design-overlay #rowPrintModule .workbench-print-speclist-label-text { min-width: 0; line-height: 1.35; }
@media (max-width: 380px) {
    .design-overlay #rowPrintModule .workbench-print-speclist-group { grid-template-columns: 1fr; }
}
.design-overlay #rowPrintModule .workbench-print-speclist-radio { flex-shrink: 0; width: 16px; height: 16px; accent-color: #1f6feb; }
/* [2026-04-18] ColumnData：1～3 個欄位均分滿版；4 個一排；5 個以上每列四欄換行（:has 需現代瀏覽器） */
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock {
    display: grid;
    gap: 6px 8px;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(1):last-child) {
    grid-template-columns: minmax(0, 1fr);
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(4):last-child) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicItem { display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-width: 0; }
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitle { font-size: 12px; font-weight: 500; color: #6b7280; line-height: 1.25; }
@media (max-width: 900px) {
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(1):last-child) {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(2):last-child) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(3):last-child) {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(4):last-child),
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock:has(> .DynamicItem:nth-child(5)) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 520px) {
    .design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicTitleBlock {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicInput input[type="text"],
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicInput select { width: 100%; box-sizing: border-box; padding: 5px 7px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 13px; background: #fff; }
.design-overlay #rowPrintModule .workbench-print-column-wrap .DynamicInput input[type="text"]:disabled { background: #f3f4f6; color: #6b7280; }
/* [2026-04-18] ModuleData：DynamicModuleBlock／DynamicModuleName（對齊 GetMethodString／ProductDetail.DynamicModuleSet） */
.design-overlay #rowPrintModule .workbench-print-module-block { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; min-width: 0; padding-top: 2px; }
.design-overlay #rowPrintModule .workbench-print-module-block .DynamicModuleName {
    padding: 6px 12px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; color: #374151;
    user-select: none;
}
/* [2026-04-26] 目的：快捷模組預設鈕右側留白（原 JS marginRight）；排除「回復初始」 */
.design-overlay #rowPrintModule .workbench-print-module-block > .DynamicModuleName:not(.workbench-print-module-clear) {
    margin-right: 8px;
}
.design-overlay #rowPrintModule .workbench-print-module-block .DynamicModuleName:hover { border-color: #1f6feb; color: #1f6feb; }
.design-overlay #rowPrintModule .workbench-print-module-block .workbench-print-module-clear { border-style: dashed; color: #6b7280; }
/* 預設按鈕列併入「加工參數」同一白卡時，與上方欄位區隔（見 design-workbench.js addSection） */
.design-overlay #rowPrintModule .workbench-print-module-block--under-fields {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}
/* [2026-03-28] 目的：一頁式商品照模式依 data-spec-detail-id 隱藏非當前細項之色票 */
.design-overlay #workbenchColorRow .sw.workbench-sw--filtered-out { display: none !important; }
/* [2026-03-28] 目的：多色時預設只顯示目前選中色票；點目前色票展開（見 4.js capture） */
.design-overlay #workbenchColorRow.workbench--color-collapse:not(.is-expanded) .sw:not(.is-active) { display: none !important; }
.design-overlay .function-panel__inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay .function-panel .btn { padding: 6px 12px; font-size: 14px; }
.design-overlay .function-panel__row--ai { align-items: flex-start; transition: opacity .15s ease; }
.design-overlay .function-panel__row--ai.is-collapsed { opacity: 0; pointer-events: none; }
.design-overlay .function-panel__ai { display: flex; flex-direction: column; gap: 6px; flex: 1; }
/* [2026-04-18] 第 2 區僅「視角」鈕（縮放／置中已移至左側白卡） */
.design-overlay .function-panel__view-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; }
/* 「2. 區域」與刀模視角鈕：中線對齊；灰色 pill 依按鈕寬度自適應 */
.design-overlay .function-panel__view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.design-overlay .function-panel__label--stack { min-width: 4.5em; flex-shrink: 0; }
.design-overlay .function-panel__view-head .seg.seg--module {
    flex: 0 1 auto;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    /* 覆寫 ContentStyle1 .seg 的 padding:4px，灰底與按鈕之間留一點空 */
    padding: 7px 14px;
    box-sizing: border-box;
}
.design-overlay .zoom-inline { margin-left: 32px; }
/* [2026-04-18] 置中主鈕在左欄白卡；無「2.視角」列時不必在列 3 重複顯示備用鈕（桌機） */
#design-overlay #btnCenterDesignHFallback { display: none !important; }
/* [2026-04-26] 目的：手機「上傳設計圖」分頁不重複置中鈕；置中改由 #DesignCanvasToolbarCenterH（見 design-workbench.js） */
.design-overlay .zoom-label { font-size: 12px; color: #6b7280; }
.design-overlay .design-mode-btn.is-active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.design-overlay .function-panel__ai-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay .function-panel__ai .ai-prompt { width: 100%; min-height: 52px; resize: vertical; font-size: 13px; padding: 6px 8px; border-radius: 6px; border: 1px solid #d1d5db; box-sizing: border-box; }
.design-overlay .ai-ref-row { display: flex; gap: 8px; align-items: flex-start; }
.design-overlay .ai-ref-thumb { width: 64px; height: 64px; border-radius: 8px; border: 1px dashed #d1d5db; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #f9fafb; flex-shrink: 0; }
.design-overlay .ai-ref-thumb__placeholder { font-size: 10px; color: #9ca3af; text-align: center; line-height: 1.4; }
.design-overlay .ai-ref-thumb__img { max-width: 100%; max-height: 100%; object-fit: cover; }
.design-overlay .ai-ref-thumb__img.is-hidden { display: none; }
/* [2026-04-26] 目的：文生圖模式隱藏縮圖區、有參考圖時隱藏佔位文字，改以 class 控制勿用 JS 寫 display */
.design-overlay .ai-ref-thumb__placeholder.is-hidden { display: none; }
.design-overlay #aiRefThumb.is-hidden { display: none !important; }
.design-overlay .function-panel input[type="range"] { width: 90px; }
.design-overlay .function-panel .zoom__value { font-size: 14px; }
.design-overlay .function-panel .btn--cta { padding: 8px 18px; font-size: 16px; border-radius: 999px; }
.design-overlay .cta__hint { font-size: 14px; color: #6b7280; text-align: right; }
.design-overlay .step-label { font-size: 15px; color: #6b7280; font-weight: 600; margin-bottom: 6px; }
.design-overlay .step-label--cta { text-align: right; }
.design-overlay .preview--compact { flex-shrink: 0; display: flex; flex-direction: column; }
.design-overlay .preview--compact .preview__head { padding: 10px 0 6px; flex-shrink: 0; }
.design-overlay .preview--compact .preview__head .kicker { font-size: 15px; font-weight: 600; color: #4b5563; text-align: center; padding-left: 8px; }
.design-overlay .preview--compact .preview__head .title { font-size: 17px; font-weight: 700; padding-top: 10px; }
.design-overlay .preview-thumbs { display: flex; gap: 10px; flex-shrink: 0; }
.design-overlay .preview-thumbs .slot { flex: 1; min-width: 0; aspect-ratio: 3/4; background: #f3f4f6; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; }
.design-overlay .preview-thumbs .slot__media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; }
.design-overlay .preview-thumbs .slot img.AIPhoto { max-width: 100%; max-height: 100%; object-fit: cover; display: block; cursor: zoom-in; border-radius: 6px; }
.design-overlay .preview-thumbs .slot.has-image .slot__state { display: none; }
.design-overlay .preview-thumbs .slot .is-hidden { display: none !important; }
.design-overlay .preview-thumbs .AIPhotoStatus { font-size: 14px; color: #374151; background: rgba(255,255,255,.9); border: 1px solid #e5e7eb; padding: 6px 10px; border-radius: 999px; }
.design-overlay .preview-thumbs .slot__state { text-align: center; padding: 8px; font-size: 13px; color: #6b7280; }
.design-overlay .preview-thumbs .slot__controls { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.92); border: 1px solid rgba(229,231,235,.9); box-shadow: 0 6px 18px rgba(0,0,0,.08); backdrop-filter: blur(6px); }
.design-overlay .preview-thumbs .slot__prompt { width: 100%; resize: none; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; padding: 8px 10px; font-size: 13px; line-height: 1.35; height: 52px; }
.design-overlay .preview-thumbs .slot__prompt::placeholder { color: #9ca3af; }
.design-overlay .preview-thumbs .slot__controls > .slot__row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.design-overlay .preview-thumbs .slot__select { flex: 1; min-width: 0; height: 34px; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; padding: 0 10px; font-size: 14px; }
.design-overlay .preview-thumbs .slot__select--mode { flex: 0 0 140px; }
.design-overlay .preview-thumbs .slot__btn { flex-shrink: 0; height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.design-overlay .preview-thumbs .slot__composed-wrap { margin-top: 6px; }
.design-overlay .preview-thumbs .slot__composed-link { font-size: 12px; color: #1f6feb; text-decoration: underline; word-break: break-all; }
.design-overlay .preview-thumbs .slot__composed-link:hover { color: #1557c7; }
.design-overlay .preview-thumbs .slot__composed-link.is-hidden { display: none; }
.design-overlay .preview--compact .preview__bar { padding: 10px 0 0; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.design-overlay .preview--compact .preview__bar .btn { font-size: 14px; padding: 8px 14px; margin-right: 8px; }
.design-overlay .preview--compact .preview__bar .status { font-size: 14px; color: #6b7280; }

.design-overlay[data-sale-spec-photo-mode="1"] #btnOnePageCreate,
.design-overlay[data-sale-spec-photo-mode="1"] #btnOverlayPurchase { display: none !important; }
/* [2026-03-28] 目的：一頁式商品照模式隱藏長文案，僅保留「完成」按鈕 */
.design-overlay[data-sale-spec-photo-mode="1"] .gen-status-lead { display: none !important; }
.design-overlay[data-sale-spec-photo-mode="1"] #genStatus { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
/* [2026-03-28] 目的：一頁式商品照「完成」僅在該模式顯示。勿用雙 #ID 隱藏，否則特異性會壓過帶屬性的顯示規則導致按鈕永遠不見 */
#design-overlay:not([data-sale-spec-photo-mode="1"]) #btnSaleSpecPhotoDone { display: none !important; }
#design-overlay[data-sale-spec-photo-mode="1"] #btnSaleSpecPhotoDone {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 100%;
    margin-right: 0;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
}

/* [2026-03-28] 目的：隱藏原生「選擇檔案」字樣，只保留自訂按鈕（設計圖／商品照上傳） */
.design-overlay label.file { position: relative; display: inline-block; cursor: pointer; vertical-align: middle; }
.design-overlay label.file input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* [2026-03-26] 目的：手機版設計視窗（進入編輯）採上畫布＋下抽屜；外層不捲動，抽屜內捲動 */
@media (max-width: 959px) {
    :root {
        --az-drawer-tabs-h: 52px;
        --az-drawer-min-h: clamp(96px, 18vh, 120px);
        --az-drawer-max-h: 90vh;
    }
    .design-overlay__body { padding: 0; }
    .design-overlay .editor-layout {
        display: flex;
        flex-direction: column;
    }
    .design-overlay .editor-canvas {
        flex: 1 1 auto;
        min-height: 0;
        /* 抽屜是 fixed 疊上來：預留底部空間避免畫布被遮住 */
        padding-bottom: calc(var(--az-drawer-min-h) + var(--az-drawer-tabs-h));
    }
    /* [2026-04-18] 手機沿用抽屜頂「目前選擇」，不顯示左欄重複區塊 */
    .design-overlay .editor-canvas__product-bar { display: none !important; }
    /* 畫布工具列（縮放/清除）固定在抽屜上方 */
    .design-canvas-toolbar {
        display: block;
        flex: 0 0 auto;
        margin: 0 10px 10px;
        padding: 10px 12px;
        border-radius: 14px;
        background: rgba(255,255,255,.96);
        border: 1px solid rgba(15, 23, 42, .10);
        box-shadow: 0 10px 22px rgba(15, 23, 42, .10);
        backdrop-filter: blur(8px);
    }
    .design-canvas-toolbar__row { display: flex; align-items: center; gap: 10px; }
    .design-canvas-toolbar__row + .design-canvas-toolbar__row { margin-top: 10px; }
    .design-canvas-toolbar__label { font-size: 12px; color: #6b7280; font-weight: 700; }
    .design-canvas-toolbar__range { flex: 1 1 auto; min-width: 0; }
    .design-canvas-toolbar__range input[type="range"] { width: 100% !important; }
    .design-canvas-toolbar__value { font-size: 12px; color: #111; font-weight: 800; white-space: nowrap; }
    .design-canvas-toolbar__row--actions { justify-content: flex-end; }

    /* 手機：整件衣服要完整顯示，避免 cover 裁切 */
    .design-overlay .stage--full { padding: 10px; }
    .design-overlay .stage--full .stage__canvas {
        max-height: calc(100vh - 56px - var(--az-drawer-min-h) - var(--az-drawer-tabs-h));
        border-radius: 14px;
        /* [2026-03-26] 目的：手機版編輯畫布更聚焦（外框/陰影略增強） */
        border: 1px solid rgba(15, 23, 42, .10);
        box-shadow: 0 10px 26px rgba(15, 23, 42, .14);
    }
    .design-overlay .stage--full .stage__canvas #teeImg { object-fit: contain !important; }

    /* 抽屜骨架：桌機仍用 editor-right 右欄；手機把它變成底部抽屜 */
    .design-overlay [data-design-drawer-root] {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10010;
        border-left: 0;
        background: transparent;
        padding: 0;
        overflow: visible;
    }
    .design-drawer {
        width: 100%;
        background: #fff;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -10px 30px rgba(0,0,0,.15);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: var(--az-drawer-min-h);
        max-height: var(--az-drawer-max-h);
    }
    .design-drawer.is-expanded {
        /* 展開時：高度以內容為主，但最多到上限；內容過長在抽屜內捲 */
        height: auto;
    }
    /* [2026-03-26] 目的：AI商品照(tab=ai) 展開時直接到最高，讓預覽區盡量拉高 */
    .design-drawer.is-expanded[data-active-tab="ai"] {
        height: var(--az-drawer-max-h);
    }
    .design-drawer__handle {
        padding: 10px 0 6px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex: 0 0 auto;
    }
    .design-drawer__grab {
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: rgba(0,0,0,.18);
    }
    .design-drawer__status {
        display: flex;
        gap: 6px;
        align-items: center;
        padding: 10px 14px 10px;
        font-size: 12px;
        color: #6b7280;
        flex: 0 0 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /* [2026-03-26] 目的：狀態列保持中性，不使用反藍（反藍只用於 tab active） */
        background: transparent;
        border-top: 0;
        border-bottom: 0;
        position: relative;
    }
    .design-drawer__status-value {
        color: #111;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .design-drawer__content {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 12px calc(var(--az-drawer-tabs-h) + 12px); /* 留給底部 tab */
    }
    .design-drawer.is-expanded .design-drawer__content {
        max-height: calc(var(--az-drawer-max-h) - var(--az-drawer-tabs-h) - 70px); /* handle+status 預留 */
    }
    /* 半開時不要露出任何內容（避免像你圖中「選擇顏色」雜亂露出） */
    .design-drawer:not(.is-expanded) .design-drawer__content {
        display: none;
    }
    .design-drawer__tabs {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: var(--az-drawer-tabs-h);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid #e5e7eb;
        background: rgba(255,255,255,.98);
        backdrop-filter: blur(8px);
    }
    .design-drawer__tab {
        appearance: none;
        border: 0;
        background: transparent;
        border-left: 1px solid rgba(229,231,235,.9);
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        padding: 8px 4px;
        white-space: nowrap;
    }
    .design-drawer__tab:first-child { border-left: 0; }
    .design-drawer__tab.is-active {
        color: #111;
        /* [2026-03-26] 目的：手機版 tab active 更清楚（更明顯的底色/描邊） */
        background: rgba(31,111,235,.14);
        /* active 指示線放下方（更符合 bottom tab 習慣） */
        box-shadow: inset 0 -2px 0 rgba(31,111,235,.55);
    }
    /* 抽屜未展開時，不顯示 active 藍底（避免看起來像已點開某分頁） */
    .design-drawer:not(.is-expanded) .design-drawer__tab.is-active {
        color: #6b7280;
        background: transparent;
        box-shadow: none;
    }

    /* 手機：把原本右欄的 padding/邊線移除，交給抽屜控制 */
    .design-overlay .editor-right { border-left: 0; padding: 0; }

    /* [2026-03-26] 目的：款式規格 tab：顯示顏色／區域；隱藏設計·AI 與預覽 */
    /* [2026-04-26] 目的：同分頁內一併顯示印刷方式／選擇規格／加工參數（原 --design 欄），與圖二桌機右欄內容一致 */
    .design-drawer.is-expanded[data-active-tab="spec"] #rowDesignInput,
    .design-drawer.is-expanded[data-active-tab="spec"] #rowAI,
    .design-drawer.is-expanded[data-active-tab="spec"] #rowAiSceneHint,
    .design-drawer.is-expanded[data-active-tab="spec"] .preview--compact {
        display: none !important;
    }

    /* 款式規格：內容滿寬，不要縮在左上角 */
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel {
        display: block !important;
        width: 100% !important;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel__split {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel__col--design {
        display: flex !important;
        width: 100% !important;
        margin-top: 0;
        border-radius: 14px;
        padding: 12px 12px 14px;
    }
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel__col--print {
        width: 100% !important;
        border-radius: 14px;
        padding: 12px 12px 14px;
    }
    /* [2026-04-18] 設計圖 tab：左欄滿寬（顏色／區域／設計·AI＋情境照註解），隱藏印刷右欄與預覽 */
    .design-drawer.is-expanded[data-active-tab="design"] .preview--compact {
        display: none !important;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel {
        display: block !important;
        width: 100% !important;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__split {
        grid-template-columns: 1fr;
    }
    /* 設計圖 tab：左欄為設計／上傳（--print），隱藏右欄印刷（--design） */
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__col--design {
        display: none !important;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__col--print {
        width: 100% !important;
        border-radius: 14px;
        padding: 12px 12px 14px;
    }
    /* [2026-04-26] 目的：上傳設計圖分頁不重複顯示已併入「款式規格」的顏色／區域；抽屜內不重複左右置中（畫布工具列已有） */
    .design-drawer.is-expanded[data-active-tab="design"] #rowSpecColor,
    .design-drawer.is-expanded[data-active-tab="design"] #moduleRowView {
        display: none !important;
    }
    .design-drawer.is-expanded[data-active-tab="design"] #rowDesignInput #btnCenterDesignHFallback {
        display: none !important;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__row { margin-bottom: 8px; }
    /* 設計圖 tab：AI 提示詞區滿寬且更高（列標題與 1.2.3. 一併顯示） */
    .design-drawer.is-expanded[data-active-tab="design"] #rowDesignInput,
    .design-drawer.is-expanded[data-active-tab="design"] #rowAI {
        align-items: stretch;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .ai-ref-row {
        flex-direction: column;
        align-items: stretch;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .ai-ref-thumb {
        width: 100%;
        height: 88px;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__ai .ai-prompt {
        width: 100%;
        min-height: 110px;
        resize: none;
    }
    /* 清除已移到畫布工具列：抽屜內不再顯示 */
    .design-drawer.is-expanded[data-active-tab="design"] #btnClear { display: none !important; }

    /* [2026-03-26] 目的：AI生成 tab：三張卡為主（水平滑動），先隱藏功能面板 */
    .design-drawer.is-expanded[data-active-tab="ai"] .function-panel { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact { display: flex !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact .preview__head { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact .preview__bar { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs {
        display: grid !important;
        grid-auto-flow: column;
        /* 一次滑動一張：滿寬卡片 */
        grid-auto-columns: 100%;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot {
        scroll-snap-align: start;
        /* [2026-03-26] 目的：手機 AI生成卡：控制區必須在抽屜內，不能壓到下方 tab */
        aspect-ratio: auto;
        border-radius: 14px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__media {
        position: relative !important;
        inset: auto !important;
        z-index: 0;
        flex: 1 1 auto;
        min-height: 280px;
        padding: 12px;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__controls {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1;
        margin: 0 12px 12px;
        padding: 10px;
        border-radius: 14px;
        background: rgba(255,255,255,.98);
        border: 1px solid rgba(229,231,235,.95);
        box-shadow: 0 10px 20px rgba(0,0,0,.08);
        backdrop-filter: blur(8px);
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__prompt {
        height: 92px;
    }

    /* [2026-03-26] 目的：完成 tab：只顯示行動按鈕（建立一頁式/購買），先不顯示三張卡 */
    .design-drawer.is-expanded[data-active-tab="done"] .function-panel { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact { display: flex !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__head { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview-thumbs { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar {
        display: block !important;
        border-top: 0;
        padding: 12px 0 0;
    }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar .status {
        display: flex;
        flex-direction: column;
        gap: 10px;
        font-size: 13px;
        color: #374151;
    }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar .btn {
        width: 100%;
        margin-right: 0;
    }
}
.ai-photo-modal { position: fixed; inset: 0; z-index: 10050; display: none; }
.ai-photo-modal.is-open { display: block; }
.ai-photo-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.ai-photo-modal__panel { position: absolute; inset: 40px 40px 40px 40px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.ai-photo-modal__img { max-width: 100%; max-height: 100%; object-fit: contain; background: #111827; }
.ai-photo-modal__close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 999px; border: 1px solid #e5e7eb; background: rgba(255,255,255,.95); cursor: pointer; font-size: 16px; line-height: 32px; }
.ai-photo-modal__close:hover { background: #f3f4f6; }
@media (max-width: 900px) { .ai-photo-modal__panel { inset: 16px; } }

/* [2026-03-24] 目的：AI 情境照生成時啟用全版遮罩，鎖住所有操作以避免重複觸發 */
.ai-global-mask { position: fixed; inset: 0; z-index: 200000; background: rgba(17,17,17,.35); backdrop-filter: blur(1.5px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ai-global-mask.is-hidden { display: none !important; }
.ai-global-mask__panel { min-width: 260px; max-width: 92vw; background: #fff; border: 1px solid #e6e3da; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.2); padding: 16px 18px; text-align: center; }
.ai-global-mask__spinner { width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #e9e7df; border-top-color: #1f6feb; border-radius: 50%; animation: ai-spin .9s linear infinite; }
.ai-global-mask__title { font-weight: 700; font-size: 16px; margin-bottom: 4px; color: #111; }
.ai-global-mask__desc { font-size: 13px; color: #4e4e4e; }
@keyframes ai-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* [2026-08-03] 目的：AI 商品照由固定三格改為大型設定區＋動態結果圖片庫；不變更既有生成與商品照片儲存流程。 */
.design-overlay .ai-photo-workspace__head { align-items: center; margin-top: 14px; margin-bottom: 10px; }
/* [2026-08-03] 目的：AI 商品照步驟標題改為靠左排列，避免標題脫離下方操作區的閱讀方向。 */
.design-overlay .preview--compact .ai-photo-workspace__head .kicker { width: 100%; padding-left: 0; text-align: left; }
.design-overlay .ai-photo-workspace__head .title { font-size: 14px; font-weight: 500; color: #4b5563; }
.design-overlay .ai-photo-workspace { display: grid; grid-template-columns: minmax(360px, 3fr) minmax(280px, 2fr); gap: 16px; height: clamp(340px, 42vh, 460px); min-height: 0; }
.design-overlay .ai-photo-editor,
.design-overlay .ai-photo-library { min-width: 0; border: 1px solid #e2e6ec; border-radius: 12px; background: #fff; padding: 18px; }
.design-overlay .ai-photo-editor { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }
.design-overlay .ai-photo-editor__title,
.design-overlay .ai-photo-library__title { margin-bottom: 6px; color: #111827; font-size: 16px; font-weight: 700; }
.design-overlay .ai-photo-editor__label { margin-top: 4px; color: #374151; font-size: 13px; font-weight: 600; }
.design-overlay .ai-photo-editor .slot__select { width: 100%; min-width: 0; height: 42px; border: 1px solid #d5dbe5; border-radius: 8px; background: #fff; padding: 0 12px; font-size: 14px; }
.design-overlay .ai-photo-editor__prompt { box-sizing: border-box; width: 100%; min-height: 110px; flex: 1 1 110px; resize: vertical; border: 1px solid #d5dbe5; border-radius: 8px; padding: 12px; font: inherit; line-height: 1.55; }
.design-overlay .ai-photo-editor__hint { color: #6b7280; font-size: 13px; line-height: 1.5; }
.design-overlay .ai-photo-editor__generate { align-self: flex-start; min-width: 150px; height: 42px; margin-top: 4px; border-radius: 8px; }
.design-overlay .ai-photo-library { display: flex; flex-direction: column; overflow: hidden; }
.design-overlay .ai-photo-library__empty { display: flex; flex: 1; min-height: 220px; align-items: center; justify-content: center; border: 1px dashed #d5dbe5; border-radius: 10px; background: #f8f9fb; color: #8a94a3; font-size: 14px; }
.design-overlay .ai-photo-library__empty.is-hidden { display: none; }
.design-overlay .ai-photo-library .preview-thumbs { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow: auto; align-content: start; padding-right: 3px; }
/* [2026-08-03] 目的：尚無生成結果時不讓空的圖片清單分走一半高度，使灰色空狀態完整填滿圖片庫。 */
.design-overlay .ai-photo-library .preview-thumbs:empty { display: none; }
.design-overlay .ai-photo-library__empty { width: 100%; min-height: 0; flex: 1 1 auto; box-sizing: border-box; }
.design-overlay .ai-photo-library .preview-thumbs .slot { position: relative; display: block; min-width: 0; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid #e2e6ec; border-radius: 10px; background: #f3f4f6; }
.design-overlay .ai-photo-library .preview-thumbs .slot__media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0; }
.design-overlay .ai-photo-library .preview-thumbs .slot img.AIPhoto { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; }
.design-overlay .ai-photo-library .slot__state { position: absolute; inset: 0; display: flex; z-index: 1; flex-direction: column; align-items: center; justify-content: center; }
.design-overlay .ai-photo-library .slot.has-image .slot__state { display: none; }
.design-overlay .ai-photo-result__delete { position: absolute; z-index: 3; top: 8px; right: 8px; border: 1px solid rgba(255,255,255,.8); border-radius: 7px; background: rgba(17,24,39,.78); color: #fff; padding: 5px 9px; cursor: pointer; font-size: 12px; }
.design-overlay .ai-photo-result__delete:hover { background: #b42318; }
.ai-photo-delete-confirm { padding: 6px 4px 2px; color: #374151; font-size: 14px; line-height: 1.6; }
.ai-photo-delete-confirm p { margin: 0 0 20px; }
.ai-photo-delete-confirm__actions { display: flex; justify-content: flex-end; gap: 10px; }
.ai-photo-delete-confirm__actions .Button { min-width: 92px; padding: 9px 16px; border: 1px solid #d5dbe5; border-radius: 8px; background: #fff; color: #374151; cursor: pointer; }
.ai-photo-delete-confirm__actions .Button:last-child { border-color: #c9342f; background: #c9342f; color: #fff; }
.ai-photo-delete-confirm__actions .Button:hover { filter: brightness(.96); }
/* [2026-08-03] 目的：補齊設計工作台未登入提示樣式，避免不同店面未載入專屬 ContentStyle 時退回原始文字與連結外觀。 */
#AlertPopup.PopupWindow #ShowContent .login-required-popup { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 12px 4px 8px; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__icon { display: flex; width: 40px; height: 40px; align-items: center; justify-content: center; padding: 0; border: 1px solid #ffd9ad; border-radius: 50%; background: #fff4e8; color: #cc7a00; font-size: 20px; font-weight: 800; line-height: 40px; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__title { color: #111827; font-size: 20px; font-weight: 800; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__desc { color: #575f6b; font-size: 14px; line-height: 1.7; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__actions { margin-top: 6px; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__btn { display: inline-flex; min-width: 120px; height: 40px; align-items: center; justify-content: center; padding: 0 20px; border: 1px solid #111827; border-radius: 8px; background: #111827; color: #fff !important; font-size: 14px; font-weight: 700; text-decoration: none; }
#AlertPopup.PopupWindow #ShowContent .login-required-popup__btn:hover { border-color: #2b3442; background: #2b3442; }

@media (max-width: 900px) {
    .design-overlay .ai-photo-workspace { grid-template-columns: 1fr; height: auto; max-height: calc(100vh - 150px); min-height: 0; overflow-y: auto; }
    .design-overlay .ai-photo-editor__prompt { min-height: 120px; }
    .design-overlay .ai-photo-library .preview-thumbs { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row !important; grid-auto-columns: auto !important; overflow-x: hidden; overflow-y: auto; }
    .design-overlay .ai-photo-library .preview-thumbs .slot__media { position: absolute !important; inset: 0 !important; min-height: 0; padding: 0; }
}
@media (max-width: 900px) { .design-overlay .editor-layout { grid-template-columns: 1fr 320px; } }
/* [2026-08-06] 目的：商品照提示詞提供右側快捷面板預覽，讓分類、內容與連續加入動線先以一致介面呈現。 */
.design-overlay .ai-photo-editor__prompt-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.design-overlay .ai-photo-editor__prompt-label-row .ai-photo-editor__label { margin: 0; }
.design-overlay .ai-photo-editor__language-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid #d5dfec; border-radius: 9px; background: #f4f7fb; }
.design-overlay .ai-photo-editor__language-switch button { min-width: 0; border: 0; border-radius: 6px; background: transparent; color: #64748b; padding: 7px 6px; font: inherit; font-size: 12px; cursor: pointer; }
.design-overlay .ai-photo-editor__language-switch button.is-active { background: #3478d8; color: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.design-overlay .ai-photo-editor__language-note { margin-top: -2px; color: #7b8798; font-size: 11px; line-height: 1.45; }
.design-overlay .ai-photo-editor__shortcut-btn {
    border: 1px solid #9fc1f7;
    border-radius: 8px;
    background: #fff;
    color: #2168c9;
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.design-overlay .ai-photo-editor__shortcut-btn:hover { background: #f2f7ff; }
.design-overlay .ai-prompt-shortcut {
    position: absolute;
    inset: 0;
    z-index: 10040;
    visibility: hidden;
    pointer-events: none;
}
.design-overlay .ai-prompt-shortcut.is-open {
    visibility: visible;
    pointer-events: auto;
}
.design-overlay .ai-prompt-shortcut__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    transition: opacity .24s ease;
    cursor: default;
}
.design-overlay .ai-prompt-shortcut.is-open .ai-prompt-shortcut__backdrop { opacity: 1; }
.design-overlay .ai-prompt-shortcut__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 92vw);
    display: flex;
    flex-direction: column;
    background: #f7f9fc;
    box-shadow: -18px 0 45px rgba(15, 23, 42, .18);
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}
.design-overlay .ai-prompt-shortcut.is-open .ai-prompt-shortcut__panel { transform: translateX(0); }
.design-overlay .ai-prompt-shortcut__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}
.design-overlay .ai-prompt-shortcut__head h2 {
    margin: 0;
    color: #1e293b;
    font-size: 20px;
}
.design-overlay .ai-prompt-shortcut__head p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}
.design-overlay .ai-prompt-shortcut__close {
    flex: 0 0 auto;
    border: 1px solid #bfd2ee;
    border-radius: 8px;
    background: #fff;
    color: #2168c9;
    padding: 8px 11px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.design-overlay .ai-prompt-shortcut__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
}
.design-overlay .ai-prompt-shortcut__section-title {
    margin-bottom: 10px;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}
.design-overlay .ai-prompt-shortcut__category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}
.design-overlay .ai-prompt-shortcut__category {
    border: 1px solid #d5dfec;
    border-radius: 999px;
    background: #fff;
    color: #526176;
    padding: 8px 13px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.design-overlay .ai-prompt-shortcut__category.is-active {
    border-color: #3478d8;
    background: #3478d8;
    color: #fff;
}
.design-overlay .ai-prompt-shortcut__item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.design-overlay .ai-prompt-shortcut__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #fff;
}
.design-overlay .ai-prompt-shortcut__item > div { min-width: 0; }
.design-overlay .ai-prompt-shortcut__item strong {
    display: block;
    color: #1e293b;
    font-size: 14px;
}
.design-overlay .ai-prompt-shortcut__item p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.55;
}
.design-overlay .ai-prompt-shortcut__item button {
    flex: 0 0 auto;
    border: 1px solid #a9c7f3;
    border-radius: 8px;
    background: #f5f9ff;
    color: #3973c4;
    padding: 7px 12px;
    font: inherit;
    font-size: 13px;
}
.design-overlay .ai-prompt-shortcut__item button:disabled { opacity: .65; cursor: not-allowed; }
.design-overlay .ai-prompt-shortcut__item button:not(:disabled) { cursor: pointer; }
.design-overlay .ai-prompt-shortcut__item button:not(:disabled):hover { background: #e8f1ff; }
.design-overlay .ai-prompt-shortcut__empty { display: block; padding: 14px; border: 1px dashed #ccd8e8; border-radius: 10px; color: #718096; font-size: 13px; line-height: 1.5; }
.design-overlay .ai-prompt-shortcut__preview-note {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 9px;
    background: #edf4ff;
    color: #4f6788;
    font-size: 12px;
    line-height: 1.55;
}
@media (max-width: 640px) {
    .design-overlay .ai-prompt-shortcut__panel { width: 100%; }
    .design-overlay .ai-prompt-shortcut__head { padding: 16px; }
    .design-overlay .ai-prompt-shortcut__head p { display: none; }
    .design-overlay .ai-prompt-shortcut__body { padding: 14px; }
}

/* [2026-08-06] 目的：放大提示詞編輯區、縮小圖片庫占比並壓縮步驟標頭，讓生成按鈕在桌機首屏即可操作。 */
@media (min-width: 901px) {
    .design-overlay .preview__head.ai-photo-workspace__head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 8px; padding: 0; }
    .design-overlay .preview--compact .ai-photo-workspace__head .kicker { width: auto; padding: 0; font-size: 15px; }
    .design-overlay .ai-photo-workspace__head .title { flex: 0 0 auto; padding: 0; font-size: 13px; }
    .design-overlay .ai-photo-workspace { grid-template-columns: minmax(520px, 7fr) minmax(230px, 3fr); height: clamp(470px, 48vh, 530px); }
    .design-overlay .ai-photo-editor { padding: 14px 16px; overflow: hidden; }
    .design-overlay .ai-photo-editor__prompt { min-height: 165px; flex: 1 1 165px; }
    .design-overlay .ai-photo-library { padding: 14px; }
    .design-overlay .ai-photo-library__empty { width: min(100%, 240px); min-height: 0; aspect-ratio: 1 / 1; flex: 0 0 auto; align-self: center; }
    /* [2026-08-06] 目的：已生成圖片以置中縮圖網格呈現，單張不再黏齊區塊左側，多張仍維持一致間距。 */
    .design-overlay .ai-photo-library .preview-thumbs { width: 100%; grid-template-columns: minmax(150px, 220px); justify-content: center; overflow-x: hidden; overflow-y: auto; }
}
.design-overlay .ai-photo-editor__actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; align-items: end; }
.design-overlay .ai-photo-editor__actions .ai-photo-editor__label { grid-column: 1 / -1; margin: 0; }
.design-overlay .ai-photo-editor__actions .slot__select { grid-column: 1; }
.design-overlay .ai-photo-editor__actions .ai-photo-editor__generate { grid-column: 2; min-width: 130px; margin: 0; }
.design-overlay .ai-photo-editor__actions .ai-photo-editor__hint { grid-column: 1 / -1; }
.design-overlay .ai-photo-editor__plan-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.design-overlay .ai-photo-editor__plan-row .ai-photo-editor__label { margin: 0; white-space: nowrap; }
.design-overlay .ai-photo-editor__plan-row .slot__select { height: 40px; padding: 0 38px 0 14px; line-height: 40px; }
.ai-photo-language-confirm { padding: 6px 4px 2px; color: #374151; font-size: 14px; line-height: 1.65; }
.ai-photo-language-confirm p { margin: 0 0 20px; }
.ai-photo-plain-confirm { padding: 6px 4px 2px; color: #374151; font-size: 14px; line-height: 1.65; }
.ai-photo-plain-confirm p { margin: 0 0 8px; font-weight: 700; }
.ai-photo-plain-confirm__note { margin-bottom: 20px; color: #64748b; }
