:root {
  --bg: #eef2f7;
  --panel: rgba(255, 255, 255, 0.94);
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --danger: #dc2626;
  --warning: #d97706;
  --ok: #059669;
  --ink: #0f172a;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
  --soft-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 22px;
  background: linear-gradient(135deg, #0f172a 0%, #172554 62%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}
.topbar h1 {
  margin: 0 0 6px;
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: -0.03em;
}
.topbar p { margin: 0; color: #cbd5e1; font-size: 13px; line-height: 1.5; }
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}
.top-actions button { flex: 0 0 auto; min-width: 92px; }

.layout {
  display: grid;
  grid-template-columns: 340px minmax(680px, 1fr);
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 86px);
}

.panel, .canvas-card {
  background: var(--panel);
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel {
  overflow: auto;
  padding: 16px;
}
section + section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
h2::before {
  content: "";
  width: 7px;
  height: 18px;
  border-radius: 99px;
  background: var(--primary);
}

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #d1d9e6;
  border-radius: 12px;
  padding: 10px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
input[readonly] { background: #f8fafc; color: #475569; }
input[type="color"] { height: 41px; padding: 4px; }
input[type="file"] { padding: 8px; font-size: 12px; }
textarea { height: 190px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.45; }

.upload-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px;
  border: 1.5px dashed #93b4ff;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f4f7ff);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.upload-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}
.upload-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.upload-text { display: grid; gap: 4px; min-width: 0; }
.upload-text b { font-size: 14px; color: var(--text); }
.upload-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.readonly {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fafc, #eef4ff);
  color: var(--muted);
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(219, 227, 239, 0.75);
}
.readonly span { display: grid; gap: 2px; }
.readonly b { color: var(--ink); font-size: 16px; }

button {
  border: 0;
  border-radius: 13px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}
button:hover { filter: brightness(1.02); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.secondary { background: #e8edf5; color: #111827; box-shadow: none; }
button.full { width: 100%; }

.checkbox { display: flex; gap: 8px; align-items: center; color: var(--text); }
.checkbox input { width: auto; margin: 0; }
.checkbox.compact { margin: 0; font-size: 12px; }

.workspace {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}
.canvas-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.78);
}
.canvas-toolbar strong { font-size: 15px; }
.canvas-toolbar span { margin-left: 10px; color: var(--muted); font-size: 12px; }
.canvas-wrap {
  flex: 1;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
canvas {
  display: block;
  margin: auto;
  background: white;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  cursor: default;
}

.hint, .empty { color: var(--muted); font-size: 12px; line-height: 1.6; }
.hint {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}
.hidden { display: none !important; }
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.validation { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.validation li {
  padding: 10px 11px;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid transparent;
}
.validation .ok { background: #ecfdf5; color: var(--ok); border-color: #bbf7d0; }
.validation .error { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.validation .warning { background: #fffbeb; color: var(--warning); border-color: #fed7aa; }
.rules { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.status {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  gap: 14px;
  overflow: visible;
}
.status section + section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: 330px minmax(420px, 1fr); height: auto; }
  .workspace { height: auto; }
  .canvas-card { min-height: 620px; }
  .status { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 12px;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 4px;
  }
  .top-actions button { min-width: 104px; padding: 10px 12px; }
  .layout {
    display: block;
    height: auto;
    padding: 12px;
  }
  .panel, .canvas-card { border-radius: 18px; margin-bottom: 12px; }
  .panel { max-height: none; overflow: visible; }
  .canvas-card { min-height: 520px; }
  .workspace { display: block; }
  .status { display: block; }
  .canvas-toolbar { align-items: flex-start; flex-direction: column; }
  .canvas-wrap { padding: 14px; }
}

@media (max-width: 430px) {
  .grid.two { grid-template-columns: 1fr 1fr; gap: 8px; }
  input, select, textarea { padding: 9px 10px; }
  .readonly { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: 21px; }
}
.wrap { flex-wrap: wrap; }
.compact-hint { margin-top: 10px; }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* 强制覆盖浏览器默认文件上传样式，避免缓存或系统样式露出 */
.upload-card {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-height: 72px !important;
  padding: 14px !important;
  border: 1.5px dashed #93b4ff !important;
  border-radius: 18px !important;
  background: linear-gradient(180deg, #ffffff, #f4f7ff) !important;
  color: var(--text) !important;
  cursor: pointer !important;
  overflow: hidden !important;
}
.upload-card > input[type="file"] {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  cursor: pointer !important;
}
.upload-card .upload-icon,
.upload-card .upload-text {
  pointer-events: none !important;
}

.layer-list {
  display: grid;
  gap: 10px;
}
.layer-empty { margin: 0; }
.layer-item {
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #ffffff;
  padding: 10px;
  box-shadow: var(--soft-shadow);
}
.layer-item.selected {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10), var(--soft-shadow);
}
.layer-main {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 8px 10px;
  text-align: left;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
  box-shadow: none;
}
.layer-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
button.mini {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 10px;
  background: #eef4ff;
  color: #1d4ed8;
  box-shadow: none;
  font-size: 11px;
  font-weight: 800;
}
button.mini.danger {
  background: #fef2f2;
  color: var(--danger);
}
.project-actions { align-items: stretch; }
.project-actions button,
.import-json {
  flex: 1 1 0;
}
.import-json {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 14px;
  border-radius: 13px;
  background: #e8edf5;
  color: #111827;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.import-json input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.spot-color-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.spot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}
.pantone-swatch {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
}
@media (max-width: 430px) {
  .spot-grid { grid-template-columns: 1fr; }
  .pantone-swatch { margin-bottom: 0; }
}

.upload-option {
  margin: 6px 0 10px;
  padding: 8px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 12px;
}

.pantone-top-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 42px auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #f8fafc;
}
.pantone-swatch.small {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
}
.pantone-top-control button {
  margin-bottom: 10px;
}
@media (max-width: 800px) {
  .pantone-top-control { grid-template-columns: 1fr; }
  .pantone-swatch.small,
  .pantone-top-control button { margin-bottom: 0; }
}

/* 潘通色号入口：固定放在“袋子颜色”右侧格子，不占整行 */
.pantone-top-control {
  grid-column: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 42px !important;
  gap: 8px !important;
  align-items: end !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.pantone-top-control label { margin-bottom: 0; }
.pantone-swatch.small {
  width: 42px !important;
  height: 42px !important;
  margin-bottom: 0 !important;
  border-radius: 12px;
}
.pantone-top-control button {
  min-height: 36px;
  margin-bottom: 0 !important;
  padding: 8px 10px;
  font-size: 12px;
}
.pantone-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
@media (max-width: 430px) {
  .pantone-top-control { grid-template-columns: minmax(0, 1fr) 42px !important; }
}

.customer-info {
  min-height: 92px;
  height: 92px;
  font-size: 13px;
  line-height: 1.55;
}
.upload-card.drag-over,
.canvas-wrap.drag-over {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 4px;
  background-color: rgba(37, 99, 235, 0.06) !important;
}
.upload-card.drag-over {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.10), 0 12px 28px rgba(37, 99, 235, 0.18) !important;
}
.global-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  background: rgba(239, 246, 255, 0.88);
  backdrop-filter: blur(5px);
}
.global-drop-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(520px, 90vw);
  padding: 46px 28px;
  border: 3px dashed #2563eb;
  border-radius: 28px;
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 24px 70px rgba(37, 99, 235, 0.25);
}
.global-drop-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: #2563eb;
  color: #fff;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}
.global-drop-content strong { font-size: 24px; }
.global-drop-content small { color: #64748b; font-size: 14px; }
.unified-upload .upload-text b::after {
  content: " · 上传后可拖到正面/背面";
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* 上传区只保留一个入口：防止历史 upload-card 强制样式把隐藏项显示出来 */
.upload-card.hidden,
#backUploadWrap.hidden,
#front2UploadWrap.hidden {
  display: none !important;
}

.process-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 14px 16px;
  border: 2px solid rgba(37, 99, 235, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14);
}
.process-status.busy .status-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(37, 99, 235, 0.22);
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
.process-status.success { border-color: #86efac; background: #ecfdf5; color: #047857; }
.process-status.warning { border-color: #fcd34d; background: #fffbeb; color: #b45309; }
.process-status.error { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.process-status.success .status-spinner,
.process-status.warning .status-spinner,
.process-status.error .status-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  opacity: .22;
}
.upload-card.is-processing {
  pointer-events: none;
  opacity: .78;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12), var(--soft-shadow) !important;
}
@keyframes spin { to { transform: rotate(360deg); } }

.color-pick-button {
  padding: 0 !important;
  border: 2px solid #cbd5e1 !important;
  cursor: pointer;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5), 0 6px 16px rgba(15,23,42,.12) !important;
}
.color-pick-button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5), 0 10px 22px rgba(15,23,42,.18) !important;
}
.manual-spot-color {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.auto-bg-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.45;
}
.auto-bg-note b { font-size: 13px; }
.manual-bg-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
}
.manual-bg-box label { margin: 0; }
.manual-bg-box input[type="color"] { margin-top: 6px; width: 100%; }
.manual-bg-box button { margin-bottom: 0; }
.manual-bg-box p { grid-column: 1 / -1; margin: 0; }

.mask-choice {
  margin-top: 10px;
  padding: 12px;
  border: 2px solid #fbbf24;
  border-radius: 14px;
  background: #fffbeb;
}
.mask-choice-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  color: #92400e;
}
.mask-choice-heading strong { font-size: 13px; }
.mask-choice-heading span { font-size: 11px; }
.mask-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mask-candidate {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px !important;
  border: 1px solid #fde68a !important;
  background: #fff !important;
  color: #172033 !important;
  text-align: center;
}
.mask-candidate:hover { border-color: #f59e0b !important; transform: translateY(-1px); }
.mask-candidate small { color: #64748b; font-size: 10px; }
.mask-preview {
  display: grid;
  height: 88px;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%), #fff;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}
.mask-preview img { width: 100%; height: 100%; object-fit: contain; filter: brightness(0); }

/* 左侧业务流程：常用操作优先，专业参数按需展开 */
@media (min-width: 1181px) {
  .layout { grid-template-columns: 380px minmax(680px, 1fr); }
}

.simple-controls {
  padding: 12px;
  background: rgba(244, 247, 252, 0.96);
}
.controls-intro {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border-radius: 15px;
  background: linear-gradient(135deg, #172554, #2563eb);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.20);
}
.controls-intro strong { font-size: 14px; }
.controls-intro span { color: #dbeafe; font-size: 11px; line-height: 1.5; }

.simple-controls > section {
  margin: 0;
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.045);
}
.simple-controls > section + section {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid #dbe3ef;
}
.simple-controls h2 {
  margin-bottom: 14px;
  font-size: 16px;
}
.simple-controls h2[data-step]::before {
  content: attr(data-step);
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 9px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.simple-controls h2:not([data-step])::before {
  width: 5px;
  height: 18px;
}
.optional-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.simple-controls label {
  color: #52627a;
  font-size: 13px;
  font-weight: 650;
}
.simple-controls input,
.simple-controls select,
.simple-controls textarea {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 500;
}
.simple-controls .customer-info {
  min-height: 84px;
  height: 84px;
  font-family: inherit;
  font-size: 13px;
}
.field-help,
.section-subtitle,
.selected-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.section-subtitle { margin: -6px 0 12px; }
.selected-note { margin-top: 10px; }

.bag-color-row {
  display: block;
}
.bag-color-row label { margin-bottom: 0; }
.simple-controls .pantone-top-control {
  grid-template-columns: minmax(0, 1fr) 42px !important;
  gap: 7px !important;
}
.simple-controls .pantone-top-control input { font-size: 12px; }
.simple-controls .pantone-top-control button {
  min-width: 0;
  min-height: 38px;
  padding: 8px 7px;
}
.simple-controls .pantone-note { font-size: 10px; }

.ai-prepare-section {
  border-color: #bfdbfe !important;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%) !important;
}
.ai-quality-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
}
.ai-quality-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.ai-quality-card .section-subtitle { margin: 0; }
.ai-quality-card strong {
  overflow: hidden;
  color: #172554;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quality-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
}
.quality-badge.low { background: #fee2e2; color: #b91c1c; }
.quality-badge.medium { background: #fef3c7; color: #a16207; }
.quality-badge.high { background: #dcfce7; color: #047857; }
.quality-badge.ai { background: #dbeafe; color: #1d4ed8; }
.ai-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.ai-action {
  min-width: 0;
  min-height: 68px !important;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 11px !important;
  white-space: normal;
}
.ai-action b { font-size: 13px; }
.ai-action small {
  color: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  opacity: .78;
}
.ai-restore-button { margin-top: 8px; }
.ai-result-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .08);
}
.ai-result-preview,
.ai-preview-stage {
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}
.ai-result-preview {
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 1px solid #dbeafe;
  border-radius: 12px;
}
.ai-result-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.ai-result-body { min-width: 0; }
.ai-result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-result-heading strong { color: #172554; font-size: 13px; }
.ai-result-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #a16207;
  font-size: 10px;
  font-weight: 850;
}
.ai-result-status.ready { background: #dcfce7; color: #047857; }
.ai-result-status.warning { background: #fee2e2; color: #b91c1c; }
.ai-result-meta,
.ai-result-message {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.ai-result-message { color: #334155; }
.ai-result-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.ai-result-actions button {
  min-width: 0;
  min-height: 38px;
  padding: 8px;
  white-space: normal;
}
.ai-result-actions #aiApplyBtn { grid-column: 1 / -1; }
.ai-risk-note {
  margin: 9px 0 0;
  color: #92400e;
  font-size: 10px;
  line-height: 1.55;
}

.ai-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .78);
  backdrop-filter: blur(5px);
}
.ai-preview-dialog {
  width: min(1100px, 96vw);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .36);
}
.ai-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.ai-preview-header > div { display: grid; gap: 3px; }
.ai-preview-header strong { color: #0f172a; font-size: 16px; }
.ai-preview-header small { color: #64748b; font-size: 11px; }
.ai-preview-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: #334155;
  font-size: 24px;
  line-height: 1;
}
.ai-preview-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  overflow-x: auto;
  border-bottom: 1px solid #e2e8f0;
}
.ai-preview-tabs button {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
}
.ai-preview-tabs button.active { background: #2563eb; color: #fff; }
.ai-preview-stage {
  min-height: 300px;
  padding: 18px;
  display: grid;
  place-items: center;
  overflow: auto;
}
.ai-preview-stage img {
  max-width: 100%;
  max-height: calc(94vh - 150px);
  display: block;
  object-fit: contain;
}
@media (max-width: 640px) {
  .ai-preview-modal { padding: 8px; }
  .ai-preview-dialog { width: 100%; max-height: 98vh; border-radius: 14px; }
  .ai-preview-stage { min-height: 220px; padding: 8px; }
}
.color-section .pantone-top-control {
  padding: 12px !important;
  border: 1px solid #dbe3ef !important;
  border-radius: 14px !important;
  background: #f8fafc !important;
}

.advanced-options,
.tool-disclosure {
  margin-top: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
}
.advanced-options > summary,
.tool-disclosure > summary,
.layer-more > summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  user-select: none;
}
.advanced-options > summary::-webkit-details-marker,
.tool-disclosure > summary::-webkit-details-marker,
.layer-more > summary::-webkit-details-marker { display: none; }
.advanced-options > summary::after,
.tool-disclosure > summary::after,
.layer-more > summary::after {
  content: "⌄";
  margin-left: auto;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  transition: transform .15s ease;
}
.advanced-options[open] > summary::after,
.tool-disclosure[open] > summary::after,
.layer-more[open] > summary::after { transform: rotate(180deg); }
.advanced-options > summary small {
  margin-left: auto;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
}
.advanced-options > summary::after { margin-left: 0; }
.details-body {
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.details-body .readonly { margin-top: 2px; }

.simple-controls .upload-card {
  min-height: 88px !important;
  border-width: 2px !important;
  border-radius: 16px !important;
  background: #f7faff !important;
}
.simple-controls .upload-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 15px;
}
.simple-controls .upload-text b { font-size: 15px; }
.simple-controls .unified-upload .upload-text b::after { content: ""; }
.upload-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
}
.upload-setting-row .upload-option {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.upload-setting-row > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #047857;
  font-size: 10px;
  font-weight: 800;
}
.simple-controls .auto-bg-note {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 10px;
  padding: 9px 10px;
}
.simple-controls .auto-bg-note b { flex: 0 0 auto; font-size: 11px; }
.simple-controls .auto-bg-note span { color: #475569; font-size: 10px; }
.simple-controls button,
.simple-controls .import-json { min-height: 44px; }
.simple-controls .simple-hint {
  margin-bottom: 0;
  padding: 8px 10px;
  border: 0;
  background: #f8fafc;
  text-align: center;
}

.simple-controls .layer-list { gap: 8px; }
.simple-controls .layer-item {
  border-radius: 14px;
  padding: 8px;
  box-shadow: none;
}
.simple-controls .layer-main { min-height: 52px; }
.simple-controls .layer-actions { align-items: center; }
.simple-controls button.mini {
  min-height: 36px;
  flex: 1 1 64px;
}
.layer-more { flex: 1 0 100%; }
.layer-more > summary {
  min-height: 34px;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
}
.layer-more > summary::after { margin-left: 4px; font-size: 13px; }
.layer-more-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 6px;
}
.selected-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 10px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.selected-heading strong { font-size: 13px; }
.selected-heading .badge { margin: 0; }
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick-actions .primary-action { grid-column: 1 / -1; }
.quick-actions button { min-width: 0; white-space: normal; }
.tool-disclosure { margin-top: 10px; }
.tool-disclosure[open] > summary {
  border-bottom: 1px solid #e2e8f0;
  background: #eff6ff;
  color: #1d4ed8;
}
.tool-disclosure .manual-bg-box,
.tool-disclosure .spot-color-box {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.project-section .project-actions { display: grid; grid-template-columns: 1fr 1fr; }
.project-section .compact-hint { margin-bottom: 0; }

@media (max-width: 430px) {
  .bag-color-row { grid-template-columns: 1fr; }
  .ai-action-grid { grid-template-columns: 1fr; }
  .advanced-options > summary small { display: none; }
  .manual-bg-box { grid-template-columns: 1fr; }
  .manual-bg-box button,
  .manual-bg-box p { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .simple-controls *,
  .simple-controls *::before,
  .simple-controls *::after { transition: none !important; }
}
