#wp-ai-agent-root { position: relative; z-index: 2147483000; }
#wp-ai-widget {
  --wp-ai-offset-x: 2%;
  --wp-ai-offset-y: 2%;
  position: fixed;
  bottom: max(12px, var(--wp-ai-offset-y));
  right: max(12px, var(--wp-ai-offset-x));
  z-index: 2147483000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}
#wp-ai-widget.wp-ai-widget--left {
  right: auto;
  left: max(12px, var(--wp-ai-offset-x));
}
@media (display-mode: standalone), (max-width: 480px) {
  #wp-ai-widget {
    bottom: max(12px, calc(var(--wp-ai-offset-y) + env(safe-area-inset-bottom, 0px)));
    right: max(12px, calc(var(--wp-ai-offset-x) + env(safe-area-inset-right, 0px)));
  }
  #wp-ai-widget.wp-ai-widget--left {
    left: max(12px, calc(var(--wp-ai-offset-x) + env(safe-area-inset-left, 0px)));
  }
}
#wp-ai-widget.wp-ai-widget--left .wp-ai-panel { right: auto; left: 0; }
#wp-ai-widget > * { pointer-events: auto; }
.wp-ai-toggle {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0 !important;
  border: none;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
  color: #fff;
  line-height: 1;
}
.wp-ai-toggle svg { display: block; flex-shrink: 0; }
.wp-ai-toggle:hover { transform: scale(1.05); }
.wp-ai-panel { position: absolute; bottom: 70px; right: 0; width: 380px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 100px); background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; color: #1e293b; }
.wp-ai-panel[hidden] { display: none !important; }
.wp-ai-header { color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.wp-ai-header button { background: transparent; border: none; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }
.wp-ai-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.wp-ai-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.wp-ai-msg-user { align-self: flex-end; background: #eef2ff; color: #312e81; }
.wp-ai-msg-assistant { align-self: flex-start; background: #f1f5f9; color: #334155; }
.wp-ai-msg-human { align-self: flex-start; background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.wp-ai-human-banner {
  background: linear-gradient(90deg, rgba(16,185,129,0.15), rgba(79,70,229,0.1));
  color: #065f46;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(16,185,129,0.25);
  text-align: center;
}
.wp-ai-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e2e8f0; }
.wp-ai-form input { flex: 1; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; }
.wp-ai-form input:focus { border-color: #6366f1; }
.wp-ai-form input:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }
.wp-ai-form button { border: none; color: #fff; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; }
.wp-ai-form button:disabled { opacity: 0.55; cursor: not-allowed; }
.wp-ai-watermark { text-align: center; font-size: 10px; color: #94a3b8; padding: 4px; margin: 0; }
.wp-ai-chat-footer {
  border-top: 1px solid #e2e8f0;
  padding: 8px 12px 10px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.wp-ai-studio-credit {
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
  color: #64748b;
  margin: 0;
}
.wp-ai-studio-credit strong {
  color: #334155;
  font-weight: 600;
}
.wp-ai-studio-credit a {
  color: #4f46e5;
  font-weight: 700;
  text-decoration: none;
}
.wp-ai-studio-credit a:hover,
.wp-ai-studio-credit a:focus {
  text-decoration: underline;
}
.wp-ai-studio-credit--subtle {
  font-size: 10px;
  opacity: 0.88;
}

.wp-ai-msg a { color: #4f46e5; text-decoration: underline; word-break: break-word; }
.wp-ai-msg-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wp-ai-action-btn {
  border: 1px solid #c7d2fe;
  background: #fff;
  color: #4338ca;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.wp-ai-action-btn--primary { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.wp-ai-action-btn--checkout { background: #059669; color: #fff; border-color: #059669; }
.wp-ai-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 480px) {
  .wp-ai-panel { width: calc(100vw - 32px); height: min(520px, calc(100vh - 96px)); }
}
