:root {
  --saim-bg: #ffffff;
  --saim-fg: #0f172a;
  --saim-muted: #64748b;
  --saim-primary: #00a8e8;
  --saim-border: #e5e7eb;
}

.saim-chat {
  width: 360px;
  max-width: 100%;
  border: 1px solid var(--saim-border);
  border-radius: 12px;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, PingFang SC, Microsoft YaHei;
  background: var(--saim-bg);
  color: var(--saim-fg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  z-index: 9998;
}

.saim-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--saim-border);
  font-weight: 600;
  position: relative;
}

.saim-messages {
  height: 420px;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
}

.saim-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.saim-msg.user { justify-content: flex-end; }
.saim-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.saim-msg.user .saim-bubble {
  background: var(--saim-primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.saim-msg.bot .saim-bubble {
  background: white;
  border: 1px solid var(--saim-border);
  border-bottom-left-radius: 4px;
}

.saim-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--saim-border);
  background: var(--saim-bg);
}
.saim-inputbar input {
  flex: 1;
  border: 1px solid var(--saim-border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
.saim-inputbar button {
  background: var(--saim-primary);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
}

.saim-muted { color: var(--saim-muted); font-size: 12px; }

/* Close (minimize) button in header */
.saim-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--saim-muted);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.saim-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--saim-fg);
}
.saim-close svg {
  width: 14px;
  height: 14px;
}

/* Floating toggle button shown when minimized */
.saim-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--saim-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  z-index: 9999;
}

.saim-toggle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.saim-toggle img {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.saim-toggle:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.20);
  transform: translateY(-1px);
}

.saim-hidden { display: none !important; }


