/**
 * Plus AI — pannello chat stile ChatGPT.
 */
.pt-assist-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pt-assist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.pt-assist-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.pt-assist-btn.is-open {
  background: #111827;
  border-color: #111827;
  color: #fff;
}
.pt-assist-btn.pt-assist-btn-credits {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35);
  color: #991b1b;
}
.pt-assist-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pt-assist-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 12040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.pt-assist-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pt-assist-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  z-index: 12050;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(105%);
  transition: transform 0.24s ease;
}
.pt-assist-panel.is-open {
  transform: translateX(0);
}

.pt-assist-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}
.pt-assist-head-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.pt-assist-head-sub {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  display: block;
  margin-top: 2px;
}
.pt-assist-close {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.pt-assist-close:hover {
  background: #f3f4f6;
}

.pt-assist-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 20px;
  background: #f7f7f8;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pt-assist-msg {
  max-width: 100%;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.pt-assist-msg.user {
  align-self: flex-end;
  max-width: 88%;
  padding: 10px 14px;
  background: #111827;
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  font-size: 14px;
}
.pt-assist-msg.bot {
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 2px;
  background: transparent;
  color: #111827;
  border: none;
}
.pt-assist-msg.bot strong {
  font-weight: 700;
}
.pt-assist-msg.bot a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
}
.pt-assist-msg.bot a:hover {
  color: #1d4ed8;
}
.pt-assist-typing {
  color: #6b7280 !important;
  font-style: normal;
  animation: ptAssistPulse 1.1s ease-in-out infinite;
}
.pt-assist-streaming.pt-assist-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: #6b7280;
  animation: ptAssistCursor 0.9s step-end infinite;
}
@keyframes ptAssistPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
@keyframes ptAssistCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.pt-assist-msg.system {
  align-self: center;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 12px;
  max-width: 100%;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
}

.pt-assist-credits-alert {
  margin: 0;
  padding: 10px 12px;
  background: #fef2f2;
  color: #991b1b;
  border-bottom: 1px solid #fecaca;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
}
.pt-assist-credits-alert strong {
  display: block;
  margin-bottom: 4px;
}
.pt-assist-credits-alert.is-hidden {
  display: none;
}

.pt-assist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 4px;
  background: #f7f7f8;
  border-top: 1px solid #ececf1;
}
.pt-assist-chip {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.pt-assist-chip:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.pt-assist-foot {
  padding: 12px 14px 16px;
  border-top: 1px solid #ececf1;
  background: #fff;
}
.pt-assist-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.pt-assist-input-row:focus-within {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}
.pt-assist-mic {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #6b7280;
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-assist-mic:hover:not([disabled]) {
  background: #f3f4f6;
  color: #111827;
}
.pt-assist-mic.is-listening {
  background: #fee2e2;
  color: #dc2626;
}
.pt-assist-mic[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.pt-assist-mic-wave {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 22px;
  flex-shrink: 0;
}
.pt-assist-mic-wave.is-live {
  display: inline-flex;
}
.pt-assist-wave-bar {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: #dc2626;
  transform-origin: bottom;
  transition: transform 0.08s linear;
}

.pt-assist-input {
  flex: 1;
  min-height: 24px;
  max-height: 140px;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  padding: 6px 4px;
  background: transparent;
  color: #111827;
}
.pt-assist-input::placeholder {
  color: #9ca3af;
}

.pt-assist-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-assist-send:hover:not([disabled]) {
  background: #000;
}
.pt-assist-send[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.pt-assist-voice-hint {
  margin: 6px 4px 0;
  font-size: 11px;
  color: #6b7280;
}
.pt-assist-hint {
  margin: 8px 4px 0;
  font-size: 10px;
  color: #9ca3af;
  line-height: 1.4;
}

.pt-assist-approve-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.pt-assist-approve-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.pt-assist-approve-btn--yes {
  background: #111827;
  border-color: #111827;
  color: #fff;
}
.pt-assist-approve-btn:hover {
  filter: brightness(0.97);
}

@media (max-width: 720px) {
  .pt-assist-btn span:last-child { display: none; }
  .pt-assist-panel { width: 100vw; }
  .pt-assist-input { font-size: 16px; }
  .pt-assist-send, .pt-assist-mic, .pt-assist-close {
    min-width: 40px;
    min-height: 40px;
  }
}
