/* CypherSys ULTRA — same visual design as current chatbot */
:root {
  --cs-blue: #2b6cff;
  --cs-blue2: #1d4ed8;
  --cs-panel: #ffffff;
  --cs-muted: #6b7280;
  --cs-border: rgba(15, 23, 42, 0.12);
  --cs-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  --cs-radius: 18px;
  --cs-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* FAB wrapper: small fixed area so tap works on iOS; only FAB size, does not block page */
.csw-fab-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 2147483000;
  display: inline-block;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(43, 108, 255, 0.3);
  touch-action: manipulation;
}
.csw-fab {
  position: relative;
  margin: 0;
  z-index: 2147483000;
  font-family: var(--cs-font);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--cs-blue), var(--cs-blue2));
  box-shadow: var(--cs-shadow);
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(43, 108, 255, 0.3);
  touch-action: manipulation;
}
.csw-fab img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.csw-fab span {
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* Panel: fixed above FAB; no wrapper so page content is never blocked */
.csw-panel {
  position: fixed;
  right: 18px;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 120px);
  z-index: 2147482999;
  font-family: var(--cs-font);
  background: var(--cs-panel);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow);
  overflow: hidden;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s ease;
}
.csw-panel.csw-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.csw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: linear-gradient(180deg, rgba(43, 108, 255, 0.12), rgba(43, 108, 255, 0));
  border-bottom: 1px solid var(--cs-border);
}
.csw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.csw-brand img {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  border: 1px solid var(--cs-border);
}
.csw-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.csw-title b {
  font-size: 15px;
  color: #0f172a;
}
.csw-title small {
  color: var(--cs-muted);
  font-size: 12px;
  margin-top: 2px;
}

.csw-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 18px;
}
.csw-close:hover {
  background: rgba(2, 6, 23, 0.06);
}

.csw-body {
  padding: 14px;
  height: 380px;
  overflow: auto;
  background:
    radial-gradient(900px 280px at 50% -40px, rgba(43, 108, 255, 0.16), transparent 60%),
    radial-gradient(700px 220px at 80% 110px, rgba(29, 78, 216, 0.12), transparent 60%),
    #fff;
}

.csw-row {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  align-items: flex-start;
}
.csw-row.csw-row-user {
  justify-content: flex-end;
}

.csw-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(43, 108, 255, 0.2), rgba(29, 78, 216, 0.1));
  border: 1px solid var(--cs-border);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.csw-avatar svg {
  width: 28px;
  height: 28px;
  opacity: 0.95;
  fill: #1d4ed8;
}
.csw-bubble {
  max-width: 250px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--cs-border);
  background: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  font-size: 14px;
  line-height: 1.35;
  color: #0f172a;
  word-break: break-word;
}
.csw-bubble.csw-user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(43, 108, 255, 0.12), rgba(29, 78, 216, 0.08));
}

/* Source links below bot message (ULTRA) */
.csw-meta {
  font-size: 11px;
  color: var(--cs-muted);
  margin-top: 8px;
}
.csw-links {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.csw-links a {
  color: #1d4ed8;
  text-decoration: underline;
  font-size: 12px;
}
.csw-links a:hover {
  color: var(--cs-blue);
}

.csw-footer {
  padding: 12px;
  border-top: 1px solid var(--cs-border);
  background: #fff;
}
.csw-inputwrap {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--cs-border);
  background: #fff;
}
.csw-input {
  width: 100%;
  border: 0;
  outline: none;
  font-size: 14px;
  background: transparent;
  font-family: var(--cs-font);
  color: #0f172a;
}
.csw-input::placeholder {
  color: var(--cs-muted);
}

.csw-send {
  width: 40px;
  height: 40px;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cs-blue), var(--cs-blue2));
  display: grid;
  place-items: center;
  box-shadow: 0 10px 25px rgba(43, 108, 255, 0.25);
}
.csw-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.csw-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.csw-footnote {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cs-muted);
  font-size: 12px;
}
.csw-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.csw-status {
  font-size: 11px;
  color: var(--cs-muted);
  margin-top: 2px;
}

@media (max-width: 460px) {
  .csw-panel {
    width: calc(100vw - 24px);
    right: 12px;
  }
  .csw-fab-wrap {
    right: 12px;
  }
}

body.cookie-consent-visible .csw-fab-wrap,
body.cookie-consent-visible .csw-fab,
body.cookie-consent-visible .csw-panel {
  display: none !important;
}
