:root {
  color-scheme: light;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172335;
  --ink: #172335;
  --muted: #586679;
  --line: #dbe2e9;
  --accent: #c45e00;
  --accent-hover: #a64c00;
  --accent-tint: #fff4e6;
  background: #f8fafc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button:not(:disabled), summary, select:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid #ca6607; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.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; }
.listing-page { width: 100%; min-width: 0; color: var(--ink); font-size: 14px; }
.upload-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 0 0 18px; }
.crumb { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.upload-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.4; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button, .row-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 6px; min-height: 36px; padding: 6px 13px; font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.button.primary { background: #df7200; color: #fff; }
.button.primary:not(:disabled):hover { background: var(--accent-hover); }
.button.secondary { border-color: #cdd6e0; background: #fff; color: var(--ink); }
.button.secondary:not(:disabled):hover { background: #fff8ed; border-color: #d49c67; }
.button.quiet, .row-action { color: #9a4a00; background: transparent; }
.row-action { padding: 2px 5px; min-height: 30px; }
.row-action:hover, .quiet:hover { background: #fff4e5; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 22px; }
.icon-button:hover { color: var(--ink); background: #f1f5f9; }
.listing-page .panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.gate { padding: 24px; }
.gate h2 { font-size: 18px; }
.gate p, .dialog p { color: var(--muted); margin: 8px 0 16px; }
.banner, .queue-notice, .version-bar { padding: 9px 13px; border: 1px solid #cce0f4; border-radius: 6px; color: #355b82; background: #f0f7ff; font-size: 14px; overflow-wrap: anywhere; }
.banner, .queue-notice { margin-bottom: 12px; }
.banner[data-tone="error"] { color: #942b34; background: #fff1f2; border-color: #f2cbd2; }
.banner[data-tone="success"] { color: #185937; background: #edf9f2; border-color: #cae6d6; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 16px; }
.filter-bar label, .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-bar label { font-size: 13px; color: #4d596b; min-width: 105px; }
.filter-bar .query-field { flex: 1 1 210px; max-width: 440px; }
.listing-page input, .listing-page select, .work-dialog :is(input:not([type=file]),textarea,select) {
  width: 100%; border: 1px solid #cfd8e1; min-height: 36px; border-radius: 5px; padding: 7px 10px; background: #fff; color: var(--ink); font-size: 14px;
}
.filter-bar .refresh-jobs { margin-left: auto; }
.table-scroll { overflow: auto; max-width: 100%; }
.jobs-table { width: 100%; min-width: 875px; border-collapse: collapse; font-size: 14px; text-align: left; }
.jobs-table th { font-size: 13px; font-weight: 650; color: #475569; background: #f4f7fa; border-block: 1px solid var(--line); white-space: nowrap; }
.jobs-table th, .jobs-table td { padding: 11px 12px; }
.jobs-table td { border-bottom: 1px solid #edf1f5; }
.jobs-table tr.current-job td { background: #fffbf5; }
.jobs-table .date-cell { color: var(--muted); font-size: 13px; }
.product-link { font: inherit; font-weight: 650; text-align: left; color: #172335; border: 0; padding: 0; background: transparent; overflow-wrap: anywhere; }
.product-link:hover { color: var(--accent); text-decoration: underline; }
.sku { display: block; font-size: 12px; color: var(--muted); }
.progress-steps { display: flex; gap: 3px; min-width: 62px; max-width: 75px; margin-bottom: 3px; }
.progress-steps i { height: 5px; flex: 1; background: #e0e6ec; border-radius: 3px; }
.progress-steps i.current { background: #e69b44; }
.progress-steps i.done { background: #4a9972; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; color: #516075; background: #edf1f6; }
.status-pill:is([data-status="launching"], [data-status="generating"]) { color: #245a91; background: #eaf3ff; }
.status-pill:is([data-status="review"], [data-status="needs_user"]) { color: #8b5200; background: #fff0d4; }
.status-pill[data-status="approved"] { color: #245c45; background: #e8f6ed; }
.status-pill[data-status="failed"] { color: #9d2339; background: #ffe9ed; }
.queue-empty, .result-empty { padding: 46px 15px; text-align: center; }
.queue-empty p, .result-empty p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.briefcase { display: block; position: relative; margin: 8px auto 14px; width: 34px; height: 24px; border: 2px solid #b8c3ce; border-radius: 5px; background: linear-gradient(to bottom, transparent 9px, #c4ced8 9px 11px, transparent 11px); }
.briefcase::before { content: ''; position: absolute; width: 12px; height: 6px; top: -8px; left: 8px; border: 2px solid #b8c3ce; border-bottom: none; border-radius: 4px 4px 0 0; }
.list-foot, .pipeline-steps { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.list-foot { justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 15px; }
.list-foot .button { min-height: 29px; padding: 3px 8px; font-size: 12px; }
.pipeline-steps { padding: 16px 0; }
.pipeline-steps i { color: #a9b4c0; }
#future-area { display: flex; flex-wrap: wrap; gap: 10px; }
.future-item { display: flex; align-items: center; gap: 14px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.future-item small { color: var(--muted); }
.dialog, .work-dialog { padding: 0; color: var(--ink); border: 1px solid #ccd6e1; border-radius: 10px; box-shadow: 0 18px 56px #25374635; }
.dialog::backdrop, .work-dialog::backdrop { background: #17233572; }
.work-dialog { width: min(800px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: auto; overflow: auto; overscroll-behavior: contain; font-size: 14px; }
.work-dialog.with-result { width: min(1240px, calc(100vw - 32px)); }
.detail-header, .report-header { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.detail-header { padding: 15px 20px; background: white; border-bottom: 1px solid var(--line); }
.detail-header h2 { font-size: 19px; }
.detail-header .status-pill { margin-left: auto; }
.detail-meta { color: var(--muted); overflow-wrap: anywhere; font-size: 13px; }
.detail-links { display: flex; gap: 12px; }
.detail-links > :not([hidden]) { margin: 9px 20px 0; }
.text-link { font-size: 14px; color: var(--accent); }
.job-alert { margin: 12px 20px 0; white-space: pre-line; }
.work-dialog fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.form-section, .result-section { padding: 18px 21px; }
.form-section + .form-section, .result-section + .result-section { border-top: 1px solid var(--line); }
.form-section h3, .result-section h3 { font-size: 16px; color: var(--ink); margin: 0 0 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 18px; }
.span-two { grid-column: 1 / -1; }
.field > label { font-size: 14px; font-weight: 620; }
.required { color: #a94804; }
.optional, .hint, .field-error, .char-count, .risk-list { font-size: 13px; color: var(--muted); }
.field-error { color: #a42538; }
.optional { margin-left: 4px; font-weight: 400; }
.work-dialog textarea { resize: vertical; min-height: 55px; }
.work-dialog [aria-invalid="true"] { border-color: #bd4051 !important; }
.work-dialog :is(input,textarea):read-only { background: #f7f9fb; }
.asset-field, .optional-fields { margin-top: 14px; }
.upload-area { border: 1px dashed #c6a880; background: #fffaf2; padding: 12px; display: flex; gap: 12px; align-items: center; border-radius: 7px; }
.upload-area.is-dragging { border-color: var(--accent); background: #fff0d5; }
.upload-area .hint { display: block; }
.upload-icon { color: var(--accent); font-size: 23px; }
.upload-button { cursor: pointer; }
.upload-area .upload-button { margin-left: auto; }
.upload-area:focus-within .upload-button, .upload-doc:focus-within .upload-button { outline: 2px solid var(--accent); }
.upload-doc { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.asset-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(195px,1fr)); gap: 6px; list-style: none; margin: 5px 0; padding: 0; }
.asset-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; }
.asset-item img, .file-placeholder { width: 36px; height: 33px; background: #f3f5f8; object-fit: contain; }
.file-placeholder { display: grid; place-items: center; font-size: 11px; }
.asset-name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 13px; color: var(--ink); }
.optional-fields summary, .plan-detail summary, .record-info summary { cursor: pointer; font-weight: 620; }
.optional-fields .field, .plan-detail .field { margin-top: 8px; }
.actionbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; position: sticky; bottom: 0; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; z-index: 1; }
.actionbar .row { margin-left: auto; }
.action-note { color: var(--muted); font-size: 13px; }
.result-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 18px; gap: 8px; overflow-x: auto; }
.result-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 8px 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.result-tabs button[aria-selected="true"] { color: var(--accent); border-color: #ef8200; }
.version-bar { margin: 14px 20px 0; }
.result-section .field + .field, .result-section details + details { margin-top: 11px; }
.char-count { align-self: flex-end; font-size: 12px; }
.plan-detail { padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.risk-list { margin: 7px 0 14px; overflow-wrap: anywhere; }
.dialog { padding: 20px; max-width: min(430px, calc(100vw - 24px)); }
.dialog h2 { font-size: 18px; }
.dialog .row { justify-content: flex-end; }
.report-dialog { width: min(1100px, calc(100vw - 24px)); max-width: none; }
.report-dialog iframe { width: 100%; height: 72dvh; margin-top: 12px; border: 1px solid var(--line); }
@media (max-width: 620px) {
  .upload-head { align-items: flex-start; gap: 8px; }
  .upload-head h1 { font-size: 19px; }
  .filter-bar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px; }
  .filter-bar label { min-width: 0; }
  .filter-bar .query-field { grid-column: 1 / -1; grid-row: 1; max-width: none; }
  .filter-bar .refresh-jobs { margin-left: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .form-section, .result-section, .detail-header, .actionbar { padding: 13px; }
  .work-dialog, .work-dialog.with-result { width: calc(100% - 12px); max-height: calc(100dvh - 12px); }
  .button, .icon-button, .result-tabs button, .list-foot .button { min-height: 44px; }
  .upload-area { flex-wrap: wrap; }
  .actionbar .row { width: 100%; justify-content: end; }
  .result-tabs { padding: 0 3px; gap: 1px; }
  .result-tabs button { padding-inline: 5px; font-size: 13px; }
  .pipeline-steps { gap: 5px; }
}
.work-dialog.with-result > .detail-header { position: sticky; top: 0; z-index: 3; flex-wrap: wrap; }
.detail-header #approve,.detail-header #image-shortcut { margin-left: auto; }
.detail-header #approve:not([hidden]) ~ .status-pill,.detail-header #image-shortcut:not([hidden]) ~ .status-pill { margin-left: 0; }
.row-action.row-primary { color: white; border-color: #aa5900; background: #aa5900; }
#image-workspace { padding: 14px 20px 22px; }
.image-controls,.image-review-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 0 0 14px; }
.image-controls p { margin-top: 4px; overflow-wrap: anywhere; }
#image-notice { white-space: pre-line; }
.image-no-files { text-align: center; color: var(--muted); padding: 25px 12px; }
.image-batch { padding: 14px 0; border-top: 1px solid var(--line); }
.image-batch h4 { margin: 14px 0 6px; }
.image-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill,minmax(min(180px,100%),1fr)); }
.image-card { display: flex; flex-direction: column; align-items: stretch; gap: 5px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; min-width: 0; overflow-wrap: anywhere; }
.image-thumb { display: block; position: relative; width: 100%; height: clamp(130px,16vw,190px); overflow: hidden; background: #f4f6f7; }
.image-thumb img { position: absolute; inset: 0; display: block; width:100%; height:100%; object-fit:contain; }
.image-review-bar { justify-content: end; padding: 10px 0; margin: 0; background: white; }
#image-needs { display: grid; gap: 7px; padding: 12px; margin-bottom: 12px; background: #fff8ee; border: 1px solid #eddac2; border-radius: 5px; }
#image-needs ul { margin:0 0 5px; padding-left: 20px; }
#image-needs label { font-weight: 630; }
#image-needs button { justify-self: start; }
@media (max-width: 620px) { .work-dialog.with-result .detail-header > div { flex: 1 0 100%; } .detail-header #approve,.detail-header #image-shortcut { margin: 0 auto 0 0; } #image-workspace { padding:12px; } .image-controls { flex-wrap:wrap; } }
@media (max-width:620px) {
  .jobs-table,.jobs-table tbody { display:block; min-width:0; width:100%; }
  .jobs-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .jobs-table tr { display:grid; grid-template-columns:1fr 1fr; padding:11px 12px; gap:7px 9px; border-top:1px solid var(--line); }
  .jobs-table td { display:block; min-width:0; border:0; padding:0; }
  .jobs-table td:nth-child(1),.jobs-table .row-actions { grid-column:1/-1; }
  .jobs-table td:nth-child(n+2):nth-child(-n+6)::before { content:attr(data-label); display:block; color:var(--muted); font-size:12px; }
  .jobs-table .row-actions { white-space:normal; }
  .jobs-table .row-actions button { min-height:40px; margin:2px 4px 1px 0; }
}

.work-dialog.with-result { scroll-padding-block: 118px 24px; }
.image-card .text-link { align-self: flex-start; padding: 5px 0; min-height: 34px; }
.image-scope-dialog { width:min(460px,calc(100vw - 20px)); max-width:100vw; }
.image-scope-dialog .scope-option { display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:5px; padding:10px; margin:7px 0; cursor:pointer; }
.image-scope-dialog .scope-option:has(input:checked) { border-color:var(--accent); background:#fff7eb; }
.image-scope-dialog .scope-option input { width:18px; height:18px; accent-color:var(--accent); }
.image-scope-dialog .scope-option span { margin-left:auto; }
.image-scope-dialog fieldset { margin:12px 0; padding:0; border:0; }
.scope-footer { display:flex; justify-content:flex-end; padding-top:8px; }
