/* LMail 2.0 — sign-in, registration by invitation, password recovery.
   Carried over from the portal: phase-one.css:246, 284-288, 352-356, 522-524;
   globals.css:6168-6180; techno-theme.css:43-50. Colours go through tokens. */

.auth-stage { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; overflow: hidden; padding: 45px 20px; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent-primary) 7.5%, transparent), transparent 32%); }
.auth-terminal { position: relative; z-index: 1; width: min(460px, 100%); padding: 30px 36px 34px; border: 1px solid var(--line-strong); background: var(--lm-auth-card-bg); box-shadow: var(--lm-auth-card-shadow); }
.auth-terminal::before, .auth-terminal::after { position: absolute; width: 18px; height: 18px; content: ""; }
.auth-terminal::before { top: -1px; left: -1px; border-top: 2px solid var(--accent-primary); border-left: 2px solid var(--accent-primary); }
.auth-terminal::after { right: -1px; bottom: -1px; border-right: 2px solid var(--accent-primary); border-bottom: 2px solid var(--accent-primary); }
.auth-terminal__status { display: flex; align-items: center; justify-content: space-between; color: var(--text-muted); font: 12px/1 "JetBrains Mono", monospace; letter-spacing: .12em; }
.auth-terminal__status small { font-size: inherit; }
.auth-terminal__status span { display: flex; align-items: center; gap: 7px; color: var(--accent-tertiary); }
.auth-terminal__status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.auth-terminal__brand { display: grid; justify-items: center; gap: 9px; margin: 28px auto 22px; }
.auth-terminal__brand > span { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.16em; }
.auth-terminal h1 { margin: 40px 0 0; font: 700 27px/1.1 "Space Grotesk", sans-serif; text-align: center; overflow-wrap: anywhere; }
.auth-terminal > p { margin: 12px auto 27px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; text-align: center; }
.auth-terminal > .lm-banner { margin: -11px 0 16px; }
.terminal-form { display: grid; gap: 10px; }
.terminal-form label { color: var(--text-secondary); font: 12px/1 "JetBrains Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.otp-field { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text-primary); font: 15.5px/1 "JetBrains Mono", monospace; }
.otp-field:focus { border-color: var(--accent-primary); box-shadow: 0 0 14px color-mix(in srgb, var(--accent-primary) 9%, transparent); }
.otp-field { height: 58px; border: 1px solid var(--line-strong); font-size: 21px; letter-spacing: .45em; text-align: center; }
.auth-text-field { width: 100%; padding: 0 14px; font-size: 14.5px; letter-spacing: 0; text-align: left; }
.otp-field[aria-invalid="true"] { border-color: color-mix(in srgb, var(--danger) 55%, var(--border-color)); }
.otp-field[readonly] { color: var(--text-secondary); }
/* re-login dialog: the address is shown, not entered */
.lm-relogin__user { display: flex; align-items: center; min-height: 50px; padding: 0 14px; border: 1px solid var(--line-strong); color: var(--text-secondary); font: 14.5px/1.3 "JetBrains Mono", monospace; overflow-wrap: anywhere; }
.auth-submit { width: 100%; margin-top: 8px; border: 0; }
.auth-link { justify-self: center; color: var(--lm-accent-ink); font-size: 12.5px; text-decoration: underline; }
.auth-terminal .auth-link:disabled { cursor: not-allowed; opacity: .45; }
.auth-link--forgot { justify-self: end; margin-top: -2px; text-decoration: none; }
.auth-link--forgot:hover { text-decoration: underline; }
.auth-hint { margin-top: -4px; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.auth-success { display: grid; justify-items: center; text-align: center; }
.auth-success > span { width: 62px; height: 62px; display: grid; place-items: center; border: 1px solid var(--accent-tertiary); border-radius: 50%; color: var(--accent-tertiary); box-shadow: 0 0 24px color-mix(in srgb, var(--accent-tertiary) 12%, transparent); }
.auth-success h2 { margin-top: 18px; font: 700 21px/1.2 var(--lm-font-heading); color: var(--text-primary); }
.auth-success p { margin-top: 8px; color: var(--text-secondary); font-size: 14px; }
.auth-success .tech-btn { margin-top: 15px; }
.auth-success .lm-secret, .auth-success .lm-check { width: 100%; text-align: left; }
.auth-success .lm-secret .tech-btn, .auth-success .lm-check + .tech-btn { margin-top: 0; }
.auth-method-switch { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); margin: 0 0 18px; border: 1px solid var(--line-strong); background: var(--lm-field-bg); }
.auth-method-switch button { min-height: 38px; border: 0; background: transparent; color: var(--text-muted); font: 12px/1 "JetBrains Mono", monospace; letter-spacing: .08em; text-align: center; text-transform: uppercase; cursor: pointer; }
.auth-method-switch button[aria-selected="true"] { background: color-mix(in srgb, var(--accent-primary) 10%, transparent); color: var(--lm-accent-ink); box-shadow: inset 0 -1px 0 var(--accent-primary); }

/* Decorative circuit background */
.circuit-background { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--accent-primary); opacity: var(--lm-circuit-opacity); pointer-events: none; }
.circuit-traces { animation: circuit-flow 4s linear infinite; }
.circuit-node { transform-box: fill-box; transform-origin: center; fill: var(--accent-primary); animation: data-pulse 2s ease-in-out infinite; }
.circuit-node:nth-child(2) { animation-delay: 180ms; } .circuit-node:nth-child(3) { animation-delay: 360ms; }
.circuit-node:nth-child(4) { animation-delay: 540ms; } .circuit-node:nth-child(5) { animation-delay: 720ms; }
.circuit-node:nth-child(6) { animation-delay: 900ms; } .circuit-node:nth-child(7) { animation-delay: 1080ms; }
.circuit-node:nth-child(8) { animation-delay: 1260ms; }
.circuit-stop-a { stop-color: var(--accent-primary); } .circuit-stop-b { stop-color: var(--accent-quaternary); }
@keyframes circuit-flow { to { stroke-dashoffset: -72; } }
@keyframes data-pulse { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.25); } }

/* LMail elements of the sign-in scene (SPEC-UI 2.4) */
.lm-corner { position: absolute; z-index: 2; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); display: flex; gap: 8px; }
.lm-recent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 6px; }
.lm-recent__title { flex: 0 0 100%; color: var(--text-muted); font-size: 12px; }
.lm-recent__item { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--border-color); border-radius: var(--r-sm);
  background: var(--lm-control-bg); }
.lm-recent__pick { min-width: 0; min-height: 32px; padding: 0 4px 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); font-size: 13px; }
.lm-recent__remove { width: 28px; height: 32px; flex: none; display: grid; place-items: center; color: var(--text-muted); }
.lm-recent__remove:hover { color: var(--lm-danger-ink); }
.lm-auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 14px; }
.lm-auth-help { margin-top: 12px; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.lm-auth-portal { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; }
.lm-auth-foot { position: relative; z-index: 1; margin-top: 16px; color: var(--text-muted); font: 500 12px/1 var(--font-mono); letter-spacing: .08em; text-align: center; }
.lm-secret { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 14px 0; }
.lm-check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 16px; color: var(--text-secondary); font-size: 13.5px; line-height: 1.45; cursor: pointer; }
.lm-auth-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }

@media (max-width: 820px) { .lm-recent__pick, .lm-recent__remove { min-height: 44px; } .lm-recent__remove { width: 44px; }
  .lm-corner > button { width: 44px; height: 44px; }
  .auth-text-field { font-size: 16px; }
  .auth-link { display: inline-flex; align-items: center; min-height: 44px; } .lm-auth-links { margin-top: 4px; gap: 0 16px; } .lm-auth-portal { margin-top: 6px; } .lm-auth-help { margin-top: 2px; } }
@media (max-width: 560px) { .auth-terminal { padding: 25px 20px; } }
/* Compact card: the sign-in form has to fit a 360x640 screen without scrolling,
   below the corner buttons (16 + 44 px). */
@media (max-width: 560px), (max-height: 800px) {
  .auth-stage { padding: 60px 12px 8px; align-content: start; }
  .lm-corner { top: calc(10px + env(safe-area-inset-top)); }
  .auth-terminal { padding-top: 12px; padding-bottom: 12px; }
  .auth-terminal__status, .auth-terminal__brand > span:not(.lapis-logo) { display: none; }
  .auth-terminal__brand { margin: 0 auto 4px; gap: 0; }
  .auth-terminal h1 { margin-top: 4px; font-size: 22px; }
  .auth-terminal > p { margin: 4px auto 8px; line-height: 1.4; }
  .auth-submit { margin-top: 4px; }
  .auth-terminal > .lm-banner { flex-wrap: nowrap; margin: -4px 0 10px; padding: 6px 10px; font-size: 12.5px; line-height: 1.35; }
  .auth-terminal > .lm-banner > span { flex: 1; }
  .lapis-logo--auth { width: min(84px, 50vw); }
  .terminal-form { gap: 6px; }
  .otp-field { height: 46px; }
  .auth-hint { margin-top: -2px; font-size: 12px; line-height: 1.35; }
  /* recent mailboxes in one scrollable line (44 px targets kept) */
  .lm-recent { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -2px 0 0; }
  .lm-recent::-webkit-scrollbar { display: none; }
  .lm-recent__title { flex: none; }
  .lm-recent__item { flex: none; max-width: 70%; }
  /* links: a visible 36 px row with a 44 px target */
  .auth-link { min-height: 44px; margin-block: -4px; }
  .lm-auth-links { margin-top: 4px; gap: 0 16px; }
  .lm-auth-help { margin-top: 2px; font-size: 12px; line-height: 1.4; }
  .lm-auth-portal { margin-top: 4px; }
  .lm-auth-foot { margin-top: 6px; }
}
@media (min-width: 561px) and (max-height: 800px) { .auth-stage { padding-top: 16px; align-content: center; } }
