:root {
  --ink: #17211f;
  --muted: #63706d;
  --line: #dce4dd;
  --panel: #ffffff;
  --bg: #f5f7f4;
  --accent: #0f766e;
  --warm: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.45;
}

.shell {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.hero + .account {
  margin-top: 0;
}

.hero > div:first-child,
.summary,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero > div:first-child {
  padding: 18px 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 850;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.28;
}

.hero p {
  max-width: 920px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.hero-links {
  margin-top: 10px !important;
}

.hero-links a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
}

.summary span,
.summary small,
label,
.metric-grid span,
.key-box span {
  color: var(--muted);
}

.summary strong {
  display: block;
  margin: 5px 0;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  padding: 14px 18px;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

button:disabled {
  border-color: var(--line);
  background: #eef2ef;
  color: var(--muted);
  cursor: not-allowed;
}

.account {
  margin-bottom: 12px;
}

.profile {
  margin-bottom: 12px;
}

.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.account-head h2 {
  margin-bottom: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.profile-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8faf7;
}

.profile-card.main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.profile-card span,
.profile-actions label span {
  color: var(--muted);
  font-size: 12px;
}

.profile-card strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.profile-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1.2fr) auto minmax(150px, 0.8fr) minmax(150px, 0.8fr) auto;
  gap: 8px;
  align-items: end;
}

.profile-actions label {
  margin-bottom: 0;
}

.metric-grid > div,
.key-box,
.usage-item,
.package-card,
.order-item,
.device-item,
.device-bind {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8faf7;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.key-box {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

code {
  overflow-wrap: anywhere;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.notice {
  margin: 8px 0 0;
  color: var(--warm);
  font-weight: 800;
}

.usage-list {
  display: grid;
  gap: 8px;
}

.usage-item,
.order-item,
.device-item,
.device-bind {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.usage-item strong,
.package-title strong,
.order-item strong {
  color: var(--accent);
}

.packages,
.orders,
.devices {
  margin-bottom: 12px;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.package-card {
  display: grid;
  gap: 10px;
}

.package-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.package-title span,
.status {
  border-radius: 999px;
  background: #e9f7f3;
  color: var(--accent);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.package-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.package-metrics > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.package-metrics span,
.order-item span,
.order-item small,
.hint {
  color: var(--muted);
}

.package-metrics strong,
.order-side strong {
  display: block;
  margin-top: 4px;
}

.package-card p,
.hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.hint {
  margin-top: 10px;
}

.order-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 180px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.order-actions button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.device-bind {
  align-items: center;
  margin-bottom: 10px;
}

.device-bind strong,
.device-item strong {
  display: block;
  color: var(--accent);
}

.device-bind p,
.device-item span,
.device-item small {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 360px;
}

.link-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.status.paid {
  background: #fff7ed;
  color: var(--warm);
}

.status.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.status.fulfilled {
  background: #dcfce7;
  color: #15803d;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.pay-modal[hidden] {
  display: none;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.pay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.pay-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.pay-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pay-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8faf7;
}

.pay-summary span,
.pay-box p {
  color: var(--muted);
}

.pay-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.pay-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pay-method {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.pay-method.active {
  border-color: var(--method-color, var(--accent));
  background: var(--method-color, var(--accent));
  color: #fff;
}

.pay-box {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf7;
}

.qr-box,
.qr-placeholder {
  display: grid;
  aspect-ratio: 1;
  width: 180px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: var(--warm);
  font-weight: 900;
  text-align: center;
}

.pay-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}

.pay-box p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.pay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 820px) {
  .hero,
  .grid,
  .metric-grid,
  .profile-grid,
  .profile-actions,
  .package-grid,
  .pay-summary,
  .pay-box {
    grid-template-columns: 1fr;
  }

  .key-box,
  .usage-item,
  .order-item,
  .device-item,
  .device-bind,
  .account-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-side {
    justify-items: start;
    min-width: 0;
  }

  .order-actions {
    justify-content: flex-start;
  }

  .device-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .qr-box,
  .qr-placeholder {
    width: 100%;
    max-width: 240px;
  }
}
