:root {
  --paper: #f7f7f6;
  --surface: #ffffff;
  --ink: #202020;
  --muted: #6e6e6e;
  --line: #dedede;
  --accent: #F4512C;
  --accent-soft: #fff0ec;
  --success: #27865a;
  --success-soft: #edf8f1;
  --warning: #a44b36;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled { cursor: wait; opacity: .58; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 16px; }

.task-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 20px 0 52px; }
.top-bar, .brand-block, .header-actions, .section-heading, .task-actions, .form-actions { display: flex; align-items: center; }
.top-bar { justify-content: space-between; min-height: 44px; border-bottom: 1px solid var(--line); }
.brand-block { gap: 24px; }
.product-name { color: var(--ink); font-size: 16px; font-weight: 750; text-decoration: none; }
.header-actions { gap: 16px; }
.view-navigation { display: flex; gap: 4px; }
.view-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 12px 8px 10px; font-size: 14px; }
.view-tab:hover, .view-tab.is-active { border-bottom-color: var(--accent); color: var(--ink); }
.connection-status, .field-hint { color: var(--muted); font-size: 13px; }
.connection-status.connected { color: var(--success); }
.button-link { border: 0; background: transparent; color: var(--ink); padding: 8px 0; }
.view { padding-top: 32px; }
.eyebrow { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.section-copy > p:last-child { margin-top: 10px; color: var(--muted); }

.upload-panel, .task-workspace, .settings-form { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 28px; }
.dropzone { display: grid; place-items: center; min-height: 190px; gap: 8px; margin-top: 24px; border: 1px dashed #b8b8b8; border-radius: 6px; background: #fcfcfc; color: var(--ink); text-align: center; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-preview { display: flex; flex-wrap: wrap; gap: 10px; min-height: 0; margin-top: 14px; }
.upload-preview:empty { display: none; }
.preview-item { width: 110px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.preview-item img { display: block; width: 92px; height: 72px; object-fit: cover; }
.preview-item span { display: block; padding: 5px 6px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.preview-remove { width: 100%; border: 0; border-top: 1px solid var(--line); background: #fff; color: var(--muted); padding: 4px; font-size: 11px; }
.preview-remove:hover { color: var(--accent); }

.toast { display: none; margin-top: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 14px; }
.toast.visible { display: block; }
.toast.error { border-color: var(--warning); color: var(--warning); }
.toast.success { border-color: var(--success); color: var(--success); }

.section-heading { justify-content: space-between; gap: 16px; }
.task-progress { margin: 24px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 14px; }
.task-progress { display: flex; align-items: center; gap: 10px; min-height: 70px; }
.progress-track { position: relative; width: min(420px, 55%); height: 10px; flex: 0 0 min(420px, 55%); border-radius: 5px; background: #ececec; }
.progress-fill { width: var(--progress, 0%); height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.progress-mascot { position: absolute; z-index: 1; top: 50%; left: clamp(21px, var(--progress, 50%), calc(100% - 21px)); width: 42px; height: 42px; object-fit: contain; image-rendering: pixelated; transform: translate(-50%, -50%); }
.progress-track.indeterminate .progress-fill { width: 35%; animation: progress-slide 1.2s ease-in-out infinite alternate; }
.progress-track.indeterminate .progress-mascot { left: 50%; animation: mascot-slide 1.2s ease-in-out infinite alternate; }
.submit-summary { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.task-progress.processing { border-color: var(--accent); color: var(--accent); }
.task-progress.stopped { border-color: var(--warning); color: var(--warning); }
.task-actions, .form-actions { flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.form-actions { margin-top: 22px; }
.button-primary, .button-secondary { min-height: 36px; border-radius: 5px; padding: 7px 11px; font-weight: 650; }
.button-primary { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.button-secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.button-secondary:hover { border-color: var(--accent); color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
table { width: 100%; min-width: 1120px; border-collapse: collapse; background: #fff; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 650; }
td { font-size: 14px; line-height: 1.5; }
tbody tr:last-child td { border-bottom: 0; }
.needs-review { background: #fff9f7; }
.record-text { min-width: 320px; max-width: 490px; }
.status-label { color: var(--muted); font-size: 13px; }
.status-label.success { color: var(--success); }
.status-label.warning { color: var(--warning); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { min-height: 30px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }
.row-actions button:hover { border-color: var(--accent); color: var(--accent); }

.record-editor { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 5px; }
.image-adjustments { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.image-adjustments h3 { margin: 0 0 12px; font-size: 15px; }
.image-adjustment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.image-adjustment-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: #fcfcfc; }
.image-adjustment-card > img { width: 118px; height: 156px; object-fit: contain; background: #f2f2f2; }
.image-adjustment-meta { min-width: 0; }
.image-adjustment-meta p { margin: 0 0 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.image-adjustment-meta label { margin-top: 9px; }
.image-warning, .image-lock-hint { color: var(--warning) !important; }
.editor-grid, .settings-section { display: grid; gap: 14px; }
.editor-grid { grid-template-columns: 220px minmax(0, 1fr); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); padding: 8px 9px; }
textarea { min-height: 120px; resize: vertical; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.settings-section h2 { margin-bottom: 2px; }
.settings-form .form-actions { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .task-shell { width: min(100% - 24px, 1440px); padding-top: 12px; }
  .top-bar, .brand-block { align-items: flex-start; flex-direction: column; }
  .brand-block { gap: 4px; }
  .upload-panel, .task-workspace, .settings-form { padding: 18px; }
  .connection-status { display: none; }
  .settings-form, .editor-grid { grid-template-columns: 1fr; }
  .image-adjustment-card { grid-template-columns: 92px minmax(0, 1fr); }
  .image-adjustment-card > img { width: 92px; height: 124px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
  .progress-track.indeterminate .progress-fill { width: 35%; }
  .progress-track.indeterminate .progress-mascot { left: 50%; }
}

@keyframes progress-slide { from { width: 25%; } to { width: 65%; } }
@keyframes mascot-slide { from { transform: translate(-85%, -50%); } to { transform: translate(-15%, -50%); } }

.upload-panel, .task-workspace, .settings-form { box-shadow: none; }
