:root {
  color: #20272c;
  background: #f3f5f6;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #f3f5f6;
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #fff;
  background: #20272c;
  border-bottom: 3px solid #087e8b;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 32px; height: 32px; }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 18px; }
.brand span { color: #cbd3d6; font-size: 13px; }

.service-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dfe5e7;
  font-size: 14px;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d29f3b;
}

.service-state[data-state="ready"] .state-dot { background: #3ca36b; }
.service-state[data-state="error"] .state-dot { background: #d45b52; }

.page-shell {
  width: min(960px, calc(100% - 32px));
  margin: 48px auto;
  align-self: start;
}

.auth-panel, .dashboard {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #d9dfe1;
  border-radius: 6px;
  box-shadow: 0 12px 30px rgb(28 39 45 / 8%);
}

.dashboard { max-width: 820px; }

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #d9dfe1;
}

.mode-tab {
  min-height: 48px;
  border: 0;
  color: #59646a;
  background: #f6f8f8;
}

.mode-tab.is-active {
  color: #075f69;
  background: #fff;
  box-shadow: inset 0 -3px #087e8b;
  font-weight: 700;
}

.account-form { padding: 30px; display: grid; gap: 10px; }
.account-form h1, .account-heading h1 { margin: 0 0 12px; font-size: 23px; letter-spacing: 0; }
.account-form label { margin-top: 6px; color: #465158; font-size: 14px; font-weight: 600; }

.account-form input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #b9c3c7;
  border-radius: 4px;
  color: #20272c;
  background: #fff;
  outline: none;
}

.account-form input:focus { border-color: #087e8b; box-shadow: 0 0 0 3px rgb(8 126 139 / 13%); }

.primary-button, .secondary-button {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button { color: #fff; background: #087e8b; }
.primary-button:hover { background: #066b75; }
.secondary-button { color: #2e3a40; background: #fff; border-color: #aeb9bd; }
.secondary-button:hover { background: #eef2f3; }
.account-form .primary-button { margin-top: 14px; width: 100%; }

.form-message { min-height: 24px; margin: 0; padding: 0 30px 20px; color: #b33c35; font-size: 14px; }
.form-message[data-tone="ok"] { color: #187a49; }

.account-heading {
  padding: 26px 30px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid #d9dfe1;
}

.account-heading p { margin: 0; color: #68747a; }
.eyebrow { display: block; margin-bottom: 6px; color: #68747a; font-size: 13px; }

.balance-band {
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: #263238;
}

.balance-band span { display: block; color: #cbd3d6; font-size: 14px; }
.balance-band strong { display: block; margin-top: 4px; font-size: 34px; letter-spacing: 0; }
.balance-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.service-details {
  padding: 22px 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #d9dfe1;
}

.service-details div { min-width: 0; padding: 14px; background: #fff; }
.service-details span { display: block; color: #68747a; font-size: 13px; }
.service-details strong { display: block; margin-top: 6px; overflow-wrap: anywhere; }
.dashboard .form-message { padding-top: 18px; }
.is-hidden { display: none !important; }

footer { padding: 20px; color: #778287; text-align: center; font-size: 13px; }

@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .service-state { margin-top: 6px; }
  .page-shell { margin: 24px auto; }
  .account-form, .account-heading, .balance-band { padding: 22px; }
  .account-heading, .balance-band { align-items: stretch; flex-direction: column; }
  .balance-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .service-details { grid-template-columns: 1fr; padding: 1px; }
}
