.upload-page {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 2.5rem 2rem 4rem;
  overflow-x: hidden;
}

.upload-page-header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2rem;
  text-align: center;
}

.upload-page-header h1 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0 auto;
  line-height: 1.15;
  text-wrap: balance;
}

@media (min-width: 901px) {
  .upload-page-header h1 {
    white-space: nowrap;
  }
}

.upload-page-header h1 em {
  font-style: italic;
  color: var(--accent);
}

.upload-container {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
  flex-wrap: wrap;
}

.preview-section {
  flex: 1 1 520px;
  min-width: 0;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
}

.preview-section-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg);
}

.preview-section-header p {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-left: auto;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-page .pdf-preview-body {
  min-height: 480px;
  max-height: 920px;
}

.upload-page .pdf-preview-loading,
.upload-page .pdf-preview-error {
  min-height: 480px;
}

.upload-page .pdf-preview-pages {
  width: 100%;
}

.upload-page .pdf-page-wrap {
  width: 100%;
  max-width: 100%;
}

.upload-page .pdf-fallback-embed,
.upload-page .pdf-fallback-object,
.upload-page .pdf-fallback-frame {
  min-height: 480px;
}

.form-section {
  flex: 0 0 400px;
  min-width: 0;
  max-width: 100%;
  position: relative;
  filter: drop-shadow(0 16px 48px rgba(44, 40, 37, 0.13));
  animation: receiptDrop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes receiptDrop {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.form-section::before {
  content: '';
  display: block;
  height: 18px;
  background: var(--bg);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='440' height='18'%3E%3Cpath d='M0 18 Q11 4 22 14 Q33 4 44 14 Q55 4 66 14 Q77 4 88 14 Q99 4 110 14 Q121 4 132 14 Q143 4 154 14 Q165 4 176 14 Q187 4 198 14 Q209 4 220 14 Q231 4 242 14 Q253 4 264 14 Q275 4 286 14 Q297 4 308 14 Q319 4 330 14 Q341 4 352 14 Q363 4 374 14 Q385 4 396 14 Q407 4 418 14 Q429 4 440 14 V0 H0 Z' fill='white'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='440' height='18'%3E%3Cpath d='M0 18 Q11 4 22 14 Q33 4 44 14 Q55 4 66 14 Q77 4 88 14 Q99 4 110 14 Q121 4 132 14 Q143 4 154 14 Q165 4 176 14 Q187 4 198 14 Q209 4 220 14 Q231 4 242 14 Q253 4 264 14 Q275 4 286 14 Q297 4 308 14 Q319 4 330 14 Q341 4 352 14 Q363 4 374 14 Q385 4 396 14 Q407 4 418 14 Q429 4 440 14 V0 H0 Z' fill='white'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  position: relative;
  z-index: 2;
}

.form-section::after {
  content: '';
  display: block;
  height: 18px;
  background: var(--bg);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='440' height='18'%3E%3Cpath d='M0 0 Q11 14 22 4 Q33 14 44 4 Q55 14 66 4 Q77 14 88 4 Q99 14 110 4 Q121 14 132 4 Q143 14 154 4 Q165 14 176 4 Q187 14 198 4 Q209 14 220 4 Q231 14 242 4 Q253 14 264 4 Q275 14 286 4 Q297 14 308 4 Q319 14 330 4 Q341 14 352 4 Q363 14 374 4 Q385 14 396 4 Q407 14 418 4 Q429 14 440 4 V18 H0 Z' fill='white'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='440' height='18'%3E%3Cpath d='M0 0 Q11 14 22 4 Q33 14 44 4 Q55 14 66 4 Q77 14 88 4 Q99 14 110 4 Q121 14 132 4 Q143 14 154 4 Q165 14 176 4 Q187 14 198 4 Q209 14 220 4 Q231 14 242 4 Q253 14 264 4 Q275 14 286 4 Q297 14 308 4 Q319 14 330 4 Q341 14 352 4 Q363 14 374 4 Q385 14 396 4 Q407 14 418 4 Q429 14 440 4 V18 H0 Z' fill='white'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
}

.form-section-inner {
  background: var(--white);
}

.form-section-header {
  padding: 2rem 1.75rem 1.75rem;
  background: var(--ink);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.form-section-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.025) 20px,
    rgba(255, 255, 255, 0.025) 40px
  );
}

.form-header-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.6rem;
  position: relative;
  z-index: 1;
}

.form-section-header h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: #fff;
  position: relative;
  z-index: 1;
}

.form-section-header p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 0.35rem;
  position: relative;
  z-index: 1;
}

.receipt-divider {
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: relative;
}

.receipt-divider::before,
.receipt-divider::after {
  content: '';
  flex: 1;
  border-top: 2px dashed var(--border);
}

.hole-left,
.hole-right {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  flex-shrink: 0;
  margin: 0 -11px;
  position: relative;
  z-index: 1;
}

.details-heading {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}

.form-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.form-group {
  margin-bottom: 1.4rem;
}

.form-group > label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.95rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.93rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--white);
}

.form-group input[readonly] {
  color: var(--ink-muted);
  cursor: default;
}

.radio-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-label {
  display: block;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 0.5rem;
  background: var(--bg);
  text-align: center;
  transition: all 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  overflow: hidden;
}

.radio-label input[type="radio"]:checked + .radio-card {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--accent);
}

.radio-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.radio-label input[type="radio"]:checked + .radio-card .radio-card-title {
  color: var(--accent);
}

.receipt-section-divider {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 1.4rem 0;
}

.radio-anim-wrap {
  width: 100%;
  max-width: 120px;
  min-height: 108px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
}

.radio-card.side-mode-card {
  overflow: visible;
}

.page-scene {
  perspective: 900px;
  width: 120px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.page-flipper {
  width: 68px;
  height: 90px;
  position: relative;
  transform-style: preserve-3d;
  animation: pageFlipAnim 5s ease-in-out infinite;
  transition: width 0.3s ease, height 0.3s ease;
}

@keyframes pageFlipAnim {
  0%, 30% {
    transform: rotateY(0deg);
  }

  44%, 58% {
    transform: rotateY(-180deg);
  }

  72%, 100% {
    transform: rotateY(0deg);
  }
}

.pf-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 3px;
  border: 1.5px solid #c4c2ba;
  background: #fff;
  transition: all 0.3s ease;
  transform-style: preserve-3d;
}

.pf-front {
  background: #fff;
}

.pf-back {
  transform: rotateY(180deg);
  border-color: #b8b5ad;
}

.pf-back.is-blank {
  background: #e8e5de;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pf-back.is-page-2 {
  background: #fff;
}

.blank-label {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a968d;
}

.pf-face .pnum,
.pf-face .ln,
.blank-label {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translate3d(0, 0, 1px);
}

.pf-face .pnum {
  position: absolute;
  top: 8%;
  left: 12%;
  font-size: 20px;
  font-weight: 700;
  color: #2c2c2a;
  line-height: 1;
  transition: all 0.3s ease;
}

.pf-face .ln {
  position: absolute;
  height: 2px;
  background: #dedad3;
  border-radius: 1px;
  left: 12%;
  transition: all 0.3s ease;
}

.l1 { top: 38%; right: 12%; }
.l2 { top: 48%; right: 24%; }
.l3 { top: 58%; right: 16%; }
.l4 { top: 68%; right: 35%; }
.l5 { top: 78%; right: 18%; }

.is-landscape .page-flipper {
  width: 90px;
  height: 68px;
}

.is-landscape .pf-face .pnum {
  font-size: 16px;
  top: 6%;
  left: 10%;
}

.is-landscape .pf-face .ln {
  left: 10%;
}

.is-landscape .l1 { top: 36%; right: 10%; }
.is-landscape .l2 { top: 46%; right: 20%; }
.is-landscape .l3 { top: 56%; right: 14%; }
.is-landscape .l4 { top: 66%; right: 30%; }
.is-landscape .l5 { top: 76%; right: 16%; }

.color-paper {
  width: 62px;
  height: 84px;
  position: relative;
  background: #fff;
  border: 1.5px solid #c4c2ba;
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
  transition: all 0.3s ease;
}

.cp-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  transition: all 0.3s ease;
}

.bw-paper .cp-header { background: #1a1a18; }
.color-paper-multi .cp-header { background: #185FA5; }

.cp-line {
  position: absolute;
  height: 2px;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.bw-paper .cp-line { background: #1a1a18; }
.color-paper-multi .cp-line { background: #dedad3; }

.cp-l1 { top: 18px; left: 7px; width: 46px; }
.cp-l2 { top: 26px; left: 7px; width: 46px; }
.cp-l3 { top: 32px; left: 7px; width: 42px; }
.cp-l4 { top: 38px; left: 7px; width: 48px; }

.cp-bar {
  position: absolute;
  bottom: 7px;
  width: 10px;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.bw-paper .cp-bar { background: #1a1a18; }

.cp-b1 { left: 7px; height: 18px; }
.cp-b2 { left: 20px; height: 12px; }
.cp-b3 { left: 33px; height: 16px; }
.cp-b4 { left: 46px; height: 9px; }

.color-paper-multi .cp-b1 { background: #E24B4A; left: 7px; height: 18px; }
.color-paper-multi .cp-b2 { background: #EF9F27; left: 20px; height: 12px; }
.color-paper-multi .cp-b3 { background: #1D9E75; left: 33px; height: 16px; }
.color-paper-multi .cp-b4 { background: #534AB7; left: 46px; height: 9px; }

.is-landscape .color-paper {
  width: 84px;
  height: 62px;
}

.is-landscape .cp-header {
  height: 10px;
}

.is-landscape .cp-l1 { top: 14px; left: 7px; width: 70px; }
.is-landscape .cp-l2 { top: 20px; left: 7px; width: 70px; }
.is-landscape .cp-l3 { top: 26px; left: 7px; width: 60px; }
.is-landscape .cp-l4 { top: 32px; left: 7px; width: 66px; }

.is-landscape .cp-bar {
  bottom: 5px;
}

.is-landscape .cp-b1 { left: 7px; height: 14px; }
.is-landscape .cp-b2 { left: 20px; height: 9px; }
.is-landscape .cp-b3 { left: 33px; height: 12px; }
.is-landscape .cp-b4 { left: 46px; height: 7px; }

.upload-page .btn-submit {
  font-size: 0.92rem;
  margin-top: 0;
}

#statusMessage {
  margin-top: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  min-height: 1.4em;
  line-height: 1.4;
}

.mobile-skip-btn {
  display: none;
}

@media (max-width: 900px) {
  .upload-page {
    padding: 1.75rem 1rem 3rem;
  }

  .upload-container {
    flex-direction: column;
  }

  .form-section {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .preview-section {
    flex: 1 1 100%;
    width: 100%;
  }

  .pdf-preview-body {
    min-height: 360px;
    max-height: 55vh;
  }

  .mobile-skip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 1.25rem;
    padding: 0.7rem 1.25rem;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
    box-shadow: 0 2px 10px rgba(44, 40, 37, 0.15);
  }

  .mobile-skip-btn:hover,
  .mobile-skip-btn:focus-visible {
    background: var(--accent);
    box-shadow: 0 4px 16px rgba(24, 95, 165, 0.3);
    outline: none;
  }

  .mobile-skip-btn:active {
    transform: scale(0.97);
  }

  .upload-page-header h1 {
    white-space: normal;
    max-width: 14em;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 480px) {
  .upload-page-header h1 {
    font-size: 1.55rem;
  }

  .radio-grid-2 {
    gap: 8px;
  }

  .radio-card {
    padding: 0.75rem 0.35rem;
    gap: 8px;
  }

  .radio-anim-wrap {
    max-width: 108px;
    min-height: 100px;
  }

  .page-scene {
    width: 108px;
    height: 100px;
  }

  .page-flipper {
    width: 60px;
    height: 80px;
  }

  .is-landscape .page-flipper {
    width: 80px;
    height: 60px;
  }

  .color-paper {
    width: 54px;
    height: 74px;
    margin: 4px 0;
  }

  .is-landscape .color-paper {
    width: 74px;
    height: 54px;
  }

  .pdf-preview-body {
    min-height: 280px;
    max-height: 50vh;
  }

  .pdf-fallback-embed,
  .pdf-fallback-object,
  .pdf-fallback-frame {
    min-height: 280px;
    height: 50vh;
  }
}
