:root {
  --ink: #1b2620;
  --ink-muted: #5c6a61;
  --paper: #f2f5f2;
  --surface: #ffffff;
  --line: #d7dfd9;
  --line-strong: #b8c7bd;
  --green: #1f7659;
  --green-dark: #15533f;
  --green-soft: #e2eee8;
  --amber: #b57928;
  --red: #a94444;
  --red-soft: #f6e8e6;
  --shadow: 0 20px 44px rgba(27, 38, 32, .08);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

button { font: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(181, 121, 40, .55);
  outline-offset: 3px;
}

.topbar {
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .74);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.wordmark-mark {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 7px;
  color: var(--surface);
  background: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.environment-tag {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.login-shell { padding: clamp(44px, 9vh, 100px) 0 52px; }

.auth-surface {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(380px, 1.08fr);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.intro-column {
  display: flex;
  flex-direction: column;
  padding: clamp(34px, 5vw, 70px);
  border-right: 1px solid var(--line);
  background: #f7f9f7;
}

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

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

h1 {
  max-width: 8em;
  margin-bottom: 18px;
  font-size: clamp(36px, 4.2vw, 58px);
  line-height: 1.06;
  letter-spacing: 0;
  font-weight: 750;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 750;
}

.lede {
  max-width: 25em;
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 15px;
}

.flow-rail {
  display: grid;
  gap: 19px;
  margin: auto 0 34px;
  padding: 34px 0 0;
  list-style: none;
}

.flow-step {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  color: #93a199;
}

.step-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.step-copy { display: grid; gap: 1px; padding-top: 2px; }
.step-copy strong { color: inherit; font-size: 14px; font-weight: 750; }
.step-copy small { color: var(--ink-muted); font-size: 12px; }
.flow-step.is-current, .flow-step.is-complete { color: var(--green); }
.flow-step.is-current .step-index { border-color: var(--green); background: var(--green); color: white; }
.flow-step.is-complete .step-index { border-color: var(--green); color: var(--green); }

.security-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}

.security-note b { color: var(--ink); font-weight: 750; }
.note-mark {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.qr-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(31px, 5vw, 58px);
}

.qr-header {
  width: min(100%, 360px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.countdown {
  min-width: 50px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-align: right;
}

.qr-frame {
  width: min(100%, 316px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.qr-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #edf1ee;
  pointer-events: none;
}

.qr-image {
  width: 84%;
  height: 84%;
  display: block;
  image-rendering: pixelated;
}

.qr-image:not([src]) { display: none; }
.qr-placeholder { width: 68%; display: grid; gap: 10px; }
.qr-placeholder[hidden] { display: none; }
.placeholder-line { display: block; height: 6px; background: var(--green-soft); }
.placeholder-line.short { width: 65%; }

.corner {
  width: 19px;
  height: 19px;
  position: absolute;
  border-color: var(--green);
  border-style: solid;
  z-index: 2;
}
.corner-tl { top: -1px; left: -1px; border-width: 3px 0 0 3px; }
.corner-tr { top: -1px; right: -1px; border-width: 3px 3px 0 0; }
.corner-bl { bottom: -1px; left: -1px; border-width: 0 0 3px 3px; }
.corner-br { right: -1px; bottom: -1px; border-width: 0 3px 3px 0; }

.status-message {
  min-height: 24px;
  width: min(100%, 360px);
  margin: 21px 0 6px;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
}

.status-message.is-error { color: var(--red); }
.status-message.is-success { color: var(--green-dark); }
.request-id { min-height: 17px; margin-bottom: 16px; color: #85928a; font-size: 10px; font-variant-numeric: tabular-nums; }

.success-panel {
  width: min(100%, 360px);
  display: grid;
  gap: 3px;
  margin: -1px 0 14px;
  padding: 13px 15px;
  border: 1px solid #b7d2c2;
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
}
.success-panel strong { font-size: 15px; }
.success-kicker { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.record-panel {
  width: min(100%, 360px);
  margin: 0 0 14px;
  padding: 13px 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}
.record-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.record-heading > div { display: grid; gap: 2px; }
.record-heading strong { font-size: 14px; }
.record-status { color: var(--ink-muted); font-size: 11px; text-align: right; white-space: nowrap; }
.record-request { margin: 9px 0 8px; color: #7d8b82; font-family: Consolas, "SFMono-Regular", monospace; font-size: 10px; overflow-wrap: anywhere; }
.record-output {
  max-height: 160px;
  margin: 0;
  padding: 9px 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #f4f7f4;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.action-row { min-height: 40px; display: flex; justify-content: center; gap: 9px; }
.button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.button-secondary:hover { border-color: var(--green); color: var(--green-dark); }
.button-quiet { color: var(--ink-muted); border-color: var(--line); background: transparent; }
.button-quiet:hover { color: var(--ink); border-color: var(--line-strong); }

.page-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  display: flex;
  justify-content: space-between;
  color: #86938b;
  font-size: 11px;
}

/* Confirmation surface */
.confirm-shell { padding: clamp(48px, 10vh, 112px) 0; }
.confirm-surface {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: clamp(29px, 6vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.confirm-heading { margin-bottom: 30px; }
.confirm-heading h1 { max-width: none; margin-bottom: 13px; font-size: clamp(31px, 5vw, 46px); }
.source-panel { margin-bottom: 23px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 6px; background: #f7f9f7; }
.source-panel-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--green-dark); font-size: 12px; font-weight: 800; }
.source-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.source-list { display: grid; gap: 10px; margin: 0; }
.source-list div { display: flex; justify-content: space-between; gap: 18px; }
.source-list dt { color: var(--ink-muted); font-size: 12px; }
.source-list dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 700; text-align: right; }
.confirm-message { min-height: 22px; margin: 0 0 13px; color: var(--ink-muted); font-size: 13px; }
.confirm-message.is-error { color: var(--red); }
.confirm-message.is-success { color: var(--green-dark); }
.confirm-actions { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }
.confirm-actions .button { min-height: 46px; }
.confirm-footnote { margin: 20px 0 0; color: #86938b; font-size: 11px; }

@media (max-width: 800px) {
  .auth-surface { grid-template-columns: 1fr; }
  .intro-column { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 28px; }
  .flow-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 34px 0 0; padding-top: 0; }
  .flow-step { display: block; }
  .step-copy { padding-top: 8px; }
  .step-copy small { display: none; }
  .qr-column { padding-top: 37px; }
}

@media (max-width: 520px) {
  .topbar { min-height: 62px; padding: 0 18px; }
  .environment-tag { font-size: 10px; }
  .login-shell, .confirm-shell { width: min(100% - 24px, 1120px); }
  .login-shell { padding-top: 24px; }
  .intro-column, .qr-column, .confirm-surface { padding-right: 22px; padding-left: 22px; }
  h1 { font-size: 38px; }
  .qr-frame { width: min(100%, 300px); }
  .page-footer { width: calc(100% - 24px); padding-bottom: 17px; }
  .page-footer span:last-child { display: none; }
  .confirm-shell { padding-top: 27px; }
  .confirm-heading h1 { font-size: 34px; }
  .source-list div { align-items: flex-start; }
  .source-list dd { max-width: 65%; }
}

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