

#aiChatbot {
  --accent:#0169AB;
  --bg-start: rgb(242,242,242);
  --bg-end:   rgb(218,216,216);
  --panel:#ffffff;
  --panel-2:#ffffff;
  --fg:#1f2937;
  --muted:#6b7280;
  --border:#e5e7eb;
  --link:#0169AB;
  --bubble-user:#f7f7f9;
  --bubble-ai:#eaf5ff;
  --radius:16px;
  font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  color:var(--fg);
}

#aiChatbot, #aiChatbot * { box-sizing:border-box; }

#aiChatbot .fab{
  position:fixed; right:20px; bottom:20px; z-index:1050;
  width:58px; height:58px; border-radius:50%;
  display:grid; place-items:center; cursor:pointer;
  background: var(--accent);
  color:#fff; border:none; box-shadow:0 10px 24px rgba(0,0,0,.22);
  font-weight:700; letter-spacing:.2px; text-decoration:none;
  transition:transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
#aiChatbot .fab:hover{ transform:translateY(-2px); box-shadow:0 14px 28px rgba(0,0,0,.28); filter:brightness(1.05) }
#aiChatbot .fab:active{ transform:translateY(0) }

#aiChatbot .overlay{
  position:fixed; inset:0; z-index:1040;
  background:rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display:none;
  align-items:center; justify-content:center;
  padding:24px;
}
#aiChatbot .overlay.open{ display:flex; }

#aiChatbot .modal{
  width: min(1100px, 96vw);
  height: min(88vh, 920px);
  background: linear-gradient(180deg,var(--panel-2),var(--panel));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  display:grid; grid-template-rows: auto 1fr auto;
  overflow:hidden;
  transform: scale(.98); opacity:0; transition: transform .15s ease, opacity .15s ease;
}
#aiChatbot .overlay.open .modal{ transform: scale(1); opacity:1; }

#aiChatbot header.app{
  display:flex; align-items:center; gap:.75rem; padding:12px 16px;
  background:#0169AB; color:#fff; border-bottom:1px solid rgba(0,0,0,.06);
}
#aiChatbot header.app h1{ font-size:16px; margin:0; letter-spacing:.3px; color:#fff; }
#aiChatbot header.app .dot{ width:8px;height:8px;border-radius:50%; background:#04af2f; }
#aiChatbot header.app .btn{
  background:rgba(255,255,255,.15);
  color:#fff;
  border:1px solid rgba(255,255,255,.35);
  border-radius:10px;
  padding:8px 12px; cursor:pointer;
}
#aiChatbot header.app .btn:hover{ background:rgba(255,255,255,.25); border-color:rgba(255,255,255,.55); }
#aiChatbot header.app #btnClose{ background:#fff; color:#0169AB; border-color:#fff; }

#aiChatbot .dot{width:8px;height:8px;border-radius:50%;background:var(--accent)}
#aiChatbot .spacer{flex:1}
#aiChatbot .btn{
  appearance:none; border:1px solid var(--border); color:var(--fg); background:#fff;
  padding:8px 12px; border-radius:10px; cursor:pointer; font-size:14px
}
#aiChatbot .btn:hover{ border-color:#d1d5db }
#aiChatbot .btn.ghost{ background:transparent }
#aiChatbot .btn.accent{ border-color:transparent; background:var(--accent); color:#fff }
#aiChatbot .btn.danger{ border-color:#ef4444; color:#ef4444; background:#fff }

#aiChatbot details.settings{ background:#fafafa; border-bottom:1px solid var(--border) }
#aiChatbot details.settings summary{ cursor:pointer; padding:10px 16px; list-style:none; color:var(--muted); outline:none }
#aiChatbot details[open].settings summary{ color:var(--fg) }
#aiChatbot .settings-grid{ display:grid; gap:12px; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); padding:0 16px 16px }
#aiChatbot label{ font-size:12px; color:var(--muted); display:block; margin-bottom:6px }
#aiChatbot input[type="text"],
#aiChatbot input[type="number"],
#aiChatbot input[type="password"]{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:#fff; color:var(--fg);
}
#aiChatbot .row{ display:flex; align-items:center; gap:10px }
#aiChatbot .small{ font-size:12px; color:var(--muted) }

#aiChatbot #chat{ padding:18px 16px; overflow:auto; background:transparent }
#aiChatbot .msg{ display:flex; gap:10px; margin:12px 0 }
#aiChatbot .msg .avatar{
  width:28px;height:28px;border-radius:50%; background:#e5f2fb;
  color:#024e80; border:1px solid #dbeafe; display:grid; place-items:center; font-size:14px
}
#aiChatbot .msg.user .avatar{ background:#f3f4f6; color:#374151; border-color:#e5e7eb }
#aiChatbot .bubble{
  max-width:860px; padding:12px 14px; border-radius:14px; border:1px solid var(--border);
  white-space:pre-wrap; word-wrap:break-word; color:var(--fg);font-size: 13px;
}
#aiChatbot .msg.user .bubble{ background:var(--bubble-user) }
#aiChatbot .msg.ai .bubble{ background:var(--bubble-ai) }
#aiChatbot .meta{ font-size:12px; color:var(--muted); margin-top:6px }

#aiChatbot .composer{ border-top:1px solid var(--border); padding:12px 16px; background:#fff }
#aiChatbot .composer .bar{ display:flex; gap:10px }
#aiChatbot textarea{
  flex:1; resize:vertical; min-height:44px; max-height:160px;
  padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:#fff; color:var(--fg)
}
#aiChatbot .status{ min-height:20px }
#aiChatbot .spinner{
  display:inline-block;width:18px;height:18px;border:2px solid var(--border);
  border-top-color:var(--accent); border-radius:50%; animation:spin .9s linear infinite; vertical-align:-4px
}
@keyframes spin{to{transform:rotate(360deg)}}
#aiChatbot a{ color:var(--link); text-decoration:underline; }


#aiChatbot .hidden{ display:none }

#aiChatbot .composer .bottom {
  display:flex; align-items:center; justify-content:space-between; margin-top:6px;
}
#aiChatbot .version { font-size:12px; color: var(--muted); }
