:root {
  --brand: #bf360c;
  --brand-2: #ff6d3b;
  --grad: linear-gradient(135deg, #bf360c 0%, #ff8a50 100%);
  --bg: #f6f2ee;
  --card: #ffffff;
  --ink: #2a241f;
  --muted: #8a7f76;
  --line: #ece4dd;
  --ok: #1e8e4e;
  --err: #c5221f;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(120, 60, 20, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.app { max-width: 520px; margin: 0 auto; }

.hidden { display: none !important; }

/* header */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: rgba(246,242,238,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.status { margin: 2px 0 0; font-size: 11px; color: var(--ok); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 6px var(--ok); }
.ghost-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ghost-btn:active { transform: scale(.97); }

/* hero */
.hero { padding: 22px 18px 6px; }
.hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

main { padding: 14px 16px 120px; }
.banner-closed { background: #fdecea; color: var(--err); padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; margin-bottom: 16px; border: 1px solid var(--line);
}
.card h3 { margin: 0 0 16px; font-size: 16px; font-weight: 800; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px;
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { resize: vertical; min-height: 70px; }
.err { display: block; color: var(--err); font-size: 12px; margin-top: 4px; font-style: normal; min-height: 0; }

/* stepper */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-size: 22px; font-weight: 700; color: var(--brand); cursor: pointer;
}
.stepper input {
  text-align: center; font-weight: 700; width: 90px; flex: none;
}

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chips button.selected { background: var(--grad); color: #fff; border-color: transparent; }

/* upload box */
.upload-box {
  display: block; border: 2px dashed var(--line); border-radius: 16px; padding: 26px 16px;
  text-align: center; cursor: pointer; background: #fdfbf9; transition: border-color .2s;
}
.upload-box b { display: block; font-size: 28px; margin-bottom: 6px; }
.upload-box p { margin: 0; font-weight: 700; font-size: 15px; }
.upload-box small { color: var(--muted); font-size: 12px; }
.upload-box.has-file { border-color: var(--ok); background: #f2faf5; }
.upload-box:active { transform: scale(.99); }

/* file preview */
.file-preview {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: #fdfbf9; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
.df-ic {
  width: 42px; height: 42px; border-radius: 10px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; letter-spacing: .3px;
}
.fpi { flex: 1; min-width: 0; }
.fpi b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpi p { margin: 0; }
.mini-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  color: var(--err); font-size: 20px; line-height: 1; cursor: pointer; flex: none;
}

/* summary */
.row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row span { color: var(--muted); }
.row b { font-weight: 700; text-align: right; }
.row.total { font-size: 16px; font-weight: 800; color: var(--brand); }
.row.total span { color: var(--brand); }
.row.total b { font-size: 20px; }

/* payment */
.pay-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.pay-method b { font-size: 16px; display: block; }
.pay-no { color: var(--muted); font-size: 14px; letter-spacing: .5px; }

.security-note { background: #fff8e8; border: 1px solid #f0dcae; border-radius: 14px; padding: 14px 16px; color: #7a5b00; font-size: 13px; margin-bottom: 16px; }
.security-note p { margin: 2px 0; }

/* CTA */
.cta {
  width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 16px; font-weight: 800;
  color: #fff; background: var(--grad); cursor: pointer; box-shadow: 0 10px 24px rgba(191,54,12,.35);
}
.cta:disabled { filter: grayscale(.7); opacity: .6; cursor: not-allowed; box-shadow: none; }
.cta:active { transform: scale(.98); }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.submit-wrap { margin-top: 8px; }
.submit-wrap .cta { width: 100%; }

/* overlay / modal */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(30,20,15,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px);
}
.modal {
  background: #fff; border-radius: 22px; max-width: 480px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-ic { width: 60px; height: 60px; border-radius: 18px; background: #fff3e5; color: #f57c00; display: grid; place-items: center; font-size: 30px; margin: 0 auto 14px; }
.modal-ic.ok { background: #e6f7ee; color: var(--ok); }
.modal-title { text-align: center; margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.modal-sub { text-align: center; margin: 0 0 14px; color: var(--brand); font-weight: 700; font-size: 14px; }
.modal-body { font-size: 14px; margin: 10px 0; }
.modal-body p { margin: 8px 0; }
.modal-body .warn { background: #fff3e0; color: #8a4b00; padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.point-list { margin: 12px 0; padding-left: 4px; list-style: none; }
.point-list li { padding: 5px 0; }
.agree { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; font-size: 14px; }
.agree input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); }
.warn-note { background: #fff3e0; color: #8a4b00; border-radius: 12px; padding: 12px; font-size: 13px; font-weight: 600; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal-actions .cta, .modal-actions .ghost-btn { width: 100%; text-align: center; text-decoration: none; }

/* processing */
.loading-box { background: #fff; border-radius: 20px; padding: 30px; text-align: center; min-width: 200px; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%; margin: 0 auto 14px;
  border: 4px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%);
  background: rgba(30,20,15,.92); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 99; max-width: 90%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

@media (min-width: 640px) {
  body { padding-top: 16px; }
  .app { background: var(--card); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.08); }
}
