:root{
  --bg: #f5f1ee;
  --ink: #1f2430;
  --muted: #666c78;
  --navy: #16284c;
  --line:#d7d0ca;
  --surface:#ffffff;
  --surface-2:#f8f5f2;
  --user:#2f4f9a;
  --shadow: 0 18px 40px rgba(22,40,76,.18), 0 4px 12px rgba(22,40,76,.08);
}

html,body{
  margin:0;
  font-family: Inter, Arial, sans-serif;
  background: transparent;
}

.chat-fab{
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  min-width: 122px;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #355cc0 0%, #2e4f9d 100%);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.chat-fab:hover{ transform: translateY(-1px); }
.chat-fab.hidden{ opacity:0; pointer-events:none; }

.chat-widget{
  position: fixed;
  right: 24px;
  bottom: 86px;
  width: 410px;
  height: 650px;
  background: rgba(248,245,242,.95);
  backdrop-filter: blur(12px);
  color: var(--ink);
  border: 1px solid rgba(22,40,76,.10);
  border-radius: 24px;
  overflow: hidden;
  z-index: 10000;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateY(18px) scale(.96);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}
.chat-widget.open{
  transform: translateY(0) scale(1);
  opacity: 1;
}
.hidden{ display:none !important; }

.chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 16px 14px 16px;
  background: linear-gradient(180deg, rgba(22,40,76,.97) 0%, rgba(22,40,76,.94) 100%);
  color:#fff;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.brand-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-mark{
  width:12px;
  height:12px;
  border-radius:4px;
  background:#6d89d8;
  box-shadow: 16px 0 0 #6d89d8, 0 16px 0 #6d89d8, 16px 16px 0 #6d89d8;
  transform: scale(.55);
  transform-origin: left top;
}
.chat-title{
  font-size:15px;
  font-weight:800;
  letter-spacing:.01em;
}
.chat-actions{
  display:flex;
  gap:8px;
}
.icon-btn{
  width:34px;
  height:34px;
  border:0;
  border-radius:12px;
  background: rgba(255,255,255,.10);
  color:#fff;
  cursor:pointer;
  font-size:14px;
}

.messages{
  flex:1;
  overflow-y:auto;
  padding:16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 100%),
    var(--surface-2);
}
.message{
  max-width: 88%;
  margin-bottom: 12px;
  padding: 13px 15px;
  border-radius: 18px;
  line-height: 1.48;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(22,40,76,.05);
}
.message.user{
  margin-left:auto;
  background: linear-gradient(180deg, #3560d4 0%, #3056b8 100%);
  color:#fff;
  border-bottom-right-radius: 8px;
  white-space: pre-wrap;
}
.message.assistant{
  background: #fff;
  color: var(--ink);
  border:1px solid rgba(22,40,76,.08);
  border-bottom-left-radius:8px;
}
.label{ font-weight: 800; margin-bottom: 4px; color: var(--navy); }
.section{ color: var(--ink); }
.spacer{ height: 8px; }

.typing{
  display:flex;
  gap:6px;
  padding: 0 18px 10px 18px;
  align-items:center;
}
.typing span{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#7b8391;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2){ animation-delay:.2s; }
.typing span:nth-child(3){ animation-delay:.4s; }
@keyframes blink{
  0%,80%,100%{ opacity:.25; transform:scale(.9);}
  40%{ opacity:1; transform:scale(1);}
}

.composer{
  display:grid;
  grid-template-columns: 1fr 48px;
  gap:10px;
  padding:14px;
  border-top:1px solid rgba(22,40,76,.08);
  background: rgba(255,255,255,.68);
}
textarea{
  width:100%;
  box-sizing:border-box;
  border-radius:16px;
  border:1px solid rgba(22,40,76,.14);
  background:#fff;
  color:var(--ink);
  padding:12px 14px;
  font:inherit;
  resize:none;
  outline:none;
}
textarea::placeholder{ color:#7b8391; }
.send-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:16px;
  background: linear-gradient(180deg, #355cc0 0%, #2e4f9d 100%);
  color:#fff;
  cursor:pointer;
  font-size:16px;
  box-shadow: 0 8px 18px rgba(47,79,154,.28);
}
