/* Wiser Payment Request: one minimal white form, Wiser red accents, charcoal text, inside the normal Telegram
   Mini App popup (no full-screen mode). One sizing system: 8 / 12 / 16 / 20 px spacing; every single-line control
   48px high, 12px radius, 1px border, 16px text, 14px inner padding. The form uses the popup's full width. */
:root {
  --red: #c8102e; --red-dark: #a50d25; --red-soft: #fdf0f2; --red-line: #f3c9d0;
  --ink: #1f2328; --muted: #6b7079; --line: #dcdfe4; --field: #f7f8fa; --good: #16803c;
  --s1: 8px; --s2: 12px; --s3: 16px; --s4: 24px;
  --h: 48px; --r: 12px; --pad: 14px; --text: 16px; --label: 13px;
  --side: 16px;                                   /* 16px side padding; 20px once the popup is wider */
}
@media (min-width: 480px) { :root { --side: 20px; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--ink);
  font: var(--text)/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; }
.app { width: 100%; padding: var(--s3) calc(var(--side) + env(safe-area-inset-right, 0px))
  calc(var(--s3) + env(safe-area-inset-bottom, 0px)) calc(var(--side) + env(safe-area-inset-left, 0px)); }

/* header */
.head { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); min-height: 32px;
  margin-bottom: var(--s2); }
h1 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.mode { font-size: 11px; line-height: 1; font-weight: 700; letter-spacing: .04em; color: var(--red); background: var(--red-soft);
  border: 1px solid var(--red-line); border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.blocked { margin: 0; padding: var(--s3); border-radius: var(--r); background: var(--field); font-weight: 600; text-align: center; }

/* layout */
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px var(--s2); }
@media (max-width: 340px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* labels: one size, one weight, one gap */
.lbl { font-size: var(--label); line-height: 16px; font-weight: 600; color: var(--muted); }
.opt { font-weight: 400; }

/* controls: identical box for every input / select; Notes only taller */
.ctl { display: block; width: 100%; min-width: 0; height: var(--h); margin: 0; padding: 0 var(--pad);
  font: inherit; font-size: var(--text); font-weight: 400; color: var(--ink); background-color: var(--field);
  border: 1px solid var(--line); border-radius: var(--r); outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .12s, box-shadow .12s, background-color .12s; }
.ctl::placeholder { color: #a3a7ae; }
.ctl:focus { border-color: var(--red); background-color: #fff; box-shadow: 0 0 0 3px rgba(200, 16, 46, .12); }
select.ctl { padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236b7079' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--pad) center; }
select.ctl:invalid { color: #a3a7ae; }
textarea.ctl { height: auto; min-height: 80px; padding: var(--s2) var(--pad); line-height: 1.45; resize: vertical; }
.ctl.bad { border-color: var(--red); }

/* A. upload: same outer edges and radius as the fields */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px;
  padding: var(--s3); border: 1.5px dashed #cfd2d8; border-radius: var(--r); cursor: pointer; text-align: center;
  transition: border-color .12s, background-color .12s; }
.drop:hover, .drop.over { border-color: var(--red); background: var(--red-soft); }
.drop input { display: none; }
.drop-main { font-size: var(--text); font-weight: 650; color: var(--red); }
.drop-sub { font-size: var(--label); color: var(--muted); }
.drop.busy { opacity: .55; pointer-events: none; }
.file { display: flex; align-items: center; gap: var(--s1); height: var(--h); padding: 0 var(--s1) 0 var(--pad);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r); }
.file-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { margin: 0; font-size: var(--label); color: var(--muted); }

/* buttons: one primary size, one text-button size */
.act { display: inline-flex; align-items: center; height: 32px; padding: 0 var(--s1); border: 0; border-radius: 8px;
  background: none; color: var(--red); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.act:hover { background: var(--red-soft); }
.send { display: block; width: 100%; height: var(--h); border: 0; border-radius: var(--r); padding: 0 var(--pad);
  background: var(--red); color: #fff; font: inherit; font-size: var(--text); font-weight: 700; cursor: pointer; }
.send:hover { background: var(--red-dark); }
.send:disabled { opacity: .55; cursor: default; }

/* D. caption: same box as the fields */
.preview { margin: 0; padding: var(--s2) var(--pad); background: var(--field); border: 1px solid var(--line);
  border-radius: var(--r); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 15px; line-height: 1.5; }
.preview.empty { color: #a3a7ae; }

/* E. status */
.status { margin: 0; min-height: 20px; font-size: 14px; line-height: 20px; font-weight: 600; text-align: center; }
.status:empty { min-height: 0; }
.status.ok { color: var(--good); }
.status.test, .status.bad { color: var(--red); }

[hidden] { display: none !important; }
