* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  color: #132018;
  background: #f4f7f5;
}
.user-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #07140d 0%, #0d2a19 58%, #10251d 100%);
}
.mobile-user-page {
  min-height: 100svh;
}
.mobile-shell {
  width: min(430px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 22px 16px 28px;
  display: grid;
  align-items: center;
}
.mobile-card {
  background: #fff;
  border: 1px solid #dce7df;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,.16);
}
.mobile-brand {
  margin: 0 auto 18px;
}
.mobile-card h1 {
  margin: 0;
  text-align: center;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: 0;
}
.subtitle {
  margin: 8px 0 20px;
  text-align: center;
  color: #087c3d;
  font-size: 17px;
  font-weight: 700;
}
.field-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #dce7df;
  border-radius: 8px;
  background: #f7fbf8;
}
.field-block span,
.field-title {
  color: #66786d;
  font-size: 14px;
}
.field-block strong {
  font-size: 18px;
  letter-spacing: 0;
}
.field-title {
  margin: 14px 0 8px;
}
.activate-btn {
  width: 100%;
  margin-top: 14px;
  height: 46px;
  font-weight: 700;
}
.mobile-qr-box {
  margin-top: 10px;
}
.qr-countdown {
  text-align: center;
  color: #087c3d;
  font-weight: 700;
  margin-bottom: 8px;
}
.redeem-box {
  margin-top: 18px;
  padding-top: 2px;
}
.exchange-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 28px 16px;
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 18px;
  min-height: 100vh;
  align-items: center;
}
.brand-panel {
  color: #fff;
}
.brand-mark {
  width: 104px;
  height: 40px;
  border: 2px solid #13d866;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #13d866;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 22px;
}
.brand-panel h1 {
  font-size: 42px;
  line-height: 1.12;
  margin: 0 0 12px;
  letter-spacing: 0;
}
.brand-panel p {
  font-size: 22px;
  margin: 0;
  color: #d9ffe7;
}
.exchange-panel,
.admin-panel,
.login-card,
.metric {
  background: #fff;
  border: 1px solid #dce7df;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}
.exchange-panel {
  padding: 22px;
}
input, select {
  width: 100%;
  height: 42px;
  border: 1px solid #c8d6ce;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}
input:focus, select:focus { border-color: #00be5b; }
textarea {
  width: 100%;
  border: 1px solid #c8d6ce;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}
textarea:focus { border-color: #00be5b; }
button, .download {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: #00be5b;
  color: #fff;
  padding: 0 16px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.download.dark { background: #202b3c; }
button.secondary { background: #202b3c; width: 100%; margin-top: 12px; }
button:disabled { opacity: .58; cursor: not-allowed; }
.exchange-panel > button {
  width: 100%;
  margin-top: 12px;
}
.pay-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.pay-choice label {
  height: 42px;
  border: 1px solid #c8d6ce;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  background: #f8fbf9;
}
.pay-choice input {
  width: auto;
  height: auto;
  accent-color: #00be5b;
}
.profile {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 12px;
  background: #f1fbf5;
  border: 1px solid #ccefd9;
  border-radius: 8px;
  font-size: 14px;
}
.qr-box {
  width: 260px;
  height: 260px;
  margin: 18px auto 12px;
  background: #fff;
  border: 1px solid #dce7df;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.pay-button {
  width: 190px;
  height: 48px;
  font-weight: 700;
}
.message {
  min-height: 26px;
  color: #314235;
  text-align: center;
  line-height: 1.5;
}
.muted { color: #6b7c71; font-size: 14px; }
.hidden { display: none !important; }
.admin-page {
  background: #f5f8fb;
  min-height: 100vh;
  color: #243228;
}
.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: #fbfdfb;
  color: #243228;
  border-right: 1px solid #e4ece7;
  display: flex;
  flex-direction: column;
}
.admin-logo {
  height: 40px;
  border: 1px solid #bfead0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #087c3d;
  background: #f0fbf4;
  font-weight: 900;
  margin-bottom: 18px;
}
.admin-nav {
  display: grid;
  gap: 6px;
}
.admin-nav a,
.admin-logout {
  color: #4b5f52;
  text-decoration: none;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.admin-nav a.active,
.admin-nav a:hover,
.admin-logout:hover {
  background: #edf8f1;
  border-color: #cfe8d8;
  color: #087c3d;
}
.admin-logout {
  margin-top: auto;
}
.admin-main {
  min-width: 0;
  padding: 24px 26px 42px;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid #e4ece7;
  border-radius: 8px;
}
.admin-topbar h1 {
  margin: 0;
  font-size: 24px;
  color: #1f2d24;
}
.admin-topbar p {
  margin: 5px 0 0;
  color: #6f7f75;
}
.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.admin-grid-2.one-col {
  grid-template-columns: minmax(0, 520px);
}
.admin-header {
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f1f17;
  color: #fff;
}
.admin-header a { color: #bfffd6; text-decoration: none; }
.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.admin-panel {
  padding: 18px;
  margin-bottom: 16px;
  border-color: #e4ece7;
  box-shadow: 0 10px 26px rgba(36, 50, 40, .04);
}
.admin-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #223127;
}
.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}
.stack-form {
  display: grid;
  gap: 10px;
}
.toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid #e8efeb;
  padding: 9px 8px;
  text-align: left;
  white-space: nowrap;
}
th {
  color: #607166;
  background: #f6faf8;
  font-weight: 700;
}
tbody tr:hover {
  background: #fbfdfc;
}
td a {
  color: #087c3d;
  text-decoration: none;
  font-weight: 700;
}
.tiny-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  margin-right: 6px;
  border: 1px solid #d9eadf;
  border-radius: 6px;
  background: #f8fcf9;
}
.tiny-link:hover {
  background: #edf8f1;
}
code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: #324034;
}
.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-title-row h2 {
  margin-bottom: 4px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.detail-grid div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #e4ece7;
  border-radius: 8px;
  background: #f8fbfa;
}
.detail-grid span {
  display: block;
  color: #667085;
  font-size: 12px;
  margin-bottom: 6px;
}
.detail-grid strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
}
.timeline {
  position: relative;
  display: grid;
  gap: 12px;
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}
.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: #18a957;
  box-shadow: 0 0 0 4px #e6f6ed;
}
.timeline-body {
  padding: 12px;
  border: 1px solid #e4ece7;
  border-radius: 8px;
  background: #ffffff;
}
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.timeline-head span {
  color: #667085;
  font-size: 12px;
}
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #526156;
  font-size: 13px;
}
.detail-json {
  max-height: 260px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid #e4ece7;
  border-radius: 6px;
  background: #f7faf8;
  color: #243229;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.settings-panel {
  max-width: 880px;
}
.settings-form {
  display: grid;
  gap: 14px;
}
.settings-form h2 {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #e8efeb;
}
.settings-form h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.settings-form label {
  display: grid;
  gap: 7px;
}
.settings-form label span {
  color: #526156;
  font-size: 14px;
  font-weight: 700;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.check-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  padding: 12px;
  border: 1px solid #dbe8e1;
  border-radius: 8px;
  background: #f8fcf9;
}
.check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #00be5b;
}
.check-row span {
  font-weight: 500 !important;
  line-height: 1.5;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e8efeb;
  color: #6f7f75;
  font-size: 13px;
}
.pagination div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.pagination a,
.pagination em {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #dbe8e1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-style: normal;
}
.pagination a {
  color: #2d5f40;
  background: #ffffff;
}
.pagination a.active,
.pagination a:hover {
  border-color: #9ddab5;
  background: #edf8f1;
  color: #087c3d;
}
.pagination em {
  color: #a5b0aa;
  background: #f7faf8;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric {
  padding: 14px;
  box-shadow: none;
}
.metric span {
  display: block;
  color: #667085;
  font-size: 13px;
  margin-bottom: 6px;
}
.metric strong {
  font-size: 24px;
}
.notice, .error {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.notice { background: #eaf8ef; color: #166534; }
.error { background: #fff1f0; color: #b42318; }
.login-card {
  width: min(380px, calc(100% - 32px));
  margin: 12vh auto 0;
  padding: 24px;
}
.login-card h1 { margin: 0 0 16px; font-size: 22px; }
.login-card form { display: grid; gap: 12px; }
.replace-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 30px 16px;
}
.replace-card {
  width: min(520px, 100%);
  margin: 0;
}
canvas {
  width: 100%;
  height: auto;
  border: 1px solid #edf1f3;
  border-radius: 8px;
}
@media (max-width: 800px) {
  .exchange-shell { grid-template-columns: 1fr; align-items: start; }
  .brand-panel h1 { font-size: 32px; }
  .inline-form { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static;
    height: auto;
  }
  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-main {
    padding: 16px;
  }
  .admin-grid-2 {
    grid-template-columns: 1fr;
  }
  .detail-title-row {
    display: grid;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }
  .pagination div {
    justify-content: flex-start;
  }
}
