:root {
  --bg: #f6f1e7;
  --paper: #fffdf8;
  --ink: #1f2a37;
  --accent: #bf5b2c;
  --accent-soft: #f2c27d;
  --ok: #2f6f4f;
  --warn: #915100;
  --danger: #8b2e2e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: linear-gradient(145deg, #f6f1e7 0%, #fef9ee 45%, #f2e3c8 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.25;
  pointer-events: none;
}

.bg-shape-a {
  width: 280px;
  height: 280px;
  top: -70px;
  left: -40px;
  background: #dd7e42;
}

.bg-shape-b {
  width: 340px;
  height: 340px;
  right: -80px;
  bottom: -120px;
  background: #d9aa68;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 48px;
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 4px 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  color: #844221;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.subtitle {
  margin: 0;
  color: #504537;
}

.panel {
  background: color-mix(in srgb, var(--paper) 88%, white);
  border: 1px solid #eadbc0;
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 8px 24px rgba(124, 83, 39, 0.08);
}

.panel h2 { margin: 0 0 12px; }

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

input[type="file"], select, button {
  font: inherit;
}

input[type="file"], select {
  border: 1px solid #d8c8ac;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: linear-gradient(120deg, var(--accent) 0%, #db8a4d 100%);
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

button:hover { transform: translateY(-1px); filter: brightness(1.04); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.download {
  color: var(--ok);
  font-weight: 700;
  text-decoration: none;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mapping-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.93rem;
}

.meta { color: #5f5a4f; margin: 8px 0 0; }

.error-text {
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #eadbc0;
}

#preview-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

#preview-table th,
#preview-table td {
  border-bottom: 1px solid #f0e5d1;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
  font-size: 0.88rem;
  line-height: 1.28;
  vertical-align: top;
  min-width: 72px;
}

#preview-table tbody tr {
  height: 32px;
}

#preview-table th.col-goods-name,
#preview-table td.col-goods-name,
#preview-table th.col-goods-translation,
#preview-table td.col-goods-translation {
  min-width: 180px;
  width: 220px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#preview-table td .cell-link {
  color: #2f52c9;
  text-decoration: underline;
}

#preview-table th {
  background: #faf1e3;
  position: sticky;
  top: 0;
}

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-warning {
  color: var(--danger);
  font-weight: 700;
}

body.embed-mode {
  --bg: #f3f5fa;
  --paper: #ffffff;
  --ink: #101828;
  --accent: #4f5bd5;
  --accent-soft: #eef2ff;
  --ok: #027a48;
  --warn: #b54708;
  --danger: #b42318;
  background: var(--bg);
  min-height: auto;
}

body.embed-mode .bg-shape {
  display: none;
}

body.embed-mode .page {
  max-width: 100%;
  margin: 0;
  padding: 12px;
}

body.embed-mode .hero {
  margin-bottom: 6px;
}

body.embed-mode .hero h1 {
  color: #1d2b48;
  font-size: clamp(1.24rem, 2.1vw, 1.78rem);
  margin-bottom: 4px;
}

body.embed-mode .eyebrow {
  color: #3d50df;
  letter-spacing: 0.06em;
}

body.embed-mode .subtitle {
  color: #667085;
  font-size: 0.92rem;
}

body.embed-mode .panel {
  background: var(--paper);
  border: 1px solid #dbe2f1;
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.05);
}

body.embed-mode .meta {
  color: #667085;
}

body.embed-mode input[type="file"],
body.embed-mode select {
  border-color: #d0d5dd;
  background: #fff;
}

body.embed-mode button {
  background: linear-gradient(135deg, #4f5bd5 0%, #3d50df 100%);
}

body.embed-mode .download {
  color: #3d50df;
}

body.embed-mode .table-wrap {
  border-color: #dbe2f1;
  background: #fff;
}

body.embed-mode .table-wrap {
  max-height: 52vh;
}

body.embed-mode #preview-table th {
  background: #eef2ff;
}

body.embed-mode #preview-table th,
body.embed-mode #preview-table td {
  border-bottom-color: #e4e7ec;
}

body.embed-mode #preview-table th,
body.embed-mode #preview-table td {
  padding: 5px 7px;
  font-size: 0.8rem;
  line-height: 1.22;
}

body.embed-mode #preview-table tbody tr {
  height: 30px;
}

@media (max-width: 680px) {
  .page { padding: 18px 12px 30px; }
  .panel { padding: 12px; }
}
