*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
  background: #f1f5f9;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.card {
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
}

.section-grid {
  display: grid;
  gap: 18px;
}

.grid-2col {
  grid-template-columns: 1.4fr 1fr;
}

.grid-equal {
  grid-template-columns: 1fr 1fr;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: #6b7280;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #111827;
  background: #fff;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25);
}

.field input.invalid,
.field textarea.invalid {
  border-color: #dc2626;
}

.field-error {
  font-size: 12px;
  color: #dc2626;
  min-height: 16px;
}

.parse-section .parse-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.parse-section .parse-desc {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.parse-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-secondary {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.btn-primary {
  background: #111827;
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-lg {
  padding: 12px 18px;
}

.parse-textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.parse-banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.parse-banner.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.parse-banner.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.parse-banner.info {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.review-hint {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
  font-size: 13px;
  color: #334155;
}

.review-hint dt {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.review-hint dd {
  margin: 0 0 10px;
}

.review-hint dd:last-child {
  margin-bottom: 0;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.status-pending {
  color: #b45309;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.copyable {
  user-select: all;
}

/* Result view — mobile-first */
.page-result {
  max-width: 480px;
  padding: 0;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: #eef2f7;
  min-height: 100dvh;
}

.result-mobile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.result-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 2px 0;
}

.result-topbar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.result-topbar p {
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.status-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #fdba74;
}

.amount-card {
  background: linear-gradient(135deg, #111827 0%, #1e293b 100%);
  color: #fff;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.amount-label {
  font-size: 12px;
  opacity: 0.75;
}

.amount-value {
  margin-top: 4px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.amount-meta {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.88;
  line-height: 1.4;
}

.meta-strip {
  background: #fff;
  border-radius: 12px;
  padding: 4px 14px;
  border: 1px solid #e2e8f0;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-k {
  color: #64748b;
  flex-shrink: 0;
}

.meta-v {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  color: #0f172a;
}

.section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.section-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.progress-v,
.tips-card,
.address-section {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
}

.progress-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.progress-timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}

.progress-timeline-item:last-child {
  padding-bottom: 0;
}

.progress-timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.progress-timeline-item.done::after {
  background: #7dd3fc;
}

.progress-timeline-item .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
  border: 2px solid #cbd5e1;
  background: #fff;
  z-index: 1;
}

.progress-timeline-item.done .dot {
  border-color: #0ea5e9;
  background: #0ea5e9;
}

.progress-timeline-item.current .dot {
  border-color: #ea580c;
  background: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

.progress-timeline-item .tl-label {
  font-size: 11px;
  color: #64748b;
}

.progress-timeline-item.done .tl-label {
  color: #0f766e;
}

.progress-timeline-item.current .tl-label {
  color: #c2410c;
  font-weight: 600;
}

.progress-timeline-item .tl-title {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
}

.address-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.addr-card {
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #e2e8f0;
}

.addr-card--sender {
  background: #fff7ed;
  border-color: #fdba74;
}

.addr-card--receiver {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.addr-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.addr-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

.addr-tag--sender {
  background: #ffedd5;
  color: #c2410c;
}

.addr-tag--receiver {
  background: #e0f2fe;
  color: #0369a1;
}

.btn-copy {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.addr-card--sender .btn-copy {
  border-color: #fdba74;
  background: #fff;
  color: #c2410c;
}

.addr-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.addr-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.addr-phone {
  font-size: 15px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  flex-shrink: 0;
}

.addr-company,
.addr-region,
.addr-detail,
.addr-postal {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
}

.addr-detail {
  font-weight: 600;
  color: #0f172a;
}

.addr-postal {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 0;
}

.addr-line-empty {
  display: none;
}

.tips-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #475569;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  max-width: calc(100% - 32px);
  text-align: center;
}

@media (min-width: 768px) {
  .page-result {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    min-height: auto;
    border-radius: 12px;
    margin-top: 24px;
    margin-bottom: 40px;
  }

  .result-mobile {
    padding: 16px;
    gap: 14px;
  }

  .amount-value {
    font-size: 36px;
  }
}

@media (max-width: 900px) {
  .grid-2col,
  .grid-equal,
  .field-grid-2 {
    grid-template-columns: 1fr;
  }

  .parse-toolbar {
    flex-direction: column;
  }

  .parse-actions {
    width: 100%;
  }

  .parse-actions .btn {
    flex: 1;
  }
}
