:root {
  --ink: #17201d;
  --muted: #5c6963;
  --paper: #f7f4ee;
  --panel: #fffdf8;
  --line: #d8d0c2;
  --green: #0b7a45;
  --green-deep: #075c34;
  --red: #a63d2a;
  --amber: #b7791f;
  --stripe: #635bff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 32, 29, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 32, 29, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input {
  font: inherit;
}

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

.header-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

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

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 20px;
}

.status-cluster {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  min-width: 58px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  text-align: center;
  background: var(--panel);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.status-pill.ok {
  border-color: rgba(11, 122, 69, 0.35);
  color: var(--green);
}

.status-pill.bad {
  border-color: rgba(166, 61, 42, 0.35);
  color: var(--red);
}

.status-pill.warn {
  border-color: rgba(183, 121, 31, 0.4);
  color: var(--amber);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 22px 70px rgba(23, 32, 29, 0.08);
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.field-label {
  display: block;
  margin: 18px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.field-input:focus {
  outline: 3px solid rgba(11, 122, 69, 0.16);
  border-color: var(--green);
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 6px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

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

.secondary-button {
  background: var(--green);
  color: #fff;
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.message-box {
  min-height: 52px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--muted);
  background: rgba(216, 208, 194, 0.2);
  font-size: 14px;
}

.qr-box {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px dashed rgba(23, 32, 29, 0.28);
  border-radius: 8px;
  background: #fff;
}

.qr-box img {
  width: min(280px, 80vw);
  aspect-ratio: 1;
}

.qr-placeholder {
  max-width: 260px;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

.qr-placeholder.error {
  color: var(--red);
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  margin-top: 14px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.result-shell {
  width: min(760px, calc(100vw - 32px));
  margin: 80px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 32px;
}

.back-link {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 760px) {
  .header-row {
    align-items: flex-start;
    flex-direction: column;
  }

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

