:root {
  --str-chat-primary-color: var(--accent);
  --str-chat-primary-color-hover: var(--accent-h);
  --str-chat-font-family: var(--font-ui);
  --str-chat-text-color: var(--ink);
  --str-chat-muted-color: var(--ink-3);
  --str-chat-bg-color: var(--bg-card);
}

.kuestify-chat-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.kuestify-chat-trigger {
  position: relative;
}

.kuestify-chat-trigger .kuestify-chat-unread {
  position: absolute;
  top: -8px;
  right: -8px;
}

.kuestify-chat-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 28%, transparent);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.kuestify-chat-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.kuestify-chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(500px, 100vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.kuestify-chat-drawer.is-open {
  transform: translateX(0);
}

.kuestify-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.kuestify-chat-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.kuestify-chat-status {
  padding: 8px 16px;
  font-size: 0.78rem;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
}

.kuestify-chat-channel-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.kuestify-chat-channel-pill {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.kuestify-chat-channel-pill.is-active {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent);
}

.kuestify-chat-body {
  overflow-y: auto;
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.kuestify-chat-msg {
  max-width: 84%;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.84rem;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.kuestify-chat-msg.is-own {
  margin-left: auto;
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.kuestify-chat-msg-meta {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--ink-4);
}

.kuestify-chat-input-wrap {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.kuestify-chat-input {
  min-height: 38px;
  max-height: 140px;
  resize: vertical;
}

@media (max-width: 640px) {
  .kuestify-chat-drawer {
    width: 100vw;
  }
}
