:root {
  --bg-1: #df7e29;
  --bg-2: #f2ab3f;
  --text: #23272f;
  --muted: #8a94a3;
  --line: #e4e7ec;
  --input-bg: #f7f8fa;
  --select-bg: #f2f3f6;
  --accent-1: #d96f27;
  --accent-2: #f0a83c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(115deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
  padding: 40px 16px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.card {
  background: #fff;
  max-width: 1080px;
  margin: 0 auto;
  border-radius: 28px;
  padding: 48px clamp(24px, 6vw, 88px) 64px;
  box-shadow: 0 30px 80px rgba(110, 55, 0, 0.28);
}

.logo-box {
  width: 180px;
  height: 104px;
  border: 1px solid #cfd4dc;
  margin: 0 auto 28px;
  padding: 8px 12px;
  font-size: 22px;
  color: #111;
}

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

.logo-box:has(img) {
  border-color: transparent;
  padding: 0;
}

h1 {
  text-align: center;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 44px;
}

.field {
  margin-bottom: 30px;
}

label {
  display: block;
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 12px;
}

input,
select {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 19px 22px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder {
  color: #b9c0ca;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(240, 168, 60, 0.18);
  background: #fff;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--select-bg);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='18' viewBox='0 0 14 18'%3E%3Cpath d='M7 1 12 7H2Z M7 17 2 11h10Z' fill='%23555e6b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  border-radius: 10px;
  padding: 13px 48px 13px 20px;
  cursor: pointer;
}

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

.hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f1f2f5;
  border-radius: 5px;
  padding: 1px 5px;
}

.hint.warn {
  color: #b45309;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.address-details {
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
}

.address-details summary {
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  user-select: none;
}

.address-details[open] summary {
  margin-bottom: 22px;
}

.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.address-grid .full {
  grid-column: 1 / -1;
}

.address-grid .field {
  margin-bottom: 22px;
}

.address-grid label {
  font-size: 16px;
  margin-bottom: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-1);
  cursor: pointer;
}

.pay-btn {
  display: block;
  width: 100%;
  margin-top: 40px;
  padding: 22px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  transition: filter 0.15s, transform 0.05s;
}

.pay-btn:hover {
  filter: brightness(1.06);
}

.pay-btn:active {
  transform: translateY(1px);
}

.pay-btn:disabled {
  opacity: 0.6;
  cursor: default;
  filter: none;
}

.banner {
  margin-top: 28px;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.banner.error {
  background: #fdecec;
  border: 1px solid #f5b5b1;
  color: #b3261e;
}

.hidden {
  display: none !important;
}

/* ---- result ---- */

.result {
  margin-top: 44px;
  border-top: 1px solid var(--line);
  padding-top: 36px;
}

.result h2 {
  font-size: 25px;
  font-weight: 800;
  margin-bottom: 24px;
}

.kv {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.kv-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.kv-key {
  flex: 0 0 210px;
  font-weight: 700;
  font-size: 15.5px;
  color: #4b5563;
}

.kv-link {
  color: #c2410c;
  font-weight: 600;
  word-break: break-all;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-transform: lowercase;
}

.badge.pending {
  background: #fff4dd;
  color: #a16207;
}

.badge.success {
  background: #e5f7eb;
  color: #15803d;
}

.badge.failed {
  background: #fdecec;
  color: #b3261e;
}

.result-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  border-radius: 12px;
  padding: 14px 26px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: filter 0.15s;
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border: none;
}

.btn.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid #d4d9e0;
}

.btn:hover {
  filter: brightness(1.05);
}

#reconcileOut {
  margin-top: 20px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 13px;
  overflow-x: auto;
}

@media (max-width: 620px) {
  body {
    padding: 16px 8px;
  }

  .card {
    border-radius: 20px;
    padding-top: 32px;
  }

  .row,
  .address-grid {
    grid-template-columns: 1fr;
  }

  .kv-key {
    flex-basis: 100%;
  }
}
