* { box-sizing: border-box; }
:root { font-family: Arial, "Microsoft YaHei", sans-serif; color: #081c3b; background: #f6f8fa; --line: #edf0f5; --purple: #6059ff; --muted: #8290ac; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 43% 0%, #d9f4ef99, transparent 65%), linear-gradient(#f2fafb, #f6f8fa 65%); }
button,input,select,textarea { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; }
button:focus-visible,a:focus-visible { outline: 2px solid #aaa3ff; outline-offset: 3px; }
input:focus,textarea:focus,select:focus { outline: none; border-color: #a39df1 !important; box-shadow: 0 0 0 3px #7166ec0b; }
a { color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app-shell { padding: 12px; margin: auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 12px; }
.workspace { display: grid; grid-template-columns: 272px minmax(0,1fr) 340px; grid-template-rows: minmax(0,1fr); gap: 12px; flex: 1; min-height: 0; }
.panel { min-width: 0; min-height: 0; background: #ffffffed; border: 1px solid #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 34px #46536e06; }
h2,h3,p { margin: 0; }
h2 { font-size: 16px; font-weight: 600; line-height: 23px; }
.history-panel { display: flex; flex-direction: column; }
.panel-heading { height: 79px; flex-shrink: 0; padding: 15px 16px 16px; }
.heading-row { display: flex; align-items: center; justify-content: space-between; height: 28px; }
.history-heading-actions { display: flex; gap: 5px; align-items: center; }
.count-badge { height: 28px; min-width: 44px; border-radius: 16px; background: #ebfcf5; color: #008b7a; font-size: 11px; font-weight: 600; display: grid; place-items: center; padding: 0 9px; }
.panel-heading p { margin-top: 2px; font-size: 12px; line-height: 19px; color: var(--muted); }
.history-filters { display: flex; gap: 4px; padding: 12px 10px; border-block: 1px solid var(--line); flex-shrink: 0; }
.filter { display: flex; justify-content: center; gap: 3px; align-items: center; border-radius: 10px; height: 29px; background: #f6f7f9; padding: 0 5px; white-space: nowrap; color: #728099; font-size: 11px; flex: 1; }
.filter.active { background: var(--purple); color: #fff; box-shadow: 0 5px 10px #6861ee20; font-weight: 600; }
.filter span { font-size: 10px; }
.history-list { padding: 12px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: #e4e7ef transparent; }
.empty-history { height: 100%; min-height: 180px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 0 25px; }
.empty-placeholder { width: 54px; height: 54px; border-radius: 18px; background: #f5f6f9; display: grid; place-items: center; color: #94a0b8; flex-shrink: 0; }
.empty-placeholder .icon { width: 24px; height: 24px; stroke-width: .8; stroke-linejoin: miter; stroke-linecap: butt; }
.empty-history h3 { font-size: 14px; line-height: 22px; font-weight: 600; margin: 12px 0 7px; }
.empty-history p { color: var(--muted); font-size: 12px; line-height: 18px; max-width: 244px; }
.preview-panel { display: flex; flex-direction: column; }
.preview-heading { height: 79px; flex-shrink: 0; border-bottom: 1px solid var(--line); padding: 15px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.preview-heading h2 { margin-bottom: 5px; }
.preview-heading>div>span { font-size: 12px; line-height: 18px; color: var(--muted); }
.retention-help { padding: 0; margin: 1px 0 0; background: none; }
.subtle-badge { display: inline-block; border-radius: 10px; color: var(--purple); background: #f0f1ff; font-size: 10px; padding: 6px 9px; white-space: nowrap; }
.preview-content { background: #f8faff; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 24px; }
.canvas-empty { text-align: center; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.canvas-empty h2 { margin: 6px 0 7px; font-size: 14px; font-weight: 600; line-height: 22px; }
.canvas-empty p { font-size: 12px; color: var(--muted); line-height: 20px; }
.controls-panel form { display: flex; flex-direction: column; height: 100%; }
.controls-heading { display: flex; justify-content: space-between; align-items: center; padding: 17px 16px 18px; height: 79px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.mode-tabs { display: flex; gap: 0; background: #f3f4f7; padding: 4px; border-radius: 13px; }
.mode-tab { font-size: 12px; color: #68768f; background: transparent; padding: 9px 12px; border-radius: 9px; line-height: 16px; }
.mode-tab.active { color: var(--purple); background: #fff; box-shadow: 0 2px 6px #33384c0d; font-weight: 600; }
.new-session { background: #effcf6; color: #008d75; border: 1px solid #9af0c7; border-radius: 12px; font-size: 11px; font-weight: 600; height: 34px; padding: 0 11px; }
.new-session:hover { background: #e3f8ed; }
.controls-scroll { padding: 17px 16px; flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #e4e7ef transparent; }
.field { min-width: 0; margin-bottom: 14px; }
.field label { font-size: 12px; line-height: 18px; font-weight: 400; display: block; margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; height: 18px; }
.label-row label { margin-bottom: 0; }
.mini-button { background: transparent; color: #9da7bb; padding: 0; display: grid; place-items: center; opacity: 0; }
.field:hover .mini-button,.mini-button:focus-visible { opacity: 1; }
.mini-button .icon { width: 13px; height: 13px; }
.field select,.field textarea,.quantity-input { width: 100%; border: 1px solid #d9e0ee; background: #fff; border-radius: 12px; color: #0b1d38; }
.field select { height: 42px; padding: 0 35px 0 16px; appearance: none; font-size: 14px; font-weight: 600; text-overflow: ellipsis; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2398a2b5' stroke-width='1.6'%3E%3Cpath d='m4 8 8 8 8-8'/%3E%3C/svg%3E"); background-position: right 15px center; background-repeat: no-repeat; }
.field select:disabled { color: #97a0b3; font-size: 12px; font-weight: 400; }
.field textarea { height: 113px; min-height: 113px; max-height: 350px; resize: vertical; padding: 10px 12px; font-size: 12px; line-height: 20px; display: block; }
.field textarea::placeholder { color: #a1a9bb; }
.field-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.quantity-input { height: 42px; padding: 0 12px; font-size: 12px; color: #61749a; }
.quantity-input::-webkit-inner-spin-button { opacity: 0; }
.quantity-input:hover::-webkit-inner-spin-button,.quantity-input:focus::-webkit-inner-spin-button { opacity: 1; }
.generate-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 16px 12px; flex-shrink: 0; background: #fff; }
.primary-button { min-height: 45px; width: 100%; border-radius: 13px; background: linear-gradient(105deg,#65bcb2,#9682cc); color: #fff; font-size: 12px; font-weight: 600; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 12px; }
.primary-button:disabled { background: linear-gradient(105deg,#9bd4ce,#bcaade); }
.primary-button:hover:enabled { filter: brightness(1.03); box-shadow: 0 4px 12px #8f8bd322; }
.generate-footer p { margin: 8px 0 0; color: #8b98b0; font-size: 10px; line-height: 16px; }
.notice { border: 1px solid #e5e0f4; background: #f7f5ff; color: #807292; border-radius: 12px; font-size: 12px; line-height: 1.8; padding: 10px 14px; flex-shrink: 0; }
.notice.error { color: #987460; border-color: #eee0d5; background: #fff9f3; }
.notice a { color: var(--purple); text-decoration: underline; margin-left: 7px; }
.demo-notice { position: fixed; bottom: 12px; left: 35px; margin: 0; padding: 5px 9px; z-index: 3; font-size: 10px; line-height: 16px; background: #f5f4fbea; color: #a19bac; border-color: #eeedf5; }
.label-note { font-size: 10px; color: #a2aabb; }
.upload-zone { display: flex!important; flex-direction: column; align-items: center; gap: 7px; padding: 16px 6px; text-align: center; background: #fafaff; border: 1px dashed #d7d4ec; border-radius: 12px; color: #8d88a5; cursor: pointer; font-size: 11px!important; }
.upload-zone small { font-size: 9px; color: #a8a4b7; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone:focus-within { outline: 2px solid #aaa3ed; }
.upload-zone.dragover { background: #f0edff; border-color: #a69add; }
.reference-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.reference-item { width: 56px; height: 56px; position: relative; border-radius: 8px; border: 1px solid #e4e7ef; }
.reference-item img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.reference-item button { position: absolute; right: -4px; top: -4px; border-radius: 50%; width: 18px; height: 18px; background: white; box-shadow: 0 1px 4px #2222; padding: 2px; color: #8791a4; }
.reference-item .icon { width: 14px; height: 14px; }
.icon-button { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: #929db1; background: transparent; }
.icon-button .icon { width: 15px; height: 15px; }
.icon-button:hover { background: #f1f2f9; color: var(--purple); }
.history-entry { position: relative; margin-bottom: 5px; border-radius: 11px; }
.history-card { display: flex; gap: 10px; width: 100%; border: 1px solid transparent; background: transparent; color: inherit; padding: 10px 8px; border-radius: 11px; text-align: left; }
.history-entry.has-delete .history-card { padding-right: 36px; }
.history-delete { position: absolute; top: 8px; right: 4px; width: 30px; height: 30px; color: #a1aabc; }
.history-delete:hover { color: #b66161; background: #fff0f0; }
.history-delete:focus-visible { outline-offset: -2px; }
.history-card:hover { background: #fafaff; }
.history-card.selected { background: #f8f6ff; border-color: #e3dffd; }
.history-thumb { width: 48px; height: 54px; border-radius: 8px; overflow: hidden; background: #f3f4f9; color: #a7aec1; display: grid; place-items: center; flex-shrink: 0; }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-summary { flex: 1; min-width: 0; }
.history-summary h3 { font-size: 12px; font-weight: 500; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin: 0 0 7px; }
.history-meta { display: flex; justify-content: space-between; gap: 5px; font-size: 10px; color: #a0a8b7; }
.history-meta .success { color: #6ca795; }.history-meta .pending { color: #9185cf; }.history-meta .failure { color: #bd8a82; }
.result-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 17px; }
.results-grid { display: grid; grid-template-columns: 1fr; gap: 16px; flex: 1; min-height: 0; align-items: center; justify-items: center; }
.results-grid.multiple { grid-template-columns: repeat(2,minmax(0,1fr)); align-content: center; }
.result-item { width: 100%; min-height: 0; position: relative; text-align: center; }
.result-image { max-width: 100%; max-height: calc(100dvh - 300px); min-height: 120px; object-fit: contain; border-radius: 10px; box-shadow: 0 8px 28px #23334a13; cursor: zoom-in; vertical-align: middle; background: #fff; }
.multiple .result-image { max-height: calc((100dvh - 350px)/2); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 10px; }
.result-actions button,.original-link { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: #7a859c; background: #fff; border: 1px solid #e2e7f0; border-radius: 7px; padding: 7px 9px; text-decoration: none; }
.result-actions .icon { width: 13px; height: 13px; }
.result-details { background: #fff; border: 1px solid #e7eaf2; border-radius: 10px; padding: 14px; flex-shrink: 0; }
.result-prompt { font-size: 12px; line-height: 1.8; color: #6d7b95; max-height: 90px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 10px; }
.result-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 10px; color: #9fa8bc; }
.result-tags>button { margin-left: auto; color: var(--purple); background: none; font-size: 10px; display: flex; align-items: center; gap: 4px; }
.result-tags .icon { width: 12px; height: 12px; }
.demo-watermark { font-size: 10px; color: #a8987a; background: #faf6ee; padding: 5px 9px; border-radius: 7px; align-self: center; }
.task-state { text-align: center; max-width: 390px; display: flex; align-items: center; flex-direction: column; padding: 24px; }
.task-state h3 { font-size: 17px; font-weight: 550; margin: 23px 0 11px; color: #64728d; }
.task-state p { font-size: 12px; color: #919bb0; line-height: 1.9; overflow-wrap: anywhere; margin-bottom: 16px; }
.task-state .state-note { font-size: 10px; color: #a4adbd; margin-top: 16px; }
.state-time { font-size: 11px; color: #9185bf; font-variant-numeric: tabular-nums; padding: 7px 13px; background: #eeebfa; border-radius: 20px; }
.spinner { width: 44px; height: 44px; border: 2px solid #e8e5f4; border-top-color: #9b91db; border-radius: 50%; animation: spin 1.8s linear infinite; }
.history-thumb .spinner { width: 19px; height: 19px; }
.state-symbol { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: #f4eee7; color: #b49c83; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #e0e5ee; border-radius: 9px; padding: 10px 14px; font-size: 11px; color: #687691; background: white; }
.secondary-button .icon { width: 15px; height: 15px; }.task-state .secondary-button { margin-top: 9px; }
.expired-image { min-height: 150px; display: flex; align-items: center; justify-content: center; background: #f2f4f8; color: #939eb2; border-radius: 10px; font-size: 12px; padding: 20px; }
.toast-container { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; flex-direction: column; gap: 9px; width: min(90vw,460px); pointer-events: none; }
.toast { font-size: 12px; color: #fff; background: #3d465df5; box-shadow: 0 4px 24px #29304426; padding: 13px 20px; border-radius: 10px; line-height: 1.6; text-align: center; }
.dialog { border: 1px solid #e6e9f2; border-radius: 20px; padding: 26px; max-width: 480px; width: calc(100% - 36px); box-shadow: 0 30px 120px #252b4a30; color: #53617b; }
.dialog::backdrop { background: #333c4d66; backdrop-filter: blur(4px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }.dialog-header h2 { font-size: 17px; }
.help-steps { margin: 0; padding-left: 22px; line-height: 1.8; }.help-steps li { padding-left: 5px; margin-bottom: 18px; color: var(--purple); font-size: 12px; }.help-steps strong { color: #687289; font-size: 13px; }.help-steps p { color: #939cae; font-size: 12px; margin: 5px 0 0; }
.help-note { padding: 13px; border-radius: 10px; background: #f7f7fb; color: #9099ad; font-size: 11px; line-height: 1.9; margin: 20px 0; }
.small-dialog p { font-size: 12px; line-height: 1.9; color: #929aae; }.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }.danger-button { background: #bb807d; color: #fff; border-radius: 9px; font-size: 12px; padding: 11px 17px; }
.small-dialog .delete-record-preview { margin: 0 0 14px; padding: 12px; background: #f5f6fa; border-radius: 10px; color: #53617b; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 100px; overflow: auto; }
.lightbox { border: 0; background: transparent; padding: 0; width: 96vw; max-width: none; height: 94vh; max-height: none; overflow: hidden; }.lightbox[open] { display: flex; align-items: center; justify-content: center; }.lightbox::backdrop { background: #18202de8; }.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; }.lightbox-close { position: fixed; top: 20px; right: 20px; background: #fff; color: #525b71; z-index: 2; }
@keyframes spin { to { transform: rotate(360deg); } }
@media(max-width:1200px) {
  .app-shell { padding: 10px; gap: 10px; }
  .workspace { grid-template-columns: 244px minmax(0,1fr) 320px; gap: 10px; }
  .filter { padding: 0 4px; font-size: 10px; }
  .history-filters { gap: 4px; padding-inline: 9px; }
  .panel-heading p,.preview-heading>div>span { font-size: 11px; }
  .field select { font-size: 13px; padding-left: 13px; }
  .empty-history { padding-inline: 12px; }
}
@media(max-width:980px) {
  .app-shell { height: auto; min-height: 100dvh; }
  .workspace { flex: none; grid-template-columns: minmax(0,1fr) 320px; grid-template-rows: minmax(560px,calc(100dvh - 210px)) 180px; }
  .history-panel { grid-column: 1/-1; grid-row: 2; position: relative; }
  .preview-panel { grid-column: 1; grid-row: 1; }
  .controls-panel { grid-column: 2; grid-row: 1; }
  .history-panel .panel-heading { height: 66px; padding: 14px 18px; }
  .history-panel .panel-heading p { display: none; }
  .history-filters { position: absolute; right: 112px; top: 15px; border: 0; padding: 0; }
  .history-list { display: flex; gap: 7px; padding: 10px 12px; overflow-x: auto; overflow-y: hidden; }
  .history-entry { flex: 0 0 260px; align-self: center; margin-bottom: 0; }
  .empty-history { width: 100%; min-height: 0; flex-direction: row; gap: 15px; }
  .empty-history h3 { margin: 0; }
  .empty-history p { display: none; }
  .result-image { max-height: 360px; }
  .multiple .result-image { max-height: 170px; }
  .canvas-empty p { max-width: 280px; }
  .demo-notice { bottom: 8px; left: 20px; }
}
@media(max-width:680px) {
  .app-shell { padding: 8px; gap: 10px; }
  .workspace { display: flex; flex-direction: column; gap: 10px; }
  .preview-panel { order: 0; }
  .controls-panel { order: 1; }
  .controls-panel form { height: auto; }
  .history-panel { order: 2; height: 230px; }
  .preview-heading { height: auto; min-height: 77px; padding: 15px; }
  .preview-heading>div>span { font-size: 10px; line-height: 1.7; display: block; max-width: 270px; }
  .preview-content { min-height: 280px; padding: 18px; }
  .canvas-empty p { font-size: 11px; }
  .controls-heading { padding-inline: 16px; height: 73px; }
  .controls-scroll { padding-top: 17px; overflow: visible; }
  .field { margin-bottom: 16px; }
  .field select { font-size: 14px; height: 44px; }
  .field textarea { height: 120px; }
  .quantity-input { height: 44px; }
  .field label { font-size: 12px; }
  .result-image { max-height: 430px; }
  .multiple .result-image { max-height: 190px; min-height: 60px; }
  .result-actions button,.original-link { font-size: 9px; padding: 6px; }
  .result-details { padding: 11px; }
  .result-wrap { gap: 13px; }
  .history-filters { top: 63px; left: 14px; right: 14px; gap: 6px; }
  .history-panel .panel-heading { height: 102px; }
  .history-list { min-height: 100px; }
  .history-heading-actions { position: absolute; top: 15px; right: 15px; }
  .notice { font-size: 11px; }
  .demo-notice { left: 18px; bottom: 5px; font-size: 9px; }
  .toast-container { bottom: 32px; }
  .mini-button { opacity: .6; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important; scroll-behavior: auto!important; } }
