:root {
  color-scheme: light;
  --page: #f5f7f8;
  --surface: #ffffff;
  --muted-surface: #f8fafb;
  --text: #1f2933;
  --muted: #64707d;
  --line: #d8e0e6;
  --accent: #276f86;
  --accent-strong: #1d5264;
  --danger: #b42318;
  --ok-bg: #edf8f4;
  --shadow: 0 18px 42px rgba(25, 42, 54, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.workbench,
.preview-panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workbench {
  padding: 24px;
}

.title-row,
.action-row,
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.pill {
  min-width: 64px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pill.is-busy {
  border-color: #d9bd7a;
  color: #8a5b17;
  background: #fff8e7;
}

.pill.is-done {
  border-color: #a7cfb8;
  color: #236146;
  background: var(--ok-bg);
}

.pill.is-error {
  border-color: #f2b8b5;
  color: var(--danger);
  background: #fff0ef;
}

.status-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--muted-surface);
  line-height: 1.5;
}

.status-box.is-error {
  color: var(--danger);
  border-color: #f2b8b5;
  background: #fff0ef;
}

.drop-zone {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  margin-top: 22px;
  border: 1.5px dashed #9dadb8;
  border-radius: 8px;
  background: #fbfcfd;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eff7f9;
  box-shadow: inset 0 0 0 1px rgba(39, 111, 134, 0.12);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.drop-title {
  max-width: calc(100% - 32px);
  overflow-wrap: anywhere;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.drop-meta {
  color: var(--muted);
  font-size: 14px;
}

.mapping-panel {
  margin-top: 18px;
}

.mapping-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.mapping-header span {
  color: var(--muted);
  font-size: 13px;
}

.mapping-scroll {
  max-width: 760px;
}

.mapping-table {
  min-width: 620px;
}

.mapping-table input,
.mapping-table select {
  width: 100%;
  min-height: 42px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fbfcfd;
  color: var(--text);
}

.mapping-table input:focus,
.mapping-table select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 111, 134, 0.12);
}

.action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.primary-button:disabled {
  color: #dbe8ec;
  background: #8da9b3;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--accent-strong);
  border-color: #b8d6de;
  background: #edf7f9;
}

.secondary-button.is-disabled {
  color: #8a959d;
  border-color: var(--line);
  background: #f2f5f6;
  pointer-events: none;
}

.result-area {
  margin-top: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 86px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  min-width: 0;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.2;
}

.preview-panel {
  margin-top: 18px;
  padding: 16px;
}

.preview-header {
  align-items: baseline;
  margin-bottom: 12px;
}

.preview-header span {
  color: var(--muted);
  font-size: 13px;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th,
td {
  max-width: 220px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

th {
  color: #3f4d57;
  background: #eef3f5;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 16px;
  }

  .workbench {
    padding: 18px;
  }

  .title-row,
  .action-row,
  .preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .mapping-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 24px;
  }
}
