:root {
  --ink: #17201c;
  --muted: #66716b;
  --line: #d9dfdb;
  --surface: #ffffff;
  --canvas: #f4f6f4;
  --accent: #157347;
  --accent-dark: #0f5736;
  --warning: #a46200;
  --danger: #a12b2b;
  --focus: #1769aa;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
}

a {
  color: var(--accent-dark);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.nav-shell,
.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.nav-shell {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a,
.link-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 6px 10px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.nav-links a:hover,
.link-button:hover {
  color: var(--accent-dark);
  background: #edf4ef;
}

.inline-form {
  display: inline;
  margin: 0;
}

.page-shell {
  padding: 36px 0 64px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

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

.message-list {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.message {
  padding: 10px 12px;
  border-left: 4px solid var(--focus);
  background: var(--surface);
}

.message.error {
  border-left-color: var(--danger);
}

.product-list,
.summary-grid {
  display: grid;
  gap: 16px;
}

.product {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.product-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.plan-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.6fr) minmax(140px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 14px 22px;
  border-bottom: 1px solid #edf0ee;
}

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

.platform-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag,
.status {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #39453f;
  background: #f7f8f7;
  font-size: 12px;
  white-space: nowrap;
}

.status.active,
.status.paid,
.status.confirmed {
  border-color: #add0bc;
  color: var(--accent-dark);
  background: #edf7f1;
}

.status.pending {
  border-color: #e2c48f;
  color: var(--warning);
  background: #fff8eb;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

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

.button.secondary:hover {
  border-color: #aeb8b2;
  background: #f1f4f2;
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

.section-band {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.section-band:first-child {
  border-top: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8ece9;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4b5751;
  background: #f7f8f7;
  font-size: 13px;
  font-weight: 600;
}

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

.form-panel {
  width: min(520px, 100%);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #b9c2bd;
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}

.errorlist {
  margin: 5px 0 0;
  padding: 0;
  color: var(--danger);
  list-style: none;
  font-size: 13px;
}

.license-output {
  padding: 14px;
  border: 1px solid #a9c8b6;
  border-radius: 5px;
  background: #f0f8f3;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
}

.payment-address {
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
}

.payment-countdown {
  display: inline-block;
  margin-left: 10px;
  color: var(--warning);
}

.payment-qr {
  display: inline-flex;
  flex-direction: column;
  margin-top: 14px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  line-height: 0;
}

.payment-qr-row {
  display: flex;
  height: 4px;
}

.payment-qr-cell {
  display: block;
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  background: #ffffff;
}

.payment-qr-cell.is-dark {
  background: #000000;
}

.payment-notice {
  margin: 12px 0 0;
  color: var(--warning);
}

.payment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.payment-actions form {
  margin: 0;
}

.status.processing,
.status.verify_pending {
  border-color: #9dbfd8;
  color: #18577f;
  background: #eef7fc;
}

.status.partially_paid,
.status.expired,
.status.failed,
.status.refunded,
.status.create_failed,
.status.create_unknown,
.status.manual_review {
  border-color: #dbadad;
  color: var(--danger);
  background: #fff2f2;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #bcc5c0;
  border-radius: 6px;
  color: var(--muted);
  background: #fafbfa;
}

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

  .nav-shell,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-shell {
    padding: 14px 0;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .page-shell {
    padding-top: 24px;
  }

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