:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1c2430;
  --muted: #667084;
  --line: #e3d9c8;
  --navy: #1b2430;
  --navy-2: #273244;
  --brass: #c6a15b;
  --blue: #2f6fad;
  --blue-dark: #214e7c;
  --green: #1f8a4d;
  --red: #c44747;
  --amber: #9a6412;
  --shadow: 0 12px 30px rgba(28, 36, 48, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--blue-dark); }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -0.03em; }
h2 { font-size: 18px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--navy);
  color: #f7f1e6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { padding-bottom: 14px; border-bottom: 3px solid var(--brass); }
.brand strong { display: block; font-size: 20px; }
.brand span, .who, .muted, small { color: var(--muted); }
.side .brand span, .side .who { color: #c9c1b4; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a, .side-foot a {
  color: #f7f1e6;
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 12px;
}
.nav a.on, .nav a:hover { background: var(--navy-2); }
.nav em {
  margin-left: 6px;
  background: var(--brass);
  color: var(--navy);
  border-radius: 999px;
  padding: 0 7px;
  font-style: normal;
  font-size: 12px;
}
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.main { padding: 28px; }
.page-head, .card-head, .actions, .filters, .tabs, .pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.page-head { align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p, .eyebrow { color: var(--muted); margin-top: 6px; }
.eyebrow { font-size: 13px; letter-spacing: 0.04em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stats article, .card, .login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.stats article { padding: 16px 18px; }
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { display: block; margin-top: 6px; font-size: 28px; font-variant-numeric: tabular-nums; }
.stats small { font-size: 13px; }
.card { padding: 16px 18px; }
.card-head { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #efe6d6;
}
.st-auto_passed, .st-approved { background: #e5f6ea; color: var(--green); }
.st-pending_review { background: #fff1d6; color: var(--amber); }
.st-rejected, .st-cancelled, .st-refunded { background: #fde8e6; color: var(--red); }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.good { background: var(--green); }
.btn.danger { background: var(--red); }
.side .btn.ghost { color: #f7f1e6; border-color: #445066; }
.flash { border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.flash.ok { background: #e7f6ec; color: #146c38; }
.flash.err { background: #fdeceb; color: #9f2f2f; }
.filters, .tabs { justify-content: flex-start; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
}
.tabs a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.tabs a.on { background: var(--navy); color: white; }
.empty { color: var(--muted); padding: 12px 0; }
.pager { justify-content: flex-start; margin-top: 12px; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; align-items: start; }
.facts { display: grid; gap: 12px; margin: 0; }
.facts div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.stack, .form-grid { display: grid; gap: 14px; }
.narrow { max-width: 460px; }
.field { display: grid; gap: 6px; }
.field span, legend { font-weight: 600; }
.choice { display: flex; gap: 8px; align-items: flex-start; }
.choices { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.wide { grid-column: 1 / -1; }
.help-list { display: grid; gap: 4px; }
.help-list p { margin: 0; }
.wallet-board { padding: 6px 8px; }
.wallet-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}
.wallet-row:last-child { border-bottom: 0; }
.wallet-row.off { background: #f7f4ee; border-radius: 14px; }
.wallet-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #f4ecdc;
  display: grid;
  place-items: center;
  font-size: 26px;
}
.wallet-row.off .wallet-mark { background: #ece7df; }
.wallet-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wallet-title strong { font-size: 16px; }
.badge.live { background: #e5f6ea; color: var(--green); }
.badge.dead { background: #fde8e6; color: var(--red); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  background: #f6f1e6;
  border-radius: 999px;
  padding: 2px 8px;
}
.pill.yes { background: #e5f6ea; color: var(--green); }
.pill.no { background: #f3f0ea; color: #8a8175; }
.pill.warn { background: #fff1d6; color: var(--amber); }
.wallet-ops { display: flex; align-items: center; gap: 8px; }
.phone { background: #d5e0ea; border-radius: 22px; padding: 14px; display: grid; gap: 10px; }
.start-keys { display: grid; gap: 8px; }
.start-keys span {
  display: block;
  text-align: center;
  background: white;
  color: var(--blue-dark);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 600;
}
.start-keys .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bubble {
  margin: 0;
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  white-space: pre-wrap;
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}
.qr { width: 220px; height: 220px; background: white; border-radius: 12px; }
.secret {
  display: block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  font-size: 16px;
  word-break: break-all;
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.otp-mini {
  width: 6.5em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: white;
}
.login-body { min-height: 100vh; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-copy {
  background: var(--navy);
  color: #f7f1e6;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}
.login-copy h1 { font-size: 42px; max-width: 10em; }
.login-copy .eyebrow { color: var(--brass); }
.login-card { margin: auto; width: min(420px, calc(100% - 40px)); padding: 28px; display: grid; gap: 14px; }

@media (max-width: 980px) {
  .stats, .split, .login-wrap, .form-grid { grid-template-columns: 1fr; }
  .login-copy { padding: 32px 22px; min-height: 220px; }
  .login-copy h1 { font-size: 32px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 2; padding: 12px; gap: 10px; }
  .nav { flex-direction: row; overflow: auto; }
  .side-foot { display: flex; align-items: center; margin-top: 0; }
  .main { padding: 16px; }
  .page-head { align-items: flex-start; }
  .facts div { grid-template-columns: 1fr; }
  .wallet-row { grid-template-columns: 52px minmax(0, 1fr); }
  .wallet-ops { grid-column: 1 / -1; flex-wrap: wrap; }
}
