:root {
  --bg: #f4f1eb;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #18212b;
  --muted: #637081;
  --line: #d4d8de;
  --soft-line: #e6e8ec;
  --primary: #0f766e;
  --primary-dark: #0b5b55;
  --accent: #c67c2f;
  --warning: #9a3c08;
  --danger-bg: #fff3e7;
  --shadow: 0 18px 50px rgba(24, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(198, 124, 47, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f4ee 0%, #f1efe8 100%);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.status-pill {
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--primary);
  white-space: nowrap;
}

.upload-panel,
.workspace {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.upload-panel {
  padding: 18px;
}

.upload-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: stretch;
}

.file-drop {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80px;
  border: 1px dashed rgba(15, 118, 110, 0.4);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 248, 0.9));
}

.file-title {
  font-weight: 700;
}

.file-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  word-break: break-word;
}

.file-drop input {
  display: none;
}

.primary,
.secondary {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  min-height: 42px;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  background: var(--primary);
  color: #fff;
}

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

.secondary {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--line);
  color: var(--text);
}

.secondary:hover {
  border-color: #9aa7b8;
}

.primary:disabled,
.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.progress {
  width: 100%;
  height: 6px;
  background: #eceff2;
  border-radius: 99px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.25s ease;
}

.message {
  margin-top: 10px;
  color: var(--muted);
  min-height: 20px;
  word-break: break-word;
}

.settings-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.settings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

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

.settings-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.9);
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  margin-top: 16px;
  min-height: 680px;
  overflow: hidden;
}

.image-list {
  border-right: 1px solid var(--soft-line);
  background: rgba(255, 255, 255, 0.45);
  min-width: 0;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.image-card {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
}

.image-card.active {
  background: rgba(15, 118, 110, 0.08);
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

.image-card strong {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.image-card .badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1f3;
  color: var(--muted);
}

.image-card.done .badge {
  background: #e3f5ef;
  color: #0d6a54;
}

.image-card.warn .badge {
  background: var(--danger-bg);
  color: var(--warning);
}

.review {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.toolbar span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.preview-pane {
  background: rgba(238, 241, 245, 0.72);
  border-right: 1px solid var(--soft-line);
  overflow: auto;
  padding: 12px;
}

.preview-pane img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
}

.table-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  overflow: auto;
  flex: 1;
}

.result-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th,
.result-table td {
  border: 1px solid var(--line);
  min-width: 96px;
  max-width: 280px;
  padding: 6px 8px;
  vertical-align: top;
  background: #fff;
  overflow-wrap: anywhere;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4f4;
  font-weight: 700;
}

.result-table td[contenteditable="true"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.result-table .cell-warn {
  background: var(--danger-bg);
}

.warnings {
  border-top: 1px solid var(--soft-line);
  padding: 10px 12px;
  color: var(--muted);
  max-height: 140px;
  overflow: auto;
  font-size: 13px;
}

.warnings strong {
  color: var(--warning);
}

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

  .topbar,
  .toolbar,
  .upload-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

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

  .image-list {
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
    max-height: 240px;
    overflow: auto;
  }

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

  .preview-pane {
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
    max-height: 48vh;
  }

  .actions button,
  .upload-form button {
    width: 100%;
  }
}
