.pva-widget {
  position: fixed;
  right: 24px;
  bottom: calc(24px + var(--pva-offset, 0px));
  z-index: 9998;
  width: min(360px, calc(100vw - 24px));
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pva-widget.pva-manual {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: 420px;
  margin: 1.5rem 0;
}

.pva-shell {
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pva-launcher {
  display: none;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pva-accent, #111827), #334155);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pva-widget.is-closed {
  width: 64px;
}

.pva-widget.is-closed .pva-launcher {
  display: inline-flex;
}

.pva-widget.is-closed .pva-shell {
  display: none;
}

.pva-widget.pva-manual .pva-launcher,
.pva-widget.pva-manual .pva-close {
  display: none !important;
}

.pva-launcher-logo,
.pva-launcher-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #ffffff;
  font-weight: 700;
  font-size: 24px;
}

.pva-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--pva-accent, #111827), #334155);
  color: #ffffff;
}

.pva-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pva-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pva-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.pva-logo-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
}

.pva-title {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.pva-subtitle {
  opacity: 0.84;
  font-size: 12px;
}

.pva-speak-toggle,
.pva-close,
.pva-mic,
.pva-send {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.pva-speak-toggle,
.pva-close {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 16px;
}

.pva-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.pva-message {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.pva-message-user {
  align-self: flex-end;
  background: var(--pva-accent, #111827);
  color: #ffffff;
}

.pva-message-assistant {
  align-self: flex-start;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.pva-form {
  padding: 14px;
  background: #ffffff;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.pva-input {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  outline: none;
  font-size: 14px;
  box-sizing: border-box;
}

.pva-input:focus {
  border-color: var(--pva-accent, #111827);
  box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.12);
}

.pva-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.pva-mic {
  width: 46px;
  height: 46px;
  font-size: 18px;
  background: #e2e8f0;
}

.pva-mic.is-listening {
  background: #fee2e2;
}

.pva-send {
  background: var(--pva-accent, #111827);
  color: #ffffff;
  padding: 12px 18px;
  font-weight: 600;
}

.pva-send:disabled {
  opacity: 0.7;
  cursor: progress;
}

@media (max-width: 767px) {
  .pva-widget {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(12px + var(--pva-offset, 0px));
  }

  .pva-widget.is-closed {
    left: auto;
    width: 64px;
  }

  .pva-messages {
    max-height: 220px;
  }
}
