:root {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  font-synthesis: none;
  color: #282825;
  background: #fafaf8;
  --accent: #b35624;
  --muted: #72726b;
  --line: #e8e8e3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 300px;
}

h1,h2,h3,p {
  margin: 0;
}

button,input,a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
  border: 0;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,a:focus-visible,input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none!important;
}

.site-shell {
  width: min(100%,460px);
  margin: 76px auto 40px;
}

.merchant-header {
  padding: 24px 28px;
}

.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.merchant-header h1 {
  font-size: 26px;
  letter-spacing: -.7px;
  line-height: 1.4;
  font-weight: 650;
}

.demo-label {
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.main-content {
  padding: 10px 28px 24px;
}

.amount-fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}

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

.amount-choice {
  position: relative;
  display: block;
}

.amount-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.amount-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  min-height: 76px;
  padding: 23px 8px;
  border: 1px solid #deded8;
  border-radius: 8px;
  background: #fff;
  color: #464640;
  cursor: pointer;
  transition: border-color .15s,background .15s,color .15s;
}

.currency {
  font-size: 13px;
}

.digits {
  font-size: 23px;
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -.7px;
  font-variant-numeric: tabular-nums;
}

.amount-choice input:checked+.amount-box {
  background: #fdf4ed;
  border-color: var(--accent);
  color: #b35624;
}

.amount-choice input:focus-visible+.amount-box {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.amount-choice input:disabled+.amount-box {
  cursor: default;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: 100%;
  border-radius: 7px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.5;
  transition: background .15s;
}

.primary-button:hover {
  background: #9e4b1e;
}

.primary-button:disabled {
  background: #e5c6b3;
  color: #725844;
}

.confirm-button {
  margin-top: 24px;
}

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 6px;
  border: 1px solid #deded8;
  background: transparent;
  color: #66665f;
  font-size: 12px;
}

.secondary-button:hover {
  background: #f0f0ec;
}

.text-button {
  min-height: 44px;
  background: transparent;
  padding: 11px 6px;
  color: var(--muted);
  font-size: 12px;
}

.text-button:hover,a.text-link:hover {
  color: var(--accent);
}

.small-links {
  text-align: center;
  margin-top: 16px;
}

.small-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--muted);
  font-size: 11px;
}

.state-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  min-height: 280px;
  text-align: center;
}

.state-panel h2 {
  font-size: 17px;
  font-weight: 550;
}

.state-panel>p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.spinner {
  width: 25px;
  height: 25px;
  border: 2px solid #e7e6e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.spinner.large {
  width: 28px;
  height: 28px;
}

.loading-title {
  font-size: 13px!important;
  color: #72726b;
  font-weight: 400!important;
}

.payment-panel {
  text-align: center;
}

.payment-amount {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.payment-amount strong {
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
  color: #353530;
}

.payment-panel>.payment-amount {
  margin: 1px 0 22px;
}

.qr-frame {
  width: 280px;
  max-width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 0 auto;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.payment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 21px;
  color: var(--muted);
  font-size: 11px;
}

.time-pill b {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.order-detail {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding: 14px 0;
  margin: 16px 0 12px;
  font-size: 10px;
  color: #72726b;
}

.order-detail>span {
  white-space: nowrap;
}

.order-detail b {
  font-family: ui-monospace,SFMono-Regular,Consolas,monospace;
  font-weight: 400;
  font-size: 10px;
  text-align: right;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.inline-error {
  padding: 10px 0;
  color: #ae653e;
  font-size: 12px;
  line-height: 1.8;
  text-align: left;
  margin: 9px 0;
}

.result-panel {
  text-align: center;
  padding-top: 23px;
  min-height: 300px;
}

.result-icon {
  color: var(--accent);
  font-size: 30px;
  line-height: 1;
  margin: 0 auto 20px;
}

.result-icon.muted {
  color: #72726b;
}

.result-panel h2 {
  font-size: 19px;
  font-weight: 550;
}

.state-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  margin-top: 10px;
}

.result-amount {
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
  margin: 25px 0;
}

.result-panel .primary-button {
  margin-top: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.copy-field {
  position: fixed;
  top: 0;
  left: -9999px;
}

.entry-panel {
  text-align: center;
}

.entry-panel .qr-frame {
  margin: 8px auto 18px;
}

.entry-url {
  display: block;
  font-size: 11px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  color: var(--muted);
  margin: 20px 0;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.copy-message {
  font-size: 11px;
  color: #875d37;
  min-height: 18px;
  margin-top: 10px;
}

.entry-notice {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  text-align: center;
  margin-top: 16px;
}

.demo-payment {
  text-align: center;
  padding-top: 9px;
}

.demo-pay-amount {
  font-size: 39px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  margin: 7px 0 20px;
}

.demo-pay-amount small {
  font-size: 22px;
  margin-right: 4px;
  font-weight: 400;
}

.waiting-status {
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0 22px;
}

.back-link {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

.empty-state {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
  padding: 45px 0;
}

.admin-shell {
  width: min(100% - 48px,760px);
  margin: 62px auto;
}

.admin-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 35px;
}

.admin-header h1 {
  font-size: 27px;
  line-height: 1.4;
  letter-spacing: -.6px;
  font-weight: 650;
}

.admin-header-left {
  display: flex;
  align-items: baseline;
  gap: 15px;
}

.admin-nav {
  display: flex;
  gap: 19px;
  align-items: center;
  font-size: 12px;
  color: #72726b;
}

.admin-nav a,.admin-nav button {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: inherit;
  background: none;
  padding: 0;
  font-size: 12px;
}

.admin-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.admin-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.admin-section h2 {
  font-size: 16px;
  font-weight: 550;
}

.admin-add-button {
  background: none;
  color: var(--accent);
  min-height: 36px;
  padding: 6px 0 6px 14px;
  font-size: 13px;
}

.admin-list {
  display: flex;
  flex-direction: column;
}

.amount-row {
  display: grid;
  grid-template-columns: 100px minmax(0,1fr) 40px 42px;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
}

.amount-row:last-child {
  border-bottom: 0;
}

.row-amount {
  font-size: 16px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.25px;
}

.row-url {
  font-size: 12px;
  color: #72726b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-edit {
  min-height: 40px;
  background: none;
  color: #72726b;
  font-size: 12px;
  padding: 8px 0;
}

.row-edit:hover {
  color: var(--accent);
}

.switch-control {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 40px;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 10px;
  background: #d4d5cf;
  transition: background .15s;
}

.switch-track:after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform .15s;
}

.switch-control input:checked+.switch-track {
  background: var(--accent);
}

.switch-control input:checked+.switch-track:after {
  transform: translateX(12px);
}

.switch-control input:focus-visible+.switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.switch-control input:disabled+.switch-track {
  opacity: .55;
}

.admin-form {
  margin: 4px 0 20px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-form h3 {
  font-size: 14px;
  font-weight: 550;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 125px minmax(0,1fr);
  gap: 15px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.form-field label {
  font-size: 12px;
  color: #72726b;
}

.form-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #deded7;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: #3e3e37;
  font-size: 13px;
}

.form-field input::placeholder {
  color: #b0b0a8;
}

.form-field input:disabled {
  color: #a8a8a1;
  background: #f5f5f1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.form-actions .primary-button,.form-actions .secondary-button {
  width: auto;
  min-width: 76px;
  min-height: 38px;
  font-size: 12px;
  padding: 9px 17px;
}

.form-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #72726b;
  margin-right: auto;
}

.form-switch .switch-control {
  width: 32px;
  min-height: 34px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 150px auto;
  gap: 16px;
  align-items: end;
}

.settings-grid .primary-button {
  width: auto;
  min-height: 42px;
  font-size: 12px;
  padding: 10px 19px;
}

.admin-note {
  font-size: 11px;
  color: #72726b;
  line-height: 1.8;
  margin: 5px 0 20px;
}

.admin-status {
  min-height: 22px;
  font-size: 12px;
  color: #875d37;
  line-height: 1.7;
  margin-bottom: 12px;
}

.admin-empty {
  font-size: 13px;
  color: #72726b;
  padding: 25px 0;
}

.login-panel {
  width: min(100%,310px);
  padding: 12px 0;
}

.login-panel .form-field {
  margin-bottom: 18px;
}

.login-panel .primary-button {
  margin-top: 23px;
}

.login-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 25px;
}

.login-panel .inline-error {
  margin: 0;
}

.admin-loading {
  font-size: 13px;
  color: #72726b;
  padding: 20px 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media(max-width:520px) {
  .site-shell {
    margin: 24px auto;
    min-height: calc(100svh - 48px);
  }
  .merchant-header {
    padding: 22px 24px 25px;
  }
  .main-content {
    padding: 7px 24px 22px;
  }
  .merchant-header h1 {
    font-size: 25px;
  }
  .admin-shell {
    width: calc(100% - 36px);
    margin: 28px auto;
  }
  .admin-header {
    margin-bottom: 26px;
    align-items: flex-start;
  }
  .admin-header h1 {
    font-size: 24px;
  }
  .admin-header-left {
    display: block;
  }
  .admin-header-left .demo-label {
    display: block;
    margin-top: 5px;
  }
  .admin-nav {
    gap: 15px;
  }
  .amount-row {
    grid-template-columns: 90px minmax(0,1fr) 34px 33px;
    gap: 8px;
  }
  .row-amount {
    font-size: 15px;
  }
  .row-url {
    font-size: 11px;
  }
  .settings-grid {
    grid-template-columns: minmax(0,1fr) 110px;
  }
  .settings-grid .primary-button {
    grid-column: 1/-1;
    justify-self: start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .admin-section {
    padding: 21px 0;
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .login-panel {
    width: 100%;
    max-width: 330px;
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation-duration: .01ms!important;
    transition: none!important;
  }
}
