* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #1d2939;
  --muted: #667085;
  --line: #d9e2ee;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --blue: #1677ff;
  --blue-deep: #0b5ed7;
  --green: #067647;
  --red: #b42318;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font: 14px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.cashier {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 14px;
}

.merchant,
.amount-card,
.result,
.error,
.tools {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.merchant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.brand {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: #101828;
  font-weight: 800;
}

.merchant p,
.tools-head p,
.result-head p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.amount-card {
  padding: 22px;
}

.amount-label {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.amount-input span {
  font-size: 30px;
  font-weight: 800;
}

.amount-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.quick-amounts button {
  min-height: 38px;
  border: 1px solid #cfe2ff;
  border-radius: 7px;
  color: var(--blue-deep);
  background: #eef5ff;
  font-weight: 750;
}

.pay-button,
.tool-card button,
.result-head button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.pay-button:hover,
.tool-card button:hover,
.result-head button:hover {
  background: var(--blue-deep);
}

.pay-button:disabled {
  cursor: wait;
  opacity: .72;
}

.pay-hint {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
}

.result,
.error {
  padding: 16px;
}

.result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: center;
}

.result-head button {
  width: auto;
}

.result textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  padding: 10px;
  font: 12px/1.45 Consolas, "Courier New", monospace;
}

.result pre,
.error pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  font: 13px/1.5 Consolas, "Courier New", monospace;
}

.bridge-result {
  min-height: 42px;
  padding: 10px;
  color: var(--green);
  background: #f6fef9;
  border: 1px solid #abefc6;
  border-radius: 7px;
}

details {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 750;
}

.error {
  color: var(--red);
  background: #fff8f6;
  border-color: #fecdca;
}

.hidden {
  display: none !important;
}

.tools {
  padding: 18px;
}

.tools-head {
  margin-bottom: 14px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fbfcff;
}

.tool-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 650;
}

.tool-card input,
.tool-card select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--blue-deep);
  background: #eef5ff;
  font-family: Consolas, "Courier New", monospace;
}

@media (max-width: 760px) {
  .shell {
    width: 100%;
    padding: 0 0 24px;
  }

  .cashier {
    min-height: auto;
    padding: 12px;
  }

  .merchant,
  .amount-card,
  .result,
  .error,
  .tools {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .amount-input input {
    font-size: 40px;
  }

  .quick-amounts,
  .tool-grid,
  .result-head {
    grid-template-columns: 1fr;
  }

  .result-head button {
    width: 100%;
  }
}
