:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e6e9ef;
  --border-strong: #d5dae3;
  --text: #141922;
  --muted: #667085;
  --muted-2: #98a1b0;
  --primary: #1677ff;
  --primary-strong: #0b5fd8;
  --primary-soft: #eaf2ff;
  --green: #0f9f6e;
  --green-soft: #e6f7f0;
  --orange: #c2740b;
  --orange-soft: #fff4e2;
  --red: #d92d20;
  --red-soft: #fdecea;
  --purple: #7a5af8;
  --purple-soft: #f1edff;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.1);
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f1f3f7;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- 布局 ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3399ff, #1677ff);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 4px 10px rgba(22, 119, 255, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.2px;
}

.brand-text small {
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-item:hover {
  background: #f4f6fa;
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.sidebar-foot .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  flex: 0 0 8px;
}

.sidebar-foot strong {
  display: block;
  font-size: 12px;
  color: var(--text);
}

.sidebar-foot small {
  font-size: 11px;
  color: var(--muted-2);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(244, 246, 249, 0.86);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}

.account-pick select {
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 0 26px 0 0;
  height: 100%;
  max-width: 190px;
  cursor: pointer;
}

.content {
  padding: 24px 28px 64px;
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
}

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.btn:hover {
  background: #f7f9fc;
  border-color: #c3cad6;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(22, 119, 255, 0.24);
}

.btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn.danger {
  color: var(--red);
  border-color: #f2c6c2;
  background: #fff;
}

.btn.danger:hover {
  background: var(--red-soft);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: #eef1f6;
  color: var(--text);
}

.btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.icon-btn.loading svg {
  animation: spin 0.8s linear infinite;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input,
select {
  height: 36px;
  padding: 0 11px;
}

textarea {
  padding: 9px 11px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.field > span em {
  color: var(--red);
  font-style: normal;
}

.field .hint {
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.5;
}

.form-error {
  margin: 0;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12.5px;
}

/* ---------- 卡片 / 统计 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}

.card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.card-body {
  padding: 18px 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
}

.stat .label {
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat .value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat .value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 1px;
}

.stat .sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted-2);
}

.stat .spark {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: 0.7;
}

.stat.green .spark {
  background: var(--green-soft);
}

.stat.orange .spark {
  background: var(--orange-soft);
}

.stat.purple .spark {
  background: var(--purple-soft);
}

.stat .badge {
  margin-left: auto;
}

/* ---------- 图表 ---------- */
.chart-card {
  margin-bottom: 18px;
}

.legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}

.chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 190px;
  padding-top: 8px;
}

.chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.bars {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.bar {
  width: 42%;
  max-width: 15px;
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #5aa6ff, #1677ff);
  transition: filter 0.15s;
  cursor: default;
}

.bar.refund {
  background: linear-gradient(180deg, #ffc266, #f59e0b);
}

.chart-col:hover .bar {
  filter: brightness(1.08);
}

.chart-x {
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  height: 15px;
}

.chart-x.today {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #eff2f6;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fafbfe;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-main {
  font-weight: 500;
}

.cell-sub {
  color: var(--muted-2);
  font-size: 11.5px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.green {
  color: var(--green);
}

.red {
  color: var(--red);
}

.amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount.plus {
  color: var(--green);
}

.amount.minus {
  color: var(--red);
}

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: #f1f3f7;
  color: var(--muted);
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge.no-dot::before {
  display: none;
}

.badge.paid,
.badge.success,
.badge.real {
  background: var(--green-soft);
  color: var(--green);
}

.badge.partial,
.badge.processing,
.badge.sandbox {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.refunded,
.badge.mock {
  background: var(--purple-soft);
  color: var(--purple);
}

.badge.closed,
.badge.failed {
  background: var(--red-soft);
  color: var(--red);
}

.badge.pending,
.badge.unknown {
  background: #eef1f6;
  color: #5b6472;
}

/* ---------- 工具栏 / 过滤器 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar .field {
  gap: 4px;
}

.toolbar .field > span {
  font-size: 11.5px;
}

.toolbar .grow {
  flex: 1;
  min-width: 180px;
}

.toolbar .spacer {
  flex: 1;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.summary-line b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.pagination .pages {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pagination .page-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.pagination .page-size select {
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

/* ---------- 空状态 / 加载 ---------- */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  color: var(--muted-2);
}

.empty .icon svg {
  width: 22px;
  height: 22px;
}

.empty strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

.empty p {
  margin: 0;
  font-size: 12.5px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 70px 0;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #dbe2ec;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 账号卡片 ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.account-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-card .top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.account-card .avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  flex: 0 0 38px;
}

.account-card h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.account-card .appid {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.account-card .metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 9px;
}

.account-card .metric {
  min-width: 0;
}

.account-card .metric span {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
}

.account-card .metric strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card .actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.account-card.inactive {
  opacity: 0.66;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fade 0.15s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(600px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  animation: pop 0.18s ease;
  overflow: hidden;
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
  }
}

.modal.wide {
  width: min(760px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

.modal-head p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.modal-close:hover {
  background: #eef1f6;
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-section {
  margin: 4px 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ---------- 订单详情 / 退款弹窗 ---------- */
.kv {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

.refund-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

.refund-summary div span {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
}

.refund-summary div strong {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--orange-soft);
  color: #8a5306;
  margin-top: 14px;
}

.notice.info {
  background: var(--primary-soft);
  color: #14549e;
}

.notice.danger {
  background: var(--red-soft);
  color: var(--red);
}

.security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.qr-wrap svg {
  width: 220px;
  height: 220px;
  stroke: none;
}

.qr-wrap svg * {
  stroke: none;
}

.qr-wrap svg rect {
  fill: #fff;
}

.qr-wrap svg path {
  fill: #111827;
}

.secret-key {
  display: block;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  word-break: break-all;
}

.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.recovery-grid code {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-align: center;
}

.amount-input {
  position: relative;
}

.amount-input input {
  padding-left: 28px;
  font-size: 16px;
  font-weight: 600;
  height: 42px;
  font-variant-numeric: tabular-nums;
}

.amount-input::before {
  content: "¥";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

.quick-amounts {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.quick-amounts button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
}

.quick-amounts button:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.refund-list {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.refund-list h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.refund-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}

.refund-item:last-child {
  border-bottom: 0;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  max-width: min(380px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #111827;
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  animation: slide 0.2s ease;
}

@keyframes slide {
  from {
    transform: translateX(14px);
    opacity: 0;
  }
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #991b1b;
}

.toast .ico {
  flex: 0 0 18px;
  font-weight: 700;
}

/* ---------- 登录 ---------- */
.login-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 20% 0%, #e8f1ff 0%, #f4f6f9 55%, #eef1f6 100%);
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(16, 24, 40, 0.14);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}

.login-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.login-brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.login-hint {
  margin: 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 11.5px;
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar .date-presets {
  min-height: 36px;
  align-items: center;
}

.chip {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
}

.link-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.link-btn:hover .cell-main {
  color: var(--primary);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.progress {
  height: 8px;
  background: #e8edf5;
  border-radius: 99px;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3399ff, #1677ff);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.progress.partial > i {
  background: linear-gradient(90deg, #f5b942, #c2740b);
}

.job-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 12px;
}

.job-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.job-card-head strong {
  font-size: 13.5px;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.sync-banner {
  margin: 0 28px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid #cfe0ff;
  background: var(--primary-soft);
  color: #14549e;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.sync-banner.hidden {
  display: none !important;
}

.sync-banner .progress {
  flex: 1;
  min-width: 120px;
  background: #d6e6ff;
}

.sync-banner .banner-text {
  flex: 1 1 220px;
  font-size: 12.5px;
  line-height: 1.45;
}

.sync-banner .banner-text strong {
  display: block;
  font-size: 13px;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .sidebar {
    width: 76px;
    flex-basis: 76px;
    padding: 18px 10px;
  }

  .brand {
    justify-content: center;
    padding: 2px 0 20px;
  }

  .brand-text,
  .nav-item span,
  .sidebar-foot {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 11px 0;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .topbar {
    padding: 15px 20px;
  }

  .sync-banner {
    margin: 12px 20px 0;
  }

  .content {
    padding: 20px 20px 60px;
  }
}

@media (max-width: 720px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    height: 62px;
    flex-basis: auto;
    z-index: 50;
    padding: 6px 8px;
    border-right: 0;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
  }

  .brand {
    display: none;
  }

  .nav {
    flex-direction: row;
    height: 100%;
    gap: 2px;
  }

  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
    font-size: 10px;
    border-radius: 8px;
  }

  .nav-item span {
    display: block;
  }

  .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .main {
    padding-bottom: 68px;
  }

  .topbar {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .topbar h2 {
    font-size: 16px;
  }

  .topbar p {
    display: none;
  }

  .topbar-right {
    gap: 7px;
  }

  .account-pick {
    height: 33px;
    padding-left: 9px;
  }

  .account-pick > span {
    display: none;
  }

  .account-pick select {
    font-size: 12px;
    max-width: 130px;
  }

  .content {
    padding: 14px 14px 30px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat {
    padding: 14px;
  }

  .stat .value {
    font-size: 21px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    padding: 12px;
  }

  .toolbar .grow {
    min-width: 100%;
  }

  .chart {
    height: 150px;
  }

  .refund-summary {
    grid-template-columns: 1fr 1fr;
  }

  .modal-mask {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
}