:root {
  --ink: #172019;
  --muted: #6c756e;
  --line: #dfe5e0;
  --soft: #f3f6f3;
  --green: #167346;
  --green-soft: #e8f5ed;
  --amber: #9b6508;
  --red: #ad2d2d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f7f9f7;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.topbar {
  height: 58px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.icon-button {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.workspace { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }
.page-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 700; }
h1 { margin: 5px 0 0; font-size: 28px; line-height: 1.2; }
h2 { margin: 0; font-size: 15px; }
.status-summary { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.status-summary.completed .status-dot { background: var(--green); }
.status-summary.failed .status-dot { background: var(--red); }
.lookup { max-width: 560px; padding: 20px 0; }
.lookup label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.lookup-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.lookup input {
  min-width: 0; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.primary-button, .download-button {
  min-height: 42px; padding: 0 18px; border: 0; border-radius: 6px;
  background: var(--green); color: #fff; font-weight: 700;
}
.download-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.error-banner {
  padding: 12px 14px; margin-bottom: 16px; border: 1px solid #efcaca;
  border-radius: 6px; background: #fff2f2; color: var(--red); font-size: 13px;
}
.order-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; }
.order-tab {
  flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--muted);
}
.order-tab.active { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.status-band {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 1px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line);
}
.status-band > div { min-height: 76px; padding: 14px 16px; background: #fff; }
.status-band span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.status-band strong { font-size: 14px; }
.status-band .download-button { margin: 16px; min-width: 140px; }
.progress-track { height: 5px; margin: 12px 0 22px; overflow: hidden; border-radius: 3px; background: #e6ebe7; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.progress-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; }
.preview-pane, .history-pane {
  min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.section-head {
  height: 48px; padding: 0 16px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line);
}
.section-head span { color: var(--muted); font-size: 11px; }
.preview {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1160 / 896;
  overflow: hidden; background: var(--soft); color: var(--muted); font-size: 13px;
}
.preview img { display: none; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.preview.ready img { display: block; }
.preview.ready > span { display: none; }
.history { max-height: 620px; overflow-y: auto; padding: 8px; }
.history-item {
  width: 100%; padding: 10px; margin-bottom: 6px; text-align: left;
  border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink);
}
.history-item:hover, .history-item.active { border-color: var(--line); background: var(--soft); }
.history-item strong { display: block; font-size: 12px; }
.history-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-empty { padding: 20px 10px; color: var(--muted); font-size: 12px; }
.loading-state { min-height: 240px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.toast {
  position: fixed; right: 20px; bottom: 20px; display: none; max-width: 360px;
  padding: 12px 14px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 13px;
}
.toast.show { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 820px) {
  .workspace { width: min(100% - 24px, 680px); padding-top: 20px; }
  .status-band { grid-template-columns: 1fr 1fr; }
  .status-band .download-button { grid-column: 1 / -1; margin: 12px; }
  .progress-layout { grid-template-columns: 1fr; }
  .history { max-height: 230px; }
}
@media (max-width: 480px) {
  .page-head { align-items: start; gap: 14px; }
  h1 { font-size: 24px; }
  .status-band { grid-template-columns: 1fr; }
  .status-band .download-button { grid-column: auto; }
  .lookup-row { grid-template-columns: 1fr; }
}
