/* Voice messages inherit the chat palette in both themes. */
.voice-player {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 270px;
  max-width: 100%;
  min-width: 0;
  padding: 5px 0;
  color: var(--text);
}
.voice-player audio {
  display: none;
}
.voice-player svg,
.voice-modal svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
body button.voice-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: var(--surface);
  box-shadow: none;
}
body button.voice-play:hover {
  filter: brightness(0.94);
  background: var(--brand);
}
.voice-player-body {
  flex: 1;
  min-width: 0;
}
.voice-player-top,
.voice-player-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.voice-player-title {
  font-size: 12px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body button.voice-speed {
  min-height: 24px;
  min-width: 32px;
  height: 24px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
}
body button.voice-speed:hover {
  background: var(--brand-soft);
  color: var(--brand);
}
.voice-player input.voice-seek {
  --voice-progress: 0%;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: 4px !important;
  min-height: 4px !important;
  margin: 8px 0 9px;
  padding: 0 !important;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(
    to right,
    var(--brand) var(--voice-progress),
    color-mix(in srgb, var(--text-secondary) 22%, transparent)
      var(--voice-progress)
  );
  cursor: pointer;
  box-shadow: none;
}
.voice-seek::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
}
.voice-seek::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
}
.voice-player-meta {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}
.voice-play-error {
  color: #dc5264;
  font-size: 10px;
}
.voice-bubble .media-link {
  display: none;
}
.voice-bubble .message-meta {
  margin-top: 3px;
}
.voice-modal .composer-recipient {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
dialog.form-modal.composer-modal.voice-modal {
  width: min(440px, calc(100vw - 24px));
}
.voice-modal .form-modal-body {
  padding: 16px 20px 20px;
}
.voice-modal .composer-dialog-form {
  gap: 16px;
}
.voice-recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}
.voice-mic-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 14px;
}
.voice-record-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}
.voice-modal p.voice-record-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  min-height: 20px;
}
.voice-record-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  margin-top: 16px;
  width: 100%;
}
.voice-record-meter span {
  width: 4px;
  height: 32px;
  transform: scaleY(0.125);
  transform-origin: center;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-secondary) 30%, transparent);
  transition: transform 80ms linear;
}
.voice-record-timer {
  margin: 4px 0 18px;
  font-size: 30px;
  font-weight: 550;
  letter-spacing: 1px;
  line-height: 38px;
  font-variant-numeric: tabular-nums;
}
body button.voice-record-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--surface);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 550;
}
.voice-record-limit {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 11px;
}
.voice-recorder[data-state="recording"] .voice-mic-badge {
  color: #e3495e;
  background: color-mix(in srgb, #e3495e 12%, var(--surface));
}
.voice-recorder[data-state="recording"] .voice-record-meter span {
  background: var(--brand);
}
.voice-recorder[data-state="recording"] .voice-record-status {
  color: #e3495e;
}
body .voice-recorder[data-state="recording"] .voice-record-button {
  background: #de4157;
  color: #fff;
}
.voice-modal label.voice-upload {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border: 1px dashed var(--input);
  border-radius: 9px;
  cursor: pointer;
  margin: 0;
}
.voice-upload:hover,
.voice-upload:focus-within {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.voice-upload:has(input:disabled) {
  opacity: 0.5;
  cursor: default;
}
.voice-upload-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-secondary);
}
.voice-upload > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.voice-upload strong {
  font-size: 12px;
  font-weight: 550;
}
.voice-upload small {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 16px;
}
.voice-modal .voice-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.voice-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-soft);
}
.voice-preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.voice-preview-heading strong {
  font-size: 12px;
  font-weight: 600;
}
body button.voice-rerecord {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  padding: 3px 0 3px 6px;
  min-height: 28px;
}
.voice-rerecord svg {
  width: 14px;
  height: 14px;
}
.voice-preview .voice-player {
  width: 100%;
}
.voice-modal p.voice-file-info {
  font-size: 10px;
  line-height: 16px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
@media (max-width: 600px) {
  .voice-modal .form-modal-body {
    padding: 14px 16px 16px;
  }
  .voice-recorder {
    padding: 20px 12px 16px;
  }
  .voice-player {
    width: 240px;
    gap: 10px;
  }
  .voice-bubble {
    max-width: calc(100vw - 96px);
  }
  body button.voice-play {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }
  body button.voice-speed {
    min-height: 32px;
    min-width: 34px;
  }
  .voice-player input.voice-seek {
    margin: 12px 0;
  }
  .voice-upload small {
    max-width: 230px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .voice-record-meter span {
    transition: none;
  }
}
.voice-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-left: auto;
  width: 22px;
  height: 20px;
}
.voice-download svg {
  width: 13px;
  height: 13px;
}
.voice-download:hover {
  color: var(--brand);
}
