:root {
  --ink: #192028;
  --muted: #64707d;
  --line: #dce3e8;
  --accent: #0f7f53;
  --blue: #1167b1;
  --warn: #fff8e5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef3f6;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

main {
  max-width: 980px;
  margin: 32px auto;
  padding: 0 18px;
}

.shell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(32, 45, 58, .08);
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}

.header img {
  width: 42px;
  height: 42px;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.mode {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.content {
  padding: 24px 26px 28px;
}

.catalog-form {
  display: grid;
  gap: 18px;
}

.catalog-form label {
  font-weight: 700;
}

.catalog-form input {
  width: min(420px, 100%);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 12px;
  font: inherit;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.book-card {
  display: grid;
  gap: 16px;
  align-content: space-between;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 16px;
  background: #fff;
}

.book-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.book-card p {
  color: var(--muted);
  margin: 0 0 12px;
}

.error {
  border: 1px solid #efb4b4;
  background: #fff1f1;
  border-radius: 6px;
  padding: 11px 13px;
}

.summary,
.record {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 0 22px;
}

.summary div,
.record dt,
.record dd {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.summary div:nth-child(odd),
.record dt {
  color: var(--muted);
  background: #fbfcfd;
  font-weight: 700;
}

.summary div:nth-last-child(-n + 2),
.record dt:last-of-type,
.record dd:last-of-type {
  border-bottom: 0;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.button {
  min-width: 112px;
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.button.primary {
  background: var(--blue);
  color: #fff;
}

.button.secondary {
  background: #edf2f6;
  color: var(--ink);
}

.button:disabled {
  opacity: .55;
  cursor: default;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warn);
  border: 1px solid #f0dfaa;
  color: #67530c;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 18px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #dfc766;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

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

.payment-code-title {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.payment-code {
  color: var(--blue);
  font-size: 56px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 18px;
}

.refresh-row {
  margin: -6px 0 20px;
}

.instructions h2,
.confirmed h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.instructions ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.instructions li {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.instructions li:last-child {
  border-bottom: 0;
}

.confirmed {
  border: 1px solid #cde7d8;
  background: #f1fbf5;
  border-radius: 7px;
  padding: 22px;
  max-width: 680px;
}

.confirmed .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.check {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 800;
  margin-bottom: 14px;
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  main {
    margin: 0;
    padding: 0;
  }

  .shell {
    border-radius: 0;
  }

  .summary,
  .record {
    grid-template-columns: 1fr;
  }

  .summary div:nth-last-child(-n + 2),
  .record dt:last-of-type {
    border-bottom: 1px solid var(--line);
  }

  .payment-code {
    font-size: 44px;
  }
}
