:root {
  color-scheme: light;
  --ink: #102438;
  --muted: #68798a;
  --line: #dce5eb;
  --surface: #ffffff;
  --canvas: #eef4f6;
  --navy: #0b2239;
  --teal: #0aa997;
  --teal-soft: #dff8f4;
  --blue: #2b67d1;
  --blue-soft: #e6efff;
  --amber: #d98a16;
  --amber-soft: #fff2d8;
  --red: #c53b50;
  --shadow: 0 12px 32px rgba(21, 48, 70, .09);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.55; }
button, input { font: inherit; }
button { touch-action: manipulation; }

.topbar {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px max(24px, calc((100vw - 1280px) / 2));
  color: #fff;
  background: radial-gradient(circle at 85% 10%, rgba(61, 214, 196, .19), transparent 32%), var(--navy);
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark { width: 54px; height: 54px; padding: 10px; border-radius: 16px; flex: 0 0 auto; background: rgba(255,255,255,.1); }
.brand-mark svg { width: 100%; height: 100%; fill: #3dd6c4; }
.brand-mark .air { fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; }
.eyebrow { margin: 0 0 2px; color: #90dcd5; font-size: .82rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow.dark { color: var(--teal); }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
h2 { font-size: clamp(1.08rem, 2vw, 1.35rem); }
.rate-pill { display: grid; padding: 10px 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(255,255,255,.08); }
.rate-pill span { color: #a9bac8; font-size: .76rem; }
.rate-pill strong { font-size: .95rem; }

.page-shell { width: min(1280px, calc(100% - 32px)); margin: 24px auto 48px; }
.filter-panel, .content-panel { background: var(--surface); border: 1px solid rgba(185,200,210,.7); border-radius: 20px; box-shadow: var(--shadow); }
.filter-panel { padding: 20px; }
.section-heading, .panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.updated-at { margin: 4px 0 0; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.query-mode { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #f4f8fa; }
.query-mode-button { min-height: 40px; padding: 7px 18px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 800; cursor: pointer; }
.query-mode-button.active { color: #fff; background: var(--navy); box-shadow: 0 4px 10px rgba(11,34,57,.16); }
.query-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(140px, .55fr); gap: 14px; margin-top: 18px; align-items: end; }
.query-form.single-day { grid-template-columns: minmax(220px, 1fr) minmax(140px, .55fr); }
.query-form label { display: grid; gap: 7px; color: var(--muted); font-size: .88rem; font-weight: 700; }
.query-form [hidden], .quick-ranges[hidden] { display: none !important; }
.query-form input, .search-box input { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fbfdfe; outline: 0; }
.query-form input:focus, .search-box input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(10,169,151,.12); }
.primary-button { min-height: 48px; border: 0; border-radius: 12px; color: #fff; background: var(--teal); font-weight: 800; cursor: pointer; box-shadow: 0 8px 16px rgba(10,169,151,.2); }
.primary-button:hover { background: #078f80; }
.primary-button:disabled { cursor: wait; opacity: .75; }
.spinner { display: none; width: 18px; height: 18px; margin: auto; border: 2px solid rgba(255,255,255,.38); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.primary-button.loading .button-text { display: none; }
.primary-button.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.quick-ranges { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.quick-ranges button { min-height: 38px; padding: 7px 15px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; cursor: pointer; }
.quick-ranges button:hover { border-color: var(--teal); color: #087f72; }

.message { margin: 16px 0; padding: 13px 16px; border: 1px solid #f1c3c9; border-radius: 12px; color: #8d2132; background: #fff1f3; }
.message a { color: inherit; font-weight: 800; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.metric-card { position: relative; overflow: hidden; min-height: 144px; padding: 20px; border: 1px solid rgba(185,200,210,.68); border-radius: 18px; background: #fff; box-shadow: 0 8px 22px rgba(21,48,70,.06); }
.metric-card::after { content: ""; position: absolute; width: 82px; height: 82px; right: -24px; bottom: -26px; border-radius: 50%; opacity: .65; }
.accent-money::after { background: var(--teal-soft); }
.accent-time::after { background: var(--blue-soft); }
.accent-calc::after { background: var(--amber-soft); }
.accent-device::after { background: #e8e4ff; }
.metric-label { display: block; color: var(--muted); font-size: .86rem; font-weight: 700; }
.metric-card strong { display: block; margin: 13px 0 6px; font-size: clamp(1.55rem, 3vw, 2.1rem); line-height: 1; font-variant-numeric: tabular-nums; }
.metric-card small { color: var(--muted); font-size: .78rem; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 680px; margin: 0 0 12px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.76); }
.tab { min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 800; cursor: pointer; }
.tab.active { color: #fff; background: var(--navy); box-shadow: 0 5px 12px rgba(11,34,57,.18); }
.refund-tab { position: relative; }
.pending-dot { position: absolute; top: 7px; right: 9px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #e22940; box-shadow: 0 0 0 2px rgba(226,41,64,.14); }
.pending-dot[hidden] { display: none; }
.content-panel { padding: 22px; }
.tab-panel:not(.active) { display: none; }
.panel-heading { align-items: center; margin-bottom: 18px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: .78rem; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 3px; }
.legend-recharge::before { background: var(--teal); }
.legend-usage::before { background: var(--blue); }
.count-badge { padding: 5px 10px; border-radius: 999px; color: #087f72; background: var(--teal-soft); font-size: .8rem; font-weight: 800; }
.search-box { width: min(260px, 42vw); }
.search-box input { min-height: 42px; }

.chart { min-height: 164px; display: flex; align-items: end; gap: 9px; padding: 20px 10px 8px; margin-bottom: 18px; border-radius: 14px; background: linear-gradient(to bottom, #f8fbfc, #fff); overflow-x: auto; }
.chart-day { min-width: 48px; flex: 1; display: grid; grid-template-rows: 110px auto; gap: 7px; text-align: center; }
.chart-bars { display: flex; align-items: end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); }
.bar { width: min(14px, 32%); min-height: 2px; border-radius: 5px 5px 1px 1px; }
.bar.recharge { background: var(--teal); }
.bar.usage { background: var(--blue); }
.chart-day time { color: var(--muted); font-size: .7rem; white-space: nowrap; }

.desktop-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; font-size: .88rem; }
th { padding: 13px 12px; color: #496072; background: #f4f8fa; font-size: .78rem; text-align: left; white-space: nowrap; }
td { padding: 13px 12px; border-top: 1px solid #e7edf1; vertical-align: top; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }
.money { color: #087f72; font-weight: 800; }
.status-chip { display: inline-block; padding: 3px 8px; border-radius: 999px; color: #087f72; background: var(--teal-soft); font-size: .74rem; font-weight: 800; white-space: nowrap; }
.status-chip.pending { color: #9a5b00; background: var(--amber-soft); }
.status-chip.failed { color: #9f2638; background: #fff0f2; }
.refund-heading { margin-bottom: 12px; }
.refund-type-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; width: min(360px, 100%); padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #f4f8fa; }
.refund-type-button { min-height: 42px; padding: 8px 16px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 800; cursor: pointer; }
.refund-type-button.active { color: #fff; background: var(--blue); box-shadow: 0 4px 10px rgba(43,103,209,.18); }
.refund-tip { margin: 10px 0 16px; color: var(--muted); font-size: .82rem; }
.refund-table { min-width: 1040px; }
.approve-button { min-height: 36px; padding: 6px 13px; border: 0; border-radius: 9px; color: #fff; background: var(--red); font-weight: 800; cursor: pointer; white-space: nowrap; }
.approve-button:disabled { opacity: .55; cursor: not-allowed; }
.approval-dialog { width: min(520px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: #fff; box-shadow: 0 24px 70px rgba(5,22,37,.3); }
.approval-dialog::backdrop { background: rgba(6,24,39,.65); backdrop-filter: blur(2px); }
.approval-dialog form { padding: 21px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: #f1f5f7; font-size: 1.55rem; line-height: 1; cursor: pointer; }
.approval-summary { display: grid; gap: 7px; margin: 18px 0; padding: 14px; border: 1px solid #f2ccd2; border-radius: 13px; background: #fff7f8; }
.approval-summary strong { color: var(--red); font-size: 1.2rem; }
.approval-summary span { color: var(--muted); font-size: .82rem; }
.dialog-field { display: grid; gap: 7px; margin-top: 13px; color: var(--muted); font-size: .86rem; font-weight: 800; }
.dialog-field input { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fbfdfe; outline: 0; }
.dialog-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,103,209,.12); }
.captcha-field { display: grid; grid-template-columns: 1fr 150px; gap: 10px; align-items: end; }
.captcha-field[hidden] { display: none; }
.captcha-image-button { height: 48px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.captcha-image-button img { width: 100%; height: 100%; object-fit: cover; }
.dialog-message { min-height: 24px; margin: 10px 0 0; color: var(--red); font-size: .84rem; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 12px; }
.secondary-button, .danger-button { min-height: 48px; border: 0; border-radius: 11px; font-weight: 800; cursor: pointer; }
.secondary-button { color: var(--ink); background: #edf2f5; }
.danger-button { color: #fff; background: var(--red); }
.danger-button:disabled { opacity: .6; cursor: wait; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; }
.mobile-list { display: none; }
.empty-state { display: grid; place-items: center; gap: 3px; min-height: 170px; color: var(--muted); text-align: center; }
.empty-state span { color: var(--ink); font-size: 1rem; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .query-form { grid-template-columns: 1fr 1fr; }
  .query-form.single-day { grid-template-columns: 1fr 1fr; }
  .primary-button { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar { min-height: auto; padding: 18px 16px; align-items: flex-start; }
  .brand { gap: 11px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
  .rate-pill { display: none; }
  .page-shell { width: calc(100% - 20px); margin: 12px auto 28px; }
  .filter-panel, .content-panel { border-radius: 16px; }
  .filter-panel, .content-panel { padding: 15px; }
  .section-heading { display: block; }
  .updated-at { margin-top: 7px; white-space: normal; text-align: left; line-height: 1.3; }
  .query-form { grid-template-columns: 1fr; gap: 11px; }
  .query-form.single-day { grid-template-columns: 1fr; }
  .query-mode { display: grid; width: 100%; }
  .query-mode-button { padding-inline: 8px; }
  .primary-button { grid-column: auto; min-height: 50px; }
  .quick-ranges { display: grid; grid-template-columns: repeat(3, 1fr); }
  .quick-ranges button { padding-inline: 8px; }
  .summary-grid { grid-template-columns: 1fr; gap: 9px; margin: 12px 0; }
  .metric-card { min-height: 126px; padding: 15px; border-radius: 15px; }
  .metric-card strong { margin-top: 11px; font-size: clamp(1.45rem, 7vw, 1.8rem); overflow-wrap: anywhere; }
  .metric-card small { display: block; line-height: 1.35; }
  .tabs { max-width: none; margin-bottom: 10px; gap: 4px; }
  .tab { padding-inline: 5px; font-size: .88rem; }
  .pending-dot { top: 5px; right: 5px; }
  .panel-heading { align-items: flex-end; gap: 10px; }
  .legend { display: grid; gap: 1px; }
  .search-box { width: 46%; }
  .desktop-table-wrap { display: none; }
  .mobile-list { display: grid; gap: 10px; }
  .record-card { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfe; }
  .record-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
  .record-card h3 { margin: 0; font-size: .98rem; }
  .record-card time, .record-card .subline { color: var(--muted); font-size: .76rem; }
  .record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 13px; }
  .record-grid span { display: grid; gap: 1px; color: var(--muted); font-size: .72rem; }
  .record-grid strong { color: var(--ink); font-size: .9rem; font-weight: 800; overflow-wrap: anywhere; }
  .record-grid .wide { grid-column: 1 / -1; }
  .chart { margin-inline: -4px; padding-inline: 6px; }
  .chart-day { min-width: 44px; }
  .refund-type-switch { width: 100%; }
  .approval-dialog form { padding: 17px; }
  .captcha-field { grid-template-columns: 1fr 128px; }
}

@media (max-width: 390px) {
  .topbar { padding-inline: 12px; }
  .brand-mark { display: none; }
  .metric-card { min-height: 108px; }
  .metric-card strong { font-size: 1.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
