#fred-cn-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'Alata', Arial, sans-serif;
}

#fred-cn-bubble-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#fred-cn-speak-label {
  background: #000;
  color: #fff;
  font-family: 'Alata', Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 7px 13px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: opacity 0.2s;
}
#fred-cn-speak-label:hover { opacity: 0.85; }

#fred-cn-bubble {
  width: 58px;
  height: 58px;
  background: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
#fred-cn-bubble:hover { transform: scale(1.07); box-shadow: 0 6px 28px rgba(0,0,0,0.45); }
#fred-cn-bubble svg { width: 26px; height: 26px; fill: #fff; }

#fred-cn-panel {
  display: none;
  flex-direction: column;
  width: 370px;
  height: 580px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  animation: fredSlideUp 0.25s ease;
}
#fred-cn-panel.open { display: flex; }

@keyframes fredSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

#fred-cn-header {
  background: #000;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: none;
}
#fred-cn-header-left { display: flex; flex-direction: column; }
#fred-cn-header-title {
  font-family: 'Alata', Arial, sans-serif;
  font-size: 18px;
  color: #fff;
  letter-spacing: 2px;
  line-height: 1;
}
#fred-cn-header-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 3px;
  letter-spacing: 0.5px;
}
#fred-cn-header-right { display: flex; align-items: center; gap: 10px; }

#fred-cn-lang-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  font-family: 'Alata', Arial, sans-serif;
}
#fred-cn-lang-select option { background: #1a1a1a; color: #fff; }

#fred-cn-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
#fred-cn-close:hover { color: #fff; }

#fred-cn-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: #ffffff;
}
#fred-cn-messages::-webkit-scrollbar { width: 4px; }
#fred-cn-messages::-webkit-scrollbar-track { background: transparent; }
#fred-cn-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

.fred-cn-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  gap: 3px;
}
.fred-cn-msg.bot { align-self: flex-start; }
.fred-cn-msg.user { align-self: flex-end; }

.fred-cn-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-family: 'Alata', Arial, sans-serif;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.fred-cn-msg.bot .fred-cn-bubble {
  background: #f1f1f1;
  color: #111111;
  border-bottom-left-radius: 4px;
}
.fred-cn-msg.user .fred-cn-bubble {
  background: #000000;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.fred-cn-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 14px;
  background: #f1f1f1;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.fred-cn-typing span {
  width: 7px; height: 7px;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  animation: fredDot 1.2s infinite;
}
.fred-cn-typing span:nth-child(2) { animation-delay: 0.2s; }
.fred-cn-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fredDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Language reminder banner */
#fred-cn-lang-reminder {
  background: #f8f8f8;
  border-top: 1px solid #eeeeee;
  padding: 7px 14px;
  font-size: 10.5px;
  color: #999999;
  text-align: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  line-height: 1.4;
}

#fred-cn-input-area {
  padding: 12px 14px;
  border-top: 1px solid #eeeeee;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #ffffff;
}

#fred-cn-input {
  flex: 1;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  color: #111111;
  font-size: 14px;
  padding: 10px 12px;
  resize: none;
  outline: none;
  font-family: 'Alata', Arial, sans-serif;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.15s;
}
#fred-cn-input::placeholder { color: #aaaaaa; }
#fred-cn-input:focus { border-color: #bbbbbb; }

#fred-cn-send {
  width: 38px;
  height: 38px;
  background: #000;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#fred-cn-send:hover { background: #333333; }
#fred-cn-send:active { transform: scale(0.95); }
#fred-cn-send svg { width: 16px; height: 16px; fill: #fff; }
#fred-cn-send:disabled { background: #cccccc; cursor: not-allowed; }
#fred-cn-send:disabled svg { fill: rgba(255,255,255,0.5); }

/* Honeypot */
#fred-cn-hp { display: none !important; }

/* Property cards */
.fred-prop-card {
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: block;
  max-width: 100%;
}
.fred-prop-card:hover { border-color: #bbbbbb; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.fred-prop-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: #eeeeee;
}
.fred-prop-card img.img-error { display: none; }
.fred-prop-card-body {
  padding: 10px 12px;
}
.fred-prop-card-name {
  font-size: 13px;
  color: #111111;
  font-family: 'Alata', Arial, sans-serif;
  margin-bottom: 2px;
}
.fred-prop-card-area {
  font-size: 11px;
  color: #888888;
  margin-bottom: 6px;
}
.fred-prop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fred-prop-card-price {
  font-size: 13px;
  color: #111111;
  font-family: 'Alata', Arial, sans-serif;
  font-weight: bold;
}
.fred-prop-card-meta {
  font-size: 10px;
  color: #999999;
}

/* Mobile */
@media (max-width: 600px) {
  #fred-cn-launcher {
    bottom: 0;
    right: 0;
    left: 0;
    gap: 0;
    align-items: flex-end;
    padding: 16px 16px 20px;
  }

  #fred-cn-bubble-row {
    align-self: flex-end;
  }

  #fred-cn-speak-label {
    font-size: 11px;
    padding: 6px 11px;
  }

  #fred-cn-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* accounts for mobile browser chrome */
    border-radius: 0;
    border: none;
  }

  #fred-cn-header {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  #fred-cn-header-title { font-size: 20px; }

  #fred-cn-messages {
    padding: 14px;
    padding-bottom: 8px;
  }

  .fred-cn-bubble { font-size: 15px; padding: 11px 14px; }

  #fred-cn-lang-reminder { font-size: 11px; padding: 8px 14px; }

  #fred-cn-input-area {
    padding: 10px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  #fred-cn-input { font-size: 16px; } /* 16px prevents iOS zoom on focus */

  #fred-cn-send { width: 42px; height: 42px; border-radius: 12px; }

  .fred-prop-card img { height: 160px; }
  .fred-prop-card-name { font-size: 14px; }
  .fred-prop-card-price { font-size: 14px; }
}