:root {
  --bg: #eef2f3;
  --surface: #ffffff;
  --ink: #152326;
  --muted: #68777b;
  --line: #d5dddf;
  --deep: #10292b;
  --teal: #0d766c;
  --teal-soft: #e3f1ed;
  --blue: #1e6fa3;
  --blue-soft: #e7f2f8;
  --amber: #b96d08;
  --amber-soft: #fbf0df;
  --danger: #ad3c34;
  --danger-soft: #fbe9e7;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  background: var(--deep);
  color: #fff;
  border-bottom: 3px solid #15937f;
}

.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius);
  color: #8be0cc;
  font-size: 18px;
  font-weight: 750;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 1px;
  color: #bad0cb;
  font-size: 11px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #cde0dc;
  font-size: 12px;
}

.live-state span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e1a446;
  box-shadow: 0 0 0 3px rgba(225, 164, 70, 0.14);
}

.live-state.is-online span {
  background: #4ed3ae;
  box-shadow: 0 0 0 3px rgba(78, 211, 174, 0.14);
}

.live-state.is-error span {
  background: #ff8d82;
  box-shadow: 0 0 0 3px rgba(255, 141, 130, 0.14);
}

.text-action {
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.text-action:hover {
  border-bottom-color: #fff;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.icon-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

main {
  padding-top: 28px;
  padding-bottom: 24px;
}

.overview,
.accounts {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.overview {
  margin-bottom: 18px;
}

.overview-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.overview-head p,
.section-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.period-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(62px, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f6f6;
}

.period-button {
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 650 12px/1 "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer;
}

.period-button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(22, 37, 40, 0.12);
}

.metric-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.primary-metric {
  padding: 24px 22px;
  border-right: 1px solid var(--line);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.primary-metric strong {
  display: block;
  margin-top: 5px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.split-track {
  height: 8px;
  display: flex;
  overflow: hidden;
  margin-top: 18px;
  border-radius: 2px;
  background: #edf1f1;
}

.split-track span {
  width: 0;
  transition: width 280ms ease;
}

.split-down {
  background: var(--blue);
}

.split-up {
  background: var(--amber);
}

.side-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}

.side-metrics > div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.side-metrics > div:last-child {
  border-right: 0;
}

.side-metrics strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.35;
}

.section-meta {
  color: var(--muted);
  font-size: 12px;
}

.account-table {
  border-top: 1px solid var(--line);
}

.table-head,
.account-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.05fr) minmax(165px, 1.1fr) minmax(180px, 1.25fr) minmax(140px, 0.9fr) 42px;
  column-gap: 22px;
  align-items: center;
}

.table-head {
  min-height: 40px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-row {
  min-height: 100px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.account-row:last-child {
  border-bottom: 0;
}

.account-name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.account-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-name strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

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

.status.is-off {
  color: var(--danger);
}

.period-value strong,
.quota-value strong,
.reset-value strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}

.sub-value {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.usage-bar {
  height: 6px;
  overflow: hidden;
  margin-top: 8px;
  border-radius: 2px;
  background: #e9eeee;
}

.usage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #31a88f);
  transition: width 280ms ease;
}

.usage-bar span.is-warning {
  background: linear-gradient(90deg, var(--amber), #d8a347);
}

.usage-bar span.is-danger {
  background: linear-gradient(90deg, var(--danger), #d76b62);
}

.copy-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.copy-button:hover {
  border-color: #a9b8bb;
  color: var(--ink);
  background: #f5f7f7;
}

.copy-button svg {
  width: 15px;
  height: 15px;
}

.empty-state {
  padding: 42px 22px;
  color: var(--muted);
  text-align: center;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 2px;
  padding-bottom: 28px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  .metric-band {
    grid-template-columns: 1fr;
  }

  .primary-metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .table-head {
    display: none;
  }

  .account-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px 18px;
    padding-block: 20px;
  }

  .account-name {
    grid-column: 1;
    grid-row: 1;
  }

  .copy-button {
    grid-column: 2;
    grid-row: 1;
  }

  .period-value,
  .quota-value,
  .reset-value {
    grid-column: 1 / -1;
  }

  .period-value,
  .quota-value,
  .reset-value {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .period-value::before,
  .quota-value::before,
  .reset-value::before {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.035em;
    text-transform: uppercase;
  }

  .period-value::before {
    content: "所选周期";
  }

  .quota-value::before {
    content: "额度使用";
  }

  .reset-value::before {
    content: "下次重置";
  }

  .usage-bar {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 24px, 1160px);
  }

  .topbar-inner {
    min-height: 64px;
  }

  .live-state {
    display: none;
  }

  .overview-head,
  .section-head {
    flex-direction: column;
  }

  .period-switch {
    width: 100%;
  }

  .side-metrics {
    grid-template-columns: 1fr;
  }

  .side-metrics > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-metrics > div:last-child {
    border-bottom: 0;
  }

  .side-metrics strong {
    margin-top: 0;
  }

  .primary-metric strong {
    font-size: 30px;
  }

  .page-footer {
    display: block;
  }

  .page-footer span {
    display: block;
    margin-top: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .split-track span,
  .usage-bar span {
    transition: none;
  }
}
