:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #657180;
  --line: #dce2e8;
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #13795b;
  --warning: #9a6700;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

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

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

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

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a,
.button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  min-height: 42px;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  line-height: 1.25;
}

.panel h2 {
  font-size: 20px;
}

.panel h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

label {
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 12px;
  font-size: 16px;
  background: #fff;
  min-height: 46px;
}

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

.status {
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: #eef4ff;
  color: #1849a9;
  border: 1px solid #c7d7fe;
}

.status.success {
  background: #eaf8f1;
  color: var(--success);
  border-color: #bfe8d2;
}

.status.warning {
  background: #fff7e6;
  color: var(--warning);
  border-color: #ffe0a3;
}

.status.error {
  background: #fff0f0;
  color: var(--danger);
  border-color: #ffd1d1;
}

.customer-card {
  display: grid;
  gap: 10px;
}

.customer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-title strong {
  font-size: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}

.pill.ok {
  border-color: #bfe8d2;
  color: var(--success);
  background: #eaf8f1;
}

.pill.vip {
  border-color: #f6ce7d;
  color: #7a4b00;
  background: #fff7e6;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 66px;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail strong {
  font-size: 15px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.25;
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

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

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

.qr-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  text-decoration: none;
  background: #fff;
}

.latency {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .grid.two,
  .metrics,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .customer-title {
    align-items: flex-start;
    flex-direction: column;
  }

  th,
  td {
    padding: 9px 6px;
    font-size: 13px;
  }
}
