:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-muted: #f0f5f3;
  --ink: #182026;
  --muted: #66727c;
  --line: #d7ddd8;
  --teal: #177e75;
  --teal-dark: #0d5f58;
  --coral: #c95f43;
  --blue: #315c91;
  --shadow: 0 18px 55px rgba(31, 42, 49, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

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

.gate-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.gate h1,
.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.gate h1 {
  font-size: 28px;
  line-height: 1.15;
}

.gate p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1 {
  max-width: 820px;
  font-size: 34px;
  line-height: 1.12;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.button:hover {
  border-color: #aeb9b2;
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.button.primary:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.button.ghost {
  background: transparent;
}

.button.is-done {
  border-color: var(--blue);
  background: #eaf1f8;
  color: var(--blue);
}

.status-line {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--muted);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #aeb9b2;
}

.status-dot[data-tone="loading"] {
  background: var(--blue);
}

.status-dot[data-tone="ok"] {
  background: var(--teal);
}

.status-dot[data-tone="warn"] {
  background: var(--coral);
}

.status-dot[data-tone="error"] {
  background: #b53a3a;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

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

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

.panel h2 {
  font-size: 21px;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #c8d8d5;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--teal-dark);
  font-weight: 700;
  white-space: nowrap;
}

.url-box {
  min-height: 112px;
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid #cad4ce;
  border-radius: 8px;
  background: #fbfcfb;
  color: #26333b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.meta-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.meta-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.meta-grid dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.qr-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.qr-frame {
  display: grid;
  flex: 1;
  min-height: 320px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.qr-frame img {
  width: min(260px, 78%);
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: crisp-edges;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 1120px);
    padding: 22px 0;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 28px;
  }

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

  .panel {
    padding: 18px;
  }

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

  .button {
    width: 100%;
  }
}
