:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1e2329;
  --muted: #687385;
  --line: #dde3ec;
  --orange: #ff6a00;
  --orange-dark: #d95500;
  --green: #0c8f64;
  --blue: #2563eb;
  --red: #c2410c;
  --table-head: #eef3f8;
  --shadow: 0 16px 36px rgba(20, 35, 60, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 100vh;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px;
}

.top-panel,
.result-area {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  padding: 14px 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--orange);
  color: white;
  font-size: 20px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.brand-row p,
.result-toolbar p,
.status-panel {
  color: var(--muted);
}

.brand-row p,
.result-toolbar p {
  margin-top: 3px;
  font-size: 13px;
}

.control-form {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-field {
  flex: 0 1 620px;
  max-width: 620px;
}

.quantity-field {
  flex: 0 0 120px;
}

.field span {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  outline: none;
  background: #fbfcfe;
}

.field input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.13);
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-button,
.primary-button,
.secondary-button,
.copy-button {
  border-radius: 6px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.upload-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: white;
  color: #243044;
  font-weight: 700;
  white-space: nowrap;
}

.file-name {
  align-self: flex-end;
  display: flex;
  align-items: center;
  height: 36px;
  min-width: 130px;
  max-width: 210px;
  overflow: hidden;
  color: #475569;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button {
  flex: 0 0 148px;
  margin-left: auto;
  height: 36px;
  border: 0;
  background: var(--orange);
  color: white;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--orange-dark);
}

.secondary-button,
.copy-button {
  border: 1px solid var(--line);
  background: white;
  color: #243044;
  font-weight: 700;
}

.secondary-button {
  height: 34px;
  padding: 0 12px;
}

.upload-button:hover,
.secondary-button:hover,
.copy-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.primary-button:active,
.secondary-button:active,
.copy-button:active,
.upload-button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 2px;
  padding: 8px 12px;
  border: 1px solid #eef2f7;
  border-radius: 6px;
  background: #fbfcfe;
  font-size: 14px;
}

.status-panel strong {
  color: #1f2937;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.running {
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 106, 0, 0.13);
}

.status-dot.done {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

.result-area {
  min-width: 0;
  overflow: hidden;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.result-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.elapsed-text {
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 164px);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.28;
}

th {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.col-index,
.col-count {
  width: 72px;
}

.col-copy {
  width: 38px;
}

.title-cell {
  min-width: 420px;
  color: #1f2937;
  font-weight: 400;
}

.copy-cell {
  width: 38px;
  padding-left: 0;
  padding-right: 4px;
  white-space: nowrap;
}

.translation-cell {
  min-width: 260px;
  color: #2f3d52;
}

.copy-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 5px;
}

.copy-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.copy-button.copied {
  border-color: rgba(12, 143, 100, 0.35);
  color: var(--green);
  background: rgba(12, 143, 100, 0.08);
}

.empty-row td {
  height: 210px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .top-panel {
    grid-template-columns: 1fr;
  }

  .control-form {
    flex-wrap: wrap;
  }

  .product-field {
    flex-basis: 100%;
  }

  .quantity-field {
    flex-basis: 88px;
  }

  .upload-button,
  .file-name,
  .primary-button {
    flex: 0 0 auto;
  }

  .table-wrap {
    max-height: none;
  }
}
