#sparkai-root { position: fixed; right: 18px; bottom: 84px; z-index: 99999; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
#sparkai-toggle { position: relative; width: auto; height: 56px; border: 0; border-radius: 28px; background: #1247cd; color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.28); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 20px 0 16px; }
#sparkai-toggle:hover { background: #0e3ab0; }
#sparkai-toggle .sparkai-bubble { display: flex; align-items: center; gap: 10px; }
#sparkai-toggle svg { width: 26px; height: 26px; fill: #fff; flex: none; }
#sparkai-toggle .sparkai-label { font-size: 16px; font-weight: 700; line-height: 1; white-space: nowrap; }
#sparkai-toggle .sparkai-x { display: none; width: 28px; height: 28px; }
#sparkai-root.open #sparkai-toggle { width: 60px; height: 60px; padding: 0; border-radius: 50%; }
#sparkai-root.open #sparkai-toggle .sparkai-bubble { display: none; }
#sparkai-root.open #sparkai-toggle .sparkai-x { display: block; }
#sparkai-badge { display: none; position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e02424; color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
#sparkai-badge.show { display: flex; }
#sparkai-teaser { display: none; }
#sparkai-panel { display: none; position: absolute; right: 0; bottom: 72px; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 120px)); background: #f4f6fb; border-radius: 16px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.28); flex-direction: column; }
#sparkai-root.open #sparkai-panel { display: flex; }
#sparkai-home, #sparkai-chat, #sparkai-prechat { display: none; flex: 1; min-height: 0; flex-direction: column; }
#sparkai-root.open:not(.view-chat):not(.view-prechat) #sparkai-home, #sparkai-root.view-chat #sparkai-chat, #sparkai-root.view-prechat #sparkai-prechat { display: flex; }
#sparkai-prechat { background: #fff; }
#sparkai-prechat-head { background: #1247cd; color: #fff; padding: 22px 18px 18px; display: flex; align-items: flex-start; gap: 8px; }
#sparkai-prechat-head strong { display: block; font-size: 22px; font-weight: 600; line-height: 1.25; }
#sparkai-prechat-body { flex: 1; overflow: auto; padding: 22px 16px 16px; }
#sparkai-prechat-body > p { margin: 0 0 18px; text-align: center; font-size: 16px; line-height: 1.4; color: #222; }
#sparkai-prechat-box { border: 1px solid #e4e4e4; border-radius: 8px; padding: 16px; }
#sparkai-prechat-box input { width: 100%; box-sizing: border-box; border: 1px solid #c8c8c8; border-radius: 4px; padding: 14px 12px; margin: 0 0 12px; font: inherit; font-size: 16px; color: #222; }
#sparkai-prechat-box input:focus { outline: 2px solid rgba(18,71,205,.25); border-color: #1247cd; }
#sparkai-start { width: 100%; border: 0; border-radius: 4px; background: #1247cd; color: #fff; padding: 14px 12px; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
#sparkai-start:hover { background: #0e3ab0; }
#sparkai-prechat-error { display: none; margin: 0 0 10px; color: #b42318; font-size: 13px; }
#sparkai-prechat-error.show { display: block; }
#sparkai-home-head, #sparkai-head { background: #1247cd; color: #fff; padding: 18px 16px 16px; }
#sparkai-home-head strong { display: block; font-size: 22px; font-weight: 700; }
.sparkai-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 700; line-height: 1; }
.sparkai-status i { width: 8px; height: 8px; border-radius: 50%; background: #fff; display: block; flex: none; box-shadow: 0 0 0 3px rgba(255,255,255,.28); }
#sparkai-home-head p { margin: 8px 0 0; font-size: 14px; line-height: 1.4; opacity: .95; }
#sparkai-home-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sparkai-card { background: #fff; border: 0; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.08); text-align: left; }
.sparkai-card-title { padding: 12px 14px 0; font-size: 13px; font-weight: 700; color: #545454; }
#sparkai-search { width: 100%; border: 1px solid #e4e6ee; border-radius: 8px; margin: 10px 0 4px; padding: 11px 12px; font: inherit; font-size: 14px; }
#sparkai-search-form { padding: 0 12px; }
.sparkai-topic { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-top: 1px solid #eef0f4; background: #fff; padding: 12px 14px; font: inherit; font-size: 15px; color: #1c1c1c; cursor: pointer; text-align: left; }
.sparkai-topic:first-of-type { border-top: 0; }
.sparkai-topic em { font-style: normal; color: #1247cd; font-size: 20px; line-height: 1; }
.sparkai-topic:hover { background: #f7fbf8; }
#sparkai-no-match { display: none; margin: 0; padding: 8px 14px 12px; color: #666; font-size: 13px; }
#sparkai-no-match:not([hidden]) { display: block; }
.sparkai-chat-card { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 14px; cursor: pointer; }
.sparkai-chat-card strong { font-size: 15px; color: #1c1c1c; }
.sparkai-chat-card span { font-size: 13px; color: #666; }
.sparkai-chat-card:hover { background: #f7fbf8; }
#sparkai-continue[hidden] { display: none; }
#sparkai-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
#sparkai-back, #sparkai-prechat-back { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 28px; line-height: 1; cursor: pointer; flex: none; }
#sparkai-head strong { display: block; font-size: 16px; }
#sparkai-head .sparkai-status { margin-top: 4px; font-size: 12px; }
#sparkai-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sparkai-msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; white-space: normal; line-height: 1.45; font-size: 14px; }
.sparkai-msg p { margin: 0 0 8px; }
.sparkai-msg p:last-child, .sparkai-msg ul:last-child, .sparkai-msg ol:last-child { margin-bottom: 0; }
.sparkai-msg ul, .sparkai-msg ol { margin: 4px 0 8px; padding-left: 18px; }
.sparkai-msg li { margin: 4px 0; }
.sparkai-msg strong, .sparkai-cat { font-weight: 700; }
.sparkai-cat { margin: 10px 0 4px; }
.sparkai-product { display: flex; align-items: center; gap: 10px; margin: 8px 0; text-decoration: none; color: inherit; }
.sparkai-product img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #eef1f6; flex: none; }
.sparkai-product span { color: #1247cd; font-weight: 700; text-decoration: underline; }
.sparkai-choice { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 6px 0 0; padding: 10px 12px; border: 1px solid #e4e6ee; border-radius: 8px; background: #f7f9fc; color: #1c1c1c; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-align: left; }
.sparkai-choice span { color: #1c1c1c; font-weight: 700; text-decoration: none; }
.sparkai-choice em { font-style: normal; color: #1247cd; font-weight: 700; }
.sparkai-choice:hover { background: #eef3fb; }
.sparkai-msg a { color: #1247cd; font-weight: 700; text-decoration: underline; word-break: break-word; }
.sparkai-user a { color: #fff; }
.sparkai-bot { background: #fff; color: #1c1c1c; align-self: flex-start; }
.sparkai-user { background: #1247cd; color: #fff; align-self: flex-end; }
#sparkai-form { display: flex; gap: 8px; padding: 10px; background: #fff; }
#sparkai-form input { flex: 1; border: 1px solid #d5d8e0; border-radius: 10px; padding: 10px 12px; font: inherit; }
#sparkai-form button { border: 0; border-radius: 10px; background: #1247cd; color: #fff; padding: 0 14px; font-weight: 700; cursor: pointer; }
#sparkai-form button:disabled { opacity: .6; cursor: default; }
@media (max-width: 760px) {
  #sparkai-root { right: 12px; bottom: 78px; }
  #sparkai-toggle { height: 52px; padding: 0 16px 0 14px; }
  #sparkai-toggle .sparkai-label { font-size: 15px; }
}
