:root {
  --sc-brand: #0891b2;
  --sc-brand-dark: #0e7490;
  --sc-bg: #ffffff;
  --sc-text: #0f172a;
  --sc-muted: #64748b;
  --sc-border: #e2e8f0;
  --sc-user: #ecfeff;
  --sc-bot: #f8fafc;
  --sc-shadow: 0 12px 40px rgba(8, 145, 178, 0.18);
}

#sobe-chat-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.sobe-chat-toggle {
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sc-brand) 0%, var(--sc-brand-dark) 100%);
  color: #fff;
  box-shadow: var(--sc-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sobe-chat-toggle:hover {
  transform: scale(1.05);
}

.sobe-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--sc-bg);
  border: 1px solid var(--sc-border);
  border-radius: 18px;
  box-shadow: var(--sc-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.sobe-chat-panel.open {
  display: flex;
}

.sobe-chat-header {
  background: linear-gradient(135deg, var(--sc-brand) 0%, var(--sc-brand-dark) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sobe-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.sobe-chat-header p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.sobe-chat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
}

.sobe-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.sobe-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.sobe-chat-msg.bot p {
  margin: 0 0 0.65em;
}

.sobe-chat-msg.bot p:last-child {
  margin-bottom: 0;
}

.sobe-chat-msg.bot strong {
  font-weight: 700;
  color: #0f172a;
}

.sobe-chat-msg.bot em {
  font-style: italic;
}

.sobe-chat-msg.bot strong.sobe-chat-em {
  color: #dc2626;
  font-weight: 700;
}

.sobe-chat-inline-link {
  color: var(--sc-brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(14, 116, 144, 0.35);
  transition: color 0.15s ease, text-decoration-color 0.15s ease, background-color 0.15s ease;
  border-radius: 3px;
}

.sobe-chat-inline-link:hover {
  color: #0e7490;
  background-color: rgba(8, 145, 178, 0.08);
  text-decoration-color: var(--sc-brand);
}

.sobe-chat-msg.user {
  align-self: flex-end;
  background: var(--sc-user);
  border: 1px solid #a5f3fc;
  color: var(--sc-text);
}

.sobe-chat-msg.bot {
  align-self: flex-start;
  background: var(--sc-bot);
  border: 1px solid var(--sc-border);
  color: var(--sc-text);
}

.sobe-chat-msg.typing {
  color: var(--sc-muted);
  font-style: italic;
}

.sobe-chat-nav-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: var(--sc-brand-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.sobe-chat-nav-link:hover {
  background: #cffafe;
}

.sobe-chat-input {
  border-top: 1px solid var(--sc-border);
  padding: 12px;
  display: flex;
  gap: 8px;
  background: #fff;
}

.sobe-chat-input textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  border: 1px solid var(--sc-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.sobe-chat-input button {
  border: 0;
  border-radius: 12px;
  background: var(--sc-brand);
  color: #fff;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}

.sobe-chat-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sobe-chat-status {
  padding: 8px 12px;
  font-size: 12px;
  color: #b45309;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  display: none;
}

.sobe-chat-status.show {
  display: block;
}

@media (max-width: 640px) {
  #sobe-chat-root {
    right: 16px;
    bottom: 16px;
  }

  .sobe-chat-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
  }
}
