:root {
  --bg: #f0f4ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #059669;
  --success-bg: #ecfdf5;
  --border: #e2e8f0;
  --tip-bg: #fffbeb;
  --tip-border: #fcd34d;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}
body {
  padding-bottom: calc(128px + var(--safe-bottom));
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 14px 24px;
}

.banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.banner-status {
  display: block;
  margin-top: 6px;
}
.banner-status[hidden] { display: none; }

.header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8 55%, #0ea5e9);
  color: #fff;
  border-radius: 18px;
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header p {
  margin: 0;
  opacity: 0.92;
  font-size: 13px;
  line-height: 1.55;
}

.meta-card, .list-card, .footer-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.meta-card label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.meta-card .field {
  margin-bottom: 10px;
}
.meta-card .field:last-child { margin-bottom: 0; }
.meta-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  background: #f8fafc;
}
.meta-card input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.progress-label {
  font-size: 14px;
  font-weight: 600;
}
.progress-label span { color: var(--primary); }
.progress-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}
.item:last-child { margin-bottom: 0; }
.item.done {
  border-color: #a7f3d0;
  background: var(--success-bg);
}

.item-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  flex: 0 0 auto;
  margin-top: 1px;
  display: grid;
  place-items: center;
  background: #fff;
  color: transparent;
  font-size: 14px;
  font-weight: 700;
}
.item.done .check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.item-main { flex: 1; min-width: 0; }
.item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 8px;
}
.item-title > span:first-child { min-width: 0; }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.45;
  white-space: nowrap;
}
.badge-ocr {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-skip {
  background: #f1f5f9;
  color: #475569;
}
.badge-ok {
  background: #d1fae5;
  color: #047857;
}
.badge-waive {
  background: #ffedd5;
  color: #9a3412;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-tip {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid var(--tip-border);
}
.btn-upload {
  background: var(--primary);
  color: #fff;
}
.btn-upload:active { background: var(--primary-dark); }
.btn-ghost {
  background: #f1f5f9;
  color: #334155;
}
.btn-skip,
.btn-skip-reason {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}
.btn-skip-reason {
  min-height: 40px;
}
.skip-panel {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.skip-panel p {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #9a3412;
}
.skip-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.btn-primary-lg {
  width: 100%;
  justify-content: center;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
}
.btn-primary-lg:disabled {
  background: #94a3b8;
  opacity: 1;
}

.file-input { display: none; }

.preview {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.preview .fname {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  flex: 1;
  min-width: 120px;
}

.status-line,
.verify-line,
.error-line {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #92400e;
}
.verify-line { color: #047857; }
.verify-line.manual { color: var(--muted); }
.error-line { color: var(--danger); }

.pending-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d97706;
  flex: 0 0 auto;
  animation: pulse 1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .pending-dot { animation: none; }
}
@keyframes pulse {
  50% { opacity: 0.35; }
}

.tip-panel {
  display: none;
  margin-top: 10px;
  background: var(--tip-bg);
  border: 1px solid var(--tip-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #78350f;
}
.tip-panel.open { display: block; }
.tip-panel a { color: #b45309; word-break: break-all; }
.tip-panel strong { color: #92400e; }

.sticky-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.sticky-inner {
  max-width: 560px;
  margin: 0 auto;
}
.sticky-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(124px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 40;
  max-width: min(92vw, 420px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.help-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 0;
}
