/* ---------------------------------------------------------
   CHAT WIDGET
   --------------------------------------------------------- */
.chat-widget{
  position: fixed;
  right: 26px;
  bottom: 112px;
  z-index: 950;
  width: 372px;
  max-width: calc(100vw - 32px);
  max-height: min(600px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(20,15,5,0.24);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(.92) translateY(12px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s;
}
html[data-theme="dark"] .chat-widget{
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.chat-widget.is-open{
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s;
}

.chat-widget-header{
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.chat-widget-avatar{
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--orange);
}
.chat-widget-title{
  display:flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  min-width: 0;
}
.chat-widget-title strong{
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.chat-widget-title span{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display:flex;
  align-items:center;
  gap: 5px;
}
.chat-widget-title span::before{
  content:"";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3bc276;
  flex-shrink: 0;
}
.chat-widget-close{
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  flex-shrink: 0;
  align-self: flex-start;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-widget-close svg{ width: 16px; height: 16px; }
.chat-widget-close:hover{
  background: var(--hairline);
  color: var(--ink);
}

.chat-widget-body{
  padding: 20px 16px;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 220px;
}
.chat-bubble-row{
  display:flex;
  align-items:flex-start;
  gap: 10px;
}
.chat-bubble-avatar{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}
.chat-bubble{
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

.chat-widget-body{
  display:flex;
  flex-direction: column;
  gap: 14px;
}
.chat-bubble-wrap{
  display:flex;
  flex-direction: column;
  gap: 8px;
  max-width: 82%;
}
.chat-bubble-row--user{
  justify-content: flex-end;
}
.chat-bubble--user{
  background: linear-gradient(135deg, var(--orange), #ff8a3d);
  color: #fff;
  border: none;
  border-radius: 16px 16px 4px 16px;
  max-width: 82%;
}
.chat-bubble-action{
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--orange);
  border: 1px solid var(--orange);
  border-radius: 999px;
  padding: 7px 14px;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-bubble-action:hover{
  background: var(--orange);
  color: #fff;
}

.chat-suggestions{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.chat-suggestion-chip{
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-suggestion-chip:hover{
  border-color: var(--orange);
  color: var(--orange);
}

.chat-widget-footer{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.chat-widget-input{
  flex-grow: 1;
  min-width: 0;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
}
.chat-widget-input::placeholder{ color: var(--muted); }
.chat-widget-input:focus{
  outline: none;
  border-color: var(--orange);
}
.chat-widget-send{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #FF8A3D);
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(255,106,43,0.35);
  transition: transform var(--dur-fast) var(--ease);
}
.chat-widget-send svg{ width: 17px; height: 17px; }
.chat-widget-send:hover{ transform: translateY(-2px) scale(1.05); }

@media (max-width: 640px){
  .chat-widget{
    right: 16px;
    bottom: 96px;
    width: calc(100vw - 32px);
  }
}