body:has(.auth-page) .mast { display: none; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
}

.auth-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--color-tint);
}
.auth-scene,
.auth-scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.auth-scene img { object-fit: cover; }
.auth-signature {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: clamp(24px, 3vw, 48px);
  color: var(--color-ink);
}
.auth-signature img {
  display: block;
  width: 68px;
  height: auto;
  flex: none;
}
.auth-signature span {
  padding-inline-start: 20px;
  border-inline-start: 1px solid var(--color-control-border);
  font-size: 16px;
  font-weight: 550;
  line-height: 1.5;
}

.auth-panel {
  width: min(calc(100% - 80px), 384px);
  min-width: 0;
  margin: auto;
  padding-block: 48px;
  color: var(--color-ink);
}
.auth-page h1 {
  font-family: var(--body);
  font-size: clamp(32px, 3vw, 40px);
  line-height: 1.25;
  font-weight: 650;
}
.auth-page #auth-form { gap: 20px; margin-top: 32px; }
.auth-page .auth-field { gap: 8px; }
.auth-page .auth-field label { font-size: 14px; font-weight: 550; }
.auth-page #auth-form input {
  min-height: 48px;
  padding-inline: 16px;
  border-color: var(--color-control-border);
  background: var(--color-surface);
}
.auth-page #auth-form input:hover { border-color: var(--color-muted); }
.auth-page #auth-form input:focus { border-color: var(--color-focus); }
.auth-page #auth-form input[aria-invalid="true"] { border-color: var(--color-danger); }
.auth-page #auth-form .password-field input { padding-inline-end: 56px; }
.auth-page #toggle-password {
  display: inline-grid;
  place-items: center;
  right: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}
#toggle-password .eye-slash { display: none; }
#toggle-password[aria-pressed="true"] .eye-slash { display: inline; }
.auth-page #authenticate { min-height: 48px; margin-top: 8px; font-size: 16px; }
.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}
.auth-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.auth-links a:hover, .auth-links a:focus-visible { color: var(--color-ink); }
.auth-links a:active { transform: translateY(1px); }

@media (max-width: 760px) {
  .auth-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .auth-cover { height: clamp(132px, 27vh, 240px); height: clamp(132px, 27svh, 240px); }
  .auth-signature {
    gap: 12px;
    padding: max(16px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-left));
  }
  .auth-signature img { width: 48px; }
  .auth-signature span { padding-inline-start: 12px; font-size: 14px; }
  .auth-panel {
    width: min(calc(100% - 48px), 432px);
    margin: 0 auto;
    padding-block: 32px max(32px, env(safe-area-inset-bottom));
  }
  .auth-page h1 { font-size: 32px; }
  .auth-page #auth-form { gap: 16px; margin-top: 24px; }
}

@media (max-width: 760px) and (max-height: 500px) {
  .auth-cover { height: 80px; }
  .auth-signature img { width: 40px; }
  .auth-panel { padding-top: 20px; }
}

.wx-entry { display: grid; gap: 12px; margin-top: 24px; }
.wx-entry button, .wx-return { min-height: 48px; }
.wx-entry p:empty { display: none; }
.wx-entry + .auth-links { justify-content: flex-end; }
.wx-login-qr { width: min(198px, 100%); height: auto; image-rendering: pixelated; }
.wx-status { margin-top: 24px; }
.wx-return { display: inline-flex; align-items: center; margin-top: 8px; }

/* The customer entrance is laid out as a physical ticket; the working login keeps its form. */
.auth-customer .auth-signature { padding: clamp(32px, 4vw, 64px); }
.auth-customer .auth-signature img { width: 80px; }
.auth-customer .auth-panel {
  width: min(calc(100% - 88px), 352px);
  text-align: center;
}
.auth-customer h1 {
  font-family: var(--head);
  font-weight: 500;
  font-size: clamp(36px, 3.6vw, 52px);
  line-height: 1.2;
}
.auth-customer .wx-entry { margin-block-start: 20px; gap: 0; }
.wx-hint, .wx-desktop-entry figcaption, .wx-copy-result {
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.65;
}
.auth-customer .wx-entry button.primary {
  position: relative;
  width: 100%;
  min-height: 52px;
  margin-block-start: 28px;
  padding-inline: 48px;
  font-size: 16px;
  font-weight: 550;
}
.auth-customer .wx-entry button.primary::after {
  content: "";
  position: absolute;
  inset-inline-end: 20px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-block-start: 1.5px solid;
  border-inline-end: 1.5px solid;
  transform: translateY(-50%) rotate(45deg);
}
.wx-entry .muted:not(:empty), .wx-copy-result:not([hidden]) { margin-top: 12px; }
.wx-desktop-entry { margin: 4px 0 0; display: grid; justify-items: center; gap: 12px; }
.wx-desktop-entry .wx-login-qr {
  display: block;
  width: min(216px, 100%);
  height: auto;
}
.auth-customer .auth-links { margin-block-start: 32px; border-top: 1px solid var(--color-line); }
.auth-customer .auth-links a { text-decoration: none; }
.auth-customer .auth-links a:hover, .auth-customer .auth-links a:focus-visible { text-decoration: underline; }
.wx-phone-entry { display: none; }
.wx-copy-result { text-align: start; overflow-wrap: anywhere; }
.wx-copy-result textarea { width: 100%; font: inherit; }

@media (max-width: 760px) {
  #shell:has(.auth-customer) {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: var(--color-tint);
  }
  .auth-customer {
    width: min(100%, 440px);
    min-height: 0;
    grid-template-rows: auto auto;
    background: var(--color-surface);
  }
  .auth-customer .auth-cover {
    display: block;
    height: auto;
    background: var(--color-tint);
  }
  .auth-customer .auth-signature {
    position: absolute;
    inset: 20px auto auto 24px;
    padding: 0;
    pointer-events: none;
  }
  .auth-customer .auth-signature img { width: 48px; height: auto; }
  .auth-customer .auth-scene {
    position: relative;
    inset: auto;
    height: clamp(132px, 22svh, 190px);
    display: block;
    overflow: hidden;
    background: var(--color-tint);
  }
  .auth-customer .auth-scene img { object-position: center 58%; }
  .auth-customer .auth-panel {
    --ticket-inset: clamp(20px, 6vw, 32px);
    position: relative;
    align-self: stretch;
    width: auto;
    margin: 0;
    padding: 32px var(--ticket-inset) 12px;
    text-align: start;
  }
  .auth-customer h1 { font-size: clamp(34px, 9vw, 44px); font-weight: 500; }
  .auth-customer .wx-entry { margin-top: 8px; }
  .auth-customer .wx-entry button.primary { margin-block-start: 20px; }
  .auth-customer .wx-hint {
    position: relative;
    margin-inline: calc(-1 * var(--ticket-inset));
    padding: 0 var(--ticket-inset) 24px;
    border-bottom: 1px dashed var(--color-line);
  }
  .auth-customer .wx-hint::before, .auth-customer .wx-hint::after {
    content: "";
    position: absolute;
    bottom: -8px;
    width: 8px;
    height: 16px;
    background: var(--color-tint);
    clip-path: ellipse(100% 50% at 0 50%);
    inset-inline-start: 0;
  }
  .auth-customer .wx-hint::after { inset-inline: auto 0; transform: rotate(180deg); }
  .auth-customer .auth-links {
    margin-top: 4px;
    border: 0;
  }
  .wx-phone-entry { display: block; }
  .wx-desktop-entry { display: none; }
}
@media (max-width: 760px) and (max-height: 600px) {
  #shell:has(.auth-customer) { padding-block: 16px; }
  .auth-customer .auth-signature { inset: 16px auto auto 20px; }
  .auth-customer .auth-signature img { width: 40px; }
  .auth-customer .auth-scene { height: clamp(104px, 22svh, 132px); }
  .auth-customer .auth-panel { padding-top: 20px; }
  .auth-customer .wx-hint { padding-bottom: 16px; }
}
