:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde7;
  --bg: #eef3f8;
  --panel: #ffffff;
  --primary: #176b87;
  --primary-dark: #0f5166;
  --accent: #d96c3f;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: #176b87;
  color: #fff;
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: 0 12px 32px rgba(23, 32, 42, 0.18);
  font-weight: 700;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.customer {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.customer.dual {
  align-items: start;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.notice {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid #f2c94c;
  background: #fff8db;
  color: #7a4d00;
  border-radius: 8px;
  padding: 14px 18px;
  white-space: pre-wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
}

.customer .panel { width: min(560px, 100%); }
.customer.dual .panel { width: 100%; }

.brand {
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

h1, h2 { margin: 0 0 18px; line-height: 1.2; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }

label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }

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

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--primary-dark); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button.secondary { background: #e8edf3; color: var(--ink); }
button.secondary:hover { background: #dce4ee; }
button.danger { background: #b42318; color: #fff; }
button.danger:hover { background: #8f1c13; }
button.confirm { width: 100%; margin-top: 10px; background: #2f7d59; }
button.confirm:hover { background: #246445; }

.result {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.result span, p { color: var(--muted); }

pre {
  min-height: 116px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #101820;
  color: #e9f7ef;
  border-radius: 8px;
  padding: 16px;
}

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

.infoBox {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 74px;
  background: #fff;
}

.infoBox span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.infoBox strong {
  display: block;
  word-break: break-word;
}

.wideInfo { grid-column: 1 / -1; }

.copyable {
  cursor: context-menu;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.copyable:hover {
  color: #0b63ce;
  background: #eaf3ff;
  border-color: #8bbcff;
}

.copyable:hover strong { color: #0b63ce; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.wide { grid-column: 1 / -1; }
.hidden { display: none; }

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); font-weight: 700; }
td code { font-family: Consolas, monospace; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar h2 { margin: 0; }
.toolbarActions { display: flex; gap: 10px; align-items: center; }
.toolbar select, .toolbarActions select { width: auto; min-width: 120px; }

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

.pager button { min-height: 36px; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.stats strong {
  display: block;
  font-size: 26px;
  line-height: 1;
  margin-bottom: 8px;
}

.stats span {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .grid, .actions, .row { grid-template-columns: 1fr; }
  .customer.dual, .cardInfo { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .toolbar, .toolbarActions, .pager { align-items: stretch; flex-direction: column; }
  .toolbar select, .toolbarActions select { width: 100%; }
  header { align-items: flex-start; gap: 12px; }
  h1 { font-size: 24px; }
}
