.cz-mfa-overlay {
  --cz-mfa-bg: #0b1120;
  --cz-mfa-panel: #101827;
  --cz-mfa-panel-soft: #0d1524;
  --cz-mfa-border: rgba(148, 163, 184, .16);
  --cz-mfa-border-strong: rgba(129, 140, 248, .38);
  --cz-mfa-text: #f8fafc;
  --cz-mfa-muted: #94a3b8;
  --cz-mfa-primary: #6366f1;
  --cz-mfa-primary-hover: #7376f5;
  --cz-mfa-success: #2dd4bf;
  --cz-mfa-danger: #fb7185;
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 12%, rgba(99, 102, 241, .18), transparent 34%),
    rgba(2, 6, 14, .84);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  animation: cz-mfa-fade-in .18s ease-out;
}

body.cz-mfa-open {
  overflow: hidden;
}

.cz-mfa-dialog {
  position: relative;
  width: min(760px, 100%);
  overflow: hidden;
  color: var(--cz-mfa-text);
  background: linear-gradient(145deg, rgba(16, 24, 39, .99), rgba(9, 15, 28, .99));
  border: 1px solid var(--cz-mfa-border);
  border-radius: 20px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .025) inset;
  animation: cz-mfa-rise-in .24s cubic-bezier(.2, .8, .2, 1);
}

.cz-mfa-dialog::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6366f1 30%, #22d3ee 70%, transparent);
}

.cz-mfa-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 26px 28px 20px;
  border-bottom: 1px solid var(--cz-mfa-border);
}

.cz-mfa-brand-icon {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #c7d2fe;
  background: linear-gradient(145deg, rgba(99, 102, 241, .28), rgba(59, 130, 246, .12));
  border: 1px solid rgba(129, 140, 248, .32);
  border-radius: 13px;
}

.cz-mfa-brand-icon svg,
.cz-mfa-button svg,
.cz-mfa-copy svg,
.cz-mfa-notice svg {
  width: 20px;
  height: 20px;
}

.cz-mfa-heading {
  min-width: 0;
  flex: 1;
}

.cz-mfa-eyebrow {
  margin: 0 0 5px;
  color: #818cf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.cz-mfa-title {
  margin: 0;
  color: var(--cz-mfa-text);
  font-size: 23px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.cz-mfa-subtitle {
  max-width: 560px;
  margin: 7px 0 0;
  color: var(--cz-mfa-muted);
  font-size: 13px;
  line-height: 1.55;
}

.cz-mfa-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  color: var(--cz-mfa-muted);
  background: rgba(148, 163, 184, .06);
  border: 1px solid var(--cz-mfa-border);
  border-radius: 10px;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.cz-mfa-close:hover {
  color: var(--cz-mfa-text);
  background: rgba(148, 163, 184, .12);
  border-color: rgba(148, 163, 184, .28);
}

.cz-mfa-close svg {
  width: 18px;
  height: 18px;
}

.cz-mfa-content {
  display: grid;
  grid-template-columns: minmax(250px, .88fr) minmax(280px, 1.12fr);
  gap: 26px;
  padding: 28px;
}

.cz-mfa-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 20px;
  background: rgba(2, 6, 23, .42);
  border: 1px solid var(--cz-mfa-border);
  border-radius: 16px;
}

.cz-mfa-qr-frame {
  position: relative;
  display: grid;
  width: min(230px, 100%);
  aspect-ratio: 1;
  place-items: center;
  padding: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .32);
}

.cz-mfa-qr-frame::after {
  content: "";
  position: absolute;
  inset: -6px;
  pointer-events: none;
  border: 1px solid rgba(129, 140, 248, .35);
  border-radius: 18px;
}

.cz-mfa-qr {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cz-mfa-qr-caption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  color: var(--cz-mfa-muted);
  font-size: 12px;
  text-align: center;
}

.cz-mfa-status-dot {
  width: 7px;
  height: 7px;
  background: var(--cz-mfa-success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, .11);
}

.cz-mfa-form {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.cz-mfa-step {
  display: flex;
  gap: 11px;
  margin-bottom: 18px;
}

.cz-mfa-step-number {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #c7d2fe;
  background: rgba(99, 102, 241, .16);
  border: 1px solid rgba(129, 140, 248, .25);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
}

.cz-mfa-step-copy strong {
  display: block;
  margin-bottom: 3px;
  color: #e2e8f0;
  font-size: 13px;
}

.cz-mfa-step-copy span {
  display: block;
  color: var(--cz-mfa-muted);
  font-size: 12px;
  line-height: 1.45;
}

.cz-mfa-secret-group {
  margin: 1px 0 20px;
}

.cz-mfa-label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 650;
}

.cz-mfa-secret-row {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: rgba(2, 6, 23, .52);
  border: 1px solid var(--cz-mfa-border);
  border-radius: 11px;
}

.cz-mfa-secret {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 11px 12px;
  color: #c7d2fe;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: .045em;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.cz-mfa-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: #a5b4fc;
  background: rgba(99, 102, 241, .1);
  border: 0;
  border-left: 1px solid var(--cz-mfa-border);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}

.cz-mfa-copy:hover {
  color: #e0e7ff;
  background: rgba(99, 102, 241, .19);
}

.cz-mfa-copy svg {
  width: 15px;
  height: 15px;
}

.cz-mfa-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  color: var(--cz-mfa-text);
  background: rgba(2, 6, 23, .58);
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 11px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .32em;
  text-align: center;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.cz-mfa-input::placeholder {
  color: #64748b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
}

.cz-mfa-input:focus {
  background: rgba(2, 6, 23, .78);
  border-color: var(--cz-mfa-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}

.cz-mfa-input[aria-invalid="true"] {
  border-color: var(--cz-mfa-danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, .12);
}

.cz-mfa-error {
  min-height: 19px;
  margin: 7px 0 5px;
  color: var(--cz-mfa-danger);
  font-size: 12px;
  line-height: 1.45;
}

.cz-mfa-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
}

.cz-mfa-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}

.cz-mfa-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.cz-mfa-button:focus-visible,
.cz-mfa-copy:focus-visible,
.cz-mfa-close:focus-visible {
  outline: 3px solid rgba(129, 140, 248, .38);
  outline-offset: 2px;
}

.cz-mfa-button:disabled {
  cursor: wait;
  opacity: .66;
}

.cz-mfa-button-primary {
  min-width: 132px;
  color: #fff;
  background: linear-gradient(135deg, var(--cz-mfa-primary), #4f46e5);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .24);
}

.cz-mfa-button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--cz-mfa-primary-hover), #5b52ed);
}

.cz-mfa-button-secondary {
  color: #cbd5e1;
  background: rgba(148, 163, 184, .07);
  border-color: var(--cz-mfa-border);
}

.cz-mfa-button-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 184, .12);
  border-color: rgba(148, 163, 184, .28);
}

.cz-mfa-recovery {
  width: min(620px, 100%);
}

.cz-mfa-recovery-body {
  padding: 26px 28px 28px;
}

.cz-mfa-notice {
  display: flex;
  gap: 11px;
  margin-bottom: 20px;
  padding: 13px 14px;
  color: #fde68a;
  background: rgba(245, 158, 11, .09);
  border: 1px solid rgba(245, 158, 11, .2);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.cz-mfa-notice svg {
  flex: 0 0 19px;
  margin-top: 1px;
}

.cz-mfa-code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.cz-mfa-recovery-code {
  padding: 10px 12px;
  color: #e0e7ff;
  background: rgba(2, 6, 23, .5);
  border: 1px solid var(--cz-mfa-border);
  border-radius: 9px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  letter-spacing: .07em;
  text-align: center;
  user-select: all;
}

.cz-mfa-recovery-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.cz-mfa-recovery-hint {
  color: var(--cz-mfa-muted);
  font-size: 11px;
  line-height: 1.4;
}

@keyframes cz-mfa-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cz-mfa-rise-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 680px) {
  .cz-mfa-overlay {
    place-items: start center;
    padding: 14px;
  }

  .cz-mfa-dialog {
    margin: auto 0;
    border-radius: 17px;
  }

  .cz-mfa-header {
    padding: 21px 20px 17px;
  }

  .cz-mfa-title {
    font-size: 20px;
  }

  .cz-mfa-content {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .cz-mfa-qr-panel {
    padding: 17px;
  }

  .cz-mfa-qr-frame {
    width: min(210px, 82vw);
  }

  .cz-mfa-recovery-body {
    padding: 20px;
  }

  .cz-mfa-code-grid {
    grid-template-columns: 1fr;
  }

  .cz-mfa-recovery-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .cz-mfa-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
  }

  .cz-mfa-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cz-mfa-overlay,
  .cz-mfa-dialog {
    animation: none;
  }

  .cz-mfa-button,
  .cz-mfa-close,
  .cz-mfa-input {
    transition: none;
  }
}
