:root {
  --lorac-primary: #050620;
  --lorac-accent: #CBF8FF;
  --lorac-bubble: #ffffff;
  --lorac-text: #0f172a;
  --lorac-muted: #64748b;
}

#lorac-root {
  position: fixed;
  bottom: 22px;
  z-index: 99999;
  font-family: Inter, Arial, sans-serif;
}
#lorac-root.lorac-pos-left { left: 20px; }
#lorac-root.lorac-pos-right { right: 20px; }

.lorac-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 232px;
  border: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--lorac-text);
  padding: 10px 14px 10px 10px;
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  cursor: pointer;
}
.lorac-toggle:hover { transform: translateY(-1px); }
.lorac-toggle-avatar,
.lorac-avatar,
.lorac-nudge-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--lorac-accent), #e7fbff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #09111f;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.lorac-toggle-avatar img,
.lorac-avatar img,
.lorac-nudge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lorac-toggle-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.lorac-toggle-text strong { font-size: 14px; font-weight: 700; }
.lorac-toggle-text small { color: var(--lorac-muted); font-size: 12px; }
.lorac-toggle-pulse {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.5);
  animation: loracPulse 1.8s infinite;
}
@keyframes loracPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.lorac-nudge {
  position: absolute;
  bottom: 82px;
  left: 0;
  width: 300px;
  max-width: calc(100vw - 24px);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--lorac-text);
  border-radius: 22px;
  box-shadow: 0 18px 55px rgba(15, 23, 42, .18);
  border: 1px solid rgba(255,255,255,.6);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .28s ease;
}
.lorac-nudge.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lorac-pos-right .lorac-nudge { right: 0; left: auto; }
.lorac-nudge-copy strong { display: block; font-size: 14px; margin-bottom: 3px; }
.lorac-nudge-copy div { font-size: 13px; color: var(--lorac-muted); }

#lorac-window {
  position: absolute;
  bottom: 0;
  width: 378px;
  max-width: calc(100vw - 24px);
  height: min(690px, calc(100vh - 28px));
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .24);
}
.lorac-pos-left #lorac-window { left: 0; }
.lorac-pos-right #lorac-window { right: 0; }
#lorac-window.lorac-hidden { display: none; }

.lorac-header {
  position: relative;
  padding: 18px 18px 14px;
  background: linear-gradient(155deg, var(--lorac-primary), #172554 76%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lorac-header-backdrop {
  position: absolute;
  inset: auto auto -30px -30px;
  width: 180px;
  height: 100px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,0));
  pointer-events: none;
}
.lorac-profile,
.lorac-header-actions {
  position: relative;
  z-index: 1;
}
.lorac-profile { display: flex; align-items: center; gap: 12px; }
.lorac-profile strong { display: block; font-size: 15px; }
.lorac-profile div div { font-size: 12px; opacity: .9; }
.lorac-sep { opacity: .55; margin: 0 4px; }
.lorac-online { color: #bef264; }
.lorac-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  margin-left: 8px;
}

.lorac-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(248,250,252,.92), rgba(255,255,255,.8));
}
.lorac-subheader strong { display:block; font-size: 13px; color: var(--lorac-text); }
.lorac-subheader span { display:block; margin-top:3px; font-size: 12px; color: var(--lorac-muted); }
.lorac-call-link {
  text-decoration: none;
  color: var(--lorac-primary);
  background: rgba(203,248,255,.8);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.lorac-messages {
  height: calc(100% - 222px);
  overflow-y: auto;
  padding: 16px 16px 18px;
  background:
    radial-gradient(circle at top left, rgba(203,248,255,.58), transparent 24%),
    linear-gradient(180deg, rgba(250,252,255,.95), rgba(246,248,252,.96));
}

.lorac-msg { margin-bottom: 14px; }
.lorac-msg-meta {
  font-size: 11px;
  color: var(--lorac-muted);
  margin: 0 0 5px 8px;
}
.lorac-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8efff;
  color: #334155;
  font-size: 10px;
}
.lorac-bubble {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 8px;
  background: var(--lorac-bubble);
  color: var(--lorac-text);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .08);
  font-size: 14px;
  line-height: 1.5;
}
.lorac-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.lorac-user .lorac-msg-meta { margin: 0 8px 5px 0; }
.lorac-user .lorac-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8 70%, #1e3a8a);
  color: #fff;
  border-radius: 18px 18px 8px 18px;
}

.lorac-typing span {
  display:inline-block;
  width:8px;
  height:8px;
  margin-right:4px;
  border-radius:50%;
  background:#94a3b8;
  animation: loracBounce 1s infinite ease-in-out;
}
.lorac-typing span:nth-child(2) { animation-delay: .15s; }
.lorac-typing span:nth-child(3) { animation-delay: .3s; margin-right: 0; }
@keyframes loracBounce {
  0%,80%,100% { transform: translateY(0); opacity: .6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.lorac-chips {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding: 12px 16px 0;
  background: rgba(255,255,255,.76);
}
.lorac-chips button {
  border: 1px solid rgba(37,99,235,.08);
  background: #fff;
  color: var(--lorac-text);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15,23,42,.04);
}

.lorac-input-wrap {
  padding: 12px 14px 10px;
  background: rgba(255,255,255,.92);
  border-top: 1px solid rgba(148,163,184,.14);
}
.lorac-input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #dbe4ef;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 10px 22px rgba(15,23,42,.05);
}
.lorac-input-shell input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--lorac-text);
}
.lorac-input-shell input::placeholder { color: #94a3b8; }
.lorac-input-shell button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(37,99,235,.3);
}
.lorac-input-shell button svg { width: 20px; height: 20px; }
.lorac-footer-note {
  font-size: 11px;
  color: var(--lorac-muted);
  padding: 0 16px 14px;
  background: rgba(255,255,255,.92);
}

.lorac-lead-card {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(203,213,225,.6);
  border-radius: 20px;
  padding: 14px;
  margin: 14px 0 6px;
  box-shadow: 0 18px 40px rgba(15,23,42,.08);
}
.lorac-lead-title { font-weight: 700; font-size: 15px; color: var(--lorac-text); }
.lorac-lead-card p { margin: 6px 0 10px; font-size: 13px; color: var(--lorac-muted); }
.lorac-lead-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:8px; }
.lorac-lead-card input,
.lorac-lead-card textarea {
  width:100%;
  border:1px solid #dbe3ef;
  border-radius: 14px;
  padding:10px 12px;
  font-size: 13px;
  box-sizing:border-box;
}
.lorac-lead-card textarea { min-height: 76px; resize: vertical; margin-top: 8px; }
.lorac-lead-card button {
  margin-top: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--lorac-primary), #172554);
  color:#fff;
  padding: 11px 16px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 600;
}

@media (max-width: 640px) {
  #lorac-root.lorac-pos-left,
  #lorac-root.lorac-pos-right {
    left: 12px;
    right: 12px;
  }
  .lorac-toggle {
    min-width: 0;
    width: auto;
    max-width: calc(100vw - 24px);
  }
  #lorac-window {
    width: calc(100vw - 24px);
    height: min(78vh, 700px);
    border-radius: 24px;
  }
  .lorac-nudge {
    width: calc(100vw - 24px);
  }
  .lorac-bubble { max-width: 90%; }
  .lorac-lead-grid { grid-template-columns:1fr; }
}
