/* Email recovery extends the incumbent graphite/red redemption surface. */
.email-recovery {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 18px;
}

.email-recovery::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 auto auto;
  width: min(440px, 48%);
  height: 150px;
  pointer-events: none;
  opacity: .2;
  background: url('redemption-wave.svg?v=20261001r1') right top / 100% 100% no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 42%);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 42%);
}

.recovery-heading { position: relative; }

.recovery-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.recovery-steps li {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.recovery-steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  inset-inline: 42px 16px;
  top: 50%;
  height: 1px;
  background: #364049;
}

.recovery-steps span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid #515e69;
  border-radius: 50%;
  color: #bac2cc;
  background: #131a20;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.recovery-steps b {
  position: relative;
  z-index: 1;
  padding-inline-end: 10px;
  background: #10161a;
  color: inherit;
  white-space: nowrap;
}

.recovery-steps li.active { color: var(--ink); }
.recovery-steps li.active span { border-color: #f33c57; color: #fff; background: #ba2039; }
.recovery-steps li.done { color: #81dbb6; }
.recovery-steps li.done span { border-color: #376c58; color: #81dbb6; background: #152c24; }

.recovery-live-status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.8;
}

.recovery-live-status[data-tone='success'] { color: #91e0bd; }
.recovery-live-status[data-tone='error'] { color: #ffabb6; }

.email-recovery[aria-busy='true'] .recovery-live-status::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-inline-end: 9px;
  border: 2px solid #7b4551;
  border-top-color: #ffe7ec;
  border-radius: 50%;
  vertical-align: -2px;
  animation: recovery-spin .8s linear infinite;
}

@keyframes recovery-spin { to { transform: rotate(360deg); } }

.recovery-stage { min-width: 0; }
.recovery-field { max-width: 880px; }
.recovery-field .input-wrap { min-width: 0; }
.recovery-field input { min-height: 56px; }
.recovery-otp-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .16em;
}

.recovery-field-error {
  margin: 10px 0 0;
  color: #ffabb6;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.6;
}

.recovery-field input[aria-invalid='true'] {
  border-color: #d24b64;
  box-shadow: inset 0 0 0 1px #d24b64;
}

.recovery-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

.recovery-context .inline-link { flex: none; }
.recovery-secondary-actions { display: flex; gap: 10px; margin-top: 16px; }

.recovery-results { padding-top: 22px; }
.recovery-results-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.recovery-results-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: -.02em;
}

.recovery-results-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.recovery-results-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.recovery-list { list-style: none; margin: 0; padding: 0; }
.recovery-item { min-width: 0; padding: 22px 0; border-bottom: 1px solid var(--line); }
.recovery-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.recovery-item-labels { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.recovery-item-plan { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.recovery-item-time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.recovery-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.recovery-code {
  display: block;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #3b4752;
  border-radius: 12px;
  background: #090e12;
  color: #f7f7f8;
  font: 650 14px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.recovery-copy { min-width: 112px; }
.recovery-copy .ui-icon { width: 18px; height: 18px; }
.recovery-copy-status { min-height: 22px; margin: 14px 0 0; color: #91e0bd; font-size: 13px; }

.recovery-empty {
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.recovery-empty strong { display: block; color: var(--ink); font-size: 15px; }
.recovery-empty p { margin: 5px 0 0; font-size: 13px; line-height: 1.8; }

.recovery-privacy {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.recovery-privacy .ui-icon { flex: none; width: 18px; height: 18px; margin-top: 2px; color: #a3aab4; }
.recovery-privacy p { margin: 0; max-width: 78ch; }

@media (max-width: 620px) {
  .recovery-field input { font-size: 16px; }
  .recovery-context .inline-link { min-height: 44px; }
  .email-recovery::before { width: 100%; height: 132px; opacity: .14; }
  .recovery-steps { padding: 16px 0; }
  .recovery-steps li { gap: 7px; font-size: 11px; }
  .recovery-steps li:not(:last-child)::after { inset-inline: 36px 10px; }
  .recovery-steps span { width: 27px; height: 27px; font-size: 11px; }
  .recovery-steps b { padding-inline-end: 6px; }
  .recovery-live-status { margin-top: 16px; }
  .recovery-context, .recovery-results-head, .recovery-item-head { align-items: flex-start; flex-direction: column; }
  .recovery-context { gap: 5px; }
  .recovery-results-actions { width: 100%; }
  .recovery-results-actions .btn { width: 100%; }
  .recovery-code-row { grid-template-columns: minmax(0, 1fr); }
  .recovery-copy { width: 100%; }
  .recovery-item-time { flex: none; }
  .recovery-secondary-actions .btn { width: 100%; }
}

@media (max-width: 350px) {
  .recovery-steps b { font-size: 11px; }
  .recovery-steps li { gap: 5px; }
  .recovery-steps li:not(:last-child)::after { inset-inline: 33px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .email-recovery[aria-busy='true'] .recovery-live-status::before { animation: none; }
}

@media (forced-colors: active) {
  .recovery-steps span, .recovery-code { border: 1px solid CanvasText; }
  .recovery-steps li.active span, .recovery-steps li.done span { forced-color-adjust: none; }
}
