:root {
  color-scheme: light;
  --page: #f6f7f4;
  --surface: #ffffff;
  --surface-muted: #eef2ed;
  --text: #20251f;
  --muted: #6a7268;
  --line: #d8dfd5;
  --accent: #2f6f4f;
  --accent-strong: #24563e;
  --amber: #9b6a1f;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(39, 51, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

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

.workbench {
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

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: var(--amber);
  background: #fff8e7;
}

.pill.is-done {
  border-color: #a7cfb8;
  color: var(--accent-strong);
  background: #edf7f0;
}

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

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.drop-zone {
  min-height: 214px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1.5px dashed #a8b5a5;
  border-radius: 8px;
  background: #fbfcfa;
  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: #f0f6f1;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 79, 0.12);
}

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

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

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

.entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

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

.field input {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 79, 0.12);
}

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

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  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: #dce6dc;
  background: #8ea594;
  cursor: not-allowed;
}

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

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

.plain-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.plain-link:hover {
  text-decoration: underline;
}

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

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

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

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

.metric {
  min-height: 82px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  line-height: 1.1;
}

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

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

.preview-header span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

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

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

.preview-table th {
  background: #eef2f5;
  color: #3f4d57;
  font-weight: 600;
  white-space: nowrap;
}

.preview-table td:nth-child(n + 4) {
  font-variant-numeric: tabular-nums;
}

.preview-table img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.drop-zone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

  .workbench {
    padding: 18px;
  }

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

  .upload-grid,
  .entry-form,
  .metrics {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
