#bsc-launcher,
#public-chat {
  --bsc-yellow: #ffdc3e;
  --bsc-purple: #7750b7;
  --bsc-ink: #272b35;
  --bsc-muted: #697181;
  --bsc-line: #e4e5eb;
  color: var(--bsc-ink);
  font: 15px/1.45 Arial, Helvetica, sans-serif;
  box-sizing: border-box;
}
#bsc-launcher svg,
#public-chat svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#bsc-launcher {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 17px;
  min-height: 47px;
  border: 1px solid #e7c32c;
  border-radius: 14px;
  background: var(--bsc-yellow);
  color: #332a16;
  box-shadow: 0 6px 24px #3c321b28;
  font-weight: 700;
  cursor: pointer;
}
#bsc-launcher:hover { background: #ffe45d; }
#bsc-launcher[hidden], #public-chat:not([open]), #public-chat [hidden] { display: none !important; }

#public-chat {
  position: fixed;
  inset: auto max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) auto;
  z-index: 2147483001;
  display: flex;
  flex-direction: column;
  width: min(430px, calc(100vw - 48px));
  height: min(790px, calc(100dvh - 48px));
  min-width: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dfe1e8;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 15px 65px #232d4424;
  text-align: left;
  color-scheme: light;
}
#public-chat *, #public-chat *::before, #public-chat *::after { box-sizing: border-box; }
#public-chat :is(h2,h3,p,small,label) { font-family: inherit; letter-spacing: normal; }
#public-chat :is(button,input,textarea) { font: inherit; color: inherit; letter-spacing: normal; }
#public-chat button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
#public-chat button:disabled { opacity: .58; cursor: default; }
#bsc-launcher:focus-visible,
#public-chat :is(button,input,textarea,a):focus-visible,
#public-chat .bsc-attach:focus-within { outline: 2px solid #7750b7; outline-offset: 2px; }
#public-chat :is(#bsc-heading,#bsc-title):focus { outline: 0; }
#public-chat :is(input:not([type=checkbox],[type=file]),textarea) {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d4d8e2;
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  line-height: 1.4;
}
#public-chat a, #public-chat .bsc-text { color: #694495; text-decoration: underline; text-underline-offset: 3px; }
#public-chat .bsc-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bsc-line);
}
#public-chat .bsc-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 13px;
  background: var(--bsc-yellow);
  color: #6b4d13;
  font-size: 27px;
  font-weight: 700;
}
#public-chat .bsc-heading-wrap { min-width: 0; }
#public-chat .bsc-header h2 { margin: 0; color: var(--bsc-ink); font-size: 19px; line-height: 1.2; font-weight: 700; }
#public-chat .bsc-header p { margin: 5px 0 0; color: var(--bsc-muted); font-size: 13px; line-height: 1.3; }
#public-chat .bsc-header-actions { display: flex; flex: none; gap: 2px; margin-left: auto; }
#public-chat .bsc-icon { width: 34px; height: 34px; padding: 0; color: var(--bsc-muted); }
#public-chat .bsc-icon:hover, #public-chat #bsc-back:hover { background: #f0f1f5; }
#public-chat .bsc-identity {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
  min-height: 49px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--bsc-line);
  background: #fbfbfc;
  font-size: 14px;
  font-weight: 700;
}
#public-chat.is-administrator .bsc-identity { background: #faf7ff; }
#public-chat .bsc-avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  border-radius: 50%;
  background: #f1e8ff;
  color: #7952ae;
  font-size: 12px;
  font-weight: 700;
}
#public-chat .bsc-identity .bsc-avatar { width: 29px; height: 29px; background: #fff0b5; color: #715616; font-size: 13px; }
#public-chat.is-administrator .bsc-identity .bsc-avatar { background: #eadcf8; color: #744fa0; }
#public-chat #bsc-identity { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#public-chat :is(#bsc-profile,#bsc-admin) { margin-left: auto; }
#public-chat .bsc-tag { padding: 3px 6px; border-radius: 5px; background: #eee4fb; color: #704a9c; font-size: 11px; font-weight: 700; white-space: nowrap; }
#public-chat .bsc-profile { flex: none; padding: 12px 16px; border-bottom: 1px solid var(--bsc-line); background: #fcfaff; }
#public-chat .bsc-profile-actions { display: flex; align-items: center; gap: 9px; margin: 8px 0 5px; }
#public-chat .bsc-profile label, #public-chat #bsc-first-name-row label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 700; }
#public-chat small { color: var(--bsc-muted); font-size: 12px; }
#public-chat .bsc-view { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: auto; }
#public-chat .bsc-tools { flex: none; padding: 13px 16px 9px; border-bottom: 1px solid var(--bsc-line); }
#public-chat .bsc-search { position: relative; }
#public-chat .bsc-search svg { position: absolute; top: 10px; left: 10px; width: 18px; height: 18px; color: var(--bsc-muted); pointer-events: none; }
#public-chat #bsc-search { padding-left: 35px; background: #f8f9fb; }
#public-chat .bsc-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
#public-chat .bsc-filters button { color: var(--bsc-muted); font-size: 14px; font-weight: 700; }
#public-chat .bsc-filters button[aria-pressed=true] { background: #efe8f8; color: #583681; }
#public-chat .bsc-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#public-chat .bsc-list > p { margin: 0; padding: 18px 16px; color: var(--bsc-muted); }
#public-chat .bsc-question { display: block; width: 100%; padding: 12px 16px; border-bottom: 1px solid #ededf1; border-radius: 0; text-align: left; }
#public-chat .bsc-question:hover, #public-chat .bsc-question:focus-visible { background: #faf8fd; outline-offset: -2px; }
#public-chat .bsc-question strong { display: block; color: inherit; line-height: 1.4; overflow-wrap: anywhere; }
#public-chat .bsc-question small { display: block; margin-top: 4px; }
#public-chat .bsc-list-footer { flex: none; padding: 11px 16px 13px; border-top: 1px solid var(--bsc-line); text-align: center; }
#public-chat .bsc-list-footer .bsc-primary { width: 100%; }
#public-chat .bsc-list-footer small { display: block; margin-top: 6px; }
#public-chat button.bsc-primary { min-height: 40px; padding: 9px 14px; border-radius: 9px; background: var(--bsc-yellow); color: #332a16; font-weight: 700; }
#public-chat button.bsc-primary:hover { background: #ffd522; }
#public-chat .bsc-backbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  padding: 7px 15px;
  border-bottom: 1px solid var(--bsc-line);
}
#public-chat #bsc-back { gap: 5px; padding-left: 0; font-size: 14px; }
#public-chat .bsc-thread-top { flex: none; padding: 10px 16px; border-bottom: 1px solid var(--bsc-line); }
#public-chat .bsc-thread-top h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0;
  color: var(--bsc-ink);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}
#public-chat .bsc-thread-top p { margin: 4px 0 0; color: var(--bsc-muted); font-size: 12px; line-height: 1.4; }
#public-chat .bsc-topic-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #ece6f2;
  color: #8c6b20;
  font-size: 12px;
}
#public-chat .bsc-topic-actions.is-resolved { color: #50745a; }
#public-chat #bsc-resolve { flex: none; min-height: 28px; padding: 4px 7px; border: 1px solid #e1d5ef; border-radius: 6px; color: #714b9c; font-size: 12px; }
#public-chat #bsc-resolve:hover { background: #f7f1fc; }
#public-chat .bsc-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 58px;
  padding: 18px 16px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: #fafafd;
}
#public-chat .bsc-msg { display: flex; align-items: flex-start; align-self: flex-start; gap: 8px; max-width: 94%; }
#public-chat .bsc-msg.is-admin { flex-direction: row-reverse; align-self: flex-end; }
#public-chat .is-admin .bsc-avatar { background: #eadcf8; color: #744fa0; }
#public-chat .bsc-bubble { min-width: 0; padding: 11px 12px; border: 1px solid #e2e4eb; border-radius: 12px; background: #fff; }
#public-chat .is-admin .bsc-bubble { border-color: #e6daf5; background: #f6f1fc; }
#public-chat .bsc-msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 5px; }
#public-chat .bsc-msg-meta strong { color: var(--bsc-ink); font-size: 13px; overflow-wrap: anywhere; }
#public-chat .bsc-msg-meta time { margin-left: auto; color: var(--bsc-muted); font-size: 11px; }
#public-chat .bsc-bubble p { margin: 0; color: var(--bsc-ink); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
#public-chat .bsc-bubble img { display: block; width: auto; height: auto; max-width: 100%; max-height: 180px; margin-top: 8px; border-radius: 7px; }
#public-chat .bsc-composer { flex: none; padding: 11px 16px 13px; border-top: 1px solid var(--bsc-line); background: #fff; }
#public-chat #bsc-first-name-row { margin-bottom: 9px; }
#public-chat #bsc-label { display: block; margin: 0 0 5px; color: var(--bsc-muted); font-size: 12px; }
#public-chat.is-administrator #bsc-label { color: #755396; }
#public-chat .bsc-composer-box { overflow: hidden; border: 1px solid #d4d8e2; border-radius: 12px; background: #fff; }
#public-chat .bsc-composer-box:focus-within { border-color: #9e82c6; box-shadow: 0 0 0 2px #c8b5df40; }
#public-chat #bsc-message { min-height: 64px; max-height: 145px; padding: 11px 12px 4px; border: 0; border-radius: 0; outline: 0; resize: none; }
#public-chat .bsc-composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 0 7px 7px; }
#public-chat.is-administrator #bsc-send { background: var(--bsc-purple); color: #fff; }
#public-chat.is-administrator #bsc-send:hover { background: #664299; }
#public-chat .bsc-attach { display: flex; align-items: center; gap: 5px; min-height: 36px; padding: 5px 7px; border-radius: 7px; color: #7950b2; cursor: pointer; font-size: 13px; }
#public-chat .bsc-attach:hover { background: #f6f1fc; }
#public-chat .bsc-attach input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; clip-path: inset(50%); }
#public-chat .bsc-selected-image { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
#public-chat #bsc-file-name { min-width: 0; overflow-wrap: anywhere; }
#public-chat .bsc-consent { display: flex; align-items: flex-start; gap: 7px; margin: 8px 0 0; color: var(--bsc-muted); font-size: 12px; line-height: 1.4; }
#public-chat .bsc-consent input { width: 15px; height: 15px; flex: none; margin: 1px 0 0; accent-color: var(--bsc-purple); }
#public-chat #bsc-draft { margin: 7px 0 0; color: var(--bsc-muted); font-size: 11px; }
#public-chat .bsc-readonly, #public-chat .bsc-retry { flex: none; margin: 0; padding: 9px 16px; background: #faf9fc; color: var(--bsc-muted); font-size: 13px; }
#public-chat .bsc-status:not(:empty) { flex: none; max-height: 72px; padding: 7px 16px; overflow: auto; background: #f3f1f8; font-size: 13px; overflow-wrap: anywhere; }
#public-chat .bsc-status.is-error:not(:empty) { background: #fff2ee; color: #812f1e; }
#public-chat #bsc-reload { flex: none; align-self: flex-start; margin: 2px 10px; font-size: 13px; }

@media (max-width: 500px) {
  #bsc-launcher {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 43px;
    padding: 8px 12px;
    font-size: 14px;
  }
  #public-chat {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(430px, calc(100vw - max(8px,env(safe-area-inset-left)) - max(8px,env(safe-area-inset-right))));
    height: min(790px, calc(100dvh - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom))));
    border-radius: 16px;
  }
  #public-chat .bsc-header { gap: 8px; padding: 11px 12px; }
  #public-chat .bsc-header h2 { font-size: 17px; }
  #public-chat .bsc-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 23px; }
  #public-chat .bsc-icon { width: 30px; }
  #public-chat :is(input:not([type=checkbox],[type=file]),textarea) { font-size: 16px; }
  #public-chat :is(.bsc-identity,.bsc-backbar,.bsc-messages,.bsc-thread-top,.bsc-composer) { padding-inline: 12px; }
  #public-chat .bsc-msg { max-width: 98%; }
}
@media (max-height: 610px) {
  #public-chat .bsc-header { padding-block: 8px; }
  #public-chat .bsc-identity { min-height: 40px; padding-block: 5px; }
  #public-chat .bsc-backbar, #public-chat .bsc-thread-top { padding-block: 5px; }
  #public-chat .bsc-messages { padding-block: 8px; }
  #public-chat .bsc-composer { padding-block: 7px; }
  #public-chat #bsc-message { min-height: 46px; height: 52px; }
}
@media (max-height: 400px) {
  #public-chat #bsc-subtitle { display: none; }
  #public-chat .bsc-mark { width: 32px; height: 32px; font-size: 22px; }
  #public-chat .bsc-messages { min-height: 40px; }
}
