:root {
  /* ExpressExchange palette (assets/css/styles.css) */
  --ee-bg: #10100f;
  --ee-panel: #141413;
  --ee-glass: rgba(16, 16, 15, 0.55);
  --ee-border: #2a2a27;
  --ee-text: #e1e1e1;
  --ee-muted: #9d9d9b;
  --ee-muted-2: #5a5a57;
  --ee-accent: #c7f829;
  --ee-accent-text: #1a1a18;

  --chat-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

/* container */
#chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: inherit;
}

/* local reset */
#chat-widget,
#chat-widget * {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

/* ===================== FAB ===================== */
#chat-fab {
  position: relative;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 56px !important;
  height: 56px !important;
  padding: 0 !important;

  border-radius: 18px !important;
  border: 1px solid var(--ee-border) !important;

  background: var(--ee-glass) !important;
  color: #ffffff !important;

  box-shadow: var(--chat-shadow) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  cursor: pointer !important;
  line-height: 1 !important;
  text-decoration: none !important;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

#chat-fab:hover {
  background: rgba(20, 20, 19, 0.75) !important;
  border-color: rgba(199, 248, 41, 0.55) !important;
  color: var(--ee-accent) !important;
  transform: scale(0.97);
}

#chat-fab .chat-fab-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#chat-fab svg {
  display: block !important;
}

/* badge */
#chat-badge {
  position: absolute !important;
  right: -6px !important;
  top: -6px !important;

  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;

  border-radius: 999px !important;
  border: 2px solid rgba(16, 16, 15, 0.95) !important;

  background: #ff3b30 !important;
  color: #fff !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

/* dot mode (when session not created yet) */
#chat-badge[data-dot="1"] {
  min-width: 12px !important;
  height: 12px !important;
  padding: 0 !important;
  font-size: 0 !important;
}

/* when chat open — hide FAB */
#chat-widget.is-open #chat-fab {
  display: none !important;
}

/* ===================== WINDOW ===================== */
#chat-window {
  width: 380px;
  height: min(600px, 78vh);

  display: flex;
  flex-direction: column;

  background: rgba(20, 20, 19, 0.82);
  border: 1px solid var(--ee-border);
  border-radius: 24px;
  box-shadow: var(--chat-shadow);
  overflow: hidden;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  margin-bottom: 12px;
}

@media (max-width: 420px) {
  #chat-window {
    width: calc(100vw - 24px);
    height: min(680px, 82vh);
  }
}

/* header */
#chat-header {
  flex: 0 0 auto;

  padding: 14px 14px;
  background: rgba(16, 16, 15, 0.35);
  border-bottom: 1px solid var(--ee-border);

  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat-title {
  font-weight: 800;
  color: #fff;
  line-height: 1.05;
  font-size: 18px;
  letter-spacing: -0.6px;
}

#chat-subtitle {
  font-size: 13px;
  color: var(--ee-muted);
  margin-top: 4px;
  letter-spacing: -0.3px;
}

#chat-close {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;

  border: 1px solid transparent !important;
  background: transparent !important;
  color: rgba(225, 225, 225, 0.65) !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  cursor: pointer !important;
  font-size: 26px !important;
  line-height: 1 !important;

  border-radius: 12px !important;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

#chat-close:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(199, 248, 41, 0.25) !important;
  color: #fff !important;
  transform: scale(0.97);
}

/* messages */
#chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow: auto;

  background:
    radial-gradient(
      700px 280px at 15% 0%,
      rgba(199, 248, 41, 0.08),
      rgba(199, 248, 41, 0) 60%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0) 45%);
}

/* bubble base */
.msg {
  max-width: 86%;
  margin: 0 0 12px 0;
  padding: 12px 14px;

  border-radius: 18px;
  border: 1px solid rgba(42, 42, 39, 0.9);

  white-space: pre-wrap;
  word-break: break-word;

  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}

/* operator bubble */
.msg.operator {
  margin-right: auto;
  background: rgba(42, 42, 39, 0.8);
  color: #fff;
}

/* user bubble */
.msg.user {
  margin-left: auto;
  background: var(--ee-accent);
  color: var(--ee-accent-text);
  border-color: transparent;
}

/* system bubble */
.msg.system {
  max-width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(225, 225, 225, 0.75);
  border-style: dashed;
}

/* meta time */
.msg-meta {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 8px;
}

/* ===================== INPUT ===================== */
#chat-input {
  flex: 0 0 auto;

  display: flex !important;
  align-items: center !important;
  gap: 10px !important;

  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));

  border-top: 1px solid var(--ee-border);
  background: rgba(16, 16, 15, 0.35);
}

#chat-text {
  flex: 1 !important;
  width: auto !important;
  min-width: 0 !important;

  color: #fff !important;
  background: rgba(16, 16, 15, 0.55) !important;

  border: 1px solid var(--ee-border) !important;
  border-radius: 14px !important;

  padding: 12px 14px !important;
  height: 46px !important;

  outline: none !important;
  box-shadow: none !important;

  font: inherit !important;
  letter-spacing: -0.6px !important; /* как на сайте */
  line-height: 1.2 !important;
  caret-color: var(--ee-accent) !important;
}

#chat-text::placeholder {
  color: rgba(157, 157, 155, 0.65) !important;
}

#chat-send {
  width: 46px !important;
  height: 46px !important;
  padding: 0 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  border-radius: 14px !important;
  border: 0 !important;

  background: var(--ee-accent) !important;
  color: var(--ee-accent-text) !important;

  cursor: pointer !important;
  line-height: 1 !important;

  box-shadow: none !important;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

#chat-send:hover {
  background: #fff !important;
  transform: scale(0.97);
}

#chat-send svg {
  display: block !important;
}

@media (max-width: 360px) {
  #chat-window {
    border-radius: 20px;
  }
}

#chat-widget .hidden {
  display: none !important;
}

.msg.system.error {
  border-style: solid;
  border-color: rgba(255, 59, 48, 0.65);
  background: rgba(255, 59, 48, 0.1);
  color: #ffb4ae;
}
