:root {
  --background: #f7fbfe;
  --surface: #ffffff;
  --text: #123f73;
  --text-dark: #0c315f;
  --muted: #60758a;
  --primary: #075cb8;
  --primary-hover: #064d99;
  --accent: #16b9e8;
  --accent-soft: #e8f7fd;
  --border: #d9e7ef;
  --success: #18805f;
  --error: #b42318;
  --focus: var(--accent);
  --placeholder: #8aa0b3;
  --focus-ring: rgba(22, 185, 232, 0.28);
  --focus-ring: color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow: 0 8px 22px rgba(12, 49, 95, 0.05);
  --font-display: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 4px;
  --panel-width: 42.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--background);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 12%, var(--background)) 0%, transparent 32%),
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--primary) 8%, var(--background)) 0%, transparent 30%),
    var(--background);
}

button,
input {
  font: inherit;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.5rem 1.5rem;
}

.page::before,
.page::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
}

.page::before {
  top: -11rem;
  right: -8rem;
  width: 26rem;
  height: 26rem;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, var(--background)) 0%, transparent 68%);
}

.page::after {
  bottom: -12rem;
  left: -9rem;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 10%, var(--background)) 0%, transparent 70%);
}

.site-header,
.site-main,
.site-footer {
  width: 100%;
  max-width: var(--panel-width);
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.logout-form {
  margin: 0.35rem 0 0;
}

.btn-logout {
  width: auto;
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

.btn-logout:hover {
  color: var(--text);
  border-color: var(--text);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  background: transparent;
}

.brand-mark {
  display: block;
  width: min(16.03rem, 100%);
  background: transparent;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
  mix-blend-mode: darken;
}

.brand-sub {
  margin: 0;
  padding-left: 0.15rem;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.test-mode-flag {
  margin: 0.15rem 0 0;
  padding-left: 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-main {
  flex: 1 1 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2.1rem 2.5rem 2rem;
}

.panel:has(#screen-payment.is-active) {
  padding-top: 1.35rem;
  padding-bottom: 1.2rem;
}

.screen[hidden] {
  display: none;
}

.screen.is-active {
  animation: screen-in 0.28s ease;
}

.panel-title {
  margin: 0 0 1.2rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-dark);
}

.scan-copy,
.success-copy,
.trust-text {
  color: var(--muted);
}

.payment-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.field-error {
  margin: 0;
  font-size: 0.92rem;
  color: var(--error);
}

.amount-field {
  position: relative;
  min-height: 5.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: text;
}

.amount-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.amount-prefix {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 2.55rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-dark);
  pointer-events: none;
}

.amount-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 5.35rem;
  border: 0;
  padding: 0 1.1rem 0 3.35rem;
  background: transparent;
  color: var(--text-dark);
  font-family: var(--font-display);
  font-size: 2.55rem;
  font-weight: 600;
  line-height: 5.35rem;
  letter-spacing: 0.01em;
  outline: none;
}

.amount-input::placeholder {
  color: var(--placeholder);
  font-weight: 400;
  opacity: 1;
}

.text-input {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dark);
}

.text-input::placeholder {
  color: var(--placeholder);
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:focus-visible,
.text-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: var(--surface);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-secondary {
  width: auto;
  min-height: 2.4rem;
  margin: 0 auto;
  padding: 0.35rem 0.7rem;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.btn-secondary:hover {
  color: var(--text);
}

.trust-text {
  margin: 1.25rem 0 0;
  font-size: 0.92rem;
  text-align: center;
}

.amount-locked-label {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.amount-display {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 2.7rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-dark);
}

.reference-display {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

#screen-payment .amount-display {
  margin-bottom: 0;
}

#screen-payment .reference-display {
  margin: 0.2rem 0 0;
}

.qr {
  display: flex;
  justify-content: center;
  margin: 0.9rem 0 0.75rem;
}

.qr-canvas-live {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
  background-image: none;
}

.qr-canvas-live canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.wait-error {
  margin: 0 0 0.85rem;
  text-align: center;
}

.panel-complete-copy {
  margin: 0;
  color: var(--muted);
}

.qr-canvas {
  position: relative;
  width: min(16.5rem, 100%);
  aspect-ratio: 1;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 14px 14px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.qr-finder {
  position: absolute;
  width: 3.1rem;
  height: 3.1rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 0.42rem var(--text-dark);
}

.qr-finder::after {
  content: "";
  position: absolute;
  inset: 0.85rem;
  background: var(--text-dark);
}

.qr-finder-tl {
  top: 0.55rem;
  left: 0.55rem;
}

.qr-finder-tr {
  top: 0.55rem;
  right: 0.55rem;
}

.qr-finder-bl {
  bottom: 0.55rem;
  left: 0.55rem;
}

.qr-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.35rem 0.55rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.scan-title {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-dark);
}

.scan-copy {
  margin: 0 0 0.85rem;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 1.8s ease-in-out infinite;
}

.demo-only {
  margin-top: 2.4rem;
  padding-top: 1.15rem;
  border-top: 1px dashed var(--border);
  text-align: center;
}

.demo-label {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-demo {
  width: auto;
  min-height: 2.1rem;
  margin: 0 auto;
  padding: 0.3rem 0.7rem;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

.btn-demo:hover {
  color: var(--text);
  border-color: var(--text);
}

.success-mark {
  display: flex;
  justify-content: center;
  margin: 0.2rem 0 1.2rem;
}

.success-mark svg {
  width: 4.6rem;
  height: 4.6rem;
  fill: none;
  stroke: var(--success);
  stroke-width: 2.4;
}

.success-title {
  text-align: center;
}

#screen-success .amount-display,
#screen-success .reference-display,
#screen-success .success-copy {
  text-align: center;
}

#screen-success .success-copy {
  margin: 0.15rem 0 1.7rem;
}

#screen-success .amount-display {
  margin-bottom: 0.35rem;
}

.site-footer {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 0 6px var(--accent-soft);
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1.05rem 1rem 1.2rem;
  }

  .site-header {
    margin-bottom: 0.65rem;
  }

  .brand-mark {
    width: min(12.62rem, 100%);
  }

  .panel {
    padding: 1.35rem 1.15rem 1.3rem;
  }

  .panel:has(#screen-payment.is-active) {
    padding-top: 1.15rem;
    padding-bottom: 1.1rem;
  }

  .panel-title {
    font-size: 1.7rem;
    margin-bottom: 1.05rem;
  }

  .amount-prefix {
    left: 1rem;
    font-size: 2.1rem;
  }

  .amount-input,
  .amount-display {
    font-size: 2.1rem;
  }

  .amount-field,
  .amount-input {
    min-height: 4.6rem;
    height: 4.6rem;
  }

  .amount-input {
    padding-left: 2.85rem;
    line-height: 4.6rem;
  }

  .qr-canvas {
    width: min(18.5rem, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active,
  .status-dot {
    animation: none;
  }
}
