:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #19202a;
  --muted: #667085;
  --accent: #178f68;
  --accent-strong: #0d6f50;
  --accent-soft: #e7f6f0;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --warn: #9a5b00;
  --warn-soft: #fff4db;
  --shadow: 0 18px 45px rgba(25, 32, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
}

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

.title-block {
  display: flex;
  min-width: 250px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  gap: 10px;
  flex: 1;
  max-width: 760px;
}

.claim-stats {
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  max-width: 380px;
}

.stat {
  min-height: 78px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(25, 32, 42, 0.04);
}

.stat-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 440px) 1fr;
  gap: 16px;
  align-items: start;
}

.single-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sticky {
  position: sticky;
  top: 16px;
}

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

.panel-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 800;
}

.body {
  padding: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid #cbd2dd;
  border-radius: 7px;
  outline: none;
  color: var(--text);
  background: #fbfcfd;
}

textarea {
  min-height: 300px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.65;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 14px;
}

input {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 14px;
}

select {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 14px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 143, 104, 0.14);
  background: #fff;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.field {
  margin-bottom: 13px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

.action-wide {
  grid-column: 1 / -1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cbd2dd;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn:hover {
  border-color: #98a2b3;
  background: #f8fafc;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.btn-primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.btn-danger {
  border-color: #f1b8b1;
  color: var(--danger);
  background: var(--danger-soft);
}

.btn-success {
  border-color: #9bd8c4;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.small-btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.text-btn {
  min-height: 28px;
  padding: 4px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.text-btn:hover {
  border-color: #cbd2dd;
  background: #fff;
  color: var(--text);
}

.tool-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.record-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-select {
  width: auto;
  min-width: 180px;
  max-width: 260px;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
}

.filter-summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #d9dee7;
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.message {
  margin-top: 12px;
  min-height: 36px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.message.ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.message.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.message.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.result-body {
  padding: 16px;
}

.empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed #cbd2dd;
  border-radius: var(--radius);
  color: var(--muted);
  background: #fbfcfd;
  text-align: center;
  line-height: 1.6;
  padding: 28px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(246px, 1fr));
  gap: 12px;
}

.qr-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 336px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid #edf0f4;
}

.qr-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.qr-preview {
  display: grid;
  place-items: center;
  min-height: 238px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

.qr-preview img {
  width: min(208px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: pixelated;
  border: 8px solid #fff;
  box-shadow: 0 8px 22px rgba(25, 32, 42, 0.08);
}

.qr-meta {
  min-height: 42px;
  padding: 0 12px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #edf0f4;
}

.issue-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.issue {
  padding: 9px 11px;
  border: 1px solid #f7d99b;
  border-radius: 7px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

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

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fbfcfd;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.pager-info {
  min-width: 86px;
  text-align: center;
  font-weight: 700;
}

.hide {
  display: none !important;
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: column;
  }

  .stats {
    max-width: none;
  }

  .layout,
  .single-layout {
    grid-template-columns: 1fr;
  }

  .sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100vw - 20px, 1440px);
    padding-top: 14px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-row {
    width: 100%;
    justify-content: stretch;
  }

  .record-head-tools {
    width: 100%;
    justify-content: stretch;
  }

  .tool-row .btn {
    flex: 1;
  }

  .record-head-tools .compact-select {
    width: 100%;
    max-width: none;
  }

  .record-head-tools .filter-summary {
    width: 100%;
    justify-content: center;
  }

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