:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647084;
  --line: #dfe5ef;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --warning: #a15c07;
  --success: #147a42;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 260px),
    var(--bg);
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row,
.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-all;
}

.brand-row p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.pending,
.status-pill.crediting {
  color: var(--warning);
  border-color: #f3d7a8;
  background: #fff8eb;
}

.status-pill.credited {
  color: var(--success);
  border-color: #b8e1c7;
  background: #effaf2;
}

.status-pill.expired,
.status-pill.credit_failed {
  color: var(--danger);
  border-color: #fac5bd;
  background: #fff1ef;
}

.form-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
}

fieldset {
  grid-column: 1 / -1;
  border: 0;
  padding: 0;
}

label span,
legend,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  color: var(--text);
  background: #ffffff;
  font-size: 15px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #f8fafc;
  font-size: 14px;
}

.segmented input:checked + span {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #ecfdf7;
  font-weight: 700;
}

button {
  height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.form-grid button {
  grid-column: 1 / -1;
}

.secondary {
  flex: 0 0 78px;
  color: var(--primary-dark);
  background: #e7f6f3;
}

.secondary:hover {
  background: #d5eee9;
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.pay-layout {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 22px;
}

.qr-wrap {
  width: 276px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.qr-wrap img {
  display: block;
  width: 100%;
  height: 100%;
}

.pay-details {
  display: grid;
  gap: 12px;
  align-content: start;
}

.amount-block {
  border: 1px solid #b8e1c7;
  border-radius: 8px;
  padding: 16px;
  background: #effaf2;
}

.amount-block span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.amount-block strong {
  display: block;
  margin-top: 6px;
  color: var(--success);
  font-size: 28px;
  line-height: 1.15;
  word-break: break-all;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  font-size: 14px;
}

.detail-row span {
  color: var(--muted);
}

.detail-row b {
  text-align: right;
  word-break: break-all;
}

.address-box {
  margin-top: 18px;
}

.address-box div {
  display: flex;
  gap: 10px;
}

.notice {
  margin-top: 14px;
  color: var(--warning);
  background: #fff8eb;
  border: 1px solid #f3d7a8;
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.tx-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 980px);
    padding: 20px 0;
  }

  .panel {
    padding: 18px;
  }

  .brand-row,
  .order-header {
    display: grid;
  }

  h1 {
    font-size: 26px;
  }

  .form-grid,
  .pay-layout {
    grid-template-columns: 1fr;
  }

  .qr-wrap {
    width: min(100%, 276px);
    margin: 0 auto;
  }

  .amount-block strong {
    font-size: 24px;
  }
}
