[data-listing-voice] {
  --voice-edge: max(20px, env(safe-area-inset-right));
  --voice-bottom: max(20px, env(safe-area-inset-bottom));
  --voice-open: min(385px, max(310px, 26vw));
  --voice-cream: #fff9ed;
}

body:has([data-listing-voice]:not([hidden])) { padding-bottom: 74px; }
body:has(.voice-dock:not([data-state="idle"])) { padding-bottom: 176px; }

.voice-dock {
  position: fixed;
  z-index: 5;
  right: var(--voice-edge);
  bottom: var(--voice-bottom);
  display: grid;
  grid-template-rows: 1fr 0fr;
  width: 162px;
  height: 52px;
  overflow: hidden;
  color: var(--voice-cream);
  background: linear-gradient(135deg, #26312ff2, #171e20ed 75%);
  border: 1px solid #50645b;
  border-radius: 50px;
  box-shadow: 0 9px 28px #18252142, inset 0 1px #f3fff124;
  backdrop-filter: blur(19px) saturate(125%);
  transition: width .36s cubic-bezier(.22,.75,.23,1), height .36s cubic-bezier(.22,.75,.23,1), border-radius .32s ease;
}
.voice-dock[data-state="idle"] { background: linear-gradient(140deg, #237355, #0e6043); border-color: #358466; }

.voice-dock:not([data-state="idle"]) {
  grid-template-rows: 0fr 1fr;
  width: var(--voice-open);
  height: var(--voice-panel-height, 145px);
  border-radius: 23px;
}
.voice-dock[data-state="connected"] {
  box-shadow: 0 9px 28px #18252142, 0 0 26px #67a48436, inset 0 1px #f3fff124;
}

.voice-launch, .voice-panel { min-height: 0; overflow: hidden; }
.voice-launch {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: .88rem;
  font-weight: 650;
  transition: opacity .16s ease;
}
.voice-dock:not([data-state="idle"]) .voice-launch { min-height: 0; opacity: 0; }
.voice-launch:hover { background: #d9f9df19; }
.voice-launch:focus-visible { outline-offset: -4px; border-radius: inherit; }
.voice-launch svg, .voice-hangup svg { width: 19px; height: 19px; flex: 0 0 auto; }

.voice-panel { opacity: 0; transition: opacity .18s ease; }
.voice-dock:not([data-state="idle"]) .voice-panel { opacity: 1; }
.voice-panel-inner {
  width: calc(var(--voice-open) - 2px);
  padding: 17px;
  background: radial-gradient(ellipse at 2% 0, #a0cbbf26, transparent 70%);
}
.voice-heading { display: flex; align-items: center; gap: 12px; }
.voice-heading h2, .voice-review h2 { margin: 0; font: 400 1.75rem/1.03 var(--serif); }
.voice-heading p { margin: 4px 0 0; color: #dce8e2; font-size: .81rem; }
.voice-signal { display: flex; gap: 3px; align-items: center; margin-left: auto; opacity: .48; }
.voice-signal i {
  width: 2px;
  height: 24px;
  border-radius: 2px;
  background: #b2e3c4;
  transform: scaleY(calc(.15 + var(--voice-level, 0) * var(--peak, .72)));
  transition: transform .12s ease-out;
}
.voice-signal i:nth-child(odd) { --peak: .43; }
.voice-signal i:nth-child(3) { --peak: .85; }
.voice-dock[data-state="connected"] .voice-signal { opacity: 1; }
.voice-dock[data-state="ended"] .voice-signal { display: none; }
.voice-clock { color: #d1e3d9; font-size: .82rem; font-variant-numeric: tabular-nums; }
.voice-controls { display: flex; gap: 8px; margin-top: 15px; }
.voice-controls button, .voice-review-actions button, .voice-sound { min-height: 44px; border-radius: 40px; padding-inline: 14px; font-size: .88rem; font-weight: 650; }
.voice-controls button:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 0; }
.voice-muted, .voice-sound { background: #ecfff516; border: 1px solid #d5eee53d; color: var(--voice-cream); }
.voice-muted:hover:not(:disabled), .voice-sound:hover { background: #ecfff52a; }
.voice-muted:disabled { opacity: .56; cursor: default; }
.voice-hangup { color: #fffaf5; background: #b03b43; border: 1px solid #f6adb275; }
.voice-hangup:hover { background: #c84b53; }
.voice-hangup svg { transform: rotate(135deg); width: 16px; height: 16px; }
.voice-notice { margin: 12px 0 0; color: #cfefd7; font-size: .85rem; }
.voice-sound { margin-top: 10px; }

.voice-review {
  width: min(550px, calc(100% - 32px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid #bdc8bf;
  border-radius: 23px;
  background: linear-gradient(145deg, #fffdf5b3, #e8eee4a6);
  backdrop-filter: blur(11px) saturate(125%);
  box-shadow: 0 20px 85px #28201975, inset 0 1px #fff8ec;
  color: var(--ink);
  overflow: auto;
}
.voice-review[open] { animation: review-reveal .24s cubic-bezier(.22,.75,.23,1); }
@keyframes review-reveal { from { opacity: 0; transform: translateY(13px) scale(.985); } }
.voice-review::backdrop { background: #1c25244d; backdrop-filter: blur(4px); }
.voice-review-body { padding: clamp(20px, 5vw, 37px); }
.voice-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.voice-review h2 { font-size: clamp(2.45rem, 6vw, 3.65rem); }
.voice-review h2:focus { outline: 0; }
.voice-review-close { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #677e7054; border-radius: 50%; color: #234738; background: #fffdf546; }
.voice-review-close:hover:not(:disabled) { background: #fffdf5a0; }
.voice-review-close svg { width: 19px; height: 19px; }
.voice-review p { margin: 12px 0 0; color: #49574d; line-height: 1.45; font-size: .9rem; }
.voice-details {
  margin: 22px 0 0;
  border-block: 1px solid #8fa59870;
}
.voice-details > div { padding: 12px 0; }
.voice-details > div + div { border-top: 1px solid #8fa59860; }
.voice-details dt { color: #49574d; font-size: .79rem; font-weight: 650; }
.voice-details dd { margin: 3px 0 0; font-size: 1.24rem; font-weight: 600; overflow-wrap: anywhere; }
.voice-details > div:last-child dd { font-variant-numeric: tabular-nums; }
.voice-review p.voice-form-error { margin: 10px 0 0; color: #912f2b; }
.voice-review-actions { display: flex; justify-content: end; margin-top: 20px; }
.voice-send { background: #176447; border: 1px solid #176447; color: #fffdf3; }
.voice-send:hover { background: #227958; }
.voice-review button:disabled { cursor: wait; opacity: .65; }

@media (max-width: 760px) {
  [data-listing-voice] {
    --voice-edge: max(12px, env(safe-area-inset-right));
    --voice-bottom: max(12px, env(safe-area-inset-bottom));
    --voice-open: calc(100vw - max(12px, env(safe-area-inset-left)) - var(--voice-edge));
  }
  .voice-review { width: calc(100% - 22px); max-height: calc(100dvh - 24px); }
  .voice-review-actions button { flex: 1 1 auto; }
}
