.sm-chatbot {
  --chat-primary: #0E4FA1;
  --chat-navy: #2C3263;
  --chat-blue: #4F8DDA;
  --chat-bg: #F5F7FC;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  font-family: "Instrument Sans", system-ui, sans-serif;
}

.sm-chat-toggle {
  width: auto;
  min-width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-primary), #1768C5);
  box-shadow: 0 18px 38px -12px rgba(14, 79, 161, .65);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.sm-chat-toggle:hover { transform: translateY(-3px); box-shadow: 0 22px 42px -12px rgba(14, 79, 161, .75); }
.sm-chat-toggle svg { width: 27px; height: 27px; }
.sm-chat-label { font-size: 13px; font-weight: 700; }

.sm-chat-window {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(370px, calc(100vw - 28px));
  height: min(590px, calc(100vh - 110px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #D8E2EF;
  border-radius: 22px;
  box-shadow: 0 30px 80px -28px rgba(44, 50, 99, .55);
}

.sm-chatbot.is-open .sm-chat-window { display: grid; animation: smChatOpen .22s ease-out both; }
@keyframes smChatOpen { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.sm-chat-header {
  padding: 17px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-navy), #343D78);
}

.sm-chat-avatar {
  width: 40px;
  height: 40px;
  padding: 5px;
  display: grid;
  place-items: center;
  flex: none;
  background: #fff;
  border-radius: 12px;
}

.sm-chat-avatar img { width: 100%; height: 100%; object-fit: contain; }
.sm-chat-title { font-weight: 700; font-size: 15px; }
.sm-chat-status { margin-top: 2px; color: #C9D9EE; font-size: 11.5px; display:flex;align-items:center;gap:5px }
.sm-chat-status i{width:6px;height:6px;border-radius:50%;background:#65d8aa;box-shadow:0 0 0 3px rgba(101,216,170,.13)}
.sm-chat-close { margin-left: auto; border: 0; background: transparent; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }

.sm-chat-messages {
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(44, 50, 99, .045) 1px, transparent 0) 0 0/20px 20px,
    var(--chat-bg);
}

.sm-chat-row { display: flex; margin-bottom: 12px; }
.sm-chat-row.user { justify-content: flex-end; }
.sm-chat-bubble { max-width: 86%; padding: 11px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.sm-chat-row.bot .sm-chat-bubble { color: #394261; background: #fff; border: 1px solid #DDE5F1; border-bottom-left-radius: 5px; }
.sm-chat-row.user .sm-chat-bubble { color: #fff; background: var(--chat-primary); border-bottom-right-radius: 5px; }
.sm-chat-bubble a { color: var(--chat-primary); font-weight: 700; text-decoration: none; }
.sm-chat-link{display:block;margin-top:9px}
.sm-chat-actions{display:flex;gap:7px;margin-top:10px}.sm-chat-actions a{background:#eaf2fc;border-radius:8px;padding:7px 9px;font-size:11.5px}
.sm-chat-note { display: block; margin-top: 7px; color: #75809C; font-size: 11px; }

.sm-chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 14px; }
.sm-chat-suggestion {
  border: 1px solid #BFD1E9;
  border-radius: 99px;
  padding: 7px 10px;
  color: var(--chat-primary);
  background: #fff;
  font: 600 11.5px/1.2 "Instrument Sans", sans-serif;
  cursor: pointer;
}
.sm-chat-suggestion:hover { background: #EAF2FC; }

.sm-chat-footer{background:#fff;border-top:1px solid #DDE5F1}.sm-chat-form { padding: 12px 12px 6px; display: flex; gap: 8px; background: #fff; }
.sm-chat-input { min-width: 0; flex: 1; border: 1px solid #D8E2EF; border-radius: 12px; padding: 11px 12px; color: #2C3263; background: #F9FBFE; font: 14px "Instrument Sans", sans-serif; outline: none; }
.sm-chat-input:focus { border-color: var(--chat-blue); box-shadow: 0 0 0 3px rgba(79, 141, 218, .13); }
.sm-chat-send { width: 42px; flex: none; border: 0; border-radius: 12px; color: #fff; background: var(--chat-primary); cursor: pointer; font-size: 17px;display:grid;place-items:center }
.sm-chat-send svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sm-chat-privacy{display:block;text-align:center;color:#8a94ad;font-size:10px;padding:0 10px 9px}
.sm-chat-typing .sm-chat-bubble{display:flex;gap:4px;padding:13px}.sm-chat-typing i{width:5px;height:5px;border-radius:50%;background:#8ba0bc;animation:smTyping 1s infinite ease-in-out}.sm-chat-typing i:nth-child(2){animation-delay:.14s}.sm-chat-typing i:nth-child(3){animation-delay:.28s}@keyframes smTyping{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-3px);opacity:1}}

@media (max-width: 600px) {
  .sm-chatbot { right: 12px; bottom: 76px; }
  .sm-chat-toggle { width: 50px; min-width:50px; height: 50px; border-radius: 16px;padding:0 }
  .sm-chat-toggle svg{width:24px;height:24px}
  .sm-chat-label{display:none}
  .sm-chatbot.is-open>.sm-chat-toggle{display:none}
  .sm-chat-window {
    position: fixed;
    inset: auto 8px calc(78px + env(safe-area-inset-bottom));
    width: auto;
    height: min(620px, calc(100dvh - 156px - env(safe-area-inset-bottom)));
    min-height: 420px;
    max-height: none;
    border-radius: 20px;
    border-color:#cbd9ea;
    box-shadow:0 26px 70px -24px rgba(23,37,84,.55);
  }
  .sm-chat-header{
    position:static!important;
    inset:auto!important;
    width:auto!important;
    min-height:66px;
    padding:12px 14px!important;
    color:#fff!important;
    background:linear-gradient(135deg,var(--chat-navy),#343D78)!important;
    backdrop-filter:none!important;
    box-shadow:none!important;
  }
  .sm-chat-avatar{display:grid!important;width:38px;height:38px;border-radius:11px}
  .sm-chat-header>span{display:block!important;min-width:0}
  .sm-chat-title{display:block!important;font-size:14px}
  .sm-chat-status{display:flex!important;font-size:10.5px}
  .sm-chat-status i{display:block!important}
  .sm-chat-close{display:grid!important;place-items:center;width:40px;height:40px;flex:0 0 40px;border-radius:11px;background:rgba(255,255,255,.1);font-size:23px}
  .sm-chat-messages{min-height:0;padding:14px 12px;overscroll-behavior:contain}
  .sm-chat-row{margin-bottom:10px}
  .sm-chat-bubble{max-width:91%;padding:10px 12px;font-size:13px;line-height:1.45}
  .sm-chat-suggestions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:3px 0 10px}
  .sm-chat-suggestion{min-height:40px;padding:7px 9px;border-radius:11px;font-size:11px;text-align:left}
  .sm-chat-footer{position:relative;z-index:2}
  .sm-chat-form{padding:9px 9px 5px;gap:7px}
  .sm-chat-input{height:46px;padding:10px 12px;font-size:16px;border-radius:12px}
  .sm-chat-send{width:46px;height:46px;border-radius:12px}
  .sm-chat-privacy{display:block!important;padding:0 10px 7px;font-size:9px}
}

@media (max-width: 360px) {
  .sm-chat-window{left:6px;right:6px;min-height:390px}
  .sm-chat-suggestions{grid-template-columns:1fr}
}

@media (prefers-reduced-motion: reduce) {
  .sm-chatbot *, .sm-chatbot *::before, .sm-chatbot *::after { animation: none !important; transition: none !important; }
}
