:root {
  --bg: #eef2ef;
  --panel: #fffdf8;
  --panel-soft: #f8f4ea;
  --ink: #17231f;
  --muted: #6e776f;
  --line: #dfe6dc;
  --line-warm: #e7dcc8;
  --brand: #176b4d;
  --brand-dark: #0f3a2d;
  --brand-soft: #e1f1e9;
  --accent: #c87a23;
  --accent-dark: #9a5616;
  --danger: #b33b2e;
  --danger-soft: #fde7e1;
  --warning: #8f5d10;
  --warning-soft: #fff4d6;
  --shadow: 0 18px 48px rgba(23, 35, 31, 0.10);
  --shadow-soft: 0 10px 26px rgba(23, 35, 31, 0.07);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(23, 107, 77, 0.18), transparent 32rem),
    linear-gradient(180deg, #f7faf7 0%, var(--bg) 42%, #e9eee9 100%);
  color: var(--ink);
}

button, input, select { font: inherit; }

.hidden { display: none !important; }

.shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  position: relative;
  width: min(440px, 100%);
  padding: 36px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.login-card h1 {
  margin-bottom: 24px;
  color: var(--brand-dark);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #46524b;
  font-weight: 700;
}

.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-end;
  padding: 30px;
  color: #fffdf4;
  background:
    linear-gradient(135deg, rgba(15, 58, 45, 0.98), rgba(23, 107, 77, 0.92)),
    radial-gradient(circle at top right, rgba(200, 122, 35, 0.36), transparent 20rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 38px solid rgba(255, 255, 255, 0.06);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 52px); letter-spacing: -0.04em; }
h2 { margin-bottom: 18px; font-size: clamp(20px, 2vw, 25px); letter-spacing: -0.02em; color: var(--brand-dark); }

.subtle {
  margin-bottom: 0;
  color: rgba(255, 253, 244, 0.76);
}

.top-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 560px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 253, 244, 0.92);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.card {
  margin-top: 20px;
  padding: 24px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

#reviewCard {
  position: fixed;
  inset: 18px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: 22px;
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

#reviewCard::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(11, 20, 17, 0.58);
  backdrop-filter: blur(5px);
}

#reviewCard .table-wrap {
  flex: 1 1 auto;
  min-height: 260px;
  overflow: auto;
}

#reviewCard .pager {
  flex: 0 0 auto;
}

form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

input[type="file"] {
  min-height: 52px;
  padding: 13px 14px;
  border: 1.5px dashed #9bb2a6;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdfb, #f2f7f3);
  color: #34443c;
}

select, input[type="text"], input[type="password"], input[type="number"], textarea {
  min-height: 44px;
  border: 1px solid #cfd9d2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

select:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(23, 107, 77, 0.13);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(154, 86, 22, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(154, 86, 22, 0.24);
}

button:active:not(:disabled) { transform: translateY(0); }
button:disabled { background: #aeb7b1; cursor: not-allowed; box-shadow: none; }
button.danger { background: linear-gradient(180deg, #c64a3a, var(--danger)); box-shadow: 0 8px 18px rgba(179, 59, 46, 0.18); }
button.danger:hover { filter: brightness(0.96); }
button.small { min-height: 30px; border-radius: 999px; padding: 6px 11px; font-size: 12px; box-shadow: none; }
.top-actions button, .review-actions button, .pager button { background: #ffffff; color: var(--brand-dark); box-shadow: none; border: 1px solid rgba(15, 58, 45, 0.14); }
.top-actions button { background: rgba(255, 255, 255, 0.92); }
#exportButton, #mergeBatchesButton { background: linear-gradient(180deg, var(--brand), var(--brand-dark)); color: #fff; }
.review-actions button.danger, .top-actions button.danger { color: #fff; }

.message {
  min-height: 24px;
  margin: 14px 0 0;
  color: #76501e;
  font-weight: 700;
}

.upload-note, .batch-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.upload-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #dbe8df;
  border-radius: 16px;
  background: var(--brand-soft);
  color: #315d49;
}

.upload-note::before {
  content: "建议";
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.batch-list {
  display: grid;
  gap: 10px;
}

.batch-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbf8);
}

.batch-item strong { color: var(--brand-dark); }
.batch-check { display: flex; gap: 7px; align-items: center; color: #52645a; font-size: 14px; font-weight: 700; }
.batch-check input { width: auto; accent-color: var(--brand); }

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pager-info {
  color: var(--muted);
  padding: 8px 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-head h2 { margin-bottom: 6px; }

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
}

.compact-table {
  min-width: 640px;
  margin-top: 14px;
}

th, td {
  border-bottom: 1px solid #edf1ec;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef5ef;
  color: #365347;
  font-size: 13px;
  letter-spacing: 0.02em;
}

tbody tr:nth-child(even) { background: #fbfcfb; }
tbody tr:hover { background: #f2f8f4; }
td:first-child, th:first-child { padding-left: 14px; }
td:last-child, th:last-child { padding-right: 14px; }

td input {
  width: 100%;
  min-width: 112px;
  background: #fbfdfb;
}

.error { color: var(--danger); font-size: 13px; }
.status-cell { display: grid; gap: 8px; min-width: 160px; color: #52645a; }

.risk-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.risk-ok { background: #dff4e6; color: #21713b; }
.risk-review { background: var(--warning-soft); color: var(--warning); }
.risk-high { background: var(--danger-soft); color: var(--danger); }

.abbr-form { margin-top: 8px; }
.abbr-list { margin-top: 12px; overflow-x: auto; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 20, 17, 0.62);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(780px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.30);
}

.narrow-modal { width: min(500px, 100%); }
.qr-box { display: grid; place-items: center; margin: 18px 0; }
.qr-box img { width: 220px; height: 220px; border: 10px solid #fff; border-radius: 16px; background: #fff; box-shadow: var(--shadow-soft); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.copy-row input { width: 100%; }
.qr-input-form { display: grid; gap: 12px; }
.full-width-actions { width: 100%; }
.scan-box {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #08110e;
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), var(--shadow-soft);
}

.scan-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.22), 0 0 28px rgba(23, 107, 77, 0.48);
  pointer-events: none;
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #49f0a0;
  border-style: solid;
  filter: drop-shadow(0 0 8px rgba(73, 240, 160, 0.75));
}

.scan-frame::before {
  left: -4px;
  top: -4px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 18px;
}

.scan-frame::after {
  right: -4px;
  bottom: -4px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 18px;
}

.scan-line {
  position: absolute;
  left: 20%;
  right: 20%;
  top: 20%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(73, 240, 160, 0.98), transparent);
  box-shadow: 0 0 18px rgba(73, 240, 160, 0.95), 0 0 42px rgba(73, 240, 160, 0.45);
  animation: scanLine 1.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scanLine {
  0% { top: 20%; opacity: 0.25; }
  12% { opacity: 1; }
  50% { opacity: 1; }
  100% { top: 80%; opacity: 0.25; }
}
.warning-content h3 { margin: 18px 0 8px; color: var(--brand-dark); }
.warning-content ul { margin: 0; padding-left: 20px; }
.warning-content li { margin: 8px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.warning-box {
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--warning-soft);
  color: #6c4420;
  border: 1px solid #e4bd75;
}

.link-button {
  min-height: 28px;
  margin: 2px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

@media (max-width: 900px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; max-width: none; }
}

@media (max-width: 720px) {
  .shell { padding: 16px 10px 28px; }
  .hero { padding: 22px; border-radius: 22px; }
  h1 { font-size: 34px; }
  .status { white-space: normal; width: 100%; justify-content: center; }
  .top-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .top-actions .status { grid-column: 1 / -1; }
  .card { padding: 18px; border-radius: 20px; }
  #reviewCard { inset: 8px; padding: 14px; border-radius: 20px; }
  #reviewCard .table-wrap { min-height: 55vh; }
  .batch-item { grid-template-columns: 1fr; }
  form { display: grid; }
  input[type="file"], button { width: 100%; }
  select, input[type="text"], input[type="password"], input[type="number"] { width: 100%; }
  .section-head { align-items: stretch; flex-direction: column; }
  .review-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .review-actions button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .pager { justify-content: stretch; }
  .pager button, .pager .pager-info { width: 100%; text-align: center; }
  .modal-actions { display: grid; }
  .copy-row { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
}

@media (max-width: 420px) {
  .top-actions, .review-actions { grid-template-columns: 1fr; }
}
