/* 上新工具台 · 白色主题基础样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16.5px;
  line-height: 1.6;
  background: #f5f6f8;
  color: #1a1a1a;
}

/* ── 布局 ── */
.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.sub {
  color: #777;
  font-size: 15px;
  margin-bottom: 28px;
}

/* ── 工具卡片网格 ── */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.tool {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px 20px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: #c7d2fe;
}

.tool.add {
  border-style: dashed;
  color: #aaa;
  cursor: default;
}

.tool .ic {
  font-size: 28px;
  line-height: 1;
}

.tool .nm {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.tool.add .nm {
  color: #aaa;
}

.tool .ds {
  font-size: 13px;
  color: #888;
}

/* ── 步骤标题（大号有色） ── */
.step-title {
  font-size: 20px;
  font-weight: 700;
  color: #4f46e5;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e7ff;
}

.step-num {
  display: inline-block;
  background: #4f46e5;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  margin-right: 8px;
}

/* ── 卡片 ── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

/* ── 字段 ── */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12.5px;
  color: #9ca3af;
  margin-bottom: 6px;
  line-height: 1.5;
}

.field input[type="text"],
.field input[type="password"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.field textarea {
  min-height: 90px;
}

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: #4f46e5;
  color: #fff;
}

.btn-primary:hover { background: #4338ca; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover { background: #e5e7eb; }

/* ── 提示框 ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14.5px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
}

.alert-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.alert-warn {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

/* ── 状态徽章 ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-none    { background: #f3f4f6; color: #6b7280; }
.badge-gen     { background: #eff6ff; color: #2563eb; }
.badge-name    { background: #fef3c7; color: #d97706; }
.badge-fix     { background: #fce7f3; color: #be185d; }
.badge-final   { background: #f5f3ff; color: #7c3aed; }
.badge-done    { background: #dcfce7; color: #16a34a; }
.badge-failed  { background: #fee2e2; color: #dc2626; }

/* ── 表格（产品列表） ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr:hover { background: #f9fafb; }

tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* ── 筛选 chip ── */
.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.chip.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

/* ── 加载 spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 占位灰显区块 ── */
.disabled-section {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.4);
}

.disabled-section .step-title {
  color: #9ca3af;
  border-color: #e5e7eb;
}

/* ── 产品信息表 ── */
.info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 15px;
}

.info-grid dt {
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

.info-grid dd {
  color: #1a1a1a;
}

/* ── 输出区 ── */
.output-field {
  margin-bottom: 16px;
}

.output-field .of-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.output-field .of-val {
  font-size: 15px;
  color: #1a1a1a;
  white-space: pre-wrap;
  background: #f9fafb;
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid #f3f4f6;
  min-height: 36px;
}

/* ── 登录页 ── */
.login-wrap {
  max-width: 360px;
  margin: 80px auto 0;
}

.login-wrap h1 {
  text-align: center;
  margin-bottom: 32px;
}

/* ── 导航返回 ── */
.nav-back {
  font-size: 14px;
  color: #6366f1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.nav-back:hover { text-decoration: underline; }

/* ── toast 浮层（页面中间，醒目）── */
#toast-host {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 12px; width: min(460px, 90vw); align-items: stretch;
  pointer-events: none;
}
.toast {
  padding: 16px 22px; border-radius: 10px; font-size: 16px; font-weight: 600; line-height: 1.5;
  text-align: center; border-left: 5px solid; box-shadow: 0 8px 28px rgba(0,0,0,0.20); background: #fff;
  animation: toast-in 0.18s ease-out; pointer-events: auto;
}
.toast-success { background:#f0fdf4; border-color:#22c55e; color:#15803d; }
.toast-error   { background:#fef2f2; border-color:#ef4444; color:#b91c1c; }
.toast-info    { background:#eff6ff; border-color:#3b82f6; color:#1d4ed8; }
@keyframes toast-in { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform:none; } }

/* ── 采购链接区（Task 5）── */
.src-tip { font-size:14px; font-weight:600; color:#b45309; margin-bottom:8px; }
.src-links { display:flex; flex-wrap:wrap; gap:8px 14px; }
.src-link {
  display:inline-flex; align-items:center; gap:4px; font-size:14px; font-weight:600;
  color:#4f46e5; text-decoration:none; padding:6px 12px; border:1px solid #c7d2fe;
  border-radius:8px; background:#eef2ff;
}
.src-link:hover { background:#e0e7ff; }
.src-link.plan { color:#0369a1; border-color:#bae6fd; background:#f0f9ff; }

/* ── 步骤1：左输入 / 右指导 两栏 ── */
.field-2col { display:grid; grid-template-columns: 1fr 1fr; gap:8px 20px; align-items:start; margin-bottom:22px; }
.field-2col .f-input { display:flex; flex-direction:column; }
.field-2col label { display:block; font-size:14.5px; font-weight:700; color:#1f2937; margin-bottom:6px; }
.field-2col textarea, .field-2col input[type="text"] {
  width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:15px; font-family:inherit; resize:vertical;
}
.field-guide {
  background:#fffaf0; border:1px solid #fde68a; border-radius:8px; padding:12px 14px;
  font-size:13.5px; line-height:1.7; color:#3f3f46;   /* 深色非灰，醒目 */
}
.field-guide b { color:#b45309; }
.field-guide .eg { display:block; margin-top:8px; padding-top:8px; border-top:1px dashed #fcd34d; color:#52525b; }
@media (max-width: 720px) { .field-2col { grid-template-columns: 1fr; } }

/* ── 产品名备选 mini chips（Task 7）── */
#naming-chips { max-height:140px; overflow-y:auto; gap:6px; }
.cand-chip-mini {
  font-size:12.5px; padding:3px 9px; border:1px solid #e5e7eb; border-radius:6px;
  background:#f9fafb; color:#374151; cursor:pointer; line-height:1.4;
}
.cand-chip-mini:hover { background:#eef2ff; border-color:#c7d2fe; }

/* ── 产品名备选 紧凑只读堆叠（反馈#2）── */
.cand-readonly { display:flex; flex-wrap:wrap; gap:6px; }
.cand-readonly .pill {
  font-size:13px; padding:3px 10px; border:1px solid #e5e7eb; border-radius:999px;
  background:#f8fafc; color:#334155; line-height:1.5;
}

/* ── 任务进度总览（反馈#5，顶部突出）── */
.progress-card {
  background:#fef2f2; border:1px solid #fecaca; border-radius:12px; padding:16px 20px; margin-bottom:20px;
  box-shadow:0 1px 6px rgba(220,38,38,0.08);
}
.progress-now { font-size:15px; font-weight:700; color:#4f46e5; margin-bottom:12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.progress-now .now-tag { background:#eef2ff; color:#4f46e5; border-radius:999px; padding:2px 12px; font-size:13px; }
.progress-now.is-done .now-tag { background:#dcfce7; color:#16a34a; }
.progress-now.is-rejected { color:#dc2626; }
.progress-now.is-rejected .now-tag { background:#fee2e2; color:#dc2626; }
.progress-steps { display:flex; flex-wrap:wrap; gap:8px; }
.progress-steps .pstep {
  display:flex; align-items:center; gap:6px; font-size:13px; padding:6px 12px; border-radius:8px;
  border:1px solid #e5e7eb; background:#f9fafb; color:#9ca3af; flex:1 1 150px; min-width:130px;
}
.progress-steps .pstep .pico { font-size:14px; }
.progress-steps .pstep.s-done    { background:#f0fdf4; border-color:#bbf7d0; color:#16a34a; }
.progress-steps .pstep.s-active  { background:#eef2ff; border-color:#c7d2fe; color:#4f46e5; font-weight:700; box-shadow:0 0 0 2px rgba(99,102,241,0.18); }
.progress-steps .pstep.s-locked  { background:#f9fafb; border-color:#e5e7eb; color:#b9bdc7; }
.progress-steps .pstep.s-rejected{ background:#fef2f2; border-color:#fecaca; color:#dc2626; font-weight:700; }

/* ── 步骤标题状态徽章（反馈#5）── */
.step-badge { font-size:13px; font-weight:600; margin-left:10px; padding:2px 10px; border-radius:999px; vertical-align:middle; }
.step-badge.b-done    { background:#dcfce7; color:#16a34a; }
.step-badge.b-active  { background:#eef2ff; color:#4f46e5; }
.step-badge.b-locked  { background:#f3f4f6; color:#9ca3af; }
.step-badge.b-rejected{ background:#fee2e2; color:#dc2626; }

/* ── 命名查重提示（反馈#6）── */
.naming-hint { font-size:13.5px; color:#b45309; background:#fffbeb; border:1px solid #fde68a; border-radius:8px; padding:8px 12px; margin-bottom:12px; }
.naming-hint b { color:#16a34a; }
