.source-heading {
  align-items: center;
  gap: 18px;
}

.source-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.header-record {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(91, 105, 59, .26);
  border-radius: 999px;
  background: rgba(255, 253, 248, .72);
  color: #46512f;
  padding: 0 16px 0 11px;
  font: 600 10px/1 Montserrat, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.header-record:hover,
.header-record:focus-visible { border-color: #5b693b; background: #fffdf8; }
.header-record:active { transform: scale(.98); }
.header-record:disabled { cursor: wait; opacity: .55; }
.header-record.is-recording {
  border-color: rgba(195, 88, 42, .45);
  color: #9d4628;
  background: rgba(255, 247, 242, .92);
}


.header-record .mic-mark {
  width: 18px;
  height: 18px;
  margin-right: 7px;
  font-size: 9px;
}

.input-guidance {
  margin: -4px 0 10px 23px;
  color: #91847b;
  font: 400 11px/1.5 Montserrat, sans-serif;
}

.voice-capture {
  padding: 10px 0 2px;
}

.voice-active,
.voice-recovery {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-button {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(91, 105, 59, .28);
  background: rgba(255, 253, 248, .78);
  color: #46512f;
  padding: 0 20px;
  font: 600 11px/1 Montserrat, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.voice-button:hover,
.voice-button:focus-visible { border-color: #5b693b; background: #fffdf8; }
.voice-button:active { transform: scale(.98); }
.voice-button:disabled { cursor: wait; opacity: .58; }
.voice-button.stop { border-color: rgba(195, 88, 42, .45); color: #a44725; }
.voice-button.discard { border-color: transparent; background: transparent; color: #916c5b; padding-inline: 12px; }

.mic-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 7px;
  border-radius: 50%;
  background: #5b693b;
  color: #fffdf8;
  font-size: 12px;
}

.voice-active[hidden],
.voice-recovery[hidden] { display: none; }

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: #a44725;
  font: 600 11px/1 Montserrat, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c65d31;
  box-shadow: 0 0 0 6px rgba(198, 93, 49, .11);
  animation: voice-pulse 1.5s ease-in-out infinite;
}

.voice-wave { display: flex; align-items: center; gap: 3px; height: 22px; }
.voice-wave i { width: 2px; height: 8px; border-radius: 2px; background: #c65d31; animation: voice-wave .9s ease-in-out infinite alternate; }
.voice-wave i:nth-child(2) { animation-delay: -.3s; }
.voice-wave i:nth-child(3) { animation-delay: -.6s; }
.voice-wave i:nth-child(4) { animation-delay: -.15s; }

.voice-status {
  flex: 1 1 220px;
  margin: 0;
  color: #887b73;
  font: 400 12px/1.55 Montserrat, sans-serif;
}

.voice-status.working { color: #5b693b; }
.voice-status.error { color: #aa4b3e; }

@keyframes voice-pulse { 50% { box-shadow: 0 0 0 10px rgba(198, 93, 49, 0); } }
@keyframes voice-wave { to { height: 20px; } }

@media (max-width: 680px) {
  .source-heading { flex-wrap: wrap; gap: 8px 12px; }
  .source-heading-actions {
    flex: 0 0 100%;
    justify-content: space-between;
    padding-left: 23px;
  }
  .input-guidance { margin: 0 0 8px 23px; }
  .header-record { min-width: 104px; }
  .voice-capture { padding-top: 10px; }
  .voice-active, .voice-recovery { align-items: stretch; }
  .voice-button { flex: 1 1 auto; padding-inline: 16px; }
  .voice-status { flex-basis: 100%; order: 3; }
  .recording-indicator { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .recording-dot, .voice-wave i { animation: none; }
  .voice-button, .header-record { transition: none; }
}

/* Keep idle voice guidance compact and attached to its action. */
.record-action {
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transform: translateY(-3px);
}

.record-guidance {
  color: #91847b;
  font: 400 10px/1.4 Montserrat, sans-serif;
  letter-spacing: .015em;
  white-space: nowrap;
}

.source-heading-actions output { order: 0; }
.source-heading-actions .record-action { order: 1; }
.voice-capture[hidden], .voice-status[hidden] { display: none; }

@media (max-width: 680px) {
  .source-heading-actions {
    justify-content: flex-end;
    gap: 10px;
  }

  .source-heading-actions output { margin-right: auto; }
  .record-guidance { font-size: 9px; }
}

.count-actions { order: 0; display: flex; align-items: center; gap: 10px; }
.clear-draft {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #a06751;
  padding: 0 6px;
  font: 500 9px/1 Montserrat, sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: .78;
}
.clear-draft:hover, .clear-draft:focus-visible { opacity: 1; color: #8f4e37; }
.clear-draft:disabled { cursor: wait; opacity: .35; }
.clear-draft[hidden] { display: none; }
@media (max-width: 680px) {
  .count-actions { margin-right: auto; gap: 8px; }
  .source-heading-actions .count-actions output { margin-right: 0; }
}

/* Calm, single-row media controls on phones. */
@media (max-width: 680px) {
  .source-heading {
    align-items: stretch;
    gap: 14px;
  }

  .source-heading > div:first-child {
    width: 100%;
  }

  .source-heading-actions {
    flex: 0 0 100%;
    width: 100%;
    padding-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .count-actions {
    width: 100%;
    margin-right: 0;
    justify-content: flex-start;
  }

  .voice-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    align-items: stretch;
  }

  .voice-actions .audio-upload,
  .voice-actions .header-record,
  .voice-actions .record-action {
    width: 100%;
    min-width: 0;
  }

  .voice-actions .audio-upload {
    padding-inline: 8px;
  }

  .voice-actions .audio-upload::before {
    display: inline-grid;
    place-items: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border: 1px solid rgba(91, 105, 59, .55);
    border-radius: 50%;
    color: #5b693b;
    font: 500 13px/1 Montserrat, sans-serif;
  }

  #upload-audio::before,
  .voice-actions .photo-upload::before { content: "+"; }
  #upload-audio { order: 1; font-size: 0; }
  #upload-audio::after { content: "Audio"; font-size: 9px; }
  .voice-actions .record-action { order: 2; transform: none; }
  .voice-actions .photo-upload { order: 3; font-size: 0; }
  .voice-actions .photo-upload::after { content: "Photos"; font-size: 9px; }
  .record-guidance { display: none; }
}

@media (max-width: 380px) {
  .voice-actions { gap: 6px; }
  .voice-actions .audio-upload,
  .voice-actions .header-record { padding-inline: 6px; letter-spacing: .07em; }
}
/* Calm two-level desktop media header. */
@media (min-width: 681px) {
  .source-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px 20px;
  }

  .source-heading > .source-heading-actions { display: contents; }

  .count-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .voice-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
    align-items: center;
    gap: 8px;
    max-width: 100%;
  }

  .voice-actions #upload-audio { order: 1; }
  .voice-actions .record-action { order: 2; transform: none; }
  .voice-actions .photo-upload { order: 3; }

  .voice-actions .audio-upload,
  .voice-actions .record-action {
    width: 96px;
    min-width: 0;
  }

  .voice-actions .header-record {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
  }

  .voice-actions .audio-upload::before {
    display: inline-grid;
    place-items: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border: 1px solid rgba(91, 105, 59, .55);
    border-radius: 50%;
    color: #5b693b;
    font: 500 13px/1 Montserrat, sans-serif;
  }

  #upload-audio::before,
  .voice-actions .photo-upload::before { content: "+"; }
}