:root {
  color-scheme: light;
  --ink: #111827;
  --ink-soft: #314158;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.28);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --navy: #172554;
  --blue: #2563eb;
  --cyan: #0e7490;
  --mint: #10b981;
  --gold: #f6c85f;
  --violet: #7c3aed;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(245, 249, 255, 0.9) 44%, rgba(239, 246, 255, 1) 100%),
    radial-gradient(circle at 16% 8%, rgba(246, 200, 95, 0.26), transparent 24%),
    radial-gradient(circle at 86% 16%, rgba(14, 116, 144, 0.18), transparent 28%),
    #f6f8fc;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 24px 16px 36px;
}

.moon-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.moon {
  position: absolute;
  top: 72px;
  right: max(36px, calc((100vw - 1120px) / 2));
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, #fffdf3 0 28%, #f8dd88 52%, #e7aa32 100%);
  box-shadow:
    0 0 0 18px rgba(246, 200, 95, 0.08),
    0 26px 80px rgba(231, 170, 50, 0.24);
}

.moon::after {
  content: "";
  position: absolute;
  inset: 13px 0 0 35px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(246, 248, 252, 0.9);
}

.star {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(23, 37, 84, 0.24);
}

.star-a {
  top: 126px;
  left: 13%;
}

.star-b {
  top: 246px;
  right: 18%;
}

.star-c {
  top: 430px;
  left: 19%;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  margin: 0 auto;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--navy), #24489a);
  box-shadow: 0 12px 28px rgba(23, 37, 84, 0.22);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 10px 8px 8px 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: -7px 2px 0 #f7fbff;
}

.brand strong {
  display: block;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.15;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.language-select {
  position: relative;
}

.language-select > button,
.language-menu button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.language-menu {
  position: absolute;
  right: 0;
  z-index: 5;
  width: 176px;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.language-menu button {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
}

.language-menu button:hover {
  background: #f1f5f9;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 680px);
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 650px;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.75;
}

.glass-card,
.main-card {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.main-card {
  padding: clamp(22px, 4vw, 34px);
}

.home-card {
  display: grid;
  gap: 22px;
}

.home-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.home-heading h2,
.section-title {
  margin: 0;
  color: var(--navy);
  font-size: 26px;
  line-height: 1.25;
}

.home-heading p,
.section-subtitle,
.hint,
.small-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.home-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(246, 200, 95, 0.45);
  border-radius: 999px;
  background: rgba(255, 248, 226, 0.8);
  color: #8a5a00;
  font-size: 13px;
  font-weight: 900;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.service-button,
.primary-button,
.secondary-button,
.danger-button,
.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  font-weight: 900;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.service-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.soft-button:hover {
  transform: translateY(-1px);
}

.service-button.primary,
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.25);
}

.service-button.blue,
.secondary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), #0891b2);
}

.service-button.purple {
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, var(--violet));
}

.service-button.teal {
  color: #fff;
  background: linear-gradient(135deg, #0f766e, var(--mint));
}

.danger-button {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, var(--danger));
}

.soft-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink-soft);
}

.view-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-weight: 900;
}

.stock-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.stock-panel div {
  display: grid;
  gap: 4px;
}

.stock-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stock-panel strong {
  color: var(--navy);
  font-size: 18px;
}

.stock-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.stock-panel.high {
  border-color: rgba(16, 185, 129, 0.32);
  background: linear-gradient(90deg, rgba(236, 253, 245, 0.9), rgba(255, 255, 255, 0.74));
}

.stock-panel.high strong {
  color: #047857;
}

.stock-panel.low {
  border-color: rgba(217, 119, 6, 0.32);
  background: linear-gradient(90deg, rgba(255, 251, 235, 0.9), rgba(255, 255, 255, 0.74));
}

.stock-panel.none {
  border-color: rgba(220, 38, 38, 0.26);
  background: linear-gradient(90deg, rgba(254, 242, 242, 0.92), rgba(255, 255, 255, 0.74));
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--muted);
}

.step.active {
  border-color: rgba(37, 99, 235, 0.28);
  background: #eff6ff;
  color: var(--blue);
}

.step.active span {
  background: var(--blue);
  color: #fff;
}

.step.done {
  color: #047857;
}

.step.done span {
  background: var(--mint);
  color: #fff;
}

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

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

label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.62);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 128px;
  padding: 13px 14px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.alert {
  padding: 13px 14px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  line-height: 1.55;
}

.alert.success {
  background: #ecfdf5;
  color: #047857;
}

.alert.warning {
  background: #fffbeb;
  color: var(--warning);
}

.alert.error {
  background: #fef2f2;
  color: var(--danger);
}

.instruction-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.instruction-list li {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.instruction-card {
  position: relative;
  overflow: hidden;
}

.instruction-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--cyan));
}

.instruction-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 20px;
}

.session-card {
  background: linear-gradient(90deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.74));
}

.input-card {
  background: linear-gradient(90deg, rgba(236, 253, 245, 0.86), rgba(255, 255, 255, 0.74));
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.confirm-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.confirm-row strong {
  color: var(--ink);
  text-align: right;
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.checkline input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.status-panel {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 220px;
  text-align: center;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.query-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.query-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 800;
}

.query-tabs button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 900;
}

td {
  color: var(--ink-soft);
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.normal,
.badge.success {
  background: #dcfce7;
  color: #15803d;
}

.badge.used,
.badge.processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.invalid,
.badge.failed {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.disabled,
.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.batch-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 26px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .home-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-heading,
  .stock-panel,
  .form-row {
    display: grid;
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 560px) {
  .page-shell {
    padding: 18px 12px 28px;
  }

  .topbar {
    margin-bottom: 28px;
  }

  .brand small {
    display: none;
  }

  .moon,
  .star {
    display: none;
  }

  .home-actions,
  .batch-stats {
    grid-template-columns: 1fr;
  }

  .main-card {
    padding: 18px;
  }

  .inline-actions > * {
    width: 100%;
  }

  .service-button,
  .primary-button,
  .secondary-button,
  .danger-button,
  .soft-button {
    width: 100%;
  }
}
