:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ecfdf5;
  --bad: #b42318;
  --bad-soft: #fef2f2;
  --warn-soft: #fff7ed;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #d1fae5 0%, transparent 50%),
    var(--bg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 760px; margin: 0 auto; padding: 28px 20px 80px; }
.wrap.wide { max-width: 1120px; }
.topbar, .card, .table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.brand { font-weight: 750; font-size: 18px; }
.brand span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 2px; }
.nav-link {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.nav-link:hover { text-decoration: none; background: #d1fae5; }
h1, h2, h3 { margin: 0; }
.lede { color: var(--muted); margin: 0 0 16px; }
.card { padding: 20px; margin-bottom: 16px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.step h2 { font-size: 16px; margin-bottom: 4px; }
.field { margin-top: 12px; }
.field label, .field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #374151;
}
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: white;
}
input:focus, textarea:focus, select:focus {
  outline: 3px solid #99f6e4;
  border-color: var(--accent);
}
textarea { min-height: 88px; resize: vertical; }
/* 顶部那条「用 Excel 填」的窄条：一行放下，别占太多地方 */
.card.compact { padding: 12px 16px; }
.compact-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.compact-text { min-width: 0; }
.compact-text b { display: block; font-size: 14px; }
.compact-text .hint { font-size: 12px; }
.compact-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.compact-row button, .compact-row .file { padding: 8px 12px; font-size: 13px; }
.card.compact #importHint { margin: 6px 0 0; font-size: 12px; }
.card.compact #importHint:empty { display: none; }

.hint { color: var(--muted); font-size: 13px; }
/* 导入报错是多行「第几行错了」，要保留换行 */
#importHint { white-space: pre-line; }
.parse-card {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px dashed var(--line);
}
.parse-card.show { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.parse-card.ok { background: var(--accent-soft); border-style: solid; border-color: #a7f3d0; }
.parse-card.bad { display: block; background: var(--bad-soft); border-color: #fecaca; color: var(--bad); }
.parse-item { min-width: 0; }
.parse-item b { display: block; font-size: 12px; color: var(--muted); font-weight: 650; }
.parse-item span { display: block; word-break: break-all; }
.parse-item.wide { grid-column: 1 / -1; }
.line-head, .line {
  display: grid;
  grid-template-columns: 1fr 108px 72px;
  gap: 8px;
  align-items: center;
}
/* 数量那一格比别的高（输入框下面还有「件/套」提示），
   居中对齐会把下拉和按钮顶歪，这里统一改成顶部对齐。 */
.line { align-items: start; }
.line-head { color: var(--muted); font-size: 12px; font-weight: 650; margin: 8px 0 4px; }
.line { margin-bottom: 8px; }
.line-note { grid-column: 1 / -1; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; }
.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  padding: 0;
  margin: 4px 0 0;
  cursor: pointer;
}
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
button, .file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button.secondary { background: #111827; }
button.secondary:hover { background: #374151; }
button.ghost, .file {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover, .file:hover { background: #f9fafb; }
button.danger { background: white; color: var(--bad); border: 1px solid #fecaca; }
.file { margin: 0; }
.success {
  display: none;
  text-align: center;
  padding: 28px 16px;
}
.success.show { display: block; }
.success h2 { margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px; }
.kpi b { display: block; font-size: 28px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 16px;
  background: #eef2f6;
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}
.tabs button {
  margin: 0;
  background: transparent;
  color: #4b5563;
  box-shadow: none;
}
.tabs button.active { background: white; color: var(--ink); box-shadow: var(--shadow); }
.panel { display: none; }
.panel.active { display: block; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 700; background: #fafafa; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.tag.pending { background: var(--warn-soft); color: #c2410c; }
.tag.exported { background: var(--accent-soft); color: #047857; }
.tag.skipped { background: var(--bad-soft); color: var(--bad); }
.fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fields .full { grid-column: 1 / -1; }
.form-title { font-size: 15px; margin-bottom: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  display: none;
  z-index: 20;
}
.toast.show { display: block; }
.toast.bad { background: #7f1d1d; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint b { color: var(--ink); }
.step-body { flex: 1; min-width: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.login-wrap { min-height: 100dvh; display: grid; align-items: center; }
.login-card { max-width: 420px; margin: 0 auto; }
.login-card .brand { margin-bottom: 16px; }
.login-card .actions button { width: 100%; min-height: 44px; }
@media (max-width: 820px) {
  .wrap, .wrap.wide { padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }
  .topbar { flex-direction: column; align-items: stretch; }
  .top-actions { justify-content: flex-start; }
  .kpis, .fields, .parse-card.show, .split { grid-template-columns: 1fr; }
  .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs button { flex: none; }
  .line-head { display: none; }
  .line { grid-template-columns: 1fr 88px; }
  .line .remove { grid-column: 2; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button, .actions .file, .file { width: 100%; min-height: 44px; }
  input, textarea, select { font-size: 16px; }
}
