* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #1f2937;
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* 头部 */
.header {
  text-align: center;
  margin-bottom: 32px;
}
.header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}
.header p {
  font-size: 14px;
  color: #6b7280;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 20px;
}

/* 输入页 */
.input-area {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.8;
}
.input-area:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.input-area::placeholder {
  color: #9ca3af;
}

.example-box {
  margin-top: 14px;
  padding: 12px 16px;
  background: #f0f7ff;
  border-left: 3px solid #2563eb;
  border-radius: 4px;
  font-size: 13px;
  color: #1e40af;
}
.example-box strong {
  display: block;
  margin-bottom: 4px;
}
.example-box span {
  cursor: pointer;
  text-decoration: underline;
  margin-right: 12px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}
.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1.5px solid #d1d5db;
}
.btn-secondary:hover {
  background: #f9fafb;
}
.btn-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 4px 10px;
  font-size: 13px;
}
.btn-danger:hover {
  background: #fef2f2;
}
.btn-success {
  background: #059669;
  color: #fff;
}
.btn-success:hover {
  background: #047857;
}
.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

/* 加载动画 */
.loading {
  display: none;
  text-align: center;
  padding: 40px 20px;
}
.loading.active {
  display: block;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading p {
  font-size: 14px;
  color: #6b7280;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  background: #f8fafc;
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
td {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tr:hover {
  background: #fafbfc;
}

/* 可编辑单元格 */
td.editable {
  cursor: text;
}
td.editable:hover {
  background: #eff6ff;
}
.cell-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.cell-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
select.cell-input {
  cursor: pointer;
}

/* 默认填充黄底标记 */
tr.default-filled td {
  background: #fef9c3;
}
tr.default-filled:hover td {
  background: #fef08a;
}

/* 置信度标签 */
.confidence {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.conf-high { background: #dcfce7; color: #166534; }
.conf-mid { background: #fef9c3; color: #854d0e; }
.conf-low { background: #fee2e2; color: #991b1b; }

/* 库存状态 */
.stock {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.stock-ok { background: #dcfce7; color: #166534; }
.stock-low { background: #fef9c3; color: #854d0e; }
.stock-out { background: #fee2e2; color: #991b1b; }

/* 汇总栏 */
.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 8px;
  margin-top: 16px;
}
.summary .total-count {
  font-size: 15px;
  color: #374151;
}
.summary .total-count strong {
  color: #2563eb;
  font-size: 18px;
}
.summary .total-amount {
  font-size: 15px;
  color: #374151;
}
.summary .total-amount strong {
  color: #dc2626;
  font-size: 22px;
  font-weight: 700;
}

/* 操作栏 */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.action-bar .left {
  display: flex;
  gap: 10px;
}

/* 原始输入展示 */
.original-input {
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 16px;
  border-left: 3px solid #2563eb;
}
.original-input strong {
  color: #1f2937;
  margin-right: 8px;
}

/* 成功页 */
.success-icon {
  text-align: center;
  margin-bottom: 24px;
}
.success-icon .circle {
  width: 72px;
  height: 72px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.success-icon .circle svg {
  width: 36px;
  height: 36px;
  color: #059669;
}
.success-icon h2 {
  font-size: 22px;
  color: #065f46;
  margin-bottom: 6px;
}
.success-icon p {
  font-size: 14px;
  color: #6b7280;
}

.order-info {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.order-info .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}
.order-info .row .label {
  color: #6b7280;
}
.order-info .row .value {
  color: #1f2937;
  font-weight: 500;
}

/* 提示消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show {
  display: block;
  animation: fadeInDown 0.3s;
}
.toast-success { background: #059669; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
.toast-info { background: #2563eb; color: #fff; }
@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ========== 左右屏布局 ========== */
.split-layout {
  display: flex;
  height: 100vh;
  gap: 0;
}
.split-left {
  width: 38%;
  min-width: 360px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.split-right {
  flex: 1;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.split-right .right-header {
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.split-right .right-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.split-right .right-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.split-left .app-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}
.split-left .app-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
}
.split-left .input-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.split-left .input-area {
  min-height: 200px;
  flex: 1;
}
.split-left .example-box {
  margin-top: 14px;
}
.split-left .btn-group {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}
.split-left .btn-group .btn {
  flex: 1;
}
.right-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  text-align: center;
}
.right-empty .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.right-empty p {
  font-size: 15px;
}
.right-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.right-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}
.right-success .check-circle {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.right-success .check-circle svg {
  width: 32px;
  height: 32px;
  color: #059669;
}
.right-success h2 {
  font-size: 20px;
  color: #065f46;
  margin-bottom: 8px;
}
.right-success p {
  color: #6b7280;
  margin-bottom: 20px;
}
.right-success .order-summary {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 16px 24px;
  margin-bottom: 20px;
  text-align: left;
  min-width: 280px;
}
.right-success .order-summary .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.right-summary-bar {
  padding: 12px 24px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.right-summary-bar .total {
  font-size: 14px;
  color: #374151;
}
.right-summary-bar .total strong {
  color: #dc2626;
  font-size: 20px;
}
.right-summary-bar .actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 900px) {
  .split-layout {
    flex-direction: column;
    height: auto;
  }
  .split-left {
    width: 100%;
    min-width: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }
  .split-right {
    min-height: 400px;
  }
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .header h1 { font-size: 20px; }
  .summary { flex-direction: column; gap: 10px; text-align: center; }
  .action-bar { flex-direction: column; gap: 12px; }
  .action-bar .left { width: 100%; }
  .action-bar .left .btn { flex: 1; }
}
