:root {
  --blue: #007aff;
  --blue-2: #0a84ff;
  --blue-dark: #0062cc;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c1c1e;
  --text2: #8e8e93;
  --text3: #aeaeb2;
  --line: #ececf0;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 30px rgba(16, 24, 40, .10);
  --shadow-blue: 0 6px 16px rgba(0, 122, 255, .28);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 85% -10%, rgba(0, 122, 255, .07), transparent 70%),
    radial-gradient(900px 400px at -10% 100%, rgba(175, 82, 222, .05), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }
::selection { background: rgba(0, 122, 255, .18); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(60, 60, 67, .18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(60, 60, 67, .3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 矢量图标 ---------- */
.ico { width: 18px; height: 18px; flex-shrink: 0; display: block; }
.nav-ico .ico { width: 16px; height: 16px; }
.btn .ico { width: 17px; height: 17px; }
.balance-pill .ico { width: 15px; height: 15px; opacity: .9; }
.empty .ico { width: 34px; height: 34px; margin: 0 auto 6px; color: #c7c7cc; stroke-width: 1.4; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-hero { text-align: center; margin-bottom: 30px; animation: rise .5s ease both; }
.hero-logo {
  width: 58px; height: 58px; margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(145deg, #4aa8ff, #007aff 60%, #0062cc);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(0, 122, 255, .32);
}
.hero-logo .ico { width: 30px; height: 30px; stroke-width: 1.6; }
.auth-hero .brand { font-size: 12px; letter-spacing: 4px; color: var(--text2); margin-bottom: 12px; font-weight: 600; }
.auth-hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.25; margin-bottom: 12px; }
.auth-hero p { color: var(--text2); font-size: 14px; }
.auth-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .09);
  padding: 34px 30px;
  width: 100%; max-width: 404px;
  animation: rise .5s .08s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
.auth-card .sub { color: var(--text2); font-size: 14px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 7px; font-weight: 500; }
.input, select.input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #f7f7fa; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
  appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}
.input:focus { border-color: var(--blue); background-color: #fff; box-shadow: 0 0 0 4px rgba(0, 122, 255, .12); }
.input:disabled { color: var(--text2); background: #f2f2f7; cursor: default; }
textarea.input { resize: vertical; line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 20px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; letter-spacing: .2px;
  background: linear-gradient(180deg, var(--blue-2), var(--blue));
  color: #fff;
  box-shadow: var(--shadow-blue);
  transition: transform .08s, box-shadow .18s, filter .18s;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 8px 20px rgba(0, 122, 255, .34); }
.btn:active { transform: scale(.975); box-shadow: 0 3px 8px rgba(0, 122, 255, .22); }
.btn.block { width: 100%; }
.btn.gray {
  background: #f0f0f5; color: #3a3a3c; box-shadow: none;
}
.btn.gray:hover { background: #e8e8ee; filter: none; box-shadow: none; }
.btn.red { background: linear-gradient(180deg, #ff6b62, var(--red)); color: #fff; box-shadow: 0 6px 16px rgba(255, 59, 48, .24); }
.btn.green { background: linear-gradient(180deg, #46d968, var(--green)); color: #fff; box-shadow: 0 6px 16px rgba(52, 199, 89, .24); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; gap: 5px; }
.btn.sm .ico { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; filter: grayscale(.2); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid rgba(0, 0, 0, .05);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(145deg, #4aa8ff, #007aff 60%, #0062cc);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 122, 255, .3);
}
.logo-mark .ico { width: 18px; height: 18px; stroke-width: 1.7; }
.logo-text { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.nav-group {
  font-size: 11px; color: var(--text3); font-weight: 600;
  padding: 14px 10px 7px; letter-spacing: 1.2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px;
  color: #3a3a3c; font-size: 14px; font-weight: 500;
  margin-bottom: 2px; cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(120, 120, 128, .08); }
.nav-item.active { background: rgba(0, 122, 255, .1); color: var(--blue); font-weight: 600; }
.nav-ico {
  width: 28px; height: 28px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  flex-shrink: 0;
}
.nav-label { flex: 1; }
.nav-chev { width: 14px; height: 14px; opacity: 0; transition: opacity .15s, transform .15s; transform: translateX(-3px); }
.nav-chev .ico { width: 14px; height: 14px; }
.nav-item:hover .nav-chev, .nav-item.active .nav-chev { opacity: .55; transform: none; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

.t-blue { background: linear-gradient(145deg, #3b9dff, #007aff); }
.t-indigo { background: linear-gradient(145deg, #7d7dff, #5856d6); }
.t-green { background: linear-gradient(145deg, #4cd964, #34c759); }
.t-orange { background: linear-gradient(145deg, #ffb340, #ff9500); }
.t-purple { background: linear-gradient(145deg, #c07bff, #af52de); }
.t-yellow { background: linear-gradient(145deg, #ffd60a, #f7b500); }
.t-pink { background: linear-gradient(145deg, #ff7eb3, #ff2d55); }
.t-gray { background: linear-gradient(145deg, #c1c4cc, #8e8e93); }
.t-red { background: linear-gradient(145deg, #ff6961, #ff3b30); }

.main { flex: 1; padding: 26px 30px; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.topbar h1 { font-size: 25px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.2; }
.topbar-sub { font-size: 12.5px; color: var(--text3); margin-top: 3px; }
.user { display: flex; align-items: center; gap: 11px; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px;
  font-size: 13px; color: var(--text2);
  box-shadow: var(--shadow-sm);
}
.balance-pill b { color: var(--blue); font-size: 14.5px; font-weight: 700; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, #4aa8ff, #007aff);
  color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 122, 255, .26);
  flex-shrink: 0;
}
.user-meta { line-height: 1.25; }
.user-name { font-size: 14px; font-weight: 600; }
.user-mail { font-size: 11.5px; color: var(--text3); }

/* ---------- 卡片 / 表格 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, .035);
  box-shadow: var(--shadow-sm);
  padding: 22px; margin-bottom: 18px;
}
.card h3 {
  font-size: 15.5px; font-weight: 650; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.step-no {
  width: 21px; height: 21px; border-radius: 50%;
  background: linear-gradient(145deg, var(--blue-2), var(--blue));
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 122, 255, .28);
}
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

.stat { padding: 20px; }
.stat .label { font-size: 12.5px; color: var(--text2); margin-bottom: 8px; font-weight: 500; }
.stat .value { font-size: 27px; font-weight: 700; letter-spacing: -0.5px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; color: var(--text3); font-weight: 600; font-size: 11.5px;
  letter-spacing: .4px; text-transform: uppercase;
  padding: 9px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td, table tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(120, 120, 128, .035); }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 13px; letter-spacing: .2px; }

.tag {
  display: inline-block; padding: 4px 10px; border-radius: 7px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.tag.waiting { background: #fff4e5; color: #c77700; }
.tag.success { background: #e8faee; color: #1f9d43; }
.tag.cancelled { background: #f2f2f7; color: var(--text2); }
.tag.on { background: #e8faee; color: #1f9d43; }
.tag.off { background: #ffeeed; color: #d9362f; }
.tag.recharge { background: #e8faee; color: #1f9d43; }
.tag.consume { background: #ffeeed; color: #d9362f; }
.tag.admin { background: #eaf2ff; color: var(--blue-dark); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text2); }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; flex: 0 1 220px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* ---------- 工作台 ---------- */
.phone-display {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 28px; font-weight: 700; letter-spacing: 1px;
  font-family: "SF Mono", Consolas, monospace;
  padding: 18px; margin: 14px 0;
  background: linear-gradient(180deg, #f3f8ff, #eef4ff);
  border: 1px solid #e2ecff;
  border-radius: 14px; color: #0b3b73;
}
.phone-display .btn.sm { font-family: -apple-system, "PingFang SC", sans-serif; letter-spacing: 0; font-weight: 500; }
.sms-box {
  background: #f7f7fa; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; min-height: 72px; font-size: 14px; line-height: 1.65;
  word-break: break-all; color: #3a3a3c;
}
.code-big {
  font-size: 34px; font-weight: 800; color: var(--blue);
  font-family: "SF Mono", Consolas, monospace;
  text-align: center; letter-spacing: 5px; padding: 6px 0;
}
.hint { font-size: 12.5px; color: var(--text3); margin-top: 9px; line-height: 1.55; }
.price-hint { font-size: 13px; color: #c77700; font-weight: 700; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: rgba(28, 28, 30, .9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px;
  z-index: 999; box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  animation: slideDown .26s cubic-bezier(.2, .9, .3, 1);
  max-width: min(90vw, 480px); text-align: center;
}
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 悬停气泡提示 */
.tt { position: relative; cursor: pointer; text-decoration: none; }
.tt::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(28, 28, 30, .92); color: #fff;
  padding: 8px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
  max-width: 360px; width: max-content;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.tt::before {
  content: ''; position: absolute; bottom: calc(100% + 2px); left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: rgba(28, 28, 30, .92);
  opacity: 0; transition: opacity .15s;
}
.tt:hover::after, .tt:hover::before { opacity: 1; }
.tt:hover::after { transform: translateX(-50%) translateY(0); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .38);
  display: flex; align-items: center; justify-content: center; z-index: 99;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s ease;
  padding: 16px;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 20px; padding: 26px;
  width: 100%; max-width: 448px; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.empty {
  text-align: center; color: var(--text3); padding: 40px 0; font-size: 13.5px;
  line-height: 1.8;
}
.notice {
  background: linear-gradient(180deg, #fffaeb, #fff7e0);
  border: 1px solid #ffe8ad; color: #8a6410;
  border-radius: 12px; padding: 13px 16px; font-size: 13px; margin-bottom: 18px;
  white-space: pre-wrap; line-height: 1.6;
}
pre.doc {
  background: #1c1c1e; color: #d8d8de; border-radius: 14px;
  padding: 18px; font-size: 12.5px; overflow-x: auto; line-height: 1.75;
  font-family: "SF Mono", Consolas, monospace;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.spin {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- 在线支付 ---------- */
.pay-types { display: flex; gap: 12px; }
.pay-type {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px 8px 16px; border: 1.5px solid var(--line); border-radius: 16px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text2);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
  background: #fff; user-select: none; min-height: 100px; text-align: center;
}
.pay-type:hover { border-color: #c7d8ff; background: #f8faff; }
.pay-type:active { transform: scale(.97); }
.pay-type > input { display: none; }
.pay-type > span { display: block; margin: 0 auto; line-height: 1; text-align: center; }
.pay-type:has(input:checked) {
  border-color: var(--blue); background: #eef4ff; color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}
.brand-ico {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  margin: 0 auto;
}
.brand-ico svg {
  width: 44px; height: 44px; display: block;
  margin: 0 auto;
}

.pay-box {
  margin-top: 16px; padding: 18px; border-radius: 14px;
  background: linear-gradient(180deg, #f6f9ff, #eef4ff);
  border: 1px solid #e2ecff; text-align: center;
}
.pay-amount { font-size: 30px; font-weight: 800; color: var(--blue); margin-bottom: 12px; letter-spacing: .5px; }
.qr-wrap { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; margin: 8px 0; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.qr-wrap img { width: 200px; height: 200px; display: block; }
.pay-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

.pay-modal { text-align: center; }
.pay-status { margin-top: 12px; font-size: 13px; color: var(--text3); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center;
    overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid rgba(0, 0, 0, .06);
    padding: 10px 12px; gap: 4px;
    backdrop-filter: none; background: #fff;
  }
  .sidebar .logo, .nav-group, .sidebar-foot, .nav-chev { display: none; }
  .nav-item { margin: 0; padding: 8px 11px; white-space: nowrap; flex-shrink: 0; }
  .nav-ico { width: 24px; height: 24px; border-radius: 8px; }
  .nav-ico .ico { width: 14px; height: 14px; }
  .main { padding: 18px 16px; }
  .grid.c2, .grid.c4 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 21px; }
  .user-meta, .balance-pill .bp-label { display: none; }
  .topbar-sub { display: none; }
  .auth-hero h1 { font-size: 28px; }
  .auth-card { padding: 26px 22px; }
  .card { padding: 18px; }

  /* 移动端表格：横向滚动，防止内容溢出屏幕 */
  .card table {
    display: block; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .card table thead, .card table tbody {
    display: table; width: max-content; min-width: 100%;
  }
  .card th, .card td { white-space: nowrap; }
  .card td .tt::after { white-space: pre-wrap; }

  .toolbar .input { flex: 1 1 140px; min-width: 0; }
  .toolbar .btn { flex-shrink: 0; }
  .pager { flex-wrap: wrap; justify-content: center; }
}
