:root {
  --paper: #f4f0e8;
  --white: #fffdf8;
  --ink: #24211e;
  --muted: #77716a;
  --line: rgba(36, 33, 30, 0.13);
  --orange: #f2683b;
  --green: #347247;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(rgba(36, 33, 30, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 33, 30, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
select { font: inherit; }
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  height: 76px;
  margin: auto;
  border-bottom: 1px solid var(--line);
}
.portal-brand { font-weight: 800; letter-spacing: -0.04em; }
.portal-nav { display: flex; gap: 22px; color: var(--muted); font-size: 13px; }
.portal-nav a:hover { color: var(--orange); }
.portal-main {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 150px);
  margin: auto;
  padding: 62px 0 90px;
}
.portal-title { margin-bottom: 28px; }
.portal-title span { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.portal-title h1 {
  margin: 10px 0 8px;
  font-family: "Songti SC", STSong, Georgia, serif;
  font-size: clamp(38px, 6vw, 66px);
  font-weight: 500;
  letter-spacing: -.06em;
}
.portal-title p { margin: 0; color: var(--muted); font-size: 13px; }
.panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 248, .82);
  box-shadow: 0 20px 60px rgba(54, 43, 33, .09);
}
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 900px; }
.auth-card h2, .panel h2 { margin: 0 0 8px; font-size: 20px; }
.auth-card > p, .panel > p { margin: 0 0 22px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.field { display: grid; gap: 7px; margin-top: 14px; }
.field span { color: var(--muted); font-size: 10px; font-weight: 700; }
.field input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--white);
}
.field select {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--white);
}
.field input:focus { border-color: var(--orange); }
.primary-action, .secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 18px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.primary-action { color: #fff; background: var(--ink); }
.secondary-action { border: 1px solid var(--line); background: var(--white); }
.message { min-height: 18px; margin: 12px 0 0; color: #a23c29; font-size: 11px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.metric { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 8px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.password-form {
  display: grid;
  gap: 14px;
  max-width: 620px;
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.password-form h3 { margin: 0; }
.link-action {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #715b4b;
  text-decoration: underline;
  cursor: pointer;
}
.list-stack { display: grid; gap: 12px; }
.record {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}
.record h3 { margin: 0 0 6px; font-size: 13px; }
.record p, .record time { margin: 0; color: var(--muted); font-size: 10px; }
.record-status { font-size: 10px; font-weight: 800; }
.status-succeeded, .status-paid { color: var(--green); }
.status-failed { color: #a23c29; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tabs button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font-size: 10px;
}
.tabs button.active { color: #fff; background: var(--ink); }
.history-section[hidden] { display: none; }
.history-results { display: flex; gap: 8px; margin-top: 12px; }
.history-results a { color: var(--orange); font-size: 10px; font-weight: 700; }
.empty { padding: 45px; color: var(--muted); text-align: center; font-size: 12px; }
.admin-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.manual-recharge-panel { margin-bottom: 20px; }
.manual-recharge-form {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.25fr auto;
  align-items: end;
  gap: 12px;
}
.manual-recharge-form .field { margin-top: 0; }
.manual-recharge-form .primary-action { margin-top: 0; white-space: nowrap; }
.admin-metrics .metric strong { font-size: 26px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); background: #eee8dd; }
.legal { max-width: 860px; margin: auto; }
.legal h2 { margin-top: 32px; font-size: 19px; }
.legal p, .legal li { color: #5f5952; font-size: 13px; line-height: 1.9; }
.legal-note { padding: 16px; border-left: 3px solid var(--orange); background: rgba(242,104,59,.08); }
.portal-footer {
  width: min(1180px, calc(100% - 40px));
  margin: auto;
  padding: 25px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}
[hidden] { display: none !important; }
@media (max-width: 800px) {
  .portal-nav { gap: 12px; }
  .auth-grid, .account-grid { grid-template-columns: 1fr; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .manual-recharge-form { grid-template-columns: 1fr; }
  .portal-main { padding-top: 42px; }
}
