:root {
  --green: #0f6b3f;
  --green-dark: #0a4f2e;
  --green-soft: #e7f3ec;
  --ink: #14201a;
  --muted: #5f6b65;
  --line: #dfe5e1;
  --bg: #f5f7f6;
  --card: #ffffff;
  --amber: #b26a00;
  --amber-soft: #fff4e0;
  --red: #b42318;
  --red-soft: #fdecea;
  --blue: #1d5fa8;
  --blue-soft: #e8f0fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--green); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }
.wide { max-width: 1100px; }

.topbar { background: var(--green); color: #fff; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; color: #fff; text-decoration: none; }
.brand-mark { min-width: 36px; height: 30px; padding: 0 5px; border-radius: 8px; background: #fff; color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.topbar .who { font-size: .8rem; opacity: .85; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-top: 16px; }
.hero { padding: 28px 0 4px; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 10px 0; }
.steps li::before { content: counter(s); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }

.address { display: flex; gap: 8px; align-items: center; background: var(--green-soft); border-radius: 10px; padding: 10px 12px; margin: 8px 0 4px; }
.address code { flex: 1; font-size: 1rem; font-weight: 600; color: var(--green-dark); word-break: break-all; font-family: inherit; }

.btn {
  appearance: none; border: 0; border-radius: 10px; padding: 12px 16px; font: inherit; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  min-height: 44px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-warn { background: var(--amber); color: #fff; }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }

input, select, textarea {
  font: inherit; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: transparent; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.price b { font-size: 1.4rem; display: block; }

.email-group { margin-top: 20px; }
.email-head { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 4px 6px; display: flex; justify-content: space-between; gap: 8px; }
.email-head span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.file:last-child { border-bottom: 0; }
.file-icon { flex: 0 0 40px; height: 48px; border-radius: 6px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.file-icon.body { background: var(--blue-soft); color: var(--blue); }
.file-icon.bad { background: var(--red-soft); color: var(--red); }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; gap: 6px; }
.list { padding: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.b-awaiting_payment { background: var(--amber-soft); color: var(--amber); }
.b-paid, .b-printing { background: var(--blue-soft); color: var(--blue); }
.b-printed { background: var(--green-soft); color: var(--green); }
.b-failed, .b-needs_refund { background: var(--red-soft); color: var(--red); }
.b-cancelled, .b-expired, .b-refunded { background: #eef0ef; color: var(--muted); }

/* Bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 15, .45); display: none; z-index: 10; }
.sheet-backdrop.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: #fff; border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; transform: translateY(100%); transition: transform .22s ease;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet.open { transform: none; }
.sheet-inner { max-width: 560px; margin: 0 auto; }
.grabber { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 12px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 600; }
.seg label small { display: block; font-weight: 400; color: var(--muted); }
.seg input:checked + label { border-color: var(--green); background: var(--green-soft); }
.seg input:focus-visible + label { outline: 2px solid var(--green); outline-offset: 2px; }

.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: max-content; }
.stepper button { width: 48px; height: 46px; border: 0; background: var(--bg); font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.stepper input { width: 64px; border: 0; text-align: center; border-radius: 0; font-weight: 700; min-height: 46px; }

.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; margin-top: 12px; border-top: 1px dashed var(--line); }
.total b { font-size: 1.6rem; }

.status-hero { text-align: center; padding: 28px 18px; }
.status-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 2rem; background: var(--green-soft); }
.ref { font-size: 2rem; font-weight: 800; letter-spacing: .06em; color: var(--green-dark); }
dl.summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dl.summary dt { color: var(--muted); }
dl.summary dd { margin: 0; text-align: right; font-weight: 600; }

.notice { padding: 12px 14px; border-radius: 10px; margin-top: 12px; font-size: .92rem; }
.notice.err { background: var(--red-soft); color: var(--red); }
.notice.ok { background: var(--green-soft); color: var(--green-dark); }
.notice.warn { background: var(--amber-soft); color: var(--amber); }
.hidden { display: none !important; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px; }
