#oio-agent-root * { box-sizing: border-box; }

.oio-bubble {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer; z-index: 99998;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow .3s, transform .15s;
  animation: oioFadeUp .4s ease-out;
}
.oio-bubble:hover { transform: translateY(-2px); }
.oio-bubble.oio-pulse { box-shadow: 0 0 0 8px rgba(59,130,246,0.18), 0 4px 20px rgba(0,0,0,0.2); }

.oio-badge {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.oio-panel {
  position: fixed; bottom: 24px; right: 24px;
  width: 370px; max-width: calc(100vw - 32px); max-height: 540px;
  border-radius: 16px; overflow: hidden; z-index: 99999;
  background: #fff; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: oioScaleIn .25s ease-out;
}

.oio-head {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.oio-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.oio-head-meta { flex: 1; }
.oio-title { color: #fff; font-size: 14px; font-weight: 600; }
.oio-status { color: #94a3b8; font-size: 11px; display: flex; align-items: center; gap: 5px; }
.oio-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; }
.oio-close {
  background: rgba(255,255,255,0.1); border: none; color: #cbd5e1;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1;
}
.oio-close:hover { background: rgba(255,255,255,0.2); }

.oio-msgs {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f8fafc; min-height: 220px; max-height: 360px;
}
.oio-row { display: flex; }
.oio-row.oio-user { justify-content: flex-end; }
.oio-row.oio-assistant { justify-content: flex-start; }
.oio-msg {
  max-width: 82%; padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; word-wrap: break-word;
}
.oio-user .oio-msg {
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff;
  border-bottom-right-radius: 4px;
}
.oio-assistant .oio-msg {
  background: #fff; color: #1e293b; border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.oio-typing { display: flex; gap: 4px; align-items: center; }
.oio-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #94a3b8;
  animation: oioBounce 1.2s ease-in-out infinite;
}
.oio-typing span:nth-child(2) { animation-delay: .15s; }
.oio-typing span:nth-child(3) { animation-delay: .3s; }

.oio-input {
  padding: 12px 14px; border-top: 1px solid #e2e8f0; background: #fff;
  display: flex; gap: 8px;
}
.oio-input input {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid #e2e8f0;
  font-size: 13.5px; outline: none; background: #f8fafc;
}
.oio-input input:focus { border-color: #3b82f6; background: #fff; }
.oio-input button {
  padding: 0 16px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.oio-input button:disabled { opacity: .5; cursor: default; }

@keyframes oioFadeUp { from { opacity: 0; transform: translateY(10px);} to { opacity:1; transform:translateY(0);} }
@keyframes oioScaleIn { from { opacity: 0; transform: scale(.92) translateY(10px);} to {opacity:1; transform:scale(1) translateY(0);} }
@keyframes oioBounce { 0%,60%,100% { transform: translateY(0);} 30% { transform: translateY(-6px);} }

@media (max-width: 420px) {
  .oio-panel { bottom: 0; right: 0; width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
}

.oio-link { color: #2563eb; text-decoration: underline; word-break: break-all; }
.oio-user .oio-link { color: #fff; }

.oio-lead-form {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px; margin: 4px 0; display: flex; flex-direction: column; gap: 8px;
}
.oio-lead-form input {
  padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13.5px; outline: none;
}
.oio-lead-form input:focus { border-color: #3b82f6; }
.oio-lead-submit {
  padding: 9px 12px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.oio-lead-submit:disabled { opacity: .6; cursor: default; }
.oio-lead-msg { font-size: 13px; font-weight: 500; text-align: center; padding: 4px 0; }
