#rajchat-root {
  --rc: #1a56db;
  --rc-ink: #111827;
  --rc-muted: #6b7280;
  --rc-line: #e5e7eb;
  --rc-bg: #f6f7fb;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Telugu", "Noto Sans", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--rc-ink);
  text-align: left;
}
#rajchat-root *, #rajchat-root *::before, #rajchat-root *::after { box-sizing: border-box; letter-spacing: normal; text-transform: none; }
#rajchat-root svg { width: 18px; height: 18px; fill: currentColor; display: block; flex: none; }
#rajchat-root button, #rajchat-root input, #rajchat-root textarea { font: inherit; margin: 0; }
#rajchat-root a { text-decoration: none; }
#rajchat-root :focus-visible { outline: 3px solid color-mix(in srgb, var(--rc) 45%, white); outline-offset: 2px; }

/* Launcher */
.rc-launcher {
  position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--rc); color: #fff; margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .25);
  transition: transform .15s ease;
}
#rajchat-root .rc-launcher svg { width: 28px; height: 28px; }
.rc-launcher:hover { transform: scale(1.05); }
.rc-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

/* Panel */
.rc-panel {
  position: absolute; right: 0; bottom: 76px;
  width: 380px; height: 600px; max-height: calc(100vh - 110px);
  background: #fff; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--rc-line);
  box-shadow: 0 16px 48px rgba(17, 24, 39, .18);
  display: flex; flex-direction: column;
  animation: rc-in .18s ease-out;
}
.rc-panel[hidden] { display: none; }
@keyframes rc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rc-header {
  background: var(--rc); color: #fff; padding: 14px 10px 14px 14px;
  display: flex; align-items: center; gap: 10px;
}
.rc-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.2); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.35);
}
.rc-head-text { flex: 1; min-width: 0; }
.rc-name { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-status { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.rc-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.rc-head-actions { display: flex; gap: 2px; }
.rc-icon {
  width: 34px; height: 34px; border-radius: 8px; border: 0; cursor: pointer;
  background: transparent; color: #fff !important;
  display: inline-flex; align-items: center; justify-content: center;
}
.rc-icon:hover { background: rgba(255,255,255,.18); }

/* Body */
.rc-body {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  background: var(--rc-bg);
  display: flex; flex-direction: column; gap: 10px;
}
.rc-msg {
  max-width: 86%; padding: 10px 13px; border-radius: 16px;
  overflow-wrap: anywhere; white-space: normal;
}
.rc-bot { align-self: flex-start; background: #fff; border: 1px solid var(--rc-line); border-bottom-left-radius: 4px; }
.rc-user { align-self: flex-end; background: var(--rc); color: #fff; border-bottom-right-radius: 4px; }
.rc-error { align-self: flex-start; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.rc-msg a { color: inherit; text-decoration: underline; }

.rc-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.rc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: rc-blink 1.2s infinite ease-in-out; }
.rc-typing span:nth-child(2) { animation-delay: .2s; }
.rc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes rc-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* Option buttons */
.rc-options { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.rc-option {
  width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: #fff; color: var(--rc); font-weight: 600;
  border: 1.5px solid color-mix(in srgb, var(--rc) 35%, white);
  transition: background .12s ease, border-color .12s ease;
}
.rc-option:hover { background: color-mix(in srgb, var(--rc) 8%, white); border-color: var(--rc); }
/* Some themes recolour every button on hover (often to white), hiding the label. Keep it dark and readable. */
#rajchat-root .rc-option:hover,
#rajchat-root .rc-option:focus,
#rajchat-root .rc-option:active {
  color: #111827 !important;
  background: color-mix(in srgb, var(--rc) 10%, white) !important;
  border-color: var(--rc) !important;
}

/* Cards (form, services) */
.rc-card {
  align-self: stretch; background: #fff; border: 1px solid var(--rc-line); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; margin: 0;
}
.rc-field { display: flex; flex-direction: column; gap: 4px; }
.rc-field label { font-size: 13px; font-weight: 600; color: #374151; }
.rc-opt { font-weight: 400; color: var(--rc-muted); }
.rc-field input, .rc-field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 10px;
  background: #fff; color: var(--rc-ink); box-shadow: none; min-height: 40px; resize: vertical;
}
.rc-field input:focus, .rc-field textarea:focus { outline: none; border-color: var(--rc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 15%, white); }
.rc-field [aria-invalid="true"] { border-color: #dc2626; }
.rc-card .rc-error, .rc-field .rc-error { background: none; border: 0; padding: 0; color: #dc2626; font-size: 12.5px; min-height: 0; }
.rc-card .rc-error:empty { display: none; }

.rc-primary {
  width: 100%; padding: 11px 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--rc); color: #fff; font-weight: 600;
}
.rc-primary:hover { filter: brightness(1.07); }
.rc-primary:disabled { opacity: .6; cursor: default; }

/* Service chips */
.rc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  background: #fff; color: #374151; border: 1px solid #d1d5db; font-size: 13.5px;
}
.rc-chip:hover { border-color: var(--rc); }
.rc-tick { display: none; }
.rc-chip[aria-pressed="true"] { background: var(--rc); color: #fff; border-color: var(--rc); }
.rc-chip[aria-pressed="true"] .rc-tick { display: inline-flex; }
#rajchat-root .rc-tick svg { width: 15px; height: 15px; }

/* Done actions */
.rc-done { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rc-actions { display: flex; gap: 8px; width: 100%; }
.rc-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border-radius: 10px; font-weight: 600;
  background: var(--rc); color: #fff !important;
}
.rc-action-wa { background: #16a34a; }
.rc-action:hover { filter: brightness(1.07); }
.rc-link { background: none; border: 0; color: var(--rc-muted); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }

/* Composer */
.rc-composer {
  display: flex; align-items: flex-end; gap: 8px; margin: 0;
  padding: 10px 12px; border-top: 1px solid var(--rc-line); background: #fff;
}
.rc-composer[hidden] { display: none; }
.rc-composer textarea {
  flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 12px;
  padding: 10px 12px; color: var(--rc-ink); background: #fff;
  max-height: 110px; min-height: 42px; box-shadow: none;
}
.rc-composer textarea:focus { outline: none; border-color: var(--rc); }
.rc-send {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--rc); color: #fff; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.rc-send:disabled { opacity: .5; cursor: default; }
.rc-foot { font-size: 11px; color: #9ca3af; text-align: center; padding: 6px 0 8px; background: #fff; border-top: 1px solid #f3f4f6; }

/* Mobile: full screen */
@media (max-width: 480px) {
  #rajchat-root { right: 14px; bottom: 14px; }
  #rajchat-root.rc-open { inset: 0; }
  #rajchat-root.rc-open .rc-launcher { display: none; }
  .rc-panel { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .rc-field input, .rc-field textarea, .rc-composer textarea { font-size: 16px; } /* stop iOS zoom */
}

@media (prefers-reduced-motion: reduce) {
  .rc-panel, .rc-typing span, .rc-launcher, .rc-option { animation: none !important; transition: none !important; }
}

/* Pop-up notification */
.rc-teaser {
  position: absolute; right: 0; bottom: 74px;
  width: 300px; max-width: calc(100vw - 28px);
  animation: rc-pop .35s cubic-bezier(.2,.9,.3,1.2);
}
.rc-teaser-body {
  width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; cursor: pointer;
  background: #fff; color: var(--rc-ink); border: 1px solid var(--rc-line); border-radius: 16px; border-bottom-right-radius: 4px;
  padding: 12px 34px 12px 12px; box-shadow: 0 12px 32px rgba(17, 24, 39, .18);
}
.rc-teaser-body:hover { border-color: color-mix(in srgb, var(--rc) 40%, white); }
.rc-avatar-sm { width: 34px; height: 34px; font-size: 12px; background: var(--rc); border: 0; }
.rc-teaser-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-teaser-name { font-weight: 600; font-size: 13px; }
.rc-teaser-msg { font-size: 14px; color: #374151; }
.rc-teaser-close {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: transparent; color: var(--rc-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.rc-teaser-close:hover { background: #f3f4f6; color: var(--rc-ink); }
#rajchat-root .rc-teaser-close svg { width: 14px; height: 14px; }
@keyframes rc-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.rc-launcher:has(.rc-badge) { animation: rc-nudge 1s ease 2; }
@keyframes rc-nudge { 0%,100% { transform: none; } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce) { .rc-teaser, .rc-launcher { animation: none !important; } }
