:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #202124;
  --muted: #666b73;
  --line: #ded8cc;
  --panel: #fffdf8;
  --accent: #167a5b;
  --accent-dark: #0f5d45;
  --warn: #b5462f;
  --shadow: 0 18px 48px rgb(48 42 30 / 12%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(22 122 91 / 10%), transparent 35%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.checkout {
  display: grid;
  gap: 24px;
}

.intro {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.state {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.state[data-kind="ok"] {
  border-color: rgb(22 122 91 / 22%);
  background: rgb(22 122 91 / 10%);
  color: var(--accent-dark);
}

.state[data-kind="bad"] {
  border-color: rgb(181 70 47 / 24%);
  background: rgb(181 70 47 / 10%);
  color: var(--warn);
}

.product-list {
  display: grid;
  gap: 10px;
}

.product {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.product[data-active="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(22 122 91 / 12%);
}

.cover {
  display: grid;
  place-items: center;
  width: 76px;
  aspect-ratio: 1;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgb(22 122 91 / 90%), rgb(45 91 153 / 82%)),
    #e9efe8;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.cover img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
}

.product-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.product-copy strong,
.product-copy small {
  overflow-wrap: anywhere;
}

.product-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.price {
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(22 122 91 / 12%);
}

.primary,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  margin-top: 16px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary:hover,
.download:hover {
  background: var(--accent-dark);
}

.primary:disabled {
  background: #b9c4bd;
  cursor: not-allowed;
}

.pay-panel {
  position: sticky;
  top: 20px;
}

.empty-pay,
.pay-box {
  display: grid;
  justify-items: center;
  gap: 16px;
  min-height: 360px;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.empty-pay p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.qr-placeholder {
  width: min(220px, 60vw);
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #d7d1c5 14px, transparent 14px) 0 0 / 28px 28px,
    linear-gradient(#d7d1c5 14px, transparent 14px) 0 0 / 28px 28px,
    #fff;
  opacity: 0.55;
}

#qrImage {
  width: min(320px, 76vw);
  aspect-ratio: 1;
  border: 10px solid #fff;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 10px 30px rgb(30 32 36 / 12%);
}

.order-meta {
  display: grid;
  gap: 6px;
  width: 100%;
  color: var(--muted);
  text-align: center;
}

.order-meta strong {
  color: var(--ink);
  font-size: 18px;
}

.hidden {
  display: none !important;
}

.error {
  margin: 0;
  color: var(--warn);
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 24px, 560px);
    padding: 24px 0;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .pay-panel {
    position: static;
  }

  .product {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .cover {
    width: 62px;
  }

  .price {
    grid-column: 2;
    font-size: 18px;
  }
}
