.voice-text-wrap {
  display: grid;
  width: 100%;
  min-width: 0;
}

/* Field and mic occupy the same grid cell. The mic is therefore positioned
   against the actual field footprint instead of a page-dependent wrapper. */
.voice-text-wrap .voice-text-input {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  min-width: 0;
  padding-right: 48px !important;
}

.voice-text-mic {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0 8px 8px 0;
  padding: 0;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  background: #fff;
  color: #475467;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  line-height: 1;
}

/* CSS-drawn microphone: no emoji, font glyph, SVG, or image dependency. */
.voice-text-mic-icon {
  position: relative;
  display: block;
  width: 10px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.voice-text-mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  width: 14px;
  height: 9px;
  transform: translateX(-50%);
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 9px 9px;
}

.voice-text-mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 10px;
  height: 2px;
  transform: translateX(-50%);
  background: currentColor;
  border-radius: 2px;
  box-shadow: 0 -4px 0 -0.25px currentColor;
}

.voice-text-mic:hover,
.voice-text-mic:focus-visible {
  background: #f2f4f7;
  color: #101828;
  outline: none;
}

.voice-text-mic.is-listening {
  background: #fee4e2;
  color: #d92d20;
  animation: voice-text-pulse 1s ease-in-out infinite;
}

.voice-text-mic:disabled,
.voice-text-mic.voice-text-unavailable {
  cursor: not-allowed;
  opacity: .45;
}

.voice-text-mic.voice-text-denied {
  background: #fef3f2;
  color: #b42318;
}

@keyframes voice-text-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
