:root {
  color: #19232d;
  background: #f3f5f7;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #19232d;
  --muted: #66727e;
  --line: #dce1e5;
  --surface: #ffffff;
  --accent: #087f72;
  --accent-dark: #06665c;
  --danger: #b83b3b;
  --warning: #98630d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: #f3f5f7; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.topbar {
  min-height: 68px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #202a33;
  color: #fff;
  border-bottom: 3px solid var(--accent);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--accent); border-radius: 6px; font-weight: 800; font-size: 20px; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 17px; line-height: 19px; }
.brand small { margin-top: 2px; color: #b9c2ca; font-size: 11px; }
.account-menu { display: flex; align-items: center; gap: 14px; font-size: 13px; }

.auth-band {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 440px);
  align-items: center;
  gap: 80px;
  padding: 64px max(7vw, 32px);
  background: #eef2f3;
}

.auth-copy { max-width: 640px; }
.auth-copy h1 { margin: 8px 0 16px; font-size: 48px; line-height: 1.15; letter-spacing: 0; }
.auth-copy > p:last-child { color: var(--muted); font-size: 17px; line-height: 1.8; }
.auth-panel { min-width: 0; width: 100%; padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 50px rgba(25, 35, 45, .1); }
.auth-panel form, .segmented { min-width: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 24px; background: #edf0f2; border-radius: 6px; }
.segment { min-height: 38px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.segment.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(25, 35, 45, .12); font-weight: 700; }

label { display: grid; gap: 7px; color: #47525d; font-size: 13px; }
.auth-panel label + label { margin-top: 16px; }
input, select { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid #cbd2d8; border-radius: 5px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 114, .12); }

.button { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: #273440; background: #fff; border-color: #cbd2d8; }
.button-danger { color: #fff; background: var(--danger); }
.button-quiet { color: #e9edef; background: transparent; border-color: #59636c; }
.button-block { width: 100%; margin-top: 24px; }

.dashboard { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 72px; }
.page-heading, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 26px; }
.eyebrow { margin: 0; color: var(--accent); font: 700 11px/1.4 "Segoe UI", sans-serif; letter-spacing: 1.4px; }
h1, h2 { letter-spacing: 0; }
.page-heading h1 { margin: 5px 0 0; font-size: 30px; }
.section-heading h2, .action-band h2 { margin: 4px 0 0; font-size: 19px; }

.metrics { display: grid; grid-template-columns: 1.2fr 1fr 1fr; border: 1px solid var(--line); background: #fff; }
.metric { min-width: 0; min-height: 116px; padding: 22px 24px; display: flex; flex-direction: column; justify-content: space-between; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { overflow: hidden; text-overflow: ellipsis; font-size: 25px; }
.metric-balance strong { color: var(--accent); font-size: 38px; }

.section-band { margin-top: 28px; padding: 24px 0; border-top: 1px solid var(--line); }
.recharge-form, .device-form { margin-top: 18px; display: flex; align-items: end; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); }
.recharge-form label { width: 190px; }
.recharge-estimate { min-width: 220px; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.recharge-estimate strong { color: var(--accent); font-size: 20px; }
.recharge-estimate small { font-size: 11px; }
.device-form { flex-wrap: wrap; }
.device-form label { min-width: 170px; flex: 0 1 220px; }
.device-form .grow { flex: 1 1 240px; }
.package-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.package { min-height: 158px; padding: 20px; display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.package h3 { margin: 0; font-size: 16px; }
.package-points { margin: 12px 0; color: var(--accent); font-size: 27px; font-weight: 800; }
.package-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.package-price { color: var(--muted); font-size: 14px; }
.action-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.action-controls { width: min(480px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); background: #fff; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { height: 49px; padding: 9px 14px; text-align: left; border-bottom: 1px solid #e7eaed; font-size: 13px; }
th { color: #56616b; background: #f7f8f9; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.amount-positive { color: var(--accent); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }
.status { display: inline-flex; min-width: 58px; min-height: 25px; padding: 3px 8px; align-items: center; justify-content: center; border-radius: 4px; font-size: 12px; font-weight: 700; }
.status-pending { color: #7f560d; background: #fff2d7; }
.status-paid { color: #07665b; background: #dcefeb; }
.status-cancelled { color: #7b3a3a; background: #f4e0e0; }
.empty { padding: 25px; margin: 0; color: var(--muted); text-align: center; background: #fff; border: 1px solid var(--line); border-top: 0; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(420px, calc(100vw - 48px)); padding: 13px 16px; color: #fff; background: #24313b; border-left: 4px solid var(--accent); border-radius: 5px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }
.toast.error { border-left-color: #e15c5c; }
.admin-dashboard { padding-top: 36px; }
.admin-auth-band, .credit-form { display: flex; align-items: end; gap: 14px; padding: 20px; background: #fff; border: 1px solid var(--line); }
.admin-toolbar { margin-top: 16px; display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.admin-toolbar input { flex: 1 1 260px; }
.admin-toolbar select { width: 160px; }
.detail-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.inline-form { min-width: 0; padding: 18px; display: flex; align-items: end; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); }
.inline-form h3 { width: 100%; margin: 0; font-size: 15px; }
.inline-form label { flex: 1 1 150px; }
.inline-form .grow { flex-basis: 220px; }
.admin-auth-band .grow, .credit-form .grow { flex: 1 1 300px; }
.admin-auth-band label:not(.grow) { width: 170px; }
.credit-form { flex-wrap: wrap; }
.credit-form label { flex: 1 1 180px; }
.admin-trade { width: 180px; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }

@media (max-width: 800px) {
  .topbar { padding: 0 18px; }
  .account-menu span { display: none; }
  .auth-band { min-height: auto; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 40px 20px; background: #eef2f3; }
  .auth-copy h1 { font-size: 34px; }
  .auth-panel { padding: 22px; }
  .dashboard { width: calc(100% - 28px); padding-top: 28px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { min-height: 92px; border-left: 0; border-top: 1px solid var(--line); }
  .metric:first-child { border-top: 0; }
  .package-grid { grid-template-columns: 1fr; }
  .recharge-form, .device-form, .action-band, .admin-auth-band { align-items: stretch; flex-direction: column; }
  .recharge-form label { width: 100%; }
  .recharge-estimate { min-width: 0; }
  .action-controls { grid-template-columns: 1fr; }
  .admin-auth-band .grow, .admin-auth-band label:not(.grow) { width: 100%; flex-basis: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .admin-toolbar select { width: 100%; }
}
