#optiai-chat-root {
  --chat-accent: var(--accent-purple, #7256e8);
  --chat-surface: var(--bg-card, #ffffff);
  --chat-field: var(--bg-input, #f5f6fa);
  --chat-ink: var(--text-primary, #172039);
  --chat-secondary: var(--text-secondary, #59627a);
  --chat-muted: var(--text-muted, #81899e);
  --chat-border: var(--border-color, rgba(30, 39, 69, .12));
  position: fixed;
  z-index: 1090;
  right: 24px;
  bottom: 24px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--chat-ink);
}

#optiai-chat-root *, #optiai-chat-root *::before, #optiai-chat-root *::after { box-sizing: border-box; }
#optiai-chat-root [hidden] { display: none !important; }

#optiai-chat-root.optiai-chat-with-guide { bottom: 84px; z-index: 1030; }
#optiai-chat-root.optiai-chat-with-guide .optiai-chat-panel {
  height: min(540px, calc(100dvh - 158px));
  min-height: 0;
}

.optiai-chat-launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 17px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: var(--chat-accent);
  box-shadow: 0 9px 28px rgba(27, 22, 70, .2);
  color: #fff;
  font: 600 14px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.optiai-chat-launch:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(27, 22, 70, .26); }
.optiai-chat-launch:focus-visible, .optiai-chat-close:focus-visible,
.optiai-chat-send:focus-visible, .optiai-chat-input:focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 3px;
}
.optiai-chat-send svg, .optiai-chat-close svg { display: block; width: 19px; height: 19px; }
.optiai-chat-mark { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.optiai-chat-mark img { display: block; width: 27px; height: 27px; }

.optiai-chat-panel {
  display: none;
  width: min(380px, calc(100vw - 24px));
  height: min(540px, calc(100dvh - 98px));
  min-height: 340px;
  margin-bottom: 12px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  background: var(--chat-surface);
  box-shadow: 0 20px 60px rgba(13, 10, 46, .28);
  flex-direction: column;
}
#optiai-chat-root[data-open="true"] .optiai-chat-panel { display: flex; }
.optiai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--chat-border);
}
.optiai-chat-head .optiai-chat-mark { width: 36px; height: 36px; background: var(--chat-field); border: 1px solid var(--chat-border); }
.optiai-chat-head .optiai-chat-mark img { width: 32px; height: 32px; }
.optiai-chat-heading { flex: 1; min-width: 0; }
.optiai-chat-title { margin: 0; color: var(--chat-ink); font-size: 15px; font-weight: 650; line-height: 1.25; }
.optiai-chat-subtitle { margin: 4px 0 0; color: var(--chat-muted); font-size: 12px; line-height: 1.35; }
.optiai-chat-close {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1px solid var(--chat-border); border-radius: 9px; background: transparent;
  color: var(--chat-secondary); cursor: pointer;
}
.optiai-chat-close:hover { background: var(--chat-field); color: var(--chat-ink); }
.optiai-chat-messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}
.optiai-chat-message {
  max-width: 88%; width: fit-content; padding: 11px 13px;
  border-radius: 13px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 13px; line-height: 1.55; text-align: left;
}
.optiai-chat-message--assistant { align-self: flex-start; background: var(--chat-field); color: var(--chat-ink); border: 1px solid var(--chat-border); border-bottom-left-radius: 4px; }
.optiai-chat-message--user { align-self: flex-end; background: var(--chat-accent); color: #fff; border-bottom-right-radius: 4px; }
.optiai-chat-message--status { align-self: flex-start; color: var(--chat-secondary); background: transparent; padding-left: 0; }
.optiai-chat-lead { flex: none; padding: 11px 13px; border-top: 1px solid var(--chat-border); background: var(--chat-surface); }
.optiai-chat-lead-open {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--chat-accent);
  border-radius: 10px; background: transparent; color: var(--chat-accent);
  font: 600 12px/1.3 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer;
}
.optiai-chat-lead-open:hover { background: var(--chat-field); }
.optiai-chat-lead-form { display: grid; gap: 8px; max-height: 38dvh; overflow-y: auto; }
.optiai-chat-lead-form label { display: grid; gap: 4px; color: var(--chat-secondary); font-size: 11px; font-weight: 600; }
.optiai-chat-lead-form input {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--chat-border);
  border-radius: 9px; background: var(--chat-field); color: var(--chat-ink);
  font: 12px/1.35 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.optiai-chat-lead-form input:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 1px; }
.optiai-chat-lead-form p { margin: 1px 0; color: var(--chat-muted); font-size: 10px; line-height: 1.35; }
.optiai-chat-lead-form a { color: var(--chat-accent); text-decoration: underline; }
.optiai-chat-lead-actions { display: flex; gap: 7px; }
.optiai-chat-lead-actions button {
  min-height: 36px; padding: 7px 10px; border: 1px solid var(--chat-border); border-radius: 9px;
  background: transparent; color: var(--chat-secondary); font: 600 11px/1.25 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer;
}
.optiai-chat-lead-actions button[type="submit"] { flex: 1; border-color: var(--chat-accent); background: var(--chat-accent); color: #fff; }
.optiai-chat-lead-actions button:disabled { opacity: .55; cursor: default; }
.optiai-chat-lead-status { color: var(--chat-secondary); font-size: 11px; line-height: 1.35; }
.optiai-chat-lead-status:empty { display: none; }
.optiai-chat-composer { display: flex; align-items: flex-end; gap: 9px; padding: 13px; border-top: 1px solid var(--chat-border); }
.optiai-chat-input {
  display: block; flex: 1; min-width: 0; min-height: 42px; max-height: 110px;
  padding: 10px 12px; resize: none; border: 1px solid var(--chat-border);
  border-radius: 11px; background: var(--chat-field); color: var(--chat-ink);
  font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.optiai-chat-input::placeholder { color: var(--chat-muted); opacity: 1; }
.optiai-chat-send {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 11px; background: var(--chat-accent); color: #fff; cursor: pointer;
}
.optiai-chat-send:hover { filter: brightness(1.08); }
.optiai-chat-send:disabled { opacity: .55; cursor: default; filter: none; }
.optiai-chat-footnote { padding: 0 14px 11px; color: var(--chat-muted); font-size: 11px; line-height: 1.3; }

@media (max-width: 575px) {
  #optiai-chat-root { right: 12px; bottom: 12px; }
  .optiai-chat-panel { height: min(620px, calc(100dvh - 78px)); margin-bottom: 9px; border-radius: 15px; }
  .optiai-chat-launch { min-height: 46px; }
  #optiai-chat-root.optiai-chat-with-guide { bottom: 72px; }
  #optiai-chat-root.optiai-chat-with-guide .optiai-chat-panel {
    height: min(620px, calc(100dvh - 138px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .optiai-chat-launch { transition: none; }
  .optiai-chat-launch:hover { transform: none; }
}
